Posts

Showing posts from July, 2015

Reading special field from variable XML File c# -

Reading special field from variable XML File c# - i have got file called xmlfile.xml: <personen> <person> <vorname>manfred</vorname> <telefon/> <zuname>fischer</zuname> <alter>45</alter> <adresse ort="bonn" strasse="neuestr.34"></adresse> </person> </personen> there 2 problems. first of fields of '' variable. maybe xmlfile contains 3 persons or value (of course of study contains @ to the lowest degree one). need print out 'vorname' of each person, how can so? tried code (just short view): reader.readtofollowing("person"); string isbn = reader.getattribute("alter"); console.writeline("age: " + isbn); console.readline(); but doesn't print out age (alter), how working print out age of each person, in case there more one. just quick search , you'll find plenty of resource read xml vi

Design - Breadcrumbs Javascript -

Design - Breadcrumbs Javascript - recently we've received design uses breadcrumbs, specifies breadcrumb page not exist. in effect, breadcrumb in question, relates section of top-level page. we're wondering if utilize of breadcrumbs not advisable or whether more mutual we're aware of. example: page 1 (main info page, contains 2-4 sections describing topics contained in sub-pages. each topic's text marked using html using h1 or h2). page 2 (is page list products related topics on page 1). the design this: page 1 > our top-level page. user presented 3-4 sets of products grouped hyperlinked topic text (as html h1's or h2's). when user clicks on topic taken page 2: breadcrumb new design specifies this: page 1 > topic text > page 2 and when user clicks topic text "breadcrumb", taken page 1, , css used highlight h1 or h2 topic text user clicked on. the above seems odd in "topic text" breadcrumb not relate page. beingnes

asp.net mvc - OnActionExecuting gets called when loading images on Firefox & IE but not on Chrome -

asp.net mvc - OnActionExecuting gets called when loading images on Firefox & IE but not on Chrome - i testing code in onactionexecuting action , noticed chrome acting differently firefox & ie. firefox & ie fires onactionexecuting action on images (maybe more?) , chrome not. i requested property: filtercontext.requestcontext.httpcontext.request.currentexecutionfilepathextension gives me extension of requested url. in case was: `".png" why isn't chrome firing action? note: (i have not tested further, stopped when noticed fires images. browsers tested ie & firefox) has asp.net mvc or browser? asp.net-mvc internet-explorer google-chrome firefox action-filter

sql - First active_record insert id is set to NULL automatically -

sql - First active_record insert id is set to NULL automatically - i have schema: create_table :tweets, id: false |t| # we'll utilize id store actual tweet id t.integer :id, null: false t.string :text t.datetime :created_at t.index :created_at end class tweet < activerecord::base end i'm trying utilize active_record, provide own id values on each insert. now when seek insert same thing twice, error first time, works after that: > tweet.create(id: 123, text: 'foo', created_at: time.now)) activerecord::statementinvalid: pg::notnullviolation: error : null value in column "id" violates not-null constraint detail: failing row contains (null, foo, 2014-10-06 15:45:46.149613). : insert "tweets" ("created_at", "text") values ($1, $2) /home/mapleoin/tweetwatch/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.6/l ib/active_record/connection_adapters/postgresql_adapter.rb:834

keyboard - How to prevent iOS Messages app from cropping pasted image? -

keyboard - How to prevent iOS Messages app from cropping pasted image? - i'm working on app lets people re-create , paste images. image copied this: nsstring *path = [[nsbundle mainbundle] pathforresource:@"circle" oftype:@"png"]; uipasteboard *pasteboard = [uipasteboard generalpasteboard]; nsdata *data = [nsdata datawithcontentsoffile:path]; [pasteboard setdata:data forpasteboardtype:@"public.png"]; when pasting in notes app, works fine. in messages app, crops right side of image. there way prevent this? you cannot prevent this, since apple's ui idea. although can set transparent borders image though messages.app clips image main part of still visible. ios keyboard sms copy-paste imessage

powershell - Using Import-CSV to make HTTP Request -

powershell - Using Import-CSV to make HTTP Request - wonder if can help. i'm trying utilize powershell import list of domains , generate http request each of them. i've got far: class="snippet-code-html lang-html prettyprint-override"> $csvfilename = "c:\sites\sites.csv" $csv = import-csv $csvfilename -header @("url") | foreach { $http_request = [system.net.webrequest]::create('$csv') $http_response = $http_request.getresponse() $http_status = [int]$http_response.statuscode if ($http_status -eq 200) { write-host "site ok!" } else { write-host "the site may down, please check!" } $http_response.close() } i'm not sure why 'create()' statement won't pick url. ideas? many thanks inside foreach loop, can access current element automatic variable $_ so replace line $http_request = [system.net.webrequest]::create('$csv') $

java - Wont display int declared in if statement -

java - Wont display int declared in if statement - package assignment_3_1; import java.util.scanner; public class assignment_3_1 { /** * @param args command line arguments */ public static void main(string[] args) { //create scanner scanner input = new scanner (system.in); //obtain bundle weight 1 system.out.print("enter bundle weight (in pounds): "); int packageweight1 = input.nextint(); double weightcalc1 = 5; double weightcalc2 = 15; double weightcalc3 = 34; double weightcalc4 = 45; double weightcalc5 = 60; double weightcalc6 = 60; double pricea = 12; double priceb = 14; double pricec = 17; double priced = 21; double pricee = 33; double pricef = 105; //if weightcalc1 >= packageweight1 base of operations charge 12 if (weightcalc1 >= packageweight1) { system.out.println("the base of operations charge : " + pricea); int baseprice = 12; }

json - Python dictionary giving weird results -

json - Python dictionary giving weird results - i trying generate inverted-index construction json response result. [{"node":[{"node": [{"node": [{"id": "w"}], "id": "q"}], "id":"e"},{"id":"r"},{"id":"t"}],"id":"y"}, {"id": "u"}] here sample json data, i'm trying maintain track of index of each 'id' object. illustration in given sample, object 'id' equal 'u' have index [1] , object 'id' equal 'q' have index [0[0[0]]]. resultant index representation here in form of array, [1] , [0,0,0] respectively. i have written code all. class="snippet-code-html lang-html prettyprint-override"> class tree: def __init__(self, data): self.data = info self.indices = {} self.create_index(self.data) def create_

javascript - Search a collection for a models that have an attribute like and search param -

javascript - Search a collection for a models that have an attribute like and search param - i wanting search collections models match closely user typing in search box, for illustration have 3 models in collection each model has it's own name attribute , named follows, 1) apples reddish 2) apples greenish 3) apples can yellow the users inputs search "apple" , @ moment, code homecoming nil not exact match using, var found_models = this.where({ "name" : filtervalue }); is there way homecoming models match string, search happens on every keyup. you have utilize _.filter in conjunction regexp: var found_models = this.filter(function(model) { homecoming /apple/i.test(model.get('name')); }); javascript backbone.js backbone-collections backbone-model

c# - How to send and receive raw JSON? -

c# - How to send and receive raw JSON? - i need help determining direction take this. need programme send fixed raw simple json formatted message server @ given ip , port needs hear response on given port , write out raw response console. i found few topics on doing json http requests don't think on right track. code trying adapt. public static void send_json() { httpwebrequest request = (httpwebrequest)httpwebrequest.create("http://10.211.55.5:7752"); request.contenttype = "application/json; charset=utf-8"; request.accept = "application/json"; request.method = "post"; using (streamwriter author = new streamwriter(request.getrequeststream())) { writer.write("{\"request\": \"get_menu\", \"checksum\": \"\", \"table_state\": {\"table_id\": \"1\", \"waiter_id\": \"1001\"}}"); } webresponse respo

php - Preg Match multiple br tags -

php - Preg Match multiple br tags - i have textarea users come in comments , using nl2br allow them add together spaces between blocks of text. replace occurrences 3 or more br tags appear in row , replace them single tag. one or 2 br tags don't replaced they're fine anymore more needs replaced single tag. this regular look have far $comment = preg_replace('/(<br \/>){3,}/', '<br />', $comment); $comment variable is one<br /> <br /> <br /> <br /> <br /> two<br /> <br /> <br /> <br /> <br /> three<br /> <br /> 4 changing regex $comment = preg_replace('/(<br \/>)/', '-', $comment); replaces br tags hyphens, seems it's {3,} i'm not sure. you can utilize next regular expression. since repeating tags on same line or separated newline sequence, need business relationship whitespace. $comment = preg_replace('~(

objective c - Need TabBarController to be right to left RTL -

objective c - Need TabBarController to be right to left RTL - am using tabbarcontroller in ios7 project , need tabbarcontroller rtl "more" button appear in left side of screen thought how accomplish you can set tab bar buttons in order. however, i'd review apple's human interaction guide may have that, more buttons found on far right & wouldn't want app rejected it. objective-c xcode cocoa-touch ios7 apple

vb.net - How to get each value in combobox dropdown list? -

vb.net - How to get each value in combobox dropdown list? - how each value in combobox dropdown list? here try each obj in cbcombobox.items messagebox.show(obj.tostring) next it showing combobox datasource object, not showing, in items is there class type extract? objectcollection . when add together things them there stored objects. cast obj it's type , proceed. for each obj in cbcombobox.items dim item = trycast(obj, {the object type or class}) if not item nil 'use item converted correctly end if next vb.net foreach combobox

Linux bash command that returns where two strings differ -

Linux bash command that returns where two strings differ - so, i've been googling around, , searching in more detail on stack overflow, can't seem find easy way of doing this: i want know in way 2 strings (without whitespace) differ, , print exact difference is. e.g.: input 1 > "chocolatecakeflavour" input 2 > "chocolateflavour" output: "cake" i've tried doing diff , dwdiff, cmp, , other known bash commands popped mind, couldn't exact result. any ideas? you can utilize diff fold , awk ths: s="chocolatecakeflavour" r="chocolateflavour" diff <(fold -w1 <<< "$s") <(fold -w1 <<< "$r") | awk '/[<>]/{printf $2}' cake fold -w1 split input string character character (one in each line) diff difference in both lists (1 char in each line) awk '/[<>]/{printf $2}' suppress < or > diff'e output , print in s

javascript - Karma "not found" in NetBeans after upgrading to Yosemite -

javascript - Karma "not found" in NetBeans after upgrading to Yosemite - i have war project in netbeans uses karma jasmine unit-test javascript files. platform mac os x. things worked should under mavericks, after upgraded yosemite, no longer works, error message : failed execute goal com.kelveden:maven-karma-plugin:1.8:start (default) on project insight-war: there error executing karma. cannot run programme "karma" (in directory "/users/thja/documents/projects/kpi2010_core/webgis/insight-war"): error=2, no such file or directory -> [help 1] it tries execute next command, printed in log: karma start /users/thja/documents/projects/kpi2010_core/webgis/insight-war/src/main/webapp/config/karma.conf.js --browsers phantomjs --reporters dots,junit --single-run --no-auto-watch --colors true i can run exact same command in terminal without problem - executes , give test results. which karma gives result /usr/local/bin/karma , , /usr/local/bin

Can I use jquery datapicker as a readonly calendar? not "picker" -

Can I use jquery datapicker as a readonly calendar? not "picker" - my requirement simple: have sharepoint list events list. want utilize jquery calendar show tooltip in highlighted day, when there event day. my intention not utilize in textbox input. read only. if possible, should alter in jquery calendar config? thx you can create inline datepicker :) class="snippet-code-js lang-js prettyprint-override"> $( "#datepicker" ).datepicker(); class="snippet-code-html lang-html prettyprint-override"> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script> <div id="datepicker"></div> jquery jquery-ui jquery-ui-datepicker

MySQL Triggers and Procedure -

MySQL Triggers and Procedure - i have 3 tables shown below: i have written mysql trigger phone call procedure alter delivery channel of mod whenever delivery channel of pac changes. there many many relationship between 2 have pac_mods table. trigger: delimiter $$ create trigger pac_delivery_channel_change_trigger after update on pacs each row begin if new.delivery_channel <> old.delivery_channel phone call updatemods(old.id, new.delivery_channel); end if; end; $$ and procedure: delimiter $$ create procedure updatemods(in pacid int, in newdeliverychannelid int) begin update mods md inner bring together pac_mods pmds on pmds.mod_id = md.id set md.delivery_channel = newdeliverychannelid pmds.pac_id = pacid; end; $$ there no errors when run statements in mysql not work. what doing wrong? thanks actually works, made stupid error , realized after had posted question. the error u

c# - Handling Button Clicks from a different Class -

c# - Handling Button Clicks from a different Class - i have form button buttongo. and have class takes button through constructor, handles events: public class handlingclass {//....... button go ; public handlingclass(button btn) { this.go = btn; this.go.click += new eventhandler(this.go_click); } //..... public void go_click(object sender, eventargs e) { //logic here } what doing wrong, , why isn't event beingness raised when press button in caller form? this code works me public class handlingclass { button go; public handlingclass(button btn) { go = btn; go.click += go_click; } void go_click(object sender, routedeventargs e) { throw new notimplementedexception(); } } and in loaded event of class having button add together below code void mainwindow_loaded(object sender, routedeventargs e) { handlingclass hc=new handlingclass(**mybutton**); }

javascript - Gmap4rails: infowindow render action from different controller -

javascript - Gmap4rails: infowindow render action from different controller - i have home.html.erb file displaying markers. markers correspond new sport created user. when marker clicked want display sport info (along other values). in main controller have associated show partial markers , pass required locales. @hash = gmaps4rails.build_markers(@game) |game, marker| marker.lat game.latitude marker.lng game.longitude marker.infowindow render_to_string(:partial => 'games/show', :layout => false, :locals => { :@game => @game }) end end in _show.html.erb file, trying display sport, associated game. <div class="row"> <aside class="span4"> <section> <p> <strong>sport:</strong> <%= @game.sport %> </p> </section> </aside> </div> i getting next error. undefined method `sport' #. how can displ

process - Program recognizes a copy of itself in the operating system -

process - Program recognizes a copy of itself in the operating system - i'm trying create piece of software not susceptible bots. there way me code programme way check in operating scheme process , set in shutdown mechanism if recognized. think of netflix if 1 tab in chrome running netflix, sec tab beingness opened display "oops" message. there not run on web browser? should looking into? thanks in advance there can plenty of solutions; first coming mind are: 1) programme checks existence of particular file; if files not found programme continue, otherwise programs know instance running , can terminate immediately. if file not found, programme creates , delete before exting. 2) can utilize operating scheme phone call or o.s. utility programme know if instance of programme running (e.g.: in linux, command ps) have fun process operating-system bots createprocess malware

PETSc - MatMultScale? Matrix X vector X scalar -

PETSc - MatMultScale? Matrix X vector X scalar - i'm using petsc , wanted like, i know can do: mat vec x,y matmult(a,x,y) vecscale(y,0.5) i curious if there function of these in 1 shot. seems save loop. matmultscale(a,x,0.5,y) does such function exist? this function (or close) not seems in list of functions operating on mat. brief reply question be...no. if utilize $y=\frac12 ax$, solution scale matrix 1 time all, using matscale(a,0.5); . would such function useful ? 1 way check utilize -log_summary alternative of petsc, profiling information. if matrix dense, see time spent in matmult() much larger time spent in vecscale() . question meaningful if sparce matrix handled, few non-null terms per line. here code test it, using 2xidentity matrix : static char help[] = "tests solving linear scheme on 0 0 matrix.\n\n"; #include <petscksp.h> #undef __funct__ #define __funct__ "main" int main(int argc,char **args) {

java - Why aren't my label and button showing up in my JFrame? -

java - Why aren't my label and button showing up in my JFrame? - i can not seem figure out life of me. excuse me if there redundant code kept trying , trying , couldn't figure out. jframe shows button , label not appearing. import javax.swing.*; import java.awt.event.*; import java.awt.*; public class ex03 { int w = 20; int h = 20; public ex03() { jframe fra = new jframe(""); fra.setbounds(10, 10, 200, 200); fra.setlayout(null); fra.setdefaultcloseoperation(jframe.exit_on_close); fra.setvisible(true); jpanel pan = new jpanel(); pan.setlayout(null); pan.setvisible(true); fra.getcontentpane().add(pan); jlabel lab = new jlabel(); lab.setbounds(10, 10, w, h); lab.setopaque(true); lab.setbackground(color.blue); lab.setvisible(true); jbutton = new jbutton("play"); but.setbounds(10, 10, 100,

python - Transform slow pandas iterrows into apply -

python - Transform slow pandas iterrows into apply - i have next dataframe: value count recl_2007 recl_2008 recl_2009 a_a a_b a_c b_a b_b \ 0 189 149.5872 503 503 500 0 0 0 0 0 1 209 1939.6160 503 503 503 0 0 0 0 0 2 499 617.4784 503 500 503 0 0 0 0 0 3 585 73.0688 503 503 503 0 0 0 0 0 4 611 133.9072 503 500 503 0 0 0 0 0 5 645 278.7904 503 503 503 0 0 0 0 0 6 659 138.2976 500 503 503 0 0 0 0 0 7 719 769.5744 503 503 502 0 0 0 0 0 b_c c_a c_b c_c 0 0 0 0 0 1 0 0 0 0 2 0 0 0 0 3 0 0 0 0 4 0 0 0 0 5 0 0 0 0 6 0 0 0

html - Unable to show/hide a button element in jquery -

html - Unable to show/hide a button element in jquery - i have next html , css. , in css i'm setting display:none button. form beingness shared across other pages i'd show button on pages using jquery. attempted using $(".ui-multiselect.ui-widget.ui-state-default.ui-corner-all").show() didnt work. can please tell me if i'm doing wrong here. class="snippet-code-js lang-js prettyprint-override"> $(document).ready(function() { $(".ui-multiselect.ui-widget.ui-state-default.ui-corner-all").show(); }); class="snippet-code-css lang-css prettyprint-override"> #usersearchform .ui-multiselect { position: absolute; right: 31px; top: 26px; z-index: 100; } #usersearchform .ui-multiselect { display: none; } #usersearchform button { float: right; margin-right: 13px; } class="snippet-code-html lang-html prettyprint-override"> <form method="post"

php - Why is it not inserting to the database? -

php - Why is it not inserting to the database? - <?php if(!isset($_get['nick'])) { echo '<form action="ban.php" method="get"> <input placeholder="username" type="text" name="nick"/> <input placeholder="reason" type="text" name="reason"/> <input type="submit" value"ban!"/>'; } else { $nick = mysql_real_escape_string($_get['nick']); $reason = mysql_real_escape_string($_get['reason']); $query = mysql_query("select name users name='".$nick."'"); if (mysql_num_rows($query) != 0) {

ios - iPhone 4S - UnAuthorized Access Exception -

ios - iPhone 4S - UnAuthorized Access Exception - this question sure xcode developers answer. have screenshot of code below in xamarin. why getting unauthorized access exception? should able write documents folder right? var webclient = new webclient(); //var documentsfolder = environment.getfolderpath (environment.specialfolder.personal); // ios 7 , before var documentsfolder = nsbundle.mainbundle.bundlepath; var filenameandpath = path.combine (documentsfolder, "verses.xml"); if(!file.exists(documentsfolder)){ directory.createdirectory(documentsfolder); if(!file.exists(filenameandpath)){ //file.setattributes(filenameandpath, fileattributes.normal); file.create(filenameandpath); //throws exception here. } } and errors: access path "/var/mobile/applications/1f95d694-bba5-4fb3-ae6c-0c2cdd9dedd8/comexample.app/verses.xml" de

java - Always Getting a "FALSE" -

java - Always Getting a "FALSE" - i'm making quiz program. first step, i'm taking quiz questions , right answers teacher/ user. have kid class named truefalsequestion takes boolean model reply , string question parameter. i've made array of truefalsequestion type , i'm stuck @ part run code, insert question , no matter whether model reply i've inserted true or false, it's stored false when print out. help? here's part of code: system.out.println("how many true or false questions include in quiz?"); int l=s.nextint(); truefalsequestion[] qu2= new truefalsequestion[l]; int x; for(x=0;x<l;x++){ system.out.println("please insert question "+(x+1)+":\n"); string q2=s.next(); system.out.println("please insert right answer"); boolean a2=s.nextboolean(); qu2[x]=new truefalsequestion(q2,a2); system.out.println(qu2[x].getcorrectanswer())

Convert json file to R object in R -

Convert json file to R object in R - i trying convert json file in r. format of info follows: { "id": "xyz", "root": { "author": { "name": "xyz", "email": "xyx@xyz.org", "date": "2014-10-08t00:10:30z" }, "authorer": { "name": "xyz", "email": "xyx@xyz.org", "date": "2014-10-08t00:11:30z" }, "message": "this test json", "root": { "id": "xyz1", "url": "xyz" }, "url": "xyz", "message_count": 0 }, "url": "xyz", "html_url": "xyz", "comments_url": "abc", "author": null, "authorer": null, "parent": [ { "id": "xyz3", "url": "xyz", "html_url": "xyz" } ] } after similar

ConfirmationActivity Android Wear last for too short -

ConfirmationActivity Android Wear last for too short - i have wear activity has button. when clicked method below run: public void success(view view) { intent intent = new intent(this, confirmationactivity.class); intent.putextra(confirmationactivity.extra_animation_type, confirmationactivity.success_animation); intent.putextra(confirmationactivity.extra_message, "success!"); startactivity(intent); finish(); } the confirmation animation shows few seconds. when include finish() line close current activity lastly shorter... ideas on how show confirmation more time? or other way finish current activity allow confirmation lastly longer? thanks! the confirmation animation handled os, dont think can alter duration. inside confirmationactivity class, there private fellow member variable private static final long success_message_delay_ms = 50l; variable private final, can not change. also, vari

php - codeigniter extend database driver call to undefined method my_db_mysql_driver::select() -

php - codeigniter extend database driver call to undefined method my_db_mysql_driver::select() - in codeigniter, need custom active record class can grouping clauses. upon stumbling found this , tutorial on how extend mysql driver. upon doing so, receive error of fatal error: phone call undefined method my_db_mysql_driver::select() . have followed steps stated on tutorial still no luck. here's sql statement: $this->db->select('post_id, post_title'); $this->db->from('articles'); $this->db->where($sqlparams); $this->db->open_bracket(); $this->db->or_like($sqllikeparams); $this->db->close_bracket(); your custom active record class must extends ci_model class active_record extends ci_model { function __construct() { parent::__construct(); } function your_function() { /* code here*/ $this->db->select('post_id, post_title'); $this->db->from('articles');

ios - How to get requested image size for iOS8 PhotoKit? -

ios - How to get requested image size for iOS8 PhotoKit? - i using code below fetching image: [[phimagemanager defaultmanager] requestimageforasset:asset targetsize:cgsizemake(800, 600) contentmode:phimagecontentmodeaspectfill options:options resulthandler:^(uiimage *result, nsdictionary *info) { nslog(@"size:%@",nsstringfromcgsize(result.size)); }]; i'm requesting image size of 800 x 600, i'm getting image size of 45 x 60, poor-quality. how can requested image size using photokit ? your (unnati's) self reply work, misses out on number of optimisations apple give in framework images display more quickly. your original code pretty much correct, include options object don't need, , may have been causing problems if had set resizemode incorrectly on it. here code should work you, i've removed options object. [[phimagemanager defaultmanager] requestimageforasset:(phasset *)asset targetsize:cgsizemake(800, 6

c - Program stops running on terminal but process persists -

c - Program stops running on terminal but process persists - when programme reaches end, prints out "sleep x seconds" executes sleep(x). however, after print happens, programme not hang @ , exits. using ps can see process still running in background (though may kid zombie). very basic hierarchy of code: main -> func1 -> fork multiple func2, set alarm() -(alarm goes off)> func3 using printf , fflush, func2 never gets entered it's called in func1 after successful kid process spawned. i've tried using gdb appears mess when start using shared memory between parent/child fork(). there's on 1000 lines of code, posting rather much. question: thought on how debug or have thought of may cause this? note: calls exit() coupled perror() before. the issue wrong access shared memory. abruptly stopped programme without errors. c gdb fork

java - SQL statement to concat strings in MySQL and SQL Server -

java - SQL statement to concat strings in MySQL and SQL Server - i worked on hibernate.below code worked fine in mssql gives error in mysql code: criteria criteria = session.createcriteria(table1.class); criteria.add(restrictions.sqlrestriction("(select this11_.um_email y0_ table2 this11_ this11_.id='"+idvalue+"') '%'+this_.post_id+'%'")); stacktrace : you have error in sql syntax; check manual corresponds mysql server version right syntax utilize near '+this_.post_id+'%'' @ line 1 org.hibernate.exception.sqlgrammarexception: not execute query @ org.hibernate.exception.sqlstateconverter.convert(sqlstateconverter.java:67) @ org.hibernate.exception.jdbcexceptionhelper.convert(jdbcexceptionhelper.java:43) @ org.hibernate.loader.loader.dolist(loader.java:2223) @ org.hibernate.loader.loader.listignorequerycache(loader.java:2104) @ org.hibernate.loader.loader.list(loader.java:2099) @ org.hibernate.loader.crite

angularjs - $http.then callback not being called -

angularjs - $http.then callback not being called - i have $http.post phone call callback function not called. have exact same code phone call , 1 works. can see issues next code. var info = {entityids: $scope.allentityids, accountids: $scope.accountids}; $http.post("http://localhost:8080/psi4web/rest/social/posts", data, {params: {filter: $scope.filters, pagenum: $scope.pagenum, pagesize: $scope.pagesize}}) .then(function(res) {$log.info("test me")}, onerror); for debugging purposes, added inline function within then() shown above , doesnt work either. made sure info beingness returned backend. thanks. just few minor details keeping having success. corrected code below. var info = {entityids: $scope.allentityids, accountids: $scope.accountids}; var mypost = $http.post("http://localhost:8080/psi4web/rest/social/posts", data, {params: {filter: $scope.filters,

c# - Different levels of access to methods -

c# - Different levels of access to methods - situation: i'm creating 2 libraries: x1.dll , x2.dll. created , amended separately , projects couldn't combined 1 solution. x1.dll contains definition of class c1. x2.dll contains definition of class c2. x2.dll references x1.dll. class c1 has method m1(). method used in x2.dll , reason why m1() made public method. i distribute x1.dll , x2.dll other developers. not want them phone call m1() - can whatever want c1 instances, not touch m1(). @ same time, m1() public because have able phone call in x2.dll. question: what best way organize m1() in order create available me still not merge projects x1.dll , x2.dll? there plenty of awkward solutions making m1() m1(string secretecode) , hardcode secretecode i'm 1 can pass right argument. but best practice accomplish goal? thanks suggestions! make m1() internal , add together internalsvisibletoattribute on assembly allow x2.dll phone call x1.d

ruby on rails - What is wrong with my && operator? -

ruby on rails - What is wrong with my && operator? - i know why outputting false when input 1982 . there wrong && statement? tried using !(t==r) , didn't work; reason, keeps outputting false . def no_repeats?(year) out=true t=0 while t<4 r=0 while r<4 if (year[t] == year[r]) && t != r out=false end r+=1 end t+=1 end out end you're complicating bit more needs be. 2.2.0-preview1 :001 > load 'no_repeat.rb' => true testing string 2.2.0-preview1 :002 > no_repeats?("1981") => false 2.2.0-preview1 :003 > no_repeats?("1983") => true testing integer 2.2.0-preview1 :004 > no_repeats?(1981) => false 2.2.0-preview1 :005 > no_repeats?(1983) => true and no_repeat.rb looks like def no_repeats?(year) digits = year.to_s.split(//) digits.size == digits.uniq.size end edit: ben

ios - NSString boundingRect with image glyphs included within UILabel -

ios - NSString boundingRect with image glyphs included within UILabel - i'm attempting determine appropriate height uilabel need when constrained max width nsattributedstring label. the problem i'm running height calculation off when include little image @ end of uilabel. here i'm doing. @property (nonatomic, weak) iboutlet uilabel *fullname; // append first , lastly name nsmutableattributedstring *fullname = [[nsmutableattributedstring alloc] initwithstring:[nsstring stringwithformat:@"%@ %@", firstname, lastname] attributes:@{ nsfontattributename : [uifont systemfontofsize:16], nsforegroundcolorattributename : fontcolor }]; // append image nstextattachment *textattachment = [[nstextattachment alloc] init]; textattachment.image = [uiimage imagenamed:@"starimage"]; nsattributedstring *attrstringwithimage = [nsattributedstring attributedstringwithattachment:textattachment]; [fullname appendattributedstring:attrstringwithimage]; // set

apache karaf - Jersey Client (JAX-RS 2) not working in OSGI -

apache karaf - Jersey Client (JAX-RS 2) not working in OSGI - i attempting install , utilize bailiwick of jersey 2 in karaf version 3. features.xml (provisioning) contains next dependencies: class="lang-java prettyprint-override"> <bundle>mvn:javax.ws.rs/javax.ws.rs-api/2.0.1</bundle> <bundle>mvn:org.glassfish.hk2/hk2-locator/2.3.0</bundle> <bundle>mvn:org.glassfish.hk2/osgi-resource-locator/1.0.1</bundle> <bundle>mvn:org.glassfish.jersey.core/jersey-common/2.12</bundle> <bundle>mvn:org.glassfish.jersey.bundles.repackaged/jersey-guava/2.12</bundle> <bundle>mvn:org.glassfish.hk2/hk2-utils/2.3.0</bundle> <bundle>mvn:org.glassfish.hk2/hk2-api/2.3.0-b10</bundle> <bundle>mvn:org.glassfish.hk2.external/javax.inject/2.3.0-b10</bundle> <bundle>mvn:org.glassfish.jersey.core/jersey-client/2.12</bundle> my code outside of

google app engine - Objectify does not fetch by String ID -

google app engine - Objectify does not fetch by String ID - i have datastore kind in id field string ofy().load().type( scores.class ).id( playername ).now(); this fetches null. have confirmed entity given playername exists. not happen kind id long. code scores class import com.googlecode.objectify.key; import com.googlecode.objectify.annotation.entity; import com.googlecode.objectify.annotation.id; import com.googlecode.objectify.annotation.parent; @entity public class scores { @parent public key<rankerroot> parentkey; @id public string playername; public int value; } you need sure giving objectify plenty info build entity's key. so, if entity has ancestor , id/name lone insufficient. if entity has ancestor, can build key , load entity key, this: key<scores> scorekey = key.create(parentkey, scores.class, playername); ofy().load().key(scorekey).now(); google-app-engine gae-datastore objectify

android - App crashes onResume when canceling Notification -

android - App crashes onResume when canceling Notification - i seek cancel notification in onresume() crashes: with displaynotification() create notification. tried set cancelnotification() in seek catch. doesn't solve problem. without can't start app generate notification. here codesnippets: onresume: @override protected void onresume() //activity resumed , visible 1 time again { log.d(logtag,"onresume() called"); super.onresume(); cancelnotification(); } cancelnotification(): protected void cancelnotification() { log.i("cancel", "notification"); mnotificationmanager.cancel(1); } displaynotification(): protected void displaynotification(string message, string ticker) { log.i("start", "notification"); /* invoking default notification service */ notificationcompat.builder mbuilder = new notificationc

asp.net mvc 2 - Default ModelBinding converts int field to 0 every time -

asp.net mvc 2 - Default ModelBinding converts int field to 0 every time - i have model looks this: [serializable] public class question : ratingitem, iquestion, ixmlserializable { // ... public int textrows { get; set; } and when send controller via post, fiddler captured this: ...question.textrows=44... but on first line in controller break point says value 0. [httppost] [requiresresource(securityconstants.individualoverview_configuration, eactions.addnew | eactions.update)] public actionresult save(int documentid, string evaluationvariablename, question question) { // question.textrows 0 here ... any guesses going on? i inherited code, don't see custom model binders adjusting things. what's weirder other properties percolate controller fine. well, it's hard without seeing view, binding errors universally related bad field names in form. example, based on code you've shown, shouldn't have field named question.

c# - How to intercept a Url to dynamically change the routing -

c# - How to intercept a Url to dynamically change the routing - i looking like: for categories controller categorycontroller www.mysite.com/some-category www.mysite.com/some-category/sub-category www.mysite.com/some-category/sub-category/another //this go on .. the problem that: www.mysite.com/some-product needs point productcontroller . map same controller. so, how can intercept routing can check if parameter category or product , route accordingly. i trying avoid having www.mysite.com/category/some-category or www.mysite.com/product/some-product sense perform improve on seo side. when can intercept routing, i'll forwards product / category based on rules @ slugs each etc. you write custom route serve purpose: public class categoriesroute: route { public categoriesroute() : base("{*categories}", new mvcroutehandler()) { } public override routedata getroutedata(httpcontextbase httpcontext) { var rd = ba

regex - Add/Insert lines before pattern such that lines to be added have part of the pattern in uppercase -

regex - Add/Insert lines before pattern such that lines to be added have part of the pattern in uppercase - i have add together compiler directives before class declaration : `ifndef mipi_rffe_scoreboard__sv `define mipi_rffe_scoreboard__sv class mipi_rffe_scoreboard extends uvm_scoreboard; i tried : sed 's/class (\w+)(.*)/\`ifndef \u\1__sv\2/' mipi_rffe_scoreboard.sv which gives : sed: -e look #1, char 38: invalid reference \2 on `s' command's rhs i have seen using sed, insert line below (or above) pattern?. here kamal's reply solves part of problem need capture "mipi_rffe_scoreboard" , alter uppercase you run perl one-liner on file: perl -pe 's/(class (\w+))/`ifndef \u$2\e__sv\n`define \u$2\e__sv\n\n$1/' it captures lines containing "class" followed word , prepends 2 lines. \u used transform match uppercase , \e end transformation. testing out: $ perl -pe 's/(class (\w+))/`ifndef \u$2

loops - Python Program to replace spaces with tabs, tabs with spaces, etc. Having problems -

loops - Python Program to replace spaces with tabs, tabs with spaces, etc. Having problems - i'm having problems creating code program. here's outline of code supposed in end, i'm coding 1 function @ time not confuse myself further. (get_input) should not changed it's necessary program. program outline: - programme unix style command line, using qualifiers -t or +t phone call functions 1) alter tabs in indenting spaces 2) alter spaces in indenting tabs 3) substitute spaces, tabs, , newlines printable characters 4) undo 3 functions not used @ same time using command line qualifiers allow user specify functions use using (-) sign introduce short qualifier i working on 1 function of i'm having troubles getting read entire file provided. entire code of programme this: #name: nathan geist #id #: 10152796 #tut: 06 #assignment 3 #code editing program: # 1) alter tabs in indenting spaces # 2) alter spaces in indenting tabs # 3) substit

opengl - Why doesn't this viewing/projection transform work? -

opengl - Why doesn't this viewing/projection transform work? - i'm trying understand opengl's basic matrix transformation logic better. 2d code copied textbook , modified handle 3d; "sort of works", final result visually different when matrix multiplication myself vs. using glmultmatrix. the lines marked 'xxx' allow flipping between 'my multiplication' , 'opengl multiplication'. tried obvious things (eg. row vs. column major, order of transforms, etc.) if can illuminate me i'm doing wrong compared opengl, i'd appreciate it. #include <iostream> #include <math.h> #include "glut.h" #include "vector3.h" typedef glfloat matrix4x4[4][4]; matrix4x4 matcomposite; void matrix4x4setidentity(matrix4x4 matident4x4){ glint row, col; for(row = 0; row<4; row++){ for(col = 0; col<4; col++){ matident4x4[row][col] = (row == col); } } } void matrix4x4premulti

Maven checkstyle not running as part of build -

Maven checkstyle not running as part of build - i'm totally lost why not. construction this: using mvn checkstyle:check creates reports (i have identical settings in reporting section) build treats plugin doesn't exist. if alter checkstyle version, doesn't download it, etc. treats config invisible. <build> <pluginmanagement> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-checkstyle-plugin</artifactid> <version>2.13</version> <configuration> <configlocation>checkstyle.xml</configlocation> <suppressionslocation>checkstyle-suppressions.xml</suppressionslocation> <maxallowedviolations>2500</maxallowedviolations> <consoleoutput>true</consoleoutput> <failsone

objective c - IOS Checking Active internet connection even connected via WIFI without internet -

objective c - IOS Checking Active internet connection even connected via WIFI without internet - please help me out how check net connection in iphone. i tried checking apple's reachability framework, not returning if connected via wifi without internet. what getting reachable via wifi. the other alternative tried making synchronous request google.com etc , checking response code. is there other way check can avoid making url request , checking response code. thanks in advance. check if wifi reachable (using apple's reachability), , create request ensure host reachable. // wifi checking code here //... [[[nsurlsession sharedsession] datataskwithurl:[nsurl urlwithstring:@"http://yourserver.com/somelightfile.html"] completionhandler:^(nsdata *data, nsurlresponse *response, nserror *error) { if (!error) { // host reachable } }] resume]; ios objective-c iphone ios7

Can I use the javascript interpreter inside Firefox as a js shell? -

Can I use the javascript interpreter inside Firefox as a js shell? - i start coding js writing more evolved versions of bash scripts, hence take actions download package, unpack it, move between folders, execute shell/system commands, etc etc ... . now utilize integrated shell interpreter within firefox without dom related features , should "dry" possible can standard js shell , more simple set of apis. someone knows if can ? there's rhino , spidermonkey both related mozilla js engine. list of other js shells here include things node (based on chrome v8 engine). i'm using node because level of 3rd party back upwards node modules seems have taken off in lastly couple years , can utilize web server development if take , runs on many platforms. javascript shell firefox

Errors: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression -

Errors: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression - the code not allowing me log in database: bundle business; import java.io.serializable; import java.sql.*; public class pupil implements serializable { private int id; private string password; private string firstname; private string lastname; private string street; private string city; private string state; private double zip; private string email; private double gpa; private string message; /** * no arg constructor sets default value of * client properties empty string value. */ public student() { this.id = 0; this.password = ""; this.firstname = ""; this.lastname = ""; this.street = ""; this.city = ""; this.state = ""; this.zip = 0; this.email = &quo