Posts

Showing posts from April, 2012

javascript - grab a youtube playlist from a url -

i using function fetches video based on video id. how fetch playlist url . function use fetch video based on id : var ytid = url.match("[\\?&]v=([^&#]*)"); here playlist: http://www.youtube.com/playlist?list=pl1w1q3fl4pmhqxjaomvwqwf6qsnjtrn-3 this playlist (at lease me): http://www.youtube.com/course?category=university%2fengineering&feature=edu&list=ec6f144cf03cb2381b the list id of both can parsed little modification of regex: var listid = url.match("[\\?&]list=([^&#]*)");

c# - Why we should use ToString method with StringBuilder? -

msdn says need convert stringbuilder object string , stringbuilder works fine? why should convert? string[] spellings = { "hi", "hiii", "hiae" }; stringbuilder builder = new stringbuilder(); int counter = 1; foreach (string value in spellings) { builder.appendformat("({0}) right spelling? {1}", counter, value); builder.appendline(); counter++; } console.writeline(builder); // works //why should use tostring below console.writeline(builder.tostring()); // make difference in above 2 ways. console.readline(); these 2 calls use different console.writeline overloads: writeline(object) , writeline(string) . and writeline(object) overload calls "... tostring method of value called produce string representation, , resulting string written standard output stream." ( msdn ) edit the difference here can see is: stringbuilder sb = null; console.writeline(sb); // prints terminator console.writeline(sb.tos...

java - How a sleeping thread can send interrupt to itself? -

i reading java threads. looking sleep() method. books states that when thread encounters sleep call, must go sleep specified amount of time, unless interrupted before wake-up time. i reading interrupts, how can thread send interrupt itself? think thread can send interrupt? understanding correct? additionally, both of threads, 1 send interrupt should having same target runnable? if suppose thread interrupted, go runnable state? sorry, if sounding stupid, it's pretty new me. thanks a thread can't interrupt while sleeping, because is... sleeping. a picture worth thousand words here simple example thread starts sleeping , main thread interrupts it: public static void main(string[] args) throws exception { runnable sleeper = new runnable() { public void run() { try { system.out.println("sleeper going sleep"); thread.sleep(1000); system.out.println("sleeper awake...

performance - Android target-version advantages -

i first wrote android app targeted version 2.2. later got android 4.1.2 device. i upgraded target , minimum 4.1.2. 1 advantage new runtime exception networkonmainthreadexception, causes app crash instead of having non-responsive gui. advantages when developing. however, there other advantages, besides @ developement time? instance, can 4.1.2 device run 4.1.2 app faster 2.2 app? the main advantage when target newer version of android able access new goodies such new apis , services app can make use of. functionality may improved improve performance or fix bugs. regarding app run faster 4.1.2 2.2 app, not necessarily, dependant on android os , not app. example, 4.3 release , has many speed improvements 4.2. if target app 4.2 run on 4.3, app run faster due 4.3 having speed improvements. if targeted app 4.3 there little difference in performance. hope helps.

java - IWAB0014E Unexpected exception occurred when traying create webservice for given WSDL:Proxy Authorization Required -

i created dynamic web project imported wsdl file webcontent of project i go file-> new-> webservice-> webservice i adjusted settings accordingly, after finsihing throwing follwing error; java.lang.illegalargumentexception: char '0x0' after 'return code: 407 <head><title>proxy authorization required</title></head> <body bgcolor="white" fgcolor="black"><h1>proxy authorization required</h1><hr> <font face="helvetica,arial"><b> description: authorization required access proxy</b></font> <hr> <!-- default "proxy authorization required" response (407) --> </body> ' not valid xml character. @ org.apache.axis.components.encoding.abstractxmlencode(abstractxmlencoder.java:110) this happening because of improper setup of axis2. steps: download axis2 : link--> http://ws.apache.org/axis2/download.cgi point axis2 run...

How do I use a Git submodule with a Composer loaded library? -

i have zend framework 2 application. contains library code containing business logic , other utilities common other applications created later. my intention share across projects using composer. question is, how do , streamline development? need make changes , additions library, within other project. i tried setting vendor/stuff git submodule containing package needed, , referencing in primary composer.json (ref) : "repositories": [ { "type": "git", "url": "vendor/stuff" } ], "require": { "stuff/library": "master" }, composer isn't able load in way. complains package not found, presumably because it's ignoring fact url both local , relative. technically, doesn't need to; vendor/stuff folder initialised separately through git submodule commands. unfortunately* composer doesn't support git submodules, main aim of composer provide similar inter...

css - Centered and fixed navigation -

i have css below, makes navigation bar centered. however, want add following line "position:fixed", if so, navigation bar no longer centered, , no longer have border lines stretched across screen. any suggestions ? (thanks !) .navbar{ border:1px solid #ccc; border-width:1px 0; list-style:none; margin:0; padding:0; text-align:center; } .navbar li{ display:inline; } .navbar a{ display:inline-block; padding:10px; } body { padding-left: 0em; padding-bottom: 0em; color: white; background-color: #708090; font-family: georgia, times, serif} html <nav> <ul> <li><a href="#">first nav item</a></li> <li><a href="#">second nav item</a></li> <li><a href="#">third nav item</a></li> </ul> </nav> css nav { position: fixed; top:0; left:0; width:100%; height:40px; ...

java - Zlib compression is too big in size -

i new java, have decided learn doing small project in it. need compress string using zlib , write file. however, file turn out big in size. here code example: string input = "yasar\0yasar"; // test input. input have null character in it. byte[] compressed = new byte[100]; // hold compressed content deflater compresser = new deflater(); compresser.setinput(input.getbytes()); compresser.finish(); compresser.deflate(compressed); file test_file = new file(system.getproperty("user.dir"), "test_file"); try { if (!test_file.exists()) { test_file.createnewfile(); } try (fileoutputstream fos = new fileoutputstream(test_file)) { fos.write(compressed); } } catch (ioexception e) { e.printstacktrace(); } this write 1 kilobytes file, while file should @ 11 bytes (because content 11 bytes here.). think problem in way initialize byte array compressed 100 bytes, don't know how big compreesed data in advance. doing wrong her...

c# - How can I solve datagrid showing in WPF? -

i'm trying add data table datagrid on wpf (c#) when columns become more 29, datagrid not show values of other columns. me in problem? thank you dtgrresult.itemssource = tbl_main.asdataview(); set horizontalscrollbarvisibility attribute of datagrid visible or auto , make sure each of columns' frozen attribute set false . hope works you.

c# 4.0 - Retrieving .Net managed exception system error code -

when pinvoke native methods such regqueryinfokeyex in advapi32.dll methods return system error code, incredibly useful me. there anyway can retrieve error code .net managed exception? i understand hresult property contains value have no idea how extract it. any ideas? thanks

java - How to put a particular thread to sleep()? -

i reading sleep() method of threads. tried develop small example. have 2 confusions regarding example. /** * created intellij idea. * user: ben * date: 8/7/13 * time: 2:48 pm * change template use file | settings | file templates. */ class sleeprunnable implements runnable{ public void run() { for(int =0 ; < 100 ; i++){ system.out.println("running: " + thread.currentthread().getname()); } try { thread.sleep(500); } catch(interruptedexception e) { system.out.println(thread.currentthread().getname() +" have been interrupted"); } } } public class threadsleeptest { public static void main(string[] args){ runnable runnable = new sleeprunnable(); thread t1 = new thread(runnable); thread t2 = new thread(runnable); thread t3 = new thread(runnable); t1.setname("ben"); t2.setname("rish"); t3.setname("mom"); t1.start(); t2.start(); t3.start()...

ccavenue api integration with codeigniter -

i quite new codeigniter , developing ecommerce application flipkart using codeigniter , want integrate ccavenue payment gateway our website , have referred many sites regarding couldnt able proper solution. please me out , provide me ccavenue api documentation. , havent got codeigniter code integrating ccavenue , have gone through below url http://integrate-payment-gateway.blogspot.in/2012/01/ccavenue-payment-integration-php.html continue integration of ccavenue.but dont know how parse php script codeigniter. here can documentation. http://world.ccavenue.com/downloads/ccavenueworldintegrationmanual.pdf and can code ccavenue account. ask ccavenue account holder send code zip folder contains 3 languages code , have go php folder. ask following integration kit: login ccavenue account , click on link download kit. find within "how set ccavenue account?". working key: go settings , option links in top menu , click on generate working key link. , select a...

Activate screen when hitting enter C# -

i have login screen , want activate when press enter in password textbox. problem though works, when close form app acts enter still pressed , form opens in endless loop. here code: private void textbox2_textchanged(object sender, eventargs e) { textbox2.keydown += new keyeventhandler(textbox2_keydown); } public void textbox2_keydown(object sender, keyeventargs e) { if (user == username[1] && pass == passwords[1]) { messagebox.show("login successfull", "welcome, hr"); updatedbform newemployee = new updatedbform(); this.hide(); newemployee.showdialog(); return; } } how tdo solve problem? thanks. you assigning keydown -eventhandler everytime text changes: private void textbox2_textchanged(object sender, eventargs e) { textbox2.keydown += new keyeventh...

python - Flask: How to pass all GET parameters to redirect? -

i this: return redirect(app.config['fb_app_url'], request.args) but exception: attributeerror: 'immutablemultidict' object has no attribute 'split' is there easier way achieve or have loop through request.args ? thanks update: going paolo 's solution, solution worked me. params = urlparse(request.url).query return redirect(app.config['fb_app_url']+"?"+params) your code wrong cause second parameter redirect httpcode (301, 302, ecc). you can use url_for create full url, like: full_url = url_for('.index', **request.args) return redirect(full_url)

php - Creation of new objects slows down? -

i searching why script slows down growing number of objects. not find error on side. script creating objects. i've disabled possible variables. for ($i = 0; $i < $ilen; $i++) { $row = db_row($res, $i); echo str_replace(" ", "&nbsp;", str_pad("obj" . $i, 10)); $time = microtime(true); $element = new datastructureelement($row['code']); echo "new: " . number_format((microtime(true) - $time) * 1000, 1) . "ms\n"; } class datastructureelement { ... function __construct($code, $recover = false) { $time = microtime(true); parent::__construct(); $this->code = $code = enc::seourl($code); $this->key = 'element:' . $code; if ($recover) $this->recover(); $this->properties = new datastructureproperties($code); $this->rules = new datastructurepropertiesrules($code); $this->searchindex = new datasearchindexelement($code); $this->searchgr...

sql server 2008 - How to build a database that contain only the delta from yesterday -

i need know has been changed on database since last night. possible extract data ldf file , build new database contains delta? for example, let have table users , now, new user added , 1 of users update home address. need able build new database users table contain 2 records 1. new user (and add new column know if it’s new or update field) 2. user update record (it nice know record has been update)? btw, have sql servers can use (2008 , 2012) thanks in advance. i suggest @ "change data capture" feature: http://technet.microsoft.com/en-us/library/cc645937.aspx this feature available sql server enterprise edition. or try codeplex project sql server standard edition: https://standardeditioncdc.codeplex.com/

ruby on rails - Cheap SSL certification for an app hosted on Heroku -

i have rails app on heroku , need add there ssl certificate. in heroku add-ons section see possible buy on heroku add-on, price $20/month, $240 , cannot afford @ moment. is there cheaper way ssl heroku app? we've installed our ssl certificate on digitalocean.com instance running nginx reverse proxy. trade-offs include bump in latency , paying bandwidth overages haven't been issues us. here basic nginx config similar ours: server { listen 80; rewrite ^ https://www.example.com$request_uri? permanent; } # https server server { listen 443; ssl on; ssl_certificate /root/example.crt; ssl_certificate_key /root/example.key; ssl_session_timeout 5m; ssl_protocols sslv3 tlsv1; ssl_ciphers all:!adh:!export56:rc4+rsa:+high:+medium:+low:+sslv3:+exp; ssl_prefer_server_ciphers on; location / { proxy_pass https://example.herokuapp.com/; } } this basic example , made little more secure (possibly forcing ssl in ...

restructuredtext - Indent block selection in notepad++ (starting at other position than first character) -

i writing documentation in restructuredtext format. prettify things using lot tables , here might know indentation becomes important - , annoying edit. need keep first words of each line are, need indent words in second column line up. i can use alt + drag select block, how can indent this? save lot of time not having go each line tab or space everything. example: ================================ ============ xpath meaning ================================ ============ /div/a fetch a-tags in /div tags //a fetch every a-tag ./@href fetch href attribute of current tag ./text() fetch text held current tag desired result: ================================ ============ xpath meaning ================================ ============ /div/a fetch a-tags in /div tags //a fetch every a-tag ./@href ...

php - Highcharts export (PhantomJS) to server does not show words -

Image
i have tried export picture of pie chart server, can't see labels or titles. have tested options.json file in server @ http://export.highcharts.com/demo , worked fine. options contant: { series: [{ type: 'pie', data: [ ['one', 80.0], ['two', 10], ['three', 10], ] }], title: { text: 'the title', style: { color: '#333' } } } and how output looks: i'm not sure, looks have install specific fonts on server. export- server cannot find them. linux, place fonts in /usr/share/fonts , run commandline: $prompt> fc-cache -fv to refresh font cache on system.

jquery - Populating Kendo Read datasource -

i cannot scheduler populate data being pulled outside function. kendo ui. cant calendar show of appoinments being pulled database. have ideas? thanks $(function () { $("#scheduler").kendoscheduler({ date: new date("2013/6/13"), starttime: new date("2013/6/13 07:00 am"), height: 600, views: [ "day", { type: "week", selected: true }, "month", "agenda" ], timezone: "etc/utc", datasource: { batch: true, transport: { read: { url: "/team/calendar/populatecalendar/", datatype: "json", }, update: { url: "http://demos.kendoui.com/service/tasks/update", ...

c# - Regex, match string ending with ) and ignore any () inbetween -

this question has answer here: using regex balance match parenthesis 4 answers i want select part of string, problem last character want select can have multiple occurrences. i want select 'aggregate(' , end @ matching ')' , () in between can ignored. examples: string: substr(aggregate(subquery, sum, [model].remark * [object].shortname + 10), 0, 1) should return: aggregate(subquery, sum, [model].remark * [object].shortname + 10) string: substr(aggregate(subquery, sum, [model].remark * ([object].shortname + 10)), 0, 1) should return: aggregate(subquery, sum, [model].remark * ([object].shortname + 10)) string: substr(aggregate(subquery, sum, ([model].remark) * ([object].shortname + 10) ), 0, 1) should return: aggregate(subquery, sum, ([model].remark) * ([object].shortname + 10) ) is there way solve regular expres...

path - PHP - Correct way to define Site_Root and App_Root -

i have these 2 constants defined: define( 'site_root',$_server['document_root'] . '/' ); define( 'app_root', str_replace('\\', '/', dirname(dirname(__file__))) . '/' ); my folder structure this: site_root (exampledomain.com) - docs - tests - app - assets - libs - core if use : $appassets = app_root.'assets/css/'.$filename.'.css'; it echos path as: http://exampledomain.com/var/www/app/assets/css/core.css how can rid of var/www/ bit echoed path? i want value of 'site_root' ' http://exampledomain.com/ ' and value of 'app_root' ' http://exampledomain.com/app/ ' how can achieve this? define( 'app_root', '/app/'); if really need constant this

c# - Bitmap Image on Border not updating in UI -

i have wpf application images downloaded threadpool.queueuserworkitem(). in ui, have dispatchertimer, checks folder images supposed cached, , if found, suppose show them backgrounds 2 border elements , button element. i can see files getting downloaded filepath , can step through code creates bitmapimage object, not see rendered on screen. the relevant code pasted below.. <border x:name="leftimage" borderbrush="transparent" borderthickness="0" horizontalalignment="left" height="220" verticalalignment="top" width="99"> <button template="{staticresource leftarrow}" width="20" height="20" horizontalalignment="left" margin="10,0,0,0" /> </border> <border x:name="rightimage" borderbrush="transparent" bordert...

how to upload file into googlecloud through java -

i want upload file bucket in google cloud storage api. when run servelet class deployed , shows output in browser " see here file content, have uploaded on storage.. file uploading done" . but problem servelet class not establish connection google cloud storage.and file not uploaded bucket.once check the code , give suggestion how connect bucket source code. public class testcloudstorageservlet extends httpservlet{ private static final long serialversionuid = 1l; private storageservice storage = new storageservice(); private static final int buffer_size = 1024 * 1024; private static final logger log = logger.getlogger(testcloudstorageservlet.class.getname()); @override public void dopost(httpservletrequest req, httpservletresponse resp) throws ioexception { log.info(this.getservletinfo()+" servlets called...."); resp.setcontenttype("text/plain"); resp.getwriter().println("now see here file content, have uploade...

javascript - Waiting for models to load before rendering app in Ember.js -

i have number of different application-level models — i.e., current user, current account, etc. — want load before rendering application. how , should done? this question/answer helped lot, doesn't cover async aspect. the following code accomplishes want, loading models in beforemodel (to take advantage of waiting promise resolve) doesn't seem right. should loading these models in applicationroute ? app.applicationcontroller = ember.controller.extend({ currentaccount: null }); app.applicationroute = ember.route.extend({ beforemodel: function () { var self = this; return app.account.find(...).then(function (account) { self.controllerfor('application').set('currentaccount', account); }); } }); thanks help! the trick return promise route's model method. cause router transition app.loadingroute route, until promise resolves (which can used loading indication bars/wheels etc.) when promise resolves, app.loadingrout...

php - Codeigniter Form Dropdown Error After Validation -

i'm trying adapt form_dropdown form in codeigniter. when i'm adding new page, doesn't show errors in parent dropdown section, after form validation, instance if user forgets enter title label, if empty or, after validation gives foreach error in dropdown section. i've read that, second variable must array , on form_dropdown. mine array , not giving errors in page before validation. can't figure problem out. a php error encountered severity: warning message: invalid argument supplied foreach() filename: helpers/form_helper.php line number: 331 my_controller : class my_controller extends ci_controller{ public $data = array(); function __construct(){ parent::__construct(); } } admin controller : class admin_controller extends my_controller{ function __construct(){ parent::__construct(); $this->data['meta_title'] = 'my website control panel'; $this->load->helper('form'); $this->load->library(...

xml - Output the difference in character XSLT -

i have 2 variables $word1 , $word2 , values are: $word1 = 'america' $word2 = 'american' now using xslt have compare both variables , output difference in character. for example output has 'n'. how in xslt 1.0 ?? i found function called index-of-string in xslt 2.0!! depends on mean 'difference'. check if $word2 starts $word1 , return remaining part can do: substring-after($word2,$word1) that returns 'n' in example. if need check if $word1 appears anywhere within $word2 - , return parts of $word2 before/after $word1 have use recursive template: <xsl:template name="substring-before-after"> <xsl:param name="prefix"/> <xsl:param name="str1"/> <xsl:param name="str2"/> <xsl:choose> <xsl:when test="string-length($str1)>=string-length($str2)"> <xsl:choose> <xsl:when test="substring($str1,1,s...

ember.js - Updating a property is not visible in the DOM -

i have following drop-downs: {{view settingsapp.select2selectview id="country-id" contentbinding=currentcountries optionvaluepath="content.code" optionlabelpath="content.withflag" selectionbinding=selectedcountry prompt="select country ..."}} ... {{view settingsapp.select2selectview id="city-id" contentbinding=currentcities selectionbinding=selectedcity prompt="select city ..."}} the bound properties defined in controller: settingsapp.serviceseditcontroller = settingsapp.baseeditcontroller.extend(settingsapp.servicesmixin, { needs : ['servicesindex'], selectedcountry : null, selectedcity : null, currentcountries : null, currentcities : null, init : function () { this._super(); }, setupcontroller : function (entry) { this._super(entry); var locator = settingsapp.locators.getlocator(this.get(...

jquery - AJAX - cart Magento totals and items in cart -

i'm working on ajax cart magento. i'm not interested in extensions, cart has author made, it's custom. can tell me what's best way acquire such info grand item total in cart , number of items? in fastest , relevant way. i can create external php file gather info user's session , ajax script gonna display on header every time when user adds or deletes product. i can think of that's not best solution. is there api, or what's best way this? thanks, adam if referring mini-cart of sorts, have accomplished on multiple projects using below code: <?php // gets current session of user mage::getsingleton('core/session', array('name'=>'frontend')); // loads products in current users cart $items = mage::getsingleton('checkout/session')->getquote()->getallvisibleitems(); // counts total number of items in cart $totalitems = count($items); // can loop through products, , load them attributes fo...

NoClassDefFoundError when hudson runs a maven project -

i have project running tests. it's maven project uses selenium. runs correctly when launched locally, hudson platform, throws noclassdeffounderror: parsing poms [elsevier-selenium] $ "c:\program files\java\jdk1.7.0_25/bin/java" -xmx1024m -cp e:\hudson\plugins\maven-plugin\web-inf\lib\maven-agent-1.353.jar;e:\maven\boot\classworlds-1.1.jar hudson.maven.agent.main e:\maven e:\hudson\war\web-inf\lib\remoting-1.353.jar e:\hudson\plugins\maven-plugin\web-inf\lib\maven-interceptor-1.353.jar 1753 e:\hudson\plugins\maven-plugin\web-inf\lib\maven2.1-interceptor-1.2.jar <===[hudson remoting capacity]===>channel started executing maven: -b -f e:\hudson\jobs\tests-selenium\workspace\elsevier-selenium\pom.xml integration-test [info] scanning projects... [info] ------------------------------------------------------------------------ [info] building selenium-elsevier [info] task-segment: [integration-test] [info] ----------------------------------------------------------...

javascript - Return value from deferred nested function -

i'm writing caching function loads invisible content dom div sizes can calculated correctly (including images). using jquery's deferred object run function once caching complete. the problem having can't work out how return props object once caching function complete. return props @ bottom want return properties object, it's returning undefined _obj function hasn't completed time return called. my complete function near bottom correctly logging props object (inc cacheheight var), can't work out how return props object deferred function. i'd return _obj(content).done(complete); , returns deferred object, not return complete function. cache : function(content) { // vars var props; // deferred switch var r = $.deferred(); /* * cache object */ var _obj = function(content) { cacheheight = 0; cache = document.createelement("div"); cac...

d3.js - What Is Causing D3 To Not Work Properly In IE10? -

i working on large codebase , have been cross-browser testing. works, including ie9, except ie10. it uses d3 create timeline line current date, line selected date , rectangles ranges. problem nothing being created, cannot post code since big. ideas? worked out posted question. the latest versions of d3 require .insert have parametres, using one. fix have decided change .append since not change performance , still has 1 parameter. not sure why ie10 picks though.

JGraphX: How can I get a vertex by mouse coordinates? (mouseMoved method) -

i have mousemoved(mouseevent e) method coordinates e.getx() , e.gety(). want check if mouse on vertex. there way this? i don't want check if cell (vertex) selected, want check if mouse on 1 vertex. mgraph = new mxgraph(); // create vertexes ... mgraphcomponent = new mxgraphcomponent(mgraph); //mgraphcomponent.getgraphcontrol().addmousemotionlistener(new mouseadapter() { mgraphcomponent.getgraphcontrol().addmousemotionlistener(new mxmouseadapter() { @override public void mousemoved(mouseevent e) { system.out.println(integer.tostring(e.getx()) + " " + integer.tostring(e.gety())); // here want check if mouse position on cell // want check if mouse on 1 (or more?) cells } } ); mpanel.add(mgraphcomponent); you can so: object cell = mgraphcomponent.getcellat(e.getx(), e.gety(), false); cell should mxcell , can use model.isvertex() or model.isedge() .

multithreading - Qt signal and slot issue -

i have issue signals , slots, want use backgroundworker thread. suppose send signal few double values should updated in main gui. code compiles , thread starts gui not updating values. first gui slot: void mainwindow::slot_set_values(double ptm_temp, double ptm_hv, double heat_temp, double nomtemp, double current, double voltage) { ui->pmtvaluelabel->settext(qstring::number(ptm_temp)); ui->hvvaluelabel->settext(qstring::number(ptm_hv)); ui->heatvaluelabel->settext(qstring::number(heat_temp)); ui->nomvaluelabel->settext(qstring::number(nomtemp)); ui->currenvaluelabel->settext(qstring::number(current)); ui->vvaluelabel->settext(qstring::number(voltage)); } the worker code: void dworker::run() { qsrand(qdatetime::currentdatetime().totime_t()); mdata.set_pmt_temp(qrand()%100); mdata.set_pmt_hv(qrand()%100); mdata.set_heat_opt_temp(qrand()%100); mdata.set_heat_nominal_temp(qrand()%100); (int = ...

javascript - magic jquery image uploading? -

i'm trying make else's code work ipad (and other mobile devices). 1 of things works on desktop fails on ipad clicking 'import image' button. on desktop, opens dialogue box you'd expect , allows select image, on ipad clicking 'import image' nothing. the code can find called in response clicking button follows: var clickimport = function() { //breakpoint here hits when write "var test=9;" , 'import image' clicked }; nothing happens in function. when step past end of function goes straight jquery.js, appears open dialogue box. all image handling file reader happens after click 'ok' in dialogue box. problem can't dialogue box open @ on ipad. there's no " <input type='file'> " sort of thing in html either. does know how working?? or how function on mobile devices? thanks!

java - Why can't I use the selenium.(etc...) library? -

when try use selenium. library perform commands, don't work. i've imported import com.thoughtworks.selenium.*; library java: can't find symbol error. selenium.open("http://google.com/"); string alllinks[]=selenium.getalllinks(); for(int i=0;i<alllinks.length;i++){ selenium.click(alllinks[i]); thread.sleep(3000);

Creating a list using HTML or SVG that looks like the attached image -

Image
how can create this: i don't want use absolute positioning, need modular , easy use. googled have no clue search for. before down voting, attempt see if that's possible create using html. searched clueless i don't have time work out, figured point right way. disclaimers: have errors in - haven't tested or , i've been working in other languages recently. , first post. anyway, i'd use javascript make this. jquery, can make them move little. make simple link list in html: <ul class="radiallinks"> <li class="firefox"><a href="firefox.com">firefox.com</a></li> <li><a href="#">link2</a></li> <li><a href="#">link3</a></li> <li><a href="#">link4</a></li> <li class="active"><a href="#">link5</a></li> <li><a hr...

Sharing session value between two different asp.net solutions using "SQL Server" mode -

i testing. created text box , button in first asp.net application , on button event stored value of text box in session got stored in database. now created asp.net application text box. want call value of text box in first asp.net application. how it? i have read theoretical application. if write down code it, great help. i have used <mode="sqlserver" sqlconnectionstring="data source=.;integrated security=true"> in web.config. i have created aspstate database in sql server 2008 r2. protected void button1_click(object sender, eventargs e) { session["mydb"] = textbox1.text; } i storing value of textbox this. getting stored in database under table "aspstatetempsessions" in encrypted form in column sessionid. now not getting how call value stored in database in text box in second web application. i hope understand problem. please me!! i have found solution:- i changed procedure i.e. use aspstate go alter ...

How to set current time to some other time in javascript -

i trying set current time other time , whenever try access current time need new time. suppose current time 2 in local machine. want change 10 , current time should keep ticking 10 instead of 2 whenever access it. ex: var x = new date(); if see x.gethours() fetches local time 2 , every time keeps ticking 2 base. but need change 10 new date() gives 10 , keeps ticking every second based on that. i not want use setinterval() purpose. sure have solution setinterval(). thing have multiple setintervals , other 1 stopping updating time in setinterval() trying update 10 every second. you can't change system time javascript, not if it's running browser. you'd need special environment, 1 ability interface javascript , operating system's api that. that's no simple thing , way out of scope of application you're working on. i suggest create function/object means fetch current date offset. this: foo = function () {}; foo.prototype.offset = 8; foo.pr...

ruby - Best way to handle foreign number in Rails? -

i wonder something. have rails app had been translated in 30/40 languages including exotic languages. wonder what's best way handle numbers , number translation. for example, have in english, string 3 items , in persian or arabic, become Ù£ سلع ‎. unfortunately, getting 3 سلع using i18n gem. i using file locale: https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/ar.yml the locale correclty set ar output 3 in place of Ù£ (the arabic/persian character) any ideas?

CQRS - Domain Exceptions Vs Events for Exceptional Scenarios -

i'm wondering if it's preferable publish events rather throw exceptions aggregates. say, have domain there requirement students of grade level can enroll sports. if call enrollforsports on student not satisfy criteria, should aggregate throw exception or publish event, particularly if other aggregates or process managers interested in result of process? if event published, doesn't mean there need corresponding internal event handler handle event when we're replaying, though event wouldn't change state of aggregate? if exception thrown, how other parties notified? can command handler catch exception , raise event? can events raised command handlers? principally speaking, command should either valid , executed, or invalid , not executed. idea spawning error events leaves somewhere in middle , feedback whomever sends command ambiguous , delayed. unnecessary complexity in domain. if throw exception come immediate feedback to client code sent command. ...

wpf - Can you please explain why the Binding not working for DisplayMemberPath of ItemsControl? -

can 1 please explain why binding not working displaymemberpath of itemscontrol? and checked reflector displaymemberpath of itemscontrol dependency property,and bindable attribute set true only. xaml: <combobox x:name="display" displaymemberpath="{binding newaddress.telephone}" itemssource="{binding persons}"/> person class: public class person { public person() { persons = new observablecollection<newaddress>(); persons.add(new newaddress() { telephone = "myno" }); persons.add(new newaddress() { telephone = "myno1" }); persons.add(new newaddress() { telephone = "myno2" }); persons.add(new newaddress() { telephone = "myno3" }); } private observablecollection<newaddress> persons; public observablecollection<newaddress> persons { { return persons; } set { persons = value; } } } address class: ...

php - Why using createElement value doesn't show my input element properly? -

i've following code: $newdom = new domdocument('1.0', 'utf-8'); $foo = $newdom->createelement('input', 'this value'); $newdom->appendchild($foo); echo $newdom->savehtml(); this outputted only: <input> but when change createelement 'div' works okay this outputted 'div' or other input: <div>this value</div> this var_dump($foo) : object(domelement)#5 (17) { ["tagname"]=> string(5) "input" ["schematypeinfo"]=> null ["nodename"]=> string(5) "input" ["nodevalue"]=> string(16) "this value" ["nodetype"]=> int(1) ["parentnode"]=> string(22) "(object value omitted)" ["childnodes"]=> string(22) "(object value omitted)" ["firstchild"]=> string(22) "(object value omitted)" ["lastchild"]=> s...

php - upload a file form - doesn't recognize the $_FILES variable -

i've got following form: <form method="post" action="index.php"> product name: <input type="text" name="product_name" value="<?php echo $product_name;?>"/> <br /> <br /> product details <textarea rows = "6" cols = "30" name="product_details" > <?php echo $product_details;?></textarea> <br /> <br /> product price <input type="text" name = "product_price" value="<?php echo $product_price;?>"/> <br /> <br /> cn: <input type="text" name = "product_cn" value="<?php echo $product_cn;?>"/> <br /> <br /> image <input type="file" name="filefield" /> <br /> <br /> <input type="submit" name="submit" value="register...

ruby on rails - Has and belongs_to many or has_many through example with active record -

let's have fictional car rental application. i have users, cars, , addresses. user (id, name, email) has_many :addresses has_many :cars car (id, name) belongs_to :user address (id, name, user_id) belongs_to :user each user has multiple addresses , cars. address location user can lend car. now, model, following (let's user #1 has 2 addresses , 3 cars): settings user #1 : (specify @ address each of cars available) /-------------------------------------------\ | | car #1 | car #2 | car #3 | |-----------+----------+---------+----------| | address 1 | yes | yes | no | |-----------+----------+---------+----------| | address 2 | no | no | yes | \-------------------------------------------/ i think achieve create table cars_addresses (id, car_id, address_id, available:bool) but don't know how specify active record. questions are: is right schema structure ? how can implement through active record ? ...

java - Rule variables in ANTLR4 -

i'm trying convert grammar v3 v4 , having trouble. in v3 have rules this: dataspec[datalayout layout] returns [dataextractor extractor] @init { dataextractorbuilder builder = new dataextractorbuilder(layout); } @after { extractor = builder.create(); } : first=expr { builder.addall(first); } (comma next=expr { builder.addall(next); })* ; expr returns [list<valueextractor> ext] ... however, rules in v4 returning these custom context objects instead of explicitly told them return, things messed up. what's v4 way this? there multiple cases here: accessing passed-in variables ( layout ) accessing current rule's return value ( extractor ) accessing local variables ( first , next ) passed-in variables , current rule's return value when accessing passed-in variables or return value of current rule need prefix name given in rule definition $ . layout becomes $layout extractor becomes $extracto...

python - Getting first row from sqlalchemy -

i have following query: profiles = session.query(profile.name).filter(and_(profile.email == email, profile.password == password_hash)) how check if there row , how return first (should 1 if there match)? use query.one() one, , exactly 1 result. in other cases raise exception can handle: from sqlalchemy.orm.exc import noresultfound sqlalchemy.orm.exc import multipleresultsfound try: user = session.query(user).one() except multipleresultsfound, e: print e # deal except noresultfound, e: print e # deal there's query.first() , give first result of possibly many, without raising exceptions. since want deal case of there being no result or more thought, query.one() should use.

python - Django View is not getting processed completely after HttpResponse() call -

i have view named scan takes modelform input and sends view processscan supposed getting value of input scan view , process in processscan view. currently, processscan getting input scan view , outputting value, isn't going past line: return httpresponse("we got processor domain: " + entereddomain) process view looks like: def scan(request): form = submitdomain(request.post or none) # form bound post data if request.method == 'post': # if form has been submitted... if form.is_valid(): # if form input passes initial validation... domainnmcleaned = form.cleaned_data['domainnm'] ## clean data in dictionary form.save() #save cleaned data db dictionary try: return httpresponseredirect('/processscan/?domainnm=' + domainnmcleaned) except: raise validationerror(('invalid request'), code='invalid') ## [ todo ]: add custom ...

oracle - Is the use of the RETURNING INTO clause faster than a separate SELECT statement? -

1) update foo set bar = bar + 1 = 123; select bar var foo = 123; 2) update foo set bar = bar + 1 = 123 returning bar var; i assume second faster appears require 1 less trip database. true? just thought: often, applications need information row affected sql operation, example, generate report or take subsequent action. insert, update, , delete statements can include returning clause, returns column values affected row pl/sql variables or host variables. eliminates need select row after insert or update, or before delete. result, fewer network round trips, less server cpu time, fewer cursors, , less server memory required. taken oracle docs here

hyperlink - Preserve spaces in html links for operating system call arguments -

i built html index page german rtp iptv broadcast addresses works well, can @ here: http://lan7even.homenet dot org/server7even/test/iptv.php for links work 1 have have german telekom entertain dsl/vdsl connection , 1 have register rtp:// protocol handler in browser call vlc media player. there configured 1 argument vlc open in minimized view works well. now trying set additional argument has different each link: iptv stream title (channel name) but spaces replaced browser %20 automatically , therefore vlc not recognize argument. everything find informations known stuff preserve spaces in html display purposes, can not find alter space substituting behavior when called via html link. any hint? spaces not valid characters in urls. url standard : the url code points ascii alphanumeric, "!", "$", "&", "'", "(", ")", "*", "+", ",", "-", "."...