Posts

Showing posts from May, 2010

python - While trying to set up Django on Windows: AttributeError: 'Settings' object has no attribute 'DATABASES' -

i'm following these instructions in order set django on windows. have installed python 2.6, postgresql 8.4, psycopg 2.0.14 python 2.6 , latest version of django svn. i'm following these instructions run test project (copied page linked above): c:\documents , settings\john>cd c:\ c:\>mkdir django c:\>cd django c:\django>django-admin.py startproject testproject c:\django>cd testproject c:\django\testproject>python manage.py runserver when run last line, output: validating models... unhandled exception in thread started <function inner_run @ 0x01ecb930> traceback (most recent call last): file "j:\python26\lib\site-packages\django\core\management\commands\runserver.py", line 48, in inn er_run self.validate(display_num_errors=true) file "j:\python26\lib\site-packages\django\core\management\base.py", line 249, in validate num_errors = get_validation_errors(s, app) file "j:\python26\lib\site-packages\django\co...

iphone - Problems with makeObjectsPerformSelector inside and outside a class? -

a friend , creating card game iphone, , in these days of project, i'm developing deck class , card class keep cards. i'm wanting test shuffle method of deck class, not able show values of cards in deck class instance. deck class has nsarray of card objects have method called displaycard shows value , suit using console output(printf or nslog). in order show cards in deck instance @ once, using this, [deck makeobjectsperformselector:@selector(displaycard)] , deck nsarray in deck class. inside of deck class, nothing displayed on console output. in test file, works fine. here's test file creates own nsarray: #import <foundation/foundation.h> #import "card.h" int main (int argc, char** argv) { nsautoreleasepool* pool = [[nsautoreleasepool alloc] init]; card* 2 = [[card alloc] initvalue:2 withsuit:'d']; card* 3 = [[card alloc] initvalue:3 withsuit:'h']; card* 4 = [[card alloc] initvalue:4 withsuit:'c']; nsarray* ...

perl - What is the release date for Rakudo Star (perl6)? -

if specific release date not available (as suspect not), can provide resources tracking how close desired feature set allows release. i'm not asking percentage gauge, or x of y features completed list. list of bugs marked in whichever section of perl rt instance that's tracking rakudo bugs meet criteria, more if list dynamic (i.e. it's list of bugs tagged in manner, not static list of ticket numbers). if there few planned features left finished/tested before it's considered ready final testing, listing sufficient. as per post on 04/08/2010, first major release of "rakudo star 1.0" is tentatively aimed @ q2 2010 (original plan around april 2010 shifted due personal circumstances involving lead developer). also, on 4/22/2010 announced april development release of rakudo. announcement stated: "this not "rakudo star" release announced q2 2010 -- expect shipped in june." not sure if enough measure of progress, have "s...

before_validation issues with rails -

the problem using def before_validation self.author.strip! self.author_email.strip! end and error message: deprecation warning: base#before_validation has been deprecated, please use base.before_validation :method instead. can point me in right direction. thanks somewhere toward top of class model place name of clean-up method: before_validation :remove_whitespace ... , further down model class place private method same name: def remove_whitespace self.author.strip! self.author_email.strip! end optionally, if want one-liner, pass lambda instead of method name before_validation: before_validation lambda {self.author.strip!; self.author_email.strip!}

Enforcing business rules using a Procedure in Oracle -

how write procedure shows 1 field's value cannot higher field's value, in terms of numbers. say. employee'a salary can't higher manager's salary. i've never done 1 before there no declarative way enforce business rules in sql. has done code. there number of gotchas, not least of identifying all scenarios rule needs enforced.. here scenarios: when insert employee need check whether salary greater 90% of manager's salary. when update employee's salary need check still isn't greater 90% of manager's salary. when update manager's salary need check still greater 110% of all subordinates' salaries. if insert records simultaneously manager , subordinates (say using insert all) need make sure rule still enforced. if move employee 1 manager need make sure rule still enforced. here things make harder: enforcing these rules involves selecting table manipulating cannot use before ... each row triggers, due ora-0408...

imagemagick - write text and change image width -

how can change width of image depending on width of text? if want 5 pixel padding both left , right of text? and how can define path font want use? 'how change width of image depending on width of text?' you can use biiiig drawing canvas first , -trim trim superfluous space around text. example: convert \ -font "courier" \ -size 800x200 \ xc:none \ -box green \ -pointsize 24 \ -gravity center \ -draw "text 0,0 'this clarkk\'s text...'" \ -trim \ clarkk.jpeg 'how add 5 pixels padding both left , right of text?' you can use of different imagemagick methods add left , right pixels resulting image step 1. example: convert...

java - Problems with Tomcat server and JSP web application -

i running jsp/servlet web application , out of experienced random problems don't make sense. checked catalina.out file check log files, , noticed contained of following messages severe: error starting static resources java.lang.illegalargumentexception: invalid or unreadable war file : error in opening zip file info: validatejarfile(/home/weremo/appservers/ apache-tomcat-6.0.26/webapps /wma/web-inf/lib/ servlet-api.jar) - jar not loaded. see servlet spec 2.3, section 9.7.2. offending class: javax/servlet/servlet.class i aware of message means, in dark have caused it, or effects have on application. make sure servlet-api.jar file not included in webapp, if is, remove it. the servlet api provided servlet container. webapps not allowed load classes in javax.servlet package, , that's what's causing error.

android - Best Practices for developing an Activity with a background Service -

my application has activity ui , service background polling fun. seems standard fare. can alarmmanager trigger service intent without activity oncreate being called? is there benefit putting activity & service different applications? create 2 apk's , make impossible put market 1 app? can put 2 applications 1 manifest somehow? regarding communication between two: -if activity & service part of same application - can't store common objects (like user object) @ application scope 2 share? -it seems don't need bother aidl - 2 have weak references each other @ application scope - , can call methods on each other way? or should pub/sub each other kind of observer pattern or broadcastlistener thing? can alarmmanager trigger service intent without activity oncreate being called? yes. is there benefit putting activity & service different applications? imho, no. would create 2 apk's , make impossible put market 1 app? y...

user interface - Set attributes (margin, gravity, etc...) to an Android view programmatically (without XML) -

i need create gui (layout+views) in .java activity class (i know it's far more flexible , easier use .xml layout file, don't want use now). i can't find setgravity() (but "gravity" object can't figure how use) or set setmargin() method "view" object. what easiest way ? thanx. for setting margin on component. following leaves existing margins set , sets left margin zero. textview title = ((textview)findviewbyid(r.id.default_panel_title)) final viewgroup.marginlayoutparams lpt =(marginlayoutparams)title.getlayoutparams(); lpt.setmargins(0,lpt.topmargin,lpt.rightmargin,lpt.bottommargin); title.setlayoutparams(lpt);

What is the difference between Windows Mobile 6 Professional and Standard SDKs -

what differences between windows mobile 6 professional , standard sdks? well not sure, according me windows professional , standard sdk both used software development kit, while using windows professional need include dll contains new version , have vast library.

Memory Usage Of Different Data Types in javascript -

a question has happened me different data type in javascript how many use of memory . example in c++ data type int , char , float uses order 2 , 1 , 8 byte of memory . data type number , string , boolean , null , undefind , objects , arrays in javascript how many use of memory , ranges accepted ? accept apologize because of low english level!!! numbers 8 bytes. found in w3schools page . i searched around bit more other javascript primitive types, it's surprisingly hard find information! did find following code though: ... if ( typeof value === 'boolean' ) { bytes += 4; } else if ( typeof value === 'string' ) { bytes += value.length * 2; } else if ( typeof value === 'number' ) { bytes += 8; } ... seems indicate string 2 bytes per character, , boolean 4 bytes. found code here , here . full code's used rough size of object. although, upon further reading, found interesting co...

mvp - Which is better in GWT? -

which better in gwt interface, using normal mvp javacode, or uibinder?? performance, editing, simplicity aspects. this google says : besides being more natural , concise way build ui doing through code, uibinder can make app more efficient. browsers better @ building dom structures cramming big strings of html innerhtml attributes bunch of api calls. uibinder naturally takes advantage of this, , result pleasant way build app best way build it. so judging points mentioned, uibinder provides more advantages. however, wouldn't everything in uibinder. start it, , you'll find out, little bit of pure code might better (or only) choice!

SQL Server 2005 script with join across Database Servers -

i have following script use give me simple "diff" between tables on 2 different databases. (note: in reality comparison on lot more id) select mytablea.myid, mytableb.myid mydatabasea..mytable mytablea full outer join mydatabaseb..mytable mytableb on mytablea.myid = mytableb.myid mytablea.myid null or mytableb.myid null i need run script on 2 databases exist on different servers. @ moment solution backup database 1 server, restore other , run script. i'm pretty sure possible, however, can of worms? rare task need perform , if involves large number of db setting changes stick backup method. if set linked server in sql can run regular query so. assuming mydatabaseb on remote server set linked server , query being run on server has mydatabasea. select mytablea.myid, mytableb.myid mydatabasea..mytable mytablea full outer join linkedservername.mydatabaseb.dbo.mytable mytableb on mytablea.myid = mytableb.myid mytablea.myid null o...

ASP.NET UpdatePanel causes "A script on this page is causing internet explorer to run slowly..." on IE -

ie works slow when there chunk of invalid html code inside updatepanel. interesting point: when ugly html cleared (jquery: $('#content').empty()) before partial postback, ie runs pretty fast , not show "a script..." message. there 2 buttons in example. first 1 (async) simple partial postback , causes described problem. second 1 (async clear) clears div ugly html , executes partial postback - without problems! a solution use iframe , load ugly html iframe. more interested in explanation of such behavior. example aspx markup: <%@ page language="c#" autoeventwireup="true" codebehind="default.aspx.cs" inherits="longrunningjavascript._default" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title...

javascript - Backbone.js: Why isn't this event bound? -

i have simple todo list, , rendering expected, when click on submit button in edit form, form submitted (get /todo_items), , page reloaded shows edit form. "submit form" event isn't being bound , can't figure out why. missing? app.views.edit = backbone.view.extend({ events: { "submit form": "save" }, initialize: function(){ this.render(); }, save: function(){ var self = this; var msg = this.model.isnew() ? 'successfully created!' : 'saved!'; this.model.save({ title: this.$('[name=title]').val(), success: function(model, resp){ console.log('good'); new app.views.notice({message: msg}); self.model = model; self.render(); self.delegateevents(); backbone.history.savelocation('todo_items/'+ model.id); $('#edit_area').html(''); }, error: function(){ console.log('bad'...

c - Is `y = x = x + 1;` undefined behavior? -

as title says, is y = x = x + 1; undefined behavior in c? answer question no. what happen happen: int x = 1; /* assume */ y = x = x + 1; /* results: */ y == 2; x == 2; how compiles same as: x += 1; y = x; why not undefined because not writing x in same expression read it. set + 1 , assign y value of x . your future if find code confusing can use parentheses readability: y = x = (x + 1);

automation - Any form autofill for 'Developers'? -

i have looked @ autofills firefox. not designed developers' needs in mind. general internet surfers need tool fill in many different forms constant values each form. developers need opposite, when want test part of app you'll need fill single (or couple of) forms many times different (but valid , sensible) data. so, such thing exist? autofill fill form inputs based on perhaps class name (email, password, address, url, ...)? i feel if doesn't exist should roll sleeves , make one! 1 put in share if others want team up. right now, desperately in need of 1 if exists one way use greasemonkey. example script: "auto fill forms custom information": http://userscripts.org/scripts/show/39313 edit: link may broken i'm sure capable of finding many greasemonkey references.

Java RegEx API "Look-behind group does not have an obvious maximum length near index ..." -

i'm on sql clause parsing , designed working regex find column outside string literals using "rad software regular expression desginer" using .net api. make sure designed regex works java too, tested using api of course (1.5 , 1.6). guess what, won't work. got message "look-behind group not have obvious maximum length near index 28". the string i'm trying parsed is column_1='test''the''stuff''all''day''long' , column_2='000' , theverycolumniwanttofind = 'column_1=''test''''the''''stuff''''all''''day''''long'' , column_2=''000'' , theverycolumniwanttofind = '' theverycolumniwanttofind = '' , (column_3 null or column_3 = ''not interesting'') , ''1'' = ''1''' , (column_3 null or column_...

java - Call getPage from htmlunit WebClient with JavaScript disabled and setTimeout set to 10000 waits forever -

i'm having problems htmlunit, disabled javascript , set timeout 10000 before calling getpage, expected exception after timeout htmlunit waits forever. after search realized in 2009 had same problem ( connection timeout not working ), complaining "connection timeout not working" , values in timeout not working until in 2011 didn't answer. someone here asking exception thrown think doesn't throw always. can't answer apache httpclient settimeout , either. can see person asking stop in timeout in terminate or stop htmlunit . you can see how crazy if try: milisecreqtimeout = 10; while(true) { _webclient.settimeout(milisecreqtimeout); milisecreqtimeout = milisecreqtimeout + 10; _htmlpage = _webclient.getpage(url); } _thewebclient.setwebconnection(new httpwebconnection(_thewebclient) { @override protected synchronized abstracthttpclient gethttpclient() { abstracthttpclient client = super.gethttpclient(); ...

objective c - Is there a way to programmatically give focus to another running application in OSX? -

i have use case i'd app give focus specific running application. how do that? if know application's bundle id (and need target 10.6+), can do: nsrunningapplicatin *app = [nsrunningapplication runningapplicationwithbundleidentifier:@"com.foo.someapp"]; [app activatewithoptions:nsapplicationactivateallwindows];

matlab - How do you concatenate the rows of a matrix into a vector? -

for m-by-m (square) array, how concatenate rows column vector size m^2 ? there couple of different ways can collapse matrix vector, depending upon how want contents of matrix fill vector. here 2 examples, 1 using function reshape , 1 using colon syntax (:) : >> m = [1 2 3; 4 5 6; 7 8 9]; %# sample matrix >> vector = reshape(m.',[],1) %# collect row contents column vector vector = 1 2 3 4 5 6 7 8 9 >> vector = m(:) %# collect column contents column vector vector = 1 4 7 2 5 8 3 6 9

sql server 2005 - ASP.NET Membership vs SQL Authentication -

for asp.net mvc extranet applications, pros , cons of using sql authentication instead of asp.net membership api handle security? gern, describing aspects of same framework. the asp.net provider stack abstract service layer 'provides' common services applications. the built in sql providers implementations use sql server backing store. mvc framework , scaffolding provide of necessary adapters using default sql providers. if built-in asp.net sql providers provide functionality require pro work done. not sure con be. in regards possibility want compare using sql providers vs ad providers: the ad/token based providers active directory authentication , access control , implication user must have valid account setup in ad in order access protected resources. the sql providers allow define arbitrary users not require ad accounts. the infamous grey zone appears when have large ad user base must support must allow non-ad accounts established. @ point start...

Is it possible to remove a single file from PHP APC cache? -

i've got php apc running on centos server, apc.stat = 0 performance reasons there php files change i'd able remove apc cache @ - is possible remove single files cache? thanks in advance! would believe apc_delete_file() or can manually using apc.php

Javascript Math Object Methods - negatives to zero -

in javascript can't seem find method set negatives zero? -90 becomes 0 -45 becomes 0 0 becomes 0 90 becomes 90 is there that? have rounded numbers. just like value = value < 0 ? 0 : value; or if (value < 0) value = 0; or value = math.max(0, value);

web services - how do I make URI of dynamic web reference look in web.config instead of app.config? -

i have class library(dll) has web reference, dynamic. i have copied setting applicationsettings of web.config still keeps referring old uri had set during develoment. any idea how can make take uri of web-service web.config? there no way it's taking value app.config if you're running in web application. seeing default value, not configured value in app.config. to see this, change value in app.config , see if service picks up.

.net - Silverlight: Overriding Mouse Cursor -

is there way mouse cursor set on 1 control overrides mouse cursor on clild controls? currently setting cursor hourglass works, i've got 1 control keeping original cursor. strange children don't respect cursor defined parent life. worst case since effects 1 button try setting cursor programmatically: mybutton.cursor = cursors.hand;

jquery ui - back button not leading to the respective tabs -

i have jquery ui tabs , listings under each tabs .on clicking button of these listings first tab selected,not respective tabs. javascript history being used button leads first tab always. this due bug in jquery tabs plugin: tabs 2 supported functionality, although history plugin needs rewrite first (it doesn't support safari 3 , in general little inflexible) before can build tabs. planned , klaus working on whenever finds time. actual bugs in ui tabs plugin have higher priority though. see jquery tabs .

plugins - Broadcast live video from web-cam via plug-in -

could please suggest me kind of software should use broadcast live video webcam? web-cam connected via usb server. want broadcast video webcam on web-page (html, asp.net - doesn't matter). don't want develop video broadcasting beginning - takes lot of time implement system. i'm looking ready-to-use plug-in/widget site. found ustream.tv, live video start playing delay 2 seconds ... know, it's not real-time. need skype/icq/oovoo... plug-in/widget web-site. these plug-ins exists in internet? p.s. know videolan has activex control. vlc provide me real-time video broadcasting webcam without delays skype? thank you! may probable approaches (i not know delays in cases): use windows media encoder broadcaster. in case not need server software @ all. number of clients restricted 50. use windows media server (if use windows server platform).

Using Microsoft Chart Control in ASP.NET MVC Returns a Blank Image -

using answer generating image controller this post , created controller action return chart image seen below (the x , y values there test data): public filecontentresult historychart() { chart chart = new chart(); string[] currencies = { "zar", "usd", "gbp", "jpy" }; foreach (string currency in currencies) { series series = new series(currency); series.charttype = seriescharttype.fastline; (int x = 0; x <= 30; x++) series.points.addxy(x, (x * 5)); chart.series.add(series); } using (memorystream ms = new memorystream()) { chart.saveimage(ms, chartimageformat.png); ms.seek(0, seekorigin.begin); return file(ms.toarray(), "image/png", "mychart.png"); } } the problem is, image controller returns blank (although return image) im hoping simple ...

How to load Facebook iFrame-App into Application Tab on Profile Page -

how can load working iframe app (tested via http://apps.facebook.com/my-app-name ) application tab on profile page of own fanpage. got tab, didn't see in tab. first time called tab got couple of errors. see nothing. in sourcecode css definitions included. i read, profile tabs can use fbml. right? if true, how can load iframe application fbml profile tab? thanks in advance. marco to add app tab need make sure fill out tab url in app settings. can point app if fits in 520px or create custom ui width. once have done go profile page app: https://www.facebook.com/apps/application.php?id=your_app_id and in bottom corner click on "add page", select page , done.

cocoa - How do I get an NSFont object from a CGFont or CTFont object? -

i dealing loading ttf resource only. this question helped me answer part 1. need nsfont cgfont or ctfont. this mac application. how nsfont cgfont use ctfontcreatewithgraphicsfont . how nsfont ctfont do nothing. have one. nsfont , ctfont toll-free bridged , ctfont nsfont , vice versa.

generics - C# Reflection - How can I tell if object o is of type KeyValuePair and then cast it? -

i'm trying write dump() method linqpad equivalent iin c# own amusment. i'm moving java c# , exercise rather business requirement. i've got working except dumping dictionary. the problem keyvaluepair value type. other value types call tostring method insufficient keyvaluepair may contain enumerables , other objects undesirable tostring methods. need work out if it's keyvaluepair , cast it. in java use wildcard generics don't know equivalent in c#. your quest, given object o, determine if it's keyvaluepair , call print on key , value. print(object o) { ... } thanks! if don't know types stored in keyvaluepair need exercise bit of reflection code. let's @ needed: first, let's ensure value isn't null : if (value != null) { then, let's ensure value generic: type valuetype = value.gettype(); if (valuetype.isgenerictype) { then, extract generic type definition, keyvaluepair<,> : type ba...

asp.net - Session Not working in Generic Handler .ashx in Firefox -

i have created .ashx implemented irequiressessionstate, can create session variables in ashx, worked in ie, doesn't work in firefox. when access session variable other pages it's null. any idea? thx. perhaps don't allow cookies in firefox. check that! if don't want enable cookies, enable cookieless session.

Setting an attribute in Jquery not working -

i have following function limits amount of characters can enter text area. what's meant happen is, if text length higher text limit, set attribute of disabled="disabled" on submit button, isn't getting set, function code follows: function limitchars(textid, limit, infodiv) { var text = $('#'+textid).val(); var textlength = text.length; if(textlength > limit) { $('#' + infodiv).html('you cannot write more '+limit+' characters!'); $('input#submit').attr('disabled', 'disabled'); } else { $('#' + infodiv).html('you have '+ (limit - textlength) +' characters left.'); } } it's $('input#submit').attr('disabled', 'disabled'); bit isn't working. any ideas? i posted a demo , appears work code: $(document).ready(function(){ $('#test').keyup(function(...

java - Set log4j output log file underneath my project Not eclipse -

i use eclipse ide develop project. log have been output myproject/logs/log.log expected, until did setting saw web site. i went windows -> preferences -> java -> build path -> classpath variable add "log4j-1.2.16.jar". since then, log file started showing under d:\eclipse\logs\ instead of d:\workspace\myproject\logs. i have deleted classpath variable entry , restart eclipse, cannot have log file created under project anymore. help!!! thanks. it's best if explictly define path log should go. example if webapp deployed on tomcat can: log4j.appender.yourlog.file=${catalina.home}/logs/my-application.log

doc - Where's the rails release notes or changelog -

rails 3.0.4 released. don't see changelog documents. so rails 3.0.4 changelog? need know if should upgrade apps 3.0.4 3.0.3. there blog post , can read single changelog files https://github.com/rails/rails/blob/3-0-4-security/actionmailer/changelog https://github.com/rails/rails/blob/3-0-4-security/actionpack/changelog https://github.com/rails/rails/blob/3-0-4-security/activemodel/changelog https://github.com/rails/rails/blob/3-0-4-security/activerecord/changelog https://github.com/rails/rails/blob/3-0-4-security/activeresource/changelog https://github.com/rails/rails/blob/3-0-4-security/activesupport/changelog https://github.com/rails/rails/blob/3-0-4-security/railties/changelog you can compare changes between 3.0.3 , 3.0.4 https://github.com/rails/rails/compare/v3.0.3...v3.0.4

android - Why is javascript:history.go(-1); not working on mobile devices? -

first, background: i have application presents search page (html form) user. once criteria have been filled out , search button clicked, results appear beneath criteria section. in list of results, can view detail of individual result clicking link takes new page. within detail page, have included results link so: <a href="#" onclick="history.go(-1);return false">back results</a> this works great in ie8/9, safari, firefox , chrome on desktop. however, not work on android phone, android emulator or iphone 3g. should note when use link on desktop returned seems cached copy of search page results, , i'm placed @ same scroll position within results. on mobile devices, appears though page reloads server, search criteria disappear, , there no results. if has ideas on start looking solution, appreciate it! can provide more detail necessary. thank , regards, cn use: <a href="javascript:history.go(-1)">back results...

C# Design Questions -

how approach unit testing of private methods? i have class loads employee data database. here sample: > public class employeefacade { public employees employeerepository = new employees(); public taxdatas taxrepository = new taxdatas(); public accounts accountrepository = new accounts(); //and on 20 more repositories etc. public bool loadallemployeedata(employee employee) { if (employee == null) throw new exception("..."); bool exists = employeerepository.fetchexisting(emps.id); if (!exists) { employeerepository.addnew(); } try { employeerepository.id = employee.id; employeerepository.name = employee.employeedetails.personaldetails.active.names.firstname; employeerepository.someotherattribute; } catch() {} try { emps.save(); } catch(){} ...

php - How to catch an unexpected error? -

i'm writing script, lot of things go wrong. i'm making if/else statements obvious things, heppen, there way catch something, possible heppen, don't know yet? for example causes error of kind, in middle of script. want inform user, has gone wrong, without dozens of php warning scripts. i need like -- start listening && stop error reporting -- script -- end listening -- if(something went wrong) $alert = 'oops, went wrong.'; else $confirm = 'everything fine.' thanks. why not try...catch? $has_errors = false; try { // code here } catch (exception $e) { // handle exception, or save later $has_errors = true; } if ($has_errors!==false) print 'this did not work'; edit: here sample set_error_handler , take care of error happens outside context of try...catch block. handle notices, if php configured show notices. based on code from: http://php.net/manual/en/function.set-error-handler.php set_error_ha...

Toggling on/off Markers in Google Maps API v3 -

i'm having trouble getting setmap(null); function seems recommending work. i believe may problem way i've implemented markers. if take , let me know if see wrong i'd appreciate it. link: http://www.dougglover.com/samples/uoitmap/v2/ please note: old link above, doesn't go anywhere. the basic problem if want work you've got make mind markerstest object supposed hold. can't seem decide whether elements in markerstest should markers or should arrays tell markers going placed. quoting javascript file, here 2 functions executed when check/clear checkbox: 15 function addtestmarkers(){ 16 for(var in markerstest) { 17 var location = new google.maps.latlng(markerstest[i][1], markerstest[i][2]); 18 marker = new google.maps.marker({ 19 position: location, 20 map: map 21 }); 22 } 23 } 24 25 // removes overlays map, keeps them in array 26 function clearoverlays() { 27 if (m...

Modules function in Erlang -

so, here part of module i'm writing: request(pid, listofdocuments) when is_pid(pid), is_list(listofdocuments) -> io:format("we here~n"), case whereis(jdw_api) of undefined -> [no, api]; apipid when is_pid(apipid) -> io:format("... , here~n"), % (1) won't work: spawn(?module, loop, [pid, listofdocuments]) % (2) won't work, either: ?module:loop(pid, listofdocuments) loop(pid, listofdocuments) % (3) , neither this... end. ... , this: loop(pid, docs) when is_list(docs), length(docs) > 0 -> h = hd(docs), t = tl(docs), io:format("... not here...~w~n", h), case ?mode of sync -> ref = make_ref(), jdw_api ! {self(), ref, doc, h}, ans = loop_sync(ref, [], []), pid ! ans, loop(pid, t); async -> {error, 'async mode not implemented yet', ?file, ?line}; _ -> {'?mode must either async or sync'} end; loop(pid, docs) -...

vb.net - Constructing an object without assigning it in Visual Basic.NET -

i've used vb.net several years now, keep coming across little quirks don't know how work around. curiosity got best of me, ask now: is there way create object without assigning it? for example, have engine class, want instantiate , have whatever needs do. if there's nothing need engine after creating it, have, till now, done like: dim myengine new engine() is there way avoid "dim myengine as" part? can in java. create object " new engine() " in java , not assign anything. why need this? because want create delegate object (hence called "engine") performs functionality, otherwise don't need ever reference it. used have such objects have "public sub perform", have found cumbersome -- i'd rather create object , not worry remembering call perform method. , find aesthetically displeasing create references objects don't intend use. any vb guru have suggestion? thanks, -- michael to need put new...

c++ - Selecting a row in QTreeView programmatically -

i have qtreeview qfilesystemmodel model. the qtreeview has selectionbehavior set selectrows. in code read dataset select , select them via: idx = treeview->model()->index(search); selection->select(idx, qitemselectionmodel::select); this selects cell, not row . . have added stupid workaround, rather fix correct way. for (int col=0; col< treeview->model()->columncount(); col++) { idx = treeview->model()->index(search, col); selection->select(idx, qitemselectionmodel::select); } or ^^ way it? you can select entire row using qitemselection: selection->select ( qitemselection ( treeview->model ()->index (search, 0), treeview->model ()->index (search, treeview->model ()->columncount () - 1)), qitemselectionmodel::select); also if want row selection user clicks need set selection behavior: treeview->setselectionbehavior (qabstractitemview::selectrows)

php - MySql incrementing field with value 0 (zero) -

hy, i have problem when try increment 1 field column of type int(11) has value 0 (zero). here query : update cars set number = number+1 carid='$carid' the problem if value of number 0 result of increment 2. other values increment works fine. any ideas? in advance. later edit: problem not mysql query. guess have bug in code. create pages dynamically (everything goes through index.php file , use require_once include files) , problem appears when access page first time or make ctrl + f5 refresh. have rewrite rules in .htaccess file. rewriterule ^cars/([0-9]+)/([^\n]+)\.html index.php?page=cars&carid=$1&title=$2 [nc,b,l] rewritecond %{the_request} /index\.php\?page=cars&carid=([0-9]+)&title=([^\n]+)\ http/ rewriterule ^index\.php$ http://www.cars.com/cars/%1/%2.html? [r=301,nc,l] any ideas that? it looks common noobish rewrite problem. most people set rewrite to make index.php act 404 handler. so, if there missed request, it'...

c# - How to get complex enum value string representation -

let's have enum: [flags] public enum sometype { val1 = 0, val2 = 1, val3 = 2, val4 = 4, val5 = 8, val6 = 16, = val1 | val2 | val3 | val4 | val5 | val6 } and variables: sometype easytype = sometype.val1 | sometype.val2; sometype complextype = sometype.all; if want loop through values of first enum can do: foreach(string s in easytype.tostring().split(',')) { ... } however, when try apply same approach 'complextype' value 'all', of course valid because it's 1 of possible values of enum. but, there neat way see of values sometype.all created of? know make manual loop through values that: if(complextype.hasflag(manualtype.val1) && ... var result = string.join(",", enum.getvalues(typeof(sometype)) .cast<sometype>() .where(v => complextype.hasflag(v))); you can write extension method avoid repeating yourself.

java - By using ejb3 and jsf do I still have to do jndi lookup? -

i not sure jndi lookup necessary or not in terms of ejb3 technology advantages. appreciated, thanks. yes need to. can use annotations this. @ejb private beaninterface yourbean it injected you. make sure interface annotated @local or @remote. depends on deploy if need specify jndi name in config file or not.

wpf - Workaround for binding expression list on binding group being empty -

in wpf 4 binding expression list on binding group, passed validationrule 's validate method, empty. it same whether autogeneratecolumns true or false, whether datagridboundcolumns explicitly has been added datagrid. in wpf 3.5 sp1 using datagrid toolkit binding expression list filled excepted binding expressions (1 each column in data grid) i consider bug , has posted on microsoft connect site: https://connect.microsoft.com/wpf/feedback/details/642815/bindingexpressions-on-bindinggroup-passed-to-validationrule-in-datagrid-rowvalidationrules-is-empty but have workaround can correct binding expression within validationrule ? in order support "proposed values" not committed target of two-way binding until validation succeeds, wpf 4.0 datagrid redesigned take advantage of the new bindinggroup.sharesproposedvalues feature of wpf 4.0. because of change, no longer necessary use two-way bindings in binding group of display templates. you can use bindi...

java - Setting a timeout for socket operations -

when create socket: socket socket = new socket(ipaddress, port); it throws exception, ok, because ip address not available. (the test variables string ipaddress = "192.168.0.3" , int port = 300 .) the problem is: how set timeout socket? when create socket, how reduce time before unknownhostexception , socket timeout? use socket() constructor , , connect(socketaddress endpoint, int timeout) method instead. in case like: socket socket = new socket(); socket.connect(new inetsocketaddress(ipaddress, port), 1000); quoting documentation connect public void connect(socketaddress endpoint, int timeout) throws ioexception connects socket server specified timeout value. timeout of 0 interpreted infinite timeout. connection block until established or error occurs. parameters: endpoint - socketaddress timeout - timeout value used in milliseconds. throws: ioexception - if error occurs during connection socke...

flex - Spark Combox Memory Leak -

Image
i have simple, reproducable memory leak associated spark combo box, i'm convinced must i'm doing wrong, rather sdk bug. // application.mxml <?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"> <s:layout> <s:verticallayout /> </s:layout> <fx:script> <![cdata[ import mx.events.flexevent; private var haselement:boolean; protected function togglecontainer():void { if (haselement) { button.setfocus(); comboboxcontainer.removeallelements(); haselement = false; } else { var vew:comboboxview = new comboboxview(); ...

php - Is it safe to use a MySQL database for recording positions on a multiplayer game? -

would safe use mysql database record positions of players on screen? then second, flash retrieves new position data in database , sets players' positions of map new positions? i'm not sure how slow be. i know php. know sql. not experienced in actionscript, can basic things set positions of objects. not know how retrieve information database via flash. not know how make flash send out queries. do think give me bit of help? it safe use mysql. but, wouldn't recommend using php + mysql game server though, or server tend lock influx of requests. http protocol not designed this. it might take bit of time, learn easy programming language (especially java or c#) create basic server. can store user information within ram, instead of accessing database repeatedly. but, have server updates database every n amount of minutes, in case server shutdown , needs started same data.

visual-studio-2008 versioninfo for all files updated from one place -

the version information, displayed when mouse cursor hovers on file in windows explorer, set file built visual studio in version resource. set version in 1 place files built solution, preferably when change version in install properties. there way this? the motivation if version not updated file, installer leave previous versions of files instead of replacing them new files. happens when 'removepreviousversions' property set. in order save tedious , error prone task of updating version in every file built , installed, remove version resource files - not elegant. the second answer in stack overflow topic how programatically change project's product version? features solution setting version number common header file in c++. place header file containing hard-coded version numbers in folder each project can find it. the above answer describes means of incrementing version number. alternate approach c++ version incrementing available microsoft's arti...