Posts

Showing posts from April, 2013

css - height width as percentage not working in IE -

my css has percentage height , width properties... these works in firefox , chrome... doesn't work in ie. can pleaes me identify issue. (i did check online , there many duplicate ques regarding no response). thanks, samuel mathews.

profile - Profiling WPF Loading Events -

i have complex control taking long initialize. whilst able use wpf performance kit profile controls layout time, haven't found way analyze initialization time. im wondering if there way can analyze hot spot in initializing controls hierarchy, styles, resources etc. i don't know tool allow debugging or profiling initialization process. you can use snoop see visual tree. can use pistachio profile unused resources. eventually you'll have remove ui elements control , start adding them 1 one while counting initialization time way you'll able figure out hot spot. of course have take in account binding in specific use case result in performance hit

HTML/CSS make div snap to the windows's bottom -

i've div: <style> #asd{ height:auto; width:1024px; margin-left:auto; margin-right:auto; background-color:#093; } </style> i want div's bottom reach down window's bottom, whatever window's current size is. what tried far adding #asd's css, without expected results: margin-bottom:0px; or height:100%; or bottom:0px; any advice? add position:absolute; bottom:0; to class... #asd{ height:auto; width:1024px; margin-left:auto; margin-right:auto; background-color:#093; position:absolute; bottom:0; }

php - Retrieve the child model of a record in Yii Framework -

i trying understand how model child class of cactiverecord model. i have following 2 basic classes: class user extending cactiverecord class tutor extending user the connection between them id of table users being fk in table tutors . in current app instanciating user class, need data tutor . the relations set gii follows: for user class: public function relations() { return array( 'tutor' => array(self::has_many, 'tutors', 'user_id'), ); } tutor class: public function relations() { return array( 'user' => array(self::belongs_to, 'users', 'user_id'), ); } how can can object populated data both models? note: database tables named @ plural , while models @ singular . when query active record model should bring in related objects automatically (provided have set relationships properly). following give start. $users=user::model()->findall();

entity framework 5 - Trying to pass back the results of a LINQ query from a middle tier class -

i need feature... the first query works fine: public list<project> getprojectbycustomerid(int16 customerid) { try { using (yeagertechentities dbcontext = new yeagertechentities()) { dbcontext.configuration.proxycreationenabled = false; dbcontext.database.connection.open(); ienumerable<project> project = dbcontext.projects.where(p => p.customerid == customerid); list<project> myprojects = new list<project>(); myprojects = project.tolist(); return myprojects; } } catch (exception ex) { throw ex; } } the second query has project list , want bring columns in query, giving me error: "cannot convert type iqueryable anonymoustype#1 generic.list". design time compile error on

Python MultiProcess, Logging, Various Classes -

i trying log single file multiple processes having lot of trouble it. have spend countless hours looking online -- stackoverflow , google, have come nothing concrete. i have read: how should log while using multiprocessing in python? i've been trying use zzzeek's code not write file me. don't have specific way i'm doing -- i've been trying every way can. have of got work , have sample code, or have alternative way of doing it. need log multiple processes same file. log errors various class same file. i, however, satisfied simple getting multiprocess 1 work. thanks look @ these posts: using logging multiprocessing improved queuehandler, queuelistener: dealing handlers block logutils: using recent logging features older python versions

certificate - Java: Get X509Certificate Issuers -

hi have certificate(x509certificate) need issuers of it, example: the certification path of certificate is -ca national root - costa rica --ca natural person politics - costa rica ---ca sinpe - natural person ----mario xxxxx xxxxxx (sign) ---> have, need access top issuer till reach root(ca national root - costa rica), because need compare name of first issuer , other data, parameters. how accomplish or should start?

regex - How do I replace the spaces between words in Emacs? -

i have files consisting of words: ndkjsank ndjksandknsakj dnsjakndjskndjknsakjn dsajkndksnakjndsnajkndjkas dsnjak and replace (sometimes multiple) spaces between them single tab: dsnak**\t**ndsjka njdkas**\t**ndksjankda njdsaibdusai**\t**nkdsnakjdnas is possible using regular expression in emacs? thought might away using rectangular selection area words of varying length (and file far long manually). edit: this comes close selects spaces/newlines/tabs right of second word: \s- the regexp want  + . call m-x replace-regex replace  + \t . note there's empty space before + sign. also, produce tab might have hit c-q c-i keys. i'm not sure if accepts \t syntax when called interactively.

Comparing the average in MYSQL -

if have table shirt +--------+------+ | color | size | +--------+------+ | red | 2 | | red | 4 | | red | 2 | | blue | 3 | | blue | 5 | | yellow | 2 | | yellow | 7 | +--------+------+ and want display ones above average so shirt +--------+------+ | color | size | +--------+------+ | red | 4 | | blue | 5 | | yellow | 7 | +--------+------+ what best way in mysql? edit: have code different set made quick example can see how it's done try myself. try: select shirt.color, shirt.size shirt inner join (select color, avg(size) size shirt group color) table2 on shirt.color = table2.color shirt.size >= table2.size here's sqlfiddle update with same table name.

installation - /usr/local/cuda-5.0/lib64/libcusparse.so: undefined reference to `std::bad_alloc::what() const@GLIBCXX_3.4.9 -

i setting cuda 5.0 on centos 6.2, have set successfully, because command querydevice , got passed. when enter /root/nvidia_cuda-5.0_samples, , make project,i got errors below: make[1]: entering directory `/root/nvidia_cuda-5.0_samples/7_cudalibraries/conjugategradientprecond' g++ -m64 -i/usr/local/cuda-5.0/include -i. -i.. -i../../common/inc -o main.o -c main.cpp g++ -m64 -o conjugategradientprecond main.o -l/usr/local/cuda-5.0/lib64 -lcudart -lcublas -lcusparse /usr/local/cuda-5.0/lib64/libcusparse.so: undefined reference `std::bad_alloc::what() const@glibcxx_3.4.9' collect2: ld returned 1 exit status make[1]: *** [conjugategradientprecond] error 1 my compiler gcc44, got below steps: 1.sudo rm gcc 2.sudo ln -s /usr/bin/gcc-4.4 gcc before upper operation of 1 , 2, compiler gcc 4.1.7,i got errors title, operation of 1 , 2, there error either centos 6.2 ships version 4.4.6 of gcc. niether 4.1.7 nor 4.4 correct compilers distro. i'm not saying can'

How to execute a bat file from cygwin bash that uses the Windows find command -

the find command different in windows , unix. on windows fgrep -like utility listing matching lines in file; on unix -- , on cygwin -- list filenames matching criteria. cygwin bash prepends standard directories current path, inside bash $path typically /bin:/usr/bin:/cygdrive/c/windows/system32:/cygdrive/c/windows . begin update provide additional details for example have many scripts use gnu find command -- example scripts purge directory trees contain no files: purge-empty-dirs.sh find . -depth -type d -empty | xargs rmdir -p i have bat file start build, uses windows find command, searches lines matching string (similar gnu grep ). build.bat ... dir | find "target" if errorlevel = 1 goto no_target_dir ... now, bash script work need /bin in path before c:\windows\system32 . bat file run need c:\windows\system32 in path before /bin in general might able claim all bat files should executed original environment inherited bash, not modified one . make

actionscript 3 - Route To Take For Creating A Cloud Based Application in AS3 -

ok, i'm writing web application in actionscript 3.0 , i'm pretty stuck... want cloud based (all data accessible where-ever on whatever device), honest don't know start or really... route take. at moment i'm storing data created on local shared objects, login system, data created within software. i've looked in remote shared objects, honest, i've been trying find tutorial explaining haven't. i have few mysql databases don't know start in sending sharedobject data unique accounts via as3, php, , mysql. if knows tutorial on great too. really, i'm looking lead me right direction, if have resources hugely grateful. thank much! luckily you, as3, php , mysql work wonderfully together. within as3 application, can: take complex user data contained within object (i'm referring object datatype) write object bytearray base64-encode bytearray, making safe send on http post base64-encoded string server (your php script), along auth

jquery - Fade in div with same class name as the same name as my button id -

i have few buttons share same class name divs ids fade in. example: <div class="one">button</div> <div id="one">i 1 div needs fade in</div> <div class="two">button</div> <div id="two">i 2 div needs fade in</div> you should use common class/tag buttons, , data-* attribute target id, , retrieve in click handler: html: <div class="button" data-target="one">button</div> <div id="one">i 1 div needs fade in</div> <div class="button" data-target="two">button</div> <div id="two">i 2 div needs fade in</div> js: $(document).on('click', '.button', function() { var id = $(this).data('target'); $('#' + id).fadein(); });

executable - windows how to show memory segment of a process? -

we have tools objdump , readelf , , dumbin show executable file contents. but when executable file loaded memory (a process created), segments in memory different segments in executable file. example, when loaded, 2 segments namely stack , heap allocated (we overlook details of page mapping here). is there tool show in-time memory segment/status of process ? windows executables use portable executable format. format describes sections of memory allocated when process loaded, , optionally raw data ( .text , .data sections) loaded sections. each section typically have file offset specifying in raw file data located, , virtual address @ data loaded. these may or may not resemble each other. pe explorer can give details on sections (and else pe file) of executable. immunity debugger allow attach running process , see memory map .

Upgrading from Django 1.3 to 1.5 -

i'd upgrade existing application more recent version of django. in 1.4 changed password hashing algorithm such old passwords no longer match when people try login. there way upgrade not require users reset passwords? i did same upgrade last month , django passwords still functional. changes made in generic views( generic views class based) , logging in settings.py changed , have put allowed_hosts list. example: allowed_hosts = ['.stackoverflow.com'] particularly, changed urls calls cause using named urls without quotes in url tags , it's no longed supported django. right way this: {% url 'name_of_the_view' arg1 arg2%} i suggest create environment , try use django 1.5 making small changes.

visual studio 2010 - Convert System::String to std::string in c++ simply? -

this question has answer here: c++ .net convert system::string std::string 6 answers i know there lot of google answers out there topic, keep getting error in code. in gui using visual studio in c++, declared struct in form1.h: struct char_build { string name; } user; but when try retrieve text text box like user.name = textbox1->text; there's error managed vs. unmanaged strings, , string ^ isn't able go struct. any ideas of best way retrieve input in text box , use in struct? thanks! i first converting wstring , string using iterator constructor: wstring temp(textbox1->text->data()); user.name(temp.begin(), temp.end());

call javascript while rendering a partial in rails 3 -

i need call javascript while rendering partial in rails 3. like: _my_partial.html.erb whenever partial renders, javascript function should called. try in _my_partial.html.erb : for html : # partial code <script type="text/javascript"> your_function(); </script> for haml : # partial code :javascript your_function(#{@variable});

cqlsh - Cassandra Composite Column Family -

i have simple requirement in sql world want create create table event_tracking ( key text, trackingid timeuuid, entityid bigint, entitytype text userid bigint primary key (key, trackingid) ) i need cli create command not able it. need create column family through cli pig cannot read column family created through cqlsh (duh) here tried , didnt worked create column family event_tracking ... comparator='compositetype(timeuuidtype)' ... , key_validation_class=utf8type ... , default_validation_class = utf8type; 1) dont know why add value column when see in cqlsh create table event_tracking ( key text, trackingid timeuuid, value text, primary key (key, trackingid) ) compact storage , bloom_filter_fp_chance=0.010000 , caching='keys_only' , comment='' , dclocal_read_repair_chance=0.000000 , gc_grace_seconds=864000 , read_repair_chance=0.100000 , replicate_on_write='true' , populate_io_cache_on_flush='fa

asp.net - Log both webservice Request, Response in SoapExtension -

i using soapextension log both webservice request, response when error occurs in webservice. both request , response xmldocument's have incorrect data. can review code see doing wrong? if unable centralize changes in soapextension, go adding logging code around each webservice endpoint. using system; using system.io; using system.web.services.protocols; using system.xml; using elmah; public class elmahsoapextensionv2 : soapextension { private stream oldstream; private stream newstream; public static xmldocument xmlrequest { get; private set; } public static xmldocument xmlresponse { get; private set; } public override stream chainstream(stream stream) { oldstream = stream; newstream = new memorystream(); return newstream; } public override void processmessage(soapmessage soapmessage) { switch (soapmessage.stage) {

php - how to change the DPI of an image from 72DPI to 300DPI with Imagick -

i have image of 72dpi , want change 300dpi printing purposes, want stuff need done imagick, tried code following no positive results. <? $im = new imagick(); $im->setresolution(72,72); $im->setoption('density','300x300'); $im->readimage("test.png"); header("content-type: image/png"); echo $im; ?> can help/clarify me usage of setoption or can 1 explain hot change dpi in either imagick or gd i think want: i have setted resolution pixel/inch 300 dpi: <?php $im = new imagick(); $im->setimageunits(imagick::resolution_pixelsperinch); $im->setimageresolution(300,300); $im->readimage("test.png"); $im->setimageformat("png"); header("content-type: image/png"); echo $im; ?> hope you!

design - Sharepoint RUP OOAD Diagrams -

i work on project using sharepoint platform , should give rup design model,design class , design package employer. there no design model or other ooad diagrams sharepoint (especially sharepoint 2013) or can't find that. is there rup ooad diagrams sharepoint? thanks i found sharepoint uml diagrams around definition, features, provisioning etc... here: http://technocktail.info/?p=19 maybe in modelling these parts of solution.

class - Difference between a property and a global variable [objective c] -

i'm wondering difference between class's public global variable , class's property (objective-c ios programming). thing notice have use pointer notation -> access class's global variable rather dot. i've read changing code using globals using properties can program breaking change. true , if so, why? thanks! edit: block.h public global variable (i think?) [edit: understand instance variable , thanks] @interface block : gameobject { @public int type; skemitternode *particles;} property @property (nonatomic) cgfloat x; no, not "global variable". it called instance variable. a property (but not necessarily) has associated instance variable, modern compilers hide you. the big difference between using instance variable is, property accessed through accessors (in case setx:(cgfloat)x? and -(cgfloat)x`. if wanted, overwrite these accessors , special handling, say, whenever variable accessed. it possible bypass a

sql - Need help to review PostgreSQL query -

i have following sql query want use postgres declare _sql varchar varying(50); _whereclause varchar varying(50); _whereclause:='and 1=1' execute 'select count(*) test t 1=1' || _whereclause when i'm trying execute above query gives error @ varchar in second line. , time simple command below declare _sql varchar varying(50); it gives error, don't know what's wrong code. have tried figure out postgres sql offcial site , when tried copy , run example given on there it's not executing. i'm new postgres , i'm feeling unlucky postgres sql syntax. the syntax incorrect, should use either varchar(50) or character varying(50) , not varchar varying(50) . eg. declare _sql varchar(50); _whereclause varchar(50);

html - Is there anyway to put a div value inside another one -

i have code right here: <div> <div id="pos">hello</div> <div style="border:10px solid black; width:600px; height:840px"></div> </div> so want know if there way put value of div"hello" inside second div top property??????? tried position code: top:200px nothing happened. you can use jquery selector $( "#pos" ).innerhtml html of div after can set div put class name or id identify div like $( "#another_div" ).innerhtml=$( "#pos" ).innerhtml , after modify css. $( #another_div" ).css( "attribute","value");

winavr - Code from ICCV7- AVR displays garbled in text editor? -

i have code written atmega64 , "iccv7 avr" (c cross compiler atmel avr), i can open , edit sourceinsight, but when open text editor (the common 1 on windows), garbled. what can ? thanks lot in advance. probably because code file stored in unix format, uses "\n" return @ end of each line. notepad in windows uses "\r\n" return. in notepad, code may display in single line. ps: try tag q other tags. 'icc' here means intel c++ compiler.

html - How can I stack this Z-index configuration? -

i have situation whereby: my hierarchy is: box1: (z-index: 5000) -(other parent elements) -box1_child (z-index: 5001) box2 (z-index: 5000) -(other parent elements) -box2_child (z-index: 5002) so obviously, want box1 , box2 @ same level. want box1_child sit on box2. want box2_cihld sit on box1_child. but it's not working (in ff4), basically, box1_child isn't sitting on box2. is possible, (on more recent browsers?) all elements have non-static position. even if 2 adjacent elements have same z-index, still have stacking order: 1 comes later drawn on first. using this, can use css (simplified) stack elements in way want. #box1{ position: absolute; z-index:auto; } #box1_child { position: absolute; z-index:1; } #box2{ position: absolute; z-index:auto; } #box2_child { position: absolute; z-index:1; } then box2 drawn on over box1 (if overlap @ all) , box2_child drawn on box1_child, both children drawn on parent

android - Linking Two Different Objects For ArrayList -

i have 2 classes: driver class: public static final class driver implements drivercolumns, basecolumns, parcelable { public static final uri content_uri = base_content_uri.buildupon().appendpath(path_drivers).build(); public static final string content_type = "vnd.android.cursor.dir/com.test.console.drivers"; public static final string content_item_type = "vnd.android.cursor.item/vnd.console.drivers"; private int driver_id, driver_number; private string driver_name; public driver() { } public driver(int driverid, int drivernumber, string drivername) { this.setdriverid(driverid); this.setdrivernumber(drivernumber); this.setdrivername(drivername); } public static uri builddriveruri(string driverid) { return content_uri.buildupon().appendpath(driverid).build(); } public int getdriverid() { return drive

Ext.Net: parent.Ext.net.DirectMethods.NewCard_Click(); -

i have project.when click button inside mainpage, loading newcard.aspx file.inside file have button this, <ext:button id="button1" runat="server" text="ekle" icon="groupadd"> <listeners> <click handler="parent.ext.net.directmethods.newcard_click();"></click> </listeners> </ext:button> newcard_click();methon defined inside mainpage.aspx.(which loadind anaother aspx file) event not fired,did miss something?should add something? earlier versions used ext.net.directmethods.methodname() which make window.parent.ext.net.directmethods.methodname() the correct answer, seem changed in latest version, answer is window.parent.app.direct.methodname()

vb.net - Force datagridview call row validating after finish input -

i'm creating form bound datagridview inside it. on form_load or row_validating , added new row datagridview by: private sub purchaseinrowadd() 'add new row datagridview dim dtrow datarow = ctype(me.dgvpurchasein.datasource, datatable).newrow() dtrow.item("invoiceid") = 0 dtrow.item("kindid") = ctype(ctype(me.dgvpurchasein.columns("colpurchasekind"), datagridviewcomboboxcolumn).datasource, datatable).rows(0)("kindid") dtrow.item("invoicesign") = "" dtrow.item("invoiceno") = "" dtrow.item("invoicedate") = new date(objcontroller.processyear, objcontroller.processmonth, 1) dtrow.item("id") = ctype(ctype(me.dgvpurchasein.columns("colpurchasecustomer"), datagridviewcomboboxcolumn).datasource, datatable).rows(0)("id") dtrow.item("product") = "" dtrow.item(&qu

asp.net - Compare Flight Rates and timing -

i know question closed post , thumb down. need know issue , how solve it(or show me other portal can post this). i asked develop portal users can search available airline flights , compare it. in simple words want know how kayak works.i need same functionality. i read http://www.kayak.com/labs/gateway/ but shows result on site..i need on site is there free api this? after months of searching can tell there none. there no free flight api in existence anymore except if negotiate access through service kayak affiliate suppose. best bet gds (like http://developer.travelport.com/ ) going cost searches. there month free trail option far remember.

Django : url main page -

i want add main page login have error a server error occurred. please contact administrator. what means ?? url: urlpatterns = patterns('', url(r'^§', main_page), url(r'^mainview/$', mainview.as_view()), url(r'^material/(?p<slug>[-\w]+)/$', materialdetailview.as_view(), name='material_material_detail'), ) view: def main_page(request): template = get_template('registration/main_page.html') variables = context({ 'user': request.user }) output = template.render(variables) return httpresponse(ouput) pretty sure meant url(r'^$', main_page),

Sharepoint : Collect data from user with visual studio -

i collect data user in visual studio workflow. sharepoint designer it's easy "collect data user" can create task , add attributs collect. email send collect data user. same process in visual studio workflow. haven't found tools can this. ideas ? thank. ok have found answer. have create approval workflow. http://approvalworkflow.codeplex.com/

html - Two div elements, one fixed and the other one is auto. How to fix? -

i have total brain freeze , appreciate helping hand how fix it. i have 2x div elements. called left , right: i want right element have fixed width of 320px, , left 1 should auto. when shrink browser window, left element should become smaller. i can working if left element fixed, not right one. working code left: .left {width: 320px;float: left;background:#ccc;} .right { margin-left: 320px; background:#ffff00; } not working code right: .left_two { margin-right: 320px; background:#ffff00; } .right_two {width: 320px;float: right;background:#ccc; } but how want behaive. you can follow code , project here: ( shrink browser window ) http://www.adamskymotorkylare.se/project/new.php thanks jack change html structure like this <div class="left">left</div> <div class="right">right</div> <div class="right_two">right</div> <div class="left_two">left</div> demo

gnuplot - multiple plot files using the same style settings, but different number of plot lines? -

this problem: have 4 different data files; , need create various plots on png, using data in these files. i have in function call in script, put many common statement can. the plot have different file names, use same settings: legend position, title, axis label, range, border line style. what change data, coming different data files, number of lines on same plot (some has example 1 set of data, others has 4-5 per plot), , color differentiate them. is there clean way group similar, don't end writing same things each of plot? i've check doc , not able find solution this; since style set each dataset, can't group it. found questions here similar, problem totally different...i don't need merge data different dataset, need create different plot files, share of common settings. make generic example, need way css style file, style stay same, content of plot (and name of file) changes. i using shell script code; wrapped gnuplot command in shell function. thank

osx - what does the decreasing numbers in stack trace in Mac process hang report means? -

i have mac application hangs when command executed. when force quit application, mac generates report current stack trace. stack trace looks like: 14 start + 53 (app 14.0) [0x2955] 14 main + 164 (app 14.0) [0x444f5f] 13 paste + 53 (app 14.0) [0x2955] 12 pasteinternal + 164 (app 14.0) [0x444f5f] , on... wondering prefixed numbers (14, 13, 12...) mean here? number of times method called?

python - Stack, Pop and Add -

this calculate function should work calculate((1, 2, '+', 3, '*')) return 9 1. take 1, push 1 # stack [1] 2. take 2, push 2 #stack [1, 2] 3. take '+', pop 2, pop 1, calculate 1+2 = 3, push 3 #stack [3] 4. take 3, push 3 #stack [3, 3] 5. take '*', pop 3, pop 3, calculate 3 * 3 = 9, push 9 #stack [9] 6. input empty, pop 9, return 9 i don't know how use string '+' here add 1 , 2 together. seems impossible. here code. suppose convert tuple , put list pop first 2 number out combine binary operators '+', '-', '*', '/' def calculate(inputs): #(1, 2, '+', 3, '/') if len(inputs) <= 1: return inputs[0] in range(len(inputs)+1): ## (0,...5) s = make_empty_stack() # [] first = push_stack(s, inputs[i]) #[1] # push_stack pushes item onto stack s, returns stack second = push_stack(s, inputs[i + 1]) ##[2,1] third = push_stack(s, inputs[i +2]

ruby - Rhomobile Migration from Rho3.1 to Rho 4.0 Alert Msg. Error -

Image
i trying migrate rho application 3.1 4.0. in 3.1 have defined alert using alert.show_popup :title => "please wait", :message => "fetching data..." specified in documentation have changed datapopprops = hash.new datapopprops['message'] = "fetching data..."; datapopprops['title'] = "please wait"; rho::notification.showpopup(datapopprops) but still getting same error. error: button list has been incorrectly defined. dialog not launch any great. try this, datapopprops = hash.new datapopprops['message'] = "fetching data..."; datapopprops['title'] = "please wait"; datapopprops['buttons'] = ["ok"] rho::notification.showpopup(datapopprops)

Creating a customized sandbox in node.js (Can only read in a certain directory, and cannot write anywhere) -

i trying make application runs submitted scripts, , try sandbox submitted scripts. scripts need able able read in directory (and in of subdirectories), shouldn't able write @ all, and, other being able read, should not able not done in browser (ie download files using http ). how go doing this? i don't think node has capability built in, should able run "unsandboxed" node on *nix operating system severely restricted user (might possible in other oses too, i'm not sure). might want @ node's vm module .

angularjs - Onsenui app add custom function on navigator click -

i develop onsenui app on monaca , i'd add custom function on on-right-button-click event : <ons-navigator title="mytitlte" right-button-icon="fa fa-lg fa-refresh" on-right-button-click="refresh()" page="pages/msg.html"> </ons-navigator> my refresh() function defined in controller moduleapp.controller('myctrl', ['$scope', '$http', function ($scope, $http) { // refresh items $scope.refresh = function () { .... }; }]); thanks help you need set "mycontroller" on navigator or above navigator. <ons-navigator ng-controller="mycontroller" title="mytitlte" right-button-icon="fa fa-lg fa-refresh" on-right-button-click="refresh()" page="pages/msg.html"> </ons-navigator>

eval SyntaxError: invalid syntax in python -

i want assign : x0='123' x1='123' x2='123' x3='123' x4='123' x5='123' x6='123' x7='123' x8='123' x9='123' i write code express can output of string 123 when input x1 or x8 . for in range(0,10): eval("x"+str(i)+"='123'") traceback (most recent call last): file "<stdin>", line 2, in <module> file "<string>", line 1 x0='123' ^ syntaxerror: invalid syntax how can way? for dynamic execution of statements use exec statement. >>> exec('y=3') >>> y 3 eval usgae: eval(expression) the expression argument parsed , evaluated python expression eg: >>> s=3 >>> eval('s==3') true >>> eval('s + 1') 4 >>> eval('s') 3 >>> eval('str(s)+"test"') '3test'

c# - AppDomainSetup.PrivateBinPath vs Environment.SetEnvironmentVariable -

i need app know unmanaged dlls. using setenvironmentvariable , working great. know there property appdomainsetup.privatebinpath . practical difference between them? currently doing below: var dlldirectory = @"c:\some\path"; environment.setenvironmentvariable("path", environment.getenvironmentvariable("path") + ";" + dlldirectory) edit: noticed environment.setenvironmentvariable not change path variable, seams affect app have called it. privatebinpath clr assemblies. which not windows dlls, doesn't know clr configuration. uses regular windows search rules, behaves this: same directory exe stored the directory specified in set/adddlldirectory() call, if any the windows system directory (normally c:\windows\system32) the windows install directory (normally c:\windows) the current default directory (environment.currentdirectory) the directories listed in path environment variable. several quirks this, has been

How do I limit an input in python so it will only allow 0 or 1's? -

ive got binary converter in python , want know how limit input numbers only, in case. 1's or 0's. 101010001 valid 44 not example. thanks. you can try attempt convert integer binary, , print message if fails. query = raw_input("enter binary number ") try: is_bin = int(query,2) is_bin = true print "correct number" except valueerror: is_bin = false print "not binary number"

javascript - Different callback inside the loop -

i have problem iterating in array inside callbacks. it's specific problem. i have loop: arr.foreach(function(value, index, array){}); inside loop call asynchronous function: arr.foreach(function(value, index, array) { asfun1(function(i, val){ return function (param1, param2) { };}(index, value)); }); after callback fired, need set new callback object , call asynchronous function: arr.foreach(function(value, index, array) { asfun1(function(i, val){ return function (param1, param2) { obj.callback = (function(in, v){ return function (param3, param4) { //make };}(i, val)) obj.asfun2(); };}(index, value)); }); so, solve problem implemented in obj class callback array , iterator. , in loop i'm not setting callback, adding in array. , when first callback fires, command obj iterator go next callback: arr.foreach(function(value, index, array) { asfun1(function(i, val){ return function (param1, param

Using mutex C# for Inno setup -

avast detect software uses c# mutex virus. i need use not able to, code: private static mutex meuprograma; [stathread] static void main() { application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); bool creatednew; using (var setupmutex = new mutex(false, @"alpino")) { application.run(new form1()); } } avast detects virus. can me?

java - OpenCV Template matching improper if region set using cvSetImageROI -

i trying match template using javacv. problem that, if set region using cvsetimageroi output not proper, shows rectangle anywhere in resulted output area, if cvsetimageroi not used results proper, shows desired output. following code public static void main(string c[]) { iplimage src = cvloadimage("d:\\opencvtest\\1.jpg", 0); iplimage tmp = cvloadimage("d:\\opencvtest\\close.png", 0); iplimage result = cvcreateimage(cvsize(src.width() -tmp.width()+1,src.height()-tmp.height() + 1),ipl_depth_32f,1); cvzero(result); // cvsetimageroi(src, new cvrect(370, 175, 624, 398)); //cvsetimageroi(result, new cvrect(370, 175, 624 - tmp.width() + 1, 398 - tmp.height() + 1)); cvmatchtemplate(src, tmp, result, cv_tm_ccorr_normed); double[] min_val = new double[2]; double[] max_val = new double[2]; cvpoint minloc = new cvpoint(); cvpoint maxloc = new cvpoint(); cvminmaxloc(result, min_val, max_val, minloc, maxloc,nul

java - how to delete a blob in .jsp -

i trying delete image blob app through .jsp file, far i've got this: <% blobstring=key.getproperty("keys").tostring(); //vale "keys" blob-key datastore, above code loops through pictures , gets key of them blobkey blobkey = new blobkey(blobstring); %> <form action="<%=blobstoreservice.delete(blobkey)%>" method="post" enctype="multipart/form-data"> <input type="submit" value="delete" name="delete"> </form> i cant work , beginner in area, can spot im droing wrong? you have create handler on server, example, /delete , process delete requests when user submits such request. <form action="/delete" method="post" enctype="multipart/form-data"> <input type="submit" value="<% blobstring %>" name="delete"> you cannot set object blobkey value in html code. accepts string.

What is the best way to atomic-replace all contents in List in Java? -

suppose have list role of cache. time list read-only buy every few seconds want atomic replacement of list contents. in atomic mean don't want allow cache clients hit read between example clear() , addall() . what list implementation use , how perform replacement best performance? it better replace list contents or replace reference value itself? java has readwritelock supports reads concurrently , writes exclusively. mentioned in javadoc, choice if updates occur not , reads occur often. faster writer updates list better performance get. the methods readlock() has called readers , writelock() writers. have call lock() on lock obtained. if available, tread continue working, otherwise block, until lock available. use fairness when constructing readwritelock enable reader , writer threads obtain locks in order requested it. otherwise thread wait forever (in worst case scenario). the benefit of readwritelock many reader may share same lock without obtai

android - Padding error with fitsSystemWindows on Kitkat -

Image
i trying use kitkat's transparent navigation bars feature, , weird effect: padding seems added bottom of view when add fitssystemwindows attribute true . attribute added first view doesn't align top , displayed behind status bar. this want , expect: but get: i tested textview s well, same result. can't work, guess i'm missing something. below code: file values-19/styles.xml : <style name="apptheme" parent="android:theme.holo.noactionbar.translucentdecor"> </style> my layout file: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#800" android:orientation="vertical" > <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#80

c# - Convert DateTime to string according to Oracle Format Mask -

there oracle db api function expects input string representing date (or in other cases number) formatted provided format mask. before went , implemented oracle format mask parser thought ask whether there .net built-in or third party way of converting datetime .net object string using oracle format mask? update examples: datetime date = datetime.now; string converteddate = convertdatetimetooracleformattedstring (date, "month dd, yyyy"); // should produce: march 21, 2014 converteddate = convertdatetimetooracleformattedstring (date, "cc bc"); // should produce: 21 // other valid oracle format combination: http://docs.oracle.com/cd/b19306_01/server.102/b14200/sql_elements004.htm#i34924 my current idea parse provided oracle format mask equivalent .net custom date , time format string: http://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx , use when converting .net datetime string: datetime.now.tostring ("equivalentdotnetformat"); .

php - jQuery ajaxForm complete works sometimes, other times it only fires a native javascript function then stops -

this may duplicate of this topic , must revive issue seems little deeper this. i'm using ajaxform() submit 4 question quiz php script, receive result, , populate div. beforesend function fires, sending information ajax.php script. beforesend shows loading graphic in quiz container. complete function fires ajax.php returns html populated dom. @ point, stops. next line call slideup loading div , display returned information in quizcontainer. at point if put in javascript alert fires, meaning complete @ least firing when should, jquery reference loading div ignored. here's code javascript file handles submission - section handling "handle quiz submission": $(document).ready(function () { // rid of message box after 15 seconds settimeout(function() { $('#message').slideup('fast'); }, 10000); // handle course list lis $('#courselist li').on('click', function () { // background color it's set var color = $(th

c# - conversion of a varchar data type to a datetime data type resulted in an out-of-range value executing stored procedure -

i have problem error title. error ocures when try execute stored procedure this: create procedure [dbo].[inserttimedate] @tablename nvarchar(28), @timestamp datetime, declare @query nvarchar(max); begin set @query = 'insert [' +@tablename+'] (timestamp) values ('''+convert(nvarchar, @timestamp, 20)+''')' exec (@query) end i execute c# code: dbcommand = new sqlcommand("inserttimedate", dbconnection); dbcommand.commandtype = commandtype.storedprocedure; dbcommand.parameters.addwithvalue("@tablename", "table_name"); dbcommand.parameters.addwithvalue("@timestamp", datetime.now); dbcommand.executenonquery(); try style 126 in convert - that's iso-8601 format should work language/regional setting of sql server: set @query = 'insert [' +@tablename+'] (timestamp) values (''' + convert(nvarchar, @timestamp, 126) + ''

AJAX won't POST to PHP (Non jQuery) -

i've searched , search , find jquery questions , fixes this. have 1 script setup works fine 1 not post post 3 values php script. i've tried force feed 3 set values i'm putting timestamp , dosn't work. i'm @ bit of loss. this script generates different fields/inputs run updatecoupon() function updateform(formnum,id){ var str = 'edit-contents'+id; switch( formnum ) { case 1: document.getelementbyid(str).innerhtml = "<div class='title-input'>promo title:<br><input type='text' size='25' maxlength='100' id='ptitle' name='ptitle'><input name='edit' type='button' class='editcoup' id='editcoup' value='edit' onclick='javascript:updatecoupon("+id+",1);'></div>"; break; case 2: docum

swing - How to use SystemTray correctly in Java? -

i tried implement small (test) programm using systemtray in java. got problems , wrote (m)we , pubushed http://pastebin.com/nybkalsy (sorry not doing safty checks). what happens (under ubuntu/kde openjdk): the program starts , button clickable. systemtray registered (all right far) if click (single left mouse) on image in tray button no more clickable. instead seems disabled. right-click on tray icon or frame content (!!!) opens popup. after closing (clicking anywhere) button active again. (this bahavior cannot explain. code not implie far see) if click on minimize button of window manager frame disappears (correct) on choosing show popup of tray icon restores frame , frame content clickable (ok far). unfortunately popup disabled after that. cannot open again , if minimize window again cannot bring window again. (also not see point in code) now unsure if understood principles wrongly or if there other bug around. please me clear questions. edit: inserted code (a

ios - Method to consume web socket video stream with AVFoundation? -

i have resource sending video stream via websockets (i don't have control on transimission method). able read socket using socketrocket without problems, avplayer , ilk need nsurl , not stream of nsdata bytes. here couple of solutions have tried: custom nsurlprotocol route bytes socket nsurlprotocolclient . turns out, though, avplayer , mpmovieplayerviewcontroller not use nsurlconnection . this worded question tried writing bytes disk , appending them poor results. use cocoahttpserver proxy stream. apis here (unless i'm missing something) aren't conducive writing arbitrary amount of data response. how can trick avplayer playing video stream? you should take @ avassetresourceloaderdelegate . allows initialize avasset custom url myapp://path/that/means/something/to/myapp , if have set [[avasset resourceloader] setdelegate:myobj queue:myqueue] media playback pipeline ask data , merely requires respond nsdata - see avassetresourceloadingda

php - Configure SwiftMailer "Local Domain" setting easily, in Symfony 2 -

swiftmailer default way of sending email symfony 2 project, , i'd use in application. i've pointed towards smtp server provided internet provider (virgin media, in uk), emails not sent. exception thrown says expected response code 250 got code "501", message "501 helo requires valid address in response smtp command helo [::1] [::1] corresponds localhost in ipv6, , it's not surprising smtp server reject if it's expecting proper domain name. tracing execution through swiftmailer source, find value comes _domain on abstractsmtptransport; altering value during debug session allows email sent. although can set using public setlocaldomain() method, isn't anywhere in symfony 2 framework, seems there no way (obvious me, @ least) of configuring value by, example, changing symfony config file. so question this: there other way of changing value, ideally using config, without diving symfony code , changing bits aren't meant changed?

php - fastest way to read multiple documents from Riak -

i have tried reading documents in different format, have array of keys use reading. each batch contains 1000 keys. have 6 riak nodes. reads r=1. connect each time same riak node. documents profile fields, it's not big. i've checked cpu , disk usage on nodes, , can observe slight move, not close overall 20% cpu. method 1: multiget ( code section linked here ): $data = $riak->multiget($ids); /*execution time 80seconds*/ method 2: key_filter ( code section linked here ) $data = $riak->multigetbetween($id1, $id2); /* gives riak internal timeout*/ method 3: 1 one get foreach ($ids $key) { $riak->get($key); $data[$key] = $riak->document->data; } /* execution time 20seconds */ as see method 3 better, problem have of them, cannot run more 2 threads . if try run more, socket timeout connection. checked linux open limits , it's 240k. ran out of options try , here. ideas? the recommended approach retrieving multiple objects use multi