Posts

Showing posts from September, 2015

c# - Match a regex and reverse the matches within the target string -

c# - Match a regex and reverse the matches within the target string - based on this question regex \d+(?:-\d+)+ match 10-3-1 , 5-0 . example: this 10-3-1 string after performing matching , reversing, want this: this 1-3-10 string notice 10-3-1 should become 1-3-10 , not normal string reverse result in 1-3-01. a basic algorithm be: extract match string. "10-3-1" split match segments "-" character. you have list of elements. ["10","3","1"] reverse list. ["1","3","10"] join elements of array "-" character. "1-3-10" replace match newly joined string. c# regex string reverse

php - How to preserve application.ini paths using Zend_Config_Writer_Ini -

php - How to preserve application.ini paths using Zend_Config_Writer_Ini - i'm working on build scheme in phing takes zend framework project template , configures according phing parameters. 1 problem i've come across when using zend_config_writer_ini. my phing task takes pre-populated file repo called application.default.ini , modifies using zend_config_ini add together parameters build file (db details, etc). writes application.ini ready project use. simplified version of related task code looks this: $appconfig = new zend_config_ini( $appdefaultconfigpath, null, array( 'skipextends' => true, 'allowmodifications' => true ) ); $appconfig->production->resources->db->params->host = $buildproperties->db->host; $appconfig->production->resources->db->params->username = $buildproperties->db->username; $appconfig->production->resources->db->params->password = ...

swing - Java: How to select all descendants of a given ancestor on the Jtree? -

swing - Java: How to select all descendants of a given ancestor on the Jtree? - i select ancestor defaultmutabletreenode , descendant defaultmutabletreenode of ancestor in jtree. i using treeselectionlistener grab selection event on current jtree. basically, able is, select ancestor node, , able re-create it's descendant tree ancestor. you should able walk subtree recursively through children() of dmtn. fwiw: maybe help little, exampledepot site java illustration code, , have lot of swing examples. here link set of jtree examples. hope find need. http://www.exampledepot.com/egs/javax.swing.tree/pkg.html java swing jtree

css - Using print stylesheet, page overflows to two pages in print preview -

css - Using print stylesheet, page overflows to two pages in print preview - i using css print stylesheet provide alternate style page elements when printed, , hide ones don't wish printed. when page previewed in browser (tested ie8), overflows onto sec page, though of elements appear fit on single page - please see screenshots. what has alter in print stylesheet prevent , maintain page single printed page? tried setting display:none bottom-most panels, yet page still broken two. also, how prevent display of border around page , page numbering? css stylesheet /* specify class items should not print */ .noprint { display: none; } /* ensure content spans total width */ .fullwidth { width: 100%; margin: 0; float: none; } /* print styles elements */ .newscript { position: absolute; float: none; margin: 0pt auto; clear: both; /* background-image: url( '../_images/blank_rx.jpg' ); */ width: 433pt; height: 400pt; ...

javascript - Problem with showing HTML tags in Android Email client -

javascript - Problem with showing HTML tags in Android Email client - i'm trying fill subject , body of android email (or gmail) client web. <button onclick="parent.location='mailto:?subject=prijatelj ti preporučuje ponudu&amp;body=Ćao, pogledaj ovu ponudu na grupovini! <br />http://localhost:8089/deal/skocite-sa-padobranom<br />skok sa padobranom<br />skocite'">pošalji @</button> so it's simple mailto script has "" html tags. works fine on iphone, have new lines not on android shows text (it not format html). so question how new line on android email / gmail client (\r\n not works either)? you can't. the specs of mailto specifies body param first line of mail service content... strange iphone that... or, found (not tested): mailto:?to=email%40example.com&subject=mailto%20uri%20scheme&body=line1%0d%0aline2&cc=email%40example.com&bcc=email%40example.com javascri...

javascript - Not getting a complete conversion of Yahoo's weather API - XML to JSON -

javascript - Not getting a complete conversion of Yahoo's weather API - XML to JSON - i'm new javascript hoping utilize json output of yahoo's weather api cool things website. problem reason i'm not getting total pull of json info , i'm not sure why. json should start @ "channel" instead starts @ "item". if follow link http://weather.yahooapis.com/forecastrss?p=usoh0293&u=c should able see finish (pre json) xml looks like. here's javascript i'm using (it add together current status body tag)... help appreciated. $(document).ready(function() { $.yql = function(query, callback) { var encodedquery = encodeuricomponent(query.tolowercase()), url = 'http://query.yahooapis.com/v1/public/yql?q=' + encodedquery + '&format=json&callback=?'; $.getjson(url, callback); }; $.yql("select * rss url='http://weather.yahooapis.com/forecastrss...

java - Serializing an object which has a non-serializable parent class -

java - Serializing an object which has a non-serializable parent class - how below code work? class { int = 10; } class b extends implements serializable{ } public class test { public static void main(string[] args){ b obj = new b(); obj.a = 25; //code serialize object b (b b= new b()), // deserialize , print value of 'a'. } } the code prints 10 though have changed value of 'a' in code. any explanation behaviour ? the default value of a 10 - set 10 when object created. if want have realistic test, set different value after instantiation , serialize it. as update - if class not serializable, fields not serialized , deserialized. fields of serializable subclasses. java serialization

python - Method for indexing an object database -

python - Method for indexing an object database - i'm using object database (zodb) in order store complex relationships between many objects running performance issues. result started build indexes in order speed object retrieval , insertion. here story , hope can help. initially when add together object database insert in branch dedicated object type. in order prevent multiple objects representing same entity added method iterate on existing objects in branch in order find duplicates. worked @ first database grew in size time took load each object memory , check attributes grew exponentially , unacceptably. to solve issue started create indexes based on attributes in object when object added saved in type branch within attribute value index branch. example, saving person object attributes firstname = 'john' , lastname = 'smith', object appended person object type branch , appended lists within attribute index branch keys 'john' , 'smith'...

ASP.NET URL Encoding/Decoding -

ASP.NET URL Encoding/Decoding - i have 2 files htmlpage1.htm , webform1.aspx htmlpage1.htm contains anchor tag href="webform1.aspx?name=abc+xyz". when seek access querystring in page_load of webform1.aspx, "abc xyz" (abc [space] xyz). want exact value in querystring "abc+xyz" note: href value cannot changed any help appreciated thank you. this server.urldecode you: request.querystring["name"] // "abc xyz" option 1) can re-encode server.urlencode(request.querystring["name"]); // "abc+xyz" or raw query data request.url.query // "?name=abc+xyz" option 2) parse value request.url.query.substring(request.url.query.indexof("name=") + 5) // "abc+xyz" asp.net url encoding decoding

algorithm - Optimise 3D placement of rooms? -

algorithm - Optimise 3D placement of rooms? - given graph nodes represent 3x3x1 rooms , vertices represent need closeness. how should placed in 3d space optimise overall closeness? example (randomish) datastructure: { room1: [room2, room3], room2: [room1, room4], room3: [room5], room4: [room2, room5, room1], room5: [] } (i'm not sure should asking question it's different see on stackoverflow. interested in programming solutions/heuristic algorithms.) i assume want adjacency. in backtracking search, maintain queue of rooms ordered how many other rooms connected in graph (the constrained variable heuristic). then, each room in queue: determine possible grid positions can take , pick 1 of them; in loop, determine whether other rooms exist can in 1 spot, set them there , remove them queue (forward checking); if of previous steps failed, backtrack lastly selection point (undo changes grid). algorithm optimization language-agnosti...

php - Losing session after a redirect to another domain then back -

php - Losing session after a redirect to another domain then back - i creating login scheme utilize persons email address unique identifier in db. people can login using openid provider such google ect (also facebook), take email , store unique identifier in users table in sql db. (means dont have worry email verification, passwords ect , users dont have register). this works, opening new window using link/javascript, php script directed google or whoever provider is. come in there details, google/ect automaticly redirect window login script along (if worked) user details (most importantly email). now on response @ email, if in database, if not add together it, if so, using $_session, log user site. i have working using openid mechanism (google, yahoo, ect). trying working facebook , having great difficulty. able log user fb, grab users email ect. seek log user site, not work. reason has seperate session(inc seperate sessionid) new window have opened (and script + redir...

tooltip - How to wrap legend items in highcharts -

tooltip - How to wrap legend items in highcharts - i have big problem using highcharts, cause have been trying hours wrap legend items if very long. tryed set legend , legend item width, text still out legend. thing found alter highcharts.src.js think that's not way solve problem. here code: <script type="text/javascript"> var chart; $(document).ready(function() { chart = new highcharts.chart({ chart: { renderto: 'graph_container', defaultseriestype: 'line', zoomtype: 'y', marginright: 130, marginbottom: ${marginbottom} }, title: { x: -10, text: null }, xaxis: { title: { text: '<fmt:message key="html.time" bundle="${msg}"/>...

forms - Difference in WordPress comments: reply to existing versus adding a new comment? -

forms - Difference in WordPress comments: reply to existing versus adding a new comment? - i'm having hard time finding how differentiate in wordpress comment forms when replying existing comment (threaded) versus replying the blog post, , not comment. both forms seem have same action , same hidden value. how form post associate new comment either threaded reply, or parent-level reply? i tried searching wordpress' back upwards didn't have right vocabulary/search terms valid search result. if check database of wordpress, can see there table named 'wp_comments'. in table there column 'comment_parent' holds id of parent of comment. if value 0, means comment post , if value non-zero, means reply prent comment forms wordpress webforms

actionscript 3 - AS3 Flash checkbox in datagrid -

actionscript 3 - AS3 Flash checkbox in datagrid - i have fill grid mysql database using service. have datagrid this col_1 col_2 col_3 col_4 [chekbox] value value value [chekbox] value value value [chekbox] value value value [chekbox] value value value note : plid value checkboxes for (varname in returnobj) { var plid = int (returnobj[varname]["plid"]); var varstate = string(returnobj[varname]["state"]); var varcity = string(returnobj[varname]["city"]); arrdp.push({ //arrdp array defined //column value select : plid, state : varstate, city : varcity }); var dp:dataprovider = new dataprovider(arrdp); var select:datagridcolumn = dg.addcolumn("select"); var state :datagridcolumn = dg.addcolumn("state"); var city :datagridcolumn = dg.addcolumn("city...

xcode - Preview image shows its white screen? -

xcode - Preview image shows its white screen? - i seek open .png images in preview shows white screen? can 1 help me. thanks, subbu i found reply here. in case else finds question , needs solution. take xcode out of total screen mode. still not fixed in 5.2 xcode 5.0.1 don't show images when select in navigation area xcode

properties applying only after mouse click in datagrid in C# winforms -

properties applying only after mouse click in datagrid in C# winforms - i used code alter color of cell properties applying after mouse click want alter color after form loaded used code private void datagridview1_rowvalidated(object sender, datagridviewcelleventargs e) { (int = 0; < 5; i++) { int j = 6; datagridviewcellstyle cellstyle = new datagridviewcellstyle(); cellstyle.forecolor = color.red; datagridview1[j, i].style = cellstyle; } } remove code datagridview1_rowvalidated , add together form load event instead: add code in form constructor: public form1() { initializecomponents(); this.load += onformload; this.datagridview1.sorted += ondatagridsorted; } private void onformload(object sender, eventargs e) { updatedatagridviewcolor(); } private void ondatagridsorted(object sender, eventargs e) { updatedatagridviewcolor(); } private void updated...

ruby on rails 3 - Running bundle exec cucumber is fine, but just running cucumber doesn't work -

ruby on rails 3 - Running bundle exec cucumber is fine, but just running cucumber doesn't work - i'm using cucumber 1.0 installed cucumber-rails on rails 3. i'd utilize autotest, seems autotest invokes cucumber cucumber , not bundle exec cucumber . bundle exec cucumber works fine me, when run cucumber , get: using default profile... uninitialized constant diff::readablediffer (nameerror) /users/mike/.rvm/gems/ruby-1.9.2-p180@rails3/gems/rake-0.9.2/lib/rake/ext/module.rb:36:in `const_missing' /users/mike/.rvm/gems/ruby-1.9.2-p180@rails3/gems/test-unit-2.3.0/lib/test/unit/ui/console/testrunner.rb:336:in `<module:console>' /users/mike/.rvm/gems/ruby-1.9.2-p180@rails3/gems/test-unit-2.3.0/lib/test/unit/ui/console/testrunner.rb:17:in `<module:ui>' /users/mike/.rvm/gems/ruby-1.9.2-p180@rails3/gems/test-unit-2.3.0/lib/test/unit/ui/console/testrunner.rb:16:in `<module:unit>' /users/mike/.rvm/gems/ruby-1.9.2-p180@rails3/gems/test-unit-...

actionscript 3 - Loading image into flash project dynamically -

actionscript 3 - Loading image into flash project dynamically - i'm trying create as3 project dynamically pulls images database , sticks them framework of flash film making this. next tutorial (in as2, , converting as3 go along) , trying images load same directory project, having issues loader. finish newb @ as3 , such have no thought doing, come guys help why programme won't work properly. here entire code project. import flash.net.urlloader; import flash.events.event; import flash.net.urlrequest; import flash.display.movieclip; import flash.display.*; import com.greensock.tweenlite; import com.greensock.easing.*; var xmlpath = "content.xml"; var photos_xml:xml = new xml(); var imagelist:xmllist = new xmllist(); var xmlloader:urlloader = new urlloader(); xmlloader.addeventlistener(event.complete, loadxml) var imageloader:loader = new loader(); imageloader.addeventlistener(event.init, inithandler); imageloader.addeventlistener(event.complete, completehan...

Normalize document captured from camera in OpenCV -

Normalize document captured from camera in OpenCV - i want utilize photographic camera document scanner , need prepare distortion. have seen solutions allow user point on corners of document, , prepare distortion according points. trying opencv, cannot find simple way that. can show me how o simple 4 corners of document? thank's meir i found solution here: nuigroup.com/forums/viewthread/3414 that's looking for. opencv

sql server - programmatic/CLI way to tell MSSQL differential backups from full backups? -

sql server - programmatic/CLI way to tell MSSQL differential backups from full backups? - is there easy way tell total , differential backups apart metadata nowadays in .bak file? i've been playing around osql/sqlcmd , command test: sqlcmd -q "restore filelistonly disk = 'c:\some_path\some_backup.bak'" runs, differentialbaselsn , differentialbaseguid info nowadays info files in both types of backups =(. each backup has 3 files, .mdf, .ndf, , .ldf. hoping see null or 0 values these attributes total database backup, instead mdf , ndf files have entries both of fields. am out of luck, or there other way dig backup file , tell if total or differential? maybe things easier sql server management objects? use restore headeronly , backuptype column the database file type orthogonal backup type sql-server smo sqlcmd

php - why after click on tag , page refresh and not work appendTo? -

php - why after click on tag <a>, page refresh and not work appendTo? - tag a $.each(). see js code: $('.auto_complete').keyup(function () { var id = '#' + this.id; var alt = $(id).attr('alt'); var id = $(this).attr('id'); var name = $(this).attr('name'); var url = alt + id + '/' + name; var dataobj = $(this).closest('form').serialize(); $.ajax({ type: "post", url: url, data: dataobj, cache: false, datatype: 'json', success: function (data) { $(".list_name").show().html(''); $.each(data.name, function(a,b){ $(".list_name").append('<p><a href="" id="result">' + b + '</a></p>...

c++ - Why increment on data pointed by Pointer crashing? -

c++ - Why increment on data pointed by Pointer crashing? - possible duplicate: c/c++ char pointer crash char *p = "atl"; char c; c = ++*p; //crashing here why crashing? i know memory not created pointer increment should have done on data. p points const info string literal "atl" ; means, *p cannot changed. you're trying alter writing ++*p . why crashing @ runtime. in fact, compilers give warning when write char *p ="atl" . should write: const char *p ="atl"; if write so, compiler give error when write ++*p @ compilation time itself. detection of error @ compile time improve detection of error @ runtime. see compilation error here now: http://www.ideone.com/fvbpx the compilation error is: prog.cpp:7: error: increment of read-only location ‘* p’ however, if write char p[] = "atl"; char c = ++*p; //ok then right now. because p array created out of string literal ...

bootstrapping - Grails instantiates object and uses in Controllers -

bootstrapping - Grails instantiates object and uses in Controllers - i have application needs instantiate 1 object, thinking of singleton, before jump in that, thinking of dependency injection. is, instantiate object , setattribute servletcontext in bootstrap.groove , utilize object in every controller. understanding bootstrap called 1 time during application lifetime? that? you can define singleton beans in resources.groovy beans = { mybean(my.company.mybeanimpl) { singleton true } } then in controllers class examplecontroller { def mybean } all documented here: http://www.grails.org/doc/latest/guide/14.%20grails%20and%20spring.html grails bootstrapping

ruby - rails simple_form_for association select text -

ruby - rails simple_form_for association select text - i using rails 3.0, ruby 1.9.2 , plataformatec simple_form gem. the code below renders select box consumer names. want show select box consumer locations instead. how do that? view code: <%= simple_form_for @request |f| %> <%= f.association :consumer, :collection => consumer.all, :prompt => "choose location" %> <%= f.button :submit %> <% end %> model code: consumer < activerecord::base attr_accessor :name, :location end you via label_method <%= f.association :consumer, :collection => consumer.all, :prompt => "choose location", :label_method=>:location %> ruby-on-rails ruby simple-form

asp.net changing password format problem -

asp.net changing password format problem - i changed password format in web.config hashed encrypted , added machine key after got error : format of initialization string not conform specification starting @ index 0 i tried changing hashed still got error. here membership code: <membership> <providers> <remove name="aspnetsqlmembershipprovider"/> <add name="aspnetsqlmembershipprovider" type="system.web.security.sqlmembershipprovider, system.web, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a" connectionstring="localsqlserver" enablepasswordretrieval="false" enablepasswordreset="true" requiresquestionandanswer="false" applicationname="/" requiresuniqueemail="true" minrequ...

javascript - jQuery clear cache on logout -

javascript - jQuery clear cache on logout - when users logout mobile app, how can create sure cache cleared? what i'm thinking redirect /logout specific page clears cache , redirects front end page, how clear cache? i'm using jquery mobile 1.0b2pre. here's how solved it: my /logout action users session destroyed in backend redirects /exit has id attribute of exitpage . in javascript have asked jquery mobile trigger when page created. empty dom , redirects front end page. /exit: <div data-role="page" id="exitpage"></div> /my.js: jquery('#exitpage').live('pagebeforecreate', function(){ jquery(document).empty(); window.location.replace('/'); }); javascript jquery caching jquery-mobile

Jquery Post - Php Get Problem -

Jquery Post - Php Get Problem - i have problem @ jquery post, php get. don't value. i'm everytime error. wrong? there codes it's jquery post: $.post("a.php", { imagetext: $("textarea").val() } ); it's php get: echo $_get["imagetext"]; p.s:i'm beginner @ php. because sending post request, need utilize $_post["imagetext"]; in php. alternatively, alter get request jquery $.get . php jquery post get

String issue - Java -

String issue - Java - i writing programme class in analyze different product codes entered. pretty simple having problem. trying end loop if user enters "e" or "e". however, not end loop @ all. @ end of while statement setting loop false should end , doesn't output totals either have messed up. code string type. // prompt user company code or exit system.out.print("enter company code or type 'e' exit: "); // input user's company code code = scan.nextline(); // check see if user wants exit if (code == "e" || code == "e") { // output final statistics system.out.print("total valid codes: " + valid + "/n"); system.out.print("total banned codes: " + banned); // end loop loop = false; } any ideas? thanks! you need utilize code.equals("e") || code...

iphone - NSFastEnumerationMutationHandler crash -

iphone - NSFastEnumerationMutationHandler crash - could perchance help me here, why getting nsfastenumerationmutationhandler crash of sudden in code. blank why crash poped of sudden , how crush one. thanks. you must trying alter array while using fast enumeration. example for ( id anobject in anarray ) { if ( /* anobject satisfies status */ ) { [anarray removeobject:anobject]; } } that shouldn't done. utilize different array or filteredarrayusingpredicate: method filter. remedy, however, depends on you're trying do. iphone crash

android - OnTouch with Listview -

android - OnTouch with Listview - i using ontouchlistener listview using motionevent action_up, how able create item in listview action_up event performed. code below package com.example.listviewdemo; import android.app.listactivity; import android.os.bundle; import android.util.log; import android.view.motionevent; import android.view.view; import android.view.view.ontouchlistener; import android.widget.adapterview; import android.widget.adapterview.onitemclicklistener; import android.widget.arrayadapter; import android.widget.listview; import android.widget.textview; import android.widget.toast; public class listviewdemo extends listactivity { textview selection; string[] items={"adipiscing","aliquet","amet","ante" }; public void oncreate(bundle icicle) { super.oncreate(icicle); setcontentview(r.layout.main); setlistadapter(new arrayadapter<string>(this, android.r.layout.simple_list_i...

Set repeated data sets in a SAS data step -

Set repeated data sets in a SAS data step - suppose have sas dataset looks this: id x 1 1234 2 2345 3 3456 i need new info set has info set read in (say) 2 times, new variable indicating "replication" is: id x rep 1 1234 1 2 2345 1 3 3456 1 1 1234 2 2 2345 2 3 3456 2 it of import info read in exact order -- entire initial info set read once, again, etc. any ideas on efficient way in info step? (in reality info set huge, need read several times, , want avoid sorting.) i tried this, order of observations in new info set not want: data foo; set tmp; rep=1; output; set tmp; rep=2; output; run; if want maintain info step, work described. data foo; set tmp (in=ina) tmp (in=inb); if ina rep=1; if inb rep=2; run; sas

c# - preventing label border from being bold -

c# - preventing label border from being bold - i using viewbox fill space available, kind of gives me right result not exactly. <viewbox grid.row="0" grid.column="0"> <stackpanel name="letters" orientation="horizontal"> <label ..>...</label> ... </stackpanel> </viewbox> when maintain adding labels stackpanel when exceed container width smaller. it's behaviour want, don't want labels' border 'bold' (because of viewbox). how should alter code structure? i've modified kzen's reply ensure don't have explicitly define style in code every time add together new label stack panel. (warning: coding in-place, afaik, should compile fine is) <viewbox grid.row="0" grid.column="0"> <stackpanel name="letters" orientation="horizontal"> <stackpanel.resources> <re...

c# - How to change the text of a comboBox cell of a dynamically added DataGridViewComboBoxColumn? -

c# - How to change the text of a comboBox cell of a dynamically added DataGridViewComboBoxColumn? - i still little new c# using winforms , have datagridview connected datasource , beingness populated correctly. i have added comboboxcolumn @ run time. comboboxcolumn beingness connected datasource, displaymember , valuemember set, headertext set , column added datagrid. connection works fine , when user clicks combobox populated expected. when user completes new row in grid select item in combobox , whole row updated database when done. my question is: when datagrid opened 1 time again or redrawn populated due datasource property, how combobox cell display value selected instead of blank box. know code of getting value db , set in value. ideal if set variable in display of combobox. maintain in mind combobox still info bound user edit value if wishes? i know in normal combobox command should set .text property. datagridviewcombobox not have same property. here co...

c# - How to grey out / disable a button control in Win Forms? -

c# - How to grey out / disable a button control in Win Forms? - can please provide illustration of how gray out button control. i have tried: downloadbutton.isdisabled; downloadbutton.enabled = false; c# .net winforms

.net - How to avoid standard input getting stuck in c# process -

.net - How to avoid standard input getting stuck in c# process - i'm writing programme check whether submit code right or not. here of code... process submitprog; streamwriter proginput; string input;//it submitprog's standard input //initialization //... submitprog.start(); proginput = submitprog.standardinput; proginput.write("{0}",input); proginput.close(); proginput.dispose(); while(!submitprog.hasexited) if(timeout) submitprog.kill(); amazingly stuck @ line proginput.write("{0}",input); while input big plenty , submit programme didn't read anything. some submit code might tricky while(1); doing nothing. can kill process when input file little enough. on contrary, if input file bigger, programme won't check timeout , stuck while reading input. do have solution avoid getting stuck in code doesn't read anything. thanks. you're @ mercy of size of standard input buffer , programme you're testi...

Value of a textbox in silverlight + MVVM -

Value of a textbox in silverlight + MVVM - i have xaml names customer.xaml this: <grid x:name="customview" > <stackpanel x:name="custompanel" > <textbox x:name="customtext" /> </stackpanel> </grid using mvvm have created icustomerviewmodel , customerviewmodel this: public interface icustomerviewmodel { icommand saveclientcommand { get; } } public class customerviewmodel : icustomerviewmodel , inotifypropertychanged { ...... private void executesaveclient() { // } my question how value of within function executesaveclient() save this? you should declare string property in view model say: public string customtext { get; set; } assign datacontext of customview viewmodel int constructor, hope grid in usercontrol or window: this.customview.datacontext = new customerviewmodel(); bind property: <textbox x:name="customtext" text="{binding customt...

php - Output Growth between Numeric Datafields in database -

php - Output Growth between Numeric Datafields in database - i output growth percentage between age 20 , age 19. should able "height growth = 3" (by taking height 178 - 175) or there "height growth = .017%" (178/175). my code looks this <table> <thead><tr><td>age</td><td>height</td><td>height growth %</td><td>weight</td></tr> </thead> <tbody> <?php foreach ($healthdata->result_array() $row) { echo "<tr><td>".$row['age']."</td><td>".$row['height']."</td><td>%</td> <td>".$row['weight']."</td></tr>"; } ?> </tbody></table> my model looks this function display_healthdata() { $healthdata = $this->db->query("select * healthdata id = '1' order age desc;"); homecoming $he...

nested forms - rails simple_nested_form_for fields_for wrong number of arguments -

nested forms - rails simple_nested_form_for fields_for wrong number of arguments - so i'm building form in rails 3.1, using <%= simple_nested_form_for(@person, :url => collection_url, :html=>{:multipart => true}) |f| %> <%= render :partial => "form", :locals => { :f => f } %> <% end %> but line in partial causing problem: <h2>badges</h2> <ul id="certifications"> // next line raising error "wrong number of arguments (4 3)" <%= f.fields_for :certifications |certification_form| %> <%= render :partial => 'certification', :locals => { :f => certification_form } %> <% end %> </ul> <%= f.link_to_add "add badge", :certifications %> so here model: class person < activerecord::base has_many :certifications, :dependent=>:destroy, :order=>:position has_many :certificates, :through=>:certifications accepts_nes...

jni - System.loadLibrary failing on java 1.6 but working on java 1.5 -

jni - System.loadLibrary failing on java 1.6 but working on java 1.5 - i have ran peculiar problem on aix 6.1 , sles 11 . trying load so file in java using system.loadlibrary() call. below sample program: public class jnitest { public static void main(string[] args) { seek { system.loadlibrary("libsample.so"); system.out.println("loaded!!!"); } catch(unsatisfiedlinkerror e) { system.out.println("unsatisfiedlinkerror"); } } when compile piece of code java 1.5 works properly. when compile java 1.6 says unsatisfiedlinkerror . don't understand how perchance getting error. way running is: javac jnitest.java java -djava.library.path=. jnitest the so file place in current directory running code. before this, things have tried: giving absolute path - didn't work using runtime.getruntime().loadlibrary() - didn't work any thought doing wrong? i ...

javascript - jQuery load with variable instead of element id -

javascript - jQuery load with variable instead of element id - i've got slight jquery problem. want load particular area of external html doc div, instead loads whole document, not specified area. this trigger: $('a').click(function(){ // link trigger load var pid = $(this).attr('href'); //the pid links href getproject(pid); //trigger load function, pass variable }); this triggered function: function getproject(pid) { $('#container').load('data.html', pid); } so when click link, should load element id (#) specified link container, loads whole data... cant seem find solution this. the link looks (cant utilize exact markup here): href="#elementtoload" the info document looks this: div id="elementtoload" div id="..." and loads of more elements content, should loaded id links href. looking @ documentation $ load, should able this: function getproject(pid) { $('#contain...

c# - Rollback a transaction on NHibernate and Enterprise Library -

c# - Rollback a transaction on NHibernate and Enterprise Library - i have web application has multiple subsystems. in 1 of these subsystems utilize nhibernate , in utilize enterprise library info access layer. have page work these 2 subsystems concurrently , when click in button in page, execute 2 work. question if application dealing errors, how can rollback of works? not sure enterprise library, nhibernate claimed play well system.transactions c# nhibernate transactions enterprise-library rollback

qt - How can I capture QKeySequence from QKeyEvent depending on current keyboard layout? -

qt - How can I capture QKeySequence from QKeyEvent depending on current keyboard layout? - i need configuring application. have qlineedit field reimplemented keypressevent method. qkeyevent *ke = ... qstring txt; if(ke->modifiers() & qt::controlmodifier) txt += "ctrl+"; if(ke->modifiers() & qt::altmodifier) txt += "alt+"; if(ke->modifiers() & qt::shiftmodifier) txt += "shift+"; if(ke->key() >= qt::key_0 && ke->key() <= qt::key_9) txt += ('0' + ke->key() - qt::key_0); else if(ke->key() >= qt::key_a && ke->key() <= qt::key_z) txt += ('a' + ke->key() - qt::key_a); ui->hotkeyedit->settext(txt); but solution can create shortcuts english language chars. illustration when utilize russian keyboard layout, code display same sequence english language char, placed on same keyboard key. what might find useful function qkeysequance().tost...

java - Create a 256 byte RSA encrypted block from a public key -

java - Create a 256 byte RSA encrypted block from a public key - hello trying write php function/class connect remote (java) server , send message has been encoded 256 byte rsa block using public key. the github of java server here : https://github.com/vexsoftware/votifier (search for: protocol documentation). this how have send data. problem that: a) public key continuous string. miibijanbgkqhkig9w0baqefaaocaq8amiibcgkcaqeasdg2qepv74tqowjexu6bcboxtlpxeg/q5p3pkhpn433bstahmbqhroda7qginfqmhvkaofm84mnzckh+ysbriicrw3c7vyarwfgmmqidr/nilds/pmnm2pnpdrpk/vadcwcolsocp6/rjuncmkqv0lw89dtcum5mrptdcksragrp5zoahobjehk6yw2jfpd2cfbpqsu9v7unlkz3znnxwncknkxib6mqa7adfh9j4xa+9ambc5oj/zvfwhnixq3ib4tmdgzsx/+dess2mz0ml78fckxsoft4xbfslggiyi7qsfqzb4fh8d9wuuxadefzntvfy185pginopbjduh8+widaqab and every function found on net doesnt need. b) server responds either default message if send wrong info or (i guessing here) ok message when good. does know how create rsa block ? mean has 256 by...

c# - How to unit test a class derived from NetworkStream? -

c# - How to unit test a class derived from NetworkStream? - as part of project have class derives networkstream. in case provides wrapped implementations of methods such read , readbyte provide context specific safety (it calls base of operations methods additional logic). but testing issue. class requires socket in constructor (concrete type) , mocking not work me (using moq here, perhaps typemock would, avoid costly tooling). another alternative might compose rather inherit, , create class wraps networkstream , implements own interface similar networkstream. problem. consumers of streams in bcl such streamreader etc. require concrete stream or derived type, , hence not work composed class. so, can think of alternatives? it's not i'd sense happy leaving without decent coverage - it's area much go wrong, , should solid. you might want take @ pex , moles project http://research.microsoft.com/en-us/projects/pex/ . more moles part. here's direct link g...

web config - How do you implement far future expires headers in asp.net with IIS 6 -

web config - How do you implement far future expires headers in asp.net with IIS 6 - we running asp.net mvc 2.0 web app , it's running on windows server 2003 iis 6.0. know iis7+ can use: <staticcontent> <clientcache cachecontrolmode="usemaxage" cachecontrolmaxage="365:00:00"/> </staticcontent> is there way same functionality iis6? don't have access server settings cant alter way either. if have access webserver, can within iis manager. check out article on microsoft technet more info: http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/iis/0fc16fe7-be45-4033-a5aa-d7fda3c993ff.mspx?mfr=true to set expiration of web site content in iis manager, double-click local computer; right-click web sites folder, individual web site folder, virtual directory, or file; , click properties. click http headers tab. select enable content expiration check box. click expire immediately, expire after, or expir...

How to know the name of the background image used at home screen android? -

How to know the name of the background image used at home screen android? - how can know name of image used in android home screen? i utilize wallpaperinfo not giving me name of wallpaper. as far know cannot. when wallpaper set, wallpapermanager given bitmap.. not know original info used set it. no filename ever transferred wallpapermanager , actual info display.. android android-widget

indexing - Redundant MySQL Index? -

indexing - Redundant MySQL Index? - action keyname type unique packed column cardinality collation null comment edit drop primary btree yes no tickerid 23200 timestamp 13897209 edit drop tickerid btree no no tickerid 11737 edit drop timestamp btree no no timestamp 18 ~99,424,209 innodb utf8_general_ci 5.1 gib ok before seek "optimize" db deleting unneeded indexes thought i'd inquire here. table gets nail lot want speed insert performance. read 5 articles on net seem indicate single index on tickerid redundant because multiple index (tickerid,timestamp) used if ever run query on tickerid. occasionally, eod reporting, might select * timestamp > today() - 1 day or that. need timestamp index well? this index on tickerid, timestamp can used queries can utilize index on tickerid only. however, query that: select * mytable timestamp > today() -...

Weirdest Qt Layout "flesh eating" problem -

Weirdest Qt Layout "flesh eating" problem - i'm writing own class, similar toolbar, contain widgets under horizontal box layout object within of it. i have widget class serving container have widget class deriving qpushbutton, custom painting (really showing loaded image @ pos 0,0). i initialize layout object: this->buttonlayout = new qhboxlayout(this); this->buttonlayout->setcontentsmargins(0, 0, 0, 0); this->buttonlayout->setspacing(0); this->buttonlayout->setobjectname("buttonslayout"); and start initializing widgets , "adding" them onto layout similar this: // 1 time button created.. add together it... this->buttonlayout->addwidget(button); in end, create spacer object create sure toolbar buttons aligned left. qspaceritem * spaceritem = new qspaceritem(0, 0, qsizepolicy::expanding, qsizepolicy::expanding); this->buttonlayout->additem(spaceritem); my button class defining "setminim...

.net - How to scrape the description in google search results -

.net - How to scrape the description in google search results - im developing application using vb.net , application simple search on google using webbrowser command the application scrape results links , description , have succeeded scrape href of links can't scrape description of search results each link ! any help highly appreciated many in advance i don't see why decided remove response yesterday. accurate , help him guess we've people here god complex on wikipedia. i'll not write whole s* again, sorry: check info on http://google-scraper.squabbel.com . includes need solve issue, need convert php code vb/net code. .net parsing browser scrape

html - Removing space at the top left and right of div -

html - Removing space at the top left and right of div - i starting work css , have basic issue. i have div element: class="snippet-code-css lang-css prettyprint-override"> .top { background-color: #3b5998; margin-left: 0px; margin-top: 0px } class="snippet-code-html lang-html prettyprint-override"> <div class="top">...</div> the colour code taking effect (good). the problem have there seems bit of white space on left, top , right of div. how rid of white space? illustration if take @ facebook page, top part blue, there no white space @ top. you need reset both default padding , margin attributes in stylesheet: html, body { margin: 0; padding: 0; } as @jason mccreary mentions, should using reset stylesheet. 1 links to, eric meyer's css reset, great place start. it looks you're missing semi-colon in css, should follows: .top { background-color:#3b5998; marg...