Posts

Showing posts from April, 2015

maven - KafkaSpout BrokerHosts error -

i trying compile , run storm-kafka-starter project @ https://github.com/thehydroimpulse/storm-kafka-starter the main function kafkatopology looks like: public class kafkatopology { public static void main(string[] args) throws exception { list<string> hosts = new arraylist<string>(); hosts.add("localhost"); spoutconfig kafkaconf = new spoutconfig(statichosts.fromhoststring(hosts,1), "test-topic","/kafkastorm","discovery"); kafkaconf.scheme = new schemeasmultischeme(new stringscheme()); kafkaconf.forcestartoffsettime(-2); topologybuilder builder = new topologybuilder(); builder.setspout("spout", kafkaspout, 2); builder.setbolt("printer", new printerbolt()).shufflegrouping("spout"); config config = new config(); config.setdebug(true); if(args!=null && args.length > 0) { config.setnumworkers(3)...

sql - Converting Access IIF to oracle -

this question has answer here: oracle iif statement 2 answers having issues converting iif(vw_ge_all_yearqry.dep="ag","ag","ot") dept , oracle select vw_ge_all_yearqry.year, vw_ge_all_yearqry.loc, vw_ge_all_yearqry.cat, vw_ge_all_yearqry.ty, (case when vw_ge_all_yearqry.dep = 'ag' 'ag' else 'ot' end) dept, vw_ge_all_yearqry.srce, sum(vw_ge_all_yearqry.expend * 0.001) exp vw_ge_all_yearqry group vw_ge_all_yearqry.year, vw_ge_all_yearqry.loc, vw_ge_all_yearqry.cat, vw_ge_all_yearqry.ty, (case when vw_ge_all_yearqry.dep = 'ag' 'ag' else 'ot' end) dept, vw_ge_all_yearqry.srce having (((sum(vw_ge_all_yearqry.expend * 0.001)))<>0); the query tells me have error, seems trivial @ point error @ command line:11 column:169 error report: sql error: ora-00933: sql command not ended 00933. 00...

objective c - Is this a correct approach to connect screens? -

i .net programmer , last week started read objective-c. class related stuff kinda clear , today learnt protocols , delegates, can't 100% clear got it, looks lot delegates , events c#. this simple example created following tutorial. 2 screens, first one(a label , button) launches second one(a textbox , button) sends string. think of classic example of using events, no matter programming language. #import <uikit/uikit.h> #import "valueviewcontroller.h" @interface viewcontroller : uiviewcontroller<valueviewcontrollerdelegate> - (ibaction)btngetvalue:(id)sender; @property (weak, nonatomic) iboutlet uilabel *lblcurrentvalue; @end #import "viewcontroller.h" #import "valueviewcontroller.h" @interface viewcontroller () @end @implementation viewcontroller - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. } - (void)didreceivememorywarning { [super didreceivememorywarning]; ...

ruby - Can I evaluate a block inside a Proc? -

can yield block inside proc? consider example: a = proc.new yield end a.call puts "x" end what i'm trying achieve print x , interpreting ruby 2.0 raises localjumperror: no block given (yield) . no can't, because proc you've created independent yield - is, it's yield has no block in context. although can call procs specified parameters , thereby pass parameters proc, yield doesn't work based on specified parameters; executes block found within proc's closure. , proc's closure predefined; not modified because call later block. so it's equivalent of typing 'yield' straight irb (not within method definitions) returns localjumperror: no block given (yield) error.

python - Best way to pipe output of Linux sort -

i process file line line. need sort first piping: sort --key=1,2 data |./script.py. what's best call sort within python? searching online see subprocess or sh module might possibilities? don't want read file memory , sort in python data big. its easy. use subprocess.popen run sort , read stdout data. import subprocess myfile = 'data' sort = subprocess.popen(['sort', '--key=1,2', myfile], stdout=subprocess.pipe) line in sort.stdout: your_code_here sort.wait() assert sort.returncode == 0, 'sort failed'

vb.net - There's any way to know if a DataGridViewCell is visible? -

i'm making csv file datagridview following code in vb.net 'process data cells each dr datagridviewrow in dgx.rows 'dgx datagridview each dc datagridviewcell in dr.cells csv += dc.value & chr(9) 'tab separated next csv += environment.newline.tostring() next the datagriview visible gui have invisible columns , need make csv file without columns, without removing gui datagridview because need them posterior processing. solved! for each dr datagridviewrow in dgx.rows if dgx.columns(dc.columnindex).visible csv += dc.value & chr(9) 'tab separated end if csv += environment.newline.tostring() next

cypher - How to get null for labels that don't exist in Neo4J? -

i'm running following query in neo4j , i'm getting error. in nutshell, i'm asking database show me nodes label "user" and, if has relationship, type of relationship , label type of node it's connected to. start n=node(*) match (n:user)-[r?]-(m) has (n.name) return n, labels(n), type(r), labels(m), m.name; an error occurs when node of type user found doesn't have node related it. seems blowing on labels(m) part. expect if node didn't exist, null returned instead of error. how type() function works. if no relationship found, type() returns null. here result looks if omit labels(m) part... ==>+-----------------------------------------------------------------------------------------------------------------------------------+ ==> | n | labels(n) | type(r) | m.name | ==> +------------------------------------------------------------------...

css - Insert ruby in html class=" " property -

this stupid i've spent last 2 hours trying figure out how no luck @ all. basically need html page following: <div class="circleelement"> ... </div> but need add more classes div class ruby, classes coming in text field in database. i tried inserting ruby like: <div class="circleelement"+ <%= u.tag %> >...</div> and many different variations of line no luck @ :( i should add u.tag holds string> "activetag classictag".... should append no problems it's not doing it! <div class="circleelement <%= u.tag %>" >...</div> should work.

lotus notes - How do I customize iNotes (forms9_x.nsf) to send an alterered e-mail -

i in process of updating forms9_x.nsf database mimic functionality we've customized notes client. i've added action button e-actions-mailedit menuid (new memo) append value subject field , send new memo. i've got update subject working fine, don't know memo sent. i've tried xxform.submit() error message. here's code in custom_js_lite looks like: function sendencrypted(sid) { var answer = confirm("this memo sent in encrypted format listed in to, cc , bcc fields. " + "are sure want do?"); var x; if(answer == true){ alert("yes, please encrypt"); // current backend document id var opanelmanager = aaa.fkb(); var scontentid = opanelmanager.edi.get('t').oprev.sid; // current ui document var omaindoc = aaa.eck; var subj = omaindoc.getelementbyid('e-' + scontentid + '-subject').value; omaindoc.getelementbyid('e-' + scontentid + '-subject').value = ...

sql - How can i compose this MySQL query? -

the user enters 1 6 words (characteristics) input data 6 words. here table: ---------------- | user | word | ---------------- 1 | green 1 | black 1 | red 2 | green 2 | gray for example, array consists of 2 words: "green", "black". how can receive "user=1" if amount of conjunctions in it's characteristics maximal. i've tried query: // $pat - array of words // $nums - minimal amount of conjunctions. $nums = 0.8*count($pat) select user words word in ('{$pat[0]}', '{$pat[1]}','{$pat[2]}','{$pat[3]}','{$pat[4]}','{$pat[5]}') group `user` having count(*) >= ".$nums." order count(*) desc limit 1 the problem condition having count(*) >= ".$nums." doesn't work , data extracted if there 1 conjunction. i believe query working fine in case when have 2 words 'green' , 'black' select user words word in ('g...

ruby - Implementing a model of a model in rails -

i starting out rails , have run little issue. trying implement way allow users create "pages" on can tack on widgets. so have set model "pages", has database fields such name, description etc. has "has_many :widgets" association. here stumped. have list of widgets users can use. things such "about me", "photo gallery", "comments", "videos", etc. can chose 1 of these, customize contents , add page. i figure, when user picks , customizes widget add entry widgets table "belongs_to user_id". however, need specify widget user chose , custom contents entered. how implement in rails? can define each widget type? i can think of few ways, not sure 1 best. one option use model per widget. have aboutmewidget, videoswidget, etc. allow me customize each model whatever fields widget might need. however, doesn't seem efficient , require many models. another option define widget types somewh...

How to use polymorphism in CUDA -

i porting physics simulation code c++ cuda. the fundamental algorithm can understood as: applying operator each element of vector. in pseudocode, simulation might include following kernel call: apply(operator o, vector v){ ... } for instance: apply(add_three_operator, some_vector) would add 3 each element in vector. in c++ code, have abstract base class operator, many different concrete implementations. important method class operator{ virtual double operate(double x) =0; operator compose(operator lo, operator ro); ... } the implementation addoperator might this: class addoperator : public operator{ private: double to_add; public: addoperator(double to_add): to_add(to_add){} double operator(double x){ return x + to_add; } }; the operator class has methods scaling , composing concrete implementations of operator. abstraction allows me compose "leaf" operators more gen...

objective c - UTTypeCopyPreferredTagWithClass: getting all tags -

in objc, uttypecopypreferredtagwithclass returns first tag associated ut type. how can obtain tags, instead? mean, jpg , jpeg instead of jpeg . uttypecopydeclaration retrieves infos.

php - MySQL - query for duplicates of a column and return both original and duplicate rows -

i have table use store systematically chosen "serial numbers" each product bought... the problem is, csv uploaded believe contained duplicate "serial numbers", means when application tries modify row, may not modifying correct one. i need able query database , rows double of serial_number column. should this: id, serial_number, meta1, meta2, meta3 3, 123456, 0, 2, 4 55, 123456, 0, 0, 0 6, 345678, 0, 1, 2 99, 345678, 0, 1, 2 so can see, need able see both original row , duplicate row , of it's columns of data ... can compare them , determine data inconsistent. some versions of mysql implement in subquery inefficiently. safe alternative join: select t.* t join (select serial_number, count(*) cnt t group serial_number ) tsum on tsum.serial_number = t.serial_number , cnt > 1 order t.serial_number; another alternative use exists clause: select t.* t exists (select * t t2 t2.serial_number = t.serial_number ,...

html - CSS Tab coloring problems -

/* navigation --------------------------------------------------------------------------------*/ #nav-wrap .container { clear: both; overflow: hidden; position: relative; } #nav-wrap .container table, #nav-wrap .container table tr, #nav-wrap .container table tr td, #nav-wrap .container table tbody { vertical-align:bottom; } td#nav { float:right; border-spacing:0; } #navigation { line-height: 1; float: right; } #navigation ul { list-style: none; float: left; width:946px; height:44px; margin-bottom:-1px; } #navigation li { display: inline; position: relative; list-style: none; float: left; /* change margin of tabs */ margin:0 0 0 0px; } so here coding done edit tabs. problem need every tab different color can't figure out change. i've tried making image , uploading (a rainbow-type image has every color need) instead of overlaying it, repeated image in each individual tab. there way can change i...

symfony1 - sfPHPCaptchaPlugin : The following code is invalid -

i meet strange problem,i used sfphpcaptchaplugin make captha form in sf1.4 project worked on,all configuration , installation of plugin correct captcha verification won't let me save data of form in database , tell me text wrong i'm sure entered same text showing in image of captcha , here line me error : 'captcha' => new sfvalidatorphpcaptcha(array(), array('invalid' => 'the following code invalid.')), someone had same errore before please? sfphpcaptchaplugin not stable symfony 1.4 said in plugin information here . you can use sfcaptchagdplugin one, folow intalation guide in readme, , use widget: $this->widgetschema['captcha'] = new sfwidgetcaptchagd(); $this->validatorschema['captcha'] = new sfcaptchagdvalidator(array('length' => 4));

Git app that creates libraries from a subset of a project -

is there git application (ui generates editable data configuration or suppose command line working) allows select subset of files publish git project? use case being: let's have main shared library under src directory. beneficial able manage src directory internally single repository while being able publish sub package/module located in said directory publicly. copying , managing applicable commits subset of available classes huge pain. is there this? have looked git submodules ? lets collect multiple repositories single directory tree, , used in case managing separate libraries/modules separate project. some people think submodules problematic manage. the git subtree project alternative take on may meet needs.

jquery - How to Get total and Current Slide Number of Carousel -

Image
can please let me know how can total , current number of carousel slides in bootstrap image below? i have standard bootstrap carousel , <div> .num class display total , current number , used code retrieve numbers didn't go through $('.num').html(){ $('#mycarousel').carousel({number}) } thanks update: please find sample @ jsfiddle link each slide has .item class it, can total number of slides var totalitems = $('.item').length; active slide has class named active , can index of active slide this var currentindex = $('div.active').index() + 1; you can update these values binding bootstrap carousel slid event this $('#mycarousel').bind('slid', function() { currentindex = $('div.active').index() + 1; $('.num').html(''+currentindex+'/'+totalitems+''); }); example

How to push values in array for JSON in php? -

in php, making array turned json string. this works, if hardcode them: $data = array( 'firstname' => mysql_result($recordset, 0, 'first name'), 'lastname' => mysql_result($recordset, 0, 'last name'), 'email' => mysql_result($recordset, 0, 'email address'), 'password' => mysql_result($recordset, 0, 'password'), 'phone' => mysql_result($recordset, 0, 'mobile number'), 'website' => mysql_result($recordset, 0, 'website link'), 'type' => mysql_result($recordset, 0, 'type_id'), 'active' => mysql_result($recordset, 0, 'active'), 'datejoined' => mysql_result($recordset, 0, 'date joined'), 'dateleft...

javascript - 500 Error:expected "indent", but got "newline" -

ration_enum={' ':' ','定性':'定性','定量':'定量'} val, key in ration_enum if modi_type=='edit'&&key==common_index.ration option(value='#{key}', selected) #{val} else option(value='#{key}') #{val} expected "indent", got "newline" guessing jade template ... jade follows python rule whitespace matters, have indent code properly: ration_enum={' ':' ','定性':'定性','定量':'定量'} val, key in ration_enum if medi_type == 'edit' && key == common_index.ration option(value='#{key}', selected) #{val} else option(value='#{key}') #{val} jade has flexible indentation in can choose whether use tabs or spaces, how many spaces. but, have consistent in choice throughout template.

java - Iterating through a HashMap in a For Each style -

i want iterate through 'character' hashmap , grab of the'stat' objects using each loop. example want create function called 'showstats'. want able output 'stat' objects contained in 'character' hashmap. know how this? hashmap<string, gameobject> character = new hashmap<string, gameobject>; character.put("health", new stat("health",10)); character.put("accuracy", new stat("accuracy",10)); character.put("strength", new stat("strength",10)); character.put("coins",new item("coins","your money")); character.put("head",new bodypart("head")); use values collection for(gameobject gameobject : character.values()) { if(gameobject instanceof stat) { } }

c++ - where is class std::out_of_range fully defined? -

i searching under /usr/include/c++ on ubuntu linux. in /usr/include/c++/stdexcept , found this: class out_of_range : public logic_error { public: explicit out_of_range(const string& __arg); }; but can't find anywhere definition of out_of_range() constructors. also when stl throws out_of_range() exception, uses (example taken stl_vector.h ): __throw_out_of_range(__n("vector::_m_range_check")); and, thing can find __throw_out_of_range() is: void __throw_out_of_range(const char*) __attribute__((__noreturn__)); can kindly point me definitions of out_of_range class? they're defined in libstdc++ . can source code on gcc website . on ubuntu distros, have library installed ( libstdc++.so ), not source code. stuff found declarations, not definitions.

c# - Subdomain redirecting to root in MVC 3 -

i'm experiencing frustratingly perplexing issue regards subdomains on mvc 3 application. using code below, subdomain routes me root of domain everytime. when enter subdomain.mydomain.com routes me domain.com?nr=0. can't find why, or in code, it's appending querystring value. public class subdomainroute : routebase { public override routedata getroutedata(httpcontextbase httpcontext) { var url = httpcontext.request.headers["host"]; var index = url.indexof("."); if (index < 0) return null; var subdomain = url.substring(0, index); if (!string.isnullorempty(subdomain) && subdomain != "www" && subdomain != "mydomain") { var routedata = new routedata(this, new mvcroutehandler()); routedata.values.add("controller", "external"); routedat...

WPF c# window navigation -

i got 2 window , want navigate 1 when debug , shows nav null , why so? suppose null? because used same way navigate in past , work , try , doesn't work. if put nav == null , says nav.navigate(new uri("homemenu.xaml", urikind.relativeorabsolute)); is null here have : navigationservice nav = navigationservice.getnavigationservice(this); if (nav != null) { nav.navigate(new uri("homemenu.xaml", urikind.relativeorabsolute)); } is how can navigate window user control page? getnavigationservice returns null when dependencyobject: is navigationwindow. is frame that: 1) hosted navigator. 2) has journalownership property set usesparentjournal. is not part of content hosted navigator. http://msdn.microsoft.com/en-us/library/system.windows.navigation.navigationservice.getnavigationservice.aspx

android - How to not stop surface view while taking picture -

i take multi picture , i'm using these codes. makes screen freeze (after stop , start preview) in short time , make users uncomfortable. how can resolve problem. attention. picturecallback jpegcallback = new picturecallback() { public void onpicturetaken(byte[] data, camera camera) { cpreview.mcamera.startpreview(); fileoutputstream outstream = null; /*try { outstream = new fileoutputstream(string.format( "/sdcard/camtest/%d.jpg", system.currenttimemillis())); outstream.write(data); outstream.close(); } catch (filenotfoundexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } { }*/ } }; if there no way, i'm thinking of recording video , convert images ( though waste more time). some of latest phones nexus 4, samsun...

reporting services - Performance issue in SSRS Report in Test Server? -

i have query contains 45,611 rows executes in ssms (sql server management studio) 2008 r2 in 2 sec. in ssrs ,when preview report takes 6 sec, after deployed same report , configure asp.net application here takes same 6 sec. next published report in test server (same no of records),here takes more time 30 sec . see here report drildown in chart reports how improve performance ? because, while browse report ssrs, ssrs reports needs fetched html why taking time. what want suggest : [im supposing using asp.net] you can request report report server. then, can give output pdf document. which save time record fetching (a huge table) html table. hope understand.

Calling a parent method from a child class, encapsulation issues in Java -

for reason can't figure out how compile. cannot find setvalue function in line: 'skill.get("level").setvalue(newlevel);' import java.util.hashmap; public class stat extends gameobject { int value; public stat() { name = "accuracy"; value = 1; } public int getvalue() { return value; } public void setvalue(int newvalue) { value = newvalue; } } import java.util.hashmap; public class skill extends stat { protected hashmap<string, gameobject> skill; public skill() { name = "swords"; description = "learn how master art of swordmanship"; skill.put("level",new stat("level",1)); skill.get("level").setvalue(newlevel); } } skill.get("level") gameobject, not stat. probably setvalue defined in stat, not gameobject? if sure (for instance if checked instanceof...

livecode - how to add native list picker of Android and Iphone in live code -

i add native android list picker(spinner) , iphone list picker in livecode application.i using livecode combobox not working per native functionalities in android , iphone.please me how can achieve this? thanks use mobilepick command put weekdaynames tdays put lineoffset("tuesday", tdays) tinitialindex mobilepick tdays, tinitialindex -- ios example put "mon" & return & "tue" tdays put "jan" & return & "feb" & return & "mar" & return & "apr" tmonths mobilepick tdays, 2, tmonths, 3, "checkmark" answer result "okay" from lc dictionary

performance - What is the best way to handle a lot of images from a shared hosting plan? -

i have shared hosting plan , designing single page site include slideshow. browser typically limits number of simultaneous requests single domain. don't expect lot of traffic, traffic receive have fast load times. may able add unlimited subdomains, affect speed customer considering 1 polling server , subdomains point same processor? have created 2 versions of every image, 1 slideshow, , 1 larger format via ajax request, lag times still little long taste. suggestions? before contrive bunch of subdomains maximize parallel connections, should profile page load behavior know of time being spent. there might easier , more rewarding optimizations make first. there several tools can this, use of them: https://developers.google.com/speed/pagespeed/ http://developer.yahoo.com/yslow/ http://www.webpagetest.org/ some important factors @ cache optimization , image compression. if you've done things, , sure want use multiple (sub)domains, recommend using content del...

c# - getting file path from HttpPostedFile -

i trying file path of uploading file , using httppostedfile , doesn't seem option path name. true? how can go this? foreach (string s in request.files) { httppostedfile file = request.files[s]; string filename = file.filename; string filepath = path.getfullpath(filename); string fileextension = ""; if (!string.isnullorempty(filename)) fileextension = path.getextension(filename); .... } as pkkg pointed out in comment, not possible due security restrictions browsers. tell name of uploaded file, not path it. also, example, google chrome give faked path when trying grab via javascript : c:\fakepath\testfile.xml . edit: have ie @ hand, realized will give full correct path via javascript if grab selected value, example via document.forms.file.value . this imo bad behaviour should not rely on. browsers should hid...

java - Exception using HttpRequest.execute(): Invalid use of SingleClientConnManager: connection still allocated -

i'm using google-api-client-java 1.2.1-alpha execute post request, , getting following stacktrace when execute() httprequest. it happens after catch , ignore 403 error previous post same url, , re-used transport subsequent request. (it's in loop inserting multiple entries same atom feed). is there should doing 'clean up' after 403? exception in thread "main" java.lang.illegalstateexception: invalid use of singleclientconnmanager: connection still allocated. make sure release connection before allocating one. @ org.apache.http.impl.conn.singleclientconnmanager.getconnection(singleclientconnmanager.java:199) @ org.apache.http.impl.conn.singleclientconnmanager$1.getconnection(singleclientconnmanager.java:173) @ org.apache.http.impl.client.defaultrequestdirector.execute(defaultrequestdirector.java:390) @ org.apache.http.impl.client.abstracthttpclient.execute(abstracthttpclient.java:641) @ org.apache.http.impl.client.abstracthttpclie...

java - Using synchronized/locks in future code -

we building web app scala, play framework, , mongodb (with reactivemongo our driver). application architecture non-blocking end end. in parts of our code, need access non-thread-safe libraries such scala's parser combinators, scala's reflection etc. enclosing such calls in synchronized blocks. have 2 questions: are there gotchas out when using synchronized future-y code? is better use locks (such reentrantlock ) rather synchronized , both performance , usability standpoint? this old question)) see here using-actors-instead-of-synchronized example. in short more advisable use actors instead of locks: class greetingactor extends actor actorlogging { def receive = { case greeting(who) ⇒ log.info("hello " + who) } } only 1 message processed @ given time, can put not-thread safe code want instead of log.info, work ok. btw using ask pattern can seamlessly integrate actors existing code requires futures.

java - Error while attempting to program page creation on google sites -

i'm trying programmatic-ally add pages google site using java. code: import java.io.*; import java.net.malformedurlexception; import java.net.url; import com.google.gdata.client.sites.*; import com.google.gdata.data.plaintextconstruct; import com.google.gdata.data.xhtmltextconstruct; import com.google.gdata.data.sites.*; import com.google.gdata.util.serviceexception; import com.google.gdata.util.xmlblob; public class pagecreate { public static void main(string args[]) throws exception { webpageentry createdentry = createwebpage("new webpage title", "<b>html content</b>"); system.out.println("created! view @ " + createdentry.gethtmllink().gethref()); } private static void setcontentblob(basecontententry<?> entry, string pagecontent) { xmlblob xml = new xmlblob(); xml.setblob(pagecontent); entry.setcontent(new xhtmltextconstruct()); } public static webpageentry createwebpage(strin...

javascript - I have to press submit button twice in IE using jquery framework to submit form -

i have strange behaviour in ie browser. i have simple form: <form name="test" id="test" action="some_url_here" method="post"> <input type="text" name="url" id="url" class="required" /> <input type="text" name="page" id="page" class="required" /> ... <input type="submit" name="submit" value="submit" /> </form> and in js: var result = true; $("#test").on("submit", function(){ $(".required").removeclass("error"); $.each($("input.required"), function(k, v) { if($(this).val() === '') { $(this).addclass("error"); result = false; return false; } }); if(result) { if(!isvalidurl($("input[name='url']").val()){ $("input[name='url']").a...

Android file uploading with Apache HTTPClient library -

i have problems import libraries in "libs" folder of android project. tried jersey client , apache http client libraries , both doesn't works. i have configured manifest file this: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.androidclient" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="7" android:targetsdkversion="15" /> <uses-permission android:name="android.permission.write_external_storage"/> <uses-permission android:name="android.permission.internet"/> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" ...

multithreading - How to schedule Java Threads -

i have read java threads user-level threads , 1 of differences between user level threads , kernel level threads kernel level threads scheduled kernel(we cannot change it) user level threads can define our own scheduling algorithm. so how schedule threads in java? @ given time, when multiple threads ready executed, runtime system chooses runnable thread highest priority execution. if 2 threads of same priority waiting cpu, scheduler chooses 1 of them run in round-robin fashion. if don't want rr? there way can change or missing here? you cannot change scheduling algorithm jvm outside scope. jvm uses threading of user threads provided underlying os. so java perspective cannot change scheduling algorithm. scheduling done automatically. the thing in java can set priority of thread . how affects scheduling algorithm not defined. you can try change scheduling algorithm of os vm running on. highly dependend on os used.

version control - Git pull/clone gets new commits, but doesn't apply to working site files -

i have git versioning , development environment setup so: local.mydomain.com (local development) dev.mydomain.com (production testing) stage.mydomain.com (acceptance testing) mydomain.com (production environment) my git repo setup on remote server /srv/repo/mydomain.git bare repo. my local repo has been: git init(ed) git clone(d) remote repository (git clone user@domain:/repo/path/) when want make changes code, make them on local development git repository. when changes completed run following: git add . git commit -a git push origin master for production & acceptance testing, git pull origin master either dev or stage repo so: git pull origin master it should noted code changes pushed local repo. now have problem. have made whole lot of changes code in local repository.. done git add . done git commit -a done git push origin master done git status, date then on stage repo, have tried: git pull origin master , git clone origin maste...

Network Discovery sample issue in android -

i working on network discovery sample, downloaded sample application https://github.com/rorist/android-network-discovery its works if start application 5 times restart samsung galaxy tab 2. any solution on or better sample application network discovery in android i'm using jmdns in applications without problems. android has nsd api since api 16 useless purposes since doesn't expose dns txt records. can more details @ this bug report .

ios - Access Inbox SMS programmatically (For Enterprise account app) without JailBreak and don't want to upload on AppStore -

this question has answer here: iphone app reading sms 2 answers i developing 1 application **enterprise account** don't need upload app on app store . i can use private api on app without restriction. i want read inbox sms application . know possible in jailbreak . device. but device not jaibreak , want implement without jailbreak device. is possible or not ? intercepting/reading incoming sms not possible on ios (for privacy reasons). related post : iphone app reading sms

java - How to write different logs in different files with log4j2 (MDC in xml)? -

now i'm using structure this: appender: <rollingfile name="user.log" append="true" filename="users/%mdc{username}.txt" filepattern="users/archive/%mdc{username}-%d{mm-dd-yyyy}-%i.txt.gz"> <patternlayout pattern="%-5p %d{mmmm-dd hh:mm:ss} %x: %c - %m%n"/> <policies> <timebasedtriggeringpolicy/> <sizebasedtriggeringpolicy size="50 mb"/> </policies> </rollingfile> logger: <appender-ref ref="user.log"> <threadcontextmapfilter onmatch="accept" onmismatch="deny" operator="or"> <keyvaluepair key="username" value="%x{username}"/> <keyvaluepair key="ip" value="%x{ip}"/> </threadcontextmapfilter> </appender-ref> but doesn't work mdc keys. how use ...

android - RelativeLayout widgets width larger that RelativeLayout width -

i have relativelayout top bar of appwidget. contains 3 imageviews fixed witdh , 1 textview, depending on textview text or widget size relativelayout width can smaller sum of single widget, in case textview , imageview overlay 1 on other. avoid it, accettable solution hide textview if there no space. how can it? <relativelayout android:id="@+id/rl_top" android:layout_width="match_parent" android:layout_height="wrap_content"> <imageview android:id="@+id/iv_logo" android:layout_width="32dip" android:layout_height="32dip" android:layout_alignparentleft="true" android:layout_centervertical="true" android:src="@drawable/logo" android:contentdescription="@string/logo" /> <textview ...

css - Make two divs side by side, one is resizable and the other has same height -

Image
i bring here drama css height. i make layout, div contains 2 divs both in same line, 1 resizable , other must fit in parent's height (same height first one). the first div can have additional information (so can't fix height ), have more lines, important must not have scroll bar. second div must obey first height, if it's bigger have scroll bar. <div class='container'> <!-- parent --> <div class='left'> <!-- resizable --> </div> <div class='right'> <!-- same height left div --> </div> </div> unsolved code the problem can't figure out how make using css. or it's possible css. not use js. someone please me! fiddle what make right 1 absolutely positioned stops height influencing parent's. relevant css .container { background-color: gray; display: table; width: 70%; position:relative; } .container .left{ background-col...

NHibernate SqlExeption was unhandled -

Image
i study nhibernate , try repeat creating application video course, created database, model, xml-file , wrote code using system; using system.reflection; using nhibernate.cfg; using nhibernate.dialect; using nhibernate.driver; namespace nhibernatedemo { internal class program { static void main(string[] args) { var cfg = new configuration(); cfg.databaseintegration(x => { x.connectionstring = "server=localhost; database=nhibernatedemo; integrated security = sspi"; x.driver<sqlclientdriver>(); x.dialect<mssql2008dialect>(); }); cfg.addassembly(assembly.getexecutingassembly()); var sessionfactory = cfg.buildsessionfactory(); using (var session = sessionfactory.opensession()) using (var tx = session.begintransaction()) { var customers = session.createcriteria<customer>() ...

How to Plot fft of ascii values in MATLAB? -

i have ascii file containing 2048 x , y value pairs. want know how plot fft of y in matlab. writing following matlab code not able find appropriate result. how can this? have tried: i = load('data1.asc'); = 1:2048 y = i(:,2); end plot(x) fs = 40000; t = 1/fs; l = 2000; nfft = 2^nextpow2(l); y = abs(fft(y,nfft))/l; f = fs/2*linspace(0,1,nfft/2+1); figure, plot(f,2*abs(y(1:nfft/2+1))) axis([0 40000 0 40]) xlabel('frequency (hz)') ylabel('|y(f)|') instead of diving straight matlab's fft routine should instead consider using periodogram function. when people "fft" usual mean psd or periodogram, i.e. plot of power spectral density using suitably windowed , ffted sample. periodogram function in matlab takes care of details of you, i.e. applying window function, calculating fft, deriving magnitude fft output, appropriate scaling of axes, , plotting if required. note: periodogram in...

UILabel autoshrink is not working using interface builder? -

i made uilabel , set interface builder properties lines "0" line break "word wrap" autoshrink "minimun font size" but whenever large text set on label, not shrink. why? is there other thing needed set ? auto shrink works if have constraints fix size of label. either set fixed "width" constraint on label, or fix width relative container, pinning superview. edit: grammar hard.

sqlite - Not displaying the records from the ListView with ArrayList in Android -

i want populate listview saved data database, can't retrieve data instead i'm getting first record , count of records itself. mainactivity.java //populating listview arraylist<hashmap<string, string>> mylistdata = new arraylist<hashmap<string, string>>(); int[] columnids = new int[] {r.id.tv_lastname, r.id.tv_firstname, r.id.tv_mi, r.id.tv_birthdate, r.id.tv_homeno, r.id.tv_mobile, r.id.tv_email, r.id.tv_brgy}; arraylist<string> arraypatientdata = db.arraylistpatientdata(); cursor cursor = db.getpatientdata(); for(int i=0; i<cursor.getcount(); i++) { hashmap<string,string> map = new hashmap<string, string>(); for(int j=0; j<arraypatientdata.size(); j++) { cursor cursorpatientdata = db.getpatientdata(j); //cursor cursorcitydata = db.getcitydata(); //cursor cursorprovincedata = db.getprovincedata(); firstname = cursorpati...

.net - Scheduler tasks registration design -

i have architectural question. let's have scheduler , number of subsystems. of these subsystems can have actions, should able executed scheduler. we have 2 ways implement registration of scheduler tasks. one way have method in each subsystem, called registerschedulertasks , called bootstrapper in application during application start. in method call static scheduler class this: void handler1(){ } void handler2(){ } void registerschedulertasks() { scheduler.registerhandler( "e1", handler1 ); scheduler.registerhandler( "e2", handler2 ); } "e1" , "e2" names of tasks, have corresponding settings in scheduler config. another approach use, example, mef. each subsystem export set of ischedulertask s, , not register these tasks imperatively. , on other side of application have schedulertasksregistry , import set of these ischedulertask s. in approaches have map in config, contain scheduling timeline each task, identified in ...

Libgdx and Box2d Detect Collision of two specific bodies -

i have 2 bodies, both dynamic, 1 of them have turned off gravity , want turn on when hit other body. know can set own contact listener want specify action if 2 specific bodies touch. any 1 have guidance? u can set userdata of body , use that public class gamecoliision implements contactlistener { public gamecoliision() { } @override public void begincontact(contact contact) { // todo auto-generated method stub body a=contact.getfixturea().getbody(); body b=contact.getfixtureb().getbody(); a.getuserdata(); if(a.getuserdata() instanceof obstacle&&b.getuserdata() instanceof car) { } } @override public void endcontact(contact contact) { // todo auto-generated method stub } @override public void presolve(contact contact, manifold oldmanifold) { // todo auto-generated method stub } @override public void postsolve(contact contact, contactimpulse impulse) { // todo auto-generated method stub } } public class obstac...

qml - Clearing textfield blackberry -

how clear textfield in blackberry? here's qml: container { horizontalalignment: horizontalalignment.center verticalalignment: verticalalignment.bottom leftpadding: 75 rightpadding: leftpadding bottompadding: 40 textfield { id: tfcomment hinttext: qstr("add comment") inputmode: textfieldinputmode.text input { submitkey: submitkey.submit onsubmitted: { cppobj.oncommentsubmitclicked(tfcomment.text, ""); lcomment.text = tfcomment.text; } } } } container { horizontalalignment: horizontalalignment.ce...

c# - Bind Items to MenuItem -> use Command -

i have menuitem, has collection of items in it. looks file -> open menuitem. so: file open open database file 1 file 2 file 3 xaml code: <menu> <menuitem header="file"> <menuitem header="open"> <menuitem header="from database" itemssource="{binding ocfragebogen}"/> </menuitem> </menuitem> </menu> i want call command, when specific item has been clicked. example: user clicks on file 1, command should called "file 1" command parameter. viewmodel contains items, want display in menuitem "collection" private observablecollection<string> _ocfragebogen; public observablecollection<string> ocfragebogen { { if (_ocfragebogen == null) _ocfragebogen = new observablecollection<string>(); return _ocfragebogen; } set { _ocfragebogen = value; raisepropertychanged(() => ...