Posts

Showing posts from March, 2011

c# - WPF application stops interacting on screen rotate -

we have wpf app runs fine, user reported locks when screen rotated. (tablets that!) the app renders after rotate stops responding mouse/keyboard. doesn't show 'non-responding' in windows sense. we can simulate "lock up" here, debugging odd: lock not occur while in vs debugger if try , attach locked process, vs says process built without debug information before lockup vs can attach/deattach same exe process we have put trace outputs in global unhandled exceptions nothing fired. i can think of 1 next step debug start hack out chunks of code , find breaking area. anyone seen before or got suggestions? thanks! the issue update library using called sparkle . it creating hidden winforms form in it's constructor. there must kind of wpf/winforms interop bug during screen rotations. removing form or removing library fixed issue.

mysql - Nested update in select -

i executing select id uid, ( update trans set paidout=1 user_id=uid , sum(amount)>0.5234 ) accounts but no success, why doesn't work? you have used wrong syntax ,you can use select subquery in update query, in select query can't update subquery ,if want update paidout trans table scenario user_id same id accounts table , sum of user amount should greater 0.5234 can update trans t join accounts on(t.user_id = a.id) join (select user_id trans group user_id having sum(amount) > 0.5234 ) tt on(tt.user_id = a.id) group a.id set t.paidout=1

netlogo - Equivalent to link-here? -

how 1 access link object @ current location of turtle? instance count number of times event occurs while traversing particular link. i had (perhaps stupidly) assumed could: ask link(s)-here [set count count + 1] but link-here not method , doesn't work. any advice appreciated many reading. stephen are turtles wandering around plane , happen cross on links? if so, see bryan's answer. or, turtles intentionally walking along links? if latter, add: turtles-own [current-link] and @ time turtle chooses link , begins following it, store link in variable.

java - NullPointerException in an Array Stack -

i'm trying implement stack using array program reverses sound clips, taking pieces of .dat file stack , popping them off 1 one. i'm getting nullpointerexception in pop() method whenever run client program, , can't figure out why. here stack implementation: import java.util.emptystackexception; public class arraystack implements dstack { private int size = 0; private static int default_capacity = 10; private double arrayst[]; public arraystack(){ arrayst = new double[default_capacity]; } public boolean isempty(){ boolean empty = true; if(arrayst.length != 0) { empty = false; } return empty; } public void push(double d){ if(size == arrayst.length){ increasecapacity(); } arrayst[size++] = d; } public double pop(){ boolean empty = isempty(); if(empty == true){ throw new emptystackexception(); } double d = arrayst[--size]; arrayst[size] = null; return d; } public double peek(){ ...

c# - Force WebBrowser control to create isolated cookie for application -

i have gone through many questions related – not this. have webbrowser control in windows forms project. multiple instances of application run frm same windows server machine – different user credentials website. as know, webbrowser uses ie engine , has session merging. what best way force webbrowser control use individual cookie folders each instance of application wouldn’t mind cookie of other application. note: ie8 browser installed on server reference internetsetcookie function webbrowser control mishandling cookies when internet explorer open how clear webbrowser control cookie in c# multiple webbrower sessions / processes in 1 window c# webrequest using webbrowser cookie how delete cookies windows.form? internetsetcookie function: cookies created internetsetcookie without expiration date stored in memory , available in same process created them. cookies include expiration date stored in windows\cookies directory.

regex - Anchors inside of [ ] in sed -

using sed, why match: sed 's/test$/pass/' <<< "test" ...when doesn't? sed 's/test[$]/pass/' <<< "test" because […] represents character class in regular expression, [$] matches single literal $ character. in other words, cannot match anchors inside character classes. if want match a or b character or end of string, use alternation: sed 's/test([ab]|$)/pass/' <<< "test"

Hadoop MapReduce on Eclipse: Cleaning up the staging area file:/app/hadoop/tmp/mapred/staging/myname183880112/.staging/job_local183880112_0001 -

2014-04-04 16:02:31.633 java[44631:1903] unable load realm info scdynamicstore 14/04/04 16:02:32 warn util.nativecodeloader: unable load native-hadoop library platform... using builtin-java classes applicable 14/04/04 16:02:32 warn mapred.jobclient: use genericoptionsparser parsing arguments. applications should implement tool same. 14/04/04 16:02:32 warn mapred.jobclient: no job jar file set. user classes may not found. see jobconf(class) or jobconf#setjar(string). 14/04/04 16:02:32 warn snappy.loadsnappy: snappy native library not loaded 14/04/04 16:02:32 info mapred.fileinputformat: total input paths process : 1 14/04/04 16:02:32 info mapred.jobclient: cleaning staging area file:/app/hadoop/tmp/mapred/staging/myname183880112/.staging/job_local183880112_0001 java.lang.nullpointerexception @ org.apache.hadoop.conf.configuration.getlocalpath(configuration.java:950) @ org.apache.hadoop.mapred.jobconf.getlocalpath(jobconf.java:476) @ org.apache.hadoop.mapred.localjobrunn...

java - Hadoop conf files missing -

i using hadoop through vm image on rhel 5 provided ibm biginsights , unable locate conf folder . want embedd jaql eclipse develop front end. in ibm biginsights hadoop distribution, hadoop libraries, conf, scripts etc. located under /opt/ibm/biginsights/ directory default. can locate configuration directory of each components using following find command find /opt/ibm -iname "*-site.xml"

javascript - Find specific place in div where text occurs -

i have html: <div id="score-data"> <h4>soccer league</h4> <span>14:00</span> teama - teamb <a href="/match/pveahz4u/?s=1" class="fin">3:0</a> <br> <span>14:00</span> teamc - teamd <a href="/match/oo61fezi/?s=1" class="fin">0:1</a> <br><span>15:00</span> teame - teamf <a href="/match/z3zkcxjn/?s=1" class="fin">3:0</a> </div> this sample, there hundreds of identical html patterns within same div . need use jquery find href corresponding team. thought try like: var = $("#score-data:contains('teamc')").closest('a').attr('href'); but returns undefined , suspect because looking closest a tag outer div , doesn't help. how can jquery? here's jsfiddle working sample. fiddle demo var href = $("#score-dat...

Python and mechanize issues (Windows) -

ok, installed mechanize easy_install command prompt, when try write little snippet of code test it, python telling me can't import mechanize , idea might going wrong? i'm @ loss , unfamiliar mechanize . bah, had placed .py file in new folder within python27 folder , apparently issue. moved python27 , it's correctly importing.

PHP Fatal error during a DreamFactory installation -

i pulling hairs here , choking kittens frustration.. trying find nice , easy framework pull data mysql server ios , android apps using rest-api , found little promising application called dreamfactory. i had myriad of issues until stumbled on 1 while installing: php fatal error: call undefined function mcrypt_encrypt() in /opt/dreamfactory/platform/var/www/launchpad/vendor/kisma/kisma/src/kisma/core/utility/hasher.php on line 501 has encountered during installation of dreamfactory , can advise me or alternatively similar application? have tried using bitnami prepackaged version including stack? it's literally turnkey: https://bitnami.com/stack/dreamfactory

c# - Set a string column to nullable in EF6 -

i have model created bu ef6: public partial class comment { [displayname("شناسه نظر")] public int id { get; set; } [required(errormessage = "متن نظر را وارد کنید")] [displayname("متن نظر")] public string commenttext { get; set; } [displayname("تعداد پسندیدن ")] public long likecount { get; set; } [displayname("تعداد نپسندیدن")] public long dislikecount { get; set; } [displayname("تاریخ انتشار ")] public system.datetime publishdate { get; set; } [displayname("وضعیت نمایش ")] public string visible { get; set; } [displayname("نام کاربری ")] public nullable<string> autherusername { get; set; } [displayname("شناسه نظراصلی")] public nullable<int> commentfkid { get; set; } [displayname("شناسه کاربر")] public nullable<int> studentid { get; set; } [displayname("شناسه محتوا ")...

Limiting loop repetition in python -

i have program uses loop, thing though, how can make loop repeat given amount of times? code example below. while true: print "this should reprinted ten times" how can make code repeat ten, or given amount of times? you can do: for in range(10): print "this should reprinted ten times" or i=0 while < 10: print "this should reprinted ten times" i+=1 or simply print "this should reprinted ten times\n"*10 for range , random number: from random import randint num = randint(5,10) print "this should reprinted {} times\n".format(num)*num

flash - Can I write a text character to vector shape in ActionScript 3? -

i'm trying position korean characters based on position in word, that, need position them based on pixels of character starts, don't want lose ability scale characters. using textfield.textheight , whatnot isn't accurate enough i'm doing, , writing bitmapdata isn't enough since lose ability scale crisply. that said, can write letter right shape object? have vector character object? way position characters while ignoring white space around character. thanks! did try fte ? flash text engine should work korean characters nice precision , great set of helpful methods. the adobe® flash® text engine (fte), available starting flash player 10 , adobe® air™1.5, provides low-level support sophisticated control of text metrics, formatting, , bi-directional text. offers improved text flow , enhanced language support. while can used create , manage simple text elements, fte designed foundation developers create text-handling components. such, flash text ...

delphi - Iterating a panels controls results in an index out of bounds error. Why? -

i using delphi 7 (yes, hear guffaws). have tabbed notebook want controls appear in sequence prior control finished correctly. each page in notebook, have named sheet. , controls on sheet, use tag property determine whether visible @ each step. steps result in 1 new control showing, steps have many 5 controls popping view. thought iterate through controls on tab sheet that's in view , turn off tag greater current step value. on page in question, there appear 23 controls in all, labels in view, edit fields pop view , arrow-shaped buttons advancing when newly popped field gets changed. seemed simple enough, except kept generating index out of range errors. sequence shut down out detailed error message eurekalog, not opened should have been. 'resolved' issue plugging in check name of control knew last in list , quitting loop @ point. added test kounter.tag <> 0 avoid leaving submit , cancel buttons on in routes. ideas why kounter kept on past 23? procedure tfrmmain....

How do I retrieve a child Class for Java reflection? -

so, going sound odd question, i need know how class object of child object in inheritance situation java reflection . the situation this: i'm writing craftbukkit plugins, java plugins work craftbukkit, server-side-only plugin a.p.i. minecraft. @ moment, i'm making plugin supposed "parent" of other plugins i'm writing. contains large amounts of useful objects , utilities. one class in plugin object class called myplugin want main classes of other plugins extend . (i know object names shouldn't start lowercase letter, lowercase "my" trademark craftbukkit plugins.) one of things want myplugin class able handle commands load plugins' data. therefore, when command called, i want plugin call of methods in plugin's main class start "load" . i know how search through methods in class ones starting "load" if can retrieve class , if try call getclass() in myplugin class, believe it's going return myplugin cla...

html - Clicking Google-map beneath the canvas -

this 1 getting tricky me.i have google map in page working ,above lies canvas. need make google map clickable .i.e when click on canvas ,the map should behave .i have added pointer-events:none; attribute.it works in firefox ,chrome , ie11. requirement need make clickable in ie9 on wards,which unable replicate. how that? if 1 can replicate behavior in fiddle ,that helpful me. there's old jquery hack simulates pointer-events: listen click event on canvas , in click handler: hide canvas: $(this).hide(); ask document element @ clicked xy: var $map=$(document.elementfrompoint(event.clientx,event.clienty); (adjust clientx/y offset map/canvas elements) if map element under canvas, define $map @ start of app , avoid step. trigger same event on google map: $map.trigger(event); redisplay canvas: $(this).show();

matlab - How to import column of numbers from mixed string numerical text file -

variations of question have been asked several times, example here . however, can't seem work data. i have text file 3 columns. first , third columns floating point numbers. middle column strings. i'm interested in getting first column really. here's tried: filename=fopen('heartbeatn1nn.txt'); = textscan(filename,'%f','headerlines',0); fclose(filename); when comes out single number--the first element in column. how whole column? i've tried '.tsv' file extension, same result. also tried: filename=fopen('heartbeatn1nn.txt'); formatspec='%f';sizea=[1 inf]; = fscanf(filename,formatspec,sizea); fclose(filename); with same result. could file size problem? not sure how many rows quite few since file size 1.7m. assuming columns in text file separated single whitespace characters format specification should this: a = textscan(filename,'%f %s %f'); a contains complete file content. ob...

c# - how to set progressbar while downloading file from ftp -

following code used download exe file drivehq private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click try dim strftppath, strdestpath string cursor.current = cursors.waitcursor 'strftppath url of latest upd located 'strdestpath system path dwonload upd ftp strftppath = "ftp://myusrnam:mypwd@ftp.drivehq.com/rstari9kremcos/rstari9.exe" strdestpath = "d:\rstari9\gds\rstari9.exe" my.computer.network.downloadfile(strftppath, strdestpath) cursor.current = cursors.arrow button1.enabled = false msgbox("latest updation downloaded 'd:\rstari9\gds\rstari9.exe'", msgboxstyle.information, "rstari9 - download success") catch ex exception msgbox(ex.message, msgboxstyle.information, "update downloading aborted...") end try end sub and this ui download , want add progressbar in it co...

html - Why Chrome doesn't respect the margin properly? -

Image
i search long , can't find answer :/ in chrome (internet explorer, konqueror, , many others) h1 margin @ bottom added .blue . however, firefox respect css rules properly. any suggestion? html <div class="red"><div class="blue"><h1>hello world!</h1></div></div> css .red{ background: red; /* contain margins */ float:left; /* padding-top:1px; */ /* display: inline-block */ /* overflow: hidden */ } .blue{ background: blue; min-height: 60px; } h1{ margin: 10px 0 20px; background: green; } gecko-based: [this 1 correct, guess] webkit-based, khtml-based , trident shell: codepen http://codepen.io/marquex/pen/fzsik the margin issue having related min-height rule in .blue div. replace height rule if possible same result in chrome , firefox. i have no idea why happening when using min-height though. maybe kind of chrome's bug.

php - Wordpress Guest Login Redirect on view posts -

i have wp site , try force guest login/register before viewing single posts.(not pages, archives etc.). i have function: // redirect users arent logged in... function login_redirect() { // current page global $pagenow; // check see if user in not logged in , not on login page if(!is_user_logged_in() && $pagenow != 'wp-login.php') // if user is, redirect login form. auth_redirect(); } // add block of code above wordpress template add_action( 'wp', 'login_redirect' ); the problem function redirects guest login when view page/post/etc. can me modify function redirect on viewing single posts? thanks, iasmina try this: function login_redirect() { // current page global $pagenow; // check see if user in not logged in , not on login page if (!is_user_logged_in() && $pagenow != 'wp-login.php' && is_single() && !is_home()) { auth_redi...

javascript - Show / Hide Button in Sencha Touch 2.3.1 losing reference -

so have problem in sencha touch app. have container defined: { xtype: 'container', text: 'something', height: '15%', width: '15%', itemid: 'optionsmenu', hidden: true, style: 'background:red', }, and have listener defined in listeners: { fn: 'onoptionsbuttontap', event: 'tap', delegate: '#optionsbutton' } and onoptionsbuttontap() method: onoptionsbuttontap: function() { var optionspanel = this.down('#optionsmenu'); console.log(optionspanel.ishidden()); if(optionspanel.ishidden()) { optionspanel.showby(this.down('#optionsbutton')); //optionspanel.addafterlistener('tap', this.onoptionsbuttontap); } else optionspanel.hide(); }, what want when tap button, container appear button. when tapping button next time, getting ...

multithreading - How to define a function as vetorize in python? -

i need define function vectorize . furthermore, function must multithread performance test. how option added? on web found 2 ways vectorize : 1) redefinition: function = pylab.vectorize(function) 2) decorator: @pylab.vectorize def function(self): .... this option not work in code, opted first one. i found following documentation, not much: http://docs.scipy.org/doc/numpy/reference/generated/numpy.vectorize.html http://docs.continuum.io/numbapro/ufuncs.html

jsp - javax.el.PropertyNotFoundException: Property 'HelpGroupItems' not found on type com.aais.helpguides.HelpGuide -

this question has answer here: javax.el.propertynotfoundexception: property 'foo' not found on type com.example.bean 2 answers when running code on tomcat, receive following error: javax.el.propertynotfoundexception: property 'helpgroupitems' not found on type com.aais.helpguides.helpguide. i have checked helpguide.java file make sure have helpgroupitems getter/setter methods defined correctly. have checked both jsp files misspelling of name. when showform=true , /updateform show up, when showform false or hit submit button updateform run error. appreciated. helpguidecontroller.java package com.aais.helpguides; import com.aais.helpguides.helpguide; import org.springframework.stereotype.controller; import org.springframework.ui.model; import org.springframework.web.servlet.modelandview; import org.springframework.validation.bindin...

html - change document root in all links of a website -

i have website made cakephp. of links in it, , asset paths, absolute (start "/"). we're having problems our hosting provider , domains messed up, including 1 website. i've managed access through domain, website instead of being on document root of domain (as original domain), inside few folders (so mydomain.com/folder1/folder2/folder3/my_index.php). is there easy way can make links/paths start "/" point folder want (for example mydomain.com/folder1/folder2/folder3/) instead of happens now? (they point mydomain.com) yes, want <base> html tag. use such: <head> <base href="http://mydomain.com/folder1/folder2/folder3/"> </head> you can make links open in new window adding target="_blank" attribute base tag. mdn reference: https://developer.mozilla.org/en-us/docs/web/html/element/base

python - How to refer to next element in a loop? -

i've been looking around can't find to. i'm sure i've seen done before can't seem find it. here's example: in case take difference of each element in array, #generate sample list b = [a**2 in range(10)] #take difference of each element c = [(b+1)-b b in b] the (b+1) denote next element in array don't know how , doesn't work, giving result: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] the result is: [1, 3, 5, 7, 9, 11, 13, 15, 17] i understand result shorter original array reason replace ugly expressions such as: c = [b[i+1]-b[i] in range(len(b)-1)] in case isn't bad @ all, there cases need iterate through multiple variables long expressions , gets annoying keep having write index in each time. right i'm hoping there easy pythonic way don't know about... edit: example of mean having multiple variables be: x = [a in range(10)] y = [a**2 in range(10)] z = [a**3 in range(10)] x,y,z in zip(x,y,z): x + (x+1) + (y-(y+1))/(z-(...

python - Invalid string syntax error -

this question has answer here: syntax error on print python 3 [duplicate] 10 answers why following code crash? i'm following along tutorial, , seems version bit newer 1 i'm following. syntax wrote makes complete sense me, yet claims it's invalid syntactically: var1 = "hello world! " print var1 or: print "hello world!" in python 3.x, print function, have call it. for example, print('hello world')

Formatting Bash output into one Table -

i have line of code produces first half of table. last half of table sizes hdd's . first code right now: function getiscsi() { host in ${allhosts} ; hostid="$( echo "${host}" | awk -f, '{print$1}' )" csv_fqdn="$( echo "${host}" | awk -f, '{print$2}' )" alloracledev=$(ssh -x -l root ${csv_fqdn} '/sbin/multipath -ll' | grep netapp|awk '{print $2}') in $alloracledev ; ( ssh -x -l root ${csv_fqdn} "fdisk -l /dev/$i|grep gb" |awk '{print $3,$4}' ) done ;ssh -x -l root ${csv_fqdn} "ls -l /dev/oracleasm/disks/|grep dm-[0-9]"|awk '{print $11, $9}'|cut -d/ -f3 done #2>/dev/null #| ${genhtml_cmd} } the output right looks this: 107.4 gbyte, 107.4 gbyte, 107.4 gbyte, 107.4 gbyte, 107.4 gbyte, 107.4 gbyte, 107.4 gbyte, 107.4 gbyte, 107.4 gbyte, dm-18 arch01 dm-16 na2lun01 dm-17 na2lun02 dm-21...

installer - Making an executable and installable file from c++ source code -

i've made game using sdl2.0 , c++ , i'm trying make executable file , make game installable but when try use .exe file visual studio made in debug folder of project , see game's window colored blue , nothing else happens! what should rid of things? should mention there images , sounds , other files should attached program! so should make installable file program? first off, not suggest using debug executable running game. rather compile file in release mode (also check compiler's release mode preferences). it's kind of hard why nothing shows without seeing of code or image of game's window; sounds executable can't find correct image , sound files. these hard coded in code? for operating system game designed for? if using windows, try wix toolset create installer.

networking - Python Backpropagation - How to Initialize the starting activation? -

Image
i having troubles implementing backprop network. i'm not understanding how start off because in network first layer has 8 nodes. prompt gives me 10 in training set. in first group example, have [0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0] but 8 nodes can assign starting activation each node or have 2 left over. ####################################################################################### # # preparations # ####################################################################################### import random import math import pygame import sys network1 = [] network2 = [] layer1 = [] layer2 = [] layer3 = [] set1 = [] set2 = [] set3 = [] mu = .5 eta = .1 ####################################################################################### # # node class # ####################################################################################### class node(object): def __init__(self,name=no...

algorithm - Printing out nodes in a disjoint-set data structure in linear time -

i'm trying exercise in introduction algorithms cormen et al has disjoin set data structure: suppose wish add operation print-set(x) , given node x , prints members of x 's set, in order. show how can add single attribute each node in disjoint-set forest print-set(x) takes time linear in number of members of x 's set , , asymptotic running times of other operations unchanged. assume can print each member of set in o(1) time. now, i'm quite sure attribute needed tail pointer , can keep track of children. since disjoint set structure has parent attribute, find-set(x) can print out nodes going in 1 direction. now, having tail pointer, let's go other direction well. however, i'm not sure how write algorithm this. if me out in pseudocode, appreciated. each node should have next pointer next node in set in. nodes in set should form circular linked list . when singleton set first created, node's next pointer points itself....

virtual machine - Geny motion failed to import OVA -

suddenly, lost geny motion emulators (maybe after upgrading geny motion 2.2, not sure) , when ever download new virtual machine or emulator "failed import ova" error , can't use virtual machines downloaded @ in geny motion, work in virtual box! and have cleared cache , deleted old ovas , re-downloaded other emulators again , again, it's no use! any clue what's going on? is there way re-import emulators downloaded geny motion geny motion again instead of keeping downloading new emulators , getting same error? i solved problem myself. in case, had same problem after defragmenting computer. deleting ova , deploying files did not work (neither did reinstalling help). solved clearing cache in app itself: settings>misc>cache usage>clear cache try see if helps. if doesn't can't help.

html - Have list of URLs and the page of each URL has a specific link; any way to extract those links? -

Image
the urls have reddit links, e.g. http://www.reddit.com/r/pics/comments/22im98/this_blew_my_mind_a_real_restored_picture_of/ and each of links have picture/link @ top of page (usually imgur). here's picture/link above reddit link so there way use wget/curl/awk/sed/grep/cut/etc. give reddit link , imgur link? thanks using multi-platform web-scraping cli xidel xpath expression extract url of link class thumbnail : url='http://www.reddit.com/r/pics/comments/22im98/this_blew_my_mind_a_real_restored_picture_of/' xidel -q -e '//a[contains(@class, "thumbnail")]/@href' "$url"

java - Please arrays, and loops -

a. how write simpler? if (fclass[0] == 0 && fclass[1] == 0 && fclass[2] == 0 && fclass[3] == 0 && fclass[4] == 0 && fclass[5] == 0 && fclass[6] == 0 && fclass[7] == 0 && fclass[8] == 0 && fclass[9] == 0 && fclass[10] == 0){ }else{ } b. solved! how scan array (atm values in @ 0), when change of element set 1 , show ones have 0 still. example: if fclass[1], fclass[2], fclass[4], fclass[5], fclass[6], fclass[10], set 1. how program show me fclass[3], fclass[7], fclass[8], , fclass[9]? thanks help... for (int f = 0; f <= fclass.length; f++){ if (fclass[f] == 0){ system.out.println(fclass[f]); } c. teacher requires learn gui doesn't know herself, websites start learning that? a. can set boolean , loop through them check if zero. i'm assuming fclass variable int[]. boolean flag = true; (int : fclass) {...

How to migrate from Spring Data JPA to Spring Data Solr? -

is there recommended way of migrating spring data jpa spring data solr ? spring mvc app works alright using spring data jpa want blazing fast results delivered our data access layer. there (simple) tutorial helps integrate/migrate jpa solr ? if want keep search index in sync main data store (which continue function now) can check out following links 1 , 2 , 3 the links use elasticsearch instead of solr, switch should straightforward. one more thing in order make architecture more scalable, use entity event listeners not update search index, add event message queue rabbitmq. use multiple workers read events message queue , update search index.

Python split() not working as expected for first line in file -

i have large text file of data mined opinions , each classified positive, negative, neutral, or mixed. every line begins "+ ", "- ", "= ", or "* " correspond these classifiers. additionally, lines begin "!! " represent comment ignore. below simple python script supposed count each of classifiers , ignore comment lines: classes = [0, 0, 0, 0] # "+", "-", "=", "*" f = open("all_classified.txt") i, line in enumerate(f): line = line.strip() classifier = line.split(" ")[0] if classifier == "+": classes[0] += 1 elif classifier == "-": classes[1] += 1 elif classifier == "=": classes[2] += 1 elif classifier == "*": classes[3] += 1 elif classifier == "!!": continue else: print "line "+str(i+1)+": \""+line+"\"" f.close() print classes here sample of first...

javascript - Where does ripple emulator create files? -

i create file ripple emulator @ path: fullpath: "/myappfolder/myfile.txt" this code: filesystem.root.getdirectory("myappfolder", {create: true, exclusive: false}, function(dir){ dir.getfile("myfile.txt", {create: true, exclusive: true}, function(file){console.log(file);} ,function(error){console.log("error create file: "+error.code+":"+error.message);} ); } , function(error){console.log("error create dir: "+error.code+":"+error.message);} ); also can see file? on hard drive?

SQL MERGE CASE UPDATE multiple columns -

i appreciate on following issue. trying on sql server 2012. i trying use merge statement update column has had change rather perform update on whole row. when update performed on column want date modified column updated well. merge dbo.tablea target using ( select * dbo.dbo.tableb ) source on ( target.id = source.id , target.name = source.name ) when matched then update set target.age = case when target.age!= source.age then source.age else target.age end -- want update 'date_modified' column if case statement has made modification age column , target.address = case when target.address != source.address then source.address else target.address end -- want update 'date_modified...

php - Slim Set Middleware -

what's right way set custom middleware specific route calling setmiddleware method? wrote custom middleware: custommiddleware namespace slim\middleware; class custommiddleware extends \slim\middleware { public function __construct() { // omitted } public function call() { // omitted } } then want set specific route: $app->get( '/api/users(/)', function () use ($app) { echo 'middleware passed.'; })->setmiddleware(new \slim\middleware\custommiddleware()); using way get: invalidargumentexception: route middleware must callable or array of callables in c:\dev\rest\slim\route.php on line 336 any help? many thanks.

vb.net - Change function to read tab delimited file into datable? -

i need change below function read tab delimited file ideas how this? public function convertcsvtodatatable(byval columnnames boolean) datatable try dim dt new datatable each columnname in getcolumns(columnnames) dt.columns.add(columnname) next dim filereader new streamreader(filename) if columnnames filereader.readline() end if dim line string = filereader.readline while not isnothing(line) line = line.replace(chr(34), "") dt.rows.add(line.split(",")) line = filereader.readline end while filereader.close() return dt catch ex exception 'log file end try return nothing end function i replace following line: dt.rows.add(line.split(",")) with: dt.rows.add(line.split(vbtab)) that should split on tab delimited values... that said, recommend specialized library th...

android - Adding jars causes getFragments() to be undefined -

i added these four jars use showcaseview library. these getfragments() , getchildfragmentmanager() undefined. solutions this? or project targeting high sdk version? the android-support-v4.jar added older version , either replaced or overriding support library had included. replace .jar with newest version of support library , should fix issue.

casting objects in c# (Exchange Web Services Item to Email) -

i cannot work out how can need do. i have method called 'markasread' takes itemid , should mark mail item read. but seems item doesn't have 'isread' proeprty, email does, need cast exchange webservices mail item email message. here code: try { system.diagnostics.debugger.break(); //creates object represent desired mailbox mailbox mb = new mailbox(common.strinboxurl); //creates folder object point inbox fold folderid fid = new folderid(wellknownfoldername.inbox, mb); //this bind mailbox you're looking using service instance microsoft.exchange.webservices.data.folder inbox = microsoft.exchange.webservices.data.folder.bind(service, fid); //// if property not loaded yet, first load //mail.load(propertyset(basepropertyset.idonly, emailmessageschema.isread)); //if (!mail.isread) // check don't update , create unnee...

python - Pylab: Bounding box despite frameon=False -

when set visibility of axis false, axis replaced bounding box. please able me remove bounding frame. import pylab x=[0.1,0.2,0.3,0.4] y=[0.2,0.4,0.6,0.8] pylab.figure(num=1,frameon=false) circle = pylab.circle((0, 0), 1.025, color="black", fill=none) ax = pylab.subplot(111, aspect=1) ax.add_artist(circle) ax.scatter(x,y,s=30, c='red', marker='o', edgecolor='red') pylab.xlim([-1.1,1.1]) pylab.ylim([-1.1,1.1]) ax.xaxis.set_visible(false) ax.yaxis.set_visible(false) pylab.title("plot") pylab.show() try ax.axison=false , noticed axes "replaced" bounding box, looks has nothing figure. in ipython browsed through properties of ax , found property axison . turned false , worked me

windows phone 8 - How to Display Text in SystemTray -

first off, possible, , how. i've seen microsoft apps, such bing weather app, systemtray displayed without progress indicator moving. i'd implement same, , able toggle whether progress indicator on or off when required. how might implement sort of feature? here's how: progressindicator progress = new progressindicator { isvisible = true, isindeterminate = true, text = "downloading details..." }; systemtray.setprogressindicator(this, progress);

java - Spring attach data to the current transaction -

is there way access current transaction in spring ? objective add information transaction when starts , use information in method calls within same transaction. here solution ejb: how can attach data jta transaction? (or uniquely identify it) looking same spring. you can attach data thread using threadlocal , , use transactionsynchronizationmanager clear threadlocal , creating transaction scoped variable: transactionsynchronizationmanager.registersynchronization( new transactionsynchronizationadapter() { @override public void aftercompletion() { ... clear threadlocal ... } } );

java - How do I serialize a complex Class in GWT? -

i want serialize following class autobeans . public class getresults<t extends dto> implements result { list<t> results; protected getresults() { } public getresults(list<t> results) { this.results = results; } public list<t> getresults() { return results; } public void setresults(list<t> results) { this.results = results; } } here tried failed: public class autobeanserializer { private final autobeanfactory factory; public autobeanserializer(autobeanfactory factory) { this.factory = factory; } public string <t> encodedata(t data) { autobean<t> autobean = autobeanutils.getautobean(data); return autobeancodex.encode(autobean); } public <t> t decodedata(class<t> datatype, string json) { autobean<t> bean = autobeancodex.decode(factory, datatype, json); return bean.as(); } } the above c...

html - Uploading Images in PHP Error -

php code: insert.php <?php // create mysql login values , // set them login information. $username = "root"; $password = ""; $host = "localhost"; $database = "binary"; // make connect mysql or die // , display error. $link = mysql_connect($host, $username, $password); if (!$link) { die('could not connect: ' . mysql_error()); } // select database mysql_select_db ($database); // make sure user // selected , uploaded file if (isset($_files['image']) && $_files['image']['size'] > 0) { // temporary file name stored on server $tmpname = $_files['image']['tmp_name']; // read file $fp = fopen($tmpname, 'r'); $data = fread($fp, filesize($tmpname)); $data = addslashes($data); fclose($fp); // create query , insert // our database. $query = "insert tbl_images "; $query .= "(image) values ('$data')"; $results = mysql_query($query, $link); // print ...

TDD testing application entry points -

i'm new tdd, , quite far (even though it's adjustment process). however, i'm struggling how go testing entry points application. mean main(string... args) method, class single responsibility load , save properties file from/to disk, etc. when doing code first, didn't seem problem. wouldn't write test kind of methods/classes. however, how supposed follow tdd process when there's code have write without tests? in other words, when/how writing entry points fit tdd development process? in cases, can't unit test entry point, because, definition, unit test tests unit in isolation dependencies. in trivial edge cases, application's entry point composition root - is, place units integrated. while perform full systems test on entry point, should treat humble executable . my personal rule humble executable can contain no logic (only composition), , measure cyclomatic complexity ; if cyclomatic complexity of humble executable 1, it's ...

Where can I study ipython language? -

in korea, think there few people using ipython (not python). so there not useful information , community. now, i'm studying book data analysis (python data analysis). but it's hard study ipython oneself. where can helpful information ipython? well, first off, it's still programming. -) you'll never enough useful information or someone, find books , docs. second off, ipython isn't language, it's shell. can't learn lot of ( i guess?.. throw brick me if i'm wrong ), though (and should) learn things need work with. have tried going ipython official resource? http://ipython.org/documentation.html# guess there enough manuals , helpful stuff it.

java - What is use of trigger , Can anyone explain with an example that where we should use? -

i beginner in sql, please explain example. know how create simple trigger, don't have real example should use. a trigger used automatically act (i.e., apply logic) when action performed. simple example if have column holding last modification date - on every insert on update table, you'd want column updated current timestamp, regardless of how done, or application.

java - The following objects may have been concurrently modified in another transaction -

i have jsf page has button when click button calls method update object exist in database. when click button twice exception. searched didn't find related answer. using jpa 2.0 full exception message [4/10/14 10:36:54:532 edt] 00000138 registeredsyn e wtrn0074e: exception caught before_completion synchronization operation: <openjpa-1.2.4-snapshot-r422266:1481680 nonfatal store error> org.apache.openjpa.persistence.optimisticlockexception: optimistic locking errors detected when flushing data store. following objects may have been concurrently modified in transaction: [com.ibm.pp.epad.cmt.domain.brief-1] @ org.apache.openjpa.kernel.brokerimpl.newflushexception(brokerimpl.java:2184) @ org.apache.openjpa.kernel.brokerimpl.flush(brokerimpl.java:2031) @ org.apache.openjpa.kernel.brokerimpl.flushsafe(brokerimpl.java:1927) @ org.apache.openjpa.kernel.brokerimpl.beforecompletion(brokerimpl.java:1845) @ com.ibm.ws.uow.componentcontextsynchronizationwrapper.beforecompletion(...