Posts

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