Posts

Showing posts from August, 2010

c# - WinRT Smooth Grid.Column change Animation -

i'm using following code change listview location 1 column another: <grid.resources> <storyboard x:name="mystoryboard"> <fadeoutthemeanimation targetname="detailitems" /> <objectanimationusingkeyframes storyboard.targetname="detailitems2" storyboard.targetproperty="(grid.column)"> <discreteobjectkeyframe keytime="0" value="1" /> </objectanimationusingkeyframes> </storyboard> </grid.resources> this works, but, there's no animation, changes column. want have sort of translation animation. thanks! this can't done changing (grid.column) what can animate rendertransform property (use translatetransform instance). animate translatetransform using various keyframes, once animation done, reset translatetransform 0 , change grid.column.

javascript - Underscore template display array of objects via _.each -

i'm having trouble printing out simple each comment loop _.template. <% _.each([comments], function(i) { %> <p><%= %></p> <% }); %> prints [object object] <% _.each([comments], function(i) { %> <p><%= json.stringify(i) %></p> <% }); %> prints: [{"comment":"mauris quis leo @ diam molestie sagittis.","id":263,"observation_id":25}] what i've tried far: <% _.each([comments], function(i) { %> <p><%= i.comment %></p> <% }); %> blank <% _.each([comments], function(i) { %> <p><%= i.get('comment') %></p> <% }); %> uncaught typeerror: object [object array] has no method 'get' <% _.each([comments], function(i) { %> <p><%= comment %></p> <% }); %> blank assuming comments array on model: <% _.each(comments, function(comment) { %> <p

encryption - RSA Implementation in C# -

i trying implement rsa algorithm in c#. code below works when p , q small, not when trying replicate rsa-100 or greater p , q large. for example when: p = 61, q = 53, n = 3233, phi(n) = 3120, e = 17, d = 2753 once decrypted, correct original messsage. got these values rsa wikipedia page . code works other small values of p , q. however, when using rsa-100 or greater, not original message. have tried using different values exponent (e) , made sure coprime phi(n) cannot correct result. missing simple/obvious? thank in advance help! //p , q rsa-100 //string p = "37975227936943673922808872755445627854565536638199"; //string q = "40094690950920881030683735292761468389214899724061"; string p = "61"; string q = "53"; //convert string biginteger biginteger rsa_p = biginteger.parse(p); biginteger rsa_q = biginteger.parse(q); //n = p * q biginteger rsa_n = biginteger.multiply(rsa_p, rsa_q); //phi(n) = (p-1)*(q-1) biginteger rsa_fn = bi

c# - Connecting to each DB2 platform through .NET -

recently started working in application needs write , read db2 database , until now, i've never used db2. reading on internet, got information , have made assumptions. need know if thinking correct, or if there's way. with ibm data provider (.net dlls) can connect db2 running on linux or windows servers. for db2 running on as/400, z/os, is, can use these same dlls but(!) it's necessary use 'db2 connect' accomplish this. if don't have 'db2 connect' can connect databases running on as/400, z/os or is, if use oledb or odbc. sorry if misunderstood simple. you can connect db2 on power systems (formerly known as/400 or iseries) .net data provider comes ibm access (formerly ibm iseries access). db2 connect not required platform. make sure version of ibm access windows (or ibm iseries access) greater or equal version of ibm (formerly known os/400 or i5/os), , has correct service pack installed.

mysql - while loop with form with checkbox php not updating based on database details -

i have while loop display information correctly, want checkbox allowing me mark each member of loop completed in database, don't know start , appreciate help. below how far am, generating loop correctly , displaying checkbox not being set completed on loading? while ($row = mysql_fetch_array($query)){ $task_name = $row['task_name'] ; $task_description = $row['task_description']; $task_completed = $row['completed']; $tasks .= '<div id="tasksbody"><form action="" method="post">completed? <input name="completed" type="checkbox" if ($task_completed == 1){checked="checked"} /><input type="submit" value="update"><br /><br /><b>'.$task_name.'</b><br /><br />'.$task_description.'<hr><br /></form></div>'; } } any advice appreciated

How to find the files in different folders by using php? -

this question has answer here: recursive file search (php) 6 answers i have question regarding php file structure. i want run script genearte images of bunch of pdf files. my problem pdf files in different folders , structures. for example: a pdf locate in /test/book/pdf/test.pdf. another 1 in /server/pdfs/link/dummy.pdf. there thousands of pdfs file in file system , using imagick generate images pdfs . i not sure how locate of pdf nor how specify file path in imagick constructor. $im = new imagick('file path pdf here'); //i don't know how specify file path here... $im->setimageformat( "jpg" ); can gives me hint? much! you go root folder , scan directories , subdirectories .pdf files , store them in array (php: scandir), array or string caracter-delimiter between each filename.

html - On click Windows Location not adding to form action -

i looking on website works in other browsers except ie. is there reason why link below not work in ie? code: <form action="<?php echo base_url(); ?>shop/cart/add/<?php echo base64_url_encode(url_req()); ?>/" method="post"> <div style="height: 150px;"><a href="<?php echo base_url(); ?>shop/product/details/<?php echo $c->getid(); ?>/"><?php if($im = shop_image::retrievebypk($c->getcover_image_id())) echo '<img src="',base_url(),$im->getmedium_path(),'" alt="click read more" style="max-height: 120px; max-width: 120px;" />'; ?></a></div> <p style="height: 30px;"><a class="products_name" href="<?php echo base_url(); ?>shop/product/details/<?php echo $c->getid(); ?>/"><?php echo $c->getname(); ?></a></p>

c# - How would you define a Proxy Type? -

i understand them conceptually, having hard time coming plain english definition them. this closest fitting think i've come far: proxy types representations of data models defined elsewhere. that know in programming when proxy, refer proxy pattern. if want in words more or less check here: proxypattern . the sentence "a proxy, in general form, class functioning interface else." think boils down concept of proxy

asp.net - JSON + SOAP - Is DataContract necessary? -

here's problem. i'm using soap retrieve information third-party web service. response time high, planning on using json instead, @ least in couple of methods. for i'm using datacontractjsonserializer , seem having trouble. example, in soap there's method called getavailablepublic returns object of type getavailablepublicresponse . there's equivalent method in json, returns object of type getavailablepublicresponse . in order deserialize information needed create couple of data contracts, , here concerns: do need create datacontract? why can't use getavailablepublicresponse object asmx? the problem if create datacontract, need use different name other getavailablepublicresponse, have 2 objects same name (the 1 created me, , 1 soap), , require making several changes in solution. hope makes sense. thanks. can post client code making call web service? don't know using now, i'm fan of restsharp making remote calls , serializing js

java - How do I get the program to display the sum of the values divisible by 5, versus just the values themselves? -

the program asks method created. method takes 2 parameters: start , end, both integers. method must sum of numbers between start , end divisible 5. example, if start 1 , end 30, answer must 105, since 5 + 10 + 15 + 20 + 25 + 30 = 105 numbers divisible 5 , belong range of 1 , 5. import java.util.*; public class divisor{ public static void main(string[] args){ scanner input = new scanner(system.in); system.out.print("enter start: "); int start = input.nextint(); system.out.print("enter end: "); int end = input.nextint(); int result6 = sumdivisor(start, end); system.out.println(result6); } public static int sumdivisor (int start, int end){ int value = end; for(int = 5;i <= end;i = + 5){ value = i; system.out.print(i + " "); } return value; } } you have take account situation start argument not divisible 5: public static int sumdivisor (int start, int end){ int val

python - Non blocking subprocess.call -

i'm trying make non blocking subprocess call run slave.py script main.py program. need pass args main.py slave.py once when it(slave.py) first started via subprocess.call after slave.py runs period of time exits. main.py insert, (list) in enumerate(list, start =1): sys.args = [list] subprocess.call(["python", "slave.py", sys.args], shell = true) {loop through program , more stuff..} and slave script slave.py print sys.args while true: {do stuff args in loop till finished} time.sleep(30) currently, slave.py blocks main.py running rest of tasks, want slave.py independent of main.py, once i've passed args it. 2 scripts no longer need communicate. i've found few posts on net non blocking subprocess.call of them centered on requiring communication slave.py @ some-point not need. know how implement in simple fashion...? you should use subprocess.popen instead of subprocess.call . something like: subprocess.popen([

c++ - Compiler Independent Types -

i've seen several libraries , c++ header files provide compiler independent types don't understand quite why compiler independent. for example: int number; // not compiler independent typedef unsigned int u32; u32 number2; // compiler independent is above true? if so, why? don't quite understand why usage of typedef mean size of number2 same across compilers. elaborating on comment, proposition : use typedef compiler independence. rationale : platform independence thing implementation : #ifdef _msc_ver #if _msc_ver < 1400 typedef int bar; #elif _msc_ver < 1600 typedef char bar; #else typedef bool bar; #else #error "unknown compiler" #endif the preprocessor macro chain important part not typedef. disclaimer: haven't compiled it!

php - How to receive GET request from external source with CakePHP -

i'm working on project allows external users(coming source server) make request page on server, return json encoded data. for example, data (not using cake, standard php) sent wwww.example.com/handlerequest.php i'd have like if(isset($_get['userrequest'])){ //do stuff echo $json_encoded_stuff; } with cakephp i'd post data like www.example.com/handlerequest however, do not want/need view because there nothing see. page purely data exchange. considering this, there special have cake doesn't throw error because it's expecting corresponding view? possible? it easy disable both layout , view in cakephp putting following line in controller action: $this->autorender = false; if want disable layout, use following line in controller action: $this->layout = false; and if want disable view action, use following line in controller: $this->render(false); note using $this->layout = false; , $this->render(fals

Is Powershell -sta (apartment state) preferred? -

i've been dabbling in powershell (2.0) past several months , love use modernize , standardize of processes @ work - dos based processes. because of nature of work, there around 100 executions of same script(s) going @ once. first--is powershell "safe" use in manner? have seen -sta execution option - preferred method of working powershell when executing number of same script simultaneously, or used when absolutely necessary? in searching, haven't come answer "when should use apartment state?" believe if not of scripting intend not threaded. thanks in advance can shed light on powershell apartment state! in psv2, console host runs mta, , ise runs sta. in psv3 console defaults sta . you can see apartment state this: [system.threading.thread]::currentthread.getapartmentstate() the time need use sta when using classes in .net deal com objects use e.g. system.windows.forms.clipboard . there 2 ways know of change sta: powershell.exe

php - SQL query, choosing the nearest DateTime data from two column in different tables -

i show nearest datetime data sql query data across 2 table. have code socialdatabase.socialstart > now() limit 1 pick recent data 1 table , know trainingdatabase.socialstart > now() limit 1 same thing other table. so how go merging these nearest data combined list of socialdatabase , trainingdatabase tables thanks you can use union syntax: (select socialstart, data socialdatabase socialdatabase.socialstart > now() limit 1) union (select socialstart, data trainingdatabase trainingdatabase.socialstart > now() limit 1) order 1 desc limit 1

using flex and bison combo or generating parse tree from java bytecode -

i intending generate parse trees java byte codes. typical byte code of following, public class org.scandroid.testing.invokecallargtest extends org.scandroid.testing.sourcesink{ public org.scandroid.testing.invokecallargtest(); code: 0: aload_0 1: invokespecial #8; //method org/scandroid/testing/sourcesink."<init>":()v 4: return public static java.lang.string invokecallargsourcespec(); code: 0: iconst_1 1: newarray char 3: astore_0 4: aload_0 5: invokestatic #16; //method org/scandroid/testing/sourcesink.load:([c)v 8: new #20; //class java/lang/string 11: dup 12: aload_0 13: invokespecial #22; //method java/lang/string."<init>":([c)v 16: areturn public static int invokecallargsourcespecint(); code: 0: iconst_1 1: newarray char 3: astore_0 4: aload_0 5: invokestatic #16; //method org/scandroid/testing/sourcesink.load:([c)v 8: aload_0 9:

debugging - How to debug "Collection was mutated while being enumerated" errors and like, when Xcode does not provide me with enough information? -

currently, see recurring error: 2013-04-18 02:35:51.583 aaah[1713:1110f] *** terminating app due uncaught exception 'nsgenericexception', reason: '*** collection <__nsarraym: 0x1fc00dc0> mutated while being enumerated.' in failing background queue (i see queues state upon moment of crash pressing command + 5) see: 0 _pthread_kill 1 pthread_kill and see assembly output don't understand. i know how resolve kind of array enumeration errors - can't understand where/how should seek piece of code causing app crash. i have multi-threaded code using afnetworking , core data, can't remember crucial section might be. also, error occurs not always, time time, difficult use "isolation approach", isolating smaller , smaller pieces of code, identify buggy piece of code. so question is: how can extract more useful information output, or xcode can provide me more verbosity level, know how resolve annoying piece of code. have tr

java - ArrayIndexOutOfBoundsException when inserting into an array -

i'm writing program @ point needs put 2 arrays of different lengths 2 dimensional array. does know why i'm getting arrayindexoutofboundsexception @ specified line? string[][] proteinarray; if(proteinsmomfinal.length > proteinsdadfinal.length) { proteinarray = new string[proteinsmomfinal.length][2]; } else { proteinarray = new string[proteinsdadfinal.length][2]; } for(int = 0; < proteinsmom.length; i++) { proteinarray[i][0] = proteinsmomfinal[i]; // error here } for(int = 0; < proteinsdad.length; i++) { proteinarray[i][1] = proteinsdadfinal[i]; } you should using proteinsmomfinal in statement. how can know proteinsmom same length proteinsmomfinal? for(int = 0; < proteinsmomfinal.length; i++) { proteinarray[i][0] = proteinsmomfinal[i]; // error here }

c# - Execute web service method and return immediately -

c# asp.net 3.5 is possible "fire , forget" method in web service not asynchronous or one-way? there method returns value (after processing), don't need. used group (who wrote service). basically, notifies user x did action y. need call method , move on without waiting result. i tried using backgroundworker() runworkerasync, method not fire reason. cannot change web service method have no access code. should using backgroundworker, invoke, threadpool, else? don't need result returned, , don't need know if fails. basically, call method, , if works, great. if not, don't want stop or slow processing down. public static void test() { var worker = new backgroundworker(); worker.dowork += test2; worker.runworkerasync(new object[] {12345, "test"}); } private static void test2(object sender, doworkeventargs e) { // write log got method - not object[] args = e.argument object[]; int num = convert.toint32(args[0]); string na

mysql - Python working with MAMP -

i have been struggling days. installing / uninstalling / starting over. i attempting python working mysql mamp , have followed many tutorials seems point testing import mysqldb module. below error receive. advice on how continue? >>> import mysqldb traceback (most recent call last): file "<stdin>", line 1, in <module> file "/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/mysql_python-1.2.4b4-py2.7-macosx-10.5-intel.egg/mysqldb/__init__.py", line 19, in <module> import _mysql importerror: dlopen(/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/mysql_python-1.2.4b4-py2.7-macosx-10.5-intel.egg/_mysql.so, 2): library not loaded: libmysqlclient.16.dylib referenced from: /library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/mysql_python-1.2.4b4-py2.7-macosx-10.5-intel.egg/_mysql.so reason: image not found

php - Email treated as SPAM when has Links -

i've work day long on crazy problem. i created html email sent massively. use phpmailer , tried mail function. both phpmailer , it's smtp feature , native mail function works well. good - pass spam filter the problem when put link in html code, email turns spam. not links. if put link href " http://www.google.com " passes filter. samething on company domain name " http://www.sequencedigitale.com ", passes filter well. <a href="http://www.google.com">this google website</a> wrong - don't pass spam filter what turns me crazy when put same domain name server process email submission. have 3 domains names point on server, every of 3 don't pass filter. <a href="http://careers.fieracapital.com">this doesn't pass filter</a> i checked on blacklist checkers , ip isn't block on 100% of lists. the ip 184.107.100.61 the problem happened me on hotmail , outlook , on server runned ple

Writing to an output file using fstream in C++ -

assuming have proper headers , using namespace std; correct in terms of using fstream output string output file? included relevant file api parts of code entirety of long. i've included iostream , fstream headers. seem particular errors, way im using myfile class or object. #include <curses.h> #include <math.h> #include "fmttime.h" #include <sys/time.h> #include <time.h> #include <unistd.h> #include <stdio.h> // needed file api #include <iostream> // file api headers c++ #include <fstream> using namespace std; // enumeration list colors of grid, title, sin , cos waves enum colors { gridcolor = 1, titlecolor, sincolor, coscolor, }; void sim_advance(int degrees); // function prototype phase angle double sim_cos(); // function calculates cos double sim_sin(); // function calculates sin char* usag

java - Drive Api Phone -

i'm trying create java program create , upload excel files google drive. after uploading need give permissions. have done thatbut problem lies in trying convert excel files google files in order people use sheets able update them phones. have not been able find on how on google api. appreciated. assuming have path excel file: java.io.file filecontent = new java.io.file(excelfilepath); filecontent mediacontent = new filecontent("application/vnd.ms-excel", filecontent); // file's metadata. file body = new file(); body.settitle(filecontent.getname()); body.setmimetype("application/vnd.ms-excel"); // important part insert request = service.files().insert(body, mediacontent); request.setconvert(true); file file = request.execute(); // end of important part if (file != null) { showtoast("data uploaded: " + file.gettitle()); }

.net - How to pass a Subroutine name as an argument for a function? -

i'm trying make generic function create threads, need pass subroutine name function, pass function name (which useless). how can this? there way without declaring delegate out of function? ...'cause said i'll make generic function simplify things. this code: public class form1 ' desired usage: ' make_thread(thread variable, thread name, thread priority, thread sub) ' ' example: ' make_thread(thread_1, "low thread", threading.threadpriority.low, addressof test_sub) private thread_1 threading.thread ' thread variable private function make_thread(of tkey)(byref thread_variable threading.thread, _ byval thread_name string, _ byval thread_priority threading.threadpriority, _ byref thread_sub func(of string, tkey)) boolean ' i'd byref function pass subroutine. ' see if thread running. dim is_running boolean if thread_variable nothing _

ios6 - Connection to more than one Bluetooth LE device in Xcode -

recently i've developed app working fine ble devices, i've added of options , features app. can scan devices, showing list , user can choose device connect. problem code able connect 1 ble only; if user wants connect other devices, has disconnect connected one. there option or method can use solve issue? you should post code if want actual help, can tell problem design problem. seems apparent haven't implemented cbcentralmanager methods in scaleable way, both underlying connections user interface. can tell direct experience in applications current apple limit 10 bluetooth low energy connections @ given time (although people may try claim different). however, while system able handle 10, btserver process (apple's bluetooth process) begins bug out many connections , crashes frequently. you need rethink way you've designed implementations of cbperipheral , cbcentralmanager classes. ensure aren't attached specific peripherals, instances of periphe

Python check status of URL stream -

i'm trying use python check if mjpeg stream url alive or not. i've tried following: connection = urlopen('http://localhost/videostream.cgi'), timeout=10) response = connection.getcode() connection.close() with no luck, times out of gives error. if view status in firebug or chrome dev toolbar, status "pending" instead of "200". is there way check make sure it's not 404 or other error? cheers, ben turns out camera web server.

javascript - Finding the 10001st Prime Number - Project Euler -

i trying find 10,001th prime number. have looked @ other code people have written , don't understand means. have written code in javascript in tried use sieve of eratosthenes. i'm not sure problem is. looks if should work correctly, i'm getting wrong answer. var compute = function() { var prime = [2,3,5,7,11,13,17,19]; for(var i=20; i<=80000;i++) { if(i%2!==0 && i%3!==0 && i%5!==0 && i%7!==0 && i%11!==0 && i%13!==0 && i%17!==0 && i%19!==0) { prime.push(i); } } console.log(prime[10000]); }; compute(); this simple method, find millionth (or hundred thousandth in machines) you'll need chop timeouts, or ship off webworker keep locking up. you need check prime divisors, collect them, since every number either product of primes or prime. function nthprime(nth){ var p= [2], n= 3, div, i, limit,isprime; while(p.length<nth){ div= 3, i= 1; limit= math.s

php - Symfony 1.4 style form field with errors -

i want change background color of field when error occurs. in java struts, can this: <s:textfield name="parameter" cssclass="normal_css_class" csserrorclass="class_on_error" csserrorstyle="style_on error"/> i want able perform above. tag renders field csserrorclass when field parameter has errors. no more additional javascript required. currently have following (very dirty) code in template: <?php if($form['bill_to']->haserror()): ?> <?php echo $form['bill_to']->render(array('style' => 'background-color: red')) ?> <?php else: ?> <?php echo $form['bill_to']->render() ?> <?php endif; ?> <?php echo $form['bill_to']->rendererror() ?> the above code works there way implement have call: <?php echo $form['bill_to']->render() ?> and perform setting of styles? i'm thinking of overriding render() method not s

Convert IP address in C -

i have: 192.168.1.1 how can convert it? i have tried splitting ip address sscanf like: sscanf(hostaddress,"%d.%d.%d.%d", &d1, &d2, &d3, &d4); i have ip address [...] how can convert long? you'e looking function inet_pton(3) . unsigned char buf[sizeof(struct in_addr)] rc = inet_pton(af_inet, "192.168.1.1", buf); and rc should 1 success. return code of 0 or -1 means error.

javascript - How to import json data in D3? -

how import json file in d3? i did d3.json("temp.json"); but how access data set in further code? so far have tried: var data=d3.json("temp.json"); but using .data(data) did not work in rest of code. example, here var rows = g.selectall("g.row") .data(data) .enter().append("g") .attr({ "class": "row", "transform": function(d, i) { var tx = 170 + * squarewidth; var ty = 150; return "translate(" + [tx, ty] + ")" } }); it not able access data. copy pasted json variable , worked fine. there no problem data itself. the function d3.json() asynchronous. thus, have wait data received before reading data variable. reason why, when dealing asynchronous data, practice inside d3.json() function d3.json("temp.json", function(error, data){ //use data here }) // not use data anymore

extjs - When to use square brackets and curly brackets in sencha touch? -

this might dumb question here goes. i've been following this tutorial on sencha touch 2 app. i'm new ext js , can't understand when use square brackets : [ .. ] or curly brackets : { .. } . ext.define("notesapp.view.noteslistcontainer", { extend: "ext.container", config: { items: [{ xtype: "toolbar", docked: "top", title: "my notes", items: [{ xtype: "spacer" }, { xtype: "button", text: "new", ui: "action", id:"new-note-btn" }] }] } }); and here html: [ '<img src="http://staging.sencha.com/img/sencha.png" />', '<h1>welcome sencha touch</h1>', "<p>you're cr

How can i add a new tab in left in sales order view,like now are invoices credit memos,releases etc in magento -

i want add new tab in left in sales->order->view.for have created module not solved problem,it showing error wrong tab configuration,i have search on many links posted in stack overflow,but not yet satisfied. thanks this should quite easy do. @ app/design/adminhtml/default/default/layout/sales.xml layout file. can find there <adminhtml_sales_order_view> node, defines blocks used on order's view page. in order add new tab, need put <action > declaration in file. tabs defined (magento ee 1.11): <adminhtml_sales_order_view> (...) <reference name="left"> <block type="adminhtml/sales_order_view_tabs" name="sales_order_tabs"> <action method="addtab"><name>order_info</name><block>order_tab_info</block></action> <action method="addtab"><name>order_invoices</name><block>adminhtml/sales_or

python - How can i do the Q filter search based on dictionary and its keys in Django -

suppose have dictionary mydict['number'] = {23,24,25} mydict['name'] = {"john","mike","kaff"} mydict['area'] = {"london", "usa", "japan"} i have query set qs but want have additional filtering based on above dictionary like qs.filter (where number __icontains in 23,24,25) and qs.filter (where name __icontains in john, mike, kaff) , on edit: this have tried rough query_list = [] key1 in mydict.iteritems(): myval in mydict[key1]: qry = qry + q(myval__icontains= myval) | query_list.append(qry) queryset = student.objects.filter(reduce(operator.and_, query_list)) i combine argument filter q objects. https://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects

zend framework - Create model instance in Form in ZF2 like ZF1? -

in zf1 possible create instance of model , access properties form class.` class application_form_drydepot extends zend_form { $model = new application_model_dbtable_drydepotmodel(); $list = $model ->formationselect(); array_unshift($list, array('key' => '', 'value' => '--please select--')); $id = new zend_form_element_hidden('id'); $id->addfilter('int') ->setdecorators($this->elementdecoration); $formation = new zend_form_element_select('formation_id'); $formation->setlabel('formation name') ->setrequired(true) ->setattrib('id', 'formation') ->setattrib('class', 'required') ->addvalidator('notempty', true) ->setmultioptions($list) ->setdecorators($this->elementdecoration); } in here $model directly possible cal

tkinter - Python grid_forget -

i ask regarding this. i'm trying clear frame adding new elements in it. however, after clearing elements, adding new elements not show. can please shed light regarding problem. thanks here's code #!/usr/bin/env python import tkinter tk import socket import sys def next(line, num): s.send(line) data= s.recv(size) num.set(data) class client(tk.frame): def __init__(self, master=none): tk.frame.__init__(self, master) self.grid() self.confighost() def confighost(self): self.hostentry = tk.entry(self, justify=tk.center); self.hostlabel = tk.label(self, text='host') self.connectbutton = tk.button(self, text='connect', command=lambda:self.startserve()) self.hostlabel.grid(row=0, column=0, ipadx=10, ipady=10) self.hostentry.grid(row=0, column=1, columnspan=4, pady=20, padx=20, ipadx=5, ipady=5) self.connectbutton.grid(column=2,pady=10) def startserve(self):

jQuery datepicker only works once and is not shown the second time -

asp.net mvc3 / jquery 1.9.1 / jquery ui 1.10.2 i've got page on open modal dialog after clicking on ajax.actionlink . inside dialog have input field , datepicker associated it. when open dialog first time, can click on datepicker button (or inside associated input field receives focus, showon set both ), , datepicker shows expected. can, while modal dialog open, want to, datepicker shows every time. when close modal dialog (via attached $("ui-widget-overlay").click(function(){...}); , open again, datepicker no longer works, no matter whether try click on button or associated input field. i tried debug jquery code, , both times lines of code being run same (and though datepicker doesn't show second time dialog opened, jquery methods triggered) can see in debugger. i'm stumped, , methods described in this post helped in terms of being show datepicker first time dialog opens. another post seems related misunderstanding how showon setting works. i trie

Can't access existing php cookie -

this question has answer here: cookies on localhost explicit domain 13 answers i'm developing website on localhost uses cookies. have function generates random, 25 character string stored in database , set referential cookie on user's browser. i've searched internet , site, wasn't able find solution problem. below overview of related code function generaterandomstring($length){ $string = ""; $possible = "012346789abcdefghijklmnopqrstuvwabcdefghijklmnopqrstuvw"; $maxlength = strlen($possible); if($length > $maxlength){ $length = $maxlength; } $i = 0; while($i < $length){ $char = substr($possible, mt_rand(0, $maxlength-1), 1); if(!strstr($string, $char)){ $string .= $char; $i++; } } return $string; } $ucookie = generaterandoms

c# - Out of memory reading after reading 682 txt files -

i want read file code after 682 times error: exception of type 'system.outofmemoryexception' thrown. system.io.streamreader file = new system.io.streamreader(scanpad[lusteller]); scanpad array filepaths , lusteller counter it. scanpad excists 11207 files. i have have looked en there file on place 682 anyone solution? here full version of code using (streamreader file = new system.io.streamreader(scanpad[lusteller])) { //do stuff lengte = bestandsnaam.length; lengte = lengte - 13; controller = bestandsnaam.remove(lengte, 13); // controllertype uit naam halen { rij = file.readline(); if (rij != null) //error op volgende lijn vermijden { if (rij.startswith("0") || rij.startswith("1") || rij.startswith("2") || rij.startswith("3"))

noscript - Terminating the code if javascript is not found -

im trying show message if there no javascript enabled in browser using , want not further proceed load page. im using php did <?php exit;?> in noscipt though browser has javascript enabled php code exit works... code used this: <noscript> <div style="text-align:center; margin-top:15px; color:#f00; margin-bottom:10px;text-decoration: blink;"> <h1> please enable javascript<br style="margin-bottom: 5px;"/> <h3>else system not work correctly.</h3> </h1> </div> <div align="center"> <div class="title" style="font:bold 18px arial">enabling javascript</div> for: <strong>firefox</strong> go to:<strong>options > content</strong><br/> , check enable javascript. <br/>or<br/> refer link

java - Creating test data: domain builder -

i want create test data tests underlying in-memory database. common approach create test_data.sql file , create test objects inserts. , reference these objects in java test. i read in growing object-oriented software, guided tests , tests don't need go deep in details. example, if test wants existing user new status, don't need create user , fill it's fields. should tell, wants user new status , other fields should filled default values. so want helper methods, one: user user = user(userstatus.new); // inserts user in database // ... use persistent user instance in test but database schema has tables , came following code: domain domain = new domainbuilder().user(userstatus.new).agreement().account().account().build(); doman class: public class domain { private user user; private agreement agreement; private account account; // getters/setters } this code creates user, agreement(with fk user), 2 accounts(with fk agreement) , returns doma

Detecting Currently running App. Android -

i using following code detect running app . when running new app. not getting it's package name, toasting "com.hedy.launcher". whats wrong code ? @override public int onstartcommand(intent intent,int flags, int startid) { // todo auto-generated method stub super.onstartcommand(intent, flags,startid); toast.maketext(this, "service running", toast.length_short).show(); handler = new handler(){ @override public void handlemessage(message msg) { // todo auto-generated method stub super.handlemessage(msg); // count=count+1; // toast.maketext(myservice.this, ""+count, toast.length_short).show(); activitymanager = (activitymanager) getapplicationcontext().getsystemservice(activity.activity_service);

saving a html5 canvas image in higher resolution -

i creating site allow user create scene using html5 , canvas element. i going use kinecticjs this, , looks great. have 1 issue struggling with. since want able give user higher quality version of scene printing, cannot give them 800x600 pixel canvas data because gets blurry when print. i have seen forums suggest "scaling up" canvas , saving output worry performance costs of this. although might hope. since kinecticjs uses graph hierarchy render scene, thought might possible create scene using kinecticjs, re-render (rather scale) same scene, time scale positions etc... of objects in scene. has every done before? still in research phase far. one note, know svg, need larger browser support , ie uses vml prior ie9, , doubt can convert svg/vml scene png , maintain browser support. you can scale canvas single "capture frame." you have draw function or render function. give argument , if argument true, draw bigger context. var canvas, context

java - How to find absolute path from a relative path in file system -

a java class readfile1 in testa project. , class testread in project testb. want read class readfile1 in testread class. have relative path, how can read that. example my class present in d:\eix-new-source\source\message-kernel\src\main\java\com\eix\transform\parser\messagetransformer.java message-kernel project in source folder. and doing test in d:\eix-new-source\source\msg-test\src\com\corejava\rnd\relativepath.java when run program got result d:\eix-new-source\source\message-kernel\target\classes but expecting result should d:\eix-new-source\source\message-kernel\src\main\java\com\eix\transform\parser\messagetransformer.java try below method getting absolute path of class file , can append remaining path relative file path actual absolute path of file. string getabsolutepath(){ java.security.protectiondomain pd = yourclassname.class.getprotectiondomain(); if ( pd == null ) return null; java.security.codesource cs = pd.getcodesource(); if ( cs == null )

ruby on rails - VCR ignored parameter: Get real http request -

i'm recording http requests vcr test suite. have ignore parameter called callback because parameter random, , don't want vcr record new request when parameter changes (because parameter changes, not request itself). but problem is, need modify response body vcr serving app, based on original value of callback client generated @ runtime. here vcr configuration: vcr.configure |c| c.cassette_library_dir = 'spec/vcr_cassettes' c.hook_into :webmock c.allow_http_connections_when_no_cassette = false c.ignore_localhost = true c.before_http_request(:stubbed?) |request| # request.uri original request made client puts request.uri end c.before_playback |interaction, cassette| # request uri got value cassette interaction.request.uri # , here want modify interaction.response.body # based on callback parameter original request client interaction.response.body = "...." end # add callback , no caching _ parameter ign

MediaPlayer.seekTo() not seeking to position on Android -

i'm working on app in video paused @ 3 different intervals. after second pause, if button clicked, should start previous location. eg. if paused @ 1:30, on click of button, goes previous bookmark, i.e. 00:45. i thought using mediaplayer.seekto() me achieve this. but, seekto() doesn't seek position @ all. currentposition stays same after call seekto(); here's code. mediaplayer.setonseekcompletelistener(new onseekcompletelistener() { @override public void onseekcomplete(mediaplayer mp) { log.d("vid_player","seek complete. current position: " + mp.getcurrentposition()); mp.start(); } }); and somewhere below, have this... mediaplayer.seekto(45000); what problem? why isn't seekto(); working? appreciated. i testing on android v4.0.3 (ics) one of reasons why android not able seekto because of strange encoding of videos. example in mp4 format called "seek points" (i.e. search index) can spec

repository pattern - IRepository - Entity implementation -

i'm using repository , unitofwork pattern in order mantain decoupled code , achieve simple way test application. the inner implementation use entityframerowk db first , works fine. tomorrow, might want use other concrete repository implementation such file system rather database, repository method find, or delete difficult accomplish, because entities doesn't implement primary-foreing keys , on. implies entity research on repository should looks fields matching t object parameter. so, practice enforce entities interface implementation? instance: is there available example or tutorial this? some repository method find, or delete difficult accomplish, because entities doesn't implement primary-foreing keys , on. implies entity research on repository should looks fields matching t object parameter. that's how not implement repository. repository interface (contract) should ignorant of underlying implementation details such entity framework. way c

c# - Compatible with both dotnet 3.5 and dotnet 4.0 -

originally set use .net3.5 compatibility win7. (actually using wpf) however when comes users in win8 supports only .net4.0, required users download , install .net3.5, results in terrible user experience. here comes question: how make software compatible multiple .net versions? actually tried use .net 2.0 software , goes both win7 , win8. when comes .net 3.5, backward compatibility seems awful. need features available in 3.5, or wpf. i don't mind if have build multiple binary releases, provided auto-selection mechanism available. p.s. i've found similar question @ make same app compatible net3.5 & 4.0@stackoverflow got no after reading it. edit i'm using both winform , wpf. i'm using wpf better looking ui, however, nutoriously know, webbrowser in wpf cannot render in wpf app. use winform webbrowser. if you're making normal wpf desktop application, move target framework .net 4 , done it. .net 4 supported on windows 7 windows 8.

microcontroller - Which model of arduino to use for a solenoid based output project? -

i software developer no prior experience in embedded programming & electronics. have build project requires microcontrollers inclusion. the task kind of(example) need generate morse code pulses output through solenoid in form of vibrations. use c/c++ coding language. made search & found arduino more suitable task exposure field. i grateful if guys please comment on suitablility of task. & refer model of arduino should use. thinking use 8-bit variant of arduinio. as not have requirements - buy cheapest 1 integrated programmer. maybe 1 of those? http://arduino.cc/en/main/arduinoboardnano http://arduino.cc/en/main/arduinoboardmicro

android - How to check if the word is already available in user dictionary? -

i need simple , elegant way (having word) check whether given word available in user dictionary or not. word frequency doesn't matter, locale does. is there simpler querying contentresolver iterating , checking cursor.getstring(index_word).equals(myword) ? you should create query, search word in userdictionary : getcontentresolver().query(userdictionary.words.content_uri, new string[]{userdictionary.words._id, userdictionary.words.word}, //selection userdictionary.words.word +" = ?", //selection args new string[]{myword}, null); than can check cursor : if(cursor.getcount()==0){ //word not in dictionary }

c# - Launch ExceptionValidationRule from specific context -

i have class client : public class client : inotifypropertychanged { private string m_strcode; public string strcode { { return m_strcode; } set { if (codeisvalide(strcode)) { m_strcode = value; firepropertychangedevent("strcode"); } else { throw new applicationexception("bad data !"); } firepropertychangedevent("strcode"); } } private string m_strname; public string strname { { return m_strname; } set { if (nameisvalide(strname)) { m_strname = value; firepropertychangedevent("strname"); } else { throw new applicationexception("bad data! "); } firepropertychanged