Posts

Showing posts from January, 2015

common table expression - SQLite Concatenating Column values -

there similar answers other database types haven't found example sqlite, i've included answer came with. the problem given table following ╔══════════╦══════╗ ║ item ║ tag ║ ╠══════════╬══════╣ ║ "item1" ║ "a" ║ ║ "item1" ║ "b" ║ ║ "item1" ║ "c" ║ ║ "item2" ║ "a" ║ ║ "item1" ║ "d" ║ ║ "item2" ║ "f" ║ ║ "item1" ║ "e" ║ ╚══════════╩══════╝ create output of: ╔═══════════╦═════════════╗ ║ item ║ tags ║ ╠═══════════╬═════════════╣ ║ "item1" ║ "a,b,c,d,e" ║ ║ "item2" ║ "a,f" ║ ╚═══════════╩═════════════╝ that's group_concat() for: select item, group_concat(tag) tags (select item, tag t order item, tag) group item;

angularjs - SHOUTcast metadata in javascript -

i'm working on front end internet radio station , they're broadcasting shoutcast stream. have audio, need simple , reliable way display metadata on page. i'm using mean stack run whole thing if has answer fits framework preferable. here's little whipped up. uses json-p results shoutcast, can done client side without cors issues etc function dosomething(obj) { document.getelementbyid('shout').textcontent = obj.songtitle; } var getshout = (function() { var script; return function shout(fn, sc, sid) { if (script) { document.body.removechild(script); } script = document.createelement('script'); script.src = sc + 'stats?json=1&callback=' + fn + '&sid=' + sid + '&rand=' + math.random(); document.body.appendchild(script); }; }()); document.getelementbyid('eatme').addeventlistener('click', function() { ...

A few questions surrounding javascript arrays, in-built methods -

![enter image description here][1] function setfood () { var empty = []; (var x=0; x<grid.width; x++) { (var y=0; y>grid.height; y++) { if (grid.get(x,y) === empty) { empty.push({x:x, y:y}); } } } }; i watched video on youtube making snake game , came across whilst creator making function. now have few questions want know answer can keep learning. first: .get method? when searched it gave me results on jquery ever referenced jquery library anywhere javascript code? empty ? pre programmed term javascript means same thing 0 or ``null? , lastly. why creator using brackets within push method? push empty array? , x:x , y:y mean? i sorry questions. it's not have other people turn coding questions except coding community itself. empty array, declared in var empty = []; empty , on other hand, variable. javascript case-sensitive it's not alias of empty[] array. it's common practice define constants in u...

excel - Is it possible to write a custom Power Query Connector? -

in power query under “from other sources”, see number of specialized providers (facebook, sap, salesforce, etc). i interested in writing custom provider access local proprietary data store cannot consumed via of built in connectors. i aware "the recommended way" access data stores not have supporting connector expose & consume data via odata feed. however, have user friendly interface such user can find specific feed want. from playing of different providers, seems there 2 parts: a) ui specifying mandatory connection parameters, , optionally choosing specific entities , filters b) provider of physical data (facebook.graph(), sql.database(), etc) is there way write custom connector, or connectors 100% proprietary , provided microsoft? edit: i should note, knowledgeable "no it's not possible , here's why think so" answers encouraged. i'm asking is possible ? it's not possible, it's area we're actively expl...

java - Gradle transparently rename dependecy package -

is possible create dependency, on compile transparently repackaged? idea follows: // project library dependencies { compile 'some.library:artifact:version' } repackage { rule 'some.library.**' 'ext.library.**' } // main project, uses directly "import ext.library.classname" dependencies { compile project(':library') } also, related, my, unanswered question: gradle rename maven dependency package (httpcomponents, android)

ios - UISwipeGesture on imageView within tableView not working -

i'm trying add swipe gesture(left/right) on uiimageview within tableviewcell . have working, however, i'm having trouble when swipe(left/right) image show change. here's code add swipe gesture within cellforrowatindexpath resultsimagefileone[indexpath.row].getdatainbackgroundwithblock{ (imageonedata: nsdata?, error: nserror?) -> void in if error == nil { let imageone = uiimage(data: imageonedata!) //cell.imageview.image = imageone <- set image uiimageview self.pictureone = imageone //global } } resultsimagefiletwo[indexpath.row].getdatainbackgroundwithblock { (imagetwodata: nsdata?, error: nserror?) -> void in if error == nil { let imagetwo = uiimage(data: imagetwodata!) //cell.imageview.image = imagetwo <- set image uiimageview self.picturetwo = imagetwo //global } } var swipeleft = uiswipegesturerecognizer(target: self, action: "swipeimage:") swipeleft.direction = uiswipegesturerecognizer...

jquery - Dynamic Javascript to allow character input after limited with preventDefault -

i have dynamic javascript rules engine in based on criteria such dropdown not changed, prevent characters being entered $(document).on('keypress',"[id^="+condtionid+"]", function(event){ event.preventdefault(); }); however, if change dropdown value allow character, textbox refuses allow input. examples of ids: select: id="selectnumber435" input: id="condtionid435" every row dynamically created table ends same random number created. problem once not allow input, tried return true; did not work even condition in allow numeric, change dropdown value allows input , "holds on thinking should allow numeric. i prefer not have make user delete dynamically created row, there has way allow typing characters input box again. sort of "reset" ... you can dettach attached event: $(document).off('keypress',"[id^="+condtionid+"]");

java - How to change every program in a JDK to default -

i have done update-alternatives java: $ java -version java version "1.8.0_45" java(tm) se runtime environment (build 1.8.0_45-b14) java hotspot(tm) 64-bit server vm (build 25.45-b02, mixed mode) but javac still says: $ javac -version javac 1.9.0-ea because use java 9 stuff. how change @ once? i not @ shell, script looks through of files in bin , uses update alternatives on them fine. there in webupd8 repository oracle-java_-setdefault package, can use. , works better script. see ppa:webupd8team/java

sql - Linq query does not return results but normal Query does -

i have linq query in application looks like claim[] claimlst = (from clms in dbcontext.claims clms.@switch == 8 && (clms.status == "received ok" || clms.auto_resubmit == 1) && ((short)clms.timarkedforsubmission_m == 0 || (short)clms.timarkedforsubmission_t == 0) select clms).toarray(); when @ in sql server profiler can see gets resolved exec sp_executesql n'select [t0].[id], [t0].[datetime_received], [t0].[uniqueid], [t0].[practice_number], [t0].[regnum], [t0].[claim_number], [t0].[status], [t0].[date_time], [t0].[action], [t0].[med_resp], [t0].[tar_resp], [t0].[switch], [t0].[auto_resubmit], [t0].[auto_resubmit_count], [t0].[timarkedforsubmission_m], [t0].[timarkedforsubmission_t] [dbo].[claims] [t0] ([t0].[switch] = @p0) , (([t0].[status] = @p1) or ([t0].[auto_resubmit] = @p2)) , ((([t0].[tim...

android - Robotium - click on content-desc and start test on running activity -

1st question i'm trying go click on button near menuitem (on galaxy s6) robotium. here button here class , content-desc of button ui automator viewer i trying click on many ways can't.. example can click on next 1 button solo.clickonmenuitem("string"); because 1 one has content-desc: menu. so how can click 1st one? 2nd question can start robotium test on opened apk? mean open manually application, log on user account, , leave next activity opened. run robotium test with: adb shell instrument -w -e class com.android.foo.footest com.android.foo/android.test.instrumentationtestrunner and test begins activity, need making automated presentations. all test running starting apk on itself, how can skip it?

ios - Capture WKWebView audio for metering -

i working on app contains wkwebview in have loaded iframe video streaming youtube. i able create audio visualizer shown alongside iframe , moves in reaction audio stream. i have been following along this ray wenderlich tutorial creating music visualizer, tutorial uses setmeteringenabled , updatemeters functions built in avaudioplayer . is there way meter audio coming wkwebview ? want average volume level, not actual audio stream itself. i have attempted @ libraries the amazing audio engine , none of them seem allow capture channel coming wkwebview @ all, let alone metering purposes.

python - tkinter tic tac toe program -

i experimenting tkinter , thought of implementing simple tic-tac-toe game. here came with import tkinter tk class gui(tk.frame): def __init__(self, master): super().__init__(master) self.parent = master self.parent.title("tic tac toe") logo = tk.photoimage(file="x.png") in range(3): j in range(3): w = tk.label(self,image=logo) w.grid(row=i, column=j) self.pack() if __name__ == '__main__': root = tk.tk() logo = tk.photoimage(file="x.png") f = gui(root) root.mainloop() when execute nothing being displayed. have image in current folder. verify if doing right changed main part to: if __name__ == '__main__': root = tk.tk() logo = tk.photoimage(file="x.png") f = gui(root) in range(3): j in range(3): w = tk.label(f,image=logo) w.grid(row=i, column=j) f.pack() ...

php - How can I multithread with curl? -

i have hash checker works curl. checks hashes api. api fast can make faster multithreading? here current code. it's current speed 1-2 hashes per second. want more that. <?php include_once("curl.php") ; $hashes = file_get_contents("hashes.txt"); $accs = explode("\n",$hashes); foreach($accs $a){ $x = explode(":",$a); $c = new curl("website.com"); $c->setopt(curlopt_followlocation, true) ; $c->setopt(curlopt_post, true) ; $c->setopt(curlopt_returntransfer, true); $c->setopt(curlopt_cookiesession, 1); $c->setopt(curlopt_cookiejar, 'cookie.txt'); $c->setopt(curlopt_cookiefile, 'cookie.txt'); $c->setopt(curlopt_post, true); $c->setopt(curlopt_postfields, "hash0=".$x[0]."&verify=".$x[1]); $done = $c->exec(); echo $done; } ?>

ios - Swift Physics-fatal error: unexpectedly found nil while unwrapping an Optional value when two characters collide -

Image
background on game: control character moves right , left , try dodge falling blocks. there 3 players spawned. 1 in middle of screen, , 2 size.width away middle player on either sides. this error happens once in around 10 collisions playerright or playerleft or player , falling blocks. can see screenshot below, player not seem touching falling block when crashes. error code , screenshots: fatal error: unexpectedly found nil while unwrapping optional value (lldb) thread 1: exc_bad_instruction (code=exc_l386_invop, subcode=0x0) how game scene stopped i'm thinking has how built "infinitely" horizontal scrolling player. have 3 separate characters , once middle character goes past size.width or below 0 position on screen changed opposite side of screen making infinite. maybe player teleported inside of block , gives nil error. not sure looks has that. anyway, heres relevant code gamescene. import spritekit import foundation import uikit //collisions s...

javascript - node.js asynchronous passing variable between functions -

i taking first steps node.js , came across issue passing variable in asynchronous way. have piece of code im using create facebook user: req.tmppassport = {}; var fb = new fbgraph.facebook(accesstoken, 'v2.2'); function inituser() { fb.me(function (err, me) { req.tmppassport.me = me; console.log(req.tmppassport.me) // works }); } console.log(req.tmppassport.me) // not working -> undefined var i tried figure out why second log isn't working , ended reading synchronous , asynchronous functions, in attempt implement read tried coming solution using callbacks, no success. last attempt this: req.tmppassport = {}; var fb = new fbgraph.facebook(accesstoken, 'v2.2'); function inituser() { fb.me(function (err, me) { req.tmppassport.me = me; }); fb.my.events(function (err, events) { //console.log(events); req.tmppassport.events = events; }); fb.my.friends(function (err, result) { req.tm...

php - Laravel: Use Memcache instead of Filesystem -

whenever load page, can see laravel reading great amount of data /storage folder. generally speaking, dynamic reading , writing our filesystem bottleneck. using google app engine , our storage in google cloud storage, means 1 write or read equal "remote" api request. google cloud storage fast, feel it's slow, when laravel makes 10-20 cloud storage calls per request. is possible store data in memcache instead of in /storage directory? believe give our systems lot better performance. nb. both session , cache uses memcache, compiled views , meta stored on filesystem. in order store compiled views in memcache you'd need replace storage blade compiler uses. first of all, you'll need new storage class extends illuminate\filesystem\filesystem . methods bladecompiler uses listed below - you'll need make them use memcache. exists lastmodified get put a draft of class below, might want make more sophisticated: class memcachestorage ext...

mysql - SQL SUM only return values >=1 -

i have simple query want return values select advisor advisor, sum(`outcome` '%tps_approved%') approved shift_report `team`!=6 , date>20150720 , date<20150728 group `advisor` order `advisor` i want return advisor , approved count if count >=1 would want ? select advisor advisor, count(*) approved shift_report `team`!=6 , date>20150720 , date<20150728 , `outcome` '%tps_approved%' group `advisor` order `advisor`

ios - Set iPad launch only in LandscapeRight. -

Image
this question not same current exist question. i've set device universal, , checked landscaperight. when launch app in iphone, can work in landscaperight expected. but ipad can rotate, don't know why. tried - (bool) shouldautorotate { return yes; } - (nsuinteger)supportedinterfaceorientations { return uiinterfaceorientationmasklandscaperight; } - (uiinterfaceorientation)preferredinterfaceorientationforpresentation { return uiinterfaceorientationlandscaperight; } you can try method. hope can out open info.plish in project, find `supported interface orientations. the first 1 supported interface orientations iphone, second 1 supported interface orientations ipad, should leave 1 row (landscape) picture shows.

java - org.usb4java.LoaderException: Native library not found in classpath error -

am trying use usb4java library project running in ubuntu 64bit. getting following error; 30 jul 2015 09:46:16,225 info controller : working directory: /opt/dock exception in thread "main" java.lang.exceptionininitializererror @ uk.co.swimtag.control.controller.finddevice(controller.java:755) @ uk.co.swimtag.control.controller.startapplication(controller.java:150) @ uk.co.swimtag.control.controller.main(controller.java:104) caused by: org.usb4java.loaderexception: native library not found in classpath: /org/usb4java/linux-x86_64/libusb4java.so @ org.usb4java.loader.extractlibrary(loader.java:281) @ org.usb4java.loader.load(loader.java:358) @ org.usb4java.libusb.<clinit>(libusb.java:640) ... 3 more here 2 jars in manifest file, , sure x86_64 lib in project; lib/mail.jar lib/gson-1.6.jar lib/usb4java-1.2.0.jar lib/libusb4java-1.2.0-linux-x-86_64.jar conf/ any 1 had similar problems usb4java. silly have missed. thanks ...

methods - C# Optional parameters / multiple required -

is possible requirement 2 optional parameters together? here's example: public void paramchoise(string a, bool b = false, string c = "y") { // stuff here } where b optional, want function require c if b true. logic that: public void paramchoise(string a, (bool b = false, string c = "y")) couldnt find googling. 1 possible way me be: /// <summary> /// if want behaviour xxx enabled, please enter "c" usage. /// </summary> /// <param name="a"></param> /// <param name="c"></param> public void paramchoise(string a, string c = "y") { // stuff here } for sure give function comment this, writing comment unlogical given parameter feels bad me. this case maybe bad example im sure i'll run again in future. thanks :). edit clear things: possible combination parameters: a only a ...

parse.com - Unit test says function was called, but console.logs are not showing up -

i have function inside function supposedly getting called, according expect(parse.user.login).tohavebeencalled() line, there console statements inside callback aren't showing up. is there type of dependency i'm missing on unit test causing callback not have called? think getting server, because tells me need parse.initialize application keys if that's not present. how resolve it? it occurred me, maybe that's in parse.js telling me need parse.initialize(keys,keys). changed parse keys nonsense, , not telling me they're wrong, must parse isn't being touched @ all. no request being sent server. i've been putting few questions this, guess can't done karma-jasmine -- @ least way app set right now. it's depending on web service give errors, instead of having angular directive set up front detect errors in fields beforehand. i'm newbie @ obviously, or have recognized sooner: this type of testing, depending on responses server , t...

executorservice - Spring Integration - If Poller and TaskExecutor are not in tune then memory leak -

in below 7.1.7 asynchronous polling section of spring integration doc, memory leak might occur if poller , taskexecutor not in tune explained. did not understand it. http://docs.spring.io/autorepo/docs/spring-integration/3.0.x/reference/html/messaging-endpoints-chapter.html#async-polling <int:service-activator input-channel="publishchannel" ref="myservice"> <int:poller receive-timeout="5000" task-executor="taskexecutor" fixed-rate="50"/> </int:service-activator> <task:executor id="taskexecutor" pool-size="20" queue-capacity="20"/> the above configuration demonstrates 1 of out of tune configurations. the poller keeps scheduling new tasks though threads blocked waiting either new message arrive, or timeout expire. given there 20 threads executing tasks 5 second timeout, executed @ rate of 4 per second (5000/20 = 250ms). but, new tasks being scheduled @ rate ...

File is not downloaded completely using Java code -

i'm using java download file, have used 3 different code snippets i'm going post here. result same. downloading file partially , result file can't opened not downloaded completely. how should fix problem. my first code: public class filedownloader { final static int size=1024; public static void main(string[] args){ fileurl("http://textfiles.com/holiday","holiday.tar.gz","c:\\users\\me\\downloads"); } public static void fileurl(string faddress, string localfilename, string destinationdir) { outputstream outstream = null; urlconnection ucon = null; inputstream = null; try { url url; byte[] buf; int byteread,bytewritten=0; url= new url(faddress); outstream = new bufferedoutputstream(new fileoutputstream(destinationdir+"\\"+localfilename)); ucon = url.openconnection(); = ucon.getinputstream(); buf = new byte[size]; w...

Java - Does returning a value break a loop? -

i'm writing code follows following format: public static boolean isincluded(e element) { node<e> c = head; while (c != null) { if (cursor.getelement().equals(element)) { return true; } c = c.getnext(); } return false; } the code search element in list of nodes. however, question if while loop find element if-statement says should return true, return true , break loop? furthermore, if break loop carry on through method , still return false, or method completed once value returned? thanks yes* yes, usually (and in case) break out of loop , returns method. an exception one exception if there block inside loop , surrounding return statement code in block executed before method returns. block might not terminate - example contain loop or call method never returns. in case wouldn't ever exit loop or method. while (true) { try { return; // return technically speaking doesn't exit...

How to click through Access Report using SendKeys -

after having slogged through creating table of contents access report, have gotten point code works, , table of contents created. as instructions microsoft state, need manually click through print preview until last page toc created. works. how can click through access report using sendkeys? here code far... works perfectly, except sendkeys nothing! 'click through report toc code executed dim rptcurreport report set rptcurreport = screen.activereport rptcurreport application.docmd.selectobject acreport, "rptfundselectionlist" .visible = true 'switch false once code ok 'go through pages = 1 .pages sendkeys "{pgdn}", true next 'docmd.close acreport, "rptfundselectionlist" end i have managed solve issue myself. here code. may other poor soul! 'open report containing code create toc list of isins above docmd.openreport "rptfundselectionlist", acviewpreview, , strwhere set ...

github - Git branch inaccessible -

edit also, because branches have same name, how can delete current 1 on (the wrong one)? if checkout master won't know branch correct. edit edit i have run git branch --verbose master 99b97d2 prep test migrate_to_rpsec d91fd47 start model tests * migrate_to_rspec 99b97d2 prep test how can delete/switch upstream number? want 2nd item on list. i created separate branch named migrate_to_rspec . worked , committed branch git add . git commit -m 'finish model tests' git branch master migrate_to_rspec then moved master git checkout master then tried merge last branch git merge migrate_to_rspec and got merge: migrate_to_rspec - not can merge so checked branch again git branch master migrate_to_rspec and couldn't other branch git checkout migrate_to_rspec and got: error: pathspec 'migrate_to_rspec' did not match file(s) known git. so ran (stupidly) git checkout -b migrate_to_rspec so ...

hadoop - How to query data from AmazonS3 using Apache Drill? -

Image
after using spark saveastextfile s3 format hadoop. format of file in bucket that. format year/month/date/timestamp , data in part-0000 file json format. i config drill , point bucket name { "type": "file", "enabled": true, "connection": "s3://com.giaosudau.win-bid", "workspaces": { "root": { "location": "/", "writable": false, "defaultinputformat": "json" }, "tmp": { "location": "/tmp", "writable": true, "defaultinputformat": null } }, "formats": { "psv": { "type": "text", "extensions": [ "tbl" ], "delimiter": "|" }, "csv": { "type": "text", "extensions": [ "...

maven 3 - How can I overwrite parent version number in parent module from sub module -

i building spring application consists of multiple spring projects micro-services. want put these spring projects parent module , convert multi-module maven project. have met problem each sub-module needs have parent reference spring-cloud-starter-parent, natually, moving parent module. problem happened, each submodule using different version of spring-cloud-starter-parent. let's see below. part of pom parent module: <groupid>com.demo</groupid> <artifactid>spring-cloud-demo</artifactid> <version>2.0</version> <packaging>pom</packaging> <name>spring cloud demo</name> <parent> <groupid>org.springframework.cloud</groupid> <artifactid>spring-cloud-starter-parent</artifactid> <version>angel.sr3</version> </parent> and in sub-module, part of pom is: <parent> <groupid>com.demo</groupid> ...

sql - Need a database efficiency suggestion -

i have following database table. trying figure out way can structure can have position each player column. because each user going have multiple players , there multiple users, cannot figure out best way model db table efficiency. create table `user_players` ( `id` int(11) not null auto_increment, `user_id` int(11) not null, `firstname` varchar(100) collate utf8_unicode_ci not null, `lastname` varchar(100) collate utf8_unicode_ci not null, `username` varchar(100) collate utf8_unicode_ci not null, `email` varchar(100) collate utf8_unicode_ci not null, `player1` varchar(100) collate utf8_unicode_ci not null, `player2` varchar(100) collate utf8_unicode_ci not null, `player3` varchar(100) collate utf8_unicode_ci not null, `player4` varchar(100) collate utf8_unicode_ci not null, `player5` varchar(100) collate utf8_unicode_ci not null, `player6` varchar(100) collate utf8_unicode_ci not null, the thing can think of adding player_position ever player, this... `player1` v...

ios - Xcode (Swift) - How to store name of image file on button -

i trying name image file on uibutton. set image using buttonname.setimage(uiimage(named:"bluepiece.png"), forstate: .normal) buttonname.setimage(uiimage(named:"redpiece.png"), forstate: .normal) and want able compare names of image files in "if statement". also, using swift , xcode 6.4. complare images : if(btn.imageview.image == uiimage(named:"bluepiece.png")){ //do stuff here } or can take 1 boolean variable - set true or false changing , comparing images.

email - Read Using mailbox python -

i'm using linux os. objective convert pst file mbox & read data using mailbox library python. used readpst convert , store in /tmp/ temporary purpose readpst -rs input.pst -o /tmp/ "readpst" has extracted/converted expected. wanted read mail using mailbox library. i have tried following code. import mailbox mbox = mailbox.mbox('/tmp/personal folder/inbox/mbox') message in mbox: print message['subject'] but not working coz, no mbox file not found. while using readpst tool not created - "mbox" file. i've tried read mbox using "mail" as mail -f /tmp/personal folder/inbox , worked. but, wanted read subject using python. use readpst -r file.pst -o /tmp/ create mbox file in respective file. rather readpst -rs file.pst -o /tmp/

jquery - Ajax fadein ipcam pictures (smooth crossover) -

i need help. unfortunately scripting skills limitated. running soccer blog , we've installed our ip-camera. got working except 1 littlie thing: have smooth picture crossovers on webpage: http://www.blickpunkt-muenster.de/webcams/webcam-6.php i've solved embedding via ajax request cannot fadein function work though have googled lot. can me. awesome!!! my blog: http://bwa-blog.de/bwacam/ my script: <!doctype html> <html lang="en"> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> <script> $(function () { window.setinterval(function () { var path = 'http://bwa-blog.de/bwacam2/ipcam.jpg?' + (new date()).gettime(); $('#demo').attr('src', path); }, 10000); }); </script> </head> <body> <img ...

c# - Searching a ListBox where Items have customised data -

i loading data list box attached datetime data. want search listbox item contains tagid (eg: e2003450976543). when search listbox cannot find tagid though can see it. assuming search parameters not excluding attached datetime data. here code: class expiringitem { private string text; public expiringitem(string text) { this.text = text; this.added = datetime.now; } public datetime added { get; private set; } public override string tostring() { return text; } } private void timer1_tick(object sender, eventargs e) { (int = listbox1.items.count -1; > -1; i--) { var exp = (expiringitem)listbox1.items[i]; var timevisible = datetime.now - exp.added; if (timevisible.totalseconds > 30) listbox1.items.removeat(i); } } to insert using: lsttagshold.items.add(new expiringitem(txttagid.text)); basically want check if tagid exists in listbox or not... for test using: if (lsthol...

c++ - Compile-time counter in template class -

i have compile-time counter used years, inspired these answers . works in c++03/11, , far tested, relatively on major compilers: namespace meta { template<unsigned int n> struct count { char data[n]; }; template<int n> struct icount : public icount<n-1> {}; template<> struct icount<0> {}; #define max_count 64 #define make_counter( _tag_ ) \ static ::meta::count<1> _counter ## _tag_ (::meta::icount<1>) #define get_count( _tag_ ) \ (sizeof(_counter ## _tag_ (::meta::icount<max_count + 1>())) - 1) #define inc_count( _tag_ ) \ static ::meta::count<get_count(_tag_) + 2> _counter ## _tag_ (::meta::icount<2 + get_count(_tag_)>) } the following test compiles , runs perfectly (expected output 0 1 2 3 ): struct test { make_counter( uu ); static const unsigned int = get_count( uu ); inc_count( uu ); static const unsigned int b = get_count( uu ); inc_coun...

php - How to convert a multidimensional array into single dimensional array without using foreach method -

this question has answer here: is there function extract 'column' array in php? 13 answers how convert multidimensional array single dimensional array without using foreach method array ( [0] => array ( [opportunityid] => 5 [id] => 89 [discountedpackagecost] => 89990.00 [discountedaddoncost] => 61000.00 [title] => big title okayyyyyyy??????? ) [1] => array ( [opportunityid] => 42 [id] => 90 [discountedpackagecost] => 45592.00 [discountedaddoncost] => 0.00 [title] => test book ) ) i need key->"id" form each rows. any default methods available in php?? i expect result this. array(2) { [...

eclipselink - spring data jpa max aggregate function in where clause -

i have error query @repository public interface definedabsencerepository extends jparepository<definedabsence, long>, jpaspecificationexecutor<definedabsence> { @query("select da defined_absence da da.length=?1 , max (da.from, ?2) < min (da.to , ?3) " ) list<definedabsence> getlongdefinedabsencewithinperiod( absencelength length, localdatetime from, localdatetime to); }` and class public class definedabsence extends basebean { public static enum absencejustification { justified, unjustified } private localdatetime from; private localdatetime to; private absencelength length; private string description; //geter()+setter() } i use converter joda time the error generated caused by: exception [eclipselink-0] (eclipse persistence services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.jpqlexception excepti...

java - NodeJs : Image comparision -

i have nodejs application need compare image rest of images in folder find best match. there module this?? don't mind using .net/java if powerful enough requirement. please suggest for comparison of 2 images need java (.net,c, etc) application based on neural networ, k implement on node.js hard. let's assume have java app comparison, need run through exec() in node.js. example: var exec = require('child_process').exec; exec("/usr/bin/java -jar comparision.jar --images *path images folder*", function (error, stdout) { //and here match image path in stdout });

javascript - CSS - Android browsers scrolling too much -

so made tiny little page. www.farley.cz it's using jquery's load function switch content in div. that's whole functionality. now, idea containing div in middle of screen. i've used negative margin method. #mydiv { position:relative; top: 50%; left: 50%; width: 880px; height: 476px; margin-top: -238px; margin-left: -440px; } i'm happy how looks on desktop, on andoid, behaves strangely. i'm experiencing scroll drifts (link highlight drawn outside of image), strange little jumps i'm zooming in , zooming out. ...and when flip phone horizontally, div scrolls down out of picture. is there away fix this? or should find better method such centering? kind regards, martin.

c# - How to add attribute to a XML node created using Import node -

i'm cloning xml node 1 xml n number of times. identify each node want add index attribute it. here code use import node. xmldocument template = new xmldocument(); template.load(filelocation); xmldocument neweventlist= new xmldocument(); xmlnamespacemanager namespaces = new xmlnamespacemanager(template.nametable); namespaces.addnamespace("n", "http://www.hp.com/2009/software/opr/data_model"); xmlnode node = template.selectsinglenode(".//n:event", namespaces); neweventlist.load(eventlist_location); neweventlist.documentelement.appendchild(neweventlist.importnode(template.documentelement, true)); please how can set attribute new node i'm adding. template document: <event> <server></server> </event> output doc: <eventlist> <event index="0"> <server></server> </event> <event index="1"> <server></server> </event> <ev...

How to set Netbeans Action Item filters to ignore third party folders? -

Image
i not want see errors , warnings third party libraries in netbeans action items list, created filter shown below: the filter turned on, still see many items node_modules folders. doing wrong? how should filter configured ignore coming node_modules , vendor folders? i found solution hide parser errors in folder node_modules link: how ignore build folder in netbeans 'find in projects'? but make netbeans hides node_modules project tree steps: tools > options miscellaneous goto files tab add " node_modules " in ignored files pattern box. example: ^(node_modules|cvs|sccs|vssver.?\.scc|#.*#|%.*%|_svn)$|~$|^\.(?!(taccess|git.+|hgignore)$).*$ save

c# - Limit webclient to use wifi or ethernet, or vice versa -

i have connected wifi , have access internet ethernet. there anyway control webclient.downloadstring use ethernet instead of wifi or wifi instead of ethernet? this advanced functionality abstracted away both httpwebrequest, webrequest, webclient , like. can, however, using tcpclient (using constructor taking local endpoint ) or using sockets , calling socket.bind. use bind method if need use specific local endpoint. must call bind before can call listen method. not need call bind before using connect method unless need use specific local endpoint. bind local endpoint interface want use. if local machine have ip address 192.168.0.10 wifi address, using local endpoint force sockets use interface. default unbound (really 0.0.0.0) tells network stack resolve interface automatically, want circumvent. here's example code based on andrew's comment. note specifying 0 local endpoint port means dynamic. using system.net; using system.net.sockets; public static class c...

java - Android DX on a Mac -

i'm trying develop app displays icons of simple games, when icon clicked game dynamically loaded jar file , run. games loaded plug in more games can added without recompiling main app. the games simple children's games interface plug in limited things render, touch down, etc. i'm using libgdx allow me run app on multiple platforms. have got working on desktop pc idea plug ins works. however i'm trying work on android simulator requires plug in jar files converted dx format. there few posting on how cannot work. the part i'm stuck on getting dx converter work, line i'm trying is: dx --dex --verbose --output=classes.dex com/playtime/games/crows.class this throws exception : java.lang.runtimeexception: --verbose: file not found .. exception dump stuff java.lang.runtimeexception: --output=classes.dex: file not found .. exception dump stuff 2 errors; aborting .. i'm using mac this, have tried on windows , not give exception. i want ...

powershell - Automating the creation of Homedrive of a newly created AD user -

i have made script create homefolder(by name of samaccountname) newly created ad user. $adserver = 'xyz1' import-module activedirectory $searchbase = "ou=xyz2,ou=xyz3,dc=xyz4,dc=xyz5" $adusers = get-aduser -filter {name -eq "xyz6"} -server $adserver -searchbase $searchbase -properties * new-item -itemtype directory -path "xyz7\$($adusers.samaccountname)" everything automated except fact have feed in name of user (ad account name) make search particular user. want change process. want make automated thru scheduled run. now, want query eventlog , search eventid = 4720 (ie "a new user created") , trap samaccountname of newly created user (under attributes [i have checked]) , pass in current script... if run overall script scheduled run, detect new user creation , automatically make homefolder. $a = (get-eventlog system | where-object {$_.eventid -eq 514}).message should allow information want. can split result pare...

PHP echoing MySQL data into HTML table -

so i'm trying make html table gets data mysql database , outputs user. i'm doing php, i'm extremely new to, please excuse messy code ! the code i'm using is: braces storm of "your code awful!" <table class="table table-striped table-hover "> <thead> <tr> <th>#</th> <th>name</th> <th>description</th> <th>reward</th> <th>column heading</th> </tr> </thead> <tbody> <?php $con = mysql_connect("localhost", "notarealuser", 'notmypassword'); ($i = 1; $i <= 20; $i++) { $items = ($mysqli->query("select id `items` id = $i")); echo ("<tr>"); echo (" <td> while ($db_field = mysqli_fetch_assoc($items)) { print $db_field[...

playframework - Play Framework Activator Error -

cannot run activator command after new project creation raghul@raghul-inspiron-n4010:~/documents/activator-dist-1.3.5/uzadmin$ activator [info] loading project definition /home/raghul/documents/activator-dist-1.3.5/uzadmin/project /home/raghul/documents/activator-dist-1.3.5/uzadmin/build.sbt:17: error: not found: value routesgenerator routesgenerator := injectedroutesgenerator ^ [error] type error in expression project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? my build.sbt file : name := """uzadmin""" version := "1.0-snapshot" lazy val root = (project in file(".")).enableplugins(playjava) scalaversion := "2.11.6" librarydependencies ++= seq( javajdbc, cache, javaws ) // play provides 2 styles of routers, 1 expects actions injected, // other, legacy style, accesses actions statically. routesgenerator := injectedroutesgenerator your build.sbt missing import: import play.sbt.routes.rou...