Posts

Showing posts from April, 2010

java, jquery and jsp messaging -

i using jquery request pass array of strings java class jsp. something : $.ajax({url: '<%= java class %>'+'?s1='+ $("#networkbox1").val()+'&box1=box1&tick=add&val1='+ allvs+'&s2='+ $("#networkbox2").val()+'&box2=box2&val2='+ allvs, type: 'get', datatype: 'text', async: false, success: function(data) {processbox(newdata);}}); allvs --is array of strings. i converting these strings list in java class , updating java collections (hashmap) on basis of parameters s1 , s2 , getting response jquery , printing again processbox function shown above. parametrs s1 , s2 can same different users. question need have methods in java class thread safe (synchronized) ? web app used different users when login website.

shell - Top active users in linux -

i'm trying learn basic linux i'm doing bit of homework. need write shell script displays in real time top x users number of active processes delay of n seconds (where x , n command line parameters). i pretty know how this, except core part of it: how can find top users number of active processes? i fooled around top command, did not got me want be. expanding on william's post above, head -5 show top 5. sleep 10 sleep 10 sec between re-checks. i'll leave figure out how check 2 arguments , use $1 , $2 in right places. while [ 1 ] date ps ax -o user | sort | uniq -c | sort -rn | head -5 sleep 10 done

How to use Calendar Provider with Android emulator -

Image
i intend use emulator test new calendar provider . created virtual device google api image , added google account calendar. started calendar application , said no google account added or nothing synched. in account settings used sync now, unable sync. i checked this article , says no longer possible use google sync instead should use new protocol no further instructions provided. in 2010 suggested add google account exchange account , change server name. rejected, stuck. can tell me how test calendar provider emulator? the answer simple: it impossible .

html - Tizen - how to change button font-size - fixed -

how can change button font-size? when tried change css, changes didn't work , buttons lost data-style: round attribute. have html app , button open page, here it: <p><a href="two.html" data-role="button" data-style="round" id="btn" style="border: 5; background: #ffffff"> test</a></p> css: #btn { width: 250px; height: 40px; margin: 0 auto; /*data-style: round;*/ border: #000000; border-style: solid; border-width: 5px; font-family:"times new roman", times, serif; font-size: 8pt; } solution founded in answer below why don't try thisin css border-radius:8px ; -moz-border-radius:8x; -webtrik-border-radius:8px

c# can't get attributes out of xml -

i have problem im trying values attributes of xml file url. xml: http://thegamesdb.net/api/getgameslist.php?name=x-men code: public mainpage() { initializecomponent(); var webclient = new webclient(); webclient.downloadstringcompleted += requestcompleted; webclient.downloadstringasync(new uri("http://thegamesdb.net/api/getgameslist.php?name=x-men")); } private void requestcompleted(object sender, downloadstringcompletedeventargs e) { if (e.error == null) { var feedxml = xdocument.parse(e.result); var gamedata = feedxml.root.elements("game").select(x => new getgameslist { // error values null id = (int)x.attribute("id"), gametitle = (string)x.attribute("gametitle"), releasedate = (string)x.attribute("releasedate"), platform = (string)x.attribute(

java - Fetch all towns/villages names using geonames api -

i new geonames api , need hierarchical results if select continent show countries , if select country need fetch states , on. continent --> country --> state --> districts/cities --> towns --> villages. i need build above hierarchy. using of geonames api able fetch till districts/cities unable fetch towns , villages particular district/city. is geonames api doesn't have database or there way follow getting towns , villages...??? or else there separate api achieve task. fetching records country "india". can 1 me on this. stuck on here. thanq in advance i suppose have answer in geonames discussion baord already, try 'p' option fclass.

c++ - class member function won't return -

i have following code: void module_books::show_item(int n, table<book> b) { cout<<"title: "<<b[n]->title<<"\n"; cout<<"author: "<<b[n]->author<<"\n"; cout<<"issue: "<<"no. "<<b[n]->issueno<<". "<<b[n]->city<<", "<<b[n]->publisher<<", "<<b[n]->year<<"\n"; cout<<"isbn: "<<b[n]->isbn<<"\n"; cout<<"pages count: "<<b[n]->pages<<"\n"; cout<<"information: loan count: "<<b[n]->outcount<<". "; if(b[n]->damaged) cout<<"damaged "; if(b[n]->out) cout<<"loaned"; cout<<"\n\n"; } int module_books::add_item(table<book> &b) { int _year, _is

sql server - Simple select query not working with vb.net while delete query works fine -

i writing simple sql server query operation through vb.net application. having strange problems. this line giving error: dr = cmd.executereader() this giving me error "invalid column name abhishek ." here abhishek data providing in textbox1.text . not able think of mistake side simple query. able run other queries, delete queries, on same table in different form, not database problem. any clue what's going wrong? reginfo table name. name 1 of fields. my complete code below: imports system.data.sql imports system.data.sqlclient public class form9 dim con new sqlconnection() dim cmd new sqlcommand() private sub button1_click(sender system.object, e system.eventargs) handles button1.click cmd.commandtext = "select * reginfo name=" + (textbox1.text) + "" dim dr sqldatareader con.open() cmd.connection = con dr = cmd.executereader() '<<< line creating problem if

mysql - How to adding string when converting database to excel with PHP? -

i have code, post code wanna ask about. row 5, want adding word "%" because percent containt data need use "%" behind numbers. code : for ($y=0; $y<$jm; $y++) { ++$i; xlswritenumber($xlsrow,0,"$i" ); xlswritelabel($xlsrow,1,$data['arsip'][$y]); xlswritelabel($xlsrow,2,$data['income'][$y]); xlswritelabel($xlsrow,3,$data['outcome'][$y]); xlswritelabel($xlsrow,4,$data['efficiency'][$y]); xlswritelabel($xlsrow,5,number_format($data['percent'][$y],2)); } i've tried making new variable , adding behind code : $symbol = "%"; xlswritelabel($xlsrow,5,number_format($data['percent'][$y],2, echo $symbol)); but didn't work. wrong? can me? in advance! ;)

c++ - how to train SVM using landmarks from CI2CV sdk to classify expressions? -

Image
i have image such this after feeding image ci2cv face-fit along file containing info can't make sense of 66 landmarks detected in following form, explanation here great decimal values stand n_points: 66 { 54.9274 129.935 56.0976 142.037 58.2824 153.995 //there 63 more lines } is possible use information classify expression svm?

sinatra - Why is BCrypt failing to authenticate in this context? -

when create users (in sinatra), this require 'bcrypt' post '/users' @user = user.new(params[:user]) @user.password_hash = bcrypt::password.create(params[:password]) p @user.password_hash == params[:password] # prints true! @user.save! session[:user_id] = @user.id redirect '/' end then when try verify same user this post '/sessions' @user = user.find_by_email(params[:email]) p @user.id # prints 14 p @user.password_hash # prints correct hash p @user.password_hash.class # prints string p bcrypt::password.new(@user.password_hash).class # prints bcrypt::password p params[:password] # prints "clown123" p bcrypt::password.new(@user.password_hash) == params[:password] # prints false! # redirect '/' end what broke? examp

Opening https with phantomjs on OpenShift -

i using openshift, , using following code open http url phantomjs (in order take screenshot), http works fine https fails status code null. know specific question , problem openshift looks openshift want users ask questions on now. page.open(address, function (status) { if (status !== 'success') { console.log('unable load address!'); phantom.exit(); } else { window.settimeout(function () { page.render(output); phantom.exit(); }, 200); } }); i gave on making work on openshift , moved heroku , same code on heroku worked charm.

jquery - Validate the length of an input be exactly 10 in a form with html5 -

i have form (bootstrap v.3.0) , want check length of input 10. want use html5 solution used pattern=".{10,10}" doesn't work... here bootply <form class="form-horizontal" role="form"> <div class="form-group"> <label for="id9" class="col-sm-2 control-label">phone</label> <div class="col-sm-5"> <input type="number" name="j_phone" id="id9" pattern=".{10,10}" class="form-control" placeholder="phone number" required> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-default">ok</button> </div> </div> </form> you can't use type="number" , pattern attribute together. instead change

android - Could not find MyFirstAndro.apk -

i'm new in android developpment. create forst app when running it, i'm facing error could not find myfirstandro.apk! . me please? regards try this: right click on project, click on properties on shown window, choose android left side list uncheck "is library" option, @ bottom right side of window.

Python Hadoop streaming with import package that are not installed on data nodes -

i tried import scikit image in python hadoop streaming, , i've tried out existing posts on stackoverflow here , here , none of them solve problem. the real question is, if distributed using -file zip/mod file packaged scikit-image folder, how python scripts running on data nodes know how extract packages , import code? note i've installed python scikit-image on name node , , able run local experiments. my script trivial: classic word count example python streaming, "import skimage" in mapper.py. http://www.michael-noll.com/tutorials/writing-an-hadoop-mapreduce-program-in-python my command : hadoop jar hadoop-streaming.jar \ -file mapper.py -mapper mapper.py \ -file reducer.py -reducer reducer.py \ -file ./skimage.mod \ -input /user/text/* \ -output /user/textoutput/ screen printouts: packagejobjar: [mapper.py, reducer.py, ./skimage.zip] [/usr/lib/gphd/hadoop-mapreduce-2.0.2_alpha_gphd_2_0_1_0/hadoop-streaming-2.0.2-alpha-gphd-2.0.1.0.jar] /

c# - ItemsControl, on binding text cuts down from end -

Image
iam working on win 8.1app. have datatemplate <datatemplate x:key="radiooptiondatatemplate"> <grid horizontalalignment="left"> <grid.rowdefinitions> <rowdefinition height="auto"/> <rowdefinition height="auto"/> </grid.rowdefinitions> <textblock style="{staticresource subtitletextblockstyle}" margin="0 0 0 15"> <run text="{binding name}"/><run text=":"/> </textblock> <itemscontrol grid.row="1" itemssource="{binding getoptions}"> <itemscontrol.itemtemplate> <datatemplate> <radiobutton content="{binding}" margin="0 0 10 10" ischecked="true"/> </datatemplate>

c++ - insert into front of queue instead of back -

for project, want insert ascii letters @ end of queue , numbers @ front of queue. know how insert things @ end of queue, stuck on latter. here enqueue function: void linkedqueue::enqueue(elementtype new_data) { node *newnode = new node(new_data); node *tempholder = head; while (tempholder->next !=null) { tempholder = tempholder->next; } tempholder->next = newnode; mysize ++; } how modify function named enqueue_front ? simple linked list modification trick. void linkedqueue::enqueue_front(elementtype new_data) { node *newnode = new node(new_data); newnode->next = head; head = newnode; mysize ++; }

sql - Selecting values from a table where values from one column is divided into multiple columns -

i'm trying develop query in values of single column split 2 or more separate columns reflect whether or not particular id has each of different values. for example, have table this: ------------ | id | val | |----|-----| | 1 | | | 1 | b | | 2 | | | 3 | | | 4 | b | | 5 | | ------------ the query produce table looks this: ---------------------- | id | val_1 | val_2 | |----|-------|-------| | 1 | | b | | 2 | | | | 3 | | | | 4 | | b | | 5 | | | ---------------------- specifically, query show id's have missing values (i.e. id "1" knocked off table). so far have tried using self inner join, have not been able find select clauses produce this. any suggestions? thanks! update : filtering out columns have val_1 , val_2 select * ( select id, max(case when val='a' 'a' end) val_1, max(case when val='b' 'b' end) val_2 table1 group i

How to get rid of wp-login.php in Wordpress? -

i have wordpress blog site. see wp-login.php file allows users access wordpress admin section though have restricted "wp-admin" folder folder protection. can delete file off? users of site not allowed log site form blog. please let me know if there issue if delete .php file? it not practice remove login file, rather can use plugins rename wp-admin or wp-login.php else wish use. use rename wp-login.php plugin rename site's login address from: http://www.example.com/wp-admin to http://www.example.com/securelogin

javascript - Updating the database on click of a table row -

i having table in data being populated through database.now want click on 1 of row alert message displays , readstatus of row become true in database database gets updated . now problem write code updating database dont want move different page so. like table : <input type=hidden name="notifyidd" id="notifyidd" value="<%=messageid%>"/> <tr bgcolor="#5d1b90" color="#ffffff" onmouseover="changecolor(this, true,false);" onmouseout="changecolor(this, false,false);" onclick="donav('shownotification.jsp?mid=<%=messageid%>');"> <td><input type="checkbox" name="" onclick="doremove(event);" width="20" class="select_all_mail" value=<%=messageid%>></td> <td callspan="3" width="1000px"><%=messagesubject%> @ <%=sendingtime%></td> </tr> and in oncli

javascript - How to get PHP to choose one div or another depending on device screen size -

at minute have php script outputs 'page title' div. div incorporates blur script (blur.js) , quite slow requires lots of processing. this means pages take longer load on desktop, longer on mobile! i can use mediaquery hide div (using display: none ) , instead display simple text title, in background div still gets processed. is there way use php choose either div or plain title, rather media query? know involve php code having know device screen size, , i'm not sure how that. you detect mobile devices using user agent analyzer wont give screen size. you use javascript send screen size server via ajax , store cookie or user.

Specify starting point of foreach enumerator in ruby -

i have rake file pulls in data external csv file , enumerates through with: csv.foreach(file, :headers => true) |row| what effective way (in ruby) specify starting point within spreadsheet? :headers => true allows me start importing second line, if want start line 20? use .drop(#rows ignore): csv.open(file, :headers => true).drop(20).each |row|

javascript - How to make chrome extension to talk with angular on the page -

i've chrome extension modifies pages dom. page in angular need change scope of element. how can that? what want interact page's js context content script. there nothing special angularjs in regard. in order able interact page's js need inject code page. can achieved in lethora of ways , this answer covers them in great detail.

python - URL encoding: difference between Django's iri_to_uri and w3school list -

consider word declaração i'm trying put in url format. what happens when use iri_to_uri django: print iri_to_uri(u"declaração") # declara%c3%a7%c3%a3o what obtain when use list in w3school : declara%e7%e3o why different? i'm trying obtain latter using django/python. way easily? (3rd party using , there no way around...) i have no idea http://www.w3schools.com/tags/ref_urlencode.asp doing, output of cannot unqoted in python. import urlparse print urlparse.unquote('declara%e7%e3o') # declara��o print urlparse.unquote('declara%c3%a7%c3%a3o') # declaração but not first time, when www.w3schools.com sucks, bad place learn - loads of errors , unprecise statements. i recommend http://w3.org , http://developer.mozilla.org/en-us instead.

iphone - Using the proximity sensor to do something in iOS -

i'm trying make app when put hand on proximity sensor. looking @ the apple docs. on uidevice , can't find information on how when sensor covered. assume there method have put in code can't find it. thanks. from link, proximitymonitoringenabled. i've ask google this, , found link : http://mobileorchard.com/new-in-iphone-30-tutorial-series-part-4-proximity-detection/ probably not one, ok.

java - Can not find symbol -

so far, i've been reading, error has main class not being able access juego class. can't instantiate "juego" nor "tablero" class object. how can fix error? i'm sure must i'm overlooking, haven't been able figure out. i'm stumbling upon error reads: c:\users\pabloeugenio\desktop\memoria\gamedriver.java:7: error: cannot find symbol public class gamedriver extends juego{ ^ symbol: class juego c:\users\pabloeugenio\desktop\memoria\gamedriver.java:10: error: cannot find symbol juego j; ^ symbol: class juego location: class gamedriver c:\users\pabloeugenio\desktop\memoria\gamedriver.java:11: error: cannot find symbol j = new juego(); ^ symbol: class juego location: class gamedriver 3 errors [finished in 0.5s exit code 1] the program consists in 3 java classes in package memoria,; juego.java, tablero.java, , gamedriver.java. //gamedriver // // c

'null' is not an object error when including jQuery into an opened page using PhantomJS -

i'm trying out phantomjs , wanted use extract content webpage. however, cannot inject jquery using following code. console.log('ssl support = ', require('system').issslsupported); var page = require('webpage').create(); console.log('page created'); page.open('https://www.google.com/#q=my+test+query', function() { console.log('page opened'); page.includejs("http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js", function() { console.log('jquery injected'); phantom.exit(); }); }); when run code, see error c:\users\royshi\skydrive\developer\crawler>phantomjs test.txt ssl support = true page created page opened typeerror: 'null' not object (evaluating 'document.body.appendchild') http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js:1 ^c c:\users\royshi\skydrive\developer\crawler> my code not different the example provided phantomjs . wondering w

binary - How to look at a certain bit in C programming? -

i'm having trouble trying find function @ bit. if, example, had binary number of 1111 1111 1111 1011, , wanted @ significant bit ( bit way left, in case 1) function use @ bit? the program test if binary number positive or negative. started off using hex number 0x0005, , using two's compliment function make negative. now, need way check if first bit 1 or 0 , return value out of that. integer n equal 1 or 0 depending on if negative or positive. code follows: #include <msp430.h> signed long x=0x0005; int y,i,n; void main(void) { y=~x; i=y+1; } there 2 main ways have done in past. first bit mask use if checking exact same bit(s). example: #define mask 0x80000000 // return value of "0" means bit wasn't set, "1" means bit was. // can check many bits want call. int applymask(int number) { return number & mask; } second bit shift, mask (for getting arbitrary bit): int checkbit(int number, int bitindex) { r

meteor - How can I update a single child document in a MongoDB document array using something like $set and $elemMatch? -

i have collection structure so: albums: { 2obkjqyfwf3vrgdj4: { _id: "2obkjqyfwf3vrgdj4", titles: [ { titletext: "i album" }, { titletext: "this other title" } ] } } i want below update titletext equal something, change it: db.albums.update({"_id": "2obkjqyfwf3vrgdj4", "titles": {$elemmatch: {"titletext": "i album"}}}, {$set: { "titles.titletext": "i not album" } ) i know foreach, seems lot of wasted resources plan on having index on titles.titletext . is there i'm missing, or there not simple way this? i'm using meteor, don't think should change of logic if there way in mongodb. thanks everyone! turns out question repost of link this issue can solved in mongodb doing, db.albums.update({ "_id": "2ob

angularjs - AngularFire equivalent to $setPristine? -

i'm trying understand correct workflow create $setpristine equivalent firebase data. my workflow follows: 1) create firebase object (via angularfire generator 'syncdata') 2) form data modifies $firebase object. 3) update remote model, use myref.$save() all of works well. now, i'm trying add "reset" button on form, locally modified data revert remotely stored data. so far, i'm running problems. i've tried reinitializing firebase reference eg myref = syncdata('/my/path') not work, destroying remote data object! what correct way re-pull remote data use in angular model? i know old question, ran issue myself. after searching around found post: http://grokbase.com/t/gg/firebase-angular/1499haaq4j/editing-data-as-a-copy which led me outdated code snippet (2 months lol xd) @kato: https://gist.github.com/katowulf/8eaa39eab05a4d975cd9 i modified work firebase 2.3.1 , angularfire 1.1.3: app.factory('resetfactory

php - Trying to get property of non-object -

i want if there no authors/users found exit given message below. keep striking trying property of non-object on $author_found_count. why this? thanks $find_author = "select user reviews review_id=$review_id;"; $search_author = mysqli_query($con,$find_author); $found_author = mysqli_fetch_array($search_author); $author_found_count = $found_author->num_rows; //check see if reviews have been found. if($author_found_count == 0) { //no reviews found. exit ("you not author of review. not authorised delete it."); } you trying num_rows of php array, purpose should use mysqli_result object: $author_found_count = $search_author->num_rows; you can use php function check if result set empty: $author_found_count = count($found_author);

twitter bootstrap - button-group in horizontal and vertical -

i want resposive view of buttons in bootstrap. that: [button1] [button3] [button5] [button2] [button4] [button6] and on phone: [button1] [button2] [button3] [button4] [button5] [button6] as user clicked in 1 button should set active, others inactive. you can use 1 http://jsbin.com/dohanivo/1 , in example used 4 column lg,md , sm , 12 column xs devices.

3d - CGAL Mesh(es) intersection/collision -

i have collision detection module in tracking pipeline, detecting when 2 different meshes collide/interpenetrate or if there self-penetration of articulated mesh. based on depth of penetration there should penalization combats phenomenon. should list of colliding faces/vertices in order so. after examining several options, decided start working cgal . in this link there interesting answer pointing examples. ( this , this ). examples use aabbs (axis-aligned bounding boxes), proposed way non-rigid meshes, since frequent update of them needed. examples clear self-intersection case, following not clear me: apart creating b.box each triangles, guess there no tree structure created under hood speed search process. so? if yes, hint so? in case of 2 separate meshes, guess it's not nice merge triangles/boxes in 1 vector , follow examples (though mentioned here solution, doesn't sound elegant). hint nice practice? should 1 mix these examples, creating trees of triangles/

javascript - SecurityError: The operation is insecure. using Htmlcanvas -

trying convert images drag , place on canvas element png or jpeg photo (sort of moodboard concept polyvore) can view images place on canvas @ once in 1 png or jpeg photo. can save or whatever photo. but run securityerror: operation insecure. when press save , try convert data show saved image myself using .alert() method. ideas how can past error accomplish goal? thank you! here link project view live: http://amechi101.github.io/moodboard/ html: <div id="container" ondrop="drop(event)" ondragover="allowdrop(event)"></div> <div class="buttonmoodboard"> <button class="btn btn-primary btn-lg" id="save">save moodboard</button> </div> javascript: var stage = new kinetic.stage({ container: 'container', width: 500, height:500 }); var layer = new kinetic.layer(); uni_width = 120; function allo

javascript - JS: How to print elements in a for loop with distinct #ids? -

i want print out jquery, several html elements, , each element should have distinct #id. my code output elements, don´t know how make them different. <input type='button' onclick="generartabla(5)" name='submit' value='how many?'> <div id="output"></div> function generartabla(cant) { var numero = 1; var celda = "mes <input type='text' name='nro"+numero+"'><br>"; ($i=0; $i<cant; $i++) { $('#output').append(celda); } } each line should this: mes <input type='text' name='nro1'><br> mes <input type='text' name='nro2'><br> mes <input type='text' name='nro3'><br> etc. and right outputs this: mes <input type='text' name='nro1'><br> mes <input type='text' name='nro1'><br> mes <input type='text'

animation - How to fade in individual letters of text on iOS -

this question has answer here: how make secret ios app text animation 4 answers what's best way fade in individual letters of uilabel on time? i'm looking create similar example below. http://s11.postimg.org/5s16qmwn5/secret.gif i wouldn't use uilabel this. i create uiview catextlayers inside it, 1 text layer each character. can animate text layers independently. check out apple's wwdc videos on core animation learn how works. it's simple.

c# - Hosting managed code and garbage collection -

i have c++ out-of-process com server hosts lot of c# code support api exposed c++ com objects. for variety of reasons, considering eliminating c++ portion of solution. however, because of constraints outside of control have retain out-of-process com server. microsoft have canonical example of here . looking @ example there don't understand. before message loop starts, timer created call gc.collect every 5 seconds. mention of can find indicates it's ensure com objects released in reasonable timeframe. i'm little confused this...does c++ host call gc.collect automatically? i'm not doing it. , yet creating managed objects (with comvisible(true) com objects in c++ code. mean should calling gc.collect every 5 seconds now? if not, why need call in new c# out of process server. make automatic process cleans unreferenced com objects in normal c++ application? (which assume happening sometime during message loop.) calling gc.collect every 5 seconds seems bad idea. wro

java - Mule default catch exception and stopping a flow -

i created default catch exception in mule executed whenever error thrown in flow. however, seems once end of exception reached (i run couple components in it), execution of flow resumes point, expectable since error caught. i'd like, however, have execution of flow stop if catch exception triggered. way found add error filter main flow, seems temporary solution, since have add error filter after each element of flow have intended result. in exception strategy add scripting component stop flow: <scripting:component doc:name="script"> <scripting:script engine="groovy"><![cdata[ mulecontext.getregistry().get('<flow_name>').stop() ]]></scripting:script> </scripting:component>

playframework 2.0 - How to import multi-module project in IntelliJ IDEA? -

Image
i'm used spring , maven projects set multi-module project in maven projects like: app-web app-models app-services app-common i'm getting using play framework 2 (scala) , sbt . is there similar concept play , sbt group of these projects single intellij idea solution , sbt? intellij idea 13 (the latest version 13.1.3 ) comes the built-in sbt support , , the ultimate edition adds play support . a multi-module sbt project can imported idea , supported out of box it's play-based or not (they're sbt projects after all). you should try out following simplistic build file build.sbt (or generate play project play new or better activator new [your-project-name] play-scala ): lazy val a, b, c = project and following project/build.properties : sbt.version=0.13.5 nothing these 2 above files needed started sbt/activator. in idea, open project using file > open... , select build.sbt . click ok see window specify additional configuration o

c# - SQL know what statement activated a trigger if the trigger fails -

i'm using sql server in c# application, , i'm using batch statements. problem i'm having in case statement fails, whatever reason, need know statement failed , return it. i've managed putting try catch around sql statement (so won't quit if fails) c# cmd.executequery returns number of rows affected. the problem i'm having if failure occurs because of trigger, trigger outside of try catch of original batch , won't caught, instead caught c# application. @ point, state of batch lost in limbo , whole thing fails. i need way of knowing statement (or number of rows affected far, or index in batch) triggered trigger caused exception. whether there's can in sql or c#, i'm open whatever. thanks. this isn't answer it's far big comment , need formatting. say have statement begin try insert jazzhands values (2) end try begin catch end catch. if table jazzhands has trigger inserts whatever in other table, if trigger fails, won

logic - Prolog backtracks and executes other statements too -

assume have following facts: sister(susan, jane). sister(karren,holtby). parent_of(susan,karren). parent_of(susan,holtby). and following definitions: sibling(x, y) :- sister(x, y). sibling(x, y) :- parent_of(z, x), parent_of(z, y). is there reason why goal sibling(susan, jane) gives true false. both definitions used? is there way check definitions true , output true if so? prolog tree based language. let's establish knowledge base male(mark). female(mary). female(beth). brother(mark, mary). %mark brother of mary brother(mark, beth). %define sister sister(x,y) :- female(x), male(y), brother(y,x). in case clause sister evaluated such: bind mary x bind mark y check knowledge base brother(mark, mary) return true if found bind beth x bind mark y check knowledge base brother(mark, beth) return true if found no other bindings exist, return false in prolog possibilities tried. return true cases until can't find one, automati

c++ - Unhandled exception at 0x50E2DF58 (msvcp120d.dll) -

i'm trying read binary file structs. error thrown when program exits. breakpointed , error comes after return 0 executed. when run program displays results. not crash until after system("pause") this actual error: unhandled exception @ 0x50e2df58 (msvcp120d.dll) in struct reader.exe: 0xc0000005: access violation reading location 0x007ab1ec. #include <iostream> #include <string> #include <fstream> using namespace std; struct user{ string name; }; int main(){ fstream file("file.dat", ios::in | ios::binary); user users[5]; (size_t = 0; !file.eof(); i++) { file.read(reinterpret_cast<char *>(&users[i]), sizeof(user)); } file.close(); size_t size = (sizeof(users) / sizeof(user)); (size_t = 0; < size; i++) { cout << users[i].name << endl; } system("pause"); return 0; } when return function, destructor each element of users a

c++ - putting a '&' after the type -

i new programming. moving on c++ c in college courses, , encountered haven't seen before in c. after type, either in function declaration or passing parameter, & follows type. example, use struct called customer in 1 of our projects, , of functions pass customer& . why ampersand after type, opposed in front? thanks! references in c++ allow cleaner way execute following code: int x = 16; int* y = &x; cout << *y; which written instead as int x = 16; int& y = x; cout << y; when defining functions, reference allows function change value of parameters without causing user of function put ampersand before everything. e.g. void func( int& ) { = 5; } void main() { int = 10; func( ); cout << a; // output '5' } be careful this, programmer using functions without checking implementation might not realize function changing value of parameters unless intent obvious. it's better use pointers or return s

java - try/exception for integer or double or string -

how differentiate integer , double. example if wanted integer , verify it. if integer output "you correct" else "you entred wrong. try again". import javax.swing.*; public class inputexceptions { private static int inputint; private static double inputdouble; public static int inputint() { boolean inputok = false; while (inputok == false) { inputint = integer.parseint(joptionpane.showinputdialog("enter integer")); try { inputok = true; } catch (exception e) { joptionpane.showmessagedialog(null,"*** error: value entered not integer ***"); } } return inputint; } public static void main(string[] args) { joptionpane.showmessagedialog(null,"*** integer correct input: " + inputint() + " ***"); } }

php - WordPress plugin to allow each author to upload a background image? -

is there wordpress plugin lets each author upload background image archive page? aim display both author's avatar , background image on author archive page. you can use plugin http://wordpress.org/plugins/fancier-author-box/ complete task

python 2.7 - Querying many-to-many in SQL Alchemy -

i have 2 two tables related third relationship table. basically, have many fits, can use number of tags, , i'm trying query fits tagged tag using tagid. tag.py: tags_table = table("tags", saveddata_meta, column("tagid", integer, primary_key = true), column("name", string, nullable = false, unique=true)) mapper(tag, tags_table) fit.py (stripped down) fits_table = table("fits", saveddata_meta, column("id", integer, primary_key = true), column("ownerid", foreignkey("users.id"), nullable = true, index = true), column("name", string, nullable = false), column("timestamp", integer, nullable = false)) fit_tags = table("fit_tags", saveddata_meta, column("fitid", integer, foreignkey("

java - Trying to display created output file -

so passed file filewriter , passed printwriter. however, upon assignments instructions im supposed print these variables pass printwriter using tostring method in superclass. assignment thats why rules clear how instructors wants output be. system.out.print("please enter file name: "); filename = input.next(); file fw = new file(filename + ".txt"); accountwithexception acctexception = new accountwithexception(fullname, balance, id, rate); system.out.println(acctexception.tostring()); <---this works // pass object printwriter , pw write file pw = new printwriter(fw); // print created file pw.println(firstname); pw.println(lastname); pw.println(balance); pw.println(id); pw.println(rate); system.out.println(pw.tostring()); <---doesn't work. prints location , im supposed somehow use overloaded tostring method output data within file (i guess after written) yo

c++ - Sorting names alphabetically using selection sort. -

okay, posted same question earlier , got on arrays/vectors , on. fixed people told me run issues program gives me bunch of errors. , time, don't see wrong. makes perfect sense me doesn't computer , i'm mere novice. so here's i'm trying accomplish. reading names file called names.dat , has names saved this: collins, bill\n smith, bart\n allen, jim\n . . . holland, beth i'm trying sort these names alphabetically (both ascending , descending order). let alone descending order now, wrote program supposed sort these names in ascending order. keeps spitting out errors don't understand meanings of. don't know if errors coming deque , string i'm trying define, or other parts. here's got far. #include<iostream> #include<fstream> #include<iomanip> #include<deque> using namespace std; const int size = 20; void setascendingsort(string [], int); void displayarray(string [], int); int main() { deque<string> name

javascript - Using node.js to create IRC bot. Message sends twice despite function only being called once -

i'm using node.js create irc bot asks trivia questions. far works great, wanted implement system generates hints providing underscores each letter. time passes, fills in blanks. if nobody gets answer before blanks filled in, bot moves on. (if not in single-question mode) the issue: if nobody answers question, bot moves on next 1 intended. bot supplies two hints @ same time. repeats first hint, other times it's satisfying else statement , providing next hint. i have troubleshooted verify function gethint being called once. i've been staring @ code 2.5 hours , i'm beginning lose hope. i'm brand new javascript, first time coding in it. appreciated. example 1: satisfies if (there no hint) twice bot> drummer beatles? bot> _ _ _ _ _ _ _ _ _ _ bot> r _ _ g o s _ _ r bot> r _ n g o s t r r bot> oh man, nobody got answer! was: ringo starr bot> president of united states? bot> _ _ _ _ _ _ _ _

How to style facebook like box -

i have included facebook box script code on website. need change styles despite of being default facebook colors , background. how possible. me please not sure if after people on @ pixabay made tutorial on how change parts of it, perhaps colour go along it? here go: link

C# How to get pixel color/data from the screen? -

this question has answer here: how read color of screen pixel 4 answers ok i'm trying little more advanced here , 1 of things want learn how pixel color or data position on screen. have searched lot seems people want in c or c++. im making program scans location on screen color. if location contains orange number in window turns 1 true or 0 false. background of window transparent, if matters @ all. i have come across graphics.copyfromscreen() , bitmap.getpixel(); thanks please see following reference, think need: http://www.codeproject.com/articles/24850/geting-pixel-color-from-screen-shoot-image

http - Communicate to Rest server on other domain with Javascript -

i have scenario, javascript client connects rest sever expose jsonp api's on domain. my question if server stateless, if server has /session api generate session key, meaningful other succeeding requests? that is, how can server side session on domain usable in pure front-end scenario. in typical web app, front-end loaded same domain thus, when app loads , authenticates, session objects may generated. yet kind of situation client (is pure frontend) lives somewhere else in internet , not in same domain of rest server. session not applicable correct?

php - Drupal template, verify that the page is a menu item -

helló! i want examine actual page in menu. want drupal template (page.tpl.php). example: if ($page_is_a_menuitem): echo "this page in menu"; else: echo "this page not in menu"; endif; because if page in menu want highlight title. sorry bad english. try this return menu list :- menu_get_menus(true) like this array ( [menu-footer-menu] => footer menu [main-menu] => main menu [management] => management [navigation] => navigation [user-menu] => user menu ) and want main menu inside list use this $tree = menu_tree_all_data('main-menu') this return in main-menu in items otherwise use code $path = current_path(); $selected_menu= ''; $menu = menu_link_get_preferred($path = null, $selected_menu = null); $menu return current page manu detail after want echo "this menu ".$menu['menu_name'] .' , menu title '.$menu['title'];

how to use selenium grid with Specflow and Nunit and Webdriver (in DotNet version) -

presently built automation framework uses selenium webdriver+ specflow + nunit, , suing bamboo our ci run our job against our every build. we written build.xml handle our targets (like clean, init, install latest build, run selenium scripts, uninstall build. etc) ant command read tag name build.xml , runs respective feature/scenarios based on tags (like @smoke, @regression)with nunit in ci machine. now our requirement use selenium grid divide scripts different machine , execute above set-up. grid has divide scripts based on feature file or based on tags.how achieve this. is there thing need done under [beforefeature] , [beforescenario] ? if provide in details steps or link explains detail steps great help. please 1 can in regards. thanks, ashok you have misunderstood role grid plays in distributed parallel testing. not "divide scripts", provides single hub resource through multiple tests can open concurrent sessions. it role of test runner (in cas

java - How to verify criteria.list is empty? -

i've created criteria retrieve list of items. although expected, no result returned if condition not work. criteria cre = session.createcriteria(name.class,"name); cre.add(restrictions.eq("name.fname","alex"); list<name> names = (list<name>) cre.list(); i used both following 'if' conditions neither works 1) if(names.isempty()) system.err.println("cre empty"); 2) if(names != null) system.err.println("cre empty"); you can use size() of list. if list's size 0, empty. if(names.size() == 0){ //it empty } if(names.size() > 0){ //it **not** empty }

Why i cannot render my KML service in google maps? -

i have been trying render kml service in google maps following. var ctalayer = new google.maps.kmllayer({ url: 'http://domainname/geosystem/redrawkml' }); ctalayer.setmap(map); but getting undefined result ctalayer object when have checked status. but same service working good, if have tried parse kml service geoxml parser. now, confused , having no idea . why can not render kml service google maps kml layer in google maps. any appreciated. my woring code geoxml library follows. var geoxml = new geoxml3.parser({ map : map, singleinfowindow : true }); geoxml.parse('http://domainname/geosystem/redrawkml'); the following kml content produced rest service ( http://domainname/geosystem/redrawkml ) <?xml version="1.0" encoding="utf-8" standalone="yes"?> <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:ns2="http://www.google.com/kml/ext/2.2" xmlns:ns3="http://www.w3.org/2005/atom&

Variable of variable in Ansible Playbook -

i trying access variables defined in group_vars group_vars/all parent1: child1: somevalue1 child2: somevalue2 parent2: child1: somevalue1 child2: somevalue2 now passing parent detail ansible playbook vars this ansible-playbook playbook.yml -e "parent=parent1" now how can access parent1.child1 value parent1 comes in {{ parent }} vars? my playbook this:- playbook.yml - hosts: local user: roop gather_facts: no connection: local vars: parent: "" tasks: #get parent value - debug: msg={{ parent }} #trying access parent1.child1 value here - debug: msg={{ {{ parent }}.child1 }} playbook output:- play [local] ****************************************************************** task: [debug msg=local] ******************************************************* ok: [127.0.0.1] => { "msg": "parent1" } task: [debug msg={{{{parent}}.child1}}] *************************************** ok: [127

java - Setting byte field in an object -

i have simple program below: class serializationbox implements serializable { private byte serializableprop = 10; public byte getserializableprop() { return serializableprop; } public void setserializableprop(byte serializableprop) { serializableprop = serializableprop; } } public class serializationsample { /** * @param args */ public static void main(string args[]) { serializationbox serialb = new serializationbox(); serialb.setserializableprop(1); // here error } } at indicated place in code error "the method setserializableprop(byte) in type serializationbox not applicable arguments (int)". i believed per link http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html , allowed pass -128 127 arguement. please let me know missing? you have cast integer byte : serialb.setserializableprop((byte) 1); notes: when do private byte serializ