Posts

Showing posts from September, 2011

java - SparkException: local class incompatible -

i'm trying submit spark job client cloudera cluster. in cluster using cdh-5.3.2 , spark version 1.2.0 , hadoop version 2.5.0 . test our cluster submitting wordcount sample taken spark web site. can submit our spark job written in java. however, cannot write our result file on hdfs . got following error, 20/06/25 09:38:16 info dagscheduler: job 0 failed: saveastextfile @ simplewordcount.java:36, took 5.450531 s exception in thread "main" org.apache.spark.sparkexception: job aborted due stage failure: task 1 in stage 1.0 failed 4 times, recent failure: lost task 1.3 in stage 1.0 (tid 8, obelix2): java.io.invalidclassexception: org.apache.spark.rdd.pairrddfunctions; local class incompatible: stream classdesc serialversionuid = 8789839749593513237, local class serialversionuid = -4145741279224749316 @ java.io.objectstreamclass.initnonproxy(objectstreamclass.java:617) @ java.io.objectinputstream.readnonproxydesc(objectinputstream.java:1622) @ java.io.object...

NullPointerException addToRequestQueue(com.android.volley.Request, java.lang.String)' on a null object reference -

i'm using http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/ , it's working fine in example project of login-register.( just login , register ) but after many attempts trying cardviews , other widgets , error appears on *logcat* : java.lang.nullpointerexception: attempt invoke virtual method 'void client.myproject.app.appcontroller.addtorequestqueue(com.android.volley.request, java.lang.string)' on null object reference @ client.myproject.registeractivity.registeruser(registeractivity.java:185) @ client.myproject.registeractivity.access$300(registeractivity.java:35) @ client.myproject.registeractivity$1.onclick(registeractivity.java:81) @ android.view.view.performclick(view.java:4780) @ android.view.view$performclick.run(view.java:19866) @ android.os.handler.handlecallback(handler.java:739) @ android.os.handler.dispatchmessage(handler....

java - Collapsing Toolbar and Fragment -

i have app laid out this, mainactivity hosts 2 tabs accompanied fragments, first fragment has recycler view works, i'm trying add parallax effect person scrolls or down, wasn't sure if should add fragment's xml or mainactivity's xml, added mainactivity's xml , included fragment recyclerview, needless parallax didn't work , app doesn't open , nullpointerexception didn't touch code.please point me in correct direction. xml below frag1.xml <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.recyclerview android:id="@+id/my_recycler_view" android:scrollbars="vertical...

mysql - SQL: Select the next datetime in the future from one of two columns -

i have table similar this: +---------------------+---------------------+ | | | +---------------------+---------------------+ | 2014-07-01 01:00:00 | null | +---------------------+---------------------+ | 2015-08-01 02:00:00 | 2015-10-01 02:00:00 | +---------------------+---------------------+ | 2015-09-01 03:00:00 | 2015-10-01 03:00:00 | +---------------------+---------------------+ and need know next datetime in future, should be: 2015-08-01 02:00:00 i'm looking "correct" answer, ideally without subqueries or joins. edit: assuming from before to each row, don't need least: select min(if(`from` > now(), `from`, `to`)) `yourtable` `from` > now() or `to` > now(); this works because 1 of from or to have > now() or where eliminates row. in procedural pseudo code like x = ("from" "from" > now) , ("to" "from" < , "to" ...

java - Why does writeInt(int v) show as symbols in file but writeBytes(String s) shows properly in the file? -

i trying understand why when use code (using writeint(int v) ) symbols in file created. public class write { public static void main(string[] args) { try { //create fileoutputstream object fileoutputstream fos = new fileoutputstream("v.txt"); dataoutputstream dos = new dataoutputstream(fos); int str = 2323; dos.writeint(str); dos.close(); } catch (ioexception e) { system.out.println("ioexception : " + e); } } } but when use writebytes(string s) or writeutf(string s) correct string written in file. have read writebytes converts primitive data byte sequence of bytes why don't symbols getting using previous code using method? public class write { public static void main(string[] args) { try { //create fileoutputstream object fileoutputstream fos = new fileoutputstream("v.txt"); dataoutputstream dos...

python - How to use set_data with semilogx? -

i'm doing, self.fig = figure() self.axes = self.fig.add_subplot(111) self.axes.semilogx(omega,mag,*args,**kwargs) i use set_data change data points. how go it? save reference artist: line = self.axes.semilogx(omega, mag, *args, **kwargs)[0] and can use set_data method: line.set_data(omega_new, mag_new)

javascript - Ionic: Why isn't my HTTP.GET not loading my image? -

i'm trying load images json file ionic application create gallery isn't working. i'm trying follow guide https://blog.nraboy.com/2015/03/make-a-gallery-like-image-grid-using-ionic-framework/ use http.get request instead. html: <ion-content ng-controller="photoctrl" ng-init="getimages()"> <div class="row" ng-repeat="image in images" ng-if="$index % 4 === 0"> <div class="col col-25" ng-if="$index < images.length"> <img ng-src="{{data.images[$index].src}}" width="100%" /> </div> <div class="col col-25" ng-if="$index + 1 < images.length"> <img ng-src="{{data.images[$index + 1].src}}" width="100%" /> </div> <div class="col col-25" ng-if="$index + 2 < images.length"> <img ng-src=...

ios - UIPanGestureRecognizer at view with UIScrollView -

Image
i have view uipangesturerecognizer . uipangesturerecognizer *recognizer = [[uipangesturerecognizer alloc] initwithtarget:self action:@selector(handlepan:)]; [recognizer setmaximumnumberoftouches:1]; [recognizer setdelegate:self]; [self.view addgesturerecognizer: recognizer]; ======= -(void) handlepan:(uipangesturerecognizer*)gesturerecognizer { move subview of self.view } subview have scroll view inside. how capture gesture event - handlepan: when scroll view @ end of horizontal scrolling? you can use following function: - (bool)gesturerecognizer:(uigesturerecognizer *)gesturerecognizer shouldrecognizesimultaneouslywithgesturerecognizer:(uigesturerecognizer *)othergesturerecognizer

c# - .NET configuration with multiple instances of a set of parameters -

i have application can connect several servers. actual number of servers not known until runtime,and may change day day. takes several actual parameters define server. i'm trying configure application using .net support application configurations. the configuration file looks like: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configsections> <sectiongroup name="usersettings" type="system.configuration.usersettingsgroup, system, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" > <section name="server" type="system.configuration.singletagsectionhandler" allowexedefinition="machinetolocaluser" requirepermission="false" /> </sectiongroup> </configsections> <usersettings> <server name="washingto...

batch file - I've already tried ways But they won't work! it says "a not expected at this time"! -

here's code: @echo off color 0a set a=0 /l %a in (0,1,2) command ( echo ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ echo Û°°° Û echo ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ echo loading - 2% ) it's cmd that's outputting not expected @ time! to use for variables in batchfile, have double percent signs (and command not part of syntax, tells insert command): for /l %%a in (0,1,2) ( echo ---------- echo | note | echo ---------- ) a block of commands (enclosed in parantheses) qualifies "command".

intersection - ElasticSearch: minimum_should_match and length of terms list -

using elasticsearch i'm trying use minimum_should_match option on terms query find documents have list of long s x% similar list of long s i'm querying with. e.g: { "filter": { "fquery": { "query": { "terms": { "mynum": [1, 2, 3, 4, 5, 6, 7, 8, 9, 13], "minimum_should_match": "90%", "disable_coord": false } } } } } will match 2 documents mynum list of: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] and: [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12] this works , correct since first document has 10 @ end while query contained 13 , second document contained 11 again query contained 13 . which means 1 ou of 10 numbers in query's list different in returned document , amounts allowed 90% similarity ( minimum_should_match ) value in query. now issue have behav...

vbscript - VBS - How to pause a script until user presses a key? -

how can implement wait key function in vbs ? need pause script , when user presses left_arrow key continue program. you don't have lot of choices. if have console script, , i'm assuming do, can read input user registers when press [enter]. pause until enter key pressed. example: wscript.echo "press [enter] continue..." ' read dummy input. call not return until [enter] pressed. wscript.stdin.readline wscript.echo "done." there's old pause command dos days. however, shelling new console window run pause cause second window appear. you'd need press key in that window return script. not want. but apart third-parties, vbscript has no methods read keypresses @ run-time.

ios - What happens if the init method of a singleton class is called before the +sharedInstance method..? -

what happens if init method of singleton class called before +sharedinstance method..? result in new object , if not how same instance returned ? fact static variable declared inside sharedinstance have effect on overall outcome..? + (libraryapi*)sharedinstance { // 1 static libraryapi *_sharedinstance = nil; // 2 static dispatch_once_t oncepredicate; // 3 dispatch_once(&oncepredicate, ^{ _sharedinstance = [[libraryapi alloc] init]; }); return _sharedinstance; } in objective-c init method of class method 'init' prefix. it's 1 of biggest differences between objc , swift. if call init method bad you'll no doubt init new instance when init method return successfully. a static variable inside function keeps value between invocations. every time method sharedinstance called give same instance. more static variable check out here

c# - Sequential vs parallel solution memory usage -

i have slight issue following scenario: i'm given list of id values, need run select query (where id parameter), combine result sets 1 big 1 , return caller. since query might run minutes per id (that's issue, @ moment consider given fact), , there can 1000s of ids in input) tried use tasks. approach experience slow, solid increase in memory use. as test, made simple sequential solution too, has normal memory usage graph, expected, slow. there's increase while it's running, drops normal level when it's finished. here's skeleton of code: public class rowitem { public int id { get; set; } public string name { get; set; } //the rest of properties } public list<rowitem> getrowitems(list<int> customerids) { // solution has memory leak var tasks = new list<task<list<rowitem>>>(); foreach (var customerid in customerids) { var task = task.factory.startnew(() => return processcustomerid(cu...

Vue.js $set on array element does not trigger notification -

i have vue instance data contains array of objects. display data in table without issue. upon clicking table rows, set "selected" property on corresponding data object using: key.$set('testing', testing); upon setting value, add custom css class the table row, without issue. however, if simple output of entire array of objects @ bottom of page (such below), doesn't updated reflect new "testing" attribute have added. {{ griddata | json }} i able reproduce question using modified vue.js example code in jsfiddle: https://jsfiddle.net/wdmatl/531axrtt/ notice when click on rows of data, either see "testing" or "not testing". new object data isn't reflected in json @ bottom of page. why not?

How to get the rotation value of a UI Element in WPF -

i've figured out how assign rotation value (element.rendertransform = new rotatetransform(x)), how rotation value of element? for example, if wanted make 1 ui element have same rotation angle ui element, how that? you can rotation value doing: rotatetransform rotation = element.rendertransform rotatetransform; if (rotation != null) // make sure transform rotatetransform { double rotationindegrees = rotation.angle; // rotationindegrees here, if needed... } if want make uielement rotate in same way, can assign same transform: element2.rendertransform = element.rendertransform;

html - Echo isn't working within a section of my PHP -

okay, trying display text when goes wrong. want have if page number high (above 3 in case) display error. disregard accessing mysql database. <?php function get($name) { return isset($_request[$name]) ? $_request[$name] : ''; } function is_valid_index($index,$array) { return $index >= 0 && $index < count($array); } ?> <?php //variables $dbhost = "localhost"; $dbuser = "admin"; $dbpass = "pass"; $dberror = "you have failed connect database!"; $conn = mysqli_connect($dbhost,$dbuser,$dbpass) or die ($dberror); $select_db = mysqli_select_db($conn, "database") or die ("couldn't select database"); ?> <form> <?php $page = array('select list','users', 'groups'); echo '<select name="lists">'; for($i = 0; $i < count($page); $i++...

java - Replace fragments and start actives based on string name instead of list view item position -

based on list view, how can replace detail container particular fragment or start particular activity based on name of string item selected rather position of item within list? i'm looking case string rather case 0 , case 1 , case 2 , etc. code under inital incorrect code suggestion similar i'm looking not right solution. appreciated. strings <string-array name="continent_names"> //item 0 <item>@string/africa</item> //item 1 <item>@string/asia</item> //item 2 <item>@string/europe</item> </string-array> <string-array name="continent_descriptions"> //item 0 <item>@string/africa_description</item> //item 1 <item>@string/asia_description </item> //item 2 <item>@string/europe_description </item> </string-array> fragmentworld.java public class fragmentworld extends listfragment implements searchview.onquerytex...

html - Responsive Div Layout Rearrangement -

Image
i've been working independently on designing website local company , i've been stuck on how make layout/design work responsively. of right now, content looks similar this: however, browser screen decreases, or if browser on smaller resolution, item 3 shift below both item 1 , item 2 width of 100%. while both item 1 , item 2 inline each other. this: initially, had both wrapping divs (1 , 2) set display: inline-block . couldn't find sort of research said (after changing inline-block div container 2 in respective media query) child element inline separate element while child element in same container not. recently, i've started debating use of display: table , display: table-row , , display: table-cell try , organize content in table-like layout, couldn't find way assign item 1 , item 2 own row while excluding item 3. honestly it's been while since i've had mess html/css/javascript/etc., i'm little rusty. i'm hoping see if can point me ...

How to read specific lines of a file into a 2d array in python -

hello chemistry phd student "attempting" write code in python i have input file below reading in item: timestep 20000000 item: number of atoms 2 item: box bounds pp pp pp 0 51.577 0 51.048 1.06653 47.9335 item: atoms id type x y z 5 1 15.6042 48.7947 36.9084 27 1 18.4619 1.23863 36.2611 item: timestep 20005000 item: number of atoms 2 item: box bounds pp pp pp 0 51.577 0 51.048 1.03417 47.9658 item: atoms id type x y z 5 1 16.183 47.8777 37.7161 27 1 17.9296 50.8771 36.5807 ................... i want read file , extract point of array have handled far code in_name = raw_input('name of input: ') r_file = (open(in_name, 'r')) #readfile j, line in enumerate(r_file): if j%11 == 10: where getting line starts 27 every time reference. however can't seem append 1 line multidimensional array. i want array of floats this [[27.00], [1.00], [17.9296], [50.8771],[36.5807]] when read in data not worrying line reading this lines = [line.sp...

javascript - Smooth Scroll doesn't work when I set the html and body height to 100% -

html, body { height: 100%; min-height: 100%; position: relative; } #home { height: 100%; background: url("../img/test.jpg") center no-repeat; background-size: cover; } i'm using smooth scroll javascript css-tricks $(function() { $('a[href*=#]:not([href=#])').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html,body').animate({ scrolltop: target.offset().top }, 1000); return false; } } }); }); the first section of page it's full page image, need html , body have height of 100% set #home height 100% reason when smooth scroll effect doesn't work , when remove height: 100% html , body work. anyone same prob...

c# - VB.NET with MS access Database as backend how to deploy by putting Database file to AppData Folder? -

i have developed vb.net application using ms access db backend, @ development , testing have been using connection string dim connect_string string = "provider=microsoft.ace.oledb.12.0;data source=" & application.startuppath & "\data.accdb" as deployment client's machines, database must outside of program files, how deploy application separating database program files. ? you use environment.getfolderpath(environment.specialfolder.xxxx) to find suitable root directory, , add yourcompanyname\yourapplicationname it. xxxx, use either applicationdata , or localapplicationdata , or commonapplicationdata , depending on requirements (see here). or let user configure local or network path, example in config file. how "initial database" gets there program. example, test if @ there database file @ desired place , copy empty template mdb folder if there none. template db either in program's installation directory, or embedded r...

Matlab plot label's text is unreadable -

Image
first of all, i'm newbie matlab. use because need control system toolboox university. yesterday, launched script: % % esempio 11.2 % clear close clc % numg=10; deng=conv([10 1],[5 1]);deng=conv(deng,[1 1]); g=tf(numg,deng); % numra=8*deng; denra=conv([250 1],[0.4 1]);denra=conv(denra,[0.4 1]); ra=tf(numra,denra); numrb=8*conv([10 1],[5 1]); denrb=conv([250 1],[0.4 1]); rb=tf(numrb,denrb); numrc=8*conv([5 1],[1 1]); denrc=conv([0.02 1],[0.02 1]); rc=tf(numrc,denrc); numrd=0.025*conv([10 1],[5 1]); denrd=[1 1 0]; rd=tf(numrd,denrd); % la=g*ra; lb=g*rb; lc=g*rc; ld=g*rd; % calcolo margini di guadagno e di fase [kma,pma,wpa,wca]=margin(la); [kmb,pmb,wpb,wcb]=margin(lb); [kmc,pmc,wpc,wcc]=margin(lc); [kmd,pmd,wpd,wcd]=margin(ld); % calcolo massimo ritardo tollerabile taua=(pma/wca)*pi/180; taub=(pmb/wcb)*pi/180; tauc=(pmc/wcc)*pi/180; taud=(pmd/wcd)*pi/180; % fa=la/(1+la); fb=lb/(1+lb); fc=lc/(1+lc); fd=ld/(1+ld); % qa=ra/(1+la); qb=rb/(1+lb); qc=rc/(1+lc); qd=rd/(1+ld); % % fig...

Nutch and crawling millions of websites -

can use nutch 1.10 in order crawl millions of websites several number of round? i don't understand database created when launch nutch 1.10. enough crawl important data site? i have file list of url's take 2 gigabytes. yes, can. goal of nutch. however, crawling millions of websites takes time , space, , in order do, need setup environment correctly. in nutch 1.x "crawling database", e.g. urls visited, urls frontier (next urls visit),etc. persisted hadoop filesystem. place you'll first inject list of urls. in addition, in order view indexed data, can use solr (or elasticsearch). i recommend first going through nutch 1.x tutorial short list of urls , getting know how use nutch , plugins. after that, setup hadoop cluster tutorials hadoop site , , crawl away!

Vim Color Scheme behaving oddly in tmux -

Image
when set theme dark background in vim, on opening file in tmux, background spreads around lines having text. (please see attached image) tmux.conf has set-option -g default-terminal "xterm-256color" , .cshrc file has setenv term xterm-256color i think, question answered here . the fix disable background color erase property terminal: :set t_ut=

ios - How to parse a string to date using dateformatter in objective c -

i have string '2015-06-23t15:43:04.000+05:30' , want convert date format 23 june 2015 15:43 try one's: nsstring *temp = @"2015-06-23t15:43:04.000+05:30"; nsdateformatter *dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:@"yyyy-mm-dd't'hh:mm:ss.sss'+05:30'"]; nsdate *dte = [dateformat datefromstring:temp]; nslog(@"date: %@", dte); nsdateformatter *df = [[nsdateformatter alloc] init]; [df setdateformat:@"dd mmmm yyyy hh:mm"]; nslog(@"%@", [df stringfromdate:dte]); in console: date: 2015-06-23 12:43:04 +0000 23 june 2015 15:43

javascript - CompositeView where children can come from multiple collections -

here need in nutshell. i need show dropdown/combobox children can come many collections. these collections' models have text attribute show in dropdown. i wondering if possible create dropdown's list many collections. namely: collection 1 has: text: a, fungus: 9 text: b, fungus: 7 text: c, fungus: 6 collection 2 has: text: q, numberofbugs: 8 text: r, numberofbugs: 9 text: s, numberofbugs: 7 the list dropdown ends looking like: <option>a</option> <option>a</option> <option>a</option> <option>q</option> <option>r</option> <option>s</option> so if select a, want able a's model fungus attribute, , if select r want r's model has numberofbugs attribute. the idea 2 collections common attributes, in backend correspond different models. is there way in marionette/backbone? some way create dropdown has multiple data sources / collections? merging 1 collection not work because sync /...

javascript - zoomcharts - 1.5.1 hover over multiple links doesn't work -

i see zoomcharts has come cool features in latest update (1.5.1), has bugs believe... i not able hover on middle links in case of multiple links between 2 nodes. can hover on 1st , last link if copy paste following code here , can test yourself... <script> var data = { "nodes":[ {"id":"n1", "loaded":true, "style":{"label":"node1"}}, {"id":"n2", "loaded":true, "style":{"label":"node2"}} ], "links":[ {"id":"l1","from":"n1", "to":"n2", "style":{"fillcolor":"red", "todecoration":"arrow"}}, {"id":"l11","from":"n1", "to":"n2", "style":{"fillcolor":"red", "todecor...

Shell Script to Run a python code with two different folders of The Same Numbered Files -

i have 2 folders , each contains files has same numbering systems part of file name. example, folder 1 has: 001file_read.txt, 002file_read.txt, until 650file_read.txt folder 2 has: 001filtr.tsv, 002filtr.tsv, until 650filtr.tsv i want run python code using shell script runs following: python my_python_prog.py 001file_read.txt 001filtr.tsv the problem because have huge number of files of both folders. want find way run command once automatically run file001 folder1 file001 folder2 , file002 folder1 file002 folder2 , on until file650 of both folders. how can using shell script? thanks lot in advance, if have bash, use script this: #!/bin/bash in {001..650}; file_read=dir1/${i}file_read.txt file_filtr=dir2/${i}filtr.tsv if [[ -f $file_read ]] && [[ -f $file_filtr ]]; python my_python_prog.py "$file_read" "$file_filtr" fi done this loops through numbers 000 650 , checks both of 2 files exists , e...

iphone - How to check if a word is defined in the English dictionary in cocoa-touch? -

i trying make crossword app ios don't know how check if string valid english word or not. how can check it. there api or online facility check it. in advance easy in ios5 using uireferencelibraryviewcontroller class' +dictionaryhasdefinitionforterm: method. a uireferencelibraryviewcontroller object provides dictionary service definition of terms. create , initialize reference library view controller using initwithterm: method. pass term define parameter method , definition displayed. can present view controller modally or part of interface. on ipad, can set reference library view controller content view controller of uipopovercontroller object. optionally, use dictionaryhasdefinitionforterm: class method check if definition available given term before creating instance—for example, use method if want change user interface depending on whether definition available.

vba - How to evaluate typed-out formulas in Excel -

if type formula 1/4*pi()*($a$1)^2 string in cell , assuming have value in $a$1, use following vba function in third cell evaluate formula: public function e(byval textformula string) variant e = evaluate(textformula) end function is there way use math characters •, √, ¼, Ï€, ², etc. typed-out formula looks more agreeable? translate '[' , ']' '(' , ')'. can iterate through array replacements using replace() function simple characters extended characters Ï€? for sharp macro'ers... what showing intermediate steps (iterations) in (2*3) + (2.5*4) evaluates 6 + 10 in first iteration , 16 in next iteration. asside: want iterations stop before each set of addings/subtractings because know relative magnitudes of individual evaluated terms see part of formula controlling result. and mega-genius ones... what mixed units? such typing out 560{lbs}/[1.23{m}*3.4{'}] , getting result in ###{psf} example. thought unit delineated under...

objective c - Custom Tab Bar using storyboard -

Image
hello experienced ios developer new storyboard, using custom tab bar in storyboard using custom segue works fine (i can successful switch desired tab). when wan add more controllers selected tab using "show" or "push" segue app crash. googled many hours did not find solution. 1 me how resolve issue . from above image main report vc tab controller added via custom segue wan push right 1 controller colored red tab controller, crash app. have @ this implementation. have custom tab bar controller in app , made 1 based on solution. it's easy understand , uses storyboards well. i did not make it. credit goes mhaddl . you should not use push segues tab bar controller, meant used navigation controller instead. if want error leads crash please provide crash log info.

How to implement a userdefined cursor in C#? -

i want define own cursor current cursor in wpf application, wenn try create new cursor object .cur file, error. my code is private void newfile() { ... ievent_dragdrop = (htmldocumentevents2_event)doc; ievent_dragdrop.ondragstart += new htmldocumentevents2_ondragstarteventhandler(ievent_ondragstart); } private bool ievent_ondragstart(ihtmleventobj pevtobj) { x_start = pevtobj.x; // read position of mouse y_start = pevtobj.y; .... if (file.exists("mycursor.cur")) { system.windows.forms.cursor mycursor = new system.windows.forms.cursor(gettype(), "mycursor.cur"); system.windows.forms.cursor.current = mycursor; //system.windows.forms.messagebox.show("file exist"); } else system.windows.forms.messagebox.show("file not exist"); return false; } when try drag html object, error syste...

Getting a value from HTML format in Bash -

i want verify status become "ready" before performing next action. however, client return status in html format. how can "ready" value? code echo "$status" output: <reply><contents><status>ready</status> </contents> <status>ok</status> </reply> looks you've got valid xml there. can ready part out this: xmllint --xpath '//contents/status/text()' file.xml tempting may in relatively simple case use regular expression extract part you're interested in, recommend against it, wrong tool job , break input changes slightly. approach more flexible.

algorithm - Java: Scanner reads integer, but doesn't use it in while/for loop -

my book i'm learning uses libary reading inputs can't me.... i can't see mistake is. algorithm: read value of n set value of 3 follow steps iterate while < 2*n i+1 write 1/(2*i+1) console. my code: import java.util.scanner; public class aufgabe420 { public static void main (string[] args) { int i, n; system.out.println("please enter number!"); scanner sc = new scanner(system.in); n = sc.nextint(); system.out.println("n ="+n); system.out.println("the while-loop starts!"); = 3; while (i < 2*n){ += 1; system.out.println(1/(2*i+1)); } system.out.println("now for-loop"); (i = 3; < (2*n); i+=1) { system.out.println(1/(2*i+1)); } } } but trying it, results in: please enter number! 5 n =5 while-loop starts! 0 0 0 0 0 0 0 now for-loop 0 0 0 0 0 0 0 what's wrong code? help. 1/(2*i+1) result in...

ios - How to change the background of the navigation bar of a single view? -

i have application multiple views , main navigation bar has background defined in appdelegate.m . want 1 of these views have different background. i've tried embed whole view in navigation controller no luck. i've tried change background view controller class no luck. if can share code helpful. below might help [self.navigationcontroller.navigationbar setbackgroundimage:[uiimage imagenamed:@"image"] forbarmetrics:uibarmetricsdefault]

javascript - jQuery AJAX URL change Phonegap -

how change url in ajax , reload page new content? i make service in wp: www.test.com/page/?u=test $_get['u']; and while(..... new information) works good. but have problem this.. $('#test').click(function(){ uel = "http://......com/servisi302/?u=zanimljivosti"; $('#page-content').hide(1000); $('#page-content').show(1000); alert(uel); return false; }); jquery.ajax({ url : '' +uel, type : "post", datatype : "json", data : "param=no", success : function(html){ var query = jquery(".query"); console.log(html); jquery.each(html, function(key, value){ console.log(value); query.append("<div class='media well'><a href='#' class='pull-left'><img width='64' height='64' src='" +...

c# - messagebox to show many variables in a list -

Image
how show list (how use messagebox show numbers under each other ) list<int> numbers =new list<int>(); numbers.add(2); numbers.add(4); numbers.add(6); numbers.add(8); use string.join insert newline between each number. messagebox.show(string.join(environment.newline, numbers)); the resulting string displayed is: "2\r\n4\r\n6\r\n8"

ckeditor - How get plugin to load? -

i'm trying add fastimage plugin it's not working (it doesn't show in image dialog). adding incorrectly? in config.js: ckeditor.editorconfig = function( config ) { //add fastimage plugin , dependencies config.extraplugins = 'dialogui,dialog,fastimage'; ... } do need else?

python - Shapely: Cut a piece from a linestring at two cutting points -

the known function from shapely.geometry import * shapely.wkt import loads def cut(line, distance): # cuts line in 2 @ distance starting point if distance <= 0.0 or distance >= line.length: return [linestring(line)] coords = list(line.coords) i, p in enumerate(coords): pd = line.project(point(p)) if pd == distance: return [ linestring(coords[:i+1]), linestring(coords[i:])] if pd > distance: cp = line.interpolate(distance) return [ linestring(coords[:i] + [(cp.x, cp.y)]), linestring([(cp.x, cp.y)] + coords[i:])] splits shapely linestring 2 lines @ distance. what need cut piece of length line, @ position along line example line: line = loads("linestring (12.0133696 47.8217147, 12.0132944 47.8216655, 12.0132056 47.8215749, 12.0131542 47.8215034, 12.0130522 47.8212931, 12.0129941 47.8211294, 12.0130381 47.8209553, 12.0131116 47.8208718, 12.013184 47.8208107, 12.0133547 47.82...

javascript - How can I restricting grouping and draging inside a Kendo UI treeView -

Image
i got kendoui treeview this: at moment possible switch first level elements via drag , drop (group, rect-1.., line, text) should not possible group elements, drag elements inside group outside group. should possible switch elements inside group , switch elements on first level. how can that? i trying answer , hope meet exact behavior want it should not possible group elements, drag elements inside group outside group by i'm guessing want element/node can't change it's level (first if condition) it should possible switch elements inside group by i'm guessing want inside 2nd element on each 1st element, cannot switch parent (first if condition) my (second if condition) doesn't allow create 3rd element dragging 2nd element on 2nd element my (third if condition ) allow moving 1st element , comment i'm not sure mean allowing first element change add drop function treeview, add code : drop: function(e) { var data =...

objective c - Time difference between set automatically and by user in iOS device -

i'll show question example. so, f.e., it's 12:00 (set automatically) now, user decided change current time 12:10 (it won't exact time, user wants so). is there way 10 minutes in code? one method connect time server on own. or, if app running when changes, keep timer running , discontinuities in time. possible duplicate of: how can locally detect iphone clock advancement user between app runs?

sql - Get column description after removing a field from table -

i need field description sql server 2012. this query ok select discription_table.value sys.extended_properties discription_table, information_schema.columns column_table column_table.table_name = 'users' , column_table.ordinal_position = discription_table.minor_id , column_table.column_name = 'login' but if 1 of columns in table users removed after making description not working more. reason ordinal_position not minor_id anymore. how can fix it? management studio have problems this. my solution : need use anther set of tables. maybe "habit" , "old school", me solution more clear , more readable. select extended_properties.value sys.schemas,sys.tables,sys.columns,sys.extended_properties schemas.schema_id = tables.schema_id , tables.object_id = columns.object_id , tables.object_id = extended_properties.major_id , columns.column_id = extended_properties.minor_id , tables.name='user...

matlab - Delete Rows from matrix -

this question has answer here: remove rows of matrix in matlab 1 answer i have vector x (786432*1) , t(786432*1). i want delete rows x have value 2 , want delete same(corresponding)rows of t -(for example delete x(1,1) , t(1,1)) no important t values. confusing loop (index) > [r c]=find(x==2); how find same r , c in vector t? how implement in matlab? please 1 can help! you got how find indices remove: idxs = find(x==2); you can remove element @ indices with: x(idxs) = []; t(idxs) = []; example: >> x=randi(10,1,7); >> t=randi(10,1,7); >> x x = 10 3 2 2 1 5 5 >> t t = 6 9 3 4 2 10 7 >> idxs = find(x==2) idxs = 3 4 >> x(idxs)=[] x = 10 3 1 5 5 >> t(idxs)=[] t = 6 9 2 10 7 >>...

network programming - Rasberry pi Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory -

i'm trying allow pi connect public wifi network no password, can't seem wpa_supplicant.conf file right. here's file: ctrl_interface=dir=/var/run/wpa_supplicant group=netdev update_config=1 # public network network={ ssid="publicssid" key_mgmt=none } when try connect, however, error: wpa_supplicant: /sbin/wpa_supplicant daemon failed start run-parts: /etc/network/if-pre-up.d/wpasupplicant exited return code 1 failed connect wpa_supplicant - wpa_ctrl_open: no such file or directory wpa_supplicant: /sbin/wpa_cli daemon failed start run-parts: /etc/network/if-up.d/wpasupplicant exited return code 1 i able connect home networks , others have passwords fine. ideas what's going wrong? btw, connecting this: (wifi wlan1): $ sudo ifdown wlan1 $ sleep 5 $ sudo ifup wlan1 your wpa_supplicant.conf file should have psk="" in it, indicates no password. ctrl_interface=dir=/var/run/wpa_supplicant group=netdev update_config=1 # pub...

sql - SQLite Order Rows by Last Characters in a String -

i'm using sqlite database java application , have single varchar column bunch user stats written, read, , parsed java program. want have query can sort rows last stat in column. stats separated commas , lengths vary need can take whole last section of text (which text last comma end of data) , order that. easy within java application more resource intensive why directly query. in practice actual column data looks this: 2015/7/4 17:24:38,[(data1, 1, 1436394735787)|(data2, 4, 1436394739288)], 5 and i'm trying order rows based on last 5 or whatever else might (it can multiple digits too). iv'e tried find on internet lot of issues if had because of syntax errors (even when copied query exactly) or problems specific function doesn't exist , i'm not sure cause of errors is. i'm not familiar mysql simple answer appreciated. as quick , hacky solution (low performance if have huge amount of data): select * [tbl] order cast(substr([col], instr([col], ...