Posts

Showing posts from February, 2012

TestNG parallel execution -

i have 4 @test methods , want run each of them 3 times. want execute simultaneously, in 12 threads. i created testng.xml file this <suite name="suite1" verbose="1" parallel="methods" thread-count="100"> <test name="test1"> <classes> <class name="tests"/> </classes> </test> <test name="test2"> <classes> <class name="tests"/> </classes> </test> <test name="test3"> <classes> <class name="tests"/> </classes> </test> </suite> if set parallel="methods" testng executes 4 test methods in 4 threads test1, after same test2, , test3. not want wait test1 completion before running test2. testng able run test1, test2 & test3 simultaneously (if parallel="tests") in case executes 4 test methods in sequence each t

testing - Prevent accidental close of browser window when there are multiple alerts in selenium with python -

i'm writing test using selenium python. i'm using pydev extension in eclipse. i'm testing user management system , of course there method test access permissions. since there lot of links in our system , in cases may links unavailable user, there lot of alerts let user know not having permission access. unfortunately, firefox closes browser after facing continuous alerts , test exit. i want prevent firefox type of behavior , handle alerts self. don't want use check-box on firefox's alert boxes says "prevent..."; need these alerts , check existence of alert in order test functionality of system. that great if knows way web-drivers in code, not manually in browser; since code run in other browsers , other servers.

osx - how to make Xcode project with homebrew libraries portable? -

i have installed freetype on mac using brew. code on mac works fine, when try run project on other mac below mentioned linking error. dyld: library not loaded: /usr/local/opt/freetype/lib/libfreetype.6.dylib referenced from: /users/ashutosh/library/developer/xcode/deriveddata/instrumentchamp- etytleaabhxmokadgrjzbgtmwxfl/build/products/debug/instrumentchamp.app/contents/macos/instrumentchamp reason: image not found (lldb) all library directories , include directories of freetype included in project's '$srcroot/' directory when try run code on other mac. the path see in linking error library brew had installed freetype in mac created project. /usr/local/opt/freetype/lib/libfreetype.6.dylib i have copied lib/ include/ directories needed project's home folder. and have set library , include paths in xcode. what missing here? else have make code portable on other mac. got project run on other mac installing brew, want without need install brew. ps: h

javascript - Why am I not getting Cross domain error? -

Image
i have html page has iframe. ( here is ) they both @ different domains. page a: domain = http://jsbin.com/ it hosts iframe domain : example.com <iframe src='http://example.com' id='a'> </iframe> however - when try access iframe content via : $(document).ready(function () { console.log($("#a").contents().find("*").length) }); i do see response : question : why not getting error access different origin ? comment : seems can't access content of elements , i'm positive should have got cross domain error. relative info : chrome version 30.0.1599.66 you don't error because frame hasn't yet loaded there isn't block. try access after loads , you'll see expected error. $(document).ready(function (){ $("#a").load(function(){ console.log($("#a").contents().find("*").length) }); }); http://jsbin.com/uqariwu/1/edit

Remove all words bigger than 6 characters using sed -

i'm new sed , i'm trying figure out way remove words in text more 6 characters. so far i've come gives me empty file. sed -n '/.\{6\}/!d' input > output input but sed's ability filter text in pipeline particularly distinguishes other types of editors. desired output but sed's text in other types of. this should trick remove words containing more 6 letters - if define word being made of letters a-z , a-z: sed -e s'/[a-za-z]\{7,\}//g'

java - Why does this constructor that uses generics fail? -

i creating class that, @ present, stores lists of various types in internal object called generictable . each list (composed of either double , or long ) held in object instance of class genericlist . question: why doesn't method addvector work? the error under red underline says the constructor test<v>.genericlist<v>(list<list<v>>) undefined . if working in main method (but had same genericlist class) , created generictable within main method (using list<genericlist<?>> table = new arraylist<genericlist<?>>(); ) , did generictable.add(new genericlist<long>(arrays.aslist(genericvector))); (where genericvector in case list<long> ), works perfectly. public class test<v> { private final list<genericlist<?>> generictable = new arraylist<genericlist<?>>(); public void addvector(list<v> genericvector) { generictable.add(new genericlist<v>(arrays.asli

android - Error adding widget to homescreen -- The Linked Program is no Longer Installed on Your Phone -

i creating android widget , when run widget, after cleaning workspace , deleting previous instance of widget device via application manager, when go add widget device, error "the linked program no longer installed on phone". before started happening, used error: 10-06 08:58:29.448: d/androidruntime(6994): shutting down vm 10-06 08:58:29.448: w/dalvikvm(6994): threadid=1: thread exiting uncaught exception (group=0x4001d5a0) 10-06 08:58:29.458: e/androidruntime(6994): fatal exception: main 10-06 08:58:29.458: e/androidruntime(6994): java.lang.runtimeexception: unable instantiate receiver com.example.awesomefilebuilderwidget.afbwidget: java.lang.classnotfoundexception: com.example.awesomefilebuilderwidget.afbwidget in loader dalvik.system.pathclassloader[/data/app/com.example.awesomefilebuilderwidget-1.apk] 10-06 08:58:29.458: e/androidruntime(6994): @ android.app.activitythread.handlereceiver(activitythread.java:2012) 10-06 08:58:29.458: e/androidruntime(6994):

c - Can't find gcc compiler -

i running fedora 19 via vmware , want compile , run, simple c program. however, after running which gcc get: /usr/bin/which: no gcc in (/home/demetres/codesourcery/sourcery_codebench_lite_for_arm_gnu_linux/bin:/home/demetres/codesourcery/sourcery_codebench_lite_for_arm_gnu_linux/bin_cache:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/home/demetres/.local/bin:/home/demetres/bin) it hasn't been long time, since installed sourcery codebench lite, arm cross-compiler, project i'm working on. there problem cross-compiler? othewise, required compile , run program? p.s. specific program not intended arm platform. try yum install gcc reinstalling.

java - assignment operator String object -

i new java programming. have read in book string a="hello"; string b="hello"; system.out.println(a==b); this should return false & b refer different instances of string objects. bcoz assignments operator compares instances of objects still getting true . using eclipse ide. example in book goes this: string s = "s"; string stoo = "s"; system.out.println(a == b); system.out.println(s == stoo); that bit of code prints “false” s == stoo. that's because s , stoo references different instances of string object. so, though have same value, not equal in eyes of equality operators. also, s == “s” prints false, because string literal produces yet instance of string class. name of book: java 7 absolute beginners this optimisation called string pooling in compile-time constant strings (aka known identical at compile time ) can set such same object in memory (saving space 1 of used types of object). or in words of docs ;

mysql - Counting records in sql statement fails -

i have query: select @i:=@i+1, s.* quiz.score s id between @a - @l1 , @a + @l2 order points desc; @i:=@i+1 shoult increment each row each record null . i dont see problem. me? like user-defined variable, @i has initial value of null @ start of session, , null + 1 yields null. null not 0. you should initialize @i := 0 before starts counting. you can in separate statement: set @i:=0; select @i:=@i+1, s.* quiz.score s id between @a - @l1 , @a + @l2 order points desc; or trick people write subquery it: select @i:=@i+1, s.* (select @i:=0) _init join quiz.score s id between @a - @l1 , @a + @l2 order points desc; one final way resolve initial case default @i 0 coalesce(): select @i:=coalesce(@i,0)+1, s.* quiz.score s id between @a - @l1 , @a + @l2 order points desc; the coalesce() function returns first argument not null.

osx - How to produce a .app file using Qt creator in windows? -

i have installed qt creator in windows, can build project , use exe in windows. want build os x snow leopard. what kits or build configurations should use. have explored options , searched net can't find answer appreciated. how compile os x in linux or windows? searched 'compile other os' , got second result ...

wpf - IValueConverter only being called when scrolling on DataGrid -

take @ following xaml snippet: <datagridtextcolumn.cellstyle> <style targettype="{x:type datagridcell}"> <setter property="background" value="white"/> <setter property="borderthickness" value="0"/> <setter property="block.textalignment" value="center"/> <setter property="background"> <setter.value> <solidcolorbrush> <solidcolorbrush.color> <multibinding converter="{staticresource vapbrushconverter}"> <binding relativesource="{relativesource findancestor, ancestortype={x:type datagridcell}}"/> <binding relativesource="{relativesource findancestor, ancestortype={x:type usercontrol}}"/> </multibinding>

php - Composer.phar in Symfony -

i trying install fosuserbundle in composer.json problem appears in console: c:\xampphe\php>php composer.phar install fatal error: uncaught exception 'errorexception' message 'proc_open(): crea teprocess failed, error code - 0' in phar://c:/xampphe/php/composer.phar/vendor/ symfony/console/symfony/component/console/application.php on line 1013 errorexception: proc_open(): createprocess failed, error code - 0 in phar://c:/x ampphe/php/composer.phar/vendor/symfony/console/symfony/component/console/applic ation.php on line 1013 call stack: 0.0140 235464 1. {main}() c:\xampphe\php\composer.phar:0 0.0150 234136 2. require('phar://c:/xampphe/php/composer.phar/bin/comp oser') c:\xampphe\php\composer.phar:15 0.4280 2045032 3. composer\console\application->run() phar://c:/xampphe /php/composer.phar/bin/composer:43 0.4570 2262672 4. symfony\component\console\application->run() phar://c :/xampphe/php/composer.phar/src/composer/console

ios7 - IOS Application loader shows bundle error -

i have waste 3 days "solving" problem (actually have tried imagine nothing). while binary uploading of application following error: error itms-9000: "this bundle invalid. armv7s required include armv7 architecture." @ softwareassets/softwareasset (mzitmspsoftwareassetpackage). oh got it, need disconnect device ( remove cable connection between device , system ). now archive , validate. go believe. :) follow these steps while uploading binary: make project ready go ( create distribution certificate , appstore provisioning profile certificate , application id of application willing upload, down load both , double click install them) check if every thing right, right icon files default files etc, , in build setting of application have selected appstore provisioning profile create build. now unplug device (although debug option should still remain selected ios device) while archiving build after archiving completed, validate build (with same acc

c# - Handling collections of objects through a switch statement -

i need have player equip item shown here: iequiptable interface. and method in in player class. public void equip(iequiptable equipable) { switch (equipable.gettype()) { case equipable weapons: this.weapon = equipable; break; case equipable shield: this.shield = equipable break; //etc etc.. } } i error switch experession must bool,char,string,integral, enum or corresponding nullable type. i handle having equit method in each of weapon/shield etc classes , pass on player class parameter. feel illogical player should equipt item, not item equip it's self on player. you have interface why don't make use of it? public interface iequipable { void equipon( player player ); } public class shield : iequipable { public void equipon( player player ) { player.shield = this; } } public class weapons

node.js - Cross-domain socket.io breaks after 30 seconds -

i have simple chat server (node.js/express/socket.io) i'm accessing client on different domain. i've set origins allow everything, has worked. however, after 30 seconds of inactivity client, gets error "xmlhttprequest cannot load [url]. origin not allowed access-control-allow-origin." @ point, can't send messages anymore unless refresh page. i'm allowing origin both io.set('origins', '*:*'); , with app.all('*', function(req, res, next) { res.header("access-control-allow-origin", "*"); res.header("access-control-allow-headers", "x-requested-with"); next(); });. i've tried pretty can think of (disabling heartbeats, catching error , reconnecting on client, using io.server.removelistener('request', io.server.listeners('request')[0]); ). know cross-domain problem, because don't have issues when run locally. ideas? i facing similar issue when working

ruby - Alternative to rspec double that does not fail test even if allow receive is not specified for a function -

many times 1 outcome may have 2 different consequences need tested test double. example if network connection successful i'd log message, , pass resource object store internally. on other hand feels unclean put these 2 in 1 test. example code fails: describe someclass let(:logger) { double('logger') } let(:registry) { double('registry') } let(:cut) { someclass.new } let(:player) { player.new } describe "#connect" context "connection successful" "should log info" logger.should_receive(:info).with('player connected successfully') cut.connect player end "should register player" registry.should_receive(:register).with(player) cut.connect player end end end end i specify in each test function in other 1 might called, looks unnecessary duplication. in case i'd rather make 1 test. i don't it's never explicit in test m

java - Deployment JavaFX in the Browser trouble -

i new in javafx , can't run simple hello world in web browser. follow official oracle tutorial hello world , after building it, jar file works perfectly. when try open (even local file) .html file in web browser or .jnpl, error: http://imgur.com/v2tba4h i searched on internet couldn't find kind of error anywhere. have newest version of java (7.40). use netbeanside 7.2.1 allow firefox asks , still doesnt work. thanks help.

Transitive closure from a list using Haskell -

i need produce transitive closure on list using haskell. so far got this: import data.list qq [] = [] qq [x] = [x] qq x = vv (sort x) vv (x:xs) = [x] ++ (member [x] [xs]) ++ (qq xs) member x [y] = [(x1, y2) | (x1, x2) <- x, (y1, y2) <- qq (y), x2 == y1] output 1: *main> qq [(1,2),(2,3),(3,4)] [(1,2),(1,3),(1,4),(2,3),(2,4),(3,4)] output 2: *main> qq [(1,2),(2,3),(3,1)] [(1,2),(1,3),(1,1),(2,3),(2,1),(3,1)] the problem second output. instead of checking additional transitive closure on new produced list, returns result. to prototype haskell code used python code : def transitive_closure(angel): closure = set(angel) while true: new_relations = set((x,w) x,y in closure q,w in closure if q == y) closure_until_now = closure | new_relations if closure_until_now == closure: break closure = closure_until_now return closure print transitive_closure([(1,2),(2,3),(3,1)]) output: set([(1,

javascript - Angular $http.json promise returning error, though I can see the response -

i new working http promise objects. i using angular js return json api http://www.asterank.com/api . i have angular controller making call so: $http.jsonp('http://www.asterank.com/api/asterank?query={%22e%22:{%22$lt%22:0.1},%22i%22:{%22$lt%22:4},%22a%22:{%22$lt%22:1.5}}&limit=1&callback=json_callback'). success( function(data) { console.log('great success'); }).error( function(r,t,et){ console.log(r); console.log(t); console.log(et); }); when check out chrome's network monitor see response: http/1.1 200 ok date: sun, 06 oct 2013 19:06:26 gmt content-type: application/json transfer-encoding: chunked connection: keep-alive vary: accept-encoding server: gunicorn/18.0 set-cookie: session=eyjkaxnjb3zlcl9maxjzdf90aw1lijpmywxzzx0.btngmg.ef89vheeiplh8szijowcajejpha; httponly; path=/ content-encoding: gzip but seeing error method fire, never success :( is because server not support jsonp? how access data of these apis if don't support

jquery - FineUploader start with delete template -

i'm using fineuploader, have 1 problem. user can upload image, image might there (previous uploaded). when there image (previous uploaded), want show delete link, when there's no image.. show upload link. how can toggle between these 2 states? specially on page loads.. , there image there. right know im removing , adding links manually. $('.fine-uploader0 .qq-upload-list').append('remove '); can have template each 1 of those? , switch between them? thanks there no cross-browser way determine if file has been submitted. might comparing file names acceptable, it's not. fail in many situations , not reasonable choice. if there reasonable way make determination client-side (cross-browser), there no way tell fine uploader duplicate file exists. if want prevent file being submitted, can either returning false outright "validate" event handler, or can return qq.promise later call failure on after have asynchronously dete

c# - ArgumentException was unhandled on String.Replace -

i created 2 textboxes "find" , "replace with" sort of combination. loop through cells in datagridview , check see if contains value in "find" box. this has been working fine until tried find , replace "(" "" empty string this string looking "(" find , replace in: the hitch hikers guide galaxy (s01xe06) string orig = (string)(datagridview1.rows[i].cells["after"].value); string newfilename = regex.replace( orig, txtrenamefrom.text, txtrenameto.text, regexoptions.ignorecase); then receive error: parsing "(" - not enough )'s. you're using regex replace, ( special character in regular expressions. either normal string.replace or escape regex.

java - How to pass a Javascript function as an argument in Javascript Interface? -

how pass function parameter in javascript interface, save string , call? for example, describe javascript interface : class jsinterface{ string myfunction; //set function myfunction attribute @javascriptinterface public void setmyfunction(string func) { this.myfunction = func; } @javascriptinterface public void executemyfunction() { webview.loadurl("javascript:"+this.myfunction); } } add it: //... webview..addjavascriptinterface(new jsinterface, "application"); //... in js : window.application.setmyfunction(function(){ //some code here... }); note: transfer function js need in form, not string or json. but in fact, in setmyfunction "undefined" expect "window.application.setmyfunction(function(){ //some code here...});" . tell me please do, grateful! try one: convert javascript object (incl. functions) string then attach function call string: function(){ .. }() and call

css - How to ignore certain LESS files in Web Essentials LESS compiling? (Bootstrap) -

i've set web essentials 2013 (in visual studio 2012) , loaded in default twitter bootstrap less source files. auto-build , minification working perfectly, except web essentials quite overdoes job. when select " bootstrap.less ", make change , save it, web essentials creates new " bootstrap.css " " bootstrap.min.css " inside need. when edit e.g. buttons.less , creates buttons.css (and buttons.min.css ) (with includes , mixins). means, in fact, i'll have same css files on , on again under different names. can declare files ignored on save? there convention in web essentials if name of less file starts underscore (like _utils.less ) not compiled css on save. https://webessentials.uservoice.com/forums/140520-general/suggestions/3319359-don-t-compile-nested-less-files

c# - Radio Buttons in Gridvew -

i have list of games. each game has visiting team , home team. allow user choose either visiting team or home team. converted template fields , put radio buttons in. isnt right. need radio button list, think. because radio buttons, can select both. possible gridview? tutorials see have 1 radio button in row, isnt issue. here gridview: <asp:gridview id="gridview2" runat="server" autogeneratecolumns="false" datakeynames="id_game" datasourceid="sqlpopulategames"> <columns> <asp:boundfield datafield="id_game" headertext="id_game" insertvisible="false" readonly="true" sortexpression="id_game" /> <asp:templatefield headertext="visitor" sortexpression="visitor"> <edititemtemplate> <asp:textbox id="textbox1" runat="server" text='<%#

vim - Prevent buffer from unloading in autocmd -

i'm writing bufunload autocmd , , want conditionally prevent buffer being unloaded or closed within autocmd. there way this? for instance, want use contents of buffer commit message mercurial using autocmd does: autocmd bufunload <buffer> !hg ci -l logfile so if commit fails (the hg command returns non-zero error code), want leave buffer open , unchanged. i suggest saving message in variable. in aurum (plugin vcs↔vim integration) there following logic coded: when buffer commit message wiped out or written (which triggers actual committing , wiping out) save 3 variables: commit message. current commit hex (you can see using hg log -r . ). current repository root. . when committing again following logic used: if current repository root same saved 1 , current commit hex commit message taken variable , initializes buffer. reasons following behavior: if commit failed want restore commit message (same yours). if did hg rollback , edited , want com

java - Eclipse Download on Ubuntu error -

i downloaded ubuntu 13.04 on laptop, , i'm trying run eclipse. when downloaded , tried run it, told me install jre, did. it's showing error: jvm terminated. exit code=13 /usr/bin/java -dosgi.requiredjavaversion=1.6 -xx:maxpermsize=256m -xms40m -xmx512m -jar /home/sam/eclipse/eclipse//plugin/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar -os linux -ws gtk -arch x86 -showsplash /home/sam/eclipse/eclipse//plugins/org.eclipse.platform_4.3.1.v20130911-1000/splash.bmp -launcher /home/sam/eclipse/eclipse/eclipse -name eclipse --launcher.library /home/sam/eclipse/eclipse//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.200.v20130807-1835/eclipse_1506.so -startup /home/sam/eclipse/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar --launcher.appendvmargs -exitdata e5800c -product org.eclipse.epp.package.standard.product -vm /usr/bin/java -vmargs -dosgi.requiredjavaversion=1.6 -xx:maxpermsize=256m -xms40m -xmx512m -jar /home/sam/eclipse/eclipse//pl

tomcat - Spring servlet mapping not working -

when try load http://localhost:8080/people receive 404 page not found error. this servlet mapping iwthin web.xml : <servlet> <servlet-name>spring</servlet-name> <servlet-class> org.springframework.web.servlet.dispatcherservlet </servlet-class> <init-param> <param-name>contextconfiglocation</param-name> <param-value>classpath:applicationcontext.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/people/*</url-pattern> </servlet-mapping> here how understand works : a url request http://localhost:8080/people intercepted servlet "spring" , invoke class org.springframework.web.servlet.dispatcherservlet correct ? do need additional configuration in order class loaded correctly ? update : here c

bash - python uses incorrect path -

i have bash script runs python program. use virtualenv. firs include env bash: source ./env/bin/activate then see (env) prefix in bash prompt. $ echo $path /project/env/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl when try run python program bash script, runs wrong version of python. env uses python 2.6, while system has 3.2 default. i print python version python script, , prints 3. but why? ls -la -rw-r--r-- 1 wnc wnc 2219 sep 27 01:42 activate -rw-r--r-- 1 wnc wnc 1275 sep 27 01:42 activate.csh -rw-r--r-- 1 wnc wnc 2414 sep 27 01:42 activate.fish -rw-r--r-- 1 wnc wnc 1129 sep 27 01:42 activate_this.py -rwxr-xr-x 1 wnc wnc 357 sep 27 01:42 easy_install -rwxr-xr-x 1 wnc wnc 365 sep 27 01:42 easy_install-2.6 -rwxr-xr-x 1 wnc wnc 318 sep 27 01:42 pip -rwxr-xr-x 1 wnc wnc 326 sep 27 01:42 pip-2.6 lrwxrwxrwx 1 wnc wnc 9 sep 27 01:42 python -> python2.6 lrwxrwxrwx 1 wnc wnc 9 sep 27 01:42 python2 -> python2.6 -rwxr-xr-x 1 wnc wnc 6240 sep 27 01:4

sql - Multi Level Combox - MySQL Query -

Image
i have mysql table looks and want create combobox looks this: hardware (id 1, parent 0) -child (id 2, parent 1) -child (id 3, parent 1) --child (id 4, parent 3) as can see, main categories have parent id = 0, rest have id associated id of category. what wondering, if there way this, directly through mysql query? if, so, can give me example? i tried little loops in mysql couldn't make sense in head. if limited 3 levels, can make 2 left join s , data in 1 query: select t1.id, trim( concat( repeat('-',if(t2.id not null,1,0) + if(t3.id not null,1,0)), ' ', t1.label ) ) label mytable t1 left join mytable t2 on (t1.parent = t2.id) left join mytable t3 on (t2.parent = t3.id) order ifnull(t3.id, ifnull(t2.id, t1.id))

c# - WebSecurity.InitializeDatabaseConnection doesn't cooperate with code first migrations -

in project use websecurity , ef code first migrations. i have custom userprofile class want combine websecurity. i want seed users in migrations' configuration class in seed method. so try this: #1) if (!roles.roleexists("admin")) roles.createrole("admin"); if (!websecurity.userexists(adminusername)) websecurity.createuserandaccount( adminusername, "admin", new {email = "admin@mindmap.pl"}); but complains should call websecurity.initializedatabaseconnection first. ok, makes sense. added following lines global.asax: #2) websecurity.initializedatabaseconnection( _connectionstringname, "userprofiles", "id", "username", autocreatetables: true); but following lines: #3) var dbmigrator = new dbmigrator(_configuration); dbmigrator.update(); throw error: there object named 'userprofiles' in database. well, makes sense aga

aspectj - Spring @Configurable with Maven -

i'm using spring in current project, @configurable annotation doesn't work. i've used annotation in of classes (most of them jpa entities): @configurable @entity public class person{ ... @inject private personservice service; ... } i've put aspectj-maven plugin in pom.xml: <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>aspectj-maven-plugin</artifactid> <version>1.4</version> <dependencies> <dependency> <groupid>org.aspectj</groupid> <artifactid>aspectjrt</artifactid> <version>${aspectj.version}</version> </dependency> <dependency> <groupid>org.aspectj</groupid> <artifactid>aspectjtools</artifactid> <version>${aspectj.version}</version> </dependency> </dependencies> <executions> <execution> <phase>process-sources</phase> <

python - How to access object methods from an instance -

i trying make plugin gtg. though concerns connecting signals in pygtk, problem i'm facing else through pluginapi, plugins 2 parameters, 1 browser , 1 editor browser = <taskbrowser object @ 0x33a17d0 (gtg+gtk+browser+browser+taskbrowser @ 0x270dcc0)> editor = <gtg.gtk.editor.editor.taskeditor instance @ 0x25eaa28> variable browser has method 'connect' using connect signal emitted it. variable editor should have method 'connect' can connect signals emitted editor. when try access - editor.connect('signal' , callback) , error - attributeerror: taskeditor instance has no attribute 'connect' thats when found out browser object , editor instance. is there way can access object method of taskeditor class via it's instance ?

c# - which one is a more scalable solution for managing image files -

i need able support user image upload , download/view images. here options. 1) store images in sql database. i have seen work small setup. db cost go higher size increases. backups easier. can't take advantage of caching or cdn. 2) store images in file system. have seen option being cumbersome in larger small setup. difficult manage directories huge number of files. have come hashing algorithm make sure there few images in directory , directory contains few directories. dont know if there limit in windows creating deep directory structure. use caching. 3) store images in nosql db. throwing 1 there. not familiar nosql. 4) windows azure storage/amazon storage. couple of things. 1) money important factor. 2) windows preferred environment linux/apache solutions ok. and 1 more thing. facebook do? or does. again. you should go hybrid solution. store actual binary images on filesystem, use database image metadata. gives easier medium serve files - allowin

c++ - constructor and copy constructor -

#include <iostream> using namespace std; class t{ private: int * arr; public: t() { arr=new int[1]; arr[0]=1;} t(int x) {arr=new int[1]; arr[0]=x;} t(const t &); ~t() {cout<<arr[0]<<" de"<<endl; delete [] arr;} t & operator=(const t & t1){arr[0]=t1.arr[0];return *this;} void print(){cout<<arr[0]<<endl;} }; t::t(const t & t1) {arr=new int[1];arr[0]=t1.arr[0];} int main(){ t b=5; cout<<"hello"<<endl; b.print(); b=3; b.print(); return 0; } why result hello 5 3 de 3 3 de ? why "t b=5;" not call destructor? how "t b=5" works? create temp object (of class t) using constructor "t(int x)" first, use copy constructor "t(const t &)" create b? if case why not call desctructor temp object? why "t b=5;" not call destructor? when this: t b=5; you copy initialization . semantically

asp.net - IList or IQueryable OrderBy method which accepts a string parameter as selector? -

this asp.net entity framework tutorial describes how can use objectdatasource bll , provide method includes sort expression use gridview. public ienumerable<department> getdepartments(string sortexpression) { if (string.isnullorwhitespace(sortexpression)) { sortexpression = "name"; } return context.departments.include("person").orderby("it." + sortexpression).tolist(); } the problem is, uses string sortexpression objectdatasource in orderby() method. can't find reference method anywhere. exist , if not, best way allow sorting of gridview custom bll. dynamic linq supports orderby string argument: http://dynamiclinq.codeplex.com/

An "insert into" mySQL query through PHP appears to work, but nothing is added -

edit: realized problem was trying insert $user_id, has string numbers" column user_id, type int. converted string integer. still didn't quite figure out errors though, that's because of time constraints. i'll other time. i'm trying build website on top of advanced version of php login system provided @ http://www.php-login.net . in registration class of script, there's function adds new user database, , code works totally fine: $query_new_user_insert = $this->db_connection->prepare('insert users (user_name, user_password_hash, user_email, user_activation_hash, user_registration_ip, user_registration_datetime) values(:user_name, :user_password_hash, :user_email, :user_activation_hash, :user_registration_ip, now())'); $query_new_user_insert->bindvalue(':user_name', $user_name, pdo::param_str); $query_new_user_insert->bindvalue(':user_password_hash', $user_password_hash, pdo::param_str); $query_new_user_insert->bindva

java - Calling a method that only prints out a "loan statement" -

i doing assignment class , started making our own methods , thought seemed easy enough has become extremely frustration , hoping can me wrap head around it. first things first , assignment trying complete this: make modular program calculate monthly payments, seems easy few restrictions on question follows the main method should: ask user the loan amount the annual interest rate ( decimal, 7.5% 0.075 ) the number of months and call method calculate , return monthly interest rate (annual rate/12) call method calculate , return monthly payment call method print loan statement showing amount borrowed, annual interest rate, number of months, , monthly payment. i have gotten end of printing out loan statement cant life of me proper way call it, , make show once run program :/ if can me understand how done appreciate it. (i realize there other mistakes in code right rather focus on need done) import java.util.scanner; public class loanpayment {

php - Work out percentage to auto-populate HTML Table -

i have following code: function getpercent($arg){ $count = count($arg); return /* confused here */; } $test_array = array( "id" => 1, "user" => "test", "perm" => 1, "test" => "string" ); i'm going populate html table column count($test_array) , need have percentages put inside table attrib: <td align=left style="width:xx%"> but, how go working out percentage? use floor() round down don't end total percentage of on 100%, , pass array function average width. <?php function getpercent($arg){ $count = count($arg); return floor( 100 / $count ); } $test_array = array( "id" => 1, "user" => "test", "perm" => 1, "test" => "string" ); $average_widths = getpercent($test_array); // in case return 25 // ...table t

att - Dereferencing syntax in IA-32 assembly () or *? -

this source of confusion: movl (%edx), %eax treats value of %eax address, goes , copies content %eax, keeping in mind looking at: jmp *(%edx) since parenthesis used earlier (as dereferencing in mov instruction), asterisk form of double dereference ? ...and how instruction perform differently ? --> jmp (%edx) ...or jmp *%edx versus jmp %edx ? the * indicates absolute jump, in contrast absense of asterisk meaning relative jump. see http://sourceware.org/binutils/docs-2.17/as/i386_002dmemory.html#i386_002dmemory however, don't know whether assembler infers absolute jump indirection if * missing or barks on impossibility of indirect relative jump.

ERROR (no such process) Nginx+Gunicorn+Supervisord -

if run command (to start app) via supervisor: sudo supervisorctl start myapp it throwing error of: myapp: error (no such process) i created file called myappsettings.conf: [program:myapp] command = /usr/local/bin/gunicorn -c /home/ubuntu/virtualenv/gunicorn_config.py myapp.wsgi user = ubuntu stdout_logfile = /home/ubuntu/virtualenv/myapp/error/gunicorn_supervisor.log redirect_stderr = true what issue here? thank you. try: supervisorctl reread supervisorctl reload that should start service. did root under ubuntu 13.04. edit: i've had trouble since posted sighup'ing supervisor processes. share little snippet found elsewhere: sudo kill -hup `sudo supervisorctl status | grep $app_name | sed -n '/running/s/.*pid \([[:digit:]]\+\).*/\1/p'` the below send sighup process running app_name. useful gunicorn graceful reloading. joe

html - Firefox shows blue box around image link -

i have anchor tag around of these images on site. when click it, scrolls id "template". <a class="hi" href="#template"><img src="images/01.png" /></a> i have tried every trick in book. a img{border:none; outline: none;} border=0 in image tag itself. no matter there's blue border around image once click it. click of circle images (towards bottom) reference. remember, view in firefox. http://stevendennett.com/newsite/ thanks! i able remove border setting anchor color transparent: a.hi { color: transparent; }

python - Password Reset-Sending mail doesnt work -

setting.py- email_backend = "mailer.backend.dbbackend" email_subject_prefix = "[.....]" email_host = 'smtp.gmail.com' email_host_password = 'tester@@abcd' email_host_user = 'tester.abcd@gmail.com' email_port = 587 email_use_tls = true default_from_email = 'tester.abcd@gmail.com' default_admin_email = 'tester.abcd@gmail.com' temporary_cc_email = 'tester.abcd@gmail.com' contactus_email = 'tester.abcd@gmail.com' jobapply_email = 'tester.abcd@gmail.com' urls.py: urlpatterns = patterns('django.contrib.auth.views', url(r'^password-reset/$', 'password_reset', { 'template_name': 'profiles/password_reset_form.html', 'password_reset_form': passresetform }, name='password-reset'), url(r'^password-reset-process/$', 'password_reset_done', { 'template_name': 'profiles/password_r

jquery - fadeOut() and fadeIn() in the same action -

i'm trying use jquery make languaje selection nav and, once selected, fade out nav @ same time display second nav using fade in. this markup div id="content"> <img src="img/logo.png"> <ul id="navlang"> <li><a href="#" id="en">english</a></li> <li><a href="#" id="es">español</a></li> </ul> <div id="naveng"> <ul > <li><a href="#">beauty</a></li> <li><a href="#">campaign</a></li> <li><a href="#">editorial</a></li> <li><a href="#">biography</a></li> <li><a href="#">contact</a></li> &l

html - CSS Display:inline-block | 3 columns | No floats -

i trying 3 column design, out using floats. html <header>this header</header> <div id="body"> <div id="col-1" class="col">this column - column - column - column</div> <div id="col-2" class="col">this column - column - column - column</div> <div id="col-3" class="col">this column - column - column - column</div> </div> css * { margin:0; padding:0; } header { background:#4679bd; width:90%; height:70px; line-height:70px; font-size:20px; text-align:center; border:1px solid #333; margin:10px auto; } #body { width:700px; margin:auto; border:1px solid #333; } #body .col { display:inline-block; background:#ccc; height:500px; border:1px solid #333; margin:5px; } #bod

MySQL count field values before LEFT JOIN -

i've been trying work, tripping me up. search here on haven't found topic describing specific case. have following schema fiddle here: http://www.sqlfiddle.com/#!2/ac8162/6 table records : | id | contract | name | status | |----|----------|----------|---------| | 1 | | foo | status1 | | 2 | | bar | status1 | | 3 | uk | abc inc. | status3 | | 4 | pl | efg ltd. | status2 | | 5 | uk | xxx inc. | status2 | |----|----------|----------|---------| table transactions : | id | record_id | response_delay | status | |----|-----------|----------------|---------| | 1 | 1 | 8889 | status1 | | 2 | 1 | 8813 | status1 | | 3 | 1 | 5908 | status2 | | 4 | 1 | 4779 | status3 | | 5 | 2 | 519 | status1 | | 6 | 2 | 8804 | status1 | | 7 | 3 | 2604 | status1 | | 8 | 3 | 5054 | status2 | |

mysql - Stored procedure with strings -

i'm trying figured out how use insert statement in stored procedure. want put data table like (concept, a, b, c, d, e, f, g) but want result this: concept b concept c d concept d e concept f g i think need string this? how can create string? the question kinda vague should work need insert multiple values in table, indicate new row. sample: insert example (concept, element1, element2) values (concept,a,b), (concept,c,d), (concept,e,f), (concept,g,h); output: concept | element1 | element2 // table headers concept | | b concept | c | d concept | e | f //table elements concept | g | h or here more :)

javascript - How to post the values from ajax page to main page -

i having problem, working check boxes loading pop , replace html block ajax in pop if check box checked or unchecked need update query need solution please me, thank you <input type="checkbox" name="status[]" value="test1"/> <input type="checkbox" name="status[]" value="test2"/> <input type="checkbox" name="status[]" value="test3"/> ... in server side array status checked, can use array updation suppose test1 , test3 checked status array array ('test1', 'test3'); hope need

sql - MySQL Query for calculating weightage -

to calculate weightage of faults i've formulated query, select id,faultdistribution, faulttype, faultseverity, if (faultdistribution='crs', count(id) * 8, 0) + if (faultdistribution='configuration', count(id) * 6, 0) + if (faulttype='bs' , faultseverity='ft', count(id) * 4, 0) + if (faulttype='bs' , faultseverity='mj', count(id) * 2, 0) + if (faulttype='bs' , faultseverity='md', count(id) * 5, 0) + if (faulttype='bs' , faultseverity='mi', count(id) * 3, 0) + if (faulttype='lf' , faultseverity='ft', count(id) * 2, 0) + if (faulttype='lf' , faultseverity='mj', count(id) * 1, 0) tbl_fault product='das' , faultdistribution='missed' what intend is; if fault distribution= 'crs' fault * 8 + if fault distribution= 'configuration' fault * 6 ......... as, there records in database not having result above query, help/suggestions re

c++ - Edit distance recursive algorithm -- Skiena -

i'm reading algorithm design manual steven skiena, , i'm on dynamic programming chapter. has example code edit distance , uses functions explained neither in book nor on internet. i'm wondering a) how algorithm work? b) functions indel , match do? #define match 0 /* enumerated type symbol match */ #define insert 1 /* enumerated type symbol insert */ #define delete 2 /* enumerated type symbol delete */ int string_compare(char *s, char *t, int i, int j) { int k; /* counter */ int opt[3]; /* cost of 3 options */ int lowest_cost; /* lowest cost */ if (i == 0) return(j * indel(' ')); if (j == 0) return(i * indel(' ')); opt[match] = string_compare(s,t,i-1,j-1) + match(s[i],t[j]); opt[insert] = string_compare(s,t,i,j-1) + indel(t[j]); opt[delete] = string_compare(s,t,i-1,j) + indel(s[i]); lowest_cost = opt[match];

c++ - Reading in Lines with 2 numbers each -

i'm pretty rusty on c++. i'm wondering best way read input in following format: 400 200 138 493 ... i'm using while(cin.peek()!=-1) check eof, , within that, i'm using while(cin.peek()!='\n') check newlines. fine reading in full lines of text, how can limit 2 numbers and/or grab 2 numbers? int num1,num2; while(cin>>num1>>num2) { //... } or string line; int num1,num2; stringstream ss; while(getline(cin,line)) { ss<<line; ss>>num1>>num2; //... }

Visual Studio : set number of project build in parallel from command line -

i’m using visual studio 2010 devenv build solutions command line ( not using msbuild ), visual studio set build 8 projects in parallel ( set on visual studio ide under tools -> options -> projects , solutions -> build , run ) have 1 solution don’t want build projects in parallel. is there way set max number of project being built in parallel command line specific solution ? if not maybe can change number of projects set in vs through registry , undo change after solution built ? thanks. i don't think can if build on command line using devenv, can msbuild. if have existing scripts call devenv it's quite simple change msbuild: instead of: devenv solution.sln /build debug use: msbuild solution.sln /t:build /p:configuration=debug you can add flag /m:n specify maximum number of concurrent processes use build (eg /m:4 )