Posts

Showing posts from May, 2011

android - Horizontal ProgressBar not showing right -

Image
i created xml file containing horizontal progressbar, displays in image below: here's xml: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> <progressbar android:id="@+id/progress" style="@android:style/widget.progressbar.horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:max="100" android:progress="50" /> </linearlayout> what happening? how can fix it? normally should horizon...

How to modify classpath in Eclipse? -

again, saw sentence: a .classpath file snippet can included in project's .classpath has been provided here(ie, link). please use classpathentry's need (see below details). what these sentences mean , how can add code snippet classpath file in eclipse ? please help. i understand want find classpath file . go eclipse , press ctrl + shift + r . type .classpath , select file in project. note: if you're modifying file , don't know is, advise careful :).

Python : how to append new elements in a list of list? -

here simple program: = [[]]*3 print str(a) a[0].append(1) a[1].append(2) a[2].append(3) print str(a[0]) print str(a[1]) print str(a[2]) here output expecting: [[], [], []] [1] [2] [3] but instead : [[], [], []] [1, 2, 3] [1, 2, 3] [1, 2, 3] there not here ! you must do a = [[] in xrange(3)] not a = [[]]*3 now works: $ cat /tmp/3.py = [[] in xrange(3)] print str(a) a[0].append(1) a[1].append(2) a[2].append(3) print str(a[0]) print str(a[1]) print str(a[2]) $ python /tmp/3.py [[], [], []] [1] [2] [3] when a = [[]]*3 same list [] 3 times in list. the same means when change 1 of them change of them (because there 1 list referenced 3 times). you need create 3 independent lists circumvent problem. , list comprehension. construct here list consists of independent empty lists [] . new empty list created each iteration on xrange(3) (the difference between range , xrange not important in case; xrange little bit better because n...

cross platform - WAMP-like package for Node.js? -

i want try what's hot node.js, user of wamp on local environment. push changes centos production server no sweat. there wamp node.js don't have worry mysql , others? the wap part node itself, has integrated web-server. the m part depends on db want use. don't see problems in installing 2 packages on machine (node , db).

iphone - sectionName TableView - What am I doing wrong? -

i'm having trouble changing colour , font on tableview have split 4 sections names etc., can;t seem work i'm not sure doing wrong? - (nsstring *)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section { nsstring *sectionname = nil; switch(section) { case 0: sectionname = [nsstring stringwithstring:@"date"]; break; case 1: sectionname = [nsstring stringwithstring:@"gig"]; break; case 2: sectionname = [nsstring stringwithstring:@"city"]; break; case 3: sectionname = [nsstring stringwithstring:@"country"]; break; } uilabel *sectionheader = [[[uilabel alloc] initwithframe:cgrectmake(0, 0, 200, 40)] autorelease]; sectionheader.backgroundcolor = [uicolor clearcolor]; sectionheader.font = [uifont boldsystemfontofsize:18]; sectionheader.textcolor = [uicolor whitecolor]; sectionheader.text = sectionname; return sectionname; } ...

php - Compare MySQL dates when stored as datetime -

i have tried several mysql queries compare column of dates stored datetime. need create several different queries depending on action taken on form. below example of sql have created: create or replace view franchise_filter select * `c_data`.`franchise_leads` `lead_added` between unix_timestamp(date_sub(now(),interval 3 months)) , unix_timestamp(now()) or create or replace view franchise_filter select * `c_data`.`franchise_leads` `lead_added` <= 2012-06-27 00:00:00 in second example date supplied php using: date("y-m-d 00:00:00", strtotime($date_now, "+6 months")) any appreciated. you close: use ... `lead_added` <= "2012-06-27 00:00:00" (mind quotes) and ... `lead_added` between date_sub(now(),interval 3 month) , now()

ruby on rails - Sinatra route regex constraints? -

i rebuild small rails (too overkill) app in sinatra. have route this: match 'verify/:name/:bundle/:license' => 'verify#index', :constraints => { :bundle => /.*/ } how can rebould in sinatra in terms of constraints attribute? thanks! you can either way: (taken sinatra's documentation ) get %r{/hello/([\w]+)} "hello, #{params[:captures].first}!" end or inside block itself: get '/hello/:name' raise sinatra::notfound unless params[:name].match /\w+/ "hello, #{params[:name]}!" end

java - thread exiting with uncaught exception: NO stack trace -

my application causing force close somewhere instead of getting fatal exception usual (and informative) stack trace in logcat, receive following 4 lines: 06-27 07:08:54.546: d/dalvikvm(14351): gc_for_malloc freed 9923 objects / 657416 bytes in 21ms 06-27 07:08:54.769: w/dalvikvm(14351): threadid=20: thread exiting uncaught exception (group=0x4001d7f0) 06-27 07:08:54.796: w/dalvikvm(14351): threadid=21: thread exiting uncaught exception (group=0x4001d7f0) 06-27 07:08:54.796: i/process(14351): sending signal. pid: 14351 sig: 9 this in debug mode no filters applied on logcat! what causing behavior? is there way tell what's causing exception? update: @assylias below, i've been able implement: final uncaughtexceptionhandler subclass = thread.currentthread().getuncaughtexceptionhandler(); thread.setdefaultuncaughtexceptionhandler(new thread.uncaughtexceptionhandler() { @override public void uncaughtexception(thread paramthread, throwable paramthrowable) { ...

html - Iframe height not adjusting with javascript in newer versions of Internet Explorer -

i have iframe links html page. iframe contained within div. found code auto adjust high depending on contents of iframe. code works fine in firefox , older versions of internet explorer not adjusting height in v7 or later..... javascript: <script type="text/javascript"> function changecontent(){ document.getelementbyid('right').innerhtml = window.frames['contentframe'].document.getelementsbytagname('html')[0].innerhtml; } </script> html: <div class="fl" id="right"> <iframe class="newsframe" id = "contentframe" name = "contentframe" src ="news.html" onload = "changecontent()"></iframe> </div> can help..... try this function resizepanel() { window.console.log("ran resize panel function"); var frame = document.getelementsbytagname('iframe')[0]; if(frame != null) { f...

poco - WPF Wrapper AttachedProperty to follow MVVM -

i have graph control (that provides canvas draw nodes , edges) gives me following properties (non dependency properties) currentitem (that contains single node selected or last node selected in case of multi selection). selection.selectednodes (that contains selected nodes) and event called currentitemchanged. i want bind selection.selectednodes observablecollection of viewmodel , currentitem selectedentity property on viewmodel. since third party, won't able make change in source code of graphcontrol. can write class , attached property in achieve this? if yes, how write property/behaviour (pointers, examples)? can please guide me how wrap non-dependency, clumsy poco binded dependency/attached properties? having read this. regards,

Retrieving data from PHP multidimensional array with JQUERY -

i have array looks in php page: $page["1"] = array("element1","element2","element3","element4"); $page["2"] = array("element1","element2","element3","element4"); $page["3"] = array("element1","element2","element3","element4"); i need retrieve data array in javascript file (jquery). how can import example elements4 $page[1][3],$page[2][3],$page[3][3] ? i have seen many examples here json not one... may can you(filename: getdata.php): <? if($_get['ajax']==1){ $page = array( array("element1","element2","element3","element4"), array("element1","element2","element3","element4"), array("element1","element2","element3","element4"), ...

c# - part names of variable declaration -

i trying extract debug information compiled c program c#, , need store global variables. if have variable: const unsigned char * volatile myvariable; the name of variable myvariable , , type unsigned char . const , volatile . part of type? i have represent variable class , lost on how construct it. how have represented right now: public class myvariable { public string name; public string type; public bool isarray; public bool ispointer; public bool isconstant; public bool isvolatile; // etc... public int size; // in bytes } should make volatile , const part of type? they? attributes? edit sorry think did not explained self correctly. my question should have been how should construct myvariable class know const keyword variable , volatile. use volatile keyword when create variable accessed multiple threads example. anyways based on answers should constructing class as: public class myvariable { public string nam...

c++ - Default template parameters: Why does the compiler complain about not specifying template argument? -

i have code: struct a{}; template<class t = a> struct b { void foo() {} }; b b; //error: missing template arguments before 'b' //error: expected ';' before 'b' //more errors b.foo() if make foo() template function same template 'signature', compiler doesn't complain not specifying template arguments: struct {}; struct b { template<class t = a> void foo() {} }; b b; //ok b.foo() so why need specify argument template class default parameter, not template function? there subtlety missing? the reason because of template argument deduction failure sure. want know why. the correct syntax ( demo ): b<> b; the default argument a assumed class template b . <> part tells compiler b class template , asks take default parameter template argument it.

database - Why do Entity Framework classes need a virtual member of an unrelated class -

easier show example -- i'm using code-first construct database. have following classes: public class blog { public int id { get; set; } public string title { get; set; } public string authorname { get; set; } public list<post> posts { get; set; } public string blogcode { { return title.substring(0, 1) + ":" + authorname.substring(0, 1); } } } public class post { public int id { get; set; } public string title { get; set; } public string content { get; set; } public virtual blog blog { get; set; } } i don't understand why post needs public virtual blog blog. act foreign key in database link blog? seems if case use blog id. it allow 2 tables related , places foreign key on post relating blog . having public virtual blog blog { get; set; } allows reference blog object post object ,...

css - How can I use a background image instead of the IMG tag in html? -

i have following html many of these kinds of links: <a class="button" id="menu"> <img width="16" height="16" src="/images/control-double.png"> </a> i created sprite these images combined using spritegen but when @ seems it's background gives example: .sprite-control-double{ background-position: 0 -396px; width: 16px; height: 16px; } #container li { background: url(csg-4febd28fe3aa3.png) no-repeat top left; } how can use sprite positioning image instead of single image? if use "sprite" technique, don't need img elements within anchors: a.button { background-color: transparent; background-image: url(/images/control-double.png); background-position: 0 -396px; background-repeat: no-repeat; height: 16px; width: 16px; } i added background-color style because in browsers rendering engine not show background image if there no background color. ...

c# - Can I parallelize image processing with PLINQ? -

i want compare alpha channel 1 image ~1000 other images. compare method looks this: public static unsafe double similiarity (bitmap a, bitmap b) { bitmapdata adata = a.lockbits ( new rectangle (0, 0, a.width, a.height), system.drawing.imaging.imagelockmode.readonly, a.pixelformat); bitmapdata bdata = b.lockbits ( new rectangle (0, 0, b.width, b.height), system.drawing.imaging.imagelockmode.readonly, b.pixelformat); int pixelsize = 4; double sum = 0; (int y=0; y<adata.height; y++) { byte* arow = (byte *)adata.scan0 + (y * adata.stride); byte* brow = (byte *)bdata.scan0 + (y * bdata.stride); (int x=0; x<adata.width; x++) { byte aweight = arow [x * pixelsize + 3]; byte bweight = brow [x * pixelsize + 3]; sum += math.abs (aweight - bweight); } } a.unlockbits (adata); b.unlockbits (bdata); return 1 - ((sum / 255) / (a.width * a.height)); } ...

coldfusion - Issue with getting struct keys in Railo -

building application railo , cfwheels. i created form groups of radio buttons. each group having same name , name being array reference e.g (response[1]). there 23 groups. each time submit form , fetch response array keys using either structkeylist or structkeyarray , find number of keys returned, 21. i made dump of keys find out result of 2 groups combined. i tried same code adobe coldfusion , works fine. 23 responses distinct values.

jsf 2 - Using @Interceptor in @ManagedBean -

interception cdi works in @named , doesn't in @managedbean: logable.java @interceptorbinding @retention(runtime) @target({type, method}) public @interface logable { } logginginterceptor.java @logable @interceptor public class logginginterceptor { @aroundinvoke public object log(invocationcontext ctx) throws exception { //log smth. ctx. } } workingbean.java @named @logable public class workingbean implements serializable { //works : methods logged } beans.xml <?xml version="1.0" encoding="utf-8" standalone="yes"?> <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> <interceptors> <class>logginginterceptor</class> </interceptors> </beans> viewscopedbean.java @logable @managedbean publi...

.net 4.0 - DataAnnotations: Visual Studio does not let to override RequiresValidationContext property -

Image
i trying implement custom validation attribute inheriting validationattribute , found strange thing. custom attribute requires validation context, i've looked @ r# decompiled source of validationattribute , saw, need override in custom attribute class: public virtual bool requiresvalidationcontext { { return false; } } now fun part - visual studio 2012 not let me that, telling me there's no such property override, although when running project, in debug view can see property. interesting thing is, in reference path see: c:\program files (x86)\reference assemblies\microsoft\framework.netframework\v4.0\system.componentmodel.dataannotations.dll but in r# decompiled file different path: assembly location: c:\windows\microsoft.net\framework\v4.0.30319\system.componentmodel.dataannotations.dll so, compiler uses different dll runtime. so, i've tried switch reference dll 1 r# decompiles, looks vs2012 replacing it's version anyway, in projec...

c# - change image source on click -

i've made custom image checkbox , want switch between checked , unchecked version every time image clicked. sourcecode: xaml <checkbox name="checkbox1" padding="0" borderthickness="0" margin="5" grid.row="1"> <image name="image1" margin="-14,0,0,0" source="checkbox0.png" mousedown="image_mousedown" stretch="uniform"/> </checkbox> c# private void image_mousedown(object sender, mousebuttoneventargs e) { if (e.leftbutton == mousebuttonstate.pressed) { if (checkbox1checked) { image1.begininit(); image1.source = new bitmapimage(new uri("/checkbox0.png", urikind.relativeorabsolute)); image1.endinit(); checkbox1checked = false; } if (!checkbox1checked) { image1.begininit(); image1.source = new bitmapimage(new uri(...

c# - How to use for loop to scan all controls in ASP .NET page? -

foreach (control ctrl in page.controls) { if (ctrl textbox) { if (((textbox)(ctrl)).text == "") { helpcalss.messagebox("please fill empty fields", this); return; } } } i'm using asp.net , have inserting page texboxes , need check if texboxes in page empty , if need show message box empty textbox here a article on it , below modified version collects controls given property public list<control> listcontrolcollections(page page, string propertyname) { list<control> controllist = new list<control>(); addcontrols(page.form.controls, controllist, propertyname); return controllist; } private void addcontrols(controlcollection controlcollection, list<control> controllist, string propertyname) { foreach (control c in controlcollection) { propertyinfo propertytofind = c.gettype().getproperty(pr...

xml - BizTalk Custom Pipeline Component: XmlException crossed a native/managed boundary -

Image
i'm not entirely sure if exception custom pipeline component have created or not. have loaded code in vs2010 , attached btsntsvc.exe before hit first break point error: there no disassembly view , code (for component) works fine in console application same input file. this pipeline component on receive port. ideas? thanks add temporary debugging code pipeline component. write eventlog show helpful information debug with. have turned on tracing in biztalk see inputs , outputs are?

node.js - What are common development issues, pitfalls and suggestions? -

i've been developing in node.js 2 weeks , started re-creating web site written in php. far good, , looks can same thing in node (with express) done in php in same or less time. i have ran things have used such using modules, modules not sharing common environment, , getting habit of using callbacks file system , database operations etc. but there developer might discover lot later pretty important development in node? issues else developing in node has don't surface until later? pitfalls? pros know , noobs don't? i appreciate suggestions , advice. here things might not realize until later: node pause execution run garbage collector eventually/periodically. server pause hiccup when happens. people, issue not significant problem, can barrier building near-time systems. see does node.js scalability suffer because of garbage collection when under high load? node single process , default use 1 cpu. there built-in clustering support run multiple processes (...

Write a complex array of custom structs to file Objective C -

i need save , load contents of array of structs, know objective c particular data types can read/write with. here struct: struct scourse { nsmutablearray* holes; // holds integers (pars) nsstring* name; int size; bool inuse; }; @interface coursesmanager : nsobject { struct scourse courses[5]; } what data types i'll need use? each have different methods needed in order read/write? i'm looking non-complex way data need , file. quite in language i'm more familiar (c++), of particulars of objective-c still lost on me. edit: solution (thanks help, everyone) -(void)applicationwillresignactive:(uiapplication *)application { // save courses nsmutablearray* totalwritearray = [[nsmutablearray alloc] initwithcapacity:max_courses]; (int = 0; < max_courses; ++i) { struct scourse savecourse = [coursesmanager getcourseatindex:i]; nsnumber* ninuse = [nsnumber numberwithbool:savecou...

java - Extending Eclipse JDT -

i'm trying write plugin alter (more add) functionality of current eclipse java debugger. details of trying accomplish, can see thread: writing custom eclipse debugger . i'm making new question address confusion on specifics of how eclipse plugins work. so if wanted adjust debugger (or part of jdt), understanding allows happen via plugins known extension points, points grant access extending functionality , control can or cannot extent. first question is, correct understanding of concept, , if how find these extension points (and starting point specific debugging problem)? my second question regarding debugger, if wanted how pull data debugger (like variable/stackframe information, information displaying out user) , use in own plugin, possible/how begin approach (is matter of extension points)? i've looked through eclipse debugger source code, , have general idea of whats going on in debugging process, how plugin communicate/pull data debugger receiving in debuggin...

Infinite login loop on Facebook app using Javascript SDK -

i built app based on 1 of facebook developer sample apps, few days ago both app , facebook sample app stopped working users - go infinite loop after login: http://myfbse.com/socialmovies/ here link sample code have been using: https://developers.facebook.com/blog/post/2011/03/18/how-to--use-the-graph-api-to-pull-the-movies-friends-like/ i have tested on several computers, different browsers, tried add , remove apps facebook account , cleared cookies etc. i'm wondering how can find out problem is, migration issue, bug or else? ran app through facebook debugging tool , didn't flag problems. there way more detailed information causing issue? thanks i fixed infinite loop replacing auth code facebook developer sample app auth code here: https://developers.facebook.com/blog/post/525/ i guess sample auth code out of date.

Rails 3.2.6 - Running rake assets:precompile and getting an error with form_for -

when try run rake assets:precompile keep getting error: rake aborted! /new-ui/app/views/account_assets/_form.html.erb:1: syntax error, unexpected ')' _erbout = ''; _erbout.concat(( form_for @asset |f| ).to_s) the code referencing simple partial such: <%= form_for @asset |f| %> <% if @asset.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@asset.errors.count, "error") %> prohibited asset being saved:</h2> <ul> <% @asset.errors.full_messages.each |msg| %> <li><%= msg %></li> <% end %> </ul> </div> <% end %> <div class="field"> <%= f.label :account_id %><br /> <%= f.number_field :account_id %> </div> <div class="field"> <%= f.label :asset_name %><br /> <%= f.text_field :asset_name %> </div> <div class="field"> <%= f.label :asse...

asp.net - Special characters turns into � symbol on Internet Explorer -

in asp.net project have encoding problem. pages runs correctly except 1. when try querystring parameters special characters turns � symbol. i did described in here url encode behaving differently in firefox , internet explorer , here http://blog.salientdigital.com/2009/06/06/special-characters-showing-up-as-a-question-mark-inside-of-a-black-diamond/ dont work. why 1 page run incorrectly when others run without problem? browser except ie run perfectly, , weird thing ie throws error in 1 aspx page.

Find files/folders that are modified after a specific date in Python -

problem ; find files/folders changed after specific date directory structure , copy these location (as stated in title well) (: by following ; def mod(): """find files modified today, given file path.""" latest = 0 = time.strftime('%y-%m-%d', time.localtime()) dir = "/home/y33t/" fname in os.listdir(dir): if fname.endswith(''): modtime = os.stat(os.path.join(dir, fname)).st_mtime if modtime > latest: latest = modtime out = time.strftime('%y-%m-%d', time.localtime(latest)) if out == now: print fname, "has changed today. " else: pass i can determine files changed @ specific date , copy these location. achieve keep directory structure well. example following ; /testfolder ..somefile1 ..somefile2 ../testfolder2 ....somefile3 ....somefi...

How to replace with expanded tab in vim -

i don't have problem, i'm curious. here part of .vimrc. set tabstop=4 set shiftwidth=4 set expandtab i want replace in text notab <-here tab so command should : :%s/notab/^i<-here tab/ wich give me real tab, in order replace 4 space in need call :retab same results in single call (directly add 4 spaces): :%s/notab/ <-here tab/ but not convenient, first version include real tab in text, wich need te retabed , second version depends on number of space defined 1 tab. is there generalistic way it? i think should want: :%s/notab/\=repeat(" ", &tabstop)/ge

python - Loop through dictionary with django -

in django, have dictionary, contains dictionary, example: d['dict1'] = [('1', 'some information'), ('2', 'some information')] d['dict2'] = [('1', 'some more information'), ('2', 'some more information')] and need loop through it, each time loops through grab value of dict1 , dict2 corresponding loop.counter, example first time through output 1 3 , 2 4 , on , forth i tried doing: {% item1, item2 in d.items %} {{ item1.forloop.counter.value1 }} {{ item2.forloop.counter.value1 }} {% endfor %} and produces nothing. edit: updated dict looks like you should turn this: d['dict1'] = [('value1', '1'), ('value2', '2')] d['dict2'] = [('value1', '3'), ('value2', '4')] into this: result = [('value1', '1', '3'), ('value2', '2', '4')] you can in view. preparing...

php - Combine multiple column values in to single value in SQL select statement -

i have autocomplete field user can enter lastname firstname middlename in same order. using lastname firstname middlename (as term) have show autocomplete dropdown. on database have 3 columns firstname lastname , middlename. have compare 3 column values (asc_lastname, asc_firstname, asc_middlename) of same row user input (term). here sql query. please correct mistake. $rs = mysql_query( "select asc_lastname, asc_firstname, asc_middlename issio_asc_workers inner join issio_workers_asc_sc_list on issio_asc_workers.lname_fname_dob=issio_workers_asc_sc_list.lname_fname_dob issio_workers_asc_sc_list.center_id='$cid' , issio_workers_asc_sc_list.center_user_type = '31' , issio_workers_asc_sc_list.center_status <> 'deleted' , (issio_asc_workers.asc_lastname+' '+issio_asc_workers.asc_firstname+' '+issio_asc_workers.asc_middlename) '". mysql_real_escape_string($term) ."%' order issio_asc_workers.lname_fname_do...

asp.net mvc 3 - MVC3 referencing foreign key during display/edit and ADO.NET Entity Data Model? -

i'm new mvc programming , developing application. have following problem i'm short of ideas how solve (though i've read similiar topics here). want in view display value foreign key column (instead of fk value, take column value related table). i'm not sure how achieve (through model linq statement, create view model, in controller, view?). knowledge in asp.net short appreciate more detailed answer how make it. thank in advance ! check bellow case. i have following tables in database: create table [dbo].[tbl_manager]( [manager_id] [int] identity(1,1) not null, [first_name] [varchar](50) null, [last_name] [varchar](50) not null, [team_id] [int] not null, create table [dbo].[tbl_team]( [team_id] [int] identity(1,1) not null, [name] [varchar](50) not null, i use ado.net entitiy data model create class tbl_manager. in model class have following method (maybe should return ilist): public partial class tbl_manager { public static iqueryable<tbl_manager>...

Creating AngularJS directive with Plupload -

i'm working on app have file uploads. want create reusable file upload component can included on of pages need file upload functionality. thinking use jsp tag. however, discovered angularjs , want use throughout app. so, want create directive allow me put <myapp-upload> tag stick in upload functionality. i first made upload functionality it's own html page make sure angularjs playing nicely plupload plugin. put this: <html ng-app="myapp"> <head> <script src="resources/scripts/angular-1.0.1.min.js"></script> <script src="resources/scripts/myapp.js"></script> </head> <body> <style type="text/css">@import url(resources/scripts/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css);</style> <script type="text/javascript" src="resources/scripts/jquery-1.7.2.min.js"></script> <script type="text/javascript...

maven - Getting ClassNotFoundException in test scope -

i'm trying run tests webapp. i've used spring , hibernate it. running mvn package results in classnotfoundexception in test tasks: java.lang.classnotfoundexception: org.apache.commons.dbcp.basicdatasource i tried adding pom.xml, without success: <dependency> <groupid>commons-dbcp</groupid> <artifactid>commons-dbcp</artifactid> <version>1.4</version> <scope>test</scope> </dependency> what here? update mvn -x clean package : http://paste.ubuntuusers.de/raw/409407/ i don't see problem dbcp here. rather log says problems autowiring spring beans, starting missing com.example.model.articleservice . declare such missing beans spring components , should ok.

javascript - Circle Collision Detection HTML5 Canvas -

i want check if circles colliding each other. i know can getting distance between 2 centers of circles , subtracting radius of each circle distance , seeing if 'distance' > 1. how can efficiently though say, 1000 circles? maybe can somehow nearest 20 circles or , check these? don't know how begin go efficiently though either.. any ideas? here example: http://experiments.lionel.me/blocs/ before start calculating exact differences in distances, can @ least compare x/y positions of centers v.s. radii. information implicitly available in circle , requires simple comparisons , addition/subtraction. that'll let compare simple distances in x/y between circle pairs, , throw away not collision candidates, e.g. abs(x2 - x1) > (r2 + r1) abs(y2 - y1) > (r2 + r1) ... if distance in x or y between circle centers greater sum of radii, cannot colliding. once you've whittled down possible colliders, formal exact cartesian distance, 'heavy...

ruby on rails - Adding many photos to a record. Can't mass-assign protected attributes: -

i'm trying add photos app using paperclip. mug can have many photos. when try save new mug error: activemodel::massassignmentsecurity::error in mugscontroller#create can't mass-assign protected attributes: mugphoto mug.rb class mug < activerecord::base attr_accessible :name, :mugphotos_attributes has_many :mugphotos accepts_nested_attributes_for :mugphotos, :allow_destroy => true end mugphoto.rb class mugphoto < activerecord::base belongs_to :mug has_attached_file :mugphoto, :styles => { :thumb => "100x100#" } end mug new.html.erb <%= form_for @mug, :html => { :multipart => true } |f| %> <p>name: <br> <%= f.text_field :name %></p> <%= f.fields_for :mugphoto |photo| %> <p>photo: <br> <%= photo.file_field :mugphoto %></p> <% end %> <div class="button"><%= submit_tag %></div> ...

android - Use TextSwitcher with custom Typeface -

i use textswitcher opposed textview because of animations available, know how use custom typeface text? don't want use default font. just use android:fontfamily attribute each child textview . <textswitcher . . .> <textview android:fontfamily="..." . . . /> <textview android:fontfamily="..." . . . /> </textswitcher> the textswitcher alternate between 2 textview children, using font family (typeface) specify.

Java conditional imports -

how have conditional imports in java have ifdefs in c intend achieve ifdef test import com.google.mystubs.swing; elif import javax.swing.*; endif you don't have conditional import java but conditionally use different classes same name using qualified name for example: if(usesql){ java.sql.date date = new java.sql.date() }else{ java.util.date date = new java.util.date() }

iphone - Compile Source Xcode to send Xcode Project -

i need send off iphone app xcode project agency not want them able see source code of project, how compile project , send agency able submit project apple not see source code? thanks in advance, daniel you can create archive file , send instead of sending xcode code. you can check thread , know how can create archive file (ipa file)- xcode 4: create ipa file instead of .xcarchive

sql - How do I create a trigger to insert a value into an ID field that is Max([ID Field])+1 on insert -

when add new record want sql server automatically add fresh id. there records have been migrated on (from access) , until finish preparing server other required functionality manually migrating further records on (if affects possible answers). what simplest ways implement this. the simplest way make column identity column . here example of how this (it's not simple alter table ).

php - Magento Custom Shipping Module multiple rates not working -

Image
edit it looks called rate code returning same thing of shipping options. looks need find way define reate code each shipping option. end edit i created custom shipping module in magento ups freight shipping. needed options freight + lift gate, freight + residential, , freight + lift gate & residential. per response on board, instead of having checkbox each of these options create separate methods. as can see image, magento calculating prices correctly. issue have when select 1 of options , hit "update total", reverts first option lowest price. after inspecting inputs on radio buttons, found have same value. <ul> <li> <input name="estimate_method[2]" type="radio" value="excellence_excellence" id="s_method_excellence_excellence_2" class="radio"> <label for="s_method_excellence_excellence_2">freight<span class="price">$678.88</span></label...

playframework - Deserializing from JSON back to joda DateTime in Play 2.0 -

i can't figure out magic words allow posting json datetime field in app. when queried, datetime s returned microseconds since epoch. when try post in format though ( {"started":"1341006642000","task":{"id":1}} ), "invalid value: started". i tried adding @play.data.format.formats.datetime(pattern="yyyy-mm-dd hh:mm:ss") started field , posting {"started":"2012-07-02 09:24:45","task":{"id":1}} had same result. the controller method is: @bodyparser.of(play.mvc.bodyparser.json.class) public static result create(long task_id) { form<run> runform = form(run.class).bindfromrequest(); (string key : runform.data().keyset()) { system.err.println(key + " => " + runform.apply(key).value() + "\n"); } if (runform.haserrors()) return badrequest(runform.errorsasjson()); run run = runform.get(); run.task = task.find.by...

PHP access array within simpleXML -

i have soap request returning array of ids. reason, having trouble accessing array within simplexml element. i did vardump of simplexml object: die(var_dump($polist)); object(simplexmlelement)#7 (1) { ["int"]=> array(10) { [0]=> string(5) "20622" [1]=> string(5) "20868" [2]=> string(5) "20880" [3]=> string(5) "20883" [4]=> string(5) "21034" [5]=> string(5) "21065" [6]=> string(5) "21136" [7]=> string(5) "21160" [8]=> string(5) "21202" [9]=> string(5) "21247" } } and var dump of though array: die(var_dump($polist->int)); object(simplexmlelement)#8 (1) { [0]=> string(5) "20622" } how access array? simplexmlelement implements traversable , should able do: foreach( $polist->int $el) echo $el; or possibly query array xpath: $array = $polist->xpath( '/int')[0]; foreach( $array $el) e...

php - Fatal error: Call to a member function prepare() on a non-object PDO -

i trying move sql working pdo showing following fatal error: call member function prepare() on non-object in /home/content/58/9508458/html/pa/test. php on line 12 orginal code <?php $pdfreq=$_get['dadi']; include('config.php'); require('fpdf.php'); $link =mysql_connect($db_host,$username,$password); mysql_select_db($db_name); $update = "update mastertable set pdfstatus =1 id_pk = $pdfreq"; mysql_query($update, $link); replaced with <?php $pdfreq=$_get['dadi']; include('config.php'); require('fpdf.php'); $link =mysql_connect($db_host,$username,$password); mysql_select_db($db_name); $sql = "update mastertable set pdfstatus=?, id_pk=?"; $q = $link->prepare($sql); $q->execute(array(1,$pdfreq)); your $link variable not pdo object. should replace: $link = mysql_connect($db_host,$username,$password); mysql_select_db($db_name); with: $link = new pdo("mysql:dbname=$db_name;ho...

Hard timeouts using celery with django -

building on question: django celery time limit exceeded? i have tasks may run sometime. however, tasks should not take more few seconds. don't want set global timeout account long running tasks. rather, have global hard timelimit short, , manually adjust tasks need have longer timeout. when decorating task @task did @task(timeout=none) , yet, task still hit timeout of 300 seconds. called task task_function.delay(args). is there way call task , customize it's timeout? this issue addresses case when can call task custom timeouts. implemented in issue802 branch isn't in master yet. can merge master , use desired functionality. with patch, can pass timeouts when calling tasks. tasks.add.apply_async(args=[1,2], soft_timeout=2, timeout=5)

Rails Form Renders Twice -

Image
sometimes when submit form , go in browser renders entire form twice (see screenshot).. not sure if view or controller code causing cant seem figure out. thanks occasions_controller.rb def create @user = current_user @occasion = occasion.new(params[:occasion]) @occasion.user = user.find(current_user.id) if @occasion.save redirect_to occasions_path else render :new end end user_steps/occasions.html.erb <%= simple_form_for @user, url: wizard_path |f| %> <div id="single_module"> <div class="pitch"> <h2 class="signup">step 3: first occasion!</h2> </div> <div id="input1" style="margin-bottom:4px;" class="clonedinput"> <p>*just 1 started, after completion of sign process have chance utilize our occasion wizard add many events like! (exciting, know)</p> <ul class="testss1"> <%= f....

parsing java using php or java? -

i building web application in end needs parse java file , save values in database. has triggered user , set on schedule. what best way of doing this? should using php or java? know how parse file in both languages java has reflection make easier , reduce likelihood of error have no idea call java file front end e.g. onclick of button. the front end technologies i'm looking use html, css, javascript , ajax. i'm not looking use struts e.t.c not familiar them , limited on time. thanks reflection not in case, because need parse code (java in case) , interpret which. therefore need build ast of file. ast (abstract syntax tree) build in java using eclipse jdt . on maven central : <dependency> <groupid>org.eclipse.jdt</groupid> <artifactid>org.eclipse.jdt.core</artifactid> <version>3.12.2</version> </dependency> eclipse jdt document model compared dom tree, dom tree can access elem...

How can I make my font larger in PHP? -

i have php file gets xml data, font displayed small. found can increase it, size 7. there way make 90pt. font instead? here have goes size 7: <font face="helvetica, arial" color="white" size="7"> <?php $mydata = simplexml_load_file('http://192.168.xx.xxx:yyyy/data.xml'); echo '<p align="right">'.round($mydata->device[14]->value).'</p>'; ?> </font> size="90pt" read cascading style sheets reference.

objective c - Logging incorrectly spelt words in OSX -

i'm looking api or library provides me spellchecking functionality. want log words misspelled using native mac spellchecker. have dyslexia , want develop software application helps myself , others learn , practice orthography. does know how achieve this? i think you're looking nsspellchecker . allows pass strings , check spelling , guesses word. think want subclass nstextview or nstextfield , override either didchangetext or controltextdidchange respectively. in check spelling, give visual queues user , track misspelled words in own data source.

objective c - General tutorial on OS X audio programming -

i simple audio programming on os x (using lion , xcode 4.3) -- synthesizing tones given frequencies, mainly. trouble is, apple's documentation on subject way high-level current knowledge of subject. i've searched weeks me started, no avail. does know of core audio basic tutorial, or sample code, me simple core audio tasks can progress understanding apple documentation? i suggest book learning core audio there sample code book @ site.

java - JButtons appearing and disappearing with mouse -

when add several jbuttons jframe, buttons appear , disappear mouse movements...kinda spooky. ideas? other projects dont have issue, therefore im pretty sure code...but simple im not sure whats wrong! full code: (i blurred out name) package explorerplus; import java.awt.borderlayout; import java.awt.container; import java.awt.toolkit; import java.io.file; import javax.swing.*; public class explorerplus { //declarations toolkit t = toolkit.getdefaulttoolkit(); jframe f = new jframe(); public static void main(string[] args) { swingutilities.invokelater(new runnable() { public void run(){ explorerplus ep = new explorerplus(); } }); } private explorerplus(){ // f.super(""); f.setundecorated(false); f.setsize(t.getscreensize()); f.setdefaultcloseoperation(f.exit_on_close); container c = null; c =new jscrollpane(c); f.setcontentpane(c); f.setvisible(true); gothrough(new file("c:/users/*****/pict...

java - Simple XML parse XML to List -

i use simple xml (simple-xml-2.6.2.jar) parse xml file like: <?xml version="1.0" encoding="utf-8" ?> <orderlist> <order id="1"> <name>name1</name> </order> <order id="2"> <name>name2</name> </order> </orderlist> the root element contains subelements. wanna arraylist, how it? here's possible solution, hope helps you: annotations of order class: @root(name="order") public class order { @attribute(name="id", required=true) private int id; @element(name="name", required=true) private string name; public order(int id, string name) { this.id = id; this.name = name; } public order() { } // getter / setter } example class, containing list: @root(name="elementlist") public class example { @elementlist(required=true, inl...