Posts

Showing posts from July, 2014

regex - Information Sources on Token Parsing Patterns -

to make long story short, looks if going responsible rewriting text parsing engine work. so, imagine: block of text comes in, there custom tags in text, simple one-off replaces, blocks content, nesting, etc. tags have argument/value pairs, etc. while have been coding years, , i'm mid-level regex user; first admit hardcore text parsing not forte. , needs fast, optimization concern. i looking information sources on patterns , commentary kind of parsing. i'm willing read on of offer. need educate myself before begin contemplating how tackle this. thanks much, in advance. if gets little more complex can simple state machine 1 person can understand suggest using tool generate tokenizers: flex / jflex / etc . you can create hand crafted top down parser if speed big concern or can use parser generator ( antlr example , like). hand craft parser faster has potential create nasty corner cases :). need set of test cases it. i recommend start here: parsing on wiki...

Calling dynamic jQuery plugin with dynamic parameters in Javascript -

suppose need dynamically construct plugin calls such $('#mydiv').myplugin({a:'a',b:'b'}); will like: function funccallbuilder(selector, func, opts){ //dynamically construct plugin call here } using: funccallbuilder('#mydiv', 'myplugin', {a:'a',b:'b'}); can point out correct way of doing this? not sure if understand question, if want first , third code snippet have same effect, use apply : function funccallbuilder(selector, func, opts){ func.apply($(selector), [opts]); } or, if want pass function string instead of function object (not point imho): function funccallbuilder(selector, func, opts){ $.fn[func].apply($(selector), [opts]); }

java - looking up Swing components by their id? -

is possible reference swing object via lookup method ?? keeping multitude of instance variables every single ui element seems such overkill ie kinda way done in javascript: jtextarea ta = new jtextarea(); ta.setid("myjtextarea"); .... .... .... jtextarea ta = window.getelementbyid("myjtextarea"); ta.settext("blah"); ps. i'm not writing software space shuttle columbia. quick , dirty projects, best practices dont apply. thx. private static component getcomponentbyid(container container, string componentid){ if(container.getcomponents().length > 0) { for(component c : container.getcomponents()) { if(componentid.equals(c.getname())) { return c; } if(c instanceof container) { return getcomponent((container) c, componentid); } } } ...

objective c - Compostion of -schedule:(SEL)selector in Cocos2d -

i have spritehandler object composes (has) ccsprite. composes behavior object has method -update:(cctime)dt , , method -updateselector returns @selector(update:) . in spritehandler object, want use method -schedule:(sel)selector , implemented ccsprite. call [sprite schedule:[behavior getupdateselector]] fails; can figure out how schedule if subclass ccnode. there way through composition? do want run once or every frame? mean, fails? in case [sprite schedule:@selector(behaviourmethod)] doesn't work try instead: [[ccscheduler sharedscheduler] scheduleselector:@selector(behaviourmethod) fortarget:self interval:0.1 paused:no];

php - Sending additional fields data with Uploadify -

i want send additional (form) fields data uploadify. purpose, using scriptdata. example, following code sends static values of name , location field correctly. <script type="text/javascript"> $(document).ready(function() { $("#fileupload").fileupload({ 'uploader': 'uploadify/uploader.swf', 'cancelimg': 'uploadify/cancel.png', 'script': 'uploadify/upload.php', 'folder': 'files', 'multi': false, 'displaydata': 'speed', 'scriptdata': {'name':'johndoe', 'location':'australia'} }); }); </script> however, have input fields name , location, therefore want send dynamic values. so, im sending values in scriptdata following 'scriptdata' : {'name' : $('#name').val(), 'location' : $('#location').val()} and on upload.php, i...

sql - Is it common to accompany views for each table that has a IsActive field? -

i have several tables have isactive column, indicates whether record active or deleted. these tables used frequently. is common create view each of these tables , select records isactive true? or overkill? a view stored query-- execute precisely same way whether check isactive in view or in where clause. if find using isactive rows more often, have @ filtered indexes . example, have ticketing system 99% of activity related open tickets. able improve performance adding filtered indexes active tickets only.

What are popular/good file formats used by dataloggers and data acquisition systems/software? -

what popular datalogger file formats (used in devices such gps loggers, car black boxes, etc) , data acquisition file formats? interesting formats open spec, or reverse engineered formats without patents on them. sleep diagnostic systems: edf edf+ the common universal data interchange formats xml , json, can them around web info need about. "secret" flexible enough store type of data, , @ same time use plain text file format, can open in notepad , read data own eyes. for more structured data, binary formats more indicated, edf perfect example of that, don't think there standard, universal binary file formats around, each application designs it's own, , if want, no problem. if want gps data, example, can use gpx or kml, both of them xml.

iphone - Objective-C NSMethodSignature issue! -

basically i'm using "instancemethodsignatureforselector" part of construction of nstimer. problem below nsmethodsignature set "nil". nsmethodsignature *signature = [[self class] instancemethodsignatureforselector:@selector(gravitymeth:sprite:)]; the selector it's looking @ below. -(void) gravitymeth:(ccsprite*)sprite:(b2body*)body does have because can't see problem @ all! thanks in advance! -(void) gravitymeth:(ccsprite*)sprite:(b2body*)body that selector gravitymeth:: , not gravitymeth:sprite: . try: -(void) gravitymeth:(ccsprite*)sprite body:(b2body*)body which yield selector of gravitymeth:body: (which more descriptive -- better still applygravitysprite:withbody: ).

c# - In Production Web App Giving Parse Error -

my problem company's website has been getting following parse error: server error in '/' application. parser error description: error occurred during parsing of resource required service request. please review following specific parse error details , modify source file appropriately. parser error message: not load type 'namespace.index'. source error: line 1: <%@ page language="c#" autoeventwireup="true" inherits="namespace.index" codebehind="index.aspx.cs" %> line 2: line 3: <!doctype html public "..." /> source file: /index.aspx line: 1 now website has been running fine while last code changes 2 months ago. in past 2 weeks though third time parse error has appeared. have fixed each time rebuilding project in visual studios , publishing it, in few days comes back. have no idea causing error, said there have been no code changes in past 2 months. know causing parse error appe...

java - Hibernate/hsqldb 2 Cannot Hydrate Blob Column -

i trying load entity byte data (annotated @lob) hsql 2.0 database using hibernate 3.5.6. entity able saved without problems , loaded fine if in cache (i.e. not need hydrated). however, when entity not in cache (needs hydrated), receive following exception: caused by: org.hsqldb.hsqlexception: incompatible data type in conversion: sql type blob [b, value: instance of org.hsqldb.types.blobdataid @ org.hsqldb.error.error.error(unknown source) ... 68 more here full stack trace (minus domain specific trace) more context: javax.persistence.persistenceexception: org.hibernate.exception.sqlgrammarexception: not execute query @ org.hibernate.ejb.abstractentitymanagerimpl.convert(abstractentitymanagerimpl.java:1235) @ org.hibernate.ejb.abstractentitymanagerimpl.convert(abstractentitymanagerimpl.java:1168) ... caused by: org.hibernate.exception.sqlgrammarexception: not execute query @ org.hibernate.exception.sqlstateconverter.convert(sqlstateconverter.java:92) @ org.hibernate.e...

css - Radio Buttons Inline and Centered with Labels -

i have following form: <form action="post.php" method="post"> <fieldset> <div class="ratingclass"> <input type="radio" class="radio" name="rate" value="1" id="1"/> <label for="1">1</label> <input type="radio" class="radio" name="rate" value="2" id="2"/> <label for="2">2</label> <input type="radio" class="radio" name="rate" value="3" id="3"/> <label for="3">3</label> <input type="radio" class="radio" name="rate" value="4" id="4"/> <labe...

c# - Resizing Image From Graphics? -

i'm trying resize image after copying screen, , can't figure out how it. tutorials i've been reading recommend using graphics.drawimage resize image, when run code, doesn't resize. bitmap b = new bitmap(control.width, control.height); graphics g = graphics.fromimage(b); g.copyfromscreen(control.parent.rectangletoscreen(control.bounds).x, control.parent.rectangletoscreen(control.bounds).y, 0, 0, new size(control.bounds.width, control.bounds.height), copypixeloperation.sourcecopy); g.drawimage(b, 0,0,newwidth, newheight); any appreciated, thanks! try this. graphics won't "replace" image when use drawimage - draws input image on source, same the image you're trying draw it. probably more concise way but..... bitmap b = new bitmap(control.width, control.height); using (graphics g = graphics.fromimage(b)) { g.copyfromscreen(control.parent.rectangletoscreen(control.bounds).x, control.parent.rectangletoscreen(control.bounds).y...

sql server - SqlCeReplication: using ReinitializeSubscription before each Synchronize? -

i'm working on bug in legacy windows mobile 5 app, uses sql ce replication sync sql ce database sql server 2005 or 2008 database (using merge replication). there behavior in application don't believe related bug, curious side-effects of might be. code ends calling "reinitializesubscription(true)" on sqlcereplication object before calls synchronize. "true" flag tells reinit upload changes before reinitializing, fine. don't believe there concrete reason reinit sub each time, that's does... what impact of calling reinitializesubscription on sqlcereplication object before each synchronize call? performance hit, or doing different data synchronization, compared not calling reinitializesubscription before synchronize? unless experiencing major client íssues, not reinit each time sync, download entire client database (after uploading changes), , consume time , bandwidth, , give poor user experience (unless data set small , have high ban...

c# - How do you use FIPS validated cryptographic algorithms with Visual Studio 2010 and Windows 7? -

i've enabled fips compliance mode in windows 7, code fails compile following error: source file 'whatever.cs' not opened ('this implementation not part of windows platform fips validated cryptographic algorithms.') i'm using sha1 (hashing) , tripledes (encryption) encryption. tried sha512 , aes (256 bit key). i can't project build more, need compile use fips compliant algorithms. try making blank c# app , compiling it, should fail same reason. problem visual studio, not code. follow instructions here , add ide's config file ( devenv.exe.config / vcsexpress.exe.config / vbexpress.exe.config ): <enforcefipspolicy enabled="false"/> this doesn't mean app isn't running in fips compliant mode, means visual studio isn't now. non-compliant code still compile if tries execute you'll receive system.invalidoperationexception exception. i think, don't know sure, algorithms vs uses generate hashes in libr...

iphone - Can I use the UITableView grouped background pattern for a UIView? -

i default background of grouped uitableview . i'd use on standard uiview . i'm unable find asking question or reference how accomplish it. any recommendations on how this? possible outside of creating , image , loading background? you can use groupedtableviewbackgroundcolor in interface builder or backgroundcolor = [uicolor grouptableviewbackgroundcolor];

c# - Mocking entity - Enity Framework 3.5 -

is possible mock ef 3.5 entities. if so..how? unfortunately, entity framework not suited mocking, due lack of interfaces example. here's question deals simialr issue. i think best bet use moles framework microsoft (though doesn't have nicest api work i've seen. hey, @ least it's free)

c++ - typedef resolution across namespaces -

i confused way "using (namespace)" statements work in c++. i have: //somewhere in included headers typedef unsigned int uint; namespace mine { typedef unsigned int uint; } namespace other { using namespace mine; void foobar () { uint offender = i; } } results in (paraphrased): reference 'uint' ambiguous. candidates are typedef unsigned int uint and typedef unsigned int mine::uint meanwhile, when do namespace other { using namespace mine; using mine::uint; void foobar () { uint offender = i; } } everything works fine. seems strange me "using identifier ;" changes visibility of other typedef definition (conceals global one?). can point me kind of rules in c++ govern resolution of typedefs across namespaces? a name made visible using-directive appears in nearest enclosing scope contains [- directly or indirectly -] both using-directive , nominated namespace. (7.3.4 [namespace.u...

arrays - Fast Range Detection Algorithm -

i have array of 8 elements: bin[8] . bin represents range container: receive number n , such 0 <= n <= 255 . if n < 32 ==> bin[0] += 1 else if 32 <= n < 64 ==> bin[1] += 1 ... etc. i want fast solution not require if-else directive, have multiple bins handle. i using java, solution in programming language accepted. thank you. ensure number n indeed 0 <= n <= 255, simply: bin[n/32]++; edit: poster mentioned shifting right 5 bits. work too, feel dividing 32 shows intent cleaner , modern compiler optimize division away bitshift if it's more efficient on platform you're targeting anyway.

javascript - Manufacturing variable names -

i come across situations in programming want have bunch of variables defined in loop (e.g., soldiera, soldierb, soldierc,...) , assign them objects. someclassa = ext.extend(someclassb) { initcomponent { this.weekdays = [ 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday','sunday' ]; for(var = 0; i<7; i++) { var dummy = "this.vacation" +this.weekdays[i]; dummy = 1; }; console.log("i desire following 1: " +this.vacationmonday); } } console lists undefined elements. what recommended course of action? you have use bracket notation set dynamic variable names. note have assign directly, not way have listed. this["vacation" + this.weekdays[i]] = 1;

python - Can SQLAlchemy do a non-destructive alter of the db comparing the current model with db schema? -

basically i'm looking equivalent of datamapper.auto_upgrade! ruby world. in other words: change model run magic -> current db schema investigated , changed reflect model profit of course, there cases when it's impossible such alteration non-desctructive, eg. when deleted attribute. don't mean such case. i'm looking general solution doesn't in way when rapidly prototyping , changing schema. tia coders [edit] basically i've found i'm looking in sqlalchemy docs. wait here bit brave want write answer himself , earn points :) sqlalchemy-migrate (http://packages.python.org/sqlalchemy-migrate/) intended these types of operations.

objective c - Bizarre unwanted animation occurring in iPhone app -

i hate post seeing unwanted animation in iphone app working on. have never seen before in apps or other apps. this app ios 4.2 , iphones only. weirdness happening on iphone4. examples: when application in question launches uialertview , "flies in top or top left." when uitableview scrolls, new (standard) cell data "expands in left of cell" when first coming view , populated. when uitextfield has text entered it, typing slow , can see cursor slide right on new letter. if there "clear" button in uitextfield , slides left side uitextfield first entered into. when uipickerview scrolling, scrolling newly displayed row "flying" new row data in top left. the overall behavior old old old apple ii+ basic set "speed=20" , "slow" computer down. what know: happening on multiple phones (4 , 3gs). not happen in other apps. not happen in other apps in general. seems consistent across entire app. not small project not w...

Problems adding git remote repository -

i'm having problems adding remote repository local one. first tried using tower manged add local repo, when came adding remote repo said add url. doesn't url. should include ssh:// username etc. etc. so found this article , followed precisly, until came adding remote repository. failed. can help? kasper-srensens-macbook-pro:~ kasper$ git remote add origin ssh://kasperso@kaspersorensen.com:2227/www/mechatronicscluster/wp-content.git fatal: not git repository (or of parent directories): .git kasper-srensens-macbook-pro:~ kasper$ you have in git repository add remote for specific repository . use cd change current directory.

vb.net - Sort by Date a XML with XSLT and return a XML -

hello have xml , want sort message/data/transactions/transaction xslt "posted-date" , return sorted xml work with. i have hours reading xsl , trying doesnt work. thanks in advance <data result="true"> <account number="mynumber" currency="mycurrency" type="mytype" /> <transactions> <transaction description="desc 1" currency="usd" posted-date="2010/01/31" amount="240.88" /> <transaction description="desc 3" currency="usd" posted-date="2010/05/20" amount="240.88" /> <transaction description="desc 8" currency="usd" posted-date="2008/12/31" amount="240.88" /> <transaction description="desc 3" currency="usd" posted-date="2003/12/31" amount="240.88" /> <trans...

concurrency - Scheme implementation with multicore implementation of SRFI-18? -

i'll working on project in concurrent programming, , nice able use scheme. however, project really necessary use different cpu cores (continuation-based threads won't do). so, there r5rs scheme implements srfi-18 making use of different cpu cores? guile 2.0 has srfi 18 implementation uses posix threads. (guile 1.8 had posix threads, no srfi 18.)

JQuery map() form inputs -

i'm mapping out name attributes of :input using example below. had put conditional statement in map() find out if checkbox checked , return true or false. i'm not getting select option name attr. feel it's taking more code writing should. efficient way name attributes , watch checked in checkboxes. check example @ http://jsfiddle.net/gvhaq/3/ <form> <input type="text" name="name" value="john"/> <input type="text" name="password" value="password"/> <input type="text" name="url" value="http://domain.org/"/> <select> <option name="one">1</option> <option name="two">2</option> <option name="three">3</option> </select> <input type="checkbox"/> </form> <p></p> $("p").append($("...

php - How to add rel="nofollow" to links with preg_replace() -

the function below designed apply rel="nofollow" attributes external links , no internal links unless path matches predefined root url defined $my_folder below. so given variables... $my_folder = 'http://localhost/mytest/go/'; $blog_url = 'http://localhost/mytest'; and content... <a href="http://localhost/mytest/">internal</a> <a href="http://localhost/mytest/go/hostgator">internal cloaked link</a> <a href="http://cnn.com">external</a> the end result, after replacement should be... <a href="http://localhost/mytest/">internal</a> <a href="http://localhost/mytest/go/hostgator" rel="nofollow">internal cloaked link</a> <a href="http://cnn.com" rel="nofollow">external</a> notice first link not altered, since internal link. the link on second line internal link, since matches our $my_folder ...

Android soap request posting -sample? -

i want send soap xml request php server android device, shown below required parameter posting request. not getting method or sample achieve.any suggest samples. post /sample/server.php http/1.0 host: x.x.x.x user-agent: nusoap/0.7.3 (1.114) content-type: text/xml; charset=iso-8859-1 soapaction: "" content-length: 551 thanks

javascript - Prevent default action -

this page open in newwindow . have 1 text box , 2 button(h:commandbutton , a4j:commandbutton). i move(set) cursor focus textfield. my problem is, hit enter button textfield, automattically called h:comandbutton action , close new window . how avoid this. but, need , when hit enter button, move cursor focus a4j:commandbutton <f:view> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <script type="text/javascript"> function a4jbuttonclick() { alert("a4j command buton clicked..."); } </script> </head> <body> <h:form id="sampleform"> <rich:panel id="samplepanel"> <h:outputtext value="user name : "/> <h:inputtext/> <h:commandbutton value="closing-comman...

.net - C# LINQ Query DateTime literal generated -

we using following code generate sql code query against firebird database; dsrcash.getall(x => x.account.id == account.id && x.date_record <= dateto && x.date_record >= datefrom).tolist(); both dateto , datefrom parameters non nullable datetime , same respective database columns. the sql clause generated follows; where (struct_cas0_.deleted null) , struct_cas0_.account_id = 372 /* @p0 */ , struct_cas0_.date_record <= '2011-02-18t13:00:00.00' /* @p1 */ , struct_cas0_.date_record >= '2010-02-17t13:00:00.00' /* @p2 */ you can see datetime literal has been formatted using "s" or standard sortable format. appears firebird not support date format, if remove "t" datetime literal query execute successfully. is possible change datetime conversion string being performed? i should mention using nhibernate orm project. i suppose use expression visito...

Awk or grep question -

i have datafile [abc] def ghi [jkl] [mno] from file; can run grep , lines have "[" in them. how can contents of text inside "[]". for example: abc jkl mno thanks sed -n 's/\[\(.*\)\]/\1/p' file explanation: -n suppresses printing of each line stdout, /p @ end of regex re-enables behavior causing matching lines printed. regex matches between brackets , replaces entire line it.

ruby on rails - RoR - where to put a automated process -

following situation (ror 3, ruby 1.9). i've got model fields. now want grab json feed (f.e. every hour) compare content stored model objects , put in new model object if there new item in json feed. i'm not shure put automated action. don't think doing in models method right place, right? where migration actions? in controller? not think. thankful hints ignore controllers this. models serve abstraction layer accessing data. in case, have locally persisted data in form of database, , have remote data you're retrieving json on http. have regular activerecord models, , have model json data. let's assume have model called remotedata fetches json document , has methods cleanly data it. have storeddata model keeps retrieved content in database displayed later. now, want automate process of calling remotedata.fetch('url') , calling storeddata.create :params on returned data. that, create "rake task". here's example: # li...

Redirect logged in users to a "you don't have permission" error page in cakephp -

when user logged in , try access particular action he’s not authorized view, user redirected '/' (even can loop behaviour in circumstances). i've searched solutions issue, didn't find anything. i've written lines in app_controller.php redirect logged in users error page ("you have no permission access...") i'm not sure if i'm messing code. could advise me? thank you. in app_controller.php: var $components = array('auth'); function beforefilter() { $allowedactions = array_map('strtolower', $this->auth->allowedactions); if (!($this->auth->allowedactions == array('*') || in_array($this->action, $allowedactions))) { $_server['http_referer'] = router::url(array('controller' => 'page', 'action' => 'error')); } } you try use $this->auth->loginerror = "login error"; $this->auth->autherror = "auth error...

asp.net mvc 3 - mvc 3 razor view engine using "default" views -

i'm using razor new project in company, , have been playing 2 days , found weird behaviour imho. i have home controller in root of webapp , home controller in area , call area1. in both these controllers have index action , therefore got index view in views root folder, , 1 in area1\views folder. if remove index view within area , area1\views\index.cshtml , request area1\home\index, don't error view engine not finding view action , "base" index view found in \views\index.cshtml , rendered. someone knows if bug or it's done purpose ? if so, there's way disable default ? definitely not bug. this behaviour allows easy reuse of view templates, eg, error handling. the default behaviour asp.net mvc if do...: return view(); ...it searches view template name of action use in number of places: default naming convention folder controller, ie, /area1/views/home/, /area1/views/shared/ area1/views/ /views/shared/ /views/ if finds no such view ma...

ubuntu - libext2fs code not working -

i tried access superblock information using code shown here:- http://paste.pocoo.org/show/340724/ however, error shown here:- http://paste.pocoo.org/show/340723/ my kernel version 2.6.31-22-generic , have not installed libraries/additional kernel headers same. os ubuntu 9.10. you need add #include <linux/fs.h> to top of source code.

android - Exception while calling web service----java.net.SocketException: Permission denied -

i developing 1 application through calling web service. web service hosted on local machine,but while calling web service got java.net.socketexception: permission denied bug. mentioned internet permission in manifest file although, getting this. looking forward positive response. thanks in advance. regards most likely, have internet permission in wrong place in manifest.

Django form errors translate -

hi simple interface add message author name. have 2 fields 1 name second message. function сheks form.is_valid() if true element added database else render template error form , message 'this field required.' appearead. it's cool few lines of code lead result. users speak not on english language , not understand 'this field required.' message. how can change message continuing use form.as_table? django comes built-in internationalization, see i18n docs . in case of form error messages, marked translation , translated in django. need make sure django selects right language user (see how django discovers language preference ). if users speak in (for example) german, can put in settings: gettext = lambda x: x language_code = 'de_de' languages = ( ('de', gettext('german')), )

python - Scrapy: RSS control pub_date -

i'm doing rss spider. how do controlling last crawl date? right thinking this: put in control file last pub_date have crawled. then when crawl starts, checks last pub_date against new pub_dates. if there new items, start crawling, if not, nothing. how else resolve this? i store data in database (including last crawl date , post dates) , take dates need database.

ruby on rails ,checkout SVN -

if go window-->preference-->click svn-->then select-->javahl error: error loading javahl library failed load javahl these errors encountered no libsvnjavahl -1 in java.libray.path no svnjavahl -1 in java.libray.path no svnjavahl in java.libray.path java.libray.path=home/kingston/radrails/jre/lib/i386/server:/home/kingston/radrails/jre/lib/i386:/home/kingston/radrails/jre/lib/i386:/:user/java packages/lib/i386/lib/user/lib also, please tell me how install svn in linux-ubuntu-radrails , aptana radrails. your subversion installation isn't complete. if you're running java-based subversion client, suggested post, need javahl library too. provides glue between java api , core svn dlls. page can tell more: http://subclipse.tigris.org/wiki/javahl as second question, that's not programming issue, , google i'm sure.

mysql - SUBSTRING_INDEX() results "omit" character when used inside LOWER() -

i found strange bug in mysql i've reported here: bug #60166 can confirm me bug, , not understanding problem of how work mysql? ( valeriy kravchuk : thank bug report. verified described) what reason of bug??? is there provide advice solve issue other described in bug report? and if can me install mysql udf on windows mysql 5.5.8 despites bug #45549 , i'll very gratefull! anyway, in regard of bug #42404 , substring_index() seems have strange behavior. thanks advance help! [edit] here, possibles solutions given me in bug report: suggested fix: use: mysql> select substring_index(lower(@user_at_host), '@', -1); instead of: mysql> select lower(substring_index(@user_at_host, '@', -1)); avoid using of buggy function (see more 1 year old bug #42404 ), and: use preg_* udf http://www.mysqludf.org/ now,this solution unavailable on windows / mysql 5.5.8 because of 8 month old bug #45549 ...

SQL join ON not equal in Mysql -

i have 2 tables. both contains question id field. want records first table not present in second one. don't want use "not in" constrain second table having more 400000 records. try like select t1.* table1 t1 left join table2 t2 on t1.questionid = t2.questionid t2.questionid null

vbscript - cmd and ftp.exe error WScript.Shell -

hoping help i using script ftp 1 of servers. <% set oshell = createobject("wscript.shell") cmdline = "c:\windows\system32\ftp.exe -v -i -s:c:\windows\system32\ftp.exe -s:"+request.form("website")+"" tempret = oshell.run("c:\windows\system32\cmd.exe /c " & cmdline, 0, true) set oshell = nothing waittime = numberoffiles * 2 starttime = timer while timer < starttime + waittime loop %> i error code, , can not figure out. error 'fffffffe' the line cmdline = "c:\windows\system32\ftp.exe -v -i -s:c:\windows\system32\ftp.exe -s:"+request.form("website")+"" seems have 2 + symbols. converts cmdline variable int value 0. replace crosses pretzels (&). not know if source of problem, not correct.

iphone - Collaborating on an iOS game with an artist living somewhere else / modifying files in an iOS app without rebuilding -

a former coworker (artist) , myself (programmer) developing small game in our free time. since not @ interested in learning how use xcode, save making own builds (i don't blame him, great artist, little understanding technical stuff), how have been working far: we share dropbox folder store ingame artwork once enough or important changes have been made, i'd create build (ad hoc distribution) , send him from time time we'll meet , work couple of hours, maybe once week since live in different cities this ok of time. we're busy finetuning content , game mechanics. in development stage, our workflow slow , "disconnected". whenever working on artwork, he'll have wait me make build able see changes reflected in actual context. since we're not working @ same time, means he'll have wait days - not @ satisfying. so, i'd know..: best way allow him change content without need rebuild game? i know contents of ios app bundle cannot changed o...

visual c++ - VC++ read variable length char* -

i'm trying read variable length char* user input. want able specify length of string read when function called; char *get_char(char *message, unsigned int size) { bool correct = false; char *value = (char*)calloc(size+1, sizeof(char)); cout << message; while(!correct) { int control = scanf_s("%s", value); if (control == 1) correct = true; else cout << "enter correct value!" <<endl << message; while(cin.get() != '\n'); } return value; } so, upon running program , trying enter string, memory access violation, figured has gone wrong when accessing allocated space. first idea went wrong because size of scanned char * not specified within scanf(), doesn't work correct length strings either. if give calloc size of 1000 , try enter 1 character, program crashes. what did wrong? you have specify size of value scanf_s :...

Is it possible to use Enterprise Java Beans in a django project? -

i've seen possible run django web framework on glassfish application server. possible use simple enterprise java bean in django project runs on basis of jython? idea have django website frontend , java ee in backend (to manage database access, etc.). have experience that? a possibly easier variant expose ejb functionality using rest or possibly soap around interface problems between jython , java rather call directly.

python - Obtaining void template passing from django development server to apache server -

i've django app works under django development server. i'm trying run under apache2.2 using mod_wsgi. in httpd.conf file of apache i've added: <ifmodule wsgi_module> wsgiscriptalias /index my_path_to_wsgi_modules/django.wsgi </ifmodule> and django.wsgi module contains basic configuration explained in django documentation: http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/ unfortunately when run server , try access main page obtain template page without variable data in it. server log says: [fri feb 18 13:50:33 2011] [error] [client 127.0.0.1] file not exist: /usr/local/apache2/htdocs/api, referer: http://127.0.0.1/example/ said before strange thing same code works under django development server. i'm new in programming web app, please, can help? my django.wsgi file looks this: import os import sys from os.path import sep basepath = '/home/example/workspace/examplews/src' sys.path.append(basepa...

flash - Could I have some clearance on why one of my methods are being called ran first when I call it second? -

when run program "showapplication" method runs first. little confused why "showapplication" method runs before "complete" method? why happening? <?xml version="1.0" encoding="utf-8"?> <s:application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minwidth="955" minheight="600"> <s:applicationcomplete> <![cdata[ complete(); showapplication(); ]]> </s:applicationcomplete> <fx:script> <![cdata[ import mx.controls.alert; private function complete(): void { alert.show("wewt"); } private function showapplication(): void { alert.show("showing components"); } ]]...

iphone - Appcelerator Push Notifications -

i wondering if it's possible create generic push notification solution mobile devices (or @ least android , iphone) appcelerator. found examples on how implement iphone push appcelerator nothing generic. any ideas? or there maybe other cross-plattform development sdk solve this? as far know, can use push notification service ios only. see documentation here . then, ios, simpliest way send/receive notifications, subscribe free urbanairship service. can find nice tutorial here .

ruby on rails - Different Markers in Google Maps with gmaps4rails -

with gmaps4rails there way define custom marker . same 1 shown each database entry. how show different marker each database entry, in google latitude? preferably through own database column or through sprite, if there pictures categories/groups , not individual users. building on apneadivings answer, 2 possibly shorter ways come mind: generic: def gmaps4rails_marker_picture { "picture" => self.image_path, # image_path column has contain '/assets/my_pic.jpg'. "width" => 32, #beware resize pictures "height" => 32 #beware resize pictures } end in case, reuse category column name picture: def gmaps4rails_marker_picture { "picture" => "/images/" + self.category + ".png", "width" => 32, #beware resize pictures "height" => 32 #beware resize pictures } end the thing missing now, way use sprites. thats impossible.

Get source url of script tag in Javascript on the iPhone over 3G -

i have javascript widget embedded on third party websites. needs load other resources (css, flash, etc) relative (rather relative page hosted on). to have been looping through script tags in page, finding script tag, , getting src property it. e.g. path = ''; $('script').each(function(i, script) { var src = $(script).attr('src'); if ('name-of-widgets-file.js' === src.replace(/^.*[\/\\]/g, '')) { return path = src.substring(0, src.lastindexof('/')); } }); this works on devices have tried on, except iphone on 3g connection! when connected on 3g iphone returns undefined src attribute of script tag! does have ideas working around this? possibly way url of executing script tag? i've found work around this. rather looking script after has run, work out path while script executing. in case iphone returns src attribute when on 3g connection. var scripts = document.getelementsbytagname('script'...

unit testing - How to test my repositories implementation? -

i using nunit test units. have interface on domain ready make implementation of interfaces in persistence layer. question how make unit tests testing repositories ? believe isnt idea test directly database. ive heard poeple using sqlite okay use mocks instead ? why poeple using sqlite in-memory database when can provide mock actuals entities ? any example welcome too. note: intended repositories coded in c# gonna use nhibernate , fluent nhibernate mapping. thanks. it of course depends, in cases i'd it's enough mock repositories in tests , using in-memory sqlite database test mappings ( fluentnhibernate persistence specification testing ). for nunit mappings tests sqlite i'm using following base class: public abstract class mappingstestbase { [setup] public void setup() { _session = sessionfactory.opensession(); buildschema(_session); } [testfixtureteardown] public void terminate() { _session.close(...

ruby on rails - Multi - User Multi Environment -

i'm looking create app, each user can create own... "universe" in way, amount of items , names makes sense them, etc. i've never done before, far i've had typical cases have users , admins, they're both looking @ same thing. here each user have separate environment. obviously user should not able see else's environment. can please point me right direction on subject? maybe useful gems or resources use started? any advice welcome! i'd start using plugin authentication, e.g. authlogic or devise 2 popular examples. both of these let define user class. then, when showing user stuff in environment, can make sure show them own stuff using has_many , , has_one , , has_and_belongs_to_many relationships in rails. e.g. if facebook, might have this class user < activerecord::base has_many :news_items has_many :friends has_many :messages end in code refer @user.news_items @user.friends @user.messages and relationship...

python - Subprocess.Popen behaves differently in interpreter, executable scripts -

let's have following: command = shlex.split("mcf -o -q -e -w %s %s" % (solfile, netfile)) task = subprocess.popen(command, stdout=subprocess.pipe, stderr=subprocess.pipe) stdout, stderr = task.communicate() print "stdout: %s" % stdout #debugging print "stderr: %s" % stderr #debugging if stderr: sys.exit("mcf crashed on %s" % netfile) it's not necessary know mcf is, except it's c program overflow if it's not given satisfiable netfile. (why can't ensure netfiles satisfiable? well, because easiest way check feed mcf , see if overflows...) anyway, when run in executable script, task.communicate() doesn't seem store in stdout , stderr. (to precise, stdout == stderr == ''.) instead, stderr stream mcf seems "leaking" terminal rather getting captured subprocess pipe. here's sample output illustrate: netfile: facility3cat_nat5000_wholesaler_capacitation_test_.net solfile: facility3cat_nat5...

c# - WPF: How To Customize Generic Custom Window? -

this tough question, i'll try explain anyway... i have custom control window used on applicaton. reason did because wanted various windows , dialog boxes customizable across program. i.e., minimize, maximize, close button , frame custom. window templated inside generic.xaml. works , it's good. idea got http://www.codeproject.com/kb/wpf/customframes.aspx now users of custom window user controls in xaml use mywindow root element: <mywindow> .... </mywindow> but i'm trying "inject" elements mywindow user control's xaml. mywindow have container hosting them. example, might want inject toolbar button appears right next minimize button. example, might have user control following (where mywindow root element): <mywindow> <mywindow.toolbar> <button x:name="blabla"/> </mywindow.toolbar> </mywindow> this put "blabla" right next minimize button example. i'm wondering if it...

What are good books or tutorials for learning how to do web design with GIMP? -

i have photoshop cs5, want switch gimp basic web design tasks. where can turn learn how web design gimp? i'm talking making gradient backgrounds, nav tabs, etc. gimps's image editor, not web designer. beyond that, if know photoshop already, gimp pretty easy learn. basic concepts same, you'll have learn new keyboard shortcuts , things hiding in menus.

jquery - MVC 3 JSON call not working in IIS -

i'm working in mvc 3 application aspx engine , point of start developed simple search utilizes jquery json call retrieve info. call sends parameter taken text input , updates table results. funcion this: function performlookup() { var _accountnumber = $('#accountnumber').val(); $.ajax({ url: '/searchajax/searchaccount', type: 'post', data: '{_accountnumber:'+_accountnumber+'}', datatype: 'json', contenttype: 'application/json; charset=utf-8', success: function (data) { updatetable(data); }, error: function () { alert('an error occurred while performing search.'); } }); return false; } the server code runs query parameter , returns list serialized json worked jquery....

python - Writing an image from PIL's 'Image' class into a model instance's ImageFile field -

i want load image , manipulate using python imaging library , store in model's imagefield. following outlines i'm trying do, minus manipulation: #the model class djinfo(models.model): dj_name = models.charfield(max_length=30) picture = models.imagefield(upload_to="images/dj_pictures") email_address = models.emailfield() #what i'm trying do: import tempfile import image artists.models import djinfo image = image.open('ticket.png') tf = tempfile.tempfile(mode='r+b') image.save(tf, 'png') dji=djinfo() dji.picture.save('test.png', tf) you this: image = image.open('test.png') tf = tempfile.temporaryfile(mode='r+b') name = tf.name del tf image.save(name, 'png') dji=djinfo() dji.picture.save('test.png', name) but suspect there better way using cstringio or other buffer object saving step of writing temp file hdd. is t...

ruby on rails - How to set headers of a JSON/XML response in 'format.json/xml { render :json/xml => @user.to_json/xml }'? -

i using ruby on rails 3 , trying set values of json/xml response. in controller have respond_to |format| format.xml { render :xml => @user.to_xml } format.json { render :json => @user.to_json } end when make http request json/xml, set common values these header: date: - fri, 18 feb 2011 18:02:55 gmt server: - apache ... etag: - "\"0dbfd0ec23934921144bd57d383db443\"" cache-control: - max-age=0, private, must-revalidate x-ua-compatible: - ie=edge x-runtime: - "0.033209" status: - "200" transfer-encoding: - chunked content-type: - application/json; charset=utf-8 #or application/xml; charset=utf-8 http_version: "1.1" message: ok read: true i add/set header values , add new parameters message2 or header2 . how can in format.json/xml { render :json/xml => @user.to_json/xml } syntax? the format.foo { render ... } thing takes block. can put whatever want t...

SQL 2008 R2 p2p replication alternate -

the requirement. establish 3 global data centers (sites) , direct users closest site based on cisco global site selector. if site 1 goes down site 1 traffic direct site 2. if user site 1 travels site 2 or 3 should able access information entered. data should same across data centers, in near real-time. should able add new data center. the issue: have existing database needs replicated 3 sites , have exact same data. thought use sql 2008 peer-to-peer replication no go due method not supporting identity columns. what other replication technologies exist keep 3+ sql server 2008 databases in sync across global data centers? 3rd party tools? block replication? remote clustering? i have used merge replication purpose results. http://msdn.microsoft.com/en-us/library/ms151329.aspx the largest system ever managed 11 separate locations having on on-site server. note used individual locations accessed shared db if lines ever went down still operate well. how translates off-...

How can I change the apache solr search URL in Drupal? -

how can change default apache solr url path search/apachesolr_search/term else? you can create menu item has callback: $menu['search']['page callback'] = 'apachesolr_search_view'; this make url use apachesolr search it's return. what trying change to?

iphone - Using/storing an array of floats in Cocoa -

in c, if wanted array of floats (for instance) define fixed size , allocate it, , access each element math operations. however, want ability have arrays mutable since continually grow in size (as app running, , array surpass 10000+ elements) , idea of nsmutablearray sounds great. however, (if understand correctly) stores objects, have wrap numbers in nsnumber, , put array. seems ridiculous amount of overhead store array of floats (or doubles or integers). on other hand, see there flout attributes core data, don't see how access in same way ( array[index] ). missing here? should heavy-lifting math done in fixed-sized c arrays, there ways of using foundation classes haven't stumbled upon, or there ways of accessing core data objects 1 access array? you aren't missing here; there's not formal objc interface arrays of c scalar types. the simple way (as westsider mentioned) use std::vector , , implement serialization/deserialization using mechanism such...

asp.net - extra querystring data on jQuery.ajax() -

for intense purposes have working, however, wanted know querystring data , it's coming from. jquery.ajax({ url: 'myfile.aspx/processrequest', data: json.stringify({status: status }), async: false, datatype: 'application/json', cache: false, success: function (data) { // ... stuff data... }); using tamperdata , viewing request.querystring in debugger resulting url is: http://localhost/folder/myfile.aspx/processrequest?_=1298057136790&{%22status%22:%22pqs%22} so _1298057135790 come , why there? browser , proxy server cache requests. appending this, fresh data. have used following in code. cache:false changing remove great chance may old data, if browser cache disabled.

javascript - Where do I put the jQuery script tag? -

this question has answer here: does <script> tag position in html affects performance of webpage? 8 answers in documentation see jquery script tag beneath <title> in head, when go other sites (the initializr template first off top of head), drop bottom of body (you know, right before </body> ). which of these 2 right? quoting ydn best practices speeding web site : put scripts @ bottom the problem caused scripts block parallel downloads. http/1.1 specification suggests browsers download no more 2 components in parallel per hostname. if serve images multiple hostnames, can more 2 downloads occur in parallel. while script downloading, however, browser won't start other downloads, on different hostnames. in situations it's not easy move scripts bottom. if, example, script uses document.write insert part of page'...

objective c - Finding path to plist in Xcode project folder -

i have plist in xcode project's resource folder on physical drive it's in top folder of project. want read , write same file. using nsbundle reads , gives no problem. i'm using code read file path: nsstring *thepath = [[nsbundle mainbundle] pathforresource:@"myfile" oftype:@"plist"]; but think nsbundle doesn't allow writing , didn't work when tried write file. using following code creates/ updates file using application path nsarray *patharray = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdirectory, yes); nsstring * docsdirectory = [patharray objectatindex:0]; nsstring *filepath = [docsdirectory stringbyappendingpathcomponent:@"myfile.plist"]; but now, need write on internal file. solution access it? besides, i've tried giving path working directory project directory. doesn't work. it's not nsbundle doesn't support writing, it's ios itself. ios not let app write own bundle. ...

javascript - jQuery ajax method with dataType 'json' incorrectly parsing json data -

i'm having inexplicable behaviour using jquery 1.4.2, , i'm beginning think might safari problem, not jquery one. let me explain. i began enough using .getjson this: $.getjson("/challenge/results", form_data, function(data){ //i know console.log bad news, simplification. console.log('data', data); } and log gave me along lines of >locations: array (1) while expecting array of size 2. had @ json in response: {"locations": [{"customer_id":2,"editable":true,"id":971,"latitude":43.659208,"longitude":-79.407501,"max_zoom":25,"min_zoom":9,"name":"test"}, {"customer_id":3,"editable":true,"id":974,"latitude":36.746944,"longitude":-107.970899,"max_zoom":25,"min_zoom":9,"name":"test2"}]} i've simplified considerably sake of clarity, far can tell, json ...