Posts

Showing posts from March, 2014

xcode - GLEW and GLFW on Mac OS X (standalone) -

i built project on xcode using glew , glfw. cmake file given me tutorial, don't know how make 1 of cpp files build itself. when pasted code new standalone file, got errors: error: gl/glew.h: no such file or directory error: glfw3.h: no such file or directory i googled these errors, of solutions linux , did not work mac. glew , glfw indeed installed on system, since using them in xcode project. don't know how set correct paths when compiling standalone cpp file @ command line using g++. use -i @ command line indicate include paths compiler should search

java - Try-with transfer ownership -

in java 7, there try-with syntax ensures objects inputstream closed in code paths, regardless of exceptions. however, variable declared in try-with block ("is") final. try (inputstream = new fileinputstream("1.txt")) { // stuff "is" is.read(); // give "is" owner someobject.setstream(is); // release "is" ownership: doesn't work because final = null; } is there concise syntax express in java? consider exception-unsafe method. adding relevant try/catch/finally blocks make method more verbose. inputstream opentwofiles(string first, string second) { inputstream is1 = new fileinputstream("1.txt"); // is1 leaked on exception inputstream is2 = new fileinputstream("2.txt"); // can't use try-with because close is1 , is2 inputstream dual = new dualinputstream(is1, is2); return dual; } obviously, can have caller open both files, placing them both in try-wit

TMediaPlayer and TMediaPlayerControl don't seem to work for Delphi FireMonkey iOS/Android? -

i have delphi xe6 firemonkey project, intending play videos on ios , android devices. in form have tmediaplayercontrol , tmediaplayer controls. my code play video (passed in) is mediaplayer1.filename := tpath.getdocumentspath + pathdelim + s; label1.text := inttostr(mediaplayer1.media.videosize.truncate.x) + 'x' + inttostr(mediaplayer1.media.videosize.truncate.y) + 'px ' + inttostr(mediaplayer1.media.duration div mediatimescale) + 'ms'; trackbar1.max := mediaplayer1.media.duration; mediaplayer1.play; the intention label show resolution of video , trackbar show length of video. yet, label shows 0x0 , trackbar has value 0. now, if set mediaplayer property of tmediaplayercontrol, ie mediaplayercontrol1.mediaplayer := mediaplayer1; the video not play @ all. nothing happens. if clear property, video play in uncontrolled window in middle of screen, ignoring tmediaplayercontrol entirely. this code works firemonkey windows app seems not wo

node.js - Node session cookie that expires -

is possible create session cookie (one automatically deleted when browser closes) , has expiration expire after set time, let's 15 minutes unless user continues using site? if use site, i'd reset expiration lasts 15 minutes. i've had luck either creating session cookie expires when browser closed or stays around persistent cookie has expiration either using expires or maxage arguments. the thing can think of create session cookie has timestamp value stored in , in session middleware, check of current time > timestamp value , deny request , delete cookie setting null. if current time <= timestamp updating timestamp new date extending session timeout. while idea may work, makes me think there more official way of accomplishing want. i'm experimenting node , express insight tailored build-out appreciated. because way create session cookie leave out expiration, can't single cookie. but, can 2 cookies, 1 session cookie , 1 expiring cookie. h

forms - Symfony2 - Entities not linking via ManyToMany -

i have 2 entities, reply , post. these linked manytomany post being owner. i have created form reply add new replies post, reason replies not showing in loop in twig. in database new replies listed , saved yet it's not displaying? i've setup fixtures linking replies posts , displays fine in loop, not new replies created in form? what missing here? replyform public function buildform(formbuilderinterface $builder, array $options) { $builder ->add('author') ->add('body') ->add('post', 'submit'); } public function setdefaultoptions(optionsresolverinterface $resolver) { $resolver->setdefaults(array( 'data_class' => 'acme\demobundle\entity\reply' )); } public function getname() { return 'acme_demobundle_reply'; } twig {% reply in post.replies %} <hr> <p><small>reply <em>{{ reply.author.name }}</em> on {{

UI Activity in the POP window in android -

i use popup window ui activity. actually, have button in main activity page on clicked should open dialog window. in dialogue window, want have 2 other buttons in on clicked should pass value every click**(without window being disappeared)** , if there no click defined time (time-out) should vanish , return main activity. i can using "intent" want implement automatically vanishing dialog window after time-out. how can this.? please me out problem. thanks in advance, first declare 1 global varialbe handler update ui control thread , below- handler mhandler = new handler(); now create 1 thread , use while loop periodically perform task using sleep method of thread. suppose have menu_bt object of view show/open popup window use thread dismiss automatic popup window when there no click defined time i.e. 10 seconds. here mpopup object of popupwindow . use below code vanishing dialog window after time-out (i used 10 seconds). hope you. menu_

Sending images continously over udp in android java -

i sending screenshots of pc screen android tab on udp. while size of image data increases transmission stops. intially images of 10 kb being sent, when image size changed 12kb, images not received, if images less size initial received size, images received in tab. reason behind this. code receive datagram packet private class udpreceiver implements runnable { string path = environment .getexternalstoragepublicdirectory(environment.directory_dcim) + file.separator + "simple"; file directory = new file(path); byte[] incommmingdata = new byte[65 * 1024]; datagrampacket p = new datagrampacket(incommmingdata, incommmingdata.length); int file_size; public void run() { try { while (true) { datagaramsoc = new datagramsocket(1546); fileoutputstream outstream = null; file_num =

mysql - Multi count from multi table in SQL -

i have following table example: table users : |id |user | | 1 |frank | | 2 |tom | | 3 |lisa | table cities : |id |city | | 1 |paris | | 2 |tokyo | how can have count of each table users , cities in 1 sql query ? i want have: - number of users: 3 - number of cities: 2 thanks. just guessing mean: select (select count(*) users) user_count, (select count(*) cities) city_count in general, can use subquery place expression allowed, long subquery returns 1 row 1 column, wrapping subquery in parentheses.

c# - How to use a custom font with Windows Universal app? -

like other windows phone 8 projects wanted use custom font. new universal app architecture struggle put in place. i have created "fonts" folder in shared project, added fonts files property build action "content". i created "themes" folder in shared project , added resourcedictionnary ("generic.xaml"). i added fontfamily resource : <fontfamily x:key="rexboldfontfamily">/fonts/rex bold.otf#rex bold</fontfamily> i referenced in app.xaml that: <application.resources> <resourcedictionary> <resourcedictionary.mergeddictionaries> <resourcedictionary source="themes/generic.xaml"/> </resourcedictionary.mergeddictionaries> <vm:viewmodellocator x:key="locator" d:isdatasource="true" /> </resourcedictionary> </application.resources> in mainpage.xaml on windows phone project tried use this: &l

Java - standard SSL certificate all-trusting code fails -

i think now, every java coder who's had experience ssl certificate trusting errors has used or @ least encountered code: // create trust manager not validate certificate chains trustmanager[] trustallcerts; trustallcerts = new trustmanager[] { new x509trustmanager() { @override public java.security.cert.x509certificate[] getacceptedissuers() { return null; } @override public void checkclienttrusted(x509certificate[] certs, string authtype) { } @override public void checkservertrusted(x509certificate[] certs, string authtype) { } } }; // install all-trusting trust manager sslcontext sc = sslcontext.getinstance("ssl"); sc.init(null, trustallcerts, new java.security.securerandom()); httpsurlconnection.setdefaultsslsocketfactory(sc.getsocketfactory()); // create all-trusting host name verifier

javascript - Storing the contents of an external php stylesheet in html -

i have php file that's being used dynamic stylesheet. large file css/values generated php. here's example. <?php header("content-type: text/css"); ?> .top { top: <?= $topvalue ?>px; } more css... on separate file, i'm trying generated content php file , store on page somewhere can later javascript. method i'm trying storing contents in hidden input. so. <?php $file = file_get_contents("file_url.php"); ?> <input type="hidden" name="hidden-css" value="<?= $file ?>" /> however, when this, value contains raw php file , commenting out opening/closing php tags. instance, doing things '< !--?php' instead of "< ?php" , "?-->" instead of "?>". messes general html on page , doesn't store value correctly in input. so ask you, how can fix current situation or better store contents of stylesheet on page can later grab , use javascrip

c# - How to correct unwanted mschart splines? -

Image
i'm writing c# code calculating , plotting them via mschart. data looks image added below. spline data 1,2,3,4 y axis, , 5000,8000,10000,11000 x axis. there bold closed spline around spline. how can fix this? my code is: var lines = new series("lines"); lines.charttype = seriescharttype.spline; chart1.series["series1"].points.addxy(5000, 1); chart1.series["series1"].points.addxy(8000, 2); chart1.series["series1"].points.addxy(10000, 3); chart1.series["series1"].points.addxy(11000, 4); i could't add second image question, used answer link. if add data chart properties menu , make isempty option true, chart displays correctly. should via code. searched code , found public bool isempty { get; set; } but didn't work. here correct chart image: i couldn't fix via code.

express - mocha and supertest.agent not working as expected -

i'm trying write tests need authenticate first. if make multiple requests in "before()" connection refused. if split between "before()" , "it()" works cannot acheive want. code want work: var agent = request.agent(myexpressapp), token; before(function(done) { async.series([ function(cb) { agent .post('/1/auth/login') .send({ email: 'john@smith.com', password: 'j0hn_sm1th' }) .expect(200) .end(cb); }, function(cb) { agent .get('/1/auth/authorize') .query({ response_type: 'token', client_id: 'some id', redirect_uri: 'http://ignore' }) .expect(302) .end(function(err, res) { /* console.log(arguments) = { '0': { [error

c# - Parallel.foreach kill thread process -

this code : [threadstatic] private static webshopentities _data; public static webshopentities data { { if (_data == null) { _data = new webshopentities(); } return _data; } } parallel.foreach(list,item => { data.dp_articles.add(new dp_articles { prom_erp_partno = item.prom_erp_partno, prom_mfm_partno = item.prom_mfm_partno, prol_name = item.prol_name, mfm_short_name = item.mfm_short_name, prom_prfm_id = item.prom_prfm_id }); } data.savechanges(); }); after it's finished job cpu usage 99% , threads doesn't kill software automatically! searched enough nothing i'm found! how can solve problem ? you using orm concurrently. not supported. can't stuff arbitrary code p

python - How to mock/set system date in pytest? -

in of tests having problem fail on travis because of time , time zone problems, want mock system time test. how can this? afaik, can't mock builtin methods. one approach have done change code bit not use datetime directly obtain date, wrapper function somewhere: # mymodule.py def get_today(): return datetime.date.today() this makes trivial mock in test: def test_something(): mock.patch('mymodule.get_today', return_value=datetime.date(2014, 6, 2)): ... you can use freezegun module.

android - how to make a text view selectable? -

i use adapter load list view content provider. each item in list uses below layout. i looking way make text view selectable. have tried using android:textisselectable="true" , android:selectallonfocus="true" , these make text within text view selectable. want make whole text view selectable, instead of text within it, can add functions delete , share it. there way achieve that? <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"> <linearlayout android:id ="@+id/wrapper" android:layout_width="match_parent" android:layout_height="wrap_content"> <textview android:id="@+id/txt_chat" android:layout_height="wrap_content"

hadoop - Compatibility issue between Hbase 0.94.2 and apache nutch dependency -

i trying install apache nutch 2.2.1 , have build after making required changes in configuration files following http://www.blogjava.net/paulwong/archive/2013/08/31/403513.html tutorial. after building not able crawl , after hours of inspection realized hbase version on company cluster hbase- 0.94.2 whereas installation dependency apache nutch 2.2.1 hbase 0.90.4. hbase-0.90.4.jar not compatible hbase- 0.94.2 getting following error when try inject url nutch. kindly me in changing dependency of apache nutch or fixing error. i posting error below. caused by: java.lang.runtimeexception: java.lang.illegalargumentexception: not host:port pair: �-11562@bt13acl1node26.comp.com�$3�¿½bt13acl1node26.comp.com,60000,1401268790838 @ org.apache.gora.hbase.store.hbasestore.initialize(hbasestore.java:127) @ org.apache.gora.store.datastorefactory.initializedatastore(datastorefactory.java:102) @ org.apache.gora.store.datastorefactory.createdatastore(datastorefact

web services - Android .NET: A Binding must be configured for this channel factory -

i have received following error when trying call method wcf web service application in xamarin android application: system.invalidoperationexception: binding must configured channel factory. i searched internet solutions unlucky. my server side created in wcf web service application in visual studio 2013 web. client side android application created in xamarin studio. calling methods server works fine in webforms winforms, not working xamarin.androidapplications. i found link was'nt enaugh :( : http://www.nullskull.com/a/10476775/xamarin-cross-platform-application-consuming-wcf--part-1.aspx if me thankful! i have found answer question: http://developer.xamarin.com/guides/cross-platform/application_fundamentals/web_services/walkthrough_working_with_wcf/

java - Android: getX getY initial delay -

this question has answer here: android action_move threshold 2 answers when reading getx() , gety() values series of ontouch events, find action_move events return action_down coordinates until distance threshold these coordinates has been passed. onwards correct coordinates returned. steps reproduce: create new application project default activity add following method default activity: @override public boolean ontouchevent(motionevent event) { log.i("getxydelay", "(x,y)=("+event.getx() + "," + event.gety() + ")"); return super.ontouchevent(event); } run on device , watch logcat touch , drag you should see that, on every touch , drag, getx() / gety() results start changing after finger has moved half centermeter or so, , on accurate. i can see how lot of circumstances helpful, causes issues

sql - Store multiple records at a time into database table and then check if any record had been lost or not -

i new linux , oracle sql. store multiple records (of pre-set length, 800) @ time abc.csv file seperated commas (contains huge no. of records, million) database table , check if record had been lost or not. if record lost in process or not copied database retry store whole lot again. succeeded move onto next lot else save lot has not been stored database in seperate log file , continue next lot. abc.csv has field columns follows record_no.,id,name,etc.,..... any ideas or sugestions welcomed. -thanks in advance. i don't know oracle sql in plain old mysql select count(*) <tblname> , see if number matches expect in there after inserts. note: beneficial if knew total amount of items being inserted table in total.

android - List adb devices on network -

i have few devices enabled on air debugging. possible list adb devices on network? similar or same effect adb devices devices enabled on air debugging. if these steps , run adb devices command, android device should appear under list of attached devices . first open command window , make sure either in same directory adb or have adb in path variable. execute following list of commands: $adb usb restarting in usb mode $ adb devices list of devices attached ######## device $ adb tcpip 5555 restarting in tcp mode port: 5555 get ip address of android device. (usually under system settings network settings, can how ip address on specific device). ip address should 12.34.56.78 (this vary though). once have ip address continue following commands: $ adb connect 12.34.56.78 connected 12.34.56.78:5555 remove usb cable device $ adb devices list of devices attached 12.34.56.78:5555 device source

Difference between Java and Javascript on 1st Jan 0001 UTC -

i have difference of how date 1st jan 0001 utc represented in java , in javascript in java: timezone utctimezone = timezone.gettimezone("utc"); calendar cal = calendar.getinstance(utctimezone); cal.clear(); //1st jan 0001 cal.set(1, 0, 1); date date = cal.gettime(); system.out.println(date);//sat jan 01 00:00:00 gmt 1 system.out.println(date.gettime());// -62135769600000 in javascript: var date = new date(); date.settime(-62135769600000); date.toutcstring(); //"sat, 30 dec 0 00:00:00 gmt" why date, 1 jan 0001 utc, represented time -62135769600000l in java, not represented 1st of january when displayed in javascript? it looks because gregoriancalendar in java hybrid between gregorian calendar , julian calendar: gregoriancalendar hybrid calendar supports both julian , gregorian calendar systems support of single discontinuity, corresponds default gregorian date when gregorian calendar instituted (october 15, 1582 in countries, later in oth

Windows universal URI format exception -

i'm working on windows universal app. want show user image. image located in subfolder within assets folder, in both phone , windows folder. i'm trying put image in variable in class in shared folder. continously getting uri exceptions. my code looks this: uri uri = new uri("/assets/image/avatar_anonymous.png"); chat_profilepicture_bitmap = new bitmapimage(uri); i've tried different urls, , without capitals, entire path "c://blablabla", , many more. nothing seems working. have tried: pack://application:,,,/ suggested multiple stackoverflow threads. no luck there. i'm thinking problem lies in image being in project, there way around this? or if isn't problem, doing wrong? try this uri uri = new uri("ms-appx:///assets/image/avatar_anonymous.png"); hope helps

c# - object == object instead of object.id == object.id potential problems -

i have inherited sloppy project , tasked explaining why bad. i've noticed on code have done comparisons this (iqueryable).firstordefault(x => x.facility == facility && x.carrier == shipcode.carrier in example above x.facility database , facility shipment.facility mapped complex object in nhibernate. i have expected see .firstordefault(x => x.facility.id == facility.id at first thought comparing whole object might cause issues if facility record changed in db facility stored in shipment different. after thinking more realized shipment.facility populated id should match if facility record changed. it still feels wrong me see being buggy , hard track down? there somthing wrong comparing entire object vs id. expanding previous comments answer: i think good practice when orm allows it. i'm not experienced nhibernate, rest of answer i'll assume in fact implement equality in sensible way (such comparing primary keys). should ensure case,

php - create assciative array while loop without quotes around values -

i have php code creates array display json: $return_arr = array(); $sql="select * prices "; $rs=mysql_query($sql,$conn) or die(mysql_error()); while($result=mysql_fetch_array($rs)) { $return_arr[] = array('label' => $result["product"], 'id' => $result["sequence"]); } currently, displays like: var data = [{"label":"voip telephone numbers","id":"3"},{"label":"voip port submit","id":"4"}]; but need quotes (") removed label , id this regex use task: $not_valid_json = preg_replace(array('%([{,])(\s*)"([a-z0-9]+)"\s*:%i','%\\\\/%','%"%'), array('$1$3:','/','\''), json_encode($value)); be aware though not valid json anymore according spec, still evaluate in javascript. also note doesn't work great if value being encoded contains quotes.

symfony - Doctrine ORM select articles by list of tags -

i have webinar entity connected tag 's many-to-many association. i want fetch webinars list of tags, webinar must have tags in list appear in result. and have following code query it: $tags = [1, 2]; // base query. $builder = $this->getentitymanager()->createquerybuilder() ->select('w, vr, ar, t') ->from('model:webinar', 'w') ->leftjoin('w.videorecord', 'vr') ->leftjoin('w.audiorecord', 'ar') ->leftjoin('w.tags', 't') ; // tags query. if (isset($tags)) { $builder ->andwhere('t.id in (:tags)') ->setparameter('tags', $tags) ; } // other conditions. // ... // issuing query. return $builder->getquery()->getresult(); this query give me webinars have @ least 1 tag in list (or), want have tags in list (and). i've found answer . looks have more complex example , i'm not sure how re-write co

Coldfusion replace() not working on xml imported text -

i'm pulling in xml feed third party website. description field feed contains lot of special characters. when run replace tag on text doesn't change anything. can tell me i'm doing wrong. i've tried running same code , typing in 1 of words feed , replace happens successfully. i've tried using demoronize cflib , doesn't change anything. <cfhttp url="http://somewebsite.com/myfeed.xml" method="get"> <cfset mydoc = xmlparse(cfhttp.filecontent) /> <cfloop from="1" to="#arraylen(mydoc.venues.xmlchildren)#" index="i" > <cfoutput> <cfset description = '#mydoc.venues.event[i].description.xmltext#'> raw description: #description#<br/> alt description 1: #replace(description, "’", "'", "all" )#<br/> alt description 2: #replace(description, chr(180), "'", "all" )#<br/> </c

oracle - PL/SQL: Passing an 'array' of strings as argument to sql -

using plsql, want run test.sql multiple times, each time pass in different argument test.sql , spool result different file. the file name may not have relation argument being passed. i'm hoping can define 2 'arrays'; 1 filename spool to, , other argument value. declare my_types sys.dbms_debug_vc2coll := sys.dbms_debug_vc2coll('typea', 'typeb', 'typec'); my_filenames sys.dbms_debug_vc2coll := sys.dbms_debug_vc2coll('filenamefora', 'filenameforb', 'filenameforc'); begin r in my_types.first..my_types.last loop --dbms_output.put_line(my_types(r)); --dbms_output.put_line(my_filenames(r)); spool my_filenames(r) @test.sql my_types(r); spool off end loop; end; / for spool, says encountered symbol "my_filenames" when expected := . < @ % ; . also, looks test.sql taking argument put in literally, 'my_types(r)' instead of expected 'typea' . if there different ,

VBA: Parse preceding numbers from string -

Image
i need parse 2 substrings string starts numeric text followed alpha-numeric text. strings can vary bit, not much. below examples of incoming format , strings need: "00 10 50 information bidders" ==> "00 10 50", "information bidders" "001050 information bidders" ==> "001050", "information bidders" "00 10 50 - information bidders" ==> "00 10 50", "information bidders" "001050 -- information bidders" ==> "001050", "information bidders" i hoping half dozen lines of vba, code turning loop i'm testing every character in string see changeover numeric-only non-numeric, parsing string based on changeover location. not big deal, messier hoping for. there vba functions eliminate need iterate through each string character? well, question poor, don't state if want done in word, excel etc... i've assumed excel. so, either want,

rebase - Reorganising git commits into different branches -

i trying reorganise git tree structured bit better. @ moment have single master branch couple of small feature branches split it. want go , reorder commits in main branch ones corresponding new version numbers , have in between commits reside in separate develop branch feature branches split too. i'm looking tool let me manually reorganise tree. thought maybe interactive rebasing looking trying in sourcetree makes seem not right tool. can give me advice on how best proceed. below diagram of current structure: featurea x-x-x / \ master a-x-x-x-x-b-x-x-x-c d desired structure: feature x-x-x / | develop x-x-x-x-x-x-x - / | | | master - b - c - d having linear history -like current structure- wanted many people. if want try new workflow, adopting on, without changing past? save trouble. however, if want chang

javascript - jquery Trigger delegate event for nth element onload -

in page have 10 images have same class "select-option" my html is <div class="select-option swatch-wrapper selected" data-name="a scary monster" data-value="a-very-scary-monster"> <a href="#" style="width:120px;height:120px;" title="" class="swatch-anchor"> <img src="image ur1" alt="" class="" width="120" height="120"></a></div> similarly have 10 images. function init_swatches() { $('.select-option').delegate('a', 'click', function(event) { ///////////// code here var $the_option = $(this).closest('div.select-option'); }); } i want preselect 3rd image. thew selected image has class 'selected', others not. how trigger 3rd or 4th element on load. how manually trigger delegate event nth element. here want trigger click event first b

jquery - Is there a way to add number inside the JQM icons -

i trying replace arrow-l icon numbers in jqm form page. here fiddle updated fiddle as can see in fiddle using arrow-l icons want how change these icons numbers 1-----2------3----4 . thanks in advance working example: http://jsfiddle.net/gajotres/b33k9/ just find better looking icons html: <div class="ui-block-a"><a class=" center1 ui-shadow ui-btn ui-corner-all ui-btn-icon-notext ui-btn-inline ui-icon-one">button</a><div class="line" style="margin-left:62%"></div> </div> <div class="ui-block-b"><a class=" center1 ui-shadow ui-btn ui-corner-all ui-btn-icon-notext ui-btn-inline ui-icon-two">button</a><div class="line" style="margin-right:62%"></div><div class="line" style="margin-left:62%"></div> </div> <div class="ui-block-c"><a class="center1 ui-shadow

matlab - Time delay of audio signal -

here scenario: i'm generated signal is: 200ms @ 2khz 1000ms of zeros 200ms @ 2khz and want calculate time delay between them, not between 2 synthetic audio part. playing signal on speaker , recording using microphone (adds noise) fs = 44100 i tried: 1. cross correlation 2. calculation diff between 2 maximas of rms window @ size of 8820 samples. (we maxima when window on sound part. the distance between speaker , mic around 30cm. cant steady result. why? if want accurately , consistently 1 method have used in past loop 1 channel (e.g. left channel) output input , use other (i.e. right) channel timing test. can cross correlate between left (loopback) , right (actual audio) channels. eliminates many potential sources of error (buffer delays, hardware latency, software issues, etc), since left , right channels "in sync" , should able make measurements accurate +/- 1 sample period (+/- 12 µs @ 44.1 khz).

shell exec - passing array containing list of urls to shell_exec function in php -

i creating code contain shell script in php. when try run using shell_execute not getting actual result. here's code: for($i;$i<5;){ $output = shell_exec('./url_integrity_check.sh ' ."'echo $test[$i]'" ); $i++; } $test array contain list of values. when run code takes $test[0] means top value of array every time, want loop through values of array , execute shell script each time increments value of $i try this for($i=0;$i<5; $i++){ $url = "./url_integrity_check.sh " . $test[$i]; $output = shell_exec($url); }

qt - qDebug not showing __FILE__,__LINE__ -

according qlogging.h #define qdebug qmessagelogger(__file__, __line__, q_func_info).debug but when use this, file,line,function name not show. qdebug()<< "abc"; // show abc; qdebug()<< ""; // show nothing; i search while, seems no 1 had problem above. i use ubuntu14.04,g++ version 4.8.2, qt5.3 build git. if dig in qt history can find out __file__ , __function__ logged in debug builds since 1 oct 2014. git commit hash d78fb442d750b33afe2e41f31588ec94cf4023ad. commit message states: logging: disable tracking of debug source info release builds tracking file, line, function means information has stored in binaries, enlarging size. might surprise commercial customers internal file & function names 'leaked'. therefore enable debug builds only.

sftp - FTP Client Output Response standard -

after successful ftp file transfer, the response used " 226 file send ok ", suddenly, has changed " 226 transfer complete " i have below questions: does ftp response code has standard? can customize ftp output response specific status code? find standard ftp response file transfer $ ftp canopus connected canopus.austin.century.com. 220 canopus.austin.century.com ftp server (version 4.1 sat nov 23 12:52:09 cst 1991) ready. name (canopus:eric): dee 331 password required dee. password: 230 user dee logged in. ftp> pwd 257 "/home/dee" current directory. ftp> cd desktop 250 cwd command successful. ftp> type ascii 200 type set a. ftp> send typescript 200 port command successful. 150 opening data connection typescript (128.114.4.99,1412). 226 file send ok. ftp> cdup 250 cwd command successful. ftp> bye 221 goodbye. note: response text 226 file send ok has changed 226 transfer complete find details ftp responses on wikipedia

I can not view the XML in browser by xslt -

i using below mentioned codes in xml & xslt xml: <?xml version="1.0" encoding="utf-8" standalone="no"?> <?xml-stylesheet type="text/xsl" href="wiley.xsl"?> <!doctype component public "-//jws//dtd wileyml 20110801 vers 3gv2.0//en" "wileyml3gv20-flat.dtd"> <component xmlns="http://www.wiley.com/namespaces/wiley" version="2.0" type="serialarticle" xml:lang="en" xml:id="ecog473"> xslt: <?xml version='1.0' encoding='utf-8' ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="2.0" xmlns:xlink="http://www.w3.org/1999/xlink"> <xsl:output method="html"/> <xsl:template match="/"> but texts displaying without styles (as text), , has broken in end of document , display error message. error in ie , c

python - Need for Performance in bash script -

i have 50000 files , each 1 has 10000 lines. each line in form: value_1 (tab) value_2 (tab) ... value_n i wanted remove specific values every line in every file (i used cut remove values 14-17) , write results new file. for doing in 1 file, wrote code: file=nameoffile newfile=$file".new" i=0 while read line let i=i+1 echo line: $i a=$i"p" linefirstpart=$(sed -n -e $a $file | cut -f 1-13) #echo linefirstpart: $linefirstpart linesecondpart=$(sed -n -e $a $file | cut -f 18-) #echo linesecondpart: $linesecondpart newline=$linefirstpart$linesecondpart echo $newline >> $newfile done < $file this takes ~45 secs 1 file, means take about: 45x50000 = 625h ~= 26 days! well, i need faster , e.g. solution cats whole file, applies 2 cut commands simultaneusly or guess. also solutions in python accepted + appreciated bash scripting preferable! the entire while loop can replaced 1 line: cut -f1-13,18- $file

node.js - SSL Client Authentication in Openshift with Custom SSL Certificate -

is possible use ssl client authentication in node.js application in openshift? now openshift supports custom ssl certificates (sni based) 0$ in bronze plan, attractive switch bronze plan. seems client certificate not accessed application (i.e. node.js). or there hidden flag i'm missing? the ssl certificate hosted on apache reverse proxy on node, , not accessible gear. can x-forwarded-proto header see if request https request or not.

java - Converting spring XML file to spring @Configuration class -

following question understanding spring @autowired usage wanted create complete knowledge base other option of spring wiring, @configuration class. let's assume have spring xml file looks this: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <import resource="another-application-context.xml"/> <bean id="somebean" class="stack.overflow.spring.configuration.someclassimpl"> <constructor-arg value="${some.interesting.property}" /> </bean> <bean id="anotherbean" class="stack.overflow.spring.configuration.anotherclassimpl"> <constructor-arg ref="somebean"/>

r - First element in a data.table aggregation -

i have data.table of tick data, want aggregate seconds timeframe. while getting max , min , last pretty straightforward: data[, list(max(value), min(value), last(value)), by=time] i struggling first datapoint corresponds second timestamp. there nothing in manual. there easy way it, say, sql top ? i managed find solution. query first element subset column's first value using [ : data[, list(value[1], max(value), min(value), last(value)),by=time] maybe helps someone.

run python script from command line and then enter interactive mode -

is there way run python module command line ( -m option, imports , runs module ), , enter interactive mode? i need similar "cmd /k command". i tested -i option, didn't work; i'm not sure seems redirects in_stream input. you need put -i before -m . the -m option interface option; terminates option list , subsequent arguments end in sys.argv module's main function. ( link doc )

java - Sometimes, I don't get a ACTION_BOND_STATE_CHANGED -

i have created receiver , listening action_bond_state_changed. have code responds creation of bond , moves forward other things. the problem 2/3 of time, pair device , code on action_bond_state_changed never gets called. 1 third of time does. there's nothing in log after log entry says i'm waiting bonding. is there other result can happen result of pair request?

Exclude Char from Python For -

i array values request.post : array = [1,2,3] when iterating in for this: for item in array i invalid literal int() base 10: ',' i need save values in database table. what best way solve this? thanks looks you're getting string, not array. in case, can this: import json array = '[1, 2, 3]' item in json.loads(array): print item # prints 1, 2, 3 alternatively, if want skip isn't integer (though not recommended), can use try/except block in loop: array = '[1, 2, 3]' # or array = '1, 2, 3', whatever case may item in array: try: print int(item) except valueerror: pass this silently ignore isn't integer.

Undirected graph in Oracle SQL -

i'm trying represent undirected graph in oracle sql, example, have stations graph: create table station ( station_id integer not null ); create table station_link ( from_station integer not null, to_station integer not null ); this directed graph, have no idea, how make undirected. point : i need vertices, have path current vertex , information level (how many vertices on path). for directed graph pretty easy: select sl.to_station, level station_link sl start sl.from_station = :curvertex connect nocycle prior sl.to_station = sl.from_station but one-way verticies. question: do problem have solution, except adding additional links (2 -> 1 1 -> 2)? there sql fiddle tests: http://sqlfiddle.com/#!4/6c09e/24 for "fast win" can use structure "as is", every edge shold have 2 records in station_link table. if want "not_so_fast_but_without_doble_edge_records_please win", can use weirdo-trick: select x.to_stat

The authorization popup for the Google Marketplace whitescreens and doesn't close after install and other problems with the install page -

Image
when user goes unlisted marketplace app page , installs app authorization popup window white screens , doesn't close. if manually close popup moves on normal. have suspicion it's because app unlisted, since haven't seen issue other marketplace apps, of right can't change that. another issue we've had page integrate google button doesn't seem respect current profile user using. seems use default profile can confusing user if wanted use different google profile using. note: app url i've posted used local development happens on our production app well

How to initialise a string from NSData in Swift -

i have been trying initialise string nsdata in swift. in nsstring cocoa documentation apple saying have use this: init(data data: nsdata!, encoding encoding: uint) however apple did not include example usage or put init . i trying convert following code objective-c swift nsstring *string; string = [[nsstring alloc] initwithdata: data encoding: nsutf8stringencoding]; i have been trying lot of possible syntaxes such following (of course did not work): var string:nsstring! string = init(data: foodata,encoding: nsutf8stringencoding) this how should initialize nsstring : swift 2.x or older let datastring = nsstring(data: foodata, encoding: nsutf8stringencoding) swift 3 or newer: let datastring = nsstring(data: foodata, encoding: string.encoding.utf8.rawvalue) this doc explains syntax.

ember.js - Facebook Comments with Ember Views in Subroute -

i trying add facebook comment plugin 1 of subroutes, problem is shown when refresh page. navigate somewhere else (= view in added snippet removed) gone. meaning when navigate same route, facebook plugin not reinitialized. is there way prevent being destroyed or maybe "fb.init()" on route activation? if you're using xfbml can call fb.xfbml.parse(document.getelementbyid('foo')); or call without parameters, on entire page.

Android Bluetooth LE: Not discovering services after connection -

i'm trying use android's bluetooth low energy communicate ble device. first time connect, works fine (connecting gatt server works, services , characteristics discovered, etc.) but, if disconnect , try re-connect, connect gatt server, not able discover services. have kill app , restart it, , doesn't work. this code i'm using disconnect device: public void close(view view) { if (mbluetoothgatt == null) { return; } mbluetoothgatt.close(); mbluetoothgatt = null; } is there else need when disconnecting? there seems resource still connected prevents discovery of services when try , reconnect. i seem have found solution: need call both bluetoothgatt.disconnect() , bluetoothgatt.close() .

Can't access Sites folder on OS X 10.10 (Yosemite) -

my sites folder working fine on 10.9 when upgraded 10.10, stopped working. mean, when type: http://localhost/ i correct message. when try access file stored in sites folder, says: not found 404 i double checked everything. httpd.conf username.conf but still doesn't works. have tried browser other safari? i noticed , have had success accessing local applications in chrome. haven't found reason why safari blocking connections localhost addresses though.

r - Determine the number of NA values in a column -

i want count number of na values in data frame column. data frame called df , , name of column considering col . way have come following: sapply(df$col, function(x) sum(length(which(is.na(x))))) is good/most efficient way this? you're over-thinking problem: sum(is.na(df$col))

java - How to draw 6 boxes and after the first 3 change the position of the final 3 -

i'm trying draw 6 boxes loop, have first 3 boxes drawn @ curtain x , y coordinate after first 3 have been drawn draw final 3 @ same x coordinate @ different y coordinate. more detail: boxes have same width , height have 10 px of space between each needs repeatable infinite amount of boxes for(int = 0; < bricks.length; i++) { bricks[i].setsize(size); if(i <= 2) { bricks[i].setposition(i * (size + 10) + 180, 20); } bricks[i].setstate(brickstate.white); } for(int = 0; < bricks.length; i++) { bricks[i].setsize(size); bricks[i].setposition((i%3) * (size + 10) + 180, (i/3) * (ysize +10) + yoffset); bricks[i].setstate(brickstate.white); } by using i%3 instead of resulting x positions 0 1 2 0 1 2. move on start when go next line. y code i/3 give 0 0 0 1 1 1 therefore moving last 3 boxes down one.

python - django form doesn't show up or object takes no parameters error -

i add form on website firms list themselves. it's kind of local business directory wanted build django. when try show form on "add-business" page 2 different results. the first result is: if use {{ form.as_p }} doesn't show form. the second result is: if try build form own html inputs, says object() takes no parameters , pointing @ request.post within view ( form = addbusinessform(request.post) ) can see below. i don't know wrong. view same django docs. my model : class firma(models.model): user = models.foreignkey(user, on_delete=models.cascade) firm_name = models.charfield(max_length=120) firm_adress = models.charfield(max_length=200) firm_city = models.charfield(max_length=100) firm_desc = models.textfield(max_length=2000) firm_email = models.emailfield(max_length=80, unique=true,validators=[validate_email, ]) firm_phone = models.charfield(max_length=20) firm_website = models.charfield(max_length=60, validators=[u

Why intellesense for file path and installed npm package is not showing in vs code until I press Ctrl + space for typescript -

intellisense before press ctrl + space: enter image description here intellisense after press ctrl + space: enter image description here i upgraded vs code version 1.11.0 , opened project. when try use import statement in code, code completion not working installed node modules until press ctr + space. (before upgrade) when start type node module name in (import {foo} 'fo') see suggestions. foo file (after upgrade) not working. i solved changing strings: true in editor.quicksuggestions set false after upgrade vscode version 1.11.0. can find these options going file > preferences > settings. settings.json open. search editor.quicksuggestions , click on edit icon set strings true. "editor.quicksuggestions": { "other": true, "comments": false, "strings": true }

python - How to change default version of pip3 from python3.5 to python3.6 -

i'm new python i've learned basics , how works. i've been trying install django framework server can host webpage. basically problem here when run commands such as: python3 -v i output python 3.6.1 but reason when using pip3 decides use pip version specific python 3.5, example doing: pip3 install django==1.11 installs django in "/usr/local/lib/python3.5/dist-packages" instead of python 3.6 counterpart of dist-packages directory. according python documentations ( https://docs.python.org/3/installing/index.html?highlight=pip#work-with-multiple-versions-of-python-installed-in-parallel ) should able run command: python3.6 -m pip install somepackage to use pip specific python 3.6, doesn't seem work. error saying "no module named pip" or "no module named pip3". i running on server uses ubuntu 16.04 i appreciate help, in advance! :) edit: have tried running pip3 -v which gave me output pip 9.0.1 /home/user/.loca

c# - MVVM Validation With Entity Framework -

i'm working on project using mvvm , entity framework code first model. implemented idataerrorinfo , inotifypropertychanged in model classes. now, in viewmodel implemented savecommand , cansave boolean method, question how can raise canexecutechanged whole entity , not individual properties? since properties implemented inotifypropertychanged in model. this model class public class guest:validatablebindableclass { //my properties here //implement inotifypropertychanged , idataerrorinfo } this viewmodelclass: public class addeditguestviewmodel:bindableclass { private hospede guest; public relaycommand savecommand { get; set; } private readonly hmsdb.hms context = new hmsdb.hms(); public hospede guest { { return guest; } set { setproperty(ref guest, value, propertyname: "guest"); } } private void onsave() { context.hospedes.add(guest); context.savechanges(); } private bool cans

python - AttributeError: 'RangedWeapon' object has no attribute 'owner' -

in person object, there support inventory, , when person object takes weapon object or food object, object go inventory. tribute object, want retrieve weapon objects inventory creating new method in tribute class, get_weapons() , return tuple of weapon objects tribute has in inventory. class tribute(person): ... def get_weapons(self): self.weapons=[] item in self.get_inventory(): if isinstance(item,weapon): self.weapons.append(item) return tuple(self.weapons) cc = tribute("chee chin", 100) chicken = food("chicken", 5) aloe_vera = medicine("aloe vera", 2, 5) bow = rangedweapon("bow", 4, 10) sword = weapon("sword", 2, 5) base = place("base") base.add_object(cc) base.add_object(chicken) base.add_object(aloe_vera) base.add_object(bow) base.add_object(sword) cc.take(bow) # chee chin took bow cc.take(sword)