Posts

Showing posts from May, 2010

.net - Compare two ArrayLists -

i trying compare 2 arraylist s without success. what have this: dim array_1 new arraylist() dim array_2 new arraylist() dim final_array new arraylist() in array_1 , array_2 have: array_1({10, 20}, {11, 25}, {12, 10}) array_2({10, 10}, {11, 20}) and in final_array want get: array_1(1) - array_2(1) to this: final_array({10, 10}, {11, 5}, {12, 10} how can create code correctly? here attempt: for each element in array_1 each element_2 in array_2 if element(0) = element_2(0) final_array.add({element(0), element(1) - element_2(1)}) else final_array.add({element(0), element(1)}) end if next next this code not want. you should not join 2 arrays that. basically, each element in first array, iterate whole second array. so, in pseudo-code (sorry, vb skills awful) should this: let end = min(array1.lenght, array2.length) = 0 end if array1[i].first = array2[i].first final_array[i] = {array1[i].firs...

wpf - VirtualizingStackPanel not aligning menu items vertical on applying theme -

before applying wpf theme - bureaublue.xaml theme, can see menu items aligning vertically below code: <menu.itemspanel> <itemspaneltemplate> <virtualizingstackpanel orientation="vertical"/> </itemspaneltemplate> </menu.itemspanel> but same logic aligning menu items horizontally once apply theme. could please assist me in resolving this? i able solve problem. i supposed use virtualizingstackpanel display menu items vertically. in theme style menu, stackpanel orientation coded horizontal. i copied code theme xaml , created new style change orientation horizontal vertical. for menu, have applied new style dynamicresource. it worked. thanks...

alarmmanager - set repeated alarm manager for every hour in android -

i want fetch location every hours in android . use alarm manager , set repeated alarm every hour , want write file after fix time i.e @ 8 , 12 pm . got problem in setting alarm manager , while set every 1 hour execute in 1/2 hour . on button click start service : servicebutton.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { intent myintent = new intent(automainactivity.this, trackerservice.class); pendingintent = pendingintent.getservice(automainactivity.this, 0, myintent, 0); alarmmanager alarmmanager = (alarmmanager)getsystemservice(alarm_service); alarmmanager.setinexactrepeating(alarmmanager.elapsed_realtime_wakeup, alarm_trigger_at_time, 3600000, pendingintent); //3600000 1hrs finish(); } }); and service class : tracker service.class string final_string; sharedpreferences pref; static final int start_tim...

java - make jackson serialize set as list -

on server side use hibernate retrieve data set , don't want use list on server side. i'm using @orderby annotation, sets ordered on server. however, when send data browser, , parse json sets become unordered in javascript. can somehow configure jackson objectmapper, or use annotation serialize sets lists ? it needs change {} [] in i know can create dto, that's lot of boilerplate. is there flag or annotation trigger such behaviour? edit: let's i've got: {"a","b","c","d"} on server side produced code, , that's sent browser. browser receive same content, when evaluate (eval(...)), browser don't treat string, map. and when iterate map it's unordered. if browser receive array, is: ["a","b","c","d"] after evaluation in browser still sorted; i want jackson use [] instead of {} sets. hope i'm more clear now please provide code , object ...

java - Most efficient way to read characters from a file? -

while practising file i/o in java, came across assignment has rewrite method looks recorddata associated given record id. now, method i'm talking using filereader wrapped in bufferedreader in order read characters. oddly enough, assignment suggests using bufferedstreamreader(?) might not efficient way of retrieving characters file. find more confusing considering method contains bufferedreader instead of bufferedstreamreader. so question is, isn't using bufferedreader wrapper filereader efficient (in terms of speed) way read characters in file? edit: assignment talks of bufferedstreamreader, not bufferedinputstream i haven't come accross bufferedstreamreader read characters using bufferedreader first string , character character if talking about. fileinputstream fs = new fileinputstream(filename); bufferedreader br = new bufferedreader(new inputstreamreader(fs)); (int j = 0; j < 0; j++) {//the first line ...

c# - How can i print (on new window) two specific panel ID -

i want open new window , contain both panel print as... hi, how u? fine..!! i use script print in head part <head> <scripttype="text/javascript"> functionprintpanel() { var panel = document.getelementbyid("<%=pa1.clientid%>"); varprintwindow = window.open('', '', 'height=400,width=800'); printwindow.document.write('<html><head><title>div contents</title>'); printwindow.document.write('</head><body >'); printwindow.document.write(panel.innerhtml); printwindow.document.write('</body></html>'); printwindow.document.close(); settimeout(function () { printwindow.print(); }, 500); returnfalse; } </script> </head> in body part have <body> <asp:imagebuttonid="print_btn"runat="server" imageurl="~/images/awards2.jpg"onclientclick="return printpanel();"height="50"w...

java - Android - Autostart app and restrict access to other apps -

i'm new in android development , have app i'm working on kids. app start when device starts up. when app running, want prevent access other screens. disable home buttons, prevent access browser, settings etc. is possible do? stumbled across link http://www.androidsnippets.com/autostart-an-application-at-bootup , few people think it's not approach allow activities start automatically. thank :-) sounds need own launcher, because launcher can prevent access unnecessary screens , home button "blocked" launcher. solve "start-up" problem. all need declare activity in androidmanifest this: <activity android:name="your.package.activityname android:launchmode="singletask"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> <category android:name="android.intent.category.home" /> <categ...

java - How to create new application for nokia 6212 -

i try run p2p nfc project in nokia 6212 emulator. application not showing on emulator screen. so, question is possible create application nokia6212. if kindly inform me steps. actually, m running p2p java projects in eclipse. please me thanks the answer: yes. take @ example . all needed steps, including code examples, getting started, tutorials, etc.. here .

javascript - Add a link to another page with d3.js -

this straight forward. i'm looking add link page. i'm trying add through d3. add attribute in js? iv tried .attr("src", "newpage.html") , .attr("url", "newpage.html") neither work. any advice appreciated. thanks. //js var newlink = d3.select(".chart") .append("div") .html("trend graph") .attr("class", "populationtrend") //css .populationtrend{ font-weight:400; margin-top:-15%; cursor:pointer; padding-left:70%; background-color:#039; } to add "normal" link (i.e. anchor tag), can do d3.select(".chart") .append("a") .attr("href", "newpage.html") .html("new page"); or even d3.select(".chart") .append("div") .html("<a href='newpage.html'>new page</a>");

REGEX, best way to learn it -

i'm searching best book or tuts, recommendations , way earn concise knoledge on regular expression (regex) i'll happy try suggestions, thank you my answer got closed! "we expect answers supported facts, references, or specific expertise" what if stanford professor or teacher has "specific expertise" recommend me way learn "supporting" answer on many years teaching , conversation other colleagues , "references" ? i'll rephrase: i'm searching best book or tuts, recommendations , way earn concise knowledge on regular expression (regex). i happy try answers i'll assume supported facts, references, or specific expertise. thank mastering regular expressions canonical text. how learned regular expressions , changed [programming] life. when need reference, regular-expressions.info invaluable resource. finally, when trying work out regular expression, use online tool tailored "flavor" of reg...

java - log4j with oracle gives exception- invalid sql statement -

i try implement log4j logging in database example page, http://www.tutorialspoint.com/log4j/log4j_logging_database.htm i edit xml like <appender name="db" class="org.apache.log4j.jdbc.jdbcappender"> <param name="url" value="jdbc:oracle:thin:@ip:port:dbname"/> <param name="driver" value="oracle.jdbc.oracledriver"/> <param name="user" value="user"/> <param name="password" value="pass"/> <param name="sql" value="insert flow_path_logs values('%x', '%d','%c','%p','%m')"/> <layout class="org.apache.log4j.patternlayout"> </layout> </appender> but gives sql exception, invalid sql statement. try replace statement select 1 dual gives same exception. stack trace: log4j:error failed excute sql java.sql.sqlsyntax...

jsp - jQuery datepicker works but Spring controller gets null date -

i know should quite simple don't see problem. have these 2 jquery datepickers: <script> $(function() { $( "#inidate" ).datepicker({ dateformat: "dd-mm-yy", firstday: 1, changeyear: true }); $( "#enddate" ).datepicker({ dateformat: "dd-mm-yy", firstday: 1, changeyear: true }); }); </script> and jsp: <form:form method="post" action="result" commandname="mainform"> <p>fecha inicio: <input type="text" id="inidate" path="inidate"/></p> <p>fecha fin: <input type="text" id="enddate" path="enddate"/></p> <p class="submit"><input type="submit" name="commit" value="go"></p> </form:form> when click on text box , select date, copied in field, when submit form "...

groovy - classloader issues with hibernate and groovyConsole -

i trying example code using hibernate in groovy here: http://groovy.codehaus.org/using+hibernate+with+groovy it works fine when run via groovy, when run groovyconsole getting classloader issue: org.hibernate.queryexception: classnotfoundexception: org.hibernate.hql.ast.hqltoken a little googling suggest me issue hibernate , antlr coming different classloaders, if case, isn't clear me how might work around issue , still use grape dependencies. (i have several developers productive console, , avoid retooling.)

resources - Maximum instructions per CUDA kernel? Maximum operations per CUDA stream? -

is there maximum number of cuda operations may pending specific cuda stream? haven't seen such limit in documentation. i interested in related figure of maximum number of instructions per cuda kernel. there maximum number of cuda ptx instructions per kernel: 2 million gpus compute capability under 2.0 (i.e. before fermi microarchitecture) 512 million gpus compute capability 2.0 or higher (e.g. fermi, kepler, maxwell, ...) this information can found in cuda c programming guide , "maximum number of instructions per kernel". as streams, if kernels run on given stream respect limit, there no such stream instruction limit. @talonmies pointed out, streams host side queue of operations, have nothing loading code onto gpu.

google app engine - GWT/GAE 1MB .cache.js file is not gzip compressed -

i'm using gwt's splitting method split code multiple fragments. app served google app engine server , uses gzip compression send fragments. problem 1 of fragments (left-over) of 1.1 mb (32.cache.js) not being compressed. used chrome's dev tools (network) , noticed fragments compressed (24.cache.js ex.) have header "content-encoding:gzip" in "response headers" , 1.1 mb file doesn't. why isn't file compressed? can bug ? or have make special settings gwt compiler or app engine server maybe?

iphone - Access Boolean Value form Sqlite database -

i newly add column 1 of data base table using following query. alter table 'user' add column 'ismarried' bool default 'false'; once database update done user 'jhon' has ismarried status 'true' in database. and write sql query using objective c retrieve jhon's married status bellow. bool married = [results boolforcolumn:@"ismarried"]; my problem boolean varible 'married' return false; then add follwing line code check whether correctness nsstring *strmarried = [results stringforcolumn:@"ispwdprotected"]; then strmarried return 'true' jhon. can 1 tell me how retrive boolean value using boolforcolumn method bool isn't supported in sqlite, have stick integers (0 , 1) represent false , true respectively. more info on here: is there boolean literal in sqlite? i'm not in front of mac can't test imagine following want want: alter table 'user' add column 'isma...

verilog - What are common suffix and prefix code guidelines? -

what commonly used suffixes , prefixes used in systemverilog code? i'm referring code guidelines systemverilog elements such variables, parameters, classes, etc. here few i'm aware of: prefix: m_ - member (of class) cg_ - covergroup name suffix: _if - interface _t - typedef _s - struct _u - union _e - enum _h - variable name reference (handle) class _pkg - package _c - class or constraint (pick 1 , go it) _cb - clocking _mp - modport _cg - covergroup (this 1 prefix or suffix) parameters constants in other languages should kept uppercase. else lower case. use _ delimiter, avoid camelcase. for rtl suffix, _n active low signals. _a asynchronous signals. rst_an implies active low asynchronous reset. these commonest ones have come across, in interest of creating best answer include in others if or edit answer add more.

javascript - Trying to implement a simple responsive progress bar with issues -

i've followed instructions site obtained information off , i'm stuck. code follows: html <div class="progress-wrap progress" data-progress-percent="25"> <div class="progress-bar progress"></div> </div> the css code .progress { width: 100%; height: 50px; } .progress-wrap { background: #f80; margin: 20px 0; overflow: hidden; position: relative; } .progress-bar { background: #ddd; left: 0; position: absolute; top: 0; } and js // on page load... moveprogressbar(); // on browser resize... $(window).resize(function() { moveprogressbar(); }); // signature progress function moveprogressbar() { console.log("moveprogressbar"); var getpercent = ($('.progress-wrap').data('progress-percent') / 100); var getprogresswrapwidth = $('.progress-wrap').width(); var progresstotal = getpercent * getprogresswrapwidth; var anima...

selection - Selecting text with Sublime Text 2 -

i have been using evaluation copy of sublime text 2. quite recently, have noticed have been unable drag , select text mouse (with text being highlighted select it), or click in different part of document change position of cursor. i reduced using humble arrow keys on keyboard move around document. is normal feature of sublime text 2? tried uninstalling , reinstalling programme, , still no change. or have upgrade full licenced copy (which have been planning do.) any appreciated! kind regards, robert london, united kingdom i experienced same issue earlier today. solution remove sublime text app data folder. on windows 8 machine folder located at: c:\users[user_name]\appdata\roaming\sublime text 2 hope helps! best, mike

sql - Subtract values from line above the current line in MySQL -

i've following table: | id | name | date of birth | date of death | result | | 1 | john | 3546565 | 3548987 | | | 2 | mary | 5233654 | 5265458 | | | 3 | lewis| 6546876 | 6548752 | | | 4 | mark | 6546546 | 6767767 | | | 5 | steve| 6546877 | 6548798 | | and need whole table: result = 1, if( current_row(date of birth) - row_above_current_row(date of death))>x else 0 to make things easier, guess, created same table above 2 id fields: id_minus_one , id_plus_one like this: | id | id_minus_one | id_plus_one |name | date_of_birth | date_of_death | result | | 1 | 0 | 2 |john | 3546565 | 3548987 | | | 2 | 1 | 3 |mary | 5233654 | 5265458 | | | 3 | 2 | 4 |lewis| 6546876 | 6548752 | | | 4 | 3 | 5 |mark | 6546546 | 6767767 |...

javascript - Google Maps Cache Custom Map Images -

i have made custom map using google map api v.3. trying reduce blank squares see when panning or zooming caching images. i looping through images in javascript , loading them image object before load map, hasn't improved @ all. seems when ever map loads still makes own calls images , after visiting part of map map run smoothly without blank squares. does know how improve performance of image loading google maps?

time complexity for code and an order of magnitude improvement -

i have following problem: for following code, reason, give time complexity of function. write function performs same task order-of magnitude improvement in time complexity. function greater (time or space) complexity not credit. code: int something(int[] a) { (int = 0; < n; i++) if (a[i] % 2 == 0) { temp = a[i]; for(int j = i; j > 0; j--) a[j] = a[j-1]; a[0] = temp; } } i'm thinking since temp = a[i] assignment in worst case done n times, time complexity of n assigned that, , a[j] = a[j-1] run n(n+1)/2 times time complexity value of (n 2 +n)/2 assigned that, summing them returns time complexity of n+0.5n 2 +0.5n , removing constants lead 2n+n 2 , complexity of n 2 . for order of magnitude improvement: int something(int[] a) { string answer = ""; (int = 0; < n; i++) { if (a[i] % 2 == 0) answer = a[i] + answer; else answer = answer + a[i]; ...

java - Fetching data from Oracle database does not work first time -

we trying fetch data oracle db using preparedstatement. keeps fetching 0 records while same runs , fetches data when run pl/sql developer. we found root cause while trying debug. while debugging code fetched 2 records properly. we did temporary fix placing piece of code. resultset rs = ps.executequery(); while(!rs.hasnext()){ ps.executequery();} this works. not best solution since results in unwanted db hit.it looks time issue. explicitly committed earlier transactions since can affect result of query. what causing this. what's best way solve this? the method quite big: i'll post parts here: private static boolean loadcommission(member member){ connection conn = getconnection("schema1"); //obtained through connection pool //insertion table conn.close(); conn conn2 = getconnection("schema2"); //obtained through connection pool preparedstatement ps = conn2.preparestatement(sql); ...

ruby on rails - Javascript Form Submition -

i'm looking refresh the table "dashboard_categories" when click submit without whole page refreshing, i've done far: http://pastie.org/7822560 i'm stuck on javascript i'm complete novice. know have catch form submission, send data , call partial refresh... have no clue how. ideas? hopefully i'm not far off... i've got content_for tag javascript on index.html.erb: <% content_for :javascript %> <script type='text/javascript'> </script> <% end %> include unobtrusive javascript driver in manifest app/assets/javascript/application.js : //= require jquery_ujs and mark form submitted ajax: <%= form_for(@category), remote: true |f| %>

google app engine - Appengine-datanucleus error on one to many fetch after server is restarted -

i have project have user has list of pages entities. when first create user pages fetches work expected, after restart local_db.bin appengine-datanucleus server receive error when fetching list of pages. using request factory have id of pages string - please correct me if wrong. in code below forcing fetch of page list, in reality list loaded request factory code when .with("pages") method added request. force loading of pages causes same error , allows me step code. error java.lang.long cannot cast java.lang.integer . have stepped through lot of datanucleus code , error seems happening data store loaded newly created class. integers in class version , 1 field - both of tried making longs - clearing database, recreating data restarting server got same error. feeling has making id string. either have set wrong or there bug datanucleus jpa 2 support. know answer this. below 2 entity classes , service method causes error. @entity public class user { @id @gene...

creating web service in VB.NET -

i have little background in web , need task myself grateful boss told me (as far understand) - have write web service server gets parameters, check validity , insert/update them in database. parameters delivered packet written in soap - wsdl file. have using vb.net in visual studio 2010. read bit , if understand correctly .net takes care of soap wsdl issue, transparent me, isn't it? or should install or implement concerning that? saw examples in net have implement web_method in asmx file, so? if yes, parameters method - whole bunch of 20 parametres supposed in packet? need declare or update in order connect db? appreciated - uf answer long happy pointer relevant material can read , learn. lot try reading this msdn article: describes how write simple web service using visual basic .net here main steps linked msdn article: start visual studio .net or visual studio. create new active server pages (asp) .net web service project. name web service mathservic...

ios - Uncrustify: nested block indeting is wrong -

i have code: dispatch_async(dispatch_get_main_queue(), ^{ if (self.adappearblockisanimated) { [uiview animatewithduration:kanimationtime animations:^{ self.adappearblock(); }]; } }); unfortunately, uncrustify makes like: dispatch_async(dispatch_get_main_queue(), ^{ if (self.adappearblockisanimated) { [uiview animatewithduration:kanimationtime animations:^{ self.adappearblock(); }]; } }); my config: indent_oc_block=true indent_oc_block_msg = 0 does know how make normal? without spaces in nested block. edit: cannot comment now, using xcode. it appears bug in uncrustify itself; can't work around config change. see: https://github.com/bengardner/uncrustify/issues/68 (personally, i'm big fan of turning on "tab indents", selecting all, hitting , living whatever xcode produces. having standard set of formatting defaults our team, on team can , not generate bunc...

opengl - how glBlitFramebuffer works -

gluint32 fbo[2]; gluint32 rbo[2]; gluint32 texture[2]; glgenframebuffers (2, fbo); glgentextures (2, texture); glgenrenderbuffers (2, rbo); glbindtexture (gl_texture_2d, texture[0]); glbindrenderbuffer (gl_renderbuffer, rbo[0]); glbindframebuffer (gl_read_framebuffer, fbo[0]); glteximage2d (gl_texture_2d, 0, gl_rgba8, 32, 32, 0, gl_rgba, gl_unsigned_byte, null); glrenderbufferstorage (gl_renderbuffer, gl_depth24_stencil8, 32, 32); glframebuffertexture2d (gl_read_framebuffer, gl_color_attachment0, gl_texture_2d, texture[0], 0); glframebufferrenderbuffer(gl_read_framebuffer, gl_depth_stencil_attachment, gl_renderbuffer, rbo[0]); glcheckframebufferstatus(gl_read_framebuffer); glbindtexture (gl_texture_2d, texture[1]); glbindrenderbuffer (gl_renderbuffer, rbo[1]); glbindframebuffer (gl_draw_fram...

How do I access data in array using javascript TEMPO -

been searching day , still stuck on trying access data array object using tempo.tried using variety of processes not getting anywhere. the array object i'm trying access called options , key name. <p>{{options:name}}</p> it's kind of difficult answer without @ least on instance of array object. suppose have this: var data = {options:[ {name:'test name'}, {name:'another test name'} ]} just assign options array data method after prepare in tempo: tempo.prepare('container').data(data.options); and in html: <div id="container"> <p data-template>{{name}}</p> </div>

jvm - Is there a way to create a direct ByteBuffer from a pointer solely in Java? -

or have have jni helper function calls env->newdirectbytebuffer(buffer, size)? what create normal directbytebuffer , change it's address. field address = buffer.class.getdeclaredfield("address"); address.setaccessible(true); field capacity = buffer.class.getdeclaredfield("capacity"); capacity.setaccessible(true); bytebuffer bb = bytebuffer.allocatedirect(0).order(byteorder.nativeorder()); address.setlong(bb, addressyouwanttoset); capacity.setint(bb, thesizeof); from point can access bytebuffer referencing underlying address. have done accessing memory on network adapters 0 copy , worked fine. you can create directbytebuffer address directly more obscure. an alternative use unsafe (this works on openjdk/hotspot jvms , in native byte order) unsafe.getbyte(address); unsafe.getshort(address); unsafe.getint(address); unsafe.getlong(address);

c# - Highcharts DotNet: Would it be at all possible to label Plotlines -

Image
i wondering if possible how label plotlines. either labeling lines directly or adding item legend. have been trying find way, have not found 1 yet. new xaxisplotlines { value = upperspec, color = system.drawing.color.red, dashstyle = dotnet.highcharts.enums.dashstyles.shortdash, width = 2, label = new xaxislabels { text = "label here" } // not work, want functionality } thank you! please let me know if there misunderstanding in question. edit screenshot with latest version 2.0 of dotnet.highcharts library it's possible add text on plot lines. example: new yaxisplotlines { value = 932, color = color.fromname("red"), width = 1, label = new yaxisplotlineslabel { text = "theoretical mean: 932", align = horizontalaligns.center, style = "color: 'gray'" } } also can see how used in sample project. download here: http://dotnethighc...

python - how can you display an image on a gui using tk in python2.7 -

i need away able show image when run python code in gui form if possible. have type in folder name , file name in code if know answer tried pil did save image folder want on gui the code tk if necessary from tkinter import * root = tk() toolbar = frame(root) # buttons in program b = button(toolbar, text="home", width=9) b.pack(side=left, padx=2, pady=2) b = button(toolbar, text="about-us", width=9) b.pack(side=left, padx=2, pady=2) b = button(toolbar, text="contact-us", width=9) b.pack(side=left, padx=2, pady=2) b = button(toolbar, text="travelling", width=9) b.pack(side=left, padx=2, pady=2) toolbar.pack(side=top, fill=x) # labels in program o = label(root,text="frank anne",font =("italic",18,"bold")) o.pack() toolbar1 = frame(root) o=label(root,) o.pack() o=label(root,text ="age: 27") o.pack() o=label(root,text ="address: 71 strawberry lane, j...

java - Android: Resizing Bitmaps without losing quality -

i've searched through on entire web before posting. problem cannot resize bitmap without losing quality of image (the quality bad , pixelated). i take bitmap camera , have downscale it, can upload server faster. this function sampling public bitmap resizebitmap(bitmap bitmap){ canvas canvas = new canvas(); bitmap resizedbitmap = null; if (bitmap !=null) { int h = bitmap.getheight(); int w = bitmap.getwidth(); int newwidth=0; int newheight=0; if(h>w){ newwidth = 600; newheight = 800; } if(w>h){ newwidth = 800; newheight = 600; } float scalewidth = ((float) newwidth) / w; float scaleheight = ((float) newheight) / h; matrix matrix = new matrix(); // resize bit map ...

Javascript - Regex : How to replace id in string with the same id plus number? -

i have string multiple elements id's below: var data = "<div id='1'></div><input type='text' id='2'/>"; now i'm using regex find id's in string: var reg = /id="([^"]+)"/g; afterwards want replace id's new id. this: data = data.replace(reg, + 'id="' + reg2 + '_' + numcompare + '"'); i want reg2 , seen above, return value of id's. i'm not familiar regular expressions, how can go doing this? instead of using regex, parse , loop through elements. try: var data = "<div id='1'></div><div id='asdf'><input type='text' id='2'/></div>", numcompare = 23, div = document.createelement("div"), i, cur; div.innerhtml = data; function updateid(parent) { var children = parent.children; (i = 0; < children.length; i++) { cur = children[i]; ...

Split a string on sql -

i have string on 1 of columns on database table black lines^tech43223 i need split string, , code split string select ltrim(substring(complaint, charindex('^',complaint)+1, len(complaint))) service and result is tech43223 but need string "black lines". can split string, , first value? you're close!! substring() function works follows: substring( value, start position, length) start beginning of string, , trim @ occurrence of character: select ltrim(substring(complaint, 1, charindex('^',complaint) ) service test it, if result includes split character ^ may need subtract 1: select ltrim(substring(complaint, 1, charindex('^',complaint)-1 ) service

c# - URL working in dev doesn't work on production server -

i have stored proc has url in result set , onclick opens new page url working fine on box not on production server. here aspx: function navigateonclick(sender, eventargs) { try { var row = eventargs.get_item().get_row().get_index(); var url = sender.get_rows().get_row(row).get_cell(0).get_text(); window.open(url); } catch (e) { } } the url format ../cellsiteedit.aspx?cellsiteid=bhjhj . opens new window with /cellsiteedit.aspx?cellsiteid=08c05834 but url should /livelease/cellsiteedit.aspx?cellsiteid=08c05 and getting file or directory not found error. works fine on box. try window.open(regex.replace(url, "../", ""));

java - ArrayIndexOutOfBoundsException in weka.classifiers.Classifier.classifyInstance -

i have written method. want write bayesian network, exception on classifyinstance() method. here code: public static double bayesnet1(dataset data, dataset testingset) throws exception { instances insts = converttxttoarff(data); k2 learner = new k2(); multinomialbmaestimator estimator = new multinomialbmaestimator(); estimator.setusek2prior(true); editablebayesnet bn = new editablebayesnet(insts); bn.initstructure(); learner.buildstructure(bn, insts); estimator.estimatecpts(bn); double error = 0; instances inststest = converttxttoarff(testingset); for(int i=0; i<inststest.numinstances()-1; i++) { weka.core.instance inst = inststest.instance(i); double predictedvalue = bn.classifyinstance(inst); if(inst.value(inst.classindex())!= predictedvalue) error++; } return error/inststest.numinstances(); } and here exception: ...

css - Dynamic size of even cells (nth cell ) in a table row -

i have table 4 cells per row. can make second , fourth cells expand, without changing width of others? can done without setting fixed width first , third cell, because want use class? |cell1|cell2 |cell3|cell4 | another imaginary row |cell1|cell2 |cell3|cell4 | edit: result want achieve. cell 2 , cell4 should have same width, , if possible, should dynamic depending on window size. cell 1 , 2 should have same width. 2 examples not same table, illustrate idea. no, need each row own table that. //row 1 <table> <tr> <td>1</td><td>2</td><td>3</td><td>4</td> </tr> </table> //row2 <table> <tr> <td>1</td><td>2</td><td>3</td><td>4</td> </tr> </table>

java - No executable code found at line -

this question has answer here: cannot set java breakpoint in intellij idea 15 answers i getting message "no executable code found @ line" when doing remote debug intellij ver 12. java application. using maven building war. not sure make change in order debugging properly. you need ensure sources in editor in sync classes on server. classes must compiled same sources debug option enabled compiler. note classpath may configured incorrectly , include old version of classes trying debug. may include different versions of same class (like 1 .jar , classes ) , jvm load not 1 need.

java - error undefined for defined constructor -

i'm getting error have been working on, on side time error "the constructor hangmanpanel() undefined" defined in hangman().., think may want me use parameters i'm not sure ones.... hangman.java import javax.swing.*; public class hangman extends jframe{ private static final long serialversionuid = -6224212014648478637l; public static void main(string[] args){ new hangman(); } public hangman() { this.setsize(800, 500); this.setdefaultcloseoperation(jframe.exit_on_close); this.settitle("hangman web app"); hangmanpanel panel = new hangmanpanel(); this.add(panel); this.setvisible(true); } } hangmanpanel.java import java.awt.event.*; import java.util.*; import javax.swing.*; public class hangmanpanel extends jpanel { static boolean found; private static final long serialversionuid = -5793357804828609325l; public static string answerkey() { //ge...

css - Change button label color Sencha -

how change color of buttonlabel in sencha? appears black, how change code: xtype: 'button', ui: 'plain', text:'saved searches', centered:true, iconcls: 'search', iconalign:'center', height:'100%', width:'18%', left:'29.68%', cls: 'x-iconalign-top', labelcls:"font-size: 100%;" i have tried attributes , found solution. set labelcls custom css class have added app.css file. here class have added app.css: .customcls { color:red; font-size: 100%; } and in js file set: labelcls:"customcls"

Python - Pass a variable to a function -

im curently learning python (2.7) using excellent tutorials http://www.learnpythonthehardway.org/ i trying make small text input game improve skills, part of trying add health meter main character. adding combat reduce health. the below code designed set players health 100 @ start of each game, executing function "player_health" in class called "set_health" class health(): def store_health(self): d = set_health() d.player_health() local_health = d.player_health() print "your health at", local_health, "%" return local_health when below "punch_received" function executed, players health reduced 10 class combat(): def punch_received(self): punch = 10 x = health() x.store_health() combat_health = x.store_health() combat_health = combat_health - punch print "you have been punched, health is", combat_health, "%...

How to get more useful branch diagrams in git? -

i struggle trying see going on in history of git repositories, great tools sourcetree branch diagrams can confusing. main problem me can't tell branches commits made on, , string of commits on single branch displayed on different visual lines number of concurrent branches , people working on branches increases , decreases. my initial thoughts along lines of "what if git stored branch name commit made on? diagram generators group commits on same line". question: why git not store branch name part of commit? asks same thing (but different reasons) , after reading , other links realised storing branch name wouldn't solve issue anyway. example when multiple people making alternating commits on local branches same branch-name, trying display these on same line technically wrong. anyway, on questions... is there way infer correct historic branching structure , produce nice looking diagram of - perhaps looking "merge master branchx" style commit message...

Java Reflection Snippet output -

i exploring java reflection api , encountered following code snippet public class main { public static void main(string[] args) throws illegalaccessexception, nosuchfieldexception{ field value=integer.class.getdeclaredfield("value"); value.setaccessible(true); value.set(42, 43); system.out.printf("six times 7 %d%n",6*7); system.out.printf("six times 7 %d%n",42); system.out.println(42); } } output : six times 7 43 6 times 7 43 42 i read documentation of set method states sets value of field given object. not able understand output of code because should print 42 in cases. can please give insight happening in code ? system.out.println(42); is calling println(int) not println(object) . boxing never happens. makes faster, , worked prior 1.5. in other cases, boxing through integer.valueof(int) . method defined returning same integer obje...

Is it possible to create anonymous type in LINQ extension methods in C#? -

is possible create anonymous type in linq extension methods in c#? for example linq query.i.e. var caquery = temp in catemp join casect in cadb.sectors on temp.sector_code equals casect.sector_code select new { //anonymous types cusip = temp.equity_cusip, compname = temp.company_name, exchange = temp.primary_exchange }; is same behavior supported linq extension methods in c#? do mean "when using extension method syntax"? if so, absolutely. query exactly equivalent to: var caquery = catemp.join(cadb.sectors, temp => temp.sector_code, casect => casect.sector_code, (temp, casect) => new { cusip = temp.equity_cusip, compname = temp.company_name, exchange = temp.primary_exchange });...

joomla - Fatal error: Call to undefined method JUser::authorize() in mod_envolve_chat.php on line 46 -

what have done bypassed joomla 3.0 instailling mod joomla 1.7 works when try , make mod registered users cant jomsocial users reason.... here php code any ideas on might wrong? $user =& jfactory::getuser(); if($user->guest != true) if($envolveuserealnames == 'real') $fullname = $user->name; $spacepos = strpos($fullname, ' '); if($spacepos != false) $env_firstname = substr($fullname, 0, $spacepos); $env_lastname = substr($fullname, $spacepos + 1); $env_firstname = $fullname; $env_lastname = null; else $env_firstname = $user->username; $env_lastname = null; $env_profileimg = null; $env_isadmin = $user->authorize('com_content', 'edit', 'content', 'all'); echo(envapi_get_html_for_reg_user($envolveapikey, $env_firstname, $env_lastname, $env_profileimg, $env_isadmin, null)); else if($envolvewhichusers == 'all') echo envapi_get_code_fo...

Maintaining a PHP session on an iPhone web app -

i've created web app on iphone. can open , log in no problem, whenever return app has forgotten previous session , have re-enter username , password. there have been few other questions this, answers haven't helped me solve problem because i'm not sure put php provided. this best answer i've found: maintain php session in web app on iphone in answer, wilbo baggins ( https://stackoverflow.com/users/346440/wilbo-baggins ) provides following code: // start or resume session session_start(); // extend cookie life time amount of liking $cookielifetime = 365 * 24 * 60 * 60; // year in seconds setcookie(session_name(),session_id(),time()+$cookielifetime); i entered code between <?php , ?> tags in website's header, hasn't solved issue. i'm guessing i'm putting in wrong place, i'm looking guidance explain should putting it. thanks. -- bump: there out there can me solve issue or, @ least, knows how can in touch wilbo baggins ( ht...