Posts

Showing posts from February, 2015

mysql join count -

mysql join count - i have 2 table table leave id | type 1 annual 2 sick 3 unpaid 4 marriage table leavedata idleavedata | leavetype* 1 1 2 1 3 2 4 2 leavetype foreign key (refer id in table leave) how count occurence of id in table leavedata? output illustration : type | count annual 2 sick 2 unpaid 0 or null marriage 0 or null try, select l.type , count(ld.leavetype) count leave l left bring together leavedata ld on ld.leavetype = l.id grouping ld.leavetype mysql

wpf - Error Adorner in a Scrollviewer -

wpf - Error Adorner in a Scrollviewer - i'm trying ensure error adorners don't clipped scrollviewer's bounds. have series of textboxes @ border of fixed width scrollviewer (no horizontal scrolling, vertical). have adorners flag textboxes errors. the problem adorners clipped @ border of scrollviewer. any ideas? *note: have tried wrapping in adornerdecorator. ok solution problem same solution question referenced in comment above. you need retemplate scrollviewer , add together adornerdecorator template. something note in general adorners ... if have problem them, solution tends wrapping element in adornerdecorator, it's not going solution, it's worth first might be. wpf adorner adornerlayer adornerdecorator

ORACLE sql: Return columns associated with MAX value of a subquery that SUM values -

ORACLE sql: Return columns associated with MAX value of a subquery that SUM values - i'm having issues problem i'm supposed utilize subqueries. have find names of authors of book(s) have been sold most. have works if there 1 row matches max value of totalsold. select fname, lname books b bring together bookauthor ba on b.isbn = ba.isbn bring together author on ba.authorid = a.authorid b.isbn = (select isbn (select sum(quantity) totalsold, ba.isbn isbn bookauthor ba bring together author on ba.authorid = a.authorid bring together orderitems oi on ba.isbn = oi.isbn grouping ba.isbn order totalsold desc) rownum = 1) however in theory there tie max value , stuck on how homecoming associated isbn tied max value(s). in essence how query without using rownum = 1. i came seems on clunky works: select fname, lname books b bring together bookauthor ba on b.isbn = ba.isbn bring together a...

android - No resource found that matches the given name -

android - No resource found that matches the given name - on resource chooser noticed there scheme resources of different icons. i wanted utilize in project. placed icons on buttons, , showed out expected: but when tried run app, didn't allow because although showed resource correctly on buttons, in xml file wrote error: error: no resource found matches given name (at 'drawableleft' value '@drawable/ abc_ic_menu_info_details'). so can or can not utilize these resources? use @android:drawable/abc_ic_menu_info_details instead of @drawable/abc_ic_menu_info_details to utilize scheme resource need start @android: android

c++ - OpenCV linking problems with ROS -

c++ - OpenCV linking problems with ROS - i'm trying compile this project (following instructions given). when building rosmake , bunch of undefined reference cv::string::deallocate() , undefined reference cv::string::allocate(unsigned long) . find curious i'm getting error in functions while rest of opencv functions seem working properly. i know happens because linker can't find objects these functions compiled to, i'm kind of new ros build scheme , can't find what's wrong. i've tried using cmakelists.txt file provided, , adding find_package(opencv required) , target_link_libraries(xxx xxx ${opencv_libraries}) , without making difference. know opencv installed , compiled (i've used before), , had installed ros without problems. i'm using opencv 3, ros indigo, ubuntu 14.04 i had exact same problem - same error messages, same setup. i've managed solve it, though i'm not sure of steps did contributed. far can tell, due conf...

emulation - linaro-media-create error while booting qemu/linaro -

emulation - linaro-media-create error while booting qemu/linaro - i have been trying run linaro on qemu. have been next guide, https://developer.mozilla.org/en-us/docs/mozilla/developer_guide/virtual_arm_linux_environment#create_the_vm_disk_image the linaro-create-media command executes overall gives errors in between. thats why next command, sudo mount giving error of "invalid offset '' specified" the linaro-create-media command giving many such errors while fetching files, failed fetch http://ports.ubuntu.com natty-updates/universe armel packages 404 not found. natty no longer maintained, i'm guessing that's why repositories downwards , getting 404 errors. can utilize more recent versions of linaro , hwpack: https://releases.linaro.org/15.06/ubuntu example. also, wasn't able mount command work either, found way: sudo kpartx -avs vexpress.img you'll see output similar to: add map loop0p1 (252:2): 0 155584 linea...

mysql - is it possible to specify the IP address for a second database connection on heroku -

mysql - is it possible to specify the IP address for a second database connection on heroku - i have heroku app , utilize heroku postgres main repo. want access sec database in read manner info hosted on 3rd party. have seen reply multiple databases here doesn't solve our static ip issue: how utilize multiple databases 1 rails 3.1 app in heroku? (ie second_database_url). should mention read much of active record infrastucture irrelevant. we want create connection, hash , inert locally (never doing migrations against sec database), etc... however, read-only user going create needs ip address. there way me static ip or proxy these mysql requests easily? i have seen quotaguard static looks http requests. or utilize in scenario. thx mysql ruby-on-rails heroku

Install tomcat with Puppet without using inbuilt class -

Install tomcat with Puppet without using inbuilt class - i creating module installs tomcat using puppet should not utilize of inbuilt classes of puppet, dont want utilize tomcat::instance, tomcat::service etc. in module, dont want utilize command line installation. can approach this? tomcat puppet

If else condition in multiple from in LINQ in C# -

If else condition in multiple from in LINQ in C# - i have linq query need set status if p.conditionvariable > 0 apply next condition. from prob in table2.where(p => p.id == p.conditionvariable && !p.isblocked && p.isactive) if p.conditionvariable == 0 next remains same. (from _obj1 in table1.where(p => p.isactive == true)) prob in table2.where(p => p.id == _obj1.id && !p.isblocked && p.isactive && p.conditionvariable == 0) select new class1 { title = prob.title, status = prob.ispending, id = obj1.id } i think want create || between conditions , table2 queried based on p.condtionvariable . (from _obj1 in table1.where(p => p.isactive == true)) prob in table2.where(p => (p.id == _obj1.id && ...

python - General queries vs detailed queries to database -

python - General queries vs detailed queries to database - i'm writing web application in python , postgresql. users access lot of info during session. such info (almost) indexed in database. question is, should litter code specific queries, or improve practice query larger chunks of information, cashing it, , letting python process chunk finer pieces? for example: user inquire entries in payment log. either 1 writes query asking specific entries requested, or 1 collect payment history of user , utilize python select specific entries. of course of study cashing preferred when working heavy queries, since info indexed, direct database access fast , cashing approach not yield much if speed. there other factors may still render cashing approach preferable? database designers spend lot of time on caching , optimization. unless nail specific problem, it's improve allow database database stuff, , code rest instead of having code seek take on of database ...

Python 2.7 and QGIS 2.6: Subtracting two values and append ID of feature to list -

Python 2.7 and QGIS 2.6: Subtracting two values and append ID of feature to list - i subtract 2 values retrieved qgs feature iterator objects , append value of feature id list depending on condition. in context of qgis, have 2 layers: roadslayer pathslayer what have far returns empty list: evenlist = [] azimuthroadsidx = roadslayer.fieldnameindex('azimuth') azimuthpathsidx = pathslayer.fieldnameindex('azimuth') roads = roadslayer.getfeatures() paths = pathslayer.getfeatures() feat in roads: feature in paths: roadsazimuth = feat.attributes()[azimuthroadsidx] pathsazimuth = feature.attributes()[azimuthpathsidx] if (roadsazimuth - pathsazimiuth == 90) or (roadsazimuth - pathsazimth == -270): evenlist.append(feature.id()) don't know why, works. problem doesn't work in cases (even when roadsazimuth - pathsazimuth == 90, not appended in cases): for feat in roadslayer.getfeatures(): roadsazimuth = feat.attri...

directed acyclic graphs - Traverse through a DAG-like structure to produce another DAG-like structure in Clojure -

directed acyclic graphs - Traverse through a DAG-like structure to produce another DAG-like structure in Clojure - i have dag-like construction deeply-nested map . maps in construction can have mutual values, overall construction not tree direct acyclic graph. i'll refer construction dag brevity. the nodes in graph of different finite number of categories. each category can have own structure/keywords/number-of-children. there 1 unique node source of dag, meaning node can reach nodes in dag. the task traverse through dag source node, , convert each node 1 or more nodes in new constructed graph. i'll give illustration illustration. the graph in upper half input one. lower half 1 after transformation. simplicity, transformation done on node split node 1 , a1. children of node reallocated. what have tried (or in mind): write function convert 1 object different types. within function, recursively phone call convert each of children. method suffers problem ...

rest - Jersey Entity Filtering with Wildcard Annotation - How To? -

rest - Jersey Entity Filtering with Wildcard Annotation - How To? - i looking 2 days suitable reply till found nothing. i trying implement entity filtering in jersey. if utilize single custom created object (job object) works fine. works fine if utilize list< job > want utilize list< ? > or list< type > not work. wanted utilize wildcard because not have job objects deal with. if json object rest resource list entity empty. this header rest resource: @get @path("/jobs/") @produces(mediatype.application_json) public listresponse loadjoblist( @pathparam("session") string session, @pathparam(sessionfactoryutil.system_id_parameter) string system, @queryparam ("start") final int start, @queryparam ("limit") final int limit ) { this method create response object converted json object: public listresponse execute(){ list<job> jobslist = this.loadjobsfromdatabase(); ...

hadoop MapReduce sort by value only -

hadoop MapReduce sort by value only - is there way sort mapreduce output value only, , without changing output sequence of key , value? the original output (sorted key): a 1 b 2 c 1 d 3 and need output (sorted value): d 3 b 2 a 1 c 1 i tried create adding sorting job using inversemapper swap key , value output sorted value, worked, output like: 3 d 2 b 1 a 1 c is there anyway reverse output format of key , value? or there other way sort value only? thanks m/r sort-by-key. if want sort value need create job maps value sorted key. hadoop mapreduce

asp.net - Displaying results of multiple tables in same view in mvc with razor -

asp.net - Displaying results of multiple tables in same view in mvc with razor - i have 3 tables follows: jobs: idjob, description, ... jobskill: idskill, id_job, title, description, level ... jobrequirments: idreq, id_job, title, description ... (filled info follow: 1, job1, title1 2, job2, title 2 ///// 1, 1, skill1job1 2, 1, skill2job1 3, 2, skill1job2 /// 1, 1, req1job1 2, 1, req2job1 3, 2, req1job2 4, 2, req2job2 /// , on in view display jobs jobs table follows: @model ienumerable<jobshop.jobs> @{ viewbag.title = "jobs listing index"; } <div class="title-lines"> <h3 class="mt0">available jobs listing</h3> </div> @if (model.count() > 0) { <div> @{int = 1; foreach (var item in model) { <div class="bordered @(i++ % 2 == 0 ? "highlighted" : "")"> <p>@item.idjob</p> <p>@item.titlu</p>...

java - Android Inner Class Soundpool -

java - Android Inner Class Soundpool - i developing android application, of code gives basic outline to. the activity soundactivity has inner class soundtest, contains soundpool. when big textbox (textview1) covering screen pressed, sound should play, instead error triggered, tweaking remove error sound still not play. public class soundactivity extends actionbaractivity { soundactivity.soundtest msoundpoolhelper = new soundactivity.soundtest(); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_sound); view view = findviewbyid(r.id.textview1); view.setontouchlistener(msoundpoolhelper); } public static class soundtest extends activity implements view.ontouchlistener { private soundpool soundpool; private int soundid; boolean loaded = false; @override protected void oncreate(bundle savedinstancestate) { this.setvolumecontrolstream(audiomanager...

mysql - Select max date for user having sum(worktime) < x -

mysql - Select max date for user having sum(worktime) < x - need help query - i'm using both sql server , mysql. i have table of working hours of users looks this: user worktime date user1 08:00:00 2015-03-01 user1 08:00:00 2015-03-02 user1 08:00:00 2015-03-03 user2 08:30:00 2015-03-11 user2 10:00:00 2015-03-13 user3 05:00:00 2015-03-11 user3 05:00:00 2015-03-12 user3 05:00:00 2015-03-14 what need lastly date every user when sum of worktime less or equal x - illustration let's it's 18 - plus sum of worktime date - result should be: user worktime date user1 16:00:00 2015-03-02 user2 08:30:00 2015-03-11 user3 15:00:00 2015-03-14 when using simple query this: select user, sum(worktime), max(date) worktime grouping user having sum(worktime) <= 18 i users total of hours <= 18, illustration user3. i know how 2 separate queries , excel functions, wondering if it's possible within single statement. if need both da...

How do I update a nested array in an existing elasticsearch document with logstash? -

How do I update a nested array in an existing elasticsearch document with logstash? - let's have existing document in next index visitors-20150412 { "_index" : "visitors-20150412", "_type" : "visitor", "_id" : "62df20c58f008fea", "_source" : { "id" : "62df20c58f008fea", "ip" : "123.456.789.0", "referrer" : "google", "pages" : [] } and have log of "pages" visitor went want logstash read through , add together "pages" array. page document might this: { "visitorid" : "62df20c58f008fea", "url" : "http://www.example.com/whatever", "title" : "page title" } how setup logstash configuration file append "page" original visitors document _id "62df20c58f008fea"? elasticsearch logstash

java - How do I integrate my Spring project with Hibernate -

java - How do I integrate my Spring project with Hibernate - i have done little employee project using springs. project helps add,edit,delete employee in database. had used normal jdbc database connection. want integrate hibernate project. please help me. m learning hibernate , trying out of it. this employee controller. bundle com.employee.controller; import com.employee.dao.employeedao; import com.employee.model.employee; @controller public class employeecontroller { @autowired employeedao employeedao; @requestmapping(value = "/employee", method = requestmethod.get) public modelandview employee() { homecoming new modelandview("registration", "command", new employee()); } @requestmapping(value = "/addemployee", method = requestmethod.post) public string addemployee(@modelattribute employee employee/*, modelmap model*/) { seek { employeedao.create(employee.getfirstname...

How can I extend typed Arrays in Swift? -

How can I extend typed Arrays in Swift? - how can extend swift's array<t> or t[] type custom functional utils? browsing around swift's api docs shows array methods extension of t[] , e.g: extension t[] : arraytype { //... init() var count: int { } var capacity: int { } var isempty: bool { } func copy() -> t[] } when copying , pasting same source , trying variations like: extension t[] : arraytype { func foo(){} } extension t[] { func foo(){} } it fails build error: nominal type t[] can't extended using total type definition fails use of undefined type 't' , i.e: extension array<t> { func foo(){} } and fails array<t : any> , array<string> . curiously swift lets me extend untyped array with: extension array { func each(fn: (any) -> ()) { in self { fn(i) } } } which lets me phone call with: [1,2,3].each(println) ...

Need help with Flickr/JSON/Javascript issue when displaying gallery images -

Need help with Flickr/JSON/Javascript issue when displaying gallery images - wondering if can help me. i'm trying set weekly photo competition page pulling in photos flickr gallery, can't images display. works ok groups, having problems gallery code. getting right json response, can't results display on page grouping images do. here's javascript: $(function() { var map; var markers = []; var infowindow; // gallery photos var visiblegallery; $.getjson("http://api.flickr.com/services/rest/" + "?method=flickr.galleries.getphotos" + "&api_key=xxxx" + "&photoset_id=xxxx" + "&extras=geo,tags,url_sq,url_t,url_s,url_m,url_o" + "&format=json&jsoncallback=?", function(data, textstatus) { var htmlstring = '<div id="weekcontainer">'; var weeks = sortintoweekarrays(data.photos.photo); $.each(weeks, fu...

java - What if a finalizer makes an object reachable? -

java - What if a finalizer makes an object reachable? - in java, finalize called on object (that overrides it) when it's garbage collectioned, when it's unreachable. if finalizer makes object reachable again, happens then? the object not collected until gets unreachable again. according javadoc, finalize() not called again. java memory-management garbage-collection jvm finalizer

vim - Error reading cscope connection after database update from cron -

vim - Error reading cscope connection after database update from cron - i have script setup runs every night on projects , updates cscope databases. script deletes existing cscope files (.files, .out etc) , generates new ones. when script run via cron job, finish error e262: error reading cscope connection 0 within vim when seek lookup symbol. when run script manually, there's no problem. the gist of script - delete existing cscope.* , tags files go through entire project , generate cscope.files build cscope database using cscope -b -q build tags database using ctags --extra=+f -l cscope.files any ideas? found problem. i needed source bash_profile in script environment variables available script. adding source ~/.bash_profile top of script fixed issue. vim cron tags cscope

android - trying to call activity from my main activity as follow -

android - trying to call activity from my main activity as follow - @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button sendbtn=(button)findviewbyid(r.id.button1); sendbtn.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub intent intent=new intent(mainactivity.this,send.class); startactivity(intent); } }); } i have button on button click want open sec activity named send app unfortunately stopped logcat showing error this: 04-07 13:39:33.040: e/androidruntime(2426): android.content.activitynotfoundexception: unable find explicit activity class {com.send/com.send.send}; have youdeclared activity in androidmanifest.xml? 1.go mainfiest.xml class , check have registered bun...

ios - How to trigger watchkit app from the parent iphone app? -

ios - How to trigger watchkit app from the parent iphone app? - is there way open watchkit app programmatically host iphone app? if not supported, can trigger local notification shows on apple watch , tapping open corresponding watchkit app? you cannot open watchkit extension ios app. way alert user on watch send remote or local notification. however, not work if ios app in foreground because notification route iphone , not watch. ios swift xcode6 watchkit apple-watch

pip install --user is installing to python/site-packages instead of python2.7/site-packages -

pip install --user is installing to python/site-packages instead of python2.7/site-packages - i'm trying pip install --user work prebuilt python scheme little awkward. have working, reason pip install --user installing ~/.casa/lib/python/site-packages (where .casa replaces .local installation of python), can't understand how beingness set. how pip install --user select directory? perchance have set cause pick python/site-packages instead of pythonx.y/site-packages ? the source code pip installer @ package: https://github.com/radio-astro-tools/casa-python far can tell, there no situation in python/site-packages occurs in code; aways pythonx.y/site-packages should be. edit: pip i'm using called next script. in here @ fault, cannot determine what: $home/.casa/bin/casa-python $home/.casa/bin/pip $* --user which in turn using casa-python , i.e. script: #!/bin/sh installpath=/applications/casa.app/contents proot=$installpath/frameworks/python...

azure - Transfer website from free subscription to pay as you go -

azure - Transfer website from free subscription to pay as you go - this question has reply here: change azure website subscription 5 answers i had web app in azure created free subscription. free subscription has expired , site not functional. have changed subscription pay go. think i'm not able figure out previous application now. i looked @ of links on topic on stackoverflow , asks delete previous service , redeploy it. edit: know duplicate question , have gone through change azure website subscription link what creating trouble: during process i'm not seeing previous service @ in management portal how should delete it? if drop thought of deleting service , straight start creating new service, i'm not able utilize same url had flagged beingness in use. i solved myself... wanted either previous web app or delete previous 1 new web app can c...

json - Android:image animation using separate layout -

json - Android:image animation using separate layout - i building app wallpaper. trying image server. able image server when trying animate , alter image of imageview , work work in in lastly 13 images not on images. how can set animation images? here code: mainactivity.java package com.example.featuredwallpaper; import com.koushikdutta.urlimageviewhelper.urlimageviewhelper; import android.view.animation.animationutils; public class mainactivity extends activity { public static final string tag_success = "status_code"; public static final string tag_array = "info"; jsonarray images = null; linearlayout resultdisplaylayout; jsonparser jparser = new jsonparser(); string projectname = "heart"; public static string url = "http://frontlinkinfotech.com/lwp/c_wall/get_images"; private progressdialog pdialog; squareimageviewhalf image1,image2, image4, image5, image7, image8, image12, image1...

java - Check if returned value is not null and if so assign it, in one line, with one method call -

java - Check if returned value is not null and if so assign it, in one line, with one method call - java littered statements like: if(cage.getchicken() != null) { dinner = cage.getchicken(); else { dinner = getfreerangechicken(); } which takes 2 calls getchicken() before returned object can assigned dinner . this written in 1 line so: dinner = cage.getchicken() != null? cage.getchicken() : getfreerangechicken(); but alas there still 2 calls getchicken() . of course of study assign local variable utilize ternary operator 1 time again assign if not null, 2 lines , not pretty: futuremeal chicken = cage.getchicken(); dinner = chicken != null? chicken : getfreerangechicken(); so there way say: variable var = value if value not null or other value; and guess i'm talking syntax here, after code compiled doesn't create much difference how code written in performance sense. as such mutual code it'd great have ...

javascript - AMD-Modules-Structure on build without requirejs? -

javascript - AMD-Modules-Structure on build without requirejs? - i have utilize require.js developing mutual amd-modules current project/library. on build process used modules written in release file. how build released file without dependency of including require.js? javascript build module requirejs amd

c# - A field initializer cannot reference the non-static field, method, or property? -

c# - A field initializer cannot reference the non-static field, method, or property? - i have repository class , services class below : public class dinnerrepository { dinnerdatacontext db = new dinnerdatacontext(); public dinner getdinner(int id) { homecoming db.dinners.singleordefault(d => d.dinnerid == id); } // others code } public class service { dinnerrepository repo = new dinnerrepository(); dinner dinner = repo.getdinner(5); // other code } this throws error: a field initializer cannot reference non-static field, method, or property. even though have intatiated dinnerrepository class expose method getdinner() in service class. works fine below code. there alternative or standard practice? cannot utilize static methods here.. public class service { public service() { dinnerrepository repo = new dinnerrepository(); dinner dinner = repo.getdinner(5); } } pers...

internet explorer - ExtJs page makes no response while using the second time - on IE9 only -

internet explorer - ExtJs page makes no response while using the second time - on IE9 only - when extjs page opened in ie9 first time, works properly. but when open same page sec time don't response. can help me. ps getting error on ie9 this sounds have problems ids , ext.cache. please check panels, windows , on. dont utilize property id utilize itemid instead. if utilize id in datasource check ids unique. otherwise become problems during rendering of gridpanel, treestore, combobox , on... internet-explorer extjs

Android time selection in a unique way -

Android time selection in a unique way - (i'm using android studio 1.1.0) how can create kind of time selection in app's layout? ready made component? how called? i'm talking circular part user can select how many minutes/hours until... i can not confirm if custom part of mobile operating system, looks much custom built app. jquery knob closest have seen this, require heavy customization begin resemble that. http://anthonyterrien.com/knob/ <-- home page https://github.com/aterrien/jquery-knob <-- git hub repository nice, downward compatible, touchable, jquery dial android android-layout time-select

properties - JavaFX - Add a Listener to a Pane to check if it is showing -

properties - JavaFX - Add a Listener to a Pane to check if it is showing - i working on javafx lastly couple of months. trying find way implement listener fired whenever particular pane shown on root pane/scene. in java, implement using ancestorlistener on jpanel shown below, cannot find equivalent method on javafx. jpanel panel = new jpanel (); panel.addancestorlistener ( new ancestorlistener () { public void ancestoradded ( ancestorevent event ) { system.out.println("this panel shown on screen now"); } public void ancestorremoved ( ancestorevent event ){} public void ancestormoved ( ancestorevent event ){} } ); you can observe sceneproperty() . tell if pane (or other node) part of scene graph: pane.sceneproperty().addlistener((obs, oldscene, newscene) -> { if (newscene == null) { // not showing... } else { // showing ... } }); if want go further, , see if pane part of scene graph in window showi...

jsf - How to install and use CDI on Tomcat? -

jsf - How to install and use CDI on Tomcat? - i'm creating first project java ee 7, i'm having trouble. appreciate help. tomcat 7.0.34 jsf 2.2 primefaces 3.5 javaee-api-7.0.jar when application start, tomcat log shows next message: "validatejarfile (c:\...\build\web\web-inf\lib\javaee-api-7.0.jar)-jar not loaded. see servlet 2.3 spec, section 9.7.2. offending class: javax/servlet/servlet .class" when click on button calls managed bean, error: advertĂȘncia: /index.xhtml @18,66 value="#{indexmb.user}": target unreachable, identifier 'indexmb' resolved null javax.el.propertynotfoundexception: /index.xhtml @18,66 value="#{indexmb.user}": target unreachable, identifier 'indexmb' resolved null indexmb @named("indexmb") @requestscoped public class indexmb { private string password; private string user; public string logintest(){ homecoming (this.user.equals("admin") ? "adminpage...