Posts

Showing posts from July, 2013

r - split matrix by row into single array -

i split matrix has 2 columns array. have tested far splits column, e.g. mat <- rbind(c(5, 9), c(3, 7), c(2, 1), c(4, 3), c(8, 6)) ind <- gl(1,10) >split(mat, ind) [1] 5 3 2 4 8 9 7 1 3 6 but desired output is: 5 9 3 7 2 1 4 3 8 6 there must super easy neat trick this. pointers highly appreciated, thanks! you can use as.vector : ## presently have as.vector(mat) [1] 5 3 2 4 8 9 7 1 3 6 ## looking as.vector(t(mat)) # [1] 5 9 3 7 2 1 4 3 8 6

java - Hibernate: hbm2ddl doesn't set sequence.nextval as column default -

i'm running problem mapping sequences column's default while using hibernate's hbm2ddl generate database schema. after using hbm2ddl on fresh database generated sql doesn't set default value on table. causes problems when using other hibernate issue insert statements. the following java code details troublesome entity: @entity @table(name = "role") public class role { @id @column(name = "role_id") @generatedvalue(strategy = generationtype.sequence, generator = "seq") @sequencegenerator( name = "seq", sequencename = "seq_role_id", allocationsize=1, initialvalue=1) public integer getroleid() { return roleid; } ... } the above generates following sql in following order: create table role (role_id integer not null, primary key (role_id)) create sequence seq_role_id issuing insert through hibernate works you'd expect issuing insert through sql (e.g., insert "rol...

Is traffic between applications on the same azure website charged? -

let's assume following scenario: 1 website on hostname http://test.azurewebsites.com 2 virtual directories (applications) (test1 & test2) if make call inside codebase of http://test.azurewebsites.com/test1 towords webservice hosted on http://test.azurewebsites.com/test2 are charged traffic will run through load balancer or on same machine? the request run through load balancer, since request going same data-center not incur cost.

java - IO vs Database: Which is faster? -

this question has answer here: java file io vs local database 3 answers imagine have 1gb sized txt file. in java program, reading "line line" using bufferedreader . imagine have mysql database includes each line of 1gb file new row. reading "row row" inside java program. now, operation faster in situation, reading file or database? why? bufferedreader faster. explanation bit complexer. in case database warmed (running while) taken in memory. in case database might faster, running on same machine. warming require same queries, not case. is: once mysql has read first in memory. advantage of database database read following records while @ 1 resultset.next() step. not know whether mysql jdbc clever. on negative side, connection has made, , data marshalled. with bufferedreader still line processing time separate thread (or more t...

shell - Kill Process from Command Name -

in project need write function take name of command in parameter, , kill process executing command. don't know how go problem. can me please? assuming mean linux/unix: capture process id of command, can use pgrep : pgrep command this returns process id integer, can pass kill . kill -9 $(pgrep command) command extended regex pattern - pgrep test match commands called test , pgrep *test* match test , tester , bashtest etc. may have access pkill , similar skips step directly killing process matched.

java - JavaFX Listview bind button to the index of the cell -

im trying build custom view javafx allows 2 buttons "edit user" , "view user" placed in cell. i have adapter built having trouble assigning index button when cell created, problem when click button within cell null pointer excpetion. edit 07/04/2014 : have updated program logic little still struggling find solution problem - index assigned correct, incorrect ( set log give me current index , fluctuates drastically, leads me conclude cell constructor unreliable) i use following code : populatelistview(): public void populatelistview() { // 0 index each time list view repopulated // bind correct button index = 0; // refresh lists contents null lstnotes.setitems(null); // observable list containing items add observablelist notes = populateobservable(thistenant.getnotes()); // set items returned populateobservable(t); lstnotes.setitems(notes); lstnotes.setfixedcellsize(50); // use cell factory custom styling ...

java - Populating a custom listview from List, not an ArrayList -

i trying populate custom android listview list. using sugar orm save , data database. in activity use following 2 lines data, , put in simple listview. list<fish> fishlist = select.from(fish.class).orderby("species").list(); setlistadapter(new arrayadapter<fish>(this,android.r.layout.simple_list_item_1, fishlist)); this works expected , displays getstring() method fish class. every method have found populating custom listview uses arraylist fishlist list. have tried 4 or 5 tutorials , come short. describe populating list manually, not how if have data in database. i have arrayadapter classes set , @ 1 point had working load recent object list. suspected kind of loop needed couldn't working after hours of trying. is there way populate custom listview using list, or need convert arraylist somehow, , if so, how do items in list? can replace first line gets data database , puts in arraylist right away? i apologize if super simple (i'...

android - Back button when using the same activity for different views -

i have listview populating data sqlite database , using same activity load different data in it, when row of listview clicked displays information in activity , question how handle button takes appropriate list. 1st button clicked : intent i=new intent(hotel.class.this,activity_hotel); i.putextra("btn",1); startactivity(i); 2nd button clicked : intent i=new intent(hotel.class.this,activity_hotel.class); i.putextra("btn",2); startactivity(i); for button : public boolean onkeydown(int keycode, keyevent event) { if (keycode == keyevent.keycode_back) { intent home_intent = new intent(getapplicationcontext(),hotel.class).setflags(intent.flag_activity_clear_top); startactivity(home_intent); return true; } return super.onkeydown(keycode, event); } edited : in mainactivity case 2: intent intent3 = new intent(mainactivity.this,hotel.class); string lien="hotel"; intent...

joomla3.0 - how do i remove registration link in joomla 3.2 - login module -

i need remove registration link inside login view http://bartenders4hire.net/index.php/login without disabling registration functionality. we using js jobs on site , regular registration not providing fields, therefore need find code can delete registration link. i looked inside modules , plugins, couldn't find it anyone has idea can find code? you'll find registration-link in /components/com_users/views/login/tmpl/default_login.php on bottom of file. can override file in own template copying /templates/yourtemplate/html/com_users/login/default_login.php. can remove registration-line file in template, regards jonas

java - Android process for "silently" using refresh token to get new access token -

i trying handle situation in demo application i'm writing have expired access token, , need use refresh token new access token. background tasks this, i'd use asynctask app login (which works fine), i'm not sure how - if can done (i'm sure can, i'm not seeing right now). below current flow - call get() blocks ui thread, isn't i'm supposed doing here. our access ticket class contains both access token , refresh token. public boolean isloggedin() { if (isfreshaccesstoken()) return true; // if access token expired, we'll need use // refresh token one. use background task // this. string refreshtoken = preferences.getstring(refresh_token_key, null); if (stringutils.isnotblank(refreshtoken)) { refreshaccesstokenasynctask refreshlogin = new refreshaccesstokenasynctask(); refreshlogin.execute(refreshtoken); try { return refreshlogin.get(); } catch (exception e) { ...

postgresql - How to auto increment id with a character -

how auto-increment id of member in table character example: m_01 , m_02 , m_03 : create table company( id int primary key not null, name text not null, age int not null, address char(50), salary real ); the answer is: don't. use basic serial column. can format column on output. sensible table definition (added more suggestions): create table company( company_id serial primary key , birth_year int not null , company text not null , address text , salary int -- in cents ); then: select to_char(companyid, '"m_"fm00000') -- produces m_00001 etc. company;

registry - context menu for specific filetype -

i've been trying add right-click context entry .mkv files, i've added default value of "mkv.custom" hkey_classes_root\.mkv , added(using hkcu because overwrites hklm[?]) hkey_current_user\software\classes\mkv.custom\shell\click convert\command , have "ffmpeg.exe -i %1 -vcodec copy -acodec copy %1.mp4" default. issue menu not appear when clicking files .mkv extension. ideas why happening? [edit] wrote .reg file guys can test/help/(i can avoid typos) windows registry editor version 5.00 [hkey_classes_root\.mkv] @="mkv.custom" [hkey_classes_root\mkv.custom\shell\click convert\command] @="cmd.exe" [hkey_current_user\software\classes\mkv.custom\shell\click convert\command] @="cmd.exe" note applications use key hkey_classes_root\.mkv\openwithprogids tried this, not work. windows registry editor version 5.00 [hkey_classes_root\.mkv\openwithprogids] "mkv.custom"=hex(0): [hkey_current_user\software\classes...

php - How to add a jQuery Listener for 2 events? -

i have event in table if clicked function fires, want same function fire if item on dropdown select option selected. my working code table td if clicked is: $('td[id^="tblcell"]').click(function() { ... ... ... }); how can add code first line same function executues if select changed? something like: $('td[id^="tblcell"]').click(function() or ('select[id^="selectlist"]').onchange(function() { but doesn't work due syntax error... correct way code this? (if possible). i using php , latest jquery. thanks simply put code function , call in 2 seperate handlers. $('td[id^="tblcell"]').click(dostuff); $('select[id^="selectlist"]').on('change', dostuff); function dostuff(event) { // code }

http - What's the correct way of handling web requests during database maintenance? -

scenario: going scheduled database maintenance. hence unable serve dynamic content (just assume caching system in front of database needs maintained). during time, what's correct way of handling web requests trying access dynamic resource? what's correct http error code, if any, goes along notice service not available? should use errors in 5xx range? what implications in terms of seo? hurt if search engine crawlers try access site , see lots of error codes or pages same notice instead of dynamic content? can recover that? 503 service unavailable correct response use in situation.

algorithm - Median of medians is not the real median. Correct? -

personally, think median of medians not real median. correct? so if above statement true, why using median of medians pivot partition array find kth min elem's time complexity worst case o(n)? "n" num of elems. median of medians indeed approximation, not actual median. it used optimization, calculate pivot partition of array in algorithms quicksort or quickselect, such worst case complexity of o(n^2) avoided. wikipedia article it, saying: although approach optimizes quite well, typically outperformed in practice instead choosing random pivots, has average linear time selection , average linearithmic time sorting, , avoids overhead of computing pivot.

Making a new list with recursion from scheme -

this question has answer here: getting every nth atom using scheme not pick last atom 3 answers i picking scheme way learn recursive , found me:d now, have question. how make function called thirds picks 1 element , skips 2 , repeats process over. returns new list first element from, every triple of elements example (thirds '(a b c d e f g h)) should return (a d g) (define (thirds lst) (cond ((not(list? lst)) (newline) "usage: (thirds [list])") ((null? lst) lst) ((null? (cdr lst)) (car lst)) (else (cons (car lst) (thirds (cdr(cdr(cdr lst)))) )) )) thats code have tried not real luck.. help? there's way this, create helper function , pass along index. (define (thirds l) (thirds-helper l 0)) (define (thirds-helper l i) (cond ((null? l) '()) ((= 0 (modulo 3)) (cons (car l) (thirds-helpe...

php - Selecting an object using string names? -

i built object, give hex code colored backgrounds dependant on tag post has. example of object: ($tagcolor) stdclass object ( [school] => #113730 [funny] => #ef5017 [art] => #e2ba17 [wow] => #164852 [test] => #9bbb8e ) and example of code i'm trying use display background color: (i'm using laravel framework) @foreach($links $link) <?php $tag = $link->tags; ?> <span class="tagcolor" style="background: {{ $tagcolor->$tag }}"></span> @endforeach if use normal text select object value, works fine: $tagcolor->test returns: #9bbb8e how can select object value via string? does laravel allow regular php tags? suspect not. line doesn't work: <?php $tag = $link->tags; ?> this should allow omit line: <span class="tagcolor" style="background: {{ $tagcolor-...

c# - How to make a list of buttons dynamically and show them in the MainForm in a ListBox or ItemsControl -

i new in wpf. want make list of buttons list of class "buttons" , having 2 fields (buttoncontent,buttonid) in mainform in wpf. idea behind when mainform loaded want make buttons list dynamically. best example given in link http://www.codeproject.com/articles/25030/animating-interactive-d-elements-in-a-d-panel want make equal size buttons stacked horizontally. how can in wpf? thank in advance. this way it. there areas here need further research on part, started. first need viewmodel. plain old object. exposes properties , methods pertinent business. mentioned buttoncontent , buttonid. let's assume both of strings now. you'll need command button assume. public class buttonviewmodel : inotifypropertychanged { private string _content; public string content { get{ return _content; } set{ _content = value; onpropertychanged("content"); } } // you'll need implement inotifypropertychanged // take @ relayco...

c# - How to decorate JSON.NET StringEnumConverter -

i'm consuming api returns string values this. some-enum-value i try put these values in enum, since default stringenumconverter doesn't job try decorate converter additional logic. how can make sure values correctly deserialized? following code tryout job done. line reader = new jsontextreader(new stringreader(cleaned)); breaking whole thing since base.readjson cant recognize string json. is there better way of doing without having implement excisting logic in stringenumconverter? how fix approach? public class bkstringenumconverter : stringenumconverter { public override object readjson(jsonreader reader, type objecttype, object existingvalue, jsonserializer serializer) { if (reader.tokentype == jsontoken.string) { var enumstring = reader.value.tostring(); if (enumstring.contains("-")) { var cleaned = enumstring.split('-').select(firsttoupper).aggregate((a, b) => + b);...

c# - How to add Timer and add categories to hangman -

i use source code microsoft of hangman here link source code http://code.msdn.microsoft.com/windowsdesktop/hangman-c-version-e0d17f1b/view/sourcecode and selected c# version now don't know add timer , categories. if want add timer form, in visual studio, go toolbox, type timer , timer control appear. drag , drop control on form timer1 has been added control, visible in bar beneath form or in code : public mycontrol() { initializecomponent(); var timer = new timer(); timer.name = "timer1"; controls.add(timer); } to timer control public timer timer1 { { return (timer)controls["timer1"]; } } if want create event: //beware control must exist!!! timer1.tick += timer1_tick; private void timer1_tick(object sender, eventargs e) { //your code }

Excel : count with multiple text criteria -

i have below excel data :- b c 1 list list b result 2 no critical 4 3 yes critical 4 yes critical in cell c2 have used =countif(b2:b4,"critical")+countif(a2:a4,"no") formula. returns result 4. because found 3 occurrences of text "critical" , single occurrence of text "no". hence result 4. what want : should give result 1 . mean if row has text "no" , row b has text "critical" count result, should not count other combination. using above formula count irrespective looking combination. there formula other countif perform operation above? try 1 excel 2007 , later: =countifs(a2:a4,"no", b2:b4,"critical") for excel 2003 can use: =sumproduct((a2:a4="no")*(b2:b4="critical"))

java - How to keep a Bluetooth connection when Sphero is synchronized and I use several Activities (Sphero SDK 2.0 for android) -

several months had problem when went 1 activity , wanted keep synchronism sphero time. solution passing id of sphero intent , recouping next code: @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // robot object sent through activity string robotid = getintent().getstringextra("robot.id"); robot robot = robotprovider.getdefaultprovider().findrobot(robotid); } i have same problem because of sphero sdk has changed model 2.0. in api did same pass robotid activity (by intent), instancing robot in newest activity, doing next code doesn't work: robot robot = robotprovider.getdefaultprovider().findrobot(robotid); sphero mrobot= (sphero) robot; in fact, have checked if robotid filled correct value , correct, but have null value in robot.

Why do I get "Exception; must be caught or declared to be thrown" when I try to compile my Java code? -

import java.awt.*; import javax.swing.*; import java.awt.event.*; import javax.crypto.*; import javax.crypto.spec.*; import java.security.*; import java.io.*; public class encrypturl extends japplet implements actionlistener { container content; jtextfield username = new jtextfield(); jtextfield firstname = new jtextfield(); jtextfield lastname = new jtextfield(); jtextfield email = new jtextfield(); jtextfield phone = new jtextfield(); jtextfield heartbeatid = new jtextfield(); jtextfield regioncode = new jtextfield(); jtextfield retregioncode = new jtextfield(); jtextfield encryptedtextfield = new jtextfield(); jpanel finishpanel = new jpanel(); public void init() { //settitle("book - e project"); setsize(800,600); content = getcontentpane(); content.setbackground(color.yellow); content.setlayout(new boxlayout(content, boxlayout.y_axis)); jbutton submit = new jbutton("submit...

ios - add disclosure button to annotation and open information in new view controller -

i have been reading few other posts on disclosure buttons in annotations have been unable find helpful. adding annotations map locations parse json. add disclosure button these annotations , when disclosure button pressed load json information specific location in next viewcontroller. here code far displays annotation each location. viewcontroller.m #import "viewcontroller.h" #import "annotation.h" #import "city.h" @interface viewcontroller () @end #define getdatalurl @"http://www.club-hop.com/apptest.php" @implementation viewcontroller @synthesize mapview,jsonarray,citiesarray; - (void)viewdidload { [super viewdidload]; [self retrievedata]; city * cityobject; // load external page uiwebview nsmutablearray * locations= [[nsmutablearray alloc]init]; cllocationcoordinate2d location; annotation * myann; for(int u=0; u<citiesarray.count;u++){ cityobject=[citiesarray objectatindex:u]; myann=[[annotation alloc]init]; nsnumber *alat= c...

.net - Displaying all the rows from different columns into one single row and single column in sql -

i have table in database consists of name, maths, science, history columns wherein each persons marks displayed of each subject. need write query wherein need display in 1 single row as: anthony:30,70,60 $ raghav:25,30,45 , on.. can tell me how can that? declare @result varchar(max) select @result = coalesce(@result + '$','')+[name] + ':' + cast(maths varchar(3)) + ',' + cast(science varchar(3)) + ',' + cast(history varchar(3)) tablename @result variable contains concatenated string can return by select @result

knockout.js - Knockout observable only updates once inside jquery form -

i'm using jquery upload file client server. then, i'm using knockout filename , information file that's on server. however, i'm having 2 problems: the knockout observable "filename" gets updated once, first time file selected. the file name not being displayed. i know has interaction of knockout , jquery, haven't been able figure out what. i'm using knockout 2.2.1, jquery 1.9.2, , file upload here . haven't been able replicate jsfiddle yet; when do, i'll update question. html: <script type="text/jscript"> jquery(function ($) { 'use strict'; // initialize jquery file upload widget: $('#fileupload').fileupload(); }); </script> <div id="fileupload"> <form action="fileuploadhandler.ashx" method="post" enctype="multipart/form-data"> <input type="file" name="files[]" data-bind=...

java - why Class class need to be Generic? -

for example: class<string> c = string.class; i think, class object of string may have method know, it's act on string type. so, type param no need. if you're asking why class generic, it's type-safe generic methods can accept class parameter provide type bound. consider enumset . way create empty enumset of myenum use noneof : enumset<myenum> set = enumset.noneof(myenum.class) since class generic, compiler knows static noneof method returning enum<myenum> . idiom used extensively in persistence , remoting apis, such jpa type-safe queries , spring data projections, provide class literal @ compile time, , compiler understands api returning instance of class. an example in standard jre: legacy resultset#getobject(int columnindex) method returns object must cast. new resultset#getobject(int columnindex, class<t> type) tells jdbc driver want data in column converted specific class and compiler you'll getting type m...

transactions - Sql Server log file size doesn't maintain size when full db backup is made -

i have sql server 2012 database simple recovery model. sql log file size set 20mb when full database backup made, size of file set 1mb.. why that? default behavior? in simple revovery model log write has low rate. every time take full backup engine figure out log not critical , shrink 1mb.

c# - Display different number of records at each page in gridview -

this code displays 10 records par page in gridview for (int = 0; < ds.tables[0].rows.count; i++) { count += 1; } cnt = ds.tables[0].rows.count; pageddatasource pagedata = new pageddatasource(); pagedata.datasource = ds.tables[0].defaultview; pagedata.allowpaging = true; if (pgnum < 1) { pagedata.pagesize = 10; } else { pagedata.pagesize = 10; } pagedata.currentpageindex = pgnum; int vcnt = cnt / pagedata.pagesize; if (pgnum < 1) { panel1.visible = true; lnkprevious.visible = false; } else if (pgnum > 0) { panel1.visible = false; lnkprevious.visible = true; } if (pgnum == vcnt) { lnknext.visible = false; } else if (pgnum < vcnt) { lnknext.visible = true; } repeatvalues.datasource = pagedata; repeatvalues.databind(); i want display 10 records in first page , 20 records second page. appreciated. check link: http://www.dotnetcurry.com/showarticle.aspx?id=244 hope gives idea indexing functionalty. ...

sql server - MDX+TSQL column name doesn't exist -

i have create mixture of mdx , tsql follows: select "[state].[country].[country].[member_caption]" state, "[measures].[somemeasure]" [sum] openquery(my_olap_server, 'select [measures].[somemeasure] on 0, filter([state].[country].[country],not isempty([measures].[somemeasure])) on 1 (select {[state].[country].[country].&[index_here]} on columns [my cube])') if mdx returns no value, [state].[country].[country].[member_caption] not exists, query fails message msg 207, level 16, state 1, line 2 invalid column name '[state].[country].[country].[member_caption]' . is there way force either mdx or tsql (but i'm guessing mdx) provide this? thanks select "[measures].[statename]" state, "[measures].[somemeasure]" [sum] openquery(my_olap_server, 'with member [measures].[statename] [state].[country].currentmember.member_caption select {[measures].[statename],[...

javascript - Angular - 2 way data binding with DIV element style -

i'm building dragging interface using angular , jqueryui. reason want use angular is, wanted angularjs 2 way data binding awesome! here codepen - http://codepen.io/anon/pen/qmuvh/ in codepen - see there box text - "hello everyone" (div#layer). did bind style angular - top:{{layer.data.top}}px;left: {{layer.data.left}}px and added 2 input fields have ng-model same layer.data.top , layer.data.left ; when change value in input field - move div element. far works great. but made "hello everyone" div draggable using jqueryui in angular directive. can drag element around. what want - if drag around "hello everyone" div element - update layer.data.left , layer.data.top . change value in input field. how can that? you can try this: top : <input id='top' type="text" ng-model="layer.data.top"> left : <input id='left' type="text" ng-model="layer.data.left"> assig...

c# - Change ContentPresenter's DataTemplate -

i have popup, want display different things depending on various buttons clicked. i've added contentpresenter nad in contentpresenter i've got templateselector. problem far can see checks template use first time popup run , uses template on. there way code change template use? the code i've got far (xaml): <popup isopen="{binding isopen}" height="{binding height}" width="{binding width}"> <grid> <contentpresenter x:name="cp" loaded="cp_loaded"> <viewmodel:popuptemplateselector x:name="put" content="{binding}"> <viewmodel:popuptemplateselector.view1> <datatemplate> <view:view1/> </datatemplate> </viewmodel:popuptemplateselector.view1> <viewmod...

mysql - Heroku with amazon RDS security -

i've setup our heroku app amazon rds instance. i followed guide here: https://devcenter.heroku.com/articles/amazon_rds this guide says require ssl connection , input rds credentials. this doesn't seem secure me. if has db url, user , password can login anywhere, correct? ssl nice prevent sniffing of info, i'd lock down further, machine, ip address or ssh. i setup rds db instances access locked down specific ips, heroku no longer recommends whatever reason. so questions are: are assumptions correct here? how can lock down further? why doesn't heroku recommend locking down ip (or @ least ip range) i'll run heroku support , post update, wanted thoughts community. previously, heroku recommended locking down access referencing heroku aws account id. that approach no longer recommended . heroku changelog entry lists reasons, reproducing here completeness: cross-security grants don't work aws vpc (which default on aws) it's not s...

c# - Searching each property value of an IQueryable collection of T against the value of a search query. How do I test for NOT NULL and CONTAINS together? -

i trying search each property value of iqueryable collection of t against value of search query. have following function , know how test not null , contains together? private expression<func<t, bool>> propertysearch { { // object passed lambda expression parameterexpression instance = expression.parameter(typeof(t), "val"); expression whereexpr = expression.constant(true); // default val => true var _properties = typeof(t).getproperties(); foreach (var prop in _properties) { var query = _httprequest["query"].tolower(); var property = expression.property(instance, prop); var tostringcall = expression.call(expression.call( property, "tostring", new type[0]), typeof(string).getmethod("tolower", new type[0])); whereexpr = expression.and(whereexpr, expression.call(tostringcall, typeof(string).getmethod...

php - How to go about modifying the Wordpress "Pages Add New Screen" -

Image
i have been thinking developing own theme framework worpdress. i'd use jquery ui build bootstrap 3.0 drag , drop interface, have worked out, can't figure out how edit "pages add new screen" referenced here: https://codex.wordpress.org/pages_add_new_screen would add files client side theme affected admin structure well? have suggestions how this. alot of themes these days come these drag , drop frameworks , nice, able create 1 of own, need direction on start editing / looking. we add custom meta box , our thing inside it. there some hooks not meta boxes , can use insert content admin page: add_action( 'edit_form_top', function( $post ) { echo '<h1 style="color:red">edit_form_top</h1>'; }); add_action( 'edit_form_after_title', function( $post ) { echo '<h1 style="color:red">edit_form_after_title</h1>'; }); add_action( 'edit_form_after_editor', function( ...

c# - Windows phone issue with OpenStreamForReadAsync -

i'm reading xml file on windows phone 8 below: windows.storage.storagefolder localfolder = windows.storage.applicationdata.current.localfolder; var file = await localfolder.getfileasync("myxml.xml"); var stream = await file.openstreamforreadasync(); xdocument mydocument = xdocument.load(stream); it doesn't happen application stuck @ file.openstreamforreadasync. no exception, no return ... nothing. doesn't anything.

java - JUnit with Ant returns "No runnable methods" -

i'm banging head against wall - have empty test file (its more test build file else a few months build file got corrupted - , reason starting new project didnt fix it, had make 1 scratch, needed support build, requires test - , not working :( package com.rcdc.questiondatabase; import org.junit.after; import org.junit.afterclass; import org.junit.before; import org.junit.beforeclass; import org.junit.test; import static org.junit.assert.*; public class rcdcservicetest { public rcdcservicetest() { } @beforeclass public static void setupclass() { } @afterclass public static void teardownclass() { } @before public void setup() { } @after public void teardown() { } // todo add test methods here. // methods must annotated annotation @test. example: // @test public void testhellotest() { if(true){ asserttrue(true); } } } my build file: <?xml version="1.0" encoding="utf-8"?> <project name=...

Android App and Java Server Errors -

i have java server. server used android application, application takes in sound (microphone) , streams directly server , out computer server. have error when try run server. exception in thread "main" java.net.bindexception: address in use: cannot bind @ java.net.dualstackplaindatagramsocketimpl.socketbind(native method) @ java.net.dualstackplaindatagramsocketimpl.bind0(unknown source) @ java.net.abstractplaindatagramsocketimpl.bind(unknown source) @ java.net.datagramsocket.bind(unknown source) @ java.net.datagramsocket.<init>(unknown source) @ java.net.datagramsocket.<init>(unknown source) @ java.net.datagramsocket.<init>(unknown source) @ com.datagram.server.main(server.java:28) i trying use this code .

How to implement a "timely query" using Apache+wsgi? -

i new apache + wsgi programming , trying implement "email notify" service. in service, users register email address , interesting game players' name, , web server timely (for example every 6 hours) query players' information, if new matches happen, send email users register email player. very straight forward approach, don't know how timely invoke service query informations... tried google, don't know should response functionality, apache? or configuration of mod_wsgi? could give me help? use backend task queuing system celery , configure periodic tasks. http://celery.readthedocs.org/en/latest/userguide/periodic-tasks.html do not try , part of web application.

android - dialog.show(); throws null pointer exception in Asynctask -

i tried access asynctask other class. problem pass context file of mainactivity asynctask class create progress dialog. dialog.show(); in sendtowebservice throws nullpointerexception mainactivity public class mainactivity extends actionbaractivity implements ontaskcompletion{ ontaskcompletion mcompletion; textview tv; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); mcompletion = this; setcontentview(r.layout.activity_main); try { new sendtowebservice(getapplicationcontext(), mcompletion).execute(); }catch(exception e){ string error=e.tostring(); string error2=error; }} public void ontaskcompleted(string value) { toast.maketext(mainactivity.this, value, toast.length_long).show(); tv=(textview)findviewbyid(r.id.textview1); tv.set...

google apps script - How can I get Selection in dashboard with ChartWrapper -

i´m trying event in google dashboard chartwrapper. i need when select row can throw event , selected value. can me or me how can it? here´s code: <script type="text/javascript" src="//www.google.com/jsapi"></script> <script type="text/javascript"> google.load('visualization', '1.1', {packages: ['controls']}); </script> <script type="text/javascript"> var data; var table; var dash_container; var mydashboard; var stringfilter; var mytable; function draw() { // see data visualization uses, browse // http://spreadsheets.google.com/ccc?key=pcqbetd-cptgxxxqig7vfiq data = new google.visualization.query( 'http://spreadsheets.google.com/tq?key=0ai3bbto5jfaodglusww0uvfvz3bdak1nyzvac0rpwgc&pub=1'); // send query callback function. data.send(handlequeryresponse); } //fin de draw ...

JavaFX: multiple columns for same data type in TableView -

i wonder if it's possible make tableview breaks data in multiple columns. so, instead of having long list of checkbox-name pairs, break in n columns: [✓] jim [✓] joe [✓] sue [✓] jane [ ] susan [✓] mark . . . . . . considering goal layout-related, recommend used tilepane checkbox-name pairs, rather table . know automatically how break ui widgets several columns.

PHP's html_entity_decode() in Python -

let's have file a.txt contains html encoded html, sth this: <!doctype html public "-//w3c//dtd html 4.01 transitional//en"> <html> <head> <title>html preview</title> <link rel="stylesheet" href="style.css" type="text/css" media="screen"> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </head> <body>&lt;!doctype html&gt;&lt;html itemscope=&quot;&quot; ... &lt;/script&gt;&lt;/body&gt;&lt;/html&gt;</body> </html> in php can do: <?php $content = file_get_contents('a.txt'); $start = strpos ($content, '<body>') + 6; $end = strpos ($content, '</body>'); $html = html_entity_decode(substr($content, $start, $end-$start)); file_put_contents('b.h...

excel - Matching List of Numbers (with Duplicates) to Strings in another Column -

i have 2 large lists of numbers, 1 duplicates , 1 without: first list: 2, 2, 3, 3, 3, 3, 4, 5, 7, 7, 7, 8, 9, ... second list: 2, 3, 4, 5, 7, 8, 9,... now, each unique number on second list, there column identifier number. example: 2 = a, 3 = b, 4 = c, 5 = d, 7 = e, etc. what want match unique identifiers on first list on second: new list: 2a, 2a, 3b, 3b, 3b, 3b, 4c, 5d, 7e, 7e, 7e, etc. is there easy way this? list has thousands of values cannot manually match them up. here example of spreadsheet: column a--column b--column c ----2-------------2-------------a ----2-------------3-------------b ----3-------------4-------------c ----3-------------5-------------d ----3-------------7-------------e ----3-------------8-------------f ----4-------------9-------------g what want this: column a--column b ----2--------------a ----2--------------a ----3--------------b ----3--------------b ----3--------------b ----3--------------b ----4--------------c ----5--------------d et...

Guice injection on nested classes of CLI App -

i writing command line interface application connecting oracle database using mybatis , injection done guice. my question injection of nested classes. class structure looks pretty this myinjector main --menu1 ----service1 ----menua ------service2 --------menuab ----------service1 --menu2 now need user type login , password app (can't have in config file) main initializes myinjector, grabs injector object that, , uses inject , initialize menu1. problem is, once im in menu1, needs go menua , menua going need inject services, , knows how deep end going. now, first thought make myinjector singleton class , instances of wherever needed , grab injector field created main class in beginning, im kinda curious if there's better way. is there more guicey way this? maybe need @assistedinject ? pass arguments factory method , instance of top level object it. other appropriately annotated fields injected automatically.

XCode Generic Archive instead of iOS app Archive -

Image
my application stops creating ios app archive, instead begins creating xcode generic archive. this happening after working on changes new release of app, i've added logical, ui changes , new frameworks. i reviewed "skip install" flags project, target , pod libraries i'm using. ok. made sure copy header build phase not including public nor private headers, project headers. checked "installation path" set valid path in project , target, , it's pointing applications . i've not target dependencies on main target nor copy files phase. please if 1 have found other possible things cause error i'd appreciate help. fyi i'd read following post in stackoverflow: cannot generate ios app archive in xcode cannot generate ios app archive in xcode https://developer.apple.com/library/ios/technotes/tn2215/_index.html http://pulkitsinghal.blogspot.com.ar/2012/03/wrong-archive-ios-app-archive-vs.html after spending more 4 hours on f...

vim horizontal and vertical splits from command line -

i'm trying open 3 files in vim command line. i'd 1 file on left vertical split between , other 2 files, remaining 2 files horizontally split. | 2 1 |--- | 3 i know can use command vim -o notes.markdown -o plan.markdown open first 2 files in vertical split , once i'm in can switch second file ctl w , use command split history.markdown achieve want, i'd able in 1 line command line. i tried using command vim -o notes.markdown -o plan.markdown -c split history.markdown gets close, splits first , second file leaving 3rd on right side of vertical split. the thing can't figure out if can tell vim use ctl key command line run ... -c <switchwindowcommand> | split history.markdown . there way specify control key? there many ways this; key :wincmd , lets execute arbitrary window commands. here, first create 3 vertical splits, , use <c-w>h move first window full-height vertical split on left: $ vim -o 1 2 3 -c "wincmd h" ...