Posts

Showing posts from April, 2013

sql - mysql query to three tables, want to use JOIN instead subquery -

i want use join instead subquery find trade id not exist on trade_log filtered ip , current date mysql syntax below. select plug.id a, plug.url b, trade.id c plug, trade trade.id = plug.trade_id , trade.id not in (select trade_log.trade_id trade_log trade_log.ip = '".$ip."' , trade_log.log_date = curdate()) , trade.status = 1 , plug.status = 1 order plug.weight desc limit 1 please me... use: select p.id a, p.url b, t.id c plug p join trade t on t.id = p.trade_id , t.status = 1 left join trade_log tl on tl.trade_id = t.id , tl.ip = mysql_real_escape_string($ip) , tl.log_date = curdate() p.status = 1 , tl.ip null order p.weight desc limit 1

Google App Engine (Python)- Strange behaviour of REMOTE_ADDR -

in order make registration process on website easy, allow users enter email address send verification code or alternatively can solve captcha. the problem in order prevent robots registering accounts (with fake emails) limit number of registrations allowed per ip address , if limit exceeded trigger warning in logs. however ... seems happening using os.environ['remote_addr'] check remote address -- seems triggering warnings on addresses owned google (66.249.65.xxx). possible happening after change version (but not confirmed). know how/why might happening? shouldn't remote_addr return address of client computer (and in cases this)? i curious if there behind scenes re-directions going on, , if normal event or if happens when new version installed (perhaps when new version installed original server proxies user new server, therefore creating illusion ip address internal ip?) i believe have figured out reason seeing many warnings google server ip addresses. se...

increment - increase number when I press arrow key on keyboard with javascript -

i have textbox has numeric value. want keep increasing numeric value while im pressing , holding of arrow keys. know how if pressing 1 time. increased 1 only. if want keep increasing value while i'm holding arrow keys. how that? thanks there's small jquery plugin doing this: https://github.com/nakupanda/number-updown usages: $('#simplest').updown(); $('#step').updown({ step: 10, shiftstep: 100 }); $('#minmax').updown({ min: -10, max: 10 }); $('#minmaxcircle').updown({ min: -10, max: 10, circle: true }); view live demo here: http://jsfiddle.net/xctah/embedded/result/ keyboard , mousewheel events supporte

python - Updating a graphs coordinates in matplotlib -

i have below code plot sphere, it's proportions defined prop , i'd when button pressed prop 's value changes 5 , graph adjusted accordingly. how go this? i know tkinter has .configure() , allows 1 adjust widget settings. i'm looking similar can reconfigure plot. #!/usr/bin/env python import matplotlib matplotlib.use('tkagg') mpl_toolkits.mplot3d import axes3d,axes3d import matplotlib.pyplot plt matplotlib import cm import numpy np numpy import arange, sin, pi matplotlib.backends.backend_tkagg import figurecanvastkagg, navigationtoolbar2tkagg matplotlib.figure import figure matplotlib.ticker import linearlocator, fixedlocator, formatstrformatter import tkinter import sys class e(tkinter.tk): def __init__(self,parent): tkinter.tk.__init__(self,parent) self.parent = parent self.protocol("wm_delete_window", self.dest) self.main() def main(self): self.fig = plt.figure() self.fig = plt.f...

Entity Framework Code First Doesn't Generate Database -

i created db context class , added connection string in web.config file instructed in scott guthrie's code first development entity framework 4 . running test method. received several database errors running tests, when cleaned classes test succeeded, still had no database in app_data folder. i added database.createifnotexists() dbcontext constructor, still no sdf file. know doing wrong? for database automatically created, connection string name has named dbcontext subclass name (with namespace). eg. db class this: namespace mynamespace { public class foodb : dbcontext { public dbset<xxx> abc{ get; set; } } } your connection string should so: <connectionstrings> <add name="mynamespace.foodb" connectionstring="data source=|datadirectory|mynamespace.foodb.sdf" providername="system.data.sqlserverce.4.0"/> </connectionstrings>

accessing a backgrounded applications stdin/stdout with php -

i want php execute unix application in background, , have access stdin/stdout similar how subprocess can in python ...is possible? if how? you can exectute external program http://php.net/manual/en/function.exec.php you can execture apart of php's cli interface 3 "streams" can interact in more or less same way file resource returned fopen(). streams identified strings: php://stdin (read) php://stdout (write) php://stderr (write) with php 4.3.0+ cli binary, these 3 streams automatically available, identified constants stdin, stdout , stderr respectively. here's how can use stdout fix above script behaves correctly on windows: <?php $i = 0; while ( $i < 10 ) { // write output fwrite(stdout, $i."\n"); sleep(1); $i++; } ?> http://articles.sitepoint.com/article/php-command-line-1 pk

temporary files vs malloc (in C) -

i have program generates variable amount of data has store use later. when should choose use mallod+realloc , when should choose use temporary files? use temporary files if size of data larger virtual address space size of target system (2-3 gb on 32-bit hosts) or if it's @ least big enough put serious resource strain on system. otherwise use malloc . if go route of temporary files, use tmpfile function create them, since on systems never have names in filesystem , have no chance of getting left around if program terminates abnormally. people not temp file cruft microsoft office products tend leave on place. ;-)

visual c++ - why does directx 9 lack of resources? c++ -

directx 9 library have found doesn't have free tutorials or resources. why that? you have pretty extensive tutorial microsoft @ msdn. check out here or can go direct x development center

java - JTable: how to add data without displaying? -

i have column images. attach additional text information read not display. how can achieve ? looking "ghost" column. looking way store persistent data stores temporarily on client java application, , later uploads server. create tablemodel 2 columns of data create jtable using tablemodel get tablecolumnmodel jtable remove tablecolumn (from tablecolumnmodel) don't want displayed in table. not delete data in model, won't paint column in view of table. now when want reference data in hidden column need data tablemodel, not jtable: object celldata = table.getmodel().getvalueat(...);

C++ new operator inheritance and inline data structures -

i have (c++) system has many classes have variable storage (memory) requirements. in of these cases, size of required storage known @ creation of object, , fixed lifetime of object. i use this, instance, create "string" object has count field, followed directly actual characters, inline object. class string { public: size_t count; string(size_t count, const char* text) : count(count) {/*...*/} inline char& at(size_t index) { return *(reinterpret_cast<char*>(this + 1) + index); } void* operator new (size_t size, size_t count) { return new char[size + count * sizeof(char)]; } }; class node { public: size_t count; node(size_t count, ...) : count(count) {/*...*/} inline node*& at(size_t index) { return *(reinterpret_cast<node**>(this + 1) + index); } void* operator new (size_t size, size_t count) { return new char[size + count * sizeof(node*)]; } }; // ... , several more...

jQuery UI datepicker (with time addon) issues -

i'm trying implement jquery ui date picker time picker addon (http://trentrichardson.com/examples/timepicker/) for reason, i'm getting nan instead of numbers , little slider isn't showing up. downloaded redmound theme ui, might have it? i've copied code demo website. any ideas? here's site i'm trying working on: http://citysouthphysio.website.2010.360southclients.com/book-appointment.html the code is: jquery('#date').datetimepicker({ duration: '', dateformat: 'dd-mm-yy', ampm: true, hourmin: 8, hourmax: 16 }); and jquery timepicker js is: /* * jquery timepicker addon * by: trent richardson [http://trentrichardson.com] * version 0.6.2 * last modified: 9/26/2010 * * copyright 2010 trent richardson * dual licensed under mit , gpl licenses. * http://trentrichardson.com/impromptu/gpl-license.txt * http://trentrichardson.com/impromptu/mit-license.txt * * heres css: * .ui-timepicker-div dl{ text-align: l...

ios - loading Tabbar controller from view controller -

i working project in have have login page , after successful login should have tabbar view (i using tab bar controller) when try load tab bar controller using following code.nothing works out. loginsuccess *viewcontroller = [[loginsuccess alloc] initwithnibname:@"loginsuccess" bundle:nil]; [self.view addsubview:viewcontroller.tabbarcontroller.view]; [viewcontroller release]; please me. i same work me call appdelegate after success of login response [mappdelegate loadtabbar]; //call function in delegate file load tabbar view whom code follow #pragma mark - #pragma mark load tabbar -(void)loadtabbar { self.tabbarcontroller = [[uitabbarcontroller alloc] init]; tabbarcontroller.delegate = self; myalarmvc *myalarmvc = [[myalarmvc alloc] initwithnibname:@"myalarmvc" bundle:nil]; uinavigationcontroller *myalarmnvc = [[uinavigationcontroller alloc] initwithrootviewcontroller:myalarmvc]; myalarmnvc.navigationbar.tintco...

forms - How to validate a field from a BeanItem in Vaadin? -

i'm trying first hello world vaadin right , i'm stuck first simple validated form . i'm using beanitem itemdatasource form, , don't know how add validator bean property. my problem how can actual field property in bean? need call addvalidator() on field, can on form . helloworldform package vaadinapp.hello; import com.vaadin.data.util.beanitem; import com.vaadin.ui.alignment; import com.vaadin.ui.button; import com.vaadin.ui.form; import com.vaadin.ui.horizontallayout; import com.vaadin.ui.label; import com.vaadin.ui.verticallayout; public class helloworldform extends form { helloworldbean data = new helloworldbean(); public helloworldform() { setcaption("hello world"); setdescription("this simple form lets enter name , displays greeting."); setitemdatasource(new beanitem(data)); setfooter(new verticallayout()); getfooter().addcomponent( new label("this footer...

ios - clicking UIButton? -

is possible click uibutton , call action through programming without clicking? you can call method associated uibutton action follow : - (ibaction)mymethod:(id)sender { // code here } when want fire action : [self mymethod:nil];

python - Downloading a webpage using urllib2 results in garbled junk? (only sometimes) -

how come hit webpage, html text: http://itunes.apple.com/us/app/mobile/id381057839 but when hit webpage, garbled junk? http://itunes.apple.com/us/app/mobile/id375562663 i use same download() function in python, here: def download(source_url): try: socket.setdefaulttimeout(10) agent = "mozilla/5.0 (windows; u; windows nt 6.1; en-us; rv:1.9.2.10) gecko/20100914 alexatoolbar/alxf-1.54 firefox/3.6.10 gtb7.1" ree = urllib2.request(source_url) ree.add_header('user-agent',agent) ree.add_header("accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") ree.add_header("accept-language","en-us,en;q=0.5") ree.add_header("accept-charset","iso-8859-1,utf-8;q=0.7,*;q=0.7") ree.add_header("accept-encoding","gzip,deflate") ree.add_header("host","itunes.apple.com") resp = ...

What is purpose of using System.img in Android? -

what meant system.img in android? purpose of using it? can me regarding issue? thanks in advace. it's android file system, means support files android needs, applications, framework, dalvik vm, initialization scripts , on. another part of file system userdata.img empty when compile framework. it not os, either plain zimage or boot.img (and recovery.img boot in recovery mode).

Problem using hibernate with Netbeans -

i using hibernate netbeans. it's first time. i'm following tutorial: http://netbeans.org/kb/docs/web/hibernate-webapp.html#01 all well, except when come part "creating hibernate mapping files , pojos ". problem no classes being generated. hibernate.reveng.xml seems short since contains this: <?xml version="1.0" encoding="utf-8"?> <!doctype hibernate-reverse-engineering public "-//hibernate/hibernate reverse engineering dtd 3.0//en" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd"> <hibernate-reverse-engineering> <schema-selection match-catalog="sakila"/> <table-filter match-name="category"/> <table-filter match-name="film_category"/> <table-filter match-name="actor"/> <table-filter match-name="film_actor"/> <table-filter match-name="film"/> <table-filter match-name=...

xsd - Is there a shorter way to define a anything element? -

i want define tag in schema anything. should able contain combination of tags , text. far i've found <xs:complextype name="customtype" mixed="true"> <xs:sequence> <xs:any processcontents="lax" minoccurs="0" maxoccurs="unbounded"/> </xs:sequence> <xs:anyattribute processcontents="lax"/> </xs:complextype> i'm wondering if there shorter way. <xs:element name="custom" type="anything"/> thanks time. yes. in fact can write <xsd:element name="xyz"/> check here info: http://www.w3.org/tr/xmlschema-0/#anytype

jquery - 4-States button (with .toggle()) and delayed Ajax in each state -

i've got 4-states button. know how delay execution of ajax request in order have 1 request @ end... i mean, if press button twice, don't want execute first ajax request, second 1 after specific timeout. $('.btn_mark_erreur').toggle( function (){ //state 1 var id_erreur = $(this).parent().attr('erreur_num'); $(this).attr('title','erreur réglée'); $(this).children('img').attr('src','img/erreur_ok.png'); settimeout(function(){ $.ajax({ type: 'post', url: "", datatype: ($.browser.msie) ? "text" : "xml", data: "a=maj_statut&data="+donnees , succes : function(data) { console.log(data);} }); },1000); }, function (){ //state 2 ...

sql server - String concatenation issue in CTE SQL -

i have following cte sql with tasks ( select taskid, parenttaskid, cast(sortkey nchar) sort_key /*,cast(sortkey char) sort_key */ oatasks s (taskid = 1) union select s2.taskid, s2.parenttaskid ,cast( '0.'+ cast(tasks_2.sort_key nchar) + '0.' + cast(s2.sortkey nchar) nchar) sort_key /*,cast(tasks_2.sort_key +'.'+ cast(s2.sortkey char) char)*/ oatasks s2 inner join tasks tasks_2 on tasks_2.taskid = s2.parenttaskid ) select tasks_1.taskid, oatasks.task, oatasks.parenttaskid , oatasks.sortkey,tasks_1.sort_key tasks tasks_1 inner join oatasks on tasks_1.taskid = oatasks.taskid in sort_key column not getting desired format should 01, 01.01, 01.01.01 etc. i'm getting 1, 0.1, 0.1.1 . suggestion? try right select right('00',1,2) gives 01

jquery - ASP.NET MVC 2. Javascript Error when deployed to IIS7 -

been working on asp.net mvc 2 solution time , today decided test in in iis7 put in on company server colleagues play with. however got quite surprise when hosted it. started javascript errors in code worked while running locally in vs2010. i getting errors on initial jquery command in script tag, looks this <script language="javascript" type="text/javascript"> $(document).ready(function () { setcss(); }); so searching around , found post : my url "http://localhost/mvcajaxjson" have changed "http://localhost/mvcajaxjson/" , started working looks “/” @ end required call function. – prasanth mar 23 @ 11:43 so tried add forward slash page read http://localhost:8008/apq/secretary/create/ that solved javascript errors, fine , all. but since use normal routing e.g routes.maproute( "default", // route name "{controller}/{action}/{id}", // url parameters ...

c# - Right way to close WPF GUI application: GetCurrentProcess().Kill(), Environment.Exit(0) or this.Shutdown() -

my gui desktop-based wpf 4.0 (c# .net 4.0) program works sql server database. each time when run application creates connection sql server via ado.net entity framework , if sql server not reachable throws exception , shows messagebox notification. now want after user read message application shut down. found 3 ways this: process.getcurrentprocess().kill(); or this.shutdown(); // application.current.shutdown() or system.environment.exit(0); all of them work fine , need — close application , kill application's process in windows task manager. i want know: what difference between them? which way close application faster? which way close application should use? is application.current.shutdown() , this.shutdown() same way close application? or maybe there another, more suitable, way close wpf gui application? application.exit() doesn't work me error: the event ' system.windows.application.exit ' can appear on left-hand side of += or -= ...

asp.net - Applying like filter to an IQueryable -

i'm trying write custom filter dynamic data allow me run type queries on entity columns. example searching john on name field returen johnson, johns etc. i'm trying override iqueryable getqueryable(iqueryable source) method on queryablefilterusercontrol class. filter results. know best way of achieving this? if , iqueryable<t> easy return results of .where() clause. there applyequalityfilter(iqueryable source, string column.name, object value) method on queryablefilterusercontrol class performs direct comparison. any appreciated. have @ sample here five cool filters dynamic data 4 also not in both linq sql , entity framework contains mapped '%term%' in sql.

objective c - Expected identifier or '(' before '.' token -

i'm new objective-c i'm using book grips it. i'm @ bit it's explaining structs , can't life of me them work. i have following code: int main (int argc, char *argv[]) { struct node { int nodeid; int x; int y; bool isactive; }; typedef struct node mynode; mynode.nodeid = 1; } and i'm getting error written in title. every time search error online found different variations such 'before '>' token' or 'before '}' token' can't find '.' token , it's frustrating , assume it's somethings ridiculously trivial , basic. appreciated. i believe you're trying modify actual type itself. nodea type of struct, int . need nodea mynode , able perform mynode.nodeid = 1 without error.

pointers - What non-NULL memory addresses are free to be used as error values in C? -

i need write own memory allocation functions gmp library, since default functions call abort() , leave no way can think of restore program flow after occurs (i have calls mpz_init on place, , how handle failure changes based upon happened around call). however, documentation requires value function returns not null. is there @ least 1 range of addresses can guaranteed invalid? useful know them all, use different addresses different error codes, or possibly different ranges different families of errors. no, there isn't portable range of invalid pointer values. you use platform-specific definitions, or use addresses of global objects: const void *const error_out_of_bounds = &error_out_of_bounds; const void *const error_no_sprockets = &error_no_sprockets; [edit: sorry, missed hoping return these values library. bdonlan says, can't that. if find "invalid" values, library won't expecting them. requirement function must return valid value, o...

multithreading - Delphi Access to Thread Variables -

i have thread wmi query me , need access variables in thread after has executed query. the thread created follows ... procedure tformmain.runthread; var wmiq: tthreadwmiquery; begin wmiq := tthreadwmiquery.create(true); ... wmiq.onterminate := wmiqthreadonterminate; wmiq.resume; end; and in onterminate event values need ... procedure tformmain.wmiqthreadonterminate(sender: tobject); begin opcd := tthreadwmiquery(sender).p4copcd; role := tthreadwmiquery(sender).p4crole; usnm := tthreadwmiquery(sender).p4cusnm; end; i've been told may not best way access thread variables. there other, better, ways can data thread without complexity? regards, pieter who told that? did give reasons? onterminate there query thread instance after has finished executing , before destroyed. in fact, when set tthread's freeonterminate true, have no other place access thread's variables. other mechanisms: global variable set thread, queried elsewhere : ...

is spring.net being actively maintained/developed/documented? -

in course of evaluating .net ioc frameworks, gave spring.net try first, seeing how liked spring in java. however, i'm rapidly getting feeling stale/stalled/dead project. forums have no activity; documentation, though verbose, infuriating self-referencing, poor examples, , incomplete sections; spring.net questions don't seem traction on stackoverflow; , googling spring.net issues leads pages documenting obscure scenarios. i'm close making jump ninja or castle, can see documentation doesn't sparkle either. still, if has poor documentation, i'd rather pick active project. suggestions? spring.net pretty active. take bug tracking system : https://jira.springsource.org/browse/sprnet they have 2 full-time committers working on it.

Unary Operator-() on zero values - c++ -

i wrote code overload unary operator- on matrix class: const regmatrix regmatrix::operator-()const{ regmatrix result(numrow,numcol); int i,j; for(i=0;i<numrow;++i) for(j=0;j<numcol;++j){ result.setelement(i,j,(-_matrix[i][j])); } return result; } when ran program debugger in visual studio, showed me when operation done on double equals zero, inserts result matrix number -0.00000. weird vs-display feature, or should handle carefully? signed 0 zero associated sign. in ordinary arithmetic, −0 = +0 = 0. however, in computing, number representations allow existence of 2 zeros, denoted −0 (negative zero) , +0 (positive zero). occurs in signed number representations integers, , in floating point number representations. number 0 encoded +0, can represented either +0 or −0. the ieee 754 standard floating point arithmetic (presently used computers , programming languages support floating po...

ajax - IE7 vs. A Python Pickle Object -

i have issue ie7 not wanting pass pickled object through ajax call using htmltmpl. works in ie8 (and in compatibility mode) in firefox. i have pickled object using command: newhash['pickled'] = pickle.dumps(hash) because js didn't newlines, regex them out using: newhash['pickled'] = re.sub('\n', 'linebreak', newhash['pickled']) when catch pickled object in python, takes out linebreak , puts in \n. ajax call looks this: $.getjson('/folder/mypython.py', {'mode':'myfunction', 'pickled':"<tmpl_var pickled escape="none">"}, function(data){ i alert right before , right after , works expected. if alert in function(data) section, nothing gets alerted. however, if take out 'pickled' key in ajax call, works fine. pickled object variables needed python calculations, not passing not option. my pickled object looks this: (dp0linebreaks'rlbool'linebreakp1li...

php - split & showing value in javascript -

i have 1 variable in javascript named itemid i.e. var itemid=document.getelementbyid('item_code').value; in item_code there value in format "1025*1" , want display 1025 not whole in javascript div plz give me idea, same explode() in php want in javascript display in div you're looking split method . for example: var array = value.split('*'); var first = array[0]; alternatively, var first = value.substring(0, value.indexof('*'));

iphone - Capture camera view and onverlay in an image -

i open camera view , place image overlay. want save both overlay , camera view's image 1 image. achieved using uigetscreenimage(). apple forbid options ? takepicture capture camera data the overlay. merging overlay image takepicture bit slow. you have merge them, , shouldn't take more second or two. like(untested, should give idea): uigraphicsbeginimagecontext(mycapturedimage.size); [mycapturedimage drawatpoint:cgpointzero]; //you might need use drawinrect [overlayimage drawatpoint:cgpointzero]; uiimage *combinedimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext();

linq to entities - How to convert anynoymous type? -

i try convert anonymous type class don't. my code in viewmodel : <public list**<???>** poolcondition { get; set; } entities db = new entities(); public selectlistviewmodel() { string lang = sessionmanager.language; var poolcondition = (from ddlv in db.dropdownlistvalue ddlv_t in ddlv.dropdownlistvalue_translation ddlv_t.language.code == lang select new { ddlv.id, ddlv_t.traduction }).tolist(); poolcondition = poolcondition; i've error width poolcondition=poolcondition, because poolcondition anonymous type. how cast list poolcondition?? thank you! rather creating list of anonymous types, why not create list of objects? perhaps like: var poolcondition = (from ddlv in db.dropdownlistvalue ddlv_t in ddlv.dropdownlistvalue_transla...

c# - Abstract methods and the Open-Closed principle -

suppose have following contrived code: abstract class root { public abstract void printhierarchy(); } class level1 : root { override public void printhierarchy() { console.writeline("level1 child of root"); } } class level2 : level1 { override public void printhierarchy() { console.writeline("level2 child of level1"); base.printhierarchy(); } } if looking @ level2 class, can see level2.printhierarchy follows the open/closed principle because on own , calls base method overriding. however, if @ level1 class, appears in violation of ocp because not call base.printhierarchy -- in fact, in c#, compiler forbids error "cannot call abstract base member". the way make level1 appear follow ocp change root.printhierarchy empty virtual method, can no longer rely on compiler enforce deriving classes implement printhierarchy . the real issue i'm having while maintaining code here seeing dozens of override methods no...

How can I produce a satellite image using a set of coordinates in Google Maps' javascript API? -

i'd populate infowindow of annotation image of location pin on dynamically, producing aerial photo , stuffing infowindow. this have now, means have have image each site ready go in advance, lot of provisioning work several hundred different buildings. google.maps.event.addlistener(marker, "click", function(latlng) { var myhtml = "<b>" + location.name + "</b><br /><img src=../web/content/image/sites/"+ location.image + "><br/><br/><br/>"; map.openinfowindowhtml(latlng, myhtml); }); instead, i'd use aerial photo google has on file x/y coordinates. ideas? you're looking google static maps api .

xslt key and match -

i pretty new xslt, sorry confusion caused , may waste time... trying is: have 2 queries, first query (orders/order) <query name="orders" rowelementname="order"> select ordernumber, subtotal, total tablex </query> return like: ordernumber subtotal total 123 20 23.5 234 19 26.5 another query (orderitems/lineitem) <query name="orderitems" rowelementname="lineitem"> select ordernumber, cartitemid, productname, sku tabley </query> return like: ordernumber cartitemid productname sku 123 3 test1 s9sdidk 123 4 test2 s9sdidl 234 5 test3 s9sdidu 234 6 test4 s9sdidh and output (seperate 2 orders): product sku test1 ...

wpf - Two-way-like binding between a Resource's property and a runtime object property -

my problem following : i have defined textbox child of toolbar in resourcedictionary (x:key mytoolbar). when application loads, places toolbar correctly inside window frame, along textbox. far, good. of course, i'd textbox two-way databound objects' properties not defined in resourcedictionary. more precisely, when textbox set in correct window frame, , then, after “open” command file loaded, deserializer builds designercanvas object using values out of file, in case string “token” clr property of class implements inotifypropertychanged. here simplified code snippets. leave many blanks clarity’s sake: class designercanvas : inotifypropertychanged { private string m_token; public string token { get{…. set{ if (value…) onpropertychanged(“token”); } //notice there no constructor other default 1 } and on xaml side have this: <toolbar x:key=”mytoolbar….. <textbox … now, 2 goals are: have “static” textbox resource...

Django Celery Database for Models on Producer and Worker -

i want develop application uses django fronted , celery background stuff. now, celery workers on different machines need database access django frontend machine (two different servers). need know realtime stuff , run django-app python manage.py celeryd they need access database models available. do have access mysql database through direct connection? have allow user "my-django-app" access not localhost on frontend machine other worker server ips? is "right" way, or i'm missing something? thought isn't safe (without ssl), maybe that's way has be. thanks responses! they need access database. access through database backend, can 1 ships django or one third party . one thing i've done in django site's settings.py load database access info file in /etc . way access setup (database host, port, username, password) can different each machine, , sensitive info password isn't in project's repository. might want rest...

Button color should not change when I release the button in Android -

<item android:state_focused="true" > <shape> <gradient android:endcolor="#ff9900" android:startcolor="#ff9966" android:angle="270" /> <stroke android:width="3dp" android:color="#cccccc" /> <corners android:radius="3dp" /> <padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /> </shape> </item> <item> <shape> <gradient android:endcolor="#ffffff" android:startcolor="#ffffff" android:angle="270" /> <strok...

Zend Framework route chaining in application.ini -

i setting language depending on domain name (en en.example.com, tr tr.example.com): resources.router.routes.plain.type = "zend_controller_router_route" resources.router.routes.plain.route = "/:module/:controller/:action" resources.router.routes.plain.defaults.language= "en" resources.router.routes.plain.defaults.module = "content" resources.router.routes.plain.defaults.controller = "index" resources.router.routes.plain.defaults.action = "index" resources.router.routes.plain1.type = "zend_controller_router_route" resources.router.routes.plain1.abstract = 1 resources.router.routes.plain1.route = "/:module/:controller/:action/*" resources.router.routes.plain.defaults.module = "content" resources.router.routes.plain.defaults.controller = "index" resources.router.routes.plain.defaults.action = "index" resources.router.routes.dom0.type = "zend_controller_router_route_hos...

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

public player(string name, list<card> cards) { this.name = name; try { this.stack.insertcards(cards);//here nullreferenceexeption } catch (exception e) { throw e; } } public void insertcards(list<card> cards) { stack.addrange(cards); } public list<card> getsevencards() //the player gets cards function { list<card> list = new list<card>(); int ran; random r = new random(); (int = 0; < 7; i++) { ran = r.next(0, stack.count()-1); list.add(stack[ran]); stack.removeat(ran); } return list; } the stack gets cardlist of 7 cards should be: this.stack.insertcards(getsevencards()); and create new instance of stack. because cards null. fill them function first. can't more things, because didn't give more information definitions. there should more codes.

directshow - Behavior of DirectSound audio renderer with the reference clock -

i'm working on source filter feeds video/audio captured our software through directshow graph. got video working relatively painlessly, trying add audio output pin proving quite challenge. specific question have is: audio renderer modify actual reference clock playing sound? i'm seeing jerky video playback. attached below chunk of log file, , looks once in while reference clock "stops" while system time keeps ticking. make sense? one thing should mention audio samples u-law 8 khz 8-bit , each packet 120 ms. here's complication: when receive audio data network, doesn't come time information, our software assigns sample timestamp @ time packet received. video samples stamped original source, accurate. if ignore audio sample times , assign sample timestamps 120 ms apart, video play smoothly. problem i'm still not understanding complete relationship between reference clock , audio/video renderers , puzzles me have similar source filter plays same data...

ios - iPhone NSMutableArray and NSKeyedUnarchiver unarchiveObjectWithFile release oddity -

i archive array (nsmutablearray) of custom objects implement . once load froma file retaining property @property (nonatomic, retain) nsmutablearray *buddies; release count of object 2 (correct, it's 1of autorelease + 1 of retain of property) noone releases , retain count becames 1, when release -[__nsarraym retaincount]: message sent deallocated instance (i think because 1 retain count autorelease) here's full code: buddielistviewcontroller.h #import <uikit/uikit.h> #import "buddie.h" @interface buddielistviewcontroller : uitableviewcontroller { iboutlet nsmutablearray *buddies; [...] } [...] @property (nonatomic, retain) nsmutablearray *buddies; [...] @end buddielistviewcontroller.m #import "buddielistviewcontroller.h" #import "buddie.h" #import "previewviewcontroller.h" @implementation buddielistviewcontroller @synthesize buddies; [...] - (id)initwithstyle:(uitableviewstyle)style { self = [super initw...