Posts

Showing posts from May, 2010

classpath - Java: Adding included Jar files to a created Jar file in linux -

i need including imported jar files java program in linux. here program: import java.sql.*; public class createcoffees { public static void main(string args[]) { try { class.forname("com.ibm.db2.jcc.db2driver"); } catch(java.lang.classnotfoundexception e) { system.err.print("classnotfoundexception: "); system.err.println(e.getmessage()); system.exit(1); } } } in order execute class.forname("com.ibm.db2.jcc.db2driver"); need 2 .jar files added classpath: db2jcc_license_cu.jar db2jcc4.jar i put these jar files same directory createcoffees.java file, compile , run this: javac createcoffees.java java createcoffees but got error classnotfoundexception: com.ibm.db2.jcc.db2driver then tried "-classpath" option javac -classpath ./db2jcc_license_cu.jar:./db2jcc4.jar createcoffees.java java -classpath ./db2jcc_license_cu.jar:./db2jcc4.j

wordpress - Show children of direct parent without specifying parent id -

in wordpress page want show children of direct parent without wanting specify page <?php $pages = get_pages('child_of=143'); if ($pages) { echo '<ul>'; foreach ($pages $page) { echo '<li><a href="'.get_permalink($page->id).'">'; echo get_the_title($page->id); echo get_the_post_thumbnail($page->id); echo '</a></li>'; } echo '</ul>'; } ?> how can grab direct parent cheers help you can parent id through following: $post->parent_post so, like: $parent_id = $post->parent_post; $pages = get_pages('child_of=' . $parent_id); if ($pages) { ... }

regex - How are these angled brackets breaking my regular expression? -

i'm trying capture contents of bespoke html-style tag within data. then i'd replace contents , surrounding tag placeholder. i'm using objmatch.value , objmatch.submatches(0) access "contents + tag" , "contents only" respectively. however, angled brackets of tag appear causing both of these return contents. this breaks: "<mytag\b[^>]*>(.*?)</mytag>" both objmatch.value , objmatch.submatches(0) return contents only. this works: ...but if change angled brackets dollar signs, this: "$mytag\b[^$]*$(.*?)$/mytag$" objmatch.value returns "contents + tag", , objmatch.submatches(0) returns "contents only". expected , desired. can explain why is, , / or how can change regex pattern solve it? full code dim oregex set oregex = new regexp oregex.ignorecase = true oregex.global = true oregex.pattern = "<mytag\b[^>]*>(.*?)</mytag>"

.net - Powershell ScriptBlock Not Executing -

i'm trying execute code on remote machine using invoke-command . part of method includes scriptblock parameter, , sense i'm not doing correctly. first tried create method in script, looked this: param([string] $filename) function validatepath( $file, $filetype = "container" ) { $fileexist = $null if( -not (test-path $file -pathtype $filetype) ) { throw "the path $file not exist!" $fileexist = false } else { echo $filename found! $fileexist = true } return $fileexist } $responseobject = invoke-command -computername minint-ou9k10r -scriptblock{validatepath($filename)} -asjob $result = receive-job -id $responseobject.id echo $result to call this, .\myscriptname.ps1 -filename c:\file\to\test . script execute, not call function. then thought maybe should put function new script. looked like: file 1: $responseobject = invoke-command -computername minint-ou9k10

openssl - how to convert PEM to P7B with python -

this works in command-line, same using m2crypto in python code. openssl crl2pkcs7 -nocrl -certfile ra.crt -out ra-ca.p7b -certfile ca.crt. checkout below link. you. [ http://www.coderexception.com/czmubmbbujqxxjwp/how-can-i-use-python-to-output-a-certificatesonly-pkcs7][1]

python - Can someone explain why replace isn't working for me -

i need remove spaces in sentences. sentence "i  like   python" , need make "i python" . used replace this: >>> >>> sentence="i python" >>> def checkio(element): newelement=element.replace(" ", " ") , element.replace(" ", " ") return newelement >>> checkio(sentence) 'i python' >>> and see, result "i  like python" though (think) told replace "  " " " . can clear me why didn't work? this wanted do: def checkio(element): newelement = element.replace(" ", " ").replace(" ", " ") return newelement you shorten def checkio(element): return element.replace(" ", " ").replace(" ", " ") however, if wanted replace arbitrary number of spaces? better split sentence on number of spaces, , join single

jQuery draggable, save the position after reloaded page? -

i did ton of research need more personalized answer, pretty positive saving draggable values requires cookies solution, unlike jquery .slider can save values this //jquery ui slider jquery( ".slider" ).slider({ animate: true, range: "min", value: $("input.slider-value").val(), min: 50, max: 700, step: 1, //this gets live reading of value , prints on page slide: function( event, ui ) { jquery( "#slider-result" ).html( ui.value ); jquery( ".static_preview_image" ).height( ui.value ); }, //this updates hidden form field can submit data using form change: function(event, ui) { jquery('#hidden').attr('value', ui.value); } }); $( ".static_preview_image" ).css({height: $("input.slider-value").val()}); //this gives element

html - Styling problems using CSS -

http://jsfiddle.net/amkhx/ hello all, i linked code on top. main problem have header, content , footer set works websites. not have scrolling feature or anything. everytime try add intel logo screen. there. move around , tweek , works 1 browser , not other... keeps changing. want logo stick left along header made css. want mobility group text @ height right next logo, reason messes header content , footer when paly it. pretty want logo on first mobility group right next itand make smooth! also have learned html css , php , if guys see in code done smarter please let me know. need critical feedback can progress in learning these new languages better can succeed in field of programming! thank in advance input , advice!! html code: <div id="page"> <div id="header"> <h1><img src="http://wireless.fm.intel.com/test/logo2.png"> <h2>mobility group</h2> </div&

ruby - Performing a BLAST search with BioRuby -

i attempting perform blast search using bioruby on windows xp machine ruby 1.9.3 , bioruby 1.4.3_0001. have installed necessary dependencies, e.g., cairo, output follows: c:/ruby193/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `r equire': cannot load such file -- cairo.so (loaderror) c:/ruby193/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_requir e.rb:45:in `require' c:/ruby193/lib/ruby/gems/1.9.1/gems/cairo-1.12.6-x86-mingw32/lib/ca iro.rb:46:in `rescue in <top (required)>' c:/ruby193/lib/ruby/gems/1.9.1/gems/cairo-1.12.6-x86-mingw32/lib/ca iro.rb:42:in `<top (required)>' c:/ruby193/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_requir e.rb:110:in `require' c:/ruby193/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_requir e.rb:110:in `rescue in require' c:/ruby193/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_requir e.rb:35:in `require' c:/ruby193/li

vb.net - Program freezes when opening a textfile with over 100,000 lines -

my code lets user open text file , contents of textfile per line being placed inside array, program freezes when contents of textfile has on 100,000 lines or more. have tried backgroundworker seems not support openfiledialog. it runs fine on 1,000 lines or less, need on 100,000 lines of text program. there way tweak performance won't freeze? here code: dim stream system.io.filestream dim index integer = 0 dim openfiledialog1 new openfiledialog() openfiledialog1.initialdirectory = "d:\work\base tremble" openfiledialog1.filter = "txt files (*.txt)|*.txt" openfiledialog1.filterindex = 2 openfiledialog1.restoredirectory = true if openfiledialog1.showdialog() = system.windows.forms.dialogresult.ok try stream = openfiledialog1.openfile() if (stream isnot nothing) dim sreader new system.io.streamreader(stream) while sreader.peek >= 0 redim

Python 2.7: Variable defined in previous function, receiving undefined error -

so variable defined in inputnfo(), why getting undefined error? try & except perhaps? i've added removed... swapped around , cannot seem find solution, , answers online seem situation based... in advance :) super new & improved edit: getting unboundlocalerror import random alpha = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] strgen = [] retry = 0 ### defining def inputnfo(): global = input('how long want random word/lucky number be: ') global = raw_input('would letters or numbers?(let,num, or mix?):').lower def generate(): while > 0: if == 'let': strgen.append(random.choice(alpha)) -= 1 print '.'

java - Can't get bullets to shoot at correct angle? -

i've been having trouble trying bullet fire @ angle put in. using eclipse java. my code: x += (int) (spd * math.cos(dir)); y -= (int) (spd * math.sin(dir));` the feel reason it's not working because casted int possibly makes inaccurate. in order draw rectangle needs ints. when inputting dir 0 it's fine , shoots right. problem when put in 90, instead of shooting striaght shoots off little left. any idea on how can fix this? thanks! no, you're making classic mistake: java trig functions need radians, not degrees. it's not 90 should pass; it's π/2.0. so sure convert angles in degrees radians multiplying π/180.0. this true c, c++, java, javascript, c#, , every other language know. cannot name single language uses degrees angles. double radians = dir*math.pi/180.0; x += (int)(spd*math.cos(dir)); y -= (int) (spd * math.sin(dir));` // don't know why this. funny left-handed coordinate system. speed magnitude of velocity vector. e

Enable/Disable Combobox according to Checkbox selection WIX -

how enable/disable combobox according checkbox selection. want in way if checkbox checked combobox enabled , if checkbox unchecked combobox disabled. didn't find clue putting conditions in control of type combobox. suggestions????? you can use condition enable or disable combo box based on check box property. <control id="combobox_test" type="combobox" x="147" y="60" width="163" height="16" property="test"> <condition action="enable">testcheckbox=1</condition> <condition action="disable">testcheckbox &lt;&gt; 1</condition> </control> <control type="checkbox" id="checkbox_test" width="105" height="17" x="158" y="172" text="test" checkboxvalue="1" property="testcheckbox" /> edit: for requirement, this. <control id="a

angularjs - ng-init not working to initialize data -

in angularjs, ng-init not working initialize data before executing template. example, index.html <div class="control-group"> <label class="control-label label-bold">shipping first name :</label> <div class="controls"> <input class="control-width" validation-errors="contactdata" maxlength="50" type="text" id="shipping_first_name" placeholder="first name" ng-model="contactdata.data.shopcustomer.shipping_first_name" ng-init="contactdata.data.shopcustomer.shipping_first_name='abc'"> </div> </div> how initial value in angularjs? here fiddle : http://jsfiddle.net/aasquare3/2xdvt/ working fiddle - abc shows in textbox/input. your fiddle wasn't including angular, added v1.0.3, , specified "no wrap - in <body>". the body tag did not hav

javascript - Fast way to organize hierarchical MySQL tables? -

i need create (and edit constantly) hierarchical database structure this: http://sqlfiddle.com/#!2/95654/3 so real structure looks this: a b c x y since need add/remove/edit items constantly, pain phpmyadmin, or queries. so there plugin javascript (ajax) , php, organizes kind of things drag & drop? or other easy way? thanks ! p.s.: know plugin cannot know item table's structure, need set parent relations ( hierarchy_table in example) quickly. can add items, , make them dom objects. need drag , drop parent relations. for example, can have div's objects contain data : <div class='item' data-id='2' data-title='b'/> and when drag div 'a', should insert or update hierarchy_table item_id = 2.

django - Custom Number Field is not executing "to_python"? -

i new django , python. in project using customfield defined me can encrypt data values before storing database , decrypt after retreiving (there need encryption in case). i have gone through git-repository / stackoverflow / google find answer question, there similar questions on stackoverflow none of them got issue. unable fix 2 days, need now. i have code defining customfield follows - def get_multiple_of_8(some_value): some_value = str(some_value) while(len(some_value) % 8 != 0): some_value = '0'+some_value return some_value def is_multiple_of_8(input_str): input_str = str(input_str) if(len(input_str) % 8 == 0): return true return false class customfield(models.field): '''to encrypt values in model''' __metaclass__ = models.subfieldbase def __init__(self, *args, **kwargs): self.key = myproject.settings.secret_key[:8] self.des = des.new(self.key, des.mode_ecb) kwargs['max_len

IIS 8, How do I give ASP.NET permission to write to a folder in Windows 8 -

i published mvc application local iis version 8. application needs write temp files local folder, e.g. d:\my mvc\temp. my application pool defaultapppool, identity applicationpoolidentity. i selected d:\my mvc\temp in windows explorer , add iis_iusers folder, , gives full control permission. tried add local service, network, network service read , write permissions. these not work well. but application still unable write file folder. questions how can let application write local folder , security reason giving iis_iusers permisstion practice? thank you. (moving comment answer sweet, sweet karma) i think problem identity anonymous requests using. iis anonymous authentication identity set to? might not set "application pool identity" causing problems

cordova - Audio file uploading to server using phonegap and receiving result in android -

i trying upload audio file server every alternate upload gets failed. e/filetransfer(10242): {"target":"http:\/\/abc:8080\/foldername\/foldername\/test.php?" , "source":"file:\/\/\/storage\/sdcard0\/voice.wav","code":3} e/filetransfer(10242): java.io.eofexception my code: var gotfilesystem = function(filesystem) { filesystem.root.getdirectory(dirname, { create : true }, function(datadir) { fileuri = datadir.fullpath; fileuri = fileuri + '/' + filename; var options = new fileuploadoptions(); options.filekey = "file"; options.filename = fileuri.substr(fileuri.lastindexof('/') + 1); options.mimetype = filemime; $.mobile.showpageloadingmsg(); var ft = new filetransfer(); ft.upload(fileuri, encodeuri(url), win, fail, options); $.mobile.hidepageloadingmsg(); }, dirfail); }; instead of getting directory (getdirectory) file directly using (getfile) method. var filepath = "myfolder/myfi

c# - Optimize WPF for large STL files -

i new wpf , wondering: there way optimize performance of wpf(c#) when working large meshes? have stl file read (~160000 triangles) , use instructions here . program workflow is: load stl file byte array read points , normals data byte array custom class point3d , vector3d variables use method similar "private model3dgroup createtrianglemodel()" load resulting model3dgroup of triangles in modelvisual3d model this.mainviewport.children.add(model); is there more direct way load points/normals/triangles/surfaces viewport avoid of steps? see same data reused in different structures. 1 structure passing same data next. *the biggest overhead in step 3. , concern when load 1000 triangles takes 458ms, 2000 takes 1280ms, 4000 - 4076ms , on geometrically progressing. other steps execute in flash. **i thought rendering biggest timespender, seems loading data points meshes models groups. basically have stlmodel holds array of stltriangles(a class containing 3 vertice p

java - Casting objects when returning a generics list -

i'm relatively new java , generics. i'm trying understand if i'm doing wrong or not in writing generic method. have following code (greatly simplified): public class contentiniter { public contenttype getcontenttype(); } public interface content { } public class show implements content { } public class movie implements content { } public enum contenttype { movie, show } public class channel { public list<show> getshows() { return getcontentbytype(contenttype.show) } public list<movie> getmovies() { return getcontentbytype(contenttype.movie) } private <t> list<t> getcontentbytype(contenttype contenttype) { list<t> typecontents = lists.newarraylist(); list<contentiniter> allcontentiniters = somemethod(); // returns initers both shows , movies (content contentiniter : allcontentiniters) { if (contentiniter.getcontenttype().equal

Anchor html speed with jquery -

i use code format anchor speed, doesn't work on ie (7,8,9 & 10) , firefox. can tell me doing wrong , how optimize anchor speed? $('a.anchorlinks').on('click', function(e){ e.preventdefault(); var divid = $(this).attr('href'); var position = $(divid).position(); $('body').animate({scrolltop: position.top}, 1000); }); instead of position, use offset() http://api.jquery.com/offset/

c++ - How to make std::get to be member method(s)? -

std::get link gets elements of tuple. overloaded function has number of versions. if have class derived tuple, , want introduce member method get() tuple elements using std::get. need write member method each version of std::get or can write one? template<class... args> class data : public std::tuple<args...> { public: typedef std::tuple<args...> tuplety; // 1 version. template<unsigned n> (typename std::tuple_element<n, tuplety>::type)& get() { return std::get<n>(*this); } };

android - Apportable conversion VerdeActivity error -

hi , in advance, i'm new apportable , i'm trying port ios app. can build app no error when try "load"(apportable load) or "debug" (apportable debug) on device or emulatior recieve message ".verdeactivity class not exists". i have read this question i'm having same problem after modifications. can me? here manifest <?xml version="1.0" encoding="utf-8"?> <!-- begin_include(manifest) --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="lallo" android:shareduserid="lallo" android:installlocation="auto" android:versioncode="1373630001" android:versionname="1.1.1"> <supports-gl-texture android:name="gl_oes_compressed_etc1_rgb8_texture" /> <uses-sdk android:minsdkversion="8" android:targetsdkversion="17" /> &l

xaml - Range slider control in windows phone 7 -

windows phone 7 - how implement range slider? following url wpf range slider example. want in wp7 ( http://www.thejoyofcode.com/creating_a_range_slider_in_wpf_and_other_cool_tips_and_tricks_for_usercontrols_.aspx ). have tried sample in wp7 application xaml code not working. i getting error : tag 'track' not exist in xaml namespace unfortunately did not succeed make wp7contrib rangeslider work. @ 1 time found source , needed improved. syncfusion essential studio windows phone contains range slider , can see solution infragistics . hope helps.

joomla - T3-Framework does not load variables.less -

i'm developing template using t3-framework. couldn't remember did change exactly, variables.less not loaded. can see when i'm inspecting <h1> tag, shows font-size: * 2 . means variable before * went missing , weirdly show that. does know how fix this? i'm assuming accidentally edit @import tag. i've searched tag , make sure points correct url, nothing changes. i found it. apparently file under t3-assets/dev folder did not generated due exhaustion in php resources. it works fine once regenerate files.

android - How to Create ksoap2 Request Object -

i struggling creating soap request following soap request: <?xml version="1.0"?> <soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapsdk1="http://www.w3.org/2001/xmlschema" xmlns:soapsdk2="http://www.w3.org/2001/xmlschema-instance" xmlns:soapsdk3="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/1999/xmlschema-instance" xmlns:xsd="http://www.w3.org/1999/xmlschema"> <soap-env:header/><soap-env:body><ns1:authenticate xmlns:ns1="urn:login" soap-env:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"> <msgstr xsi:type="xsd:string"><message messageid="0"> <entity name="ref_login"> <property name="login_cd" value="abc" type="string"/> <property name="p

javascript - Chaining animations smoothly for several elements in jQuery -

i'm trying recreate map's zoom-in effect animating sequentially several stacked images using jquery, cross-domain purposes. i achieved far, queueing animations using delays , 2 single animations (a & b logs) each image, in order generate smooth transitions between images zooming, , fading them on next one. $('img:not(:last-child)') /* images farest zoom */ .reverse() /* last first */ .each(function (index) { $(this).css( /* half size… */ { 'width': 584, 'height': 336, 'margin-left': -292, 'margin-top': -168 }); $(this).delay(index * 300).animate( /* …to actual size */ { 'width': 1168, 'height': 673, 'margin-left': -584, 'margin-top': -336 }, { duration: 300, easing: 'linear', done: function () { console.log('a:', index, new date().gettime() - timestamp); }

dom - DomXPath php omitting html elements -

this question has answer here: how innerhtml of domnode? 6 answers i'm trying keep parts of html elements inside dom loaded domdocument , curl. problem when xpath query , retireve nodevalue omits html elements. below code. there way retrieve html particular node? $location = $xpath->query("//div[@id='location']/label"); echo $location->item(0)->nodevalue."<br>"; $dom = new domdocument(); $dom->loadhtml('<html><div id="location"><label><h1>hello <b>world</b></h1></label></div></html>'); $xpath = new domxpath($dom); $location = $xpath->query("//div[@id='location']/label/*"); var_dump($dom->savexml($location->item(0))); output: string(27) "<h1>hello <b>world</b></h1>&q

sdk - Volume slider c# windows phone 7.1 -

i have problem slider volume in windows phone app 7.1 this xaml <slider name="volumeslider" verticalalignment="center" valuechanged="changemediavolume" minimum="0" maximum="1" value="0.5" margin="0,146,0,-27"/> and function changemediavolume private void changemediavolume(object sender, routedpropertychangedeventargs<double> args) { audioplayer.volume = (double)volumeslider.value; } if don't have lines it's ok... when in code debugger show error. a first chance exception of type 'system.windows.markup.xamlparseexception' occurred in system.windows.ni.dll if there handler exception, program may safely continued. probably what's wrong it. try changing line <slider name="volumeslider" ... to <slider x:name="volumeslider" ...

knockout.js - Unable to bind values after inserting table rows with jquery -

i have in html: <table class="datatable" id="cadatatable"> <thead> <tr> <th> type</th> <th> name</th> <th> adress</th> <th> id number</th> <th> contact</th> <th> note</th> </tr> </thead> <tbody> <tr> <td> <select name="catype" id="catype" data-bind="value: catype" style="width: 12em;"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select> </td> <!-- <td><input type="text" name="catype" data-bind="value: catype" style="width: 9em;"></td> -->

powershell - Disabled ActiveDirectory Users from specific date with exclude list -

i wrote script gonna disabled old users... , need exclude list it... exclude list should .csv, 3 columns "name","samaccountname","reason"... i'm kind of stuck exclude list filtering... tried -notmatch , -notcontains , nothing worked me... try foreach if same... function get-adlockoldusers { param () begin{ [datetime]$mydate = '01/01/1601 02:00:00' $colobj = @() $allusers = (get-aduser -filter * -properties lastlogontimestamp | ? {$_.enabled} | select-object name,samaccountname,@{n="lastlogon";e={[datetime]::fromfiletime($_.lastlogontimestamp)}}) $allusers = $allusers | ? {(get-date).adddays(-30) -gt $_.lastlogon -and -not ($_.lastlogon -eq $mydate)} } process { $allusers | % { $obj = new-object psobject $obj | add-member noteproperty 'name' $_.name -force $obj | add-member noteproperty 'samaccountname' $_.samaccountname -force $obj | add-member noteproperty 'l

In extjs4 How to select tpl's radio button on clicking its value -

i working in extjs4. have tpl view displaying questions , options via radio buttons as- ext.define('balaee.view.qb.qbqns.qbqnsview', { extend:'ext.view.view', id:'qbqnsviewid', alias:'widget.qbqnsview', store:'qb.qbqnsstore', cls:'qbqnsview', //autoscroll: true, config: { tpl:'<tpl for=".">'+ '<div id="main">'+ '</br>'+ '<b><id="q">{#}.{question}</b>'+ '<tpl for="options">'+ // interrogate kids property within data '<p>&nbsp&nbsp<input type="radio" name="{parent.questionid}" value="{optionid}">&nbsp{option}</p>'+ //'<p>&nbsp&nbsp<input

click - how to close the event of a target in jquery? -

i have several menu buttons in menu panel. each button opens css:box(100px 100px) now, when click on 1 box opens ,when click on other 1 want 1 open the former 1 close simultaneoulsy. $(document).ready(function(){ //this click anywhere function $(document).click(function(e) { var target = e.target; if (!$(target).is('li.faq')) { $('#faq_container').hide(); } }); }); is there general way can achieve ? instead of checking if element in class open , selectively closing? i have used $('html').click() function closes box before open it! create function resets menu state , call @ beginning of click handler. something like function clear(){ $('#faq_container').hide(); //hide else here } then clear() before open new css box.

Java vs JavaScript getters and setters methods -

sometimes when have object lots of attributes (for example 30-40) anoying write getter , setter methods in javascript this: function someobject( properties ) { // iterate through properties of object, , make sure // it's scoped. ( var in properties ) { (function(){ // create new getter property this[ "get" + ] = function() { return properties[i]; }; // create new setter property this[ "set" + ] = function(val) { properties[i] = val; }; })(); } } so wondering if possible in java? suppose if give class 30-40 getters/setters. how feel while using. don't think idea have 30-40 getter/setters in single class. rather break/distribute class subclassing properties the example gave javascript avery example. on how should access if many properties in single class. in javascript can tread object map. i apply same idea if have

ajax - While loop in CasperJS? -

i've got website ajax-loaded content. content showed in tabs, 20 items par page, ajax link load 20 following items. i'd run tests : "as long there link next page, click it, ... [do something]", proceed next page (loop) i can't know sure how many pages i'll have go through. is there simple way achieve ? (ie while loop in casperjs) thank much! one option be: casperjs-goto hope helps

javascript - how to measure in width of an HTML element? -

i want keep % width gap between 2 html elements. is there tool tell gap in % ? i checked measure tool ....but shows in pixel ...not in %. what solution ? edit: want keep td width in % ...not in pixel .....but confused how big width should set ..so visually want see width first , want put width in td. what should ? tool can on ? any firefox plugin can on ? have measure firefox plugin installed ...but shows width in pixel ....not in % i think gonna using jquery var element_w = $('.your_html_element').width() var page_w = $('body').width() var padding_w = e_w * 100 / page_w $('.your_html_element').css('padding-left',padding_w+'px')

PHP Check the file is opend before rename -

i have cleanup script, move xls files 1 place another. file moving process, have used rename function. script working fine. when xls file open, when try move xls, getting error can not rename sample.xls. add functionality like, check xls open before initiate rename function. i believe function call flock applicable txt file alone. how check xls file opened before call rename function. one simple thing try use flock acquire exclusive lock on file , if fails know file being used: <?php $fp = fopen('c:/your_file.xlsx', 'r+'); if(!flock($fp, lock_ex)) { echo 'file being used...'; exit(-1); } else { fclose($fp); // rename(...); } an alternative check existence of locking file excel creates when file being used: <?php $file = 'c:/testfile.xlsx'; $lock = 'c:/~$testfile.xlsx'; if (file_exists($lock)) { echo "excel $file locked."; } else { echo "excel $file free."; } the hidden

php - Issue Magento = insert elements and call function javascript -

if u see javascript don't edit because related magento. thank you! i have called phtml script under price box in product view page validation function phtml : <script type="text/javascript"> //<![cdata[ $$('#product-price-<?php echo mage::registry('current_product')->getid(); ?>').each (function(elem){ $(elem).hide(); }); $('product-price-<?php echo mage::registry('current_product')->getid(); ?>').show(); var cp = document.getelementbyid('product-price-<?php echo mage::registry('current_product')->getid(); ?>'); cp.innerhtml = '$&nbsp;<input type="text" class="input-text price" name="custom_price" style="width:auto;" value="<?php echo mage::registry('current_product')->getprice(); ?>" onchange="onchangecp(this);"/></span><input type="hidden"

c++ - Undefined reference to header file function -

i got error of c:\temp\hashtableproject\main.cpp|14| undefined reference hash::hash(std::string) know how solve problem? hash.h #include <iostream> #include <cstdlib> #include <string> using namespace std; #ifndef hash_h #define hash_h class hash{ public: int hash(string key); }; #endif // hash_h hash.cpp #include <iostream> #include <cstdlib> #include <string> #include "hash.h" using namespace std; int hash::hash(string key){ //int hash = 0; int index; index = key.length(); return index; } main.cpp #include <iostream> #include <cstdlib> #include <string> #include "hash.h" using namespace std; int main() { int index; hash hashob; string traget = "testing"; index = hashob.hash(traget); cout << index << endl; return 0; } im using codeblock 13.12 there main.o file in obj folder. dont know why hash.o isn't there.

r - How to compute (some) landscape fragmentation index -

i working rasters of forests , need compute (some) fragmentation index. i looking "single-value" index each raster. first try in qgis desirable plugin ( lecos – land cover analytics ) damaged. tried in r , in imagej can not find suitable package/plugin or function. running out of options. can please recomend software (linux preffered)?

c# - How to share data between SpecFlow beforetestrun and aftertestrun hooks? -

we have scenariocontext , featurecontext share data between scenarios , features there way share data between beforetestrun , aftertestrun? i trying kill open browser processes @ end of test run described in question . i have browser.quit() in afterscenario , afterfeature still processes remain running hoping kill in aftertestrun hook. there no way share data between beforetestrun , aftertestrun hooks. however regarding: i have browser.quit() in afterscenario , afterfeature still processes remain running hoping kill in aftertestrun hook. you can use code in question referred to, kill lingering processes; if know processes need killed can iterate through these known process verify have been killed, , if haven't can proceed kill them.

django cms - python manage.py runserver 127.0.0.1:80 -

traceback (most recent call last): file "manage.py", line 28, in <module> execute_from_command_line(sys.argv) file "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 443, in execute_from_command_line utility.execute() file "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 382, in execute self.fetch_command(subcommand).run_from_argv(self.argv) file "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 196, in run_from_argv self.execute(*args, **options.__dict__) file "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 231, in execute self.validate() file "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 266, in validate num_errors = get_validation_errors(s, app) file "/usr/local/lib/python2.7/dist-packages/django/core/management/validati

html - post form data and show in server -

i have simple form, want see fields sent server. in server side, <input type="text"> field value. why server can't <select> , <input type="file" /> value? html: <form action="http://localhost:8100/" method="post"> <div> <select> <option value="op1" selected="selected">option1</option> <option value="op2">option2</option> </select> </div> <div> <input type="file" value="select file"/> </div> <div> <label>your hero: </label><input type="text" name="hero" /> </div> <input type="submit" value="submit" /> </form> server: var http = require("http"); http.createserv

javascript - Radio button automatic change the data in php -

Image
i new php keeping 2 radio buttons 1 checked default when page loaded content should displayed radiobutton based content default i think understand, <?php $sex='male'; ?> <input type="radio" name="sex" value="male" <?php if($sex=='male') echo 'checked="checked"'; ?>>male<br> <input type="radio" name="sex" value="female" <?php if($sex=='female') echo 'checked="checked"'; ?>>female output

html - Parsing the Javascript content -

i have javascript code text, after parsing html file, , want "currencycode":"eur" out of strings, eur value, way can achieve it? regex ? thank $(document).ready(function() { $('#book-simple').prepend('<div id="spinnercontainer" style="color: #224477;margin:5px 0 15px;text-align:center;"><img src="/img/spinner2.gif" />&nbsp;cargando pol&iacute;ticas...</div>') $.post( 'bridget.php', { f: 'policies', h: '010', d: '[{"rateplanid":"bar","rateplancode":"bar-sa","rateplantype":"bar","roomtypecode":"wstd","expiredate":"2014-03-22","effectivedate":"2014-03-21","sources":[{"ratesource":"bar","expiredate":"2014-03-21","effectivedate":"

xpath - Not able to hit the image element which works as a button in ui? -

i newbee selenium webdriver using python below configuration: selenium webdriver: selenium-2.40.0(python bindings) python version : python 2.7 os : windows i have tried hitting mentioned control through xpath , css selector in script unable hit control.i crosschecked in xpath viewer xpath, showing there .i tried hit control css selector not hitting it.i able access other controls there on webpage using css selector , xpath .i have attached html code xpath , css selector syntax using in code. the xpath using script : find_element_by_xpath("//img[@title='expand all' , @alt='expand all']") the css selector using in script : find_element_by_css_selector("a[class='lnk1'][onclick*='treetable(expandall)']") <table width="" cellspacing="0" cellpadding="0" border="0" role="presentation"> <tbody> <tr> <td width=""> <a c

boolean - Java: Use String as part of source code -

this question has answer here: boolean expression evaluation in java 10 answers today have question had on mind years now. consider have following evaluation in java: new evaluationlistener(){ public boolean evaluate(boolean[] b){ return b[0] || b[1]; } } i using code in program evaluating terms of different boolean values of b[0] , b[1], doesn't matter @ here. at moment writing evaluations source code, let program run , watch result in command line. now wondering how implement evaluation command line. able enter evaluation term command line, read bufferedreader etc. instead of writing source code. is there way so? thought possible using sort of variable aliases $b0$. how can pass logical or , and , not program? thanks answer here's example of expression evaluation java's script api: scriptenginemanager scriptengi

c# - Change DateTimePicker Format different from Windows Format -

i have done system contains lot of forms use datetimepicker. need publish in country different date format mine. did search , found property can put custom format. don't want seek system datetimepicker put property. is there better way this? if want force specific format datetimepicker objects have, have no choice other going through them , setting values of datetimepicker.format , datetimepicker.customformat . reason limitation objects totally independent. no change on specific object affect object (unless expressed in logic flow). you might want create global application variable , reference in existing datetimepicker objects. 1 time action. later on able change value of global variable reflected in existing objects. i assume (out of question title) know default format of windows, or more of culture configuration on host machine. deploying country mean deploying host running other culture configurations (which automatically reflected datetimepicker objects

http - RESTful advice: default value for given resource -

i have following rest structure 'keyboard' objects: get /keyboards/ -> lists user keyboards post /keyboards/ -> creates new keyboard /keyboards/{id} -> specific keyboard id put /keyboards/{id} -> update specific keyboard id delete /keyboards/{id} -> delete specific keyboard id the front end uses whatever keyboard set users default keyboard, or, if user has no custom keyboard set, returns generic default. at present, done requesting url: get /keyboards/default however, appears little misleading me, resource 'default' change whenever user changes default, , pointer different specific resource. i'm not sure of more elegant solution this, front-end appear need make 2 requests otherwise: get /keyboards/ -> revealing default /keyboards/{id} -> mappings associated keyboard which seems more laborious, 2 step process. first option reasonable one, or missing more elegant implementation?

linux - Exclude list of files from find -

if have list of filenames in text file want exclude when run find , how can that? example, want like: find /dir -name "*.gz" -exclude_from skip_files and .gz files in /dir except files listed in skip_files. find has no -exclude_from flag. how can skip files in skip_files ? i don't think find has option this, build command using printf , exclude list: find /dir -name "*.gz" $(printf "! -name %s " $(cat skip_files)) which same doing: find /dir -name "*.gz" ! -name first_skip ! -name second_skip .... etc alternatively can pipe find grep : find /dir -name "*.gz" | grep -vff skip_files

android - How to create a valid DateTime object from String -

i have following string. 21-mar-2014 how can convert valid joda datetime object? i've tried following no joy: datetimeformatter formatter = datetimeformat.forpattern("d-mmm/y"); datetime dt = formatter.parsedatetime(date); thanks in advance matt a genuine joda answer corrected pattern string , explicit locale : string input = "21-mar-2014"; datetimeformatter dtf = datetimeformat.forpattern("dd-mmm-yyyy").withlocale(locale.english); datetime dt = dtf.parsedatetime(input); // using default time zone system.out.println(dt); // 2014-03-21t00:00:00.000+01:00 (my zone: europe/berlin) if don't need time part (regarding input!) recommend use: localdate date = dtf.parselocaldate(input);

c++ - Error: cannot call constructor -

i have included new module ns2 evaluation of video transmission. have make changes required files agent.h ,agent.cc, makefile , on. during make getting stuck error. error is: myevalvid/myudp.cc: in member function ‘virtual void myudpagent::sendmsg(int, appdata*, const char*)’: myevalvid/myudp.cc:56:123: warning: format ‘%d’ expects argument of type ‘int’, argument 4 has type ‘long unsigned int’ [-wformat] myevalvid/myudp.cc:78:123: warning: format ‘%d’ expects argument of type ‘int’, argument 4 has type ‘long unsigned int’ [-wformat] make: *** no rule make target `myevalvid/myevalvid_sink.o ', needed `ns'. stop. the code is #include "myudp.h" #include "rtp.h" #include "random.h" #include "address.h" #include "ip.h" static class myudpagentclass : public tclclass { public: myudpagentclass() : tclclass("agent/myudp") {} tclobject* create(int, const char*const*) { return (new myudpagent());