Posts

Showing posts from July, 2012

r - A better way to plot lots of lines (in ggplot perhaps)? -

Image
using r 3.0.2, have dataframe looks like head() 0 5 10 15 30 60 120 180 240 ykl134c 0.08 -0.03 -0.74 -0.92 -0.80 -0.56 -0.54 -0.42 -0.48 ymr056c -0.33 -0.26 -0.56 -0.58 -0.97 -1.47 -1.31 -1.53 -1.55 ybr085w 0.55 3.33 4.11 3.47 2.16 2.19 2.01 2.09 1.55 yjr155w -0.44 -0.92 -0.27 0.75 0.28 0.45 0.45 0.38 0.51 ynl331c 0.42 0.01 -0.05 0.23 0.19 0.43 0.73 0.95 0.86 yol165c -0.49 -0.46 -0.25 0.03 -0.26 -0.16 -0.12 -0.37 -0.34 where row.names() variable names, names() measurement times, , values measurements. it's several thousand rows deep. let's call tmp . i want sanity check of plotting every variable time versus value line-plot on 1 plot. what's better way naively plotting each line plot() , lines(): timez <- names(tmp) plot(x=timez, y=tmp[1,], type="l", ylim=c(-5,5)) (i in 2:length(tmp[,1])) { lines(x=timez,y=tmp[i,]) } the above crude answer enough, i'm looking way right. had concusion

Why does NANT need the .Net framework -

why nant need .net framework specified (in build settings) when msbuild.exe doing compile ? looking @ nant.exe.config, looks nant copies default .net libraries folders based on version of .net specified in build file.

c# - UIAutomation Click button without making window take focus and GetCurrentPattern() returning unsupported pattern -

i have handle of window , want click it's button named "load settings". have 2 problems. my first problem when call invoke on invokepattern, brings window focus , undesirable application. my second problem visible , documented in comments towards end of following code: automationelement aebot = automationelement.fromhandle(mbotsettinglist.elementat(i).getwindowhandle()); automationelement aebuttonloadsettings = aebot.findfirst(treescope.children, new propertycondition(automationelement.nameproperty, "load settings")); invokepattern ipclickloadsettings = (invokepattern)aebuttonloadsettings.getcurrentpattern(invokepattern.pattern); thread invokeloadsettingsthread = new thread(ipclickloadsettings.invoke); invokepattern ipclickopen = null; automationelement aeopendialogedit = null; automationelement aebuttonopen = null; automationelementcollection aedialogs = null; automationelement aeopendialog = null; valuepattern vpopendialogedit = null; //using thread

c# - Need to automate crunching of excel data? -

i have processes running on windows xp/7. generate weekly .csv data files. have bunch of excel formulas crunch numbers each .csv file produced week separately , when adding weekly data 1 big spreadsheet containing data put together. the number of rows varies each week , each process. can't hardcode number in dozens of formulas. right go through stupid process of manually entering formulas each week .csv files. there's got way of automating this. looked doing through c# or vb code. recommend best way this. c# or vb right way go? if so, hints on how put - what's model use? example, this: c# module reads in .csv data file c# module creates excel spreadsheet , populates .csv data c# module runs formulas on rows. is how 1 approach it? there better way has limited knowledge of c# or vb? know java , c++. any advice highly appreciated. thanks from explanations in comments, appears having series of template excel sheets facilitate task. so, each proces

c++ - Reading in file with delimiter -

how read in lines file , assign specific segments of line information in structs? , how can stop @ blank line, continue again until end of file reached? background: building program take input file, read in information, , use double hashing information put in correct index of hashtable. suppose have struct: struct data { string city; string state; string zipcode; }; but lines in file in following format: 20 85086,phoenix,arizona 56065,minneapolis,minnesota 85281 56065 sorry still cannot seem figure out. having hard time reading in file. first line size of hash table constructed. next blank line should ignored. next 2 lines information should go struct , hashed hash table. blank line should ignored. , finally, last 2 lines input need matched see if exist in hash table or not. in case, 85281 not found. while 56065 found. as other 2 answers point out have use std::getline , how it: if (std::getline(is, zipcode, ',') && std::ge

javascript - Is there a possible way to write current month and year in timeline script? -

i have timeline script, , want, script work current month. var timeline = new timeline("timeline", new date("mar 2013")); i need replace "mar 2013" "mar 2014", dont want write hand. mean, in future, script should automaticaly current year , month. possible? thanks of answers! "is possible?" of course. using new date() without arguments gets date object (full) current date, so: var timeline = new timeline("timeline", new date()); or if want midnight on first day of current month: var = new date(); var timeline = new timeline("timeline", new date(now.getfullyear(), now.getmonth()));

multithreading - Compile Java to behave like GO code -

would possible write java compiler or virtual machine let compile legacy java application use thread , blocking system call same way go program compiled. thus new thread().run(); create light weight thread , blocking system call instead asynchronous operating system call , make light weight thread yield. if not, main reason impossible! james henstridge has provided background on java green threads, , efficiency problems introduced exposing native os threads programmer because use expensive. there have been several university attempts recover situation. 2 such jcsp kent , ctj (albeit defunct) twente. both offer easy design of concurrency in go style (based on hoare's csp). both suffer poor jvm performance of coding in way because jvm threads expensive. if performance not critical, csp superior way achieve concurrent design because avoids complexities of asynchronous programming. can use jcsp in production code - do. there reports jcsp team had experimental j

jsp - Alternatives to Java applet or solution to unsigned the applet website connection -

i have written applet reads data (in form of string) website each 2 seconds, processing , display results in bar-form (basically display on swing components). working fine when launched netbeans. once did out-side netbeans, hell break loose because of signed , un-signed problems, applet un-signed. question is, other options same process within java ( not familiar other languages much) because have seen people talking sfx fx , jsp couldnot figure out mapping applet them. other thing is: couldn't find post shows how establish url connection un-signed applet, u aware of any? regards. there no alternative cross-site access in applet. applet needs digitally signed. a jsp without being digitally signed, you'd need running java on server side (an applet needs java on client side). in case you're wondering. cross-site access stealing resource 1 site, reproduce on site if property of other site. why sun/oracle decided applet need digitally signed. user should

java - Issue related to implementing Inverse DCT on Images -

i trying implement dct on images part of understanding whole jpeg compression pipeline (in java). can implement forward dct. however, facing issues in inverse dct. highly appreciated. public bufferedimage inverse_dct (bufferedimage img) { int width = img.getwidth(); int height = img.getheight(); bufferedimage outputimage = new bufferedimage(width,height,bufferedimage.type_int_rgb); // ------------------- idct implementation ------------------------------ double [][]cos_basis = new double [8][8]; // 8x8 cosine basis implementation double [] coeff = new double [8]; // ------------------ pre compute kernel --------------------------- (int i=0;i<8;i++) { (int j=0;j<8;j++) { cos_basis[i][j] = math.cos((2*i+1)*j*3.14159f/16.0f); // cosine kernel } if (i==0) coeff[i]=1/(math.sqrt(2)); else coeff[i]=1; } // -------------------- idct code --------

android - How can I limit the height of AndroidSlidingUpPanel when expanded -

i'm defining anchor point , works fine, need control maximum height of slidinguppanellayout when expanded. how can this? just set panel's layout_height whatever like, , things done.

imagej - Image Stack Color Analysis -

i have few images of same rock each of them revealing presence of element in different color. 1 of them show bright green when silicon present, may show dark red calcium present, etc. is there way overlay these , able tell concentration of minerals @ given point on rock? is there way overlay these if have 7 or fewer images, can open images , make them single image stack using image > stacks > images stack. or open them using file > import > image sequence if numbered. or if rgb, can blend them using image calculator (process > image calculator). if end single stack, can use imagej's composite image feature (image > color > make composite) overlay colors. and able tell concentration of minerals @ given point on rock? that part harder. may face of same challenges of colocalization analysis. qualitative analysis subjective, , human eyes fooled. see why scatter plots instead of colour merge images on fiji wiki more information.

Parse xml element into list in Python -

i've been trying days store list of coordinates list in python. i've tried minidom, xmlreader, , few others. i'm doing wrong, i'm on deadline , need help. <?xml version="1.0" encoding="utf-8"?> <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/atom"> <document> <name>kmlfile</name> <style id="s_ylw-pushpin_hl"> <iconstyle> <scale>1.3</scale> <icon> <href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href> </icon> <hotspot x="20" y="2" xunits="pixels" yunits="pixels"/> </iconstyle> </style> <stylemap id="m_ylw-pushpin">

javascript - d3 - when setAttribute() works but .attr doesn't? -

i'm puzzled why d3 method setting element attribute fails (in piece of code) while traditional js method works. (i'm trying update chloropleth colours user clicks html button change data being plotted, same json.) the html simple: <div id="buttons"> <button id="party">parties</button> <button id="tenure">tenure</button> </div> here's relevant js 2 lines side-by-side. when run in chrome, "object # has no method 'attr'": var paths = svg.selectall("path"); var plot = { "mode": "party", "redraw": function() { var e = e || window.event; var targ = e.target || e.srcelement; if (targ.nodetype == 3) targ = targ.parentnode; switch (targ.id) { case "party": // code in here break; case "tenure": paths.each(function(d,i) {

haskell - Leksah hangs on first startup -

Image
when start leksah input form shown (see image below). problem no matter do, nothing happens when click on ok or on cancel . never able past screen. click multiple times on 2 buttons in lower right corner. nothing. any idea how can collect meta data or skip step? i posted in leksah forum , posted workaround. the answer in forum post: https://groups.google.com/forum/#!topic/leksah/hafr25h7bkw ok, i've got working. understand, welcome screen appears if there isn't preferences file in ~/.leksah-0.13/ directory. copied prefs.lkshp file ~/.cabal/share/x86_64-linux-ghc-7.6.3/leksah-0.13.3.0/data , restarted leksah. time opened default 'leksah-welcome' session. hope tips you. sorry awful english. cheers, alex then: i encountered same problem. if copy "prefs.lkshp" file "error reading file....unexpected 'm'" message. work if copy both prefs.lkshp, , prefscoll.lkshp

routes - Angular dart equivalent of anuglar js Otherwise for routing -

i have been pretty comfortable setting route in angular.dart using routeinitializerfn but have not been able setup '404' route. when user visits unmatched route, should redirected 404.html page. myrouter(router router, viewfactory view) { view.configure({ 'home' : ngroute( defaultroute : true, view : './home.html' // visiting www.mysite.com load view ), 'user' : ngroute( path : '/user', view : './user.html' ), 'every-other-route' : ngroute( path : '*', // apparently wildcard route matching doesn't work in angular view : '404.html' ) any idea every other route load 404.html page? the route has defaultroute set true (if any) 1 matched when no other patterns match. for situation, you'd want move defaultroute property 'home' route , 'every-other-route' route , remove wildcard pat

Forloop and Javascript submit in PHP -

i have code this. as per previous question, dont want send values in url , going hidden field. in below code, when submit form, able post values in next page first row value (first while loop record). why? when inspect firebug able see hidden values records. in other words, first record getting posted next page , not consecutive records. if below code looks crazy, me in such way don't want pass values in url or anywhere in browser/webform <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>books</title> <script type="text/javascript"> function test() { document.forms.testform.submit(); } </script>

data structures - I need help organizing/planning a C# Tic Tac Toe Application -

i'm university student has experience in c++ , new c#. wanted feedback how approach building c# form application 5x5 tic tac toe game. the specifics of program require user enters time player make move choice. player selects whether or computer go first. player clicks start button game commence. so far figured i'd created 'move' class x , y coordinate representing location on game grid, , 'player' class contains list of 'move' objects have made in game. planning on adding grid of clickable labels add move players list of moves. ai, think pretty easy create algorithm block human player completing row, i'm not sure data structure efficient this. perhaps i'm thinking wrong begin with. any thoughts? in ui, use 5 * 5 tablelayoutcontrol button in each cell. can set flatstyle these button flat look. now, far maintaining model concerned, have single class represent players. this: class player : inotifypropertychanged {

jquery code to set color for a paticular string -

i have string this: var report = 'verifying wireless interface present , state disconnected:passed<br>verify profile not present on client:passed<br>add profile client:passed<br>verify profile added present on client:passed<br>connecting access point:passed<br>verify state connected:passed<br>disconnecting access point:passed<br>verify state disconnected:passed<br>reconnecting access point:passed<br>verify state connected:passed<br>verify ping gateway (access point):passed<br>verify signal strength greater 75%:passed<br>verify round trip time not greater 30 millieseconds:passed<br>disconnecting access point:passed<br>verify state disconnected:passed<br>delete profile client:passed<br>verify profile not present on client:failed<br>'; from this, have set green color passed string , red color failed string. how possible... you need wrap words in element report

python - BeautifulSoup help, how to extract content from not proper tags text in html file? -

<tr> <td nowrap> good1 </td> <td class = "td_left" nowrap=""> 1 </td> </tr> <tr0> <td nowrap> good2 </td> <td class = "td_left" nowrap=""> </td> </tr0> how using python parse it? please help. want result list ['good1',1,'good2',none] find tr tags , td s it: from bs4 import beautifulsoup page = """<tr> <td nowrap> good1 </td> <td nowrap class = "td_left"> 1 </td> </tr> <tr> <td nowrap> good2 </td> <td nowrap class = "td_left"> 2 </td> </tr>""" soup = beautifulsoup(page) rows = soup.body.find_all('tr') print [td.text.strip() row in rows td in row.find_all('td')] prints: [u'good1', u'1', u'good2', u'2'] note, strip() helps rid of leading , trailing whitespaces. ho

freebsd - SCTP INIT failed -

i have 2 virtual machine, both installed freebsd 10 / i386 / generic kernel (the host centos 6.5 x86-64 kvm) the first virtual machine named freetest0 , second freetest1 freetest0 = freebsd 10 / i386 / if vtnet2 192.168.6.100 freetest1 = freebsd 10 / i386 / if vtnet2 192.168.6.110 i want test speed between freetest(s) if. but, problem cannot connected sctp. tcp , udp well. whatever use iperf3 (with sctp support) , netperfmeter, cannot connected sctp. #the server freetest1 root@freetest1:~ # netstat -an -f inet active internet connections (including servers) proto recv-q send-q local address foreign address (state) tcp46 0 0 *.9000 *.* listen tcp4 0 0 192.168.0.110.22 192.168.0.1.39754 established tcp4 0 0 192.168.0.110.22 192.168.0.1.39752 established tcp4 0 0 127.0.0.1.25 *.* listen tcp4 0 0 *.22 *.*

cocos2d iphone - Xcode: sigABRT in alcMakeContextCurrent -

i fiddling around trying game center leaderboards work. after becoming frustrated, removed code added. however, stuck error, though deleted it! feels ruined finished game. specifically, here when error occurred: 1) using cocos2d. 2) copy , pasted gkauthentication project, imported .h first cocos2d scene. 3) got sigabrt error, , decided remove import. however, error persisted. 4) removed gkauthentication files project completely. however, error still persists. + (bool) makecontextcurrent:(alccontext*) context devicereference:(alcdevice*) devicereference { @synchronized(self) { if(!alcmakecontextcurrent(context)) //sigabrt occurs here { if(nil != devicereference) { check_alc_call(devicereference); } else { oal_log_error(@"could not make context %p current. pass in device reference better diagnostic info.", context); } return no;

java - How to insert a outlook mail msg as an element in a row in PostgresSQL -

i need develop system in requester upload outlook *.msg file having approval request. how can save(insert) *.msg file in postgresql row of approval table. business logic developed in java. you should store email messages bytea fields, because might in text encoding. would: create bytearrayinputstream points message file; and use jdbc parameterized insert or update , inserting data preparedstatement.setbinarystream(...) bytea field. see: jdbc tutorial - prepared statements pgjdbc - storing binary data

email - Server returned error: "No route to host" -

unknown error occurred. server returned error: "no route host" anyone can solve this? i'm using gmail fetch email mail server. everything's fine till now, 7 march2014 shown error like: unknown error occurred. server returned error: "no route host" and when check mail, shown: error fetching mail. mail account has not been retrieved since mar 7. view details "no route host" means problems internet connectivity (link down). can connect host computer double check it? less options include e.g. firewalling out google stop fetching users' email.

sql - Linq Many to many -

could please linq problem. users have list of properties , properties have list of users. i first query properties particular companyid. makes new list we'll call myproperties. i need tenants have property in myproperties list. for other reasons, don't have access "propertiesusers" join table. sorry if looks haven't thought through, i've been banging head day on it. you can use enumerable.selectmany() flatten hierarchy: var myproperties = dbcontext.properties.where(property => property.companyid = companyid); var tenants = myproperties.selectmany(property => property.tenants);

jquery - Input file type validation message not displaying -

i have file upload field in form , validating field using jquery validation following: my input tag: <input type="file" id="photo" name="photo" /> validation: $('#create_teacher').validate({ rules: { photo:{ required: true, extension: "jpeg,jpg,gif,png" }, }, messages: { photo: { // <- refers name attribute, not id. required: "this field mandatory", extension: "accepts jpeg, jpg, gif or png" } } }); can me in .

android - How to get list of my own application list from google play -

i have published few applications on google play , live well. google play exposes rest api ? can list out applications on google play , show user in current application. in advance ! as such there no api exist fetch apps list. here documentation on linking products , page can find out linking product list .

changing the short url into expanded url using html or javascript? -

how url masking done through html , javascript? have address https://stackoverflow.com/ how address redirect https://stackoverflow.com/question/ask . you can display link goes so: <a href="http://stackoverflow.com/question/ask">http://stackoverflow.com/</a> this like: http://stackoverflow.com on page while directing longer one.

About Django for iPhone CSS -

please me, not change iphone css pc css my pc.css , iphone.css same css also setting below: <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"> <link rel="stylesheet" type="text/css" media="only screen , (max-device-width:320px) , (max-device-width:480px)" href="{% static "asset/js/iphone.css" %}"/> </head> </html> iphone.css is: @media screen , (max-width:320px) { body{ background-color:#e5e5e5; max-width: 100% } }

windows - How to make cabal to list necessary libraries, and provide me the choose of their versions without automatical installation? -

i encountered inconvenience when builded package: gtk . when wrote cabal install gtk-0.12.4 trying build upon modern dependence libraries. , failed. had track install necessary versions of dependence libraries. is there convenient way make cabal tell me, dependencies should installed, , installed them myself, choosing necessary version? p. s.: installation talking described here: https://stackoverflow.com/a/22283107/2815429 you can start with cabal install --dry-run --only-dependencies gtk-0.12.4 and @ do. either install them manually, said, or add --constraint some-dependency==1.2.3.4 or similar parameters until satisfied version selection, , have cabal install in 1 go.

class - python className not defined NameError -

i have class need instantiate in order call method contains. when access class works fine when run terminal says : file "myclass.py", line 5, in <module> class myclass: file "myclass.py", line 23, in todict td=myclass() nameerror: name 'myclass' not defined pasting code: class myclass: def convert(self,fl): xpd={} # process stuff return xpd if __name__=="__main__": source=sys.argv[1] td=myclass() needed_stuff=td.convert(source) print needed_stuff looking @ indentation of code (and edit history of question), suspect if __name__ == "__main__" block inside of class definition. cause error, code within if run part of class being created, before class been bound name. here's simpler example of error: class foo(object): foo = foo() # raises nameerror because name foo isn't bound yet if form

algorithm - How to break the image into shattered shapes in android -

Image
am trying break image in shattered pieces, unable catch logic, please give me way how achieve. i hope below image can give idea, want, breaking bitmap shattered pieces triangle or shape. later shuffle bitmap shapes , giving puzzle enduser rearrange them in order. ok, if want rearrange pieces (like in jigsaw) each triangle/polygon have appear in rectangular bitmap transparent background, because that's how drawing bitmaps works in java/android (and other environments). there way sort of masking in android, called porter-duff compositing. android documentation poor non-existent, there many articles on use in java. basically create rectangular transparent bitmap large enough hold cut-out. draw onto bitmap filled triangle (with transparency non-zero) representing cut-out. can colour like. draw cutout on top of source image @ correct location using porter-duff mode copies transparency data not rgb data. left cutout against transparent background. this easier if ma

javascript - Passing object from array model into directive -

i have array of objects containing images source links. want add flag each image when source link dead , image can not loaded. , have following html code , directive. problem can't pass image object directly directive set property on it. i've tried adding scope directive , passing parameter didn't work, ended ugly approach tighly coupling directive outside scope , working on (annotated lines in directive source fragment). question is: implemented in more elegant way passing image object directive , without manual $apply() call? yes, i've tried during weekend , failed. <!-- angularjs v. 1.0.8 --> <ul> <li ng-repeat="image in images"> <div> <img ng-src="{{image.srclarge}}" fallback-src="/assets/fallback.png"/> <!--- image comments , other data --> </div> </li> <ul> directive: .directive('fallbacksrc', function () { var fallbacksrc = { restri

c# - Object reference not set to an instance of an object error in json -

i trying develop json feed below format { "contacts": [ { "id": "c200", "name": "ravi tamada", "email": "ravi@gmail.com", "address": "xx-xx-xxxx,x - street, x - country", "gender" : "male", "phone": { "mobile": "+91 0000000000", "home": "00 000000", "office": "00 000000" } }, { "id": "c201", "name": "johnny depp", "email": "johnny_depp@gmail.com", "address": "xx-xx-xxxx,x - street, x - country", "gender" : "male",

Oracle dead with unknown reason -

our oracle database dies time time. when log in alert, shows following exception: exception [type: sigsegv, address not mapped object] [addr:0xfffffffeaa7dd0e0] [pc:0x8213123, kslgetl()+111] [flags: 0x0, count: 1] ora-07445: [kslgetl()+111] [sigsegv] [addr:0xfffffffeaa7c58c0] [pc:0x8213123] [address not mapped object] [] dde: problem key 'ora 7445 [kslgetl()+111]' flood controlled (0x6) further messages problem key suppressed 10 minutes errors in file /home/oracle/app/oracle/diag/rdbms/orcl/sdh/trace/sdh_p104_2581.trc (incident=82376): ora-00600: internal error code, arguments: [ksl_invalid_latch], [kslges], [0x2aff2f2d8], [], [], [], [], [], [], [], [], [] any ideas? we find problem caused out of memory. when there not enough memory, oracle behave or cause os system hang. believe stored procedure caused problem.

RRDtool if one value is skipped in update the next one is missing also -

i have created rrd db, should receive update every hour , display values of received orders last 24 hours: rrdtool create db.rrd --step 3600 --start 1381230000 ds:measurment:gauge:4800:0:u rra:average:0.5:1:24 everything working ok, except fact when miss 1 value in update 2 of them missing database: so let have: .... 1381240800:1203 1381244400:1302 1381248000:1132 1381251600:988 .... but if second update wouldn't received (1381244400:1302), third (1381248000:1132) missing dispite fact arrived. can tell me why happening? thank you the problem if previous update missed, interval between last , current update larger 4800 seconds specified in ds definition. therefore rrdtool treat data between last , current update unknown . in rrdtool 1.4.8 have introduced special case gauge ds updates previous update more mrhb in past. in case rrdtool treat data supplied valid now-mrhb until now .

php - Refresh database and delete entry -

i made database consists of field [id, name, lastname, time] there function refresh database after 22h , delete data deleted database. it web application reserving tables @ club. , reservation lasts 22 hours, after that, cleared , table becomes free. you need cron job runs every 5 minutes. search net on how run php cron jobs. you need php script have delete query identify database rows has time > 22 hours. delete table_name time > now() - interval 22 hours

objective c - Embed Twitter Breaking News in ios -

how can embed twitter news feed in ios application? first of possible or not? if possible how? please keep in mind i'm not asking embed user time line i'm asking embed twitter news in application, just see webpage . follow below steps. login account visit https://twitter.com/settings/widgets create widget , set design copy code , create html file. open html file in webview. you done.

how to communicate an android activity with javascript code and vise versa in phonegap android? -

i new phonegap development. want's know how communicate our phonegap webpage native android activity , vise versa , give me tutorial phonegap learning.please can 1 me. thanking in advance. you need use cordova.exec api in able communicate between javascript code , android activity. maybe link can you. http://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v610/06_05_android_-_adding_native_functionality_to_hybrid_application_with_apache_cordova_plugin.pdf first thing need declare custom plugin in config.xml <feature name="customplugin"> <param name="android-package" value="com.androidapachecordovaplugin.customplugin" /> </feature> implementing plug-in using java code public class customplugin extends cordovaplugin { @override public boolean execute(string action, jsonarray args, callbackcontext callbackcontext) throws jsonexception { if (action.equals("sayh

python - Read the continuously growing file -

i ran command program 2> log.txt , and write output log.txt continuously. and output in same line, because every output has \r in end. i'm trying read log.txt in way, truncate clear data i've read. read_in_file = open(in_file, 'r') records = [] new_item in self.__get_matched_line(read_in_file): records.append(new_item) read_in_file.truncate() read_in_file.close() return records but has problem, still have-read data sometime. the program may run weeks.and outputs every 0.5 seconds your program have open file handle on output file; therefore if truncate file outside, file handle write old position, no matter how file had been truncated. result file of original length before truncation (the gap filled zeros, maybe read sparse files more details if choose path). can circumvent closing file handle , opening anew each line. best done within program of course. if cannot change that, can read line-by-line (de

c# - Send a contact from my Windows-Store-App to People App to add it to Exchange account -

Image
greetings fellow programmers! i developing windows-store-app windows 8.1 in work contact information. user can take picture of business card , gets data it. what want adding contact ms exchange account. know, in people app preinstalled on system, can connect online account, exchange account, , add contacts it. click add button, type in information need, choose account add , submit. because don't want use exchange web services access account diretcly, wanted use app kind of gateway that. i have seen posts suggest use contactpicker , contactpickerui. see contactpickerui has method "add contact". cannot find out gets added to. there sample app on msdn, uses both classes , addcontact method, showing on screen contact chose. can maybe use share charm achieve this? can tell me contactpickerui adds contact to? thanks in advance. ps: first time ask question myself. if there wrong it, let me know. i found way it. way can show contact details inside app

Print the Web Service's Response in java code -

i trying create web service client using wsimport tool. generates clientside stubs. in code trying print web service's result. try following code. import com.cdyne.ws.weatherws.weathersoap; import com.cdyne.ws.weatherws.weather; import com.cdyne.ws.weatherws.weatherreturn; public class weatherclient1 { public static void main(string args[]) { weather we=new weather(); weathersoap ws=we.getweathersoap(); weatherreturn wr=ws.getcityweatherbyzip("10021"); system.out.println(wr); } } it doesn't cause error or exception. print following result. com.cdyne.ws.weatherws.weatherreturn@4e280c i need print responses seperately.

c# - Allow anonymous access to a single WCF service method -

i have wcf service message security , username credentials. of methods starting [principalpermission(securityaction.demand, role = conststrings.roles.admin)] and these methods supposed called authenticated users. i want add method called anonymous, receive error: the username not provided. specify username in clientcredentials. i loking similar mvc's [allowanonymous] attribute one option implement own serviceauthorizationmanager , use own custom attribute rather principalpermission basically, have inherit serviceauthorizationmanager . plug wcf pipeline adding following configuration web.config (assuming class called 'customauthorizationmanager' in org.namespace namespace. <behaviors> <servicebehaviors> <behavior> <!-- avoid disclosing metadata information, set value below false , remove metadata endpoint above before deployment --> <servicemetadata httpgetenabled="true" /> <!

sql - SELECT 1 FROM [SystemEventLog] -

i using sql server 2008 r2 . i have sql job executes stored procedure daily 8:00 am . in stored, there statement : declare @midnight datetime, @starttime datetime = getutcdate(); -- has stored procedure run today? if exists (select 1 [systemeventlog] [createddatetime_utc] >= cast(@midnight date) , [createddatetime_utc] < dateadd(dd, 1, cast(@midnight date))) begin return end -- log storedproc ran declare @systemeventlogid int insert [dbo].[systemeventlog] ( [eventtype_id], [storedprocname], [details] ) values( 1, 'storedprocedureone', null ) according comment, block checking whether store procedure has run today or not, if yes return. but not getting how checks whether procedure has alreday ran today or not? can explain? thanks. breaking stored procedure down ... select 1 [systemeventlog] [createddatetime_utc] >= cast(@midnight date) , [createddatetime_utc] < dateadd(dd, 1, cast(@midnight da

visual studio 2013 - Windows phone emulator doesn't run without Hyper V on Win 8.1....any alternative emulator? -

Image
hi stuck problem above. there way of testing windows phone apps in visual studio 12 without having access hyper v? thanks if hardware not capable of running hyper-v, dead in water. otherwise if windows 8.1 license not include support of hyper v, can check out following post nokia install windows 8 x64 evaluation license on virtual machine - or use dedicated hardware setup or dual-boot etc. source: windows phone 8 sdk on virtual machine working emulator how run wp emulator without hyper v? (summary of nokia.com ) hardware requirements 64bit host operating system; at least 8gb of ram host machine; 30-40gb of free space. step-by-step check if computer capable of running windows 8 hyper-v download coreinfo open command prompt administrator , execute coreinfo.exe –v (in folder coreinfo.exe located) if have slat enabled, marked asterisk * ept * supports intel extended page tables (slat) . if not, unable run hardware-wise. download windows 8 64bit de

how to print json array in html return by node.js -

i return array node.js reading xml content txt file , store in array send html page using ajax method how task. xml2js = require('xml2js'); fs = require('fs'); var arr={}; var parser = new xml2js.parser(); fs.readfile('d:/test.txt', function(err, data) { parser.parsestring(data, function (err, result) { arr=result.cluster.array[0].string; }); }); app.get('/test', function(req, res, next) { res.json({ message: arr }); //passing array data }); how display in html page current used. whole data in console log not able display in html page message undefined : $.ajax({ url: '/test', complete: function(data) { json.stringify(data); console.log(data.message); // document.write(data.message); for(i=0;i<data.length;i++) { document.write(data.message[i].val); $('#did').append('

php - CodeIgniter Flashdata not being overwritten -

struggling find similar reports, thought i;d ask if else has encountered this, or knows why might happening. i'm setting session flashdata, , using keep_flashdata property ensure it's not lost on couple of requests. it's used exclusively in linear process ends in confirmation screen displays flashdata. the issue sometimes, although relatively randomly, display old flashdata. i.e. if user runs through process once, they'll correct data, second time might data last time. encountered situation whereby second time flashdata blank, third time flashdata first run through (which mad) the values going flashdata exist, whole thing break if didn't. isn't case of trying set new flashdata undefined , ending retaining old data - scenario makes sense me. anyone seen this? because of how sessions work? maybe it;s related keep_flashdata property? there way 'unset' flashdata? you need destroy session if exists @ beginning of process: sess_de

c# - Sending Email from Rows in GridView -

i have scenario in which, i've done work further process need help. i've excelsheet imported grid view , suppose there 10 records in it. i've send email , email retrieved gridview want @ first email send first 5 records after taking 5 seconds email resend next 5 records. following email sending code: void send_mail() { try { string pass, fromemailid, hostadd; foreach (gridviewrow gr in datagridview.rows) { hostadd = configurationmanager.appsettings["host"].tostring(); fromemailid = configurationmanager.appsettings["frommail"].tostring(); pass = configurationmanager.appsettings["password"].tostring(); label lblname = gr.findcontrol("lblname") label; label lblmail = gr.findcontrol("lblemail") label; string name = lblname.text; string mail = lblmail.t

r - standard error of outcome in lm and lme -

i have following linear models library(nlme) fm2 <- lme(distance ~ age + sex, data = orthodont, random = ~ 1) fm2.lm <- lm(distance ~ age + sex,data = orthodont) how can obtain standard error of distance age , sex? for fm2 (linear mixed model), can do sqrt(diag(summary(fm2)$varfix)) #(intercept) age sexfemale # 0.83392247 0.06160592 0.76141685 for fm2.lm (linear model), can do summary(fm2.lm)$coefficients[, "std. error"] #(intercept) age sexfemale # 1.11220946 0.09775895 0.44488623

sql - How to call Model class inside a normal php file? -

im using codeigniter framework. want know if possible call class extends model inside normal php file. if possible, how? thnx in advance response. yes it's possible. model php class. example have class blogmodel extends ci_model { ... } you in .php file include 'path/to/blogmodel.php'; $blogmodel = new blogmodel(); $result = $blogmodel->some_function();

PHP Variable in a Class array -

i trying call variable add array within class, keenp getting unexpected t_variable error when try. class mb_api { $sname = 'test'; $pwd = 'test'; $siteid = '10'; protected $client; protected $sourcecredentials = array( "sourcename"=>$sname, "password"=>$pwd, "siteids"=>array($siteid) ); }; the variables can set within class or outside, doesn't matter. set pull database. default variable values need compile time literals (they need constant before script runs, basically, "literal string" , number 42 or array of constant values array(1, 2, 3) ), meaning, can't have dynamic value (such variable). a better way use constructor: protected $sourcecredentials = []; //php5.4 , above syntax, synonymous array() public function __construct(array $sourcecredentials) { $this->sourcecredentials = $sourcecredentials; } note way, it's c

caching - Netbeans autocompletion don't work anymore even I clear cache -

since few days netbeans not auto-complete class , function, annoying, because work ona huge project thousands functions/class-methods... i tried delete cache in user netbeans directory. no effect, make background scan still don't work when done. i tried tu create new project, , checking out working copy in new directory ( never used in netbeans ) don't work. the funny thing @ home works correctly same project , same version of netbeans. it make me crazy... any suggestion ? thank you

json - Django rest-framework + polymorphic: serialize a list of URLs -

the relevant parts of model: class item(polymorphicmodel): rating = models.decimalfield(default=0.0, max_digits=5, decimal_places=2) picture = models.urlfield(max_length=200) category = models.foreignkey('category', related_name='items') # url_list class movie(item): title = models.charfield(max_length=200) description = models.charfield(max_length=2000) ... i have list of urls in item class. list should serialized in movie object serializer. so far tried create model represent url way: class url(models.model): url = models.urlfield(max_length=200) item = models.foreignkey('item', related_name='pictures') but empty list when movie serialized. serializers are: class urlserializer(serializers.modelserializer): class meta: model = scrollerpictureurl fields = ('url',) class movieserializer(serializers.modelserializer): urls = urlserializer(many=true) class meta:

java - TestNG test skips while executing it inside servlet -

i trying execute testng test inside servlet of " testlisteneradapter " , " testng " code snippet this: testlisteneradapter tla = new testlisteneradapter(); testng testng = new testng(); testng.settestclasses(new class[] {src.scriptdemo.logintest.class}); testng.addlistener(tla); testng.run(); so, when executing code snippet inside java program test name "logintest" executing (i.e. test starts, browsers opens , whole test executes). when same code runs inside servlet gives: [testng] running: command line suite =============================================== command line suite total tests run: 1, failures: 0, skips: 1 configuration failures: 1, skips: 1 =============================================== it seems test starts execute skipped. don't know reason behind this. ps: debug code , found that, skips test due firefoxdriver() in logintest selenium script file. code of logintest.java is: package src.scriptdemo; import org.openqa.sele

javascript - Kendo UI autocomplete databound event does not trigger -

i developing mobile application using kendo ui. in script file, $("#name").kendoautocomplete({ databound: onchange }); suppose autocomplete box has string "abc". when delete letter triggers databound event. delete last letter of autocomplete (emptying autocomplete) not trigger databound event. can explain problem? when type, auto-complete widget filter data source if there text in it; triggers data source change event in turn leads databound event being triggered in autocomplete.refresh method (where widget updates view if necessary). if there no text in input, data source not filtered , result, databound event isn't triggered (in case, auto-complete closes popup). if bothers , want databound triggered when clear input, can customize widget's search method: kendo.ui.autocomplete.fn.search = (function (search) { return function (word) { word = word || this._accessor(); var length = word.length;

wso2esb - WSO2 ESB 4.8.0 - OAuth2 handler class - dependent jars org.wso2.carbon.identity.oauth.stub-4.2.2.jar -

i have custom handler validate token using oauth2 , included custom handler in rest api configuration. copied custom handler.jar /repository/components/libs directory doesn't contain (org.wso2.carbon.identity.oauth.stub-4.2.2.jar). when invoke api oauth access token getting below class not found exception. java.lang.noclassdeffounderror: org/wso2/carbon/identity/oauth2/stub/dto/oauth2tokenvalidationrequestdto_oauth2accesstoken @ org.wso2.handler.simpleoauthhandler.handlerequest(simpleoauthhandler.java:61) @ org.apache.synapse.rest.api.process(api.java:285) @ org.apache.synapse.rest.restrequesthandler.dispatchtoapi(restrequesthandler.java:76) @ org.apache.synapse.rest.restrequesthandler.process(restrequesthandler.java:63) @ org.apache.synapse.core.axis2.axis2synapseenvironment.injectmessage(axis2synapseenvironment.java:220) @ org.apache.synapse.core.axis2.synapsemessagereceiver.receive(synapsemessagereceiver.java:83) @ org.apache.axis2.engine.axisen