Posts

Showing posts from September, 2012

jquery - Web Worker Javascript cannot find functions in other javascript files -

i have html file this: <html> <head> <title>world aviation</title> <script language="javascript" src="./jquery-min.js"> </script> <script language="javascript" src="./jsdraw2d.js"> </script> <script language="javascript" src="./script.js"> </script> </head> <body> <input onclick="startanimbackground();" type="button" value="start"/> <script language="javascript"> initairports(); initroutes(); var w; function startanimbackground() { if(typeof(worker) !== "undefined") { if(typeof(w) == "undefined") { w = new worker("start_script.js"); ...

php - set values to fields in adminhtml form template -

Image
i'd created template file admin form tab as: class excellence_designer_block_adminhtml_designer_edit_tabs extends mage_adminhtml_block_widget_tabs { protected function _beforetohtml() { $this->addtab('images', array( 'label' => mage::helper('designer')->__('images'), 'title' => mage::helper('designer')->__('images'), 'content' => $this->getlayout()->createblock('designer/adminhtml_designer_edit_tab_images')->tohtml(), )); return parent::_beforetohtml(); } } class excellence_designer_block_adminhtml_designer_edit_tab_images extends mage_adminhtml_block_template implements mage_adminhtml_block_widget_tab_interface { public function _construct() { parent::_construct(); $this->settemplate('designer/edit/tab/images.phtml'); } public function gettablabel() { retu...

ios - Change text into strong Bold,Italic etc -

i getting response api shown below. want show text strong, bold etc. according api response. message = { <strong>helloooo</strong> }; status = 1; } look @ using nsattributedstring initwithdata:options:documentattributes:error: , include nsdocumenttypedocumentattribute value of nshtmltextdocumenttype in options dictionary. if need support older versions of ios, @ dtcoretext .

regex - Python error log pattern matching -

i python newbie , want learn hardway. writing function extract content between patterns. log file construct follows <time-stamp>[begin cache] <...some content> <time-stamp>. <time-stamp>. <time-stamp>. <time-stamp>. <time-stamp>[error] <..some content> <time-stamp>. <time-stamp>. <time-stamp>. <time-stamp>. <time-stamp>[end cache] <....some content> <time-stamp>. <time-stamp>. <time-stamp>. <time-stamp>[begin cache] <... content> <time-stamp>. <time-stamp>. <time-stamp>. <time-stamp>[end cache] <... content> i interested in extracting part between begin cache , end cache if there pattern error between them. code have written far no way getting me goal. logic used find positions of begin cache pattern , end cache pattern if error tag present , print file between positions. appreciated. import re import os import mmap file="\\\\xx...

sql server - Recursive References are not allowed in Sub_queries T-SQL -

i have cte query so: declare @stop datetime set @stop='2014-12-12 00:00:00.000' declare @start datetime set @start='2011-12-12 00:00:00.000' declare @temp datetime set @temp=@start x(a,b) as( select @temp a,count(*) b table1 left(convert(varchar,table1row1,120),4)=left(convert(varchar,@temp,120),4) union select dateadd(year,1,(select x.a x)) a,count(*) b table1 left(convert(varchar,table1row1,120),4)=left(convert(varchar,(select x.a x),120),4) , datediff(yyyy,(select x.a x),@stop)>0) select a,b #temptbl1 x option(maxrecursion 32767); i'm trying count of rows each year @start @stop. query accepts select x.a x @ select statement not @ clause. i'm getting compile time error stating: recursive member of common table expression 'x' has multiple recursive references. on executing, i'm getting error recursive references not allowed in sub-queries. but, i...

javascript - using onclick function to store CSV file to database -

<i> i ask how store csv file database after upload html form. had tried use onclick store csv file database , work. @ same time need validate other fields in form cannot make using onclick function. in project integrate javascript php code , know cannot done. can me solve problem? jest need store csv file database , validate other fields. ` <?php require_once "lib/base.inc.php"; ?> <script> function checkmail(){ var subject = document.getelementbyid('subject').value; var message = document.getelementbyid('message').value; var csv = document.getelementbyid('csv').value; if(empty(subject)){ alert("subject required."); } else if(empty(message)){ alert("message required."); } else if(empty(csv)){ alert("csv file required."); } else{ <?php $file = $_files[csv][tmp_name]; $handle = fopen($file,"r"); //loop through csv file , insert database { if ($data[0...

linux - kill function after specific time in php? -

i have 5 exec() function in script.i want if function not give response in given time function kill , next function starts execution. <?php exec("timeout 5 /usr/local/bin/wrun 'uptime;ps -elf|grep httpd|wc -l;free -m;mpstat'",$uptime); exec("timeout 5 /usr/local/bin/trun 'uptime;ps -elf|grep httpd|wc -l;free -m;mpstat'",$uptime); exec("timeout 5 /usr/local/bin/drun 'uptime;ps -elf|grep httpd|wc -l;free -m;mpstat'",$uptime); ?> in timeout argument not working.please correct or gives alternative method. create bash script caller.sh , execute via exec. command automatically killed after 5 seconds. caller.sh #!/bin/sh /usr/local/bin/wrun 'uptime;ps -elf|grep httpd|wc -l;free -m;mpstat' & sleep 5 kill $! 2>/dev/null && echo "killed command on time out" php exec("caller.sh",$uptime);

javascript - send json into php using jquery -

i have json php file , want send output php file. javascript: var data_1; $.ajax({ type:"post", url:"sd.php", success:function(result){ data_1 = result; test(data_1); var st = json.stringify(data_1); $.post('get.php',{q:st},function(data){ window.location = "get.php"; }); } }); and php file store json: <?php $obj = json_decode($_post['q']); echo $obj; ?> but outputs nothing. should do? please help. you're not posting data with $.ajax call. try this the javascript var req = $.post("sd.php", {foo: "bar"}); req.done(function(res) { console.log(res); }); req.fail(function() { console.log("there error"); }); the php <?php // sd.php $data = $_post["foo"]; echo "foo set to: {$data}"; exit; the output in browser console be "foo set to: bar" if want return json ph...

Can i make Rails this code more elegant? -

i have class: class user < activerecord::base attr_accessor :name, :email, :hr_id def initialize(attributes = {:name => "missing name",:email => "missing email",:hr_id => "missing hr id"}) @name = attributes[:name] @email = attributes[:email] @hr_id = attributes[:hr_id] end def print_employee "employee no: #{@hr_id} - #{@name} (#{@email})" end end and use this: def employee = user.new employee.name = "dude" employee.email = "dude@gmail.com" employee.hr_id = "129836561" @employee = employee.print_employee end my question is, how can make code in help shorter , more elegant? i tried: employee = user.new('dude','dude@gmail.com','129836561') @employee = employee.print_employee but got errors. you looking after_initialize and/or after_find callbacks. see docs after_initialize :set_default_values ...

java - JTable with different JComboBox-es for each row -

i created jtable contains information employees. in jtable added column called "qualifications". column represented jcombobox (different content @ each row). instance: row 1 | jcombobox(){"programmer","web"} row 2 | jcombobox(){"writer","editor"} the jcombobox content taken list<string> employees[row].getqualification() . the problem selected item in row 1 , row 2 "programmer", "programmer" should not appear in row 2. when click on jcombobox , correct list appears, i.e. row 2 - {"writer","editor"}. tablecolumn column = table.getcolumnmodel().getcolumn(5); column.setcellrenderer(getrenderer()); private tablecellrenderer getrenderer() { return new tablecellrenderer() { private jcombobox<string> box = new jcombobox<string>(); @override public component gettablecellrenderercomponent(jtable table, object value, ...

provisioning profile - ios in-house distribution certificate expires -

my enterprise app in production , in-house distribution certificate , provisioning profile expire in 2 days. not clear on below items. can me understand them? i knew apps submitted in app store continues work after provisioning profile , certificate expires. not sure if same enterprise apps well? app installed in production, continue work after certificate , provisioning profile expiry date? should revoke certificate before expires , create new 1 replacement? if revoke existing certificate before expiry date, apps installed in production continue work? all answers questions asked provided in apple document in this pdf. lazy read entire document answer, below answers question document. the document says distribution provisioning profiles expire 12 months after they’re issued. after expiration date, profile removed , app won’t launch. when distribution certificate expires, app won’t launch. distribution certificate valid 3 years when issued, or until enterpris...

Android, why adding left/right margin scales up image? -

Image
i have 2 image views, 1 on top of other. behind imageview displays user's image while top 1 cover image (just face area transparent following screenshot). my layout this: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/rlcontainer"> <imageview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/ivuserimage" android:contentdescription="@string/content_description"/> <imageview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/ivcoverimage" android:contentdescription="@st...

Jquery post not working when adding database conneciton -

https://www.youtube.com/watch?v=gnmgpmamlva i've uploaded video in youtube shows problem well. run app either way , without database connection. no problem without db connection problem persists me when add db connection. can please suggest , guide me right direction? i'll grateful.... i can't comment post, write there. you have check connection: $connection = @mysql_connect('localhost', 'user', 'pass') or die('error: '.mysql_error()); it show errors if exist. or put echo "some text" between each line.

javascript - Hide the footer of web page on android's web view -

Image
this seems easy task cant manage it. loading http://beta.tfl.gov.uk/plan-a-journey/ on web view , want remove footer display: on web view have tried several things see no result in page loading @override public void onpagefinished(webview view, string url) { wburl.loadurl("javascript:(function() { " + "document.getelementsbytagname('primary-footer')[0].style.display=\"none\"; " + "})()"); } any ideas ? you can try fetching page programatically (you can use httpurlconnection) , modify page (add .footer{display:none;} in header styles) , load modified page on webview.

javascript - Maximum call stack size exceeded - know why (too many functions) but how to fix it? -

on page have simple piece of code based on nested functions, helps me show 1 elements after in right order: var fade = 700; $('#s2icon-center').fadein(fade, function() { $('#s2icon-1').fadein(fade, function() { $('#s2icon-3, #s2icon-9').fadein(fade, function() { $('#s2icon-6, #s2icon-11, #s2icon-17').fadein(fade, function() { $('#s2icon-5, #s2icon-14, #s2icon-19').fadein(fade, function() { $('#s2icon-8, #s2icon-13, #s2icon-22').fadein(fade, function() { $('#s2icon-2, #s2icon-16, #s2icon-21').fadein(fade, function() { $('#s2icon-4, #s2icon-10, #s2icon-24').fadein(fade, function() { $('#s2icon-7, #s2icon-12, #s2icon-18').fadein(fade, function() { $...

capybara - CSS Find not working with Poltergeist -

the following html source: <div id="users_filter" class="btn-group no-margin pull-right nested-pull-right open"> <a class="btn dropdown-toggle attach-left btn-small btn-primary" data-toggle="click-dropdown" href="#"></a> <ul class="dropdown-menu dropdown-filter"></ul> </div> i have following step definition: when /i click "([^\"]*)"/ |arg1| find(:css, arg1).trigger('click'); end and in feature file do: then click "#users_filter .dropdown-toggle" but click event not triggered. i use capybara & poltergeist driver. can please me understand i'm going wrong? ramya

java - Adding a break to stop a loop -

i have code requires break after successful authentication, not sure add this. have tried adding after loop , successful authentication accepted can't seem working correctly. one other slight problem @ line; system.out.println("..." + i); says not in main method code written on pc @ work , later added original code. here code; public class elevator { static scanner console = new scanner(system.in); public static void main(string[] args) { final int userid = 5555; final int password = 1234; final int studentnumber = 22334455; int entereduserid; int enteredpassword; int enteredstudentnumber; (int s = 0; s <= 3; s++) { if (s < 3) { system.out.println("enter userid access lift;"); entereduserid = console.nextint(); system.out.println("your userid ==> " + entereduserid); system.out.println("enter password authenticate login;"); ...

mongodb - Collision probability of ObjectId vs UUID in a large distributed system -

considering uuid rfc 4122 (16 bytes) larger mongodb objectid (12 bytes), trying find out how collision probability compare. i know around quite unlikely , in case ids generated within large number of mobile clients, not within limited set of servers. i wonder if in case, there justified concern . compared normal case ids generated small number of clients: it might take months detect collision since document creation ids generated larger client base each client has lower id generation rate in case ids generated within large number of mobile clients, not within limited set of servers. wonder if in case, there justified concern. that sounds bad architecture me. using two-tier architecture? why mobile clients have direct access db? want rely on network-based security? anyway, deliberations collision probability: neither uuid nor objectid rely on sheer size, i.e. both not random numbers, follow scheme tries systematically reduce collision probability. in cas...

Microsoft Test Manger: Re-running tests in a different sprint? -

we designed tests in microsoft test manager our first sprint (we using agile) , executed them. on our second sprint , need run these tests again regression. there way can reset statuses of tests without destroying test execution history of previous sprint? there isn't way. ended cloning test cases different plan each time.

php - Removing empty lines with notepad++ causes T_Variable Syntax Error -

Image
removing empty lines in notepad++ as described in thread above able remove empty lines notepad++. did try methods receiving weird t_variable syntax errors (mostly in line 1-6). there no error in lines , can not see 1 anywhere. it happens when manually delete empty lines in areas of code (first 5 lines example). guessing encoding problem reencoding in utf-8, ascii etc. did not help. those lines added when used online editor webhoster couple of months ago (1 empty line between lines there before). i not it, maybe (thanks in advance!). file @ http://lightningsoul.com/index.php and here first block of code: <?php include("db/lg_db_login.php"); //require 'fb/facebook.php'; if (isset($_get['c'])) { $content = $_get['c']; } else { $content = ""; } if (isset($_get['sc'])) { $subcontent = $_get['sc']; } else { $subcontent = ""; } if (isset($_get['setlang'])) { $setlang = $_get['setlang...

ios - JavascriptCore: pass javascript function as parameter in JSExport -

javascriptcore new framework supported in ios7. can use jsexport protocol expose parts of objc class javascript. in javascript, tried pass function parameter. this: function getjsoncallback(json) { movie = json.parse(json) rendertemplate() } viewcontroller.getjsonwithurlcallback("", getjsoncallback) in objc viewcontroller, defined protocol: @protocol fetchjsonforjs <jsexport> - (void)getjsonwithurl:(nsstring *)url callback:(void (^)(nsstring *json))callback; - (void)getjsonwithurl:(nsstring *)url callbackscript:(nsstring *)script; @end in javascript, viewcontroller.getjsonwithurlcallbackscript works, however, viewcontroller.getjsonwithurlcallback not work. is there mistake used block in jsexport? thx. the problem have defined callback objective-c block taking nsstring arg javascript doesn't know , produces exception when try evaluate viewcontroller.getjsonwithurlcallback("", getjsoncallback...

javascript - Getting the url parameters inside the html page -

i have html page loaded using url looks little this: http://localhost:8080/gisproject/mainservice?s=c&o=1 i obtain parameters in url without using jsp .can done using javascript or jquery .i want test page using node.js local server before deploying in remote machine uses java server. is there library allow me that. a nice solution given here : function geturlparameter(sparam) { var spageurl = window.location.search.substring(1); var surlvariables = spageurl.split('&'); (var = 0; < surlvariables.length; i++) { var sparametername = surlvariables[i].split('='); if (sparametername[0] == sparam) { return sparametername[1]; } } }​ and how can use function assuming url is, http://dummy.com/?technology=jquery&blog=jquerybyexample : var tech = geturlparameter('technology'); var blog = geturlparameter('blog');`

jQuery function in a external javascript file isnt working -

i have external javascript file function: $(document).ready(function () { $("#save").on('click', function () { window.open('data:application/vnd.ms-excel,' + encodeuricomponent($('#exporttoexceldiv').html())); e.preventdefault(); }); }); and link looks like: <a href="#" title="save"><img src="../../images/glyphicons_446_floppy_save.png" id="save" name="save"></a> but function not working on link. nothing wrong linking between files (tried alert function works) and functions works when type directly in html.

mysql - One column references on multiple different tables -

think of platform-wide commenting-system. comment can added users profile, website section, comment or x other things. that means comment has "addressee_id" , addressee_id can reference on different tables. comments (id, adresseee_id, ..., ...) sections (id, ...) users (id, ...) what best way define on table join? three possible ways: denormalization remove other tables , add x columns "comments"-table problem: lot of empty fields. another table "pages" page_ids. each table gets column "page_id" fk on pages.id. here have make x joins each request. sounds expensive. comments-table gets column "addresse_type" here have implement if/else logics query expensive , not easy maintain. what suggest? thanks phil

Android Intel x86 Emulator KitKat (19) not starting -

i upgraded packages. on 4.4.2 19, sdk tools 22.6.1, platform 19.0.1 , intel atom image 19.2. working on windows 7. i can start intel emulator on 4.2 or 2.3 version in less minute. if start intel emulator on 4.4 (or 4.3) blank screen (not android boot logo). i tried far: different devices , screen sizes different memory options suggested here even low memory start (128 mb) with or without host gpu usage removing device functionality gps, accelerometer etc. starting -noaudio adb kill/start-server watched memory (6 gb installed, 2 gb on stand-by, no difference 4.2 start, not seem issue.) uninstalling intel packages , re-installing. (most coming emulator android 4.4 kitkat not starting ) when start emulator, hax working fine. using emulator ... -debug-all option gives me following last commands: emulator: can't connect adb server: connection refused emulator: ping program: c:\users\gsc\appdata\local\android\android-sdk\tools\ddm s.bat emulator: ping comman...

ibm mq - Connect to a remote MQ with WebSphere Message Broker -

an mq input node can connect mq bound messagebroker installation. connect remote mq. avoid using jms input. would possible use mq service connecting remote mq? i'm using tve version 9, iib. you can deliver outbound messages remote queue managers via broker's queue manager if suitable channels , xmit queues setup. this not same client connection remote queue manager not supported. you use jcn call mq base api or raise request enhancement here: http://www.ibm.com/developerworks/rfe/?prod_id=532

javascript - How to refresh right splitter's grid on click of first splitter grid data using kendoUI -

i want refresh right side grid on click of left side grid's particular record, using splitter. using kendo ui. here form code <div id="vertical_beemmfg"> <div id="horizontal_beemmfg"> <div id="left-pane_beemmfg" > <div id="enquiry_grid"></div> </div> <div id="right-pane_beemmfg"> <div id="view_transaction_record_grid"></div> </div> </div> $("#view_transaction_record_grid").hide(); var splitterv = $("#vertical_beemmfg").kendosplitter({ orientation: "vertical", panes: [ { collapsible: false }, { collapsible: false, size: "100px" }, { collapsible: false, resizable: true, size: "100px" } ] }); var splitter = $("#hor...

node.js - sails.js with passport-twitter -

i integrating passport sails . while google , facebook working fine in application struggle twitter authentication! when clicking on 'login twitter' button there error thrown wich says: error: oauthstrategy requires session support. did forget app.use(express.session(...))? i read here sessions necessary twitter authentication work. made sure app has sessions activated! i testet passport-twitter simple express app (without sails) make sure module working , twitter credentials intact. i assuming sails sessions different express sessions? sails changing way sessions work? advice on how solve this? edit: added more info requested in comments: sails version: 0.9.13 usercontroller.js: ... twitter: function(res, req) { passport.authenticate('twitter', {failureredirect: '/login'}, function(err, user, info) { return console.log(err, user, info); })(req, res); } ... config/passport.js: ... passport.use(new twitterstrategy({ ...

Equivalent of C# lock in Java? -

equivalent of c# lock in java? for example: public int next() { lock (this) { return nextunsynchronized(); } } how port c# method java? public int next() { synchronized (this) { return nextunsynchronized(); } } that's it. , next code better. public synchronized int next() { return nextunsynchronized(); }

How to build ffmpeg in android app? -

after build ffmpeg bellow steps http://stackoverflow.com/questions/22471514/ffmpeg-build-output-is-not-showing have copy include , .a file jni folder. , android.mk file as:- local_path := $(call my-dir) include $(clear_vars) local_module := ffmpegutils local_src_files := tutorial02.c local_c_includes := $(local_path)/include local_ldlibs := -l$(ndk_platforms_root)/$(target_platform)/arch-arm/usr/lib -l$(local_path) -lavformat -lavcodec -lavfilter -lavutil -lswscale -llog -ljnigraphics -lz -ldl -lgcc include $(build_shared_library) but project giving error as:- description resource path location type make: *** [obj/local/armeabi/libffmpegutils.so] error 1 mainactivity c/c++ problem undefined reference 'anativewindow_unlockandpost' mainactivity line 231, external location: /home/kiwitech/documents/development/tools/ndk/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/pr...

mysql - Updating Values of a Column from one Table to another -

i have 2 tables:- source table: act_dt columns ( cust_name, acc_type, cust_stat, sb_act_dt ); target table: org_dt columns ( cust_name, acc_type, cust_stat, sb_act_dt ); the column sb_act_dt in target table has null values. need update column values of same column in source table. condition checked are: acc_type='billing' , cust_stat='active'. the target table has updated if above conditions found true. how can it? appreciated. what looking update table using join update org_dt o join act_dt on o.cust_name=a.cust_name , o.acc_type=a.acc_type , o.cust_stat=a.cust_stat set o.sb_act_dt = a.sb_act_dt a.acc_type='billing' , a.cust_stat='active'

html - offset problems in jquery, works on chrome but not in firefox -

i'm using anchor navigation on website & fixed header. clicking on link of menu, page scrolls linked #. i've added js code calculate height of header , add height # link section not displayed under fixed header. works fine on chrome, not on firefox, don't understand doing wrong, can me ? here js code : function scrolling(){ $('a[href^="#"]').bind('click.smoothscroll',function (e) { e.preventdefault(); var target = this.hash, $target = $(target); var offset = $('#header').outerheight(true); //alert(offset); $('html, body').stop().animate({ 'scrolltop': $target.offset().top-offset //--offset--// }, 1000, 'swing', function () { window.location.hash = target; }); }); } and css : #header{position: fixed;z-index: 1000;top: 0;padding-left:25px;padding-top: 20px;height: 75px;width:100%;min-width:590px...

polymorphism - Jackson deserialization of polymorphic types -

i've seen example of jackson deserialization @jsontypeinfo, is: @jsontypeinfo( use = jsontypeinfo.id.name, include = jsontypeinfo.as.property, property = "type") @jsonsubtypes({ @jsonsubtypes.type(value = cat.class, name = "cat"), @jsonsubtypes.type(value = dog.class, name = "dog")}) public class animal {...} i've tried , works fine. now, problem in example classes cat , dog referenced animal, want avoid. there way move type binding class animal , still have deserialization work? thanks i found answer here: http://jira.codehaus.org/browse/jackson-654 . use: mapper.registersubtypes(cat.class, dog.class);

c# - WCF sending large (>90Mb) XML files from client to third party via WCF service -

i want send large xml file in entirety source third party machine via wcf service in c#. files can large 90mbs trying serialize xml string takes far long , use memory. i've seen lot of answers tell me try picking out relevant information xml file want send, need able send full file , allow third party process files. how best approach this? this may of help. custom wcf streaming

.net - How to apply a data template to a ListBox? -

i have listbox, when event occur outside listbox (ex click on button) need apply categoriesunselecteddatatemplate to element of categorieslistbox anyidea how solve this? <custom:surfacelistbox x:name="categorieslistbox" scrollviewer.horizontalscrollbarvisibility="disabled" scrollviewer.verticalscrollbarvisibility="hidden" manipulationdelta="categorieslistbox_manipulationdelta" ismanipulationenabled="true" selectionchanged="categorieslistbox_selectionchanged" itemtemplate="{dynamicresource categoriesunselecteddatatemplate}" verticalcontentalignment="stretch" horizontalcontentalignment="stretch" selectionmode="single" margin="115,131,-117,-49"> </custom:surfacelistbox...

PHP: unset first 3 elements from array -

edit: found alternative this: array_slice() great way. i have array called $mas . it's fine me unset last 7 elements of array, when try unset first 3 elements, error: notice: undefined offset: 0 here few lines of code works: $ilgis = count($mas); unset($mas[$ilgis-1], $mas[$ilgis-2], $mas[$ilgis-3], $mas[$ilgis-4], $mas[$ilgis-5], $mas[$ilgis-6], $mas[$ilgis-7]); and code doesn't work: ... unset($mas[0], $mas[1], $mas[2]); it seems don't exist in array. ideas how fix it? btw, echo $mas[0]; works perfectly. var_dump($mas) output: array (size=9) 0 => string 'paris-orly - stockholm-arlanda' (length=30) 1 => string 'tuesday 25. mar 2014 21:15 - terminal: s' (length=41) 2 => string 'flight dy4314 - lowfare' (length=26) 3 => string 'stockholm-arlanda - copenhagen' (length=30) 4 => string 'wednesday 26. mar 2014 07:00 - terminal: 5' (length=43) 5 => string 'flight dy4151 - lowfa...

vmware - How to communicate with a Virtual Machine in Java? -

i made little java program check if pin code correct or not. can see in code, program asks enter pin code, checks in bdd.txt file (playing database role) if pin correct or not. acutally want go next step, want deploy program on android device. at first, need bdd.txt file on virtual machine (such ubuntu example) won't local anymore. more realistic. have keep in mind in future, device ask if pin entered or not, , of course pins won't on device, checking process won't local. that why question : how communicate virtual machine in java ? program running on windows computer, have installed unbuntu vmware, how can reach file in vm ? (web services ?) possible ? , if yes, how ? thank you. florent the code : import java.io.*; import java.util.*; public class main { // fonction permettant d'accéder/lire notre bdd de pins (fichier .txt) static public boolean readpinsdata(file datafile, arraylist<integer> data) { boolean err = false; try { s...

javascript - Passing HTML5 Local Storage Value to PHP error -

this question has answer here: what difference between client-side , server-side programming? 5 answers i using html5 local storage , trying read , pass php variable: this code: $myphpvar = "<script>document.write(localstorage.getitem('myjsvar'));</script>"; when this: echo $myphpvar; the value looks right (at leave visually) upto there looks when add code: $sql="insert `pending` (`id`, `myfield`) values ('', '$myphpvar')"; i error: error: have error in sql syntax; check manual corresponds mysql server version right syntax use near .. the error points here: $myphpvar = "<script>document.write(localstorage.getitem('myjsvar'));</script>"; any ideas why? updated : this doesn't work because : $myphpvar = "<script>document.write(locals...

asp.net mvc - Custom validation error message in MVC5 -

i quite new mvc5 , asp.net , couldn't find answer, grateful if tell me how customize message after failing validation. let's assume have code this: [required] [maxlength(11),minlength(11)] [regularexpression("^[0-9]+$")] public string pesel { get; set; } after using other signs digits got message this: field pesel must match regular expression '^[0-9]+$' how can change message ? all validation attributes within system.componentmodel.dataannotations have errormessage property can set: [required(errormessage = "foo")] [minlength(11, errormessage = "foo"), maxlength(11, errormessage = "foo")] [regularexpression("^[0-9]+$", errormessage = "foo")] additionally, can still use field name / display name property within error message. done through string format setup. following example render error message of "you forgot mypropertyname". [required(errormessage = ...

java - Session not available -

in jsp page, calculating session value following my.jsp consists 2 buttons, 1 submit below form upload.java , on click of button leads exec.java command prompt execution stuff my.jsp looks like, <% string timestamp = new simpledateformat("dd:mm:yyyy_hh:mm:ss:sss").format(calendar.getinstance().gettime()); timestamp = timestamp + ":" + system.nanotime(); string loc = "/u/poolla/workspace/firstservlet/webcontent/web-inf/"+timestamp; session.setattribute("path", loc); // cal session , set attribute %> <div id="elements"> //form accept files upload left file : <input type="file" name="datafile1" id="filechooser1" /></li> right file : <input type="file" name="datafile2" id="filechooser2" /></li> config file :<input type="file" name="datafile3" id="filechooser3" /></...

Python ImportError: No module named system -

import system module not work in python2.7.3 python 2.7.3 (default, mar 13 2014, 11:03:55) [gcc 4.7.2] on linux2 type "help", "copyright", "credits" or "license" more information. >>> import system traceback (most recent call last): file "<stdin>", line 1, in <module> importerror: no module named system if wish sys module, try: import sys if you're looking system call, try: import os.system

php - Check if filename exists and -

i wondered if there way check if filename exists , add number after it, know - in basic possible if once it'll add 1 after it. but how check if has done more once? first time add 1 2 3 , on? $title = $_post['title']; $content = $_post['content']; $compile = $title. "\r\n" .$content; $content = $compile; $path = "../data/" .md5($title). ".txt"; $fp = fopen($path,"wb"); fwrite($fp,$content); fclose($fp); $con=new mysqli("###","###_public","###","###"); if (!($stmt = $con->prepare("insert `blog_posts` (`post_title`,`post_content`,`post_date`) values (?,?,?)")) || !is_object($stmt)) { die( "error preparing: (" .$con->errno . ") " . $con->error); } $stmt->bind_param('sss', $_post['title'], $path, $_post['date']); if($stmt->execute()) { echo "successfully posted"; } else { echo "unsuc...

PHP DOMDocument: error adding DOMElement with no children -

update: working , answer in first comment $dom = new domdocument('1.0', 'utf8'); $elroot = $dom->createelement ('root'); $elitems1 = $dom->createelement ('items1'); $elitems2 = $dom->createelement ('items2'); $elroot->appendchild($elitems1); $elroot->appendchild($elitems2); $dom->appendchild($elroot); echo $dom->savexml(); i expected create following xml: <root><items1></items1><items2></items2></root> but instead creates <root><items1><items2></items2></items1></root> if add 1 children items1 works better may have no nodes/children elements , error occur. or isn't error?

iphone - displaying email address and name from address book on tableview while text filed editing in ios -

i have application in have textfiled.just beneath text filed adding tableview.when starting typing letter in textfield searches address book , display name along email address of person on tableview.but problem not displaying emailaddress along name on tableview. code -(void)textfielddidchange:(uitextfield *)txtfld { [self fetchaddressbook]; nsstring *dictionarykey = contact.name; nsstring *predicatestring = contact.email; //---get states beginning letter--- nspredicate *predicate = [nspredicate predicatewithformat:@"self beginswith[c] %@", contact.email]; listfiles = [nsmutablearray arraywitharray:[self.namearray filteredarrayusingpredicate:predicate]]; nssortdescriptor *sortdescriptor = [[nssortdescriptor alloc] initwithkey:@"name" ascending:yes] ; nsarray *sortdescriptors = [nsarray arraywithobject:sortdescriptor]; nsarray *sortedarray = [listfiles sortedarrayusingde...

javascript - Combining dropzone.js with fancybox.js to give a fullscreen view of uploaded photos -

i trying implement drag'n'drop upload feature website using dropzone.js library. has worked fine far, want give user ability of viewing uploaded pictures clicking on them after upload done. i thought doing buy including library fancybox or lightbox, not sure how implement uploaded dropzone-elements. / tipps appreciated, not find answer question anywhere on site. thanks in advance :) it has been long time since have used dropzone means had worked older version think can point in right direction. after upload done, thumbnail view of uploaded photo , when hover on photo thumbnail, able see details size , name of file. can include button or anchor tag named "view larger image" along these details. so when hover on thumbnail, able see (size) (name) view larger image anchor/button you can binding dropzone's success function. have never used fancybox not sure code binds it. understand, anchor going used open larger image using fancybox have h...

haskell - Find a distance in graphs between nodes -

i got list in hand such: [(1,2),(1,4),(2,4),(3,9),(4,7),(7,9)] i have implement function takes: list of existing relations , pair of new realiton ,a distance n. function should work in way: takes parameters, calculates distance between nodes given in new relation, if distance <= distance n, function returns list including new relationship. for ex: list = [(1,2),(1,4),(2,4),(3,9),(4,7),(7,9)] new_relation = [(1,3)] distance_n = 4 it return [(1,2), (1,3) ,(1,4),(2,4),(3,9),(4,7),(7,9)] if distance 3 return original list [(1,2),(1,4),(2,4),(3,9),(4,7),(7,9)] how can this? have problems graphs. note: should implemented in haskell. both the containers package , the graphs package have adjacency list representations similar yours. a general method of computing shortest paths contains functional implementation of djikstra's algorithm finding graph distances, works on adjacency matrix. either change of representation or alter algorithm work on adj...

c# - Empty background not showing up during page transitions - current page showing instead -

i'm working on wp8 application. when i'm going settings page, transitions (i'm using wp toolkit's turnstile ones) play correctly, while next page loading, app displays previous page again. to make clear, here's how goes : mainpage displayed -> tap "settings" appbar -> navigationout transition animation plays -> mainpage still on display (should black - or white - background) -> navigationin transition animation plays -> settings page displayed. it's ugly , makes whole app clumsy. i feel i'm first 1 ever had problem on whole internet, can't find info. must have messed somewhere, right ? more i'm looking, more seems correct. the modification made on app.xaml.cs replacing rootframe type transitionframe : //rootframe = new phoneapplicationframe(); rootframe = new transitionframe(); i did include toolkit in xaml pages... xmlns:toolkit="clr-namespace:microsoft.phone.controls;assembly=microsoft.phone.contro...

javascript - GWT, (simple) Websockets and 405 warnings -

i'm having trouble getting basic websocket functionality running gwt (2.6.0). i'm using default generated gwt app , gwt's built-in server, , trying extend code allow websocket communication. when trying open / "upgrade" connection, see 405 warning. source below. when try connect (click on "connect" button), warning appears in eclipse console. sending message , trying close connection nothing @ point. 1: console message: [warn] 405 - /jtreeservertest/echo (127.0.0.1) 1455 bytes request headers upgrade: websocket connection: upgrade host: 127.0.0.1:8888 origin: http://127.0.0.1:8888 pragma: no-cache cache-control: no-cache sec-websocket-key: gdlkr0qckcrd6fvjafkncg== sec-websocket-version: 13 sec-websocket-extensions: permessage-deflate; client_max_window_bits, x-webkit-deflate-frame user-agent: mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, gecko) ...