Posts

Showing posts from January, 2013

Convert ios app to android using phonegap -

i have made sample application in ios using phonegap framework. have used plugins navigation bar , tab bar. want deploy app android. should now? whether should make android using phonegap framework eclipse or there other way it? can make build directly android using phone gap? in android,set weblink below setcontentview in mainactivity in android

java - i have a class like this. FileCache.class. this method is used to create a dir in SDCard. it work well -

i have class this.... want know when inherit clear method use in mainactivity.class. delete file cache, right? ( if class there wrong please fill me) , how can use method clear in mainactivity? public class filecache { private file cachedir; public filecache(context context){ //find dir save cached images if (android.os.environment.getexternalstoragestate().equals(android.os.environment.media_mounted)) cachedir=new file(android.os.environment.getexternalstoragedirectory(),"lao su kun fung"); else cachedir=context.getcachedir(); if(!cachedir.exists()) cachedir.mkdirs(); } public file getfile(string url){ . string filename=string.valueof(url.hashcode()); file f = new file(cachedir, filename); return f; } public void clear(){ file[] files=cachedir.listfiles(); if(files==null) return; for(file f:files) f.delete(); } } public class mainactivity extends activity{ filecache fi...

c - How to close a file? -

i felt @ peace posix after many years of experience. then read this message linus torvalds, circa 2002: int ret; { ret = close(fd); } while(ret == -1 && errno != ebadf); no. the above is (a) not portable (b) not current practice the "not portable" part comes fact (as pointed out), threaded environment in kernel does close fd on errors, fd may have been validly re-used (by kernel) other thread, , closing fd second time bug. not looping until ebadf unportable, loop is, due race condition have noticed if hadn't "made peace" taking such things granted. however, in gcc c++ standard library implementation, basic_file_stdio.cc , have __err = fclose(_m_cfile); while (__err && errno == eintr); the primary target library linux, seems not heeding linus. as far i've come understand, eintr happens after system call blocks , implies kernel received request free ...

java - why equals method must have equality operator comparison -

when override equals method write code below public boolean equals(object obj) { //why need use piece of code **if (obj == this) { return true; }** // how above 2 lines help. instead not want have == on object comparison //i prefer remove above 2 lines. cause issue? if (obj == null || obj.getclass() != this.getclass()) { return false; } person guest = (person) obj; return id == guest.id && (firstname == guest.firstname || (firstname != null && firstname.equals(guest.getfirstname()))) && (lastname == guest.lastname || (lastname != null && lastname .equals(guest.getlastname()))); } what if 2 object references pointing same object. there no need check firstname , lastname inside them equality once both pointing same instance. above code make logic perform better when 2 references point...

ios - know MPMusicPlayerController song playing finished -

i implementing 1 ios app playing songs in foreground , background using mpmusicplayercontroller . when in foreground able go next song using below code. long currentplaybacktime = musicplayer.currentplaybacktime; //nslog(@"%lu",currentplaybacktime); int currenthours = (currentplaybacktime / 3600); int currentminutes = ((currentplaybacktime / 60) - currenthours*60); int currentseconds = (currentplaybacktime % 60); // total duration of track... long totalplaybacktime = ([[[musicplayer nowplayingitem] valueforproperty: @"playbackduration"] longvalue])-currentplaybacktime; int thours = (totalplaybacktime / 3600); int tmins = ((totalplaybacktime/60) - thours*60); int tsecs = (totalplaybacktime % 60); float = currentplaybacktime; float b = [[[musicplayer nowplayingitem] valueforproperty: @"playbackduration"] floatvalue]; float flttime= / b; self.positionslider2.value = flttime; if(thours == 0 && tmins == 0 && tsecs == 0) { [self nex...

c# - Order of evaluation, instance and method parameters -

suppose write following code: int x = 42; if (x.equals(x = foo())) console.writeline("ok"); where foo method returning integer. guaranteed method invocation target (the first x ) evaluated before replaced return value of foo() ? in other words, code guaranteed print ok if , if return value of foo() equal 42? i've seen other questions deal order of parameter evaluations, don't talk when instance (first x ) gets evaluated during runtime non-static methods -- clarify me? this problem called sequence points . represented happens when put increment operator inside expression . in case of c# strictly defined expression , method parameters evaluated left right, inside out , assignment (and side effects in general) visible rest of expression. you can read more here .

c# - How I can SAP B1 to integrate to visual studio 2008? -

Image
hi can me please ? firstly installed visual studio 2008. after installed sap b 1, not integrate visual studio 2008. how ı can integrate sap b 1 in visual studio 2008 ? how can sap b1 addoninstaller.net wizard add on visual studio 2008 above picture ? i want to open visual studio 2008 above picture. visual studio 2008 opening bottom image. can me please ? why visual studio 2008 not opening above picture ? want add visual studio 2008 sap b1 addoninstaller.net wizard. how can ? from short experience sap have 2 ways (which i'm using): use sqlclient ( to read ). connect directly company database using sql connection. use di api ( read , write ). can find information in sdk file. vb b1 addon wizard visual studio : didn't use before found link , think it's similar problem b1 addon wizard ps. find page sap users/developers scn.sap.com hope helps regards, samira

c# - Localization using CultureInfo - punctuation marks -

i use cultureinfo in order localize application: cultureinfo newculture = new cultureinfo("en-us"); thread.currentthread.currentculture = newculture; thread.currentthread.currentuiculture = newculture; i encountered problem has punctuation marks: in local database (from i'm getting useful data app) latitude , longitude properties stored dots (i.e. 45.245135) , that's fine when cultureinfo set en-us. however, when switch native language (where dot perceived thousand mark) none of map functions can work. i'd difficult if change each bit of code handles these values, it's everywhere more or less. any ideas on solving that? try working invariantculture whenever convert to/from string : string stlattitude = "45.245135"; ... // string double // culture.invariantculture make conversion culture independent double lattitude = double.parse(stlattitude, culture.invariantculture); ... // double string // culture.invariant...

php - Delete specific row in CSV file using HTML Table -

i have html table , use php .. data inside table came csv file . i can add new data in new row @ end of file. problem is, if want delete existing row in middle of data in csv file. how can that? way don't use database here. use html table , csv file . below code in viewing csv , adding new data. view <?php $row = 1; if (($handle = fopen("bin/pdw_table.csv", "r+")) !== false) { ?> <table class="table table-hover table-striped table-bordered" id="table-data"> <tr> <th>field 1</th> <th>field 2</th> <th>field 3</th> <th></th> ...

c++ - iostream: No such file or directory in Android NDK Environment -

i compiled *.cpp file on android ndk environment. but, saw messgage. dohyeon@ubuntu:/opt/android-ndk-r9d/jni$ ../ndk-build [armeabi] compile++ thumb: cpptetris <= main.cpp /opt/android-ndk-r9d/jni/main.cpp:3:20: fatal error: iostream: no such file or directory compilation terminated. make: *** [/opt/android-ndk-r9d/obj/local/armeabi/objs/cpptetris/main.o] error 1 dohyeon@ubuntu:/opt/android-ndk-r9d/jni$ my c++ files name main.cpp , plane.cpp. my andorid.mk file local_path := $(call my-dir) include $(clear_vars) local_ldlibs := -llog app_stl := gnustl_static app_stl := stlport_static include $(clear_vars) local_module := cpptetris local_src_files := main.cpp plane.cpp local_c_includes := $(local_path)/include-all include $(build_executable) i wonder why this. please me. in case app_stl definition should in ./jni/ application.mk file , not in android.mk file.

c# - SevenZipSharp code does not work an no exception raised -

i using c# , trying use 7z encrypt single file new output archive. i succeeded in encrypting whole folder not file. here code not work (i.e. after running code output directory has no .7z file , no exceptions raised ever!) my archiving class looks this: class class1 { public static int compressfileto7zip(string sourcefile, string destinationfile) { // takes sourcefile , encrypt password destinationfile //try //{ //console.writeline("compressfileto7zip source file = " + sourcefile); sevenzipcompressor mycompressor = new sevenzipcompressor(); mycompressor.directorystructure = true; mycompressor.archiveformat = outarchiveformat.sevenzip; sevenzipcompressor.setlibrarypath(@"7z.dll"); mycompressor.compressionmethod = compressionmethod.lzma; mycompressor.encryptheaders = true; mycompressor.includeemptydirectories = true; mycompressor.volumesize = 15000000; // 15 mb s...

R: Multiple Linear Regression error -

i having hard times running lm() function , understanding error. so, script this: #! /usr/bin/env/ rscript meteodata <- read.table("/path/to/dataset.txt", header=t) meteodata summary(meteodata) plot(meteodata) lmodel <- lm(temperature~altitude+sea.distance, data=meteodata) and console output this: temperature station.id latitude longtitude sea.distance altitude 1 20,1 s1 0,5 0,5 0,5 0 2 20,5 s1 0,5 0,5 0,5 0 3 19,3 s1 0,5 0,5 0,5 0 4 18,6 s1 0,5 0,5 0,5 0 5 21,5 s1 0,5 0,5 0,5 0 6 17,1 s2 3,5 2,5 1,5 200 7 18,3 s2 3,5 2,5 1,5 200 8 16,8 s2 3,5 2,5 1,5 200 9 17,5 s2 3,5 2,5 1,5 ...

string - Strip common indentation from the beginning of each line similar to what pydoc help does with docstrings -

i have module foo (in foo.py) function f defined in manner. def f(): """test line 1 line 2 """ pass this how docstring appears in interactive session. >>> print(foo.f.__doc__) test line 1 line 2 >>> help(foo.f) on function f in module foo: f() test line 1 line 2 >>> as, can see help() function takes care of removing common indentation beginning of each line while displaying help. want write own function similar. for example, if s = """foo line 1 line 2 line 3 """ then my_function(s) should return """foo line 1 line 2 line 3""" is there in python standard library can me this? you use textwrap.dedent() : import textwrap def my_function(s): first, *rest = s.splitlines(keepends=true) # first line special return first + textwrap.dedent(''.join(rest)) example: ...

Does PHP have a function for aggregating time values from an array? -

so query this: select timediff('24:00:00',(timediff('22:00:00',time(end)))) time sworkingtime user='magdalena' , type='work' , start between '2014-03-01' , '2014-03-28' , (hour(`end`) > 22 or hour(`end`) < 4) , completed=1 my query returns this: 02:02:36 03:17:24 03:07:03 02:24:17 03:14:09 is there way modify query return sum of fields, 1 field only? thank you no, there's no special sum function in case - paying attention need time summation, not simple operation. to that, can apply callback on array. powerful function array_reduce() . working date intervals can use datetime api, like: $data = [ ['time'=>'02:02:36'], ['time'=>'03:17:24'], ['time'=>'03:07:03'] ]; $time = array_reduce($data, function($c, $x) { $x = explode(':', $x['time']); $c = explode(':', $c); return (new datetime('2000-01-01')) ...

Datatables.net scroll issue in jquery dialog in IE -

i'm using datatable plugin, rendering datatable in dialog. inside firefox datatable appearing nicely on dialog. in ie datatable not @ displaying properly. in ie scrollbar coming dialog not datatable, whole ui looking ugly, eventhough table width grows beyond dialog width , height, scrollbar not @ appearing. here code. var myplaceholder= $("#placeholder"); myplaceholder.settemplateurl("/templates/people/makechoice.htm"); myplaceholder.load("/templates/people/makechoice.htm", function () { var ot = $("#datatable").datatable({ "aocolumndefs": [ { "swidth": "20%", "atargets": [0] }, { "swidth": "20%", "atargets": [1] }, { "swidth": "20%", "atargets": [2] }, { "swidth": "40%", "atargets": [3]}], "bjqueryui...

html - Center div inside a div vertically -

Image
i have tried methods find .. , nothing worked me... can wrap head around problem of aligning div (or block element) inside div .. difficult.. i want align green block vertically. here fiddle: http://fiddle.jshell.net/795st/1/ <div class="rtl centerwrapper"> <div class="green-block pull-right"></div> <div class="green-block pull-right"></div> <div class="green-block pull-right"></div> <div>average</div> </div> .green-block { background-color: #02a556; margin: 0 .25em 0 .25em !important; width: 1em; height: 0.5em; } .pull-right { float: right; } .rtl { direction:rtl; } .centerwrapper { position: absolute; top: 50%; left: 0px; width: 100%; overflow: visible; } please .. can 1 .. , explain dooing wrong ? edit: let me more clear... need element in 1 line. blocks needs aligned @ vertical middle of text. edit2: here im...

Clearcase - Rebasing to undo all check ins -

i have stream lot of files have been changed , checked in. want rebase stream recommended baselines, don't want of changes remain. want files modified rebased in such way there identical new stream aligned recommended baselines. note: * cannot delete activity * manually modifying each file cumbersome one easy solution create new stream, can rebase right baseline. but if not convenient, , if rebase isn't possible (because clearcase deny go older baseline), need "revert" previous activity changed files. see " reverting users changes in clearcase ": usually, script cset.pl used in " clearcase: how rollback changes on specific branch? " can revert activity.

android - File.deleteOnExit - Unix trick from comments -

here's source comment method: note on android, application lifecycle not include vm termination, calling method not ensure files deleted. instead, should use appropriate out of: * use {@code finally} clause manually invoke {@link #delete}. * maintain own set of files delete, , process @ appropriate point in application's lifecycle. * use unix trick of deleting file readers , writers have opened it. no new readers/writers able access file, existing ones still have access until last 1 closes file. can explain me "unix trick" mentioned in , how use it? this answer has explanation: https://stackoverflow.com/a/5219960/200508 . basically, means "deleting" file on unix system doesn't erase disk; instead, deletes reference file directory it's in. file isn't erased until processes using terminate. thus, can open temporary file , delete it, , whenever program terminates automatically erased.

html5 - HTML Video color not accurate -

i have video, converted mov file h264 mp4, , ogg file. on pc blue background , general colors quite bright (not same original though), , when put video in html5 tags goes dull , loses bit of quality. how can fix this? http://bit.ly/1lg2uxf looks video not in same color space background have. when converting h264, in video editor, checkbox preserve or embed color profile. if there's still problem, try making compression quality higher. colors may getting changed way compressor save space. when inspect videos in adobe bridge, color profile both mp4 , webm "untagged". cool motion graphic way.

java - JFrame, JPanel, JButton, and Inheritance -

so, made jframe class , jpanel class (which pretty complicated beacuse there buttons in panel). in jframe class, have make array of jpanel class, goes this public class frame extends jframe { //some variables , methods here int lines; public frame() { //some code here panelwithbutton[] pwb = new panelwithbutton[5]; //some code here } } and problem is, buttons in jpanel have different actionlisteners each button should change variables in jframe class public class panelwithbutton extends jpanel { //some variables , method jbutton abutton = new jbutton(); jbutton bbutton = new jbutton(); jbutton cbutton = new jbutton(); public button() { //some code here add(abutton); abutton.addactionlistener(new actionlistener() { public void actionperformed(actionevent e) { frame.lines = 4; } }); add(bbutton); ...

javascript - strip white spaces from php file -

i have php file outputing json. <?php header('content-type: application/json'); ?> var data = { "cars": [ <?php foreach ($runshowcars $rowscar):;?> { "id":"<?php echo $rowscar['id'] ?>", "name":"<?php echo $rowscar['name'] ?>" } ], "boats": [ <?php foreach ($runshowboats $rowsboat):;?> { "id":"<?php echo $rowsboat['id'] ?>", "name":"<?php echo $rowsboat['name'] ?>" } ], }; this works output looks this. var data = { "cars": [ { "id":"1", "name":"ford" } ,{ "id":"2", "name":"honda" } ]...

c# - How to change itemsControl stackpanel background color -

says have list of 10 items somelist , show them on page via itemscontrol below: <itemscontrol datacontext="{binding [someviewmodel]}" borderbrush="black" itemsource="{binding somelist}"> <itemscontrol.itemtemplate> <datatemplate> <border borderthickness="1" background="green"> <stackpanel mousedown="{binding path=datacontext.somecommand, relativesource={relativesource findancestor,ancestortype={x:type itemscontrol}}}" command parameter="{binding someid}"> <textblock text="{binding something}"> </stackpanel> </border> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol> i able trigger somecommand method , able pass ...

php - Symfony 2 - Simulate login and security context in console command -

i coding custom console command on symfony2. my command call 1 service use security context dependency injection (check role). in order keep security check in service, create specific user , log user in console command. how can simulate login , have usable security context in command ? my service check : if ($this->securitycontext->gettoken() == null || !$this->securitycontext->isgranted('is_authenticated_fully') ) my command classic console command extends containerawarecommand best regards, j you can programatically authenticate user in symfony2 this: // create authentication token $token = new usernamepasswordtoken( $user, null, 'main', $user->getroles()); // give security context $this->container->get('security.context')->settoken($token); edit based on comment: security context deprecated of symfony 2.6. use instead: $this->container->get('security.token_storage'...

css - Changing cursor in browser not working -

.squirell{ position:absolute; cursor: url("http://msunicorn.ru/wp-content/uploads/2014/03/handyman_hammer.ico"); } other resources loading, size i'm using big? i think can change cursor css solution. see here . cursor: url(images/my-cursor.png), auto;

hibernate - discriminator column is not working with table per subclass -

Image
hi all, i using discriminator column in table per subclass inheritence mapping. entry of parent class @entity @table(name = "employee105") @inheritance(strategy=inheritancetype.joined) @discriminatorcolumn(name="emp_type" , discriminatortype= discriminatortype.string) and entries of subclass follows: @entity @table(name="contractemployee105") @discriminatorvalue("p") @primarykeyjoincolumn(name="id") @entity @table(name="regularemployee105") @discriminatorvalue("t") @primarykeyjoincolumn(name="id") i know code correct , tables being generated in insert query discriminator column not being created. using jars shown in image. kindly let me know issue. suspect issue jars or hibernate version. thanks it's suspect problem hibernate version. bug hhh-6911 issue, , resolved in hibernate 4.2.9, 4.3.1. if version of hibernate earlier, might want upgrade. (looking @ list of j...

javascript - Prompting a value with setTimeout function -

var label = prompt('label vertical line'); this code returns value in label enter in prompted field. want time delay prompted value. i'm using code: var label=alertwithoutnotice(); function alertwithoutnotice(){ var lab; settimeout(function(){ lab=prompt('label vertical line'); }, 1200); return lab; } but doesn't return value. please tell me wrong? this chronological issue. settimeout schedules asynchronous event. means, until runs, rest of script continue execute. the result return lab line executed before timeout callback fires. , on return, lab undefined @ point. as such, can't return values asynchronous events, or @ least not meaningfully. something jquery's deferred objects best route fix here, don't know if jquery option you.

php - Javascript & character is removed from the code -

i'm working on website first lines of codes this: header("content-type: text/html; charset=utf-8"); then lines down html starts , in <head> sections there javascript code included. part of code it's going wrong posted below. 'com/j.php?a='+account_id+'&u='+encodeuricomponent(d.url)+'&r='+math.random());var a=d.creat' now after page loaded, looks (looking @ source). 'com/j.php?a='+account_id+'u='+encodeuricomponent(d.url)+'r='+math.random());var a=d.creat' the difference & characters removed code. , code doesn't work. i think caused charset utf-8 . can't remove this. how able & characters in javascript? edit i tried using <!cdata , characters not removed now, code still doesn't work.

How to publish Chrome App into For Your Desktop collection -

i created chrome app. but appears in for desktop collection in chrome web store. there special activities should that? also, difference between for desktop , offline apps categories? that collection curated. if chrome app successful, curators consider including in collection.

android - Getting error while retriving the getStringExtra -

Image
here source ... i getting null values while putting values in intent ... here getting value other activity gives null values when click on continue private button continue_to_addfriends; string name = ""; string emailid = ""; string userbirthdate = ""; string password = ""; private intent j; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_robot_verify); j = getintent(); name = (string) j.getstringextra("name"); emailid = (string) j.getstringextra("emailid"); userbirthdate = (string) j.getstringextra("userbirthdate"); password = (string) j.getstringextra("password"); system.out.println(name+" robot activity"); continue_to_addfriends=(button)findviewbyid(r.id.button_robot_done); continue_to_addfriends.setonclicklistener(new onclicklistener() { @override...

Is there any way to perform divisions on a generic type in .net (C++-CLI)? -

i'm trying create simple rolling mean implementation generic numerical type have hit stumbling block: generic<typename t> public ref class rollingmean { protected: circularbuffer<t> m_databuffer; t m_currentsum; public: rollingmean(const int numofitems); t additem(const t newitem); t currentmean() { return m_currentsum / static_cast<float>(m_databuffer.length); // <--- gives me compiler error c2676 } }; this gives me compiler error: 1>c:\projects\util\rollingmean.h(21): error c2676: binary '/' : 't' not define operator or conversion type acceptable predefined operator 1>rollingmean.cpp(6): error c2955: 'mathhelpers::rollingmean' : use of class generic requires generic argument list 1> c:\projects\util\rollingmean.h(9) : see declaration of 'mathhelpers::rollingmean' is there way limit generic classes happy numeric operations? there's no way generics....

eclipse - Missing artifact org.jboss.seam:jboss-el:jar:2.0.0.GA -

i'm working on project using liferay 6.1.1 , maven! have error message in pom.xml "missing artifact org.jboss.seam:jboss-el:jar:2.0.0.ga" if jar file there! when tried deploy project, goes ... warning persiste if project works good. idea?

apache - .htaccess not redirecting all traffic -

im hoping 1 can help. im using .htaccess redirect traffic website while work on ... works great main index page, else results in redirection getting appened for instance, www.website.com works perfect , gets redirected www.google.com ... when go www.website.com/wp-admin ... gets redirected www.google.comwp-admin any appreciated. it should redirect here -> http://www.myredirect.com/show.aspx?sh=ku14 here line rewriterule ^(.*)$ http://www.myredirect.com/show.aspx?sh=ku14$1 [r=301,l] you asked append url redirected url $1 . remove it rewriterule ^(.*)$ http://www.myredirect.com/show.aspx?sh=ku14 [r=301,l] note: if trying redirect maintenance use 307 temporary redirect. 301 permanent redirect , browser may not visit original site later, once finish update. quote wiki 301 moved permanently , future requests should directed given uri.[2] 307 temporary redirect (since http/1.1) in case, request should repeated uri; however, future reque...

Error when receiving email in Dynamics CRM 2013 -

i've set forward mailbox in dynamics crm 2013 using new server profile features , alert when performing test , enable action. error receiving "the location of mailbox [name] not determined while receiving email. ". the server profile connected office 365 , appears working fine user mailbox. has else come across problem? the problem turned out office 365's auto discover. setting email server profiles incoming , outgoing address https://outlook.office365.com/ews/exchange.asmx manually solved problem. i don't know if local or remote issue.

javascript - WebView methods on same thread error -

i have android program (java + html in webview). can call javascript java code. other way around stopped working (after updating in eclipse). so i'm trying do make webview (worked) calling in javascript androidfunction.test(); (worked) the java test() function call webview.loadurl("javascript:helloback()"); (! not working anymore) i tried let work webview in mainactivity, didnt work. mainactivity.java public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); final webview webview = (webview)findviewbyid(r.id.webview); webview.getsettings().setjavascriptenabled(true); webview.setwebchromeclient(new webchromeclient()); websettings websettings = webview.getsettings(); websettings.setjavascriptenabled(true); javascr = new javascript(this, webview); webview.addjavascriptinterface(javascr, "androidfunction"); ...

arrays - XPATH select by set of possible attribute values -

i have this: <database> <exercise_muscle id="20" muscleid="1" exerciseid="1" /> <exercise_muscle id="35" muscleid="2" exerciseid="1" /> <exercise_muscle id="50" muscleid="3" exerciseid="2" /> <exercise_muscle id="50" muscleid="4" exerciseid="2" /> </database> and want exercise_muscle nodes, have e.g. muscleid value 1, 3 or 4.. set of possible values. i know can use "or", hoping there better solution. how this? (runs using xpath 2.0) /database/exercise_muscle[@muscleid = ('1', '3', '4')] alternatively, can use /database/exercise_muscle[@muscleid = '1' or @muscleid = '3' or @muscleid = '4']

php - Gettext not working after rebooting -

Image
i'm using gettext in webpage translations , localization. yesterday, working perfectly, , shutted down computer because had go sleep... (so normal! hahahaha) . but now, today, when turned on computer, seemed gettext wasn't working, showing me default language (english) instead of desired language (spanish), having translations in right place. gettext code: $lang = $_session['lang']; $domain = 'messages'; $language = $lang; setlocale(lc_all, 'en_us.utf8'); putenv('language=' .$language); if( env != 'live' ){ // reset caching nocache simlink "." bindtextdomain($domain, dirname(__file__) . '/../locale/nocache'); } bindtextdomain($domain, dirname(__file__) . '/../locale'); bind_textdomain_codeset($domain, 'utf-8'); textdomain($domain); and have: also, in $_session['lang'] have set 'es_es' string, assign spanish language. ...

networking - Snort - Error while running -

running snort (in packet dump mode) command sudo snort -c snort.conf -a console -i eth0 following problem occurred: --== initializing snort ==-- initializing output plugins! snort bpf option: snort.conf pcap daq configured passive. daq version not support reload. acquiring network traffic "eth0". error: can't set daq bpf filter 'snort.conf' (pcap_daq_set_filter: pcap_compile: syntax error)! fatal error, quitting.. can please suggest solution? you're using wrong option load configuration, should lower case '-c'. sudo snort -c snort.conf -a console -i eth0 also, can test configuration '-t' before running it: sudo snort -t -c snort.conf

lucene - Elasticsearch: shingles with stop words elimination -

i trying implement elasticsearch mapping optimize phrase search in large body of text. per suggestions in this article , using shingle filter build multiple unigrams per phrase. two questions: in article mentioned, stopwords filtered , shingles take care of missing spaces inserting "_" tokens. these tokens should eliminated unigram indexed engine. point of elimination able respond phrase queries contain sorts of "useless" words. standard solution (as mentioned in article), no longer possible, given lucene deprecating feature (enable_position_increments) needed kind of behaviour. how solve kind of issue? given elimination of punctuation, routinely see unigrams resulting shingling process cover both phrases. point of view of search, result contains words 2 separate phrases not correct. how avoid (or mitigate) kind of issues?

inheritance - Is it possible to call both default and parameterized constructors of SubClass and SuperClass for a particular instance(parameterized) in Java? -

i'm trying below scenario: public class superclass { public superclass(){ system.out.println("super constructor"); } public superclass(int i){ this(); system.out.println("parameterized super constructor"); } } public class subclass extends superclass{ public subclass(){ system.out.println("sub constructor"); } public subclass(int i){ super(i); /* need call **this()** here .. possible? */ system.out.println("parameterized sub constructor"); } } public class inheritance { public static void main(string[] args) { subclass sub=new subclass(5); } } how call both default , parameterized constructors case ? if have functionality in non-parameterized constructor need call both, i'd recommend move out of there a, example, private void init() function both constructors can call.

How to add new line programmatically in CodeMirror? -

i need insert new line next current line number in codemirror. i viewed documentation didn't find appending content @ end of line. please help. :( get current line cursor position, , act on it. should (not tested): var doc = cm.getdoc(); var cursor = doc.getcursor(); // gets line number in cursor position var line = doc.getline(cursor.line); // line contents var pos = { // create new object avoid mutation of original selection line: cursor.line, ch: line.length - 1 // set character position end of line } doc.replacerange('my new line of code\n', pos); // adds new line

.net - How to print a multi-lined string into a message box? -

i trying print 'last receipt' customer in have stored sting variable called prevrecpt. i want able press button (btnlastreceipt) , display sting in message box. is possible? have tried , ended message box showing first line? prevrcpt = "--------------------butlers cinemas--------------------" & environment.newline prevrcpt = prevrcpt & tbtime.text & environment.newline prevrcpt = prevrcpt + "operator: " + tbuser.text & environment.newline prevrcpt = prevrcpt + environment.newline & environment.newline + "-------------------------------------------------------" prevrcpt = prevrcpt + "total spent: £" + tbtotal.text + environment.newline + environment.newline prevrcpt = prevrcpt + shoppingcart.text + environment.newline prevrcpt = "--------------------butlers cinemas--------------------" & environment.newline this code building string....

javascript - jqplot highlighter for all markers in one point -

Image
i using jqplot plugin plot charts on web pages. there chance show tooltips of each series when @ same point (overflow others). now 1 tooltip of series on top of others. in picture bellow: i likte tooltips if there bellow mouse cursor. please help

How to install a bare Linux kernel without any distribution to study it? -

i want study kernel of linux without distribution. i found loadlin boatloader of ms-dos, think works in older version of windows (windows 95,98, me). so need install kernel in pc if possible. how can install it? the kernel not useful you; you'll need shell , working compiler if want test things first-hand, , these not part of kernel. there's distribution called linux scratch allows install kernel , whatever other stuff want, literally scratch (as in, compiling stuff , adding want) i wondering though, want study , how having distribution affect studying of kernel? (yes, distributions ship custom kernels major features same)

mysql - kamailio fails to start because of invalid database credentials -

i'm trying try hand out kamailio , freeswitch. i'm following article listed here: http://nil.uniza.sk/sip/kamailio-33-and-freeswitch-122-interconnection-voicemail-and-conference-services-debian-squeeze-60-64bit-tutorial after adding #!define statements, article says try restart kamailio. when that, fails error: driver error: access denied user 'kamailio'@'localhost' (using password: yes) i'm not sure configuration file contain name of default user that's used log in mysql. did make recommended changes kamctlrc define dbhost, dbname , read write user etc. none of settings made reference user "kamailio". not sure check. thanks. upon closer examination, found not have /etc/kamailio/kamailio.cfg file /etc/kamailio/kamailio-advanced.cfg. i made changes article suggested kamailio.cfg in kamailio-advanced.cfg instead... , well. able start service again. i'm not sure if database work @ least i'm 1 step closer ,...

android - Native crash in unknown unknown -

i have app entirely written in java - no native code whatsoever - , i've twice had crash report on developer console "native crash in unknown unknown". have no idea start locating source of problem. searching has revealed type of crash in case of android bugs, ndk usage or buggy third party libraries. for it's worth, here 1 of logs: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** build fingerprint: 'samsung/m0xx/m0:4.3/jss15j/i9300xxugmj9:user/release-keys' revision: '12' pid: 2197, tid: 2197, name: .test.app >>> com.test.app <<< signal 6 (sigabrt), code -6 (si_tkill), fault addr -------- r0 fffffffc r1 bef3f3f8 r2 00000010 r3 ffffffff r4 41619610 r5 00000000 r6 41619624 r7 000000fc r8 41619658 r9 00000014 sl 418cc238 fp bef3f56c ip bef3f3f8 sp bef3f3d8 lr 40115045 pc 401a1574 cpsr 280b0010 d0 0000000100110102 d1 0000000044a01000 d2 0000000000000000 d3 0000000000000000 d4 000002d044340000 d5 0000000042a40000...

xaml - Distorted text rendering WPF (see screenshots) -

Image
has seen specific kind of distortion xaml text rendering? this happens when page first renders when browser re-sized bigger or smaller render correctly. i have tried different text-rendering settings , made sure not setting height or width constraints impacting text. this happens text of custom buttons created. have effects-rendering? buttons , groupboxes have dropshadows, affect plain text on white background? thanks! jeff does have effects-rendering? buttons , groupboxes have dropshadows, affect plain text on white background? yes. setting effect , bitmapeffect , or cachemode on element causes element rasterized, i.e., converted scalable vector form bitmapped form. can create visual artifacts jagged edges (aliasing) when element gets positioned across device pixels or scaled in size, , text elements tend suffer most. i avoid using such effects when possible. may able mitigate problems setting uselayoutrounding (wpf 4+) or snapstodevicepixels (...

python - Should I use `app.exec()` or `app.exec_()` in my PyQt application? -

i use python 3 , pyqt5. here's test pyqt5 program, focus on last 2 lines: from pyqt5.qtcore import * pyqt5.qtwidgets import * import sys class window(qwidget): def __init__(self,parent=none): super().__init__(parent) self.setwindowtitle('test') self.resize(250,200) app=qapplication(sys.argv) w=window() w.show() sys.exit(app.exec()) #sys.exit(app.exec_()) i know exec language keyword in python. code on official pyqt5 documentation (specifically object destruction on exit part) . see example shows use of app.exec() confuses me. when tested on machine. found there no visible difference end. both , without _ produces same output in no time difference. my question is: is there wrong going when use app.exec() ? clashing python's internal exec ? suspect because both exec 's executing something. if not, can use both interchangeably? that's because until python 3, exec was reserved keyword , pyqt devs added underscore it. pyt...

javascript - How to access outer object's attribute from an inner object? -

can outer 's value accessed function of inner object? there way? var outer = { value: "1", inner: { getvalue: function() { return value; // undefined } } } alert(outer.inner.getvalue()); // fails there no way refer containing object, "inner" object have infinite number of containing objects. have explicit , give reference parent object. var outer = { ... }; var inner = { parent: outer, getvalue: function () { return this.parent.value() } }

javascript - Don't change the color of table row once visited -

i want application run in same way gmail does. once visit mail color changes permanently when reload page remains same 'here fiddle' http://jsfiddle.net/kzsjr/#&togetherjs=opoxyfna4o when click on 'po' button row color must change permanently in gmail thank help you have use localstorage , this: $("#po").click(function(){ localstorage.setitem("visited", true); $("#po").css("color", "black"); // visited }); now on page load, $(window).load(function(){ if(localstorage.getitem("visited")) { $("#po").css("color", "black"); // visited } else { $("#po").css("color", "green"); // not visited } }); alternatively, can use cookies (but usage becomes bit lengthy imo). p.s. note localstorage can modified users, , not used storing sensitive user data. further reading .

.net - Adding column in a datatable with a dynamic column name in C# -

datatable dt = new datatable(); var dr = dt1.date; string rr = convert.tostring(dr); datacolumn dc1=new datacolumn(); dc1.columnname = rr; dt.columns.add(dc1); and if add datarow after like dt.rows.add("hello","hello1","hello2"); datagrid1.itemssource = dt.defaultview; the data not displayed in grid . if comment line dc1.columnname = rr; the values displayed want colmn name date "dt1" here pleae note dt1 date values dynamic , incremented in each loop. dt1 = dt1.adddays(1); please help without seeing xaml data grid it's difficult sure imagine you've specified field name date column in xaml. to resolve this, you'll need set autogeneratecolumns=true , let grid automatically find field name.