Posts

Showing posts from May, 2014

xamarin.ios - Adding a Contact with the Google Contacts .NET API -

i using following code add contact, following unhandled exception: google.gdata.client.gdatarequestexception: execution of request failed: http://www.google.com/m8/feeds/contacts/default/full gdatacredentials mycred = new gdatacredentials("myusername", "mypassword"); requestsettings myrequestsettings = new requestsettings("macpapa-googlecodetest3-1", mycred); contactsrequest mycontactrequest = new contactsrequest(myrequestsettings); contact mycontact = new contact(); mycontact.title = "be dazzle"; phonenumber myphonenumber = new phonenumber("805-453-6688"); myphonenumber.rel = contactsrelationships.isgeneral; myphonenumber.primary = true; mycontact.phonenumbers.add(myphonenumber); email myemail = new email("man@gmail.com", contactsrelationships.ishome); email myemail2 = new email("mantest@gmail.com", contactsrelations...

php - Smart URLs using SQL table variable -

i know if possible generate smart urls through apace mod-rewrite in php website passing value of sql variable. thanks! this example apply to /customer/detail/1234 , map to /customer/detail.php?id=1234 rewriteengine on rewriterule ^/customer/detail/([0-9]+)$ /customer/detail.php?id=$1 you may want consider mvc framework other reasons in addition automating one.

c# - Setting the cursor position in a NumericUpDown Control -

i have created user control tha inherits numericupdown control. possible set cursor position within control? validating text onkeyup, , formatting when meets criteria. have me.text = fomatted(me.text), sets cursor position 0, want set end of text area. thanks use yournumericupdown.select(desiredposition,0)

tsql - SQL Server 2000 Update based on nested SELECT with TOP -

i trying update sql table x amount of rows ordered query, x balance of 100000 - previous result. using rowcount limit number of results due x being parameter don't think works. can suggest fix or alternative without cursors? declare @top int set @top = 100000 - @countrecords set rowcount @top update updatetable set updatefield = 'somevalue' id in ( select top 100% id selecttable (selectfield1 null) , (selectfielddate not null) order selectfielddate ) set rowcount 0 set rowcount applies intermediate results can misleading if load temp table, can bypass separating update 2 steps declare @top int set @top = 100000 - @countrecords set rowcount @top select id #foo selecttable (selectfield1 null) , (selectfielddate not null) order selectfielddate ...

eclipse - How do I get Tycho? -

tycho supposed plug-in maven building eclipse plug-ins. i have found various blogs , other articles it, contained links tycho dead or not accessible general public, example: http://www.sonatype.com/people/2009/04/tycho-040-roadmap/ the thing found project proposal on eclipse site, doesn't reference downloads: http://www.eclipse.org/proposals/tycho/ i found svn repository, seems extremely dated: http://svn.codehaus.org/m2eclipse/tycho/trunk/ so question is: tycho from? or dead , should stop bothering? i doubt it's dead, since found out there talk on jax2010 ... tycho not dead @ (it has indeed been submitted become eclipse project) hosted (and actively developed) on github: http://github.com/sonatype/sonatype-tycho more links readme.md : tycho homepage http://tycho.sonatype.org/ tycho wiki https://docs.sonatype.org/display/tycho/index tycho bug tracking https://issues.sonatype.org/browse/tycho building tycho sources http://docs.sonatype.org/displ...

cakephp - php menu generated from a db -

i have database products organized categories , subcategories. thing generate menu querying categories table. because categories same(they can change/add once month or something), don't think have query database each access of web-page. have better idea me? many thanks! ps: i'm using cakephp framework, answer/idea doesn't have relate it. find memcache i think in instance use combination of action caching , view caching. won't go vagaries of different caching engines, basics solve problem. the first thing need turn caching on. in app/config/core.php , you'll need make couple changes. first, comment out cache.disable line: //configure::write('cache.disable', true); second, uncomment cache.check line: configure::write('cache.check', true); finally, you'll need make cachehelper available views, add $helpers member definition in app/app_controller.php : class appcontroller extends controller { var $helpers = array...

WPF: Turning off animations, data binding temporarly for invisible objects?;) -

i have window contains tab control - multiple sheets visualizations on them. visualtizations are: possible resource intensive during rendering relying on constant data updates update underlying models obviously 1 sheet can visible every time ;) anyone knows of way turn off visualization, animations, data binding control / panel , it's contained controls? if find way that, turn off invisible sheets , reactivate them needed. the models must kept running - of visual stuff pretty complex , relies on constant data updates, , recalculating when switches tabs hard. did see, visualization executed while control not visible? expect operations neccessary visible parts executed, i'm not sure. for case have deactivate animations manually, found this . think should possible modify given example requirements.

email - How to receive mail using python -

i receive email using python. far have been able subject not body. here code have been using: import poplib email import parser pop_conn = poplib.pop3_ssl('pop.gmail.com') pop_conn.user('myusername') pop_conn.pass_('mypassword') #get messages server: messages = [pop_conn.retr(i) in range(1, len(pop_conn.list()[1]) + 1)] # concat message pieces: messages = ["\n".join(mssg[1]) mssg in messages] #parse message intom email object: messages = [parser.parser().parsestr(mssg) mssg in messages] message in messages: print message['subject'] print message['body'] pop_conn.quit() my issue when run code returns subject not body. if send email subject "tester" , body "this test message" looks in idle. >>>>tester >>>>none so appears accurately assessing subject not body, think in parsing method right? issue don't know enough these libraries figure out how change returns both subject ...

What RFCs need to be considered in developing an IMAP client? -

in theory, set of request comments (rfc) contain developer needs know build imap client. however, not easy know rfcs need considered , ones can ignored. does have rfc roadmap steer developers through this? rfc roadmap, mean: a complete list of rfcs need read , understood, in order develop imap client. an indication of rfcs no longer need considered, because have been superseded. a summary of relevant rfcs. detail on how relevant rfcs interrelate each other. an indication of logical order read , understand relevant rfcs. the roadmap reasonably short. start imap 4rev1 rfc, rfc 3501 . has normative references appendix lists rfcs directly depends on, , references rfcs in appropriate places in document. the crucial ones -- can read them in order -- internet message format (i'd recommend rfc 5322 instead of rfc 2822 more up-to-date), mime rfcs ( rfc 2045 , 2046 , , 2047 ), content-disposition ( rfc 2183 ), tls ( rfc 2595 ), , utf-7 ( rfc 2152 ) handle non-as...

objective c - -fobjc-nonfragile-abi2 on LLVM compiler 2.0: unknow argument? -

i tried built project on xcode llvm compiler 2.0 , gives error: error: unknown argument: '-fobjc-nonfragile-abi2' i'm not familiar llvm compilers, has solution? removing argument doesn't solve problem, because code has errors in situation. that option no longer necessary default setting in latest version of llvm.

python - Problem with django nose and south having multiple databases -

i had django project 1 database (default). south installed generating migration scripts , nose test framework. models built on database. tests run successfully. subsequently, needed connect second database (legacy), added databases configuration. access database using raw sql , no models. while trying run running tests, noticed that: nose creates test database legacy database default django tables (auth_... etc) created in database south runs migration scripts against legacy database , fail so what disable creation of test legacy database , running of migration scripts on it. ideally, create tables in test legacy database myself issuing raw sql create-insert statements. possible? thank help. your path of least resistance write own test running management command. can either override existing command or create separate command desired behavior. the docs creating custom management commands can found on official django docs , can find decent example of overrid...

android - may i use gdata for mobile calendar -

i want add, delete, update mobile calendar events. may use gdata it. if yes code is public void start() { try { calendarservice calservice = new calendarservice("mycalendarinter");\\ line no 1 calendarfeed resultfeed = calservice.getfeed(new url("content://calendar/calendars"), calendarfeed.class); } catch (exception e) { // todo auto-generated catch block e.printstacktrace(); } } i using gdata 1.41.1 , google android api level 3 exception in line number 1 is java.lang.verifyerror: com.google.gdata.client.service reason of using gdata https://stackoverflow.com/questions/2713652/android-problem-deleting-event-in-calender till gdata not supported on android. http://code.google.com/p/android-gdata/ no g data libraries available.

javascript - adding clickable image links to jquery code -

i show images simple script shown below. how can make images clickable? thank you! $(function() { $('.fadein img:gt(0)').hide(); setinterval(function() { $('.fadein :first-child').fadeout().next('img').fadein().end().appendto('.fadein'); }, 4000); }); $(function() { $('.fadein img:gt(0)').hide(); $('.fadein img:gt(0)').click(function() { window.location.href = 'http://www.google.com'; }); setinterval(function() { $('.fadein :first-child').fadeout().next('img').fadein().end().appendto('.fadein'); }, 4000); });

ruby on rails - How to create links between two tables -

ok i'm starting on normalising database. have 1 model "products" populated 60,000 products via data feed (xml), contains product category name , merchant name. want split these 3 models; products, categories , merchants. each product has 1 category , 1 merchant natural idea create these models: category_id | category_name merchant_id | merchant_name i can work out code associate between models i.e. has_one, belongs_to etc i'm struggling work out automatically associate new product category , merchant programatically. i've seen examples in books start empty database , seems pretty straightforward. however, i'm starting off full database , list of category names. here product creation statement working great: product.create(:name => node.xpath("./text/name/text()").inner_text.downcase, :description => node.xpath("./text/desc/text()").inner_text, :brand => node.xpath("./bra...

Linux service and Source for cron job -

i new linux , writing service in c++ spawns multiple threads , starting service calling init.d, how should send terminate signal application script , service terminates threads , exits. and can find source code linux services. e.g. /etc.init.d/rc5.d/s14cron . helpful in understanding how implement service. the classic reference kind of question steven's "advanced programming in unix environment". can find source code text book here .

C# Throw Exception on use Assert? -

i have system employeeid must alway exist unless there underlying problem. the way see it, have 2 choices check code: 1: public void getemployee(employee employee) { bool exists = employeerepository.verifyidexists(employee.id); if (!exists) { throw new exception("id not exist"); } } or 2: public void getemployee(employee employee) { employeerepository.assertifnotfound(employee.id); } is option #2 acceptable in c# language? i because it's tidy in don't looking @ "throw new exception("bla bla bla") type messages outsite class scope. as rule, should throw exceptions in exceptional circumstances. since 1 such circumstance, throwing exception right thing do.

Populate MATLAB array with the same values -

in haskell , if wanted 10 element list contained number 5, this: take 10 $ repeat 5 output: [5,5,5,5,5,5,5,5,5,5] is there in matlab? it easy assign repeated values array: x(1:10) = 5; if want generate array of elements inline in statement try this: ones(1,10) * 5 or repmat(5, 1, 10)

When is memory actually freed in Objective-C? -

i'm trying understand memory management stuff in objective-c. if see memory usage listed activity monitor, looks memory not being freed (i mean column rsize). in "object allocations" looks fine. here simple code: #import <foundation/foundation.h> int main (int argc, const char * argv[]) { nsautoreleasepool * pool = [[nsautoreleasepool alloc] init]; nsinteger i, k=10000; while (k>0) { nsmutablearray *array = [[nsmutablearray alloc]init]; (i=0;i<1000*k; i++) { nsstring *srtring = [[nsstring alloc] initwithstring:@"string...."]; [array addobject:srtring]; [srtring release]; srtring = nil; } [array release]; array = nil; k-=500; } [nsthread sleepfortimeinterval:5]; [pool release]; return 0; } as retain , release it's cool, balanced. rsize decreases after quitting little program. possible "clean" memory somehow before quitting? no point in trying scrub memory ...

Help me understand entity framework 4 caching for lazy loading -

i getting unexpected behaviour entity framework 4.0 , hoping can me understand this. using northwind database purposes of question. using default code generator (not poco or self tracking). expecting anytime query context framework make round trip if have not fetched objects. behaviour if turn off lazy loading. in application breifly turning on lazy loading , turning off can desired behaviour. pretty sucks, please help. here code example can demonstrate problem. public sub manyroundtrips() context.contextoptions.lazyloadingenabled = true dim employees list(of employee) = context.employees.execute(system.data.objects.mergeoption.appendonly).tolist() 'makes unnessesary round trip database, loaded employees' messagebox.show(context.employees.where(function(x) x.employeeid < 10).tolist().count) context.orders.execute(system.data.objects.mergeoption.appendonly) each emp employee in employees 'makes unnessesary trip database every ...

vb.net - Help with Class arrays -

when following executes, error 'nullreference exception' - object reference not set instance of object. testclass has , set methods integer property testword. how should following changed let me set testword in 6 elements of tarr? dim tarr(5) testclass integer = 0 5 tarr(i).testword = * 10 next you need initialize tarr array. if don't that, it's reference object doesn't exist (that's why null reference exception). dim tarr(5) testclass <---- doesn't mean you'll have array of testclass filled instances of testclass. need assign 5 testclass instances. you can in loop: for integer = 0 5 tarr(i) = new testclass() tarr(i).testword = * 10 next

c# - Why can't I invoke PropertyChanged event from an Extension Method? -

i've tried code class avoid method "raisepropertychanged". know can inherit class has implementation in cases can't. i've tried extension method visual studio complain. public static class extension { public static void raisepropertychanged(this inotifypropertychanged predicate, string propertyname) { if (predicate.propertychanged != null) { predicate.propertychanged(propertyname, new propertychangedeventargs(propertyname)); } } } it said: "the event ' system.componentmodel.inotifypropertychanged.propertychanged' can appear on left hand side of += or -= " reed right. however, see you're trying (make code reusable— good you ); , i'll point out rectified accepting propertychangedeventhandler delegate , passing within inotifypropertychanged implementation: public static void raise(this propertychangedeventhandler handler, object sender, string propertyname) { ...

c# - How to localize SharePoint publishing page title -

how 1 localize page title of sharepoint publishing page? provisioning like: publishingpage newpage = publishingweb.getpublishingpages().add("mypage.aspx", "mylayout.aspx"); newpage.title = "$resources:myresx,mypage_pagetitle"; newpage.update(); when provision page, title shows literally, $resources:myresx,mypage_pagetitle , instead of sharepoint looking string. so, guess assumption wrong sharepoint string up. or have syntax wrong. i referencing myresx in other places; sure resource file / string accessible. i have exact same issue webpart titles well, unified solution exists both scenarios. try sputility.getlocalizedstring : newpage.title = sputility.getlocalizedstring( "$resources:mypage_pagetitle", "myresx", web.language);

java - Retrieve Class Object from SOAP envelope? -

i have web service returns single class object me database query.. know how retrieve property soapobject but, property contains object. so, example if use: soapobject resultsrequestsoap = (soapobject) envelope.bodyin; object obj = resultsrequestsoap.getproperty("return"); the objects entire value is: "contacts{ id=value, username=value, location=value, date=value}" the problem is: can't unless want break string using "split". need know how object out of envelope or soapobject types , values can work with. appreciated. can post source code if needed, don't think it's necessary such small problem. edit: when "watch" soapobject breakdown is: object has property named "return" property has value named "contacts". value 4 properties values need. hope helps. it sounds return nested soap object? i'm not familiar particular library, work? soapobject resultsrequestsoap = (soapobject) envel...

android - MediaPlayer audio streaming fails on Galaxy Tab -

i have issue playing streaming* audio on galaxy tab (works on htc desire hd , nexus one). when create mediaplayer object, produces error this: 02-09 02:21:39.088: verbose/mediaplayer-jni(9325): native_setup 02-09 02:21:39.088: verbose/mediaplayer(9325): constructor 02-09 02:21:39.088: verbose/mediaplayer(9325): setlistener 02-09 02:21:39.092: info/mediaplayer(9325): uri is:http://147.83.39.86:3200/osgi/files/tts/1297185775715.ogg 02-09 02:21:39.092: info/mediaplayer(9325): path null 02-09 02:21:39.092: debug/mediaplayer(9325): couldn't open file on client side, trying server side 02-09 02:21:39.092: verbose/mediaplayer-jni(9325): setdatasource: path http://147.83.39.86:3200/osgi/files/tts/1297185775715.ogg 02-09 02:21:39.092: verbose/mediaplayer(9325): setdatasource(http://147.83.39.86:3200/osgi/files/tts/1297185775715.ogg) 02-09 02:21:39.092: error/mediaplayerservice(2392): failed create player object 02-09 02:21:39.092: error/mediaplayer(9325): unable to create media player...

What are the possible 'Mode' values returned by PowerShell's Get-ChildItem cmdlet? -

when run powershell's get-childitem on directory (or cmdlet returns file system items), shows column called mode , this: directory: c:\mydirectory mode lastwritetime length name ---- ------------- ------ ---- d---- 2/8/2011 10:55 directory1 d---- 2/8/2011 10:54 directory2 d---- 2/8/2011 10:54 directory3 -ar-- 2/8/2011 10:54 454 file1.txt -ar-- 2/8/2011 10:54 4342 file2.txt i searched , searched google , local powershell book, not find documentation on meaning of mode column. what possible values of mode column , each 1 mean? note mode see string representation of bitfield enum hides in attributes property. can figure out individual letters mean showing both side side: ps> gci|select mode,attributes -u mode attributes ---- ---------- d----- directory d-r--- readonly, d...

generics - Casting Between Data Types in C# -

i have (for example) object of type want able cast type b (similar how can cast int float ) data types , b own. is possible define rules casting occurs? example int = 1; float b = (float)a; int c = (int)b; yes, possible using c# operator overloading. there 2 versions explicit , implicit . here full example: class program { static void main(string[] args) { a1 = new a(1); b b1 = a1; b b2 = new b(1.1); a2 = (a)b2; } } class { public int foo; public a(int foo) { this.foo = foo; } public static implicit operator b(a a) { return new b(a.foo); } } class b { public double bar; public b(double bar) { this.bar = bar; } public static explicit operator a(b b) { return new a((int)b.bar); } } type can cast implicitly type b type b must cast explicitly type a.

c++ - Adding a string or char array to a byte vector -

i'm working on class create , read out packets send through network, far have working 16bit , 8bit integers (well unsigned still). now problem i've tried numerous ways of copying on somehow _buffer got mangled, segfaulted, or result wrong. i'd appreciate if show me working example. my current code can seen below. thanks, xeross main #include <iostream> #include <stdio.h> #include "packet.h" using namespace std; int main(int argc, char** argv) { cout << "#################################" << endl; cout << "# internal use #" << endl; cout << "# codename packetstorm #" << endl; cout << "#################################" << endl; cout << endl; packet packet = packet(); packet.setopcode(0x1f4d); cout << "current opcode is: " << packet.getopcode() << endl << e...

java - ECPublicKey Serializability -

i working on project in need pass generated public key ( ecpublickeyparameter ) on network between 2 parties. having problems serializing it. how can serialize instance of class?

windows - detect quiet mode -

i need able detect quiet mode in setup project's class library. of library's methods show dialog forms, , won't visible if setup running in quiet mode. need detect quiet mode, or @ least check if windows forms can displayed @ all. how can that? see uilevel property of windows installer.

asp.net - URLRewriter.net sends 404 when uploaded to server with IIS 7, but works on localhost -

i have "installed" urlrewriter.net website, , works fine when run visual studio, upload it, 404. example: http://dkbyg.strandweb.dk/faq application pool has been changed "integrated", because host suggested it. didn't work though. any ideas? i found reason. had set web.config described in section "approach 3: using httpmodule perform extension-less url rewriting iis7" in article: http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx

nHibernate Criteria for selecting a parent if a child in a collection has a specific value -

if have following class structure nhibernate criteria select parent if 1 of it's children has specific name? public class child { public int id { get; set; } public int name { get; set; } } public class parent { public int id { get; set; } public ilist<child> children { get; set; } } i'd create alias collection , add restrictions. var parentswithkidname = session.createcriteria<parent>() .createalias("children", "c", jointype.innerjoin) .add(restrictions.eq("c.name", childname)) .setresulttransformer(transformers.distinctrootentity()) .list<parent>(); this result in select p.* parent p inner join child c on /* it's mapped? */ c.name = ? the distinct root entity transformer process result set , remove duplicated parents. still come across wire though.

filehandle - Why do I get "Bad File Descriptor" when I try to read a file with Perl? -

i'm trying read binary file 40 bytes @ time, check see if bytes 0x00, , if ignore them. if not, write them out file (basically cutting out large blocks of null bytes). this may not efficient way this, i'm not worried that. however, right i'm getting "bad file descriptor" error , cannot figure out why. my $comp = "\x00" * 40; $byte_count = 0; $infile = "/home/magicked/image1"; $outfile = "/home/magicked/image1_short"; open in, "<$infile"; open out, ">$outfile"; binmode in; binmode out; ($buf, $data, $n); while (read (in, $buf, 40)) { ### problem here ### $boo = 1; ($i = 0; $i < 40; $i++) { if ($comp[$i] != $buf[$i]) { $i = 40; print out $buf; $byte_count += 40; } } } die "problems! $!\n" if $!; close out; close in; i marked comment breaking. help! you might want check if open doesn't return error. open in, "<$infile" or d...

database - Indexing array of strings column type in PostgreSql -

is possible create index on column type array of strings . tried using gin indexes . queries not seem using indexes. example create table users ( name varchar(100), groups text[], ); query: select name users any(groups) = 'engineering'. also best way perform group on 'groups' column efficiently can give 'groups' , count. a gin index can used: create table users ( name varchar(100), groups text[] ); create index idx_users on users using gin(groups); -- disable sequential scan in test: set enable_seqscan off; explain analyze select name users groups @> (array['engineering']); result: "bitmap heap scan on users (cost=4.26..8.27 rows=1 width=218) (actual time=0.021..0.021 rows=0 loops=1)" " recheck cond: (groups @> '{engineering}'::text[])" " -> bitmap index scan on idx_users (cost=0.00..4.26 rows=1 width=0) (actual time=0.016..0.016 rows=0 loops=1)" " index cond...

java - Display only the right side of long Text in JTable -

is there posibility display right side of long text in jtable? eg have long string: asldjklasjdklasjdklasjdlkasjkldjaslkjdklasjdklasjdlkajskldjaslk in table displayed: asldjklasjdklas... but want ...jdlkajskldjaslk to make column right aligned did not work :( you have create own tablecellrenderer implementation: class mytablecellrenderer implements tablecellrenderer { ... } and replace jtable default renderer it: jtable.setdefaultrenderer(new mytablecellrenderer()); or, if want set column, say, first: jtable.getcolumnmodel().getcolumn(1).setcellrenderer(new mytablecellrenderer()) left dot renderer , mentioned @camickr, tablecellrenderer implementation.

python - gtk.gdk: make image 50% grayer -

i have image wiht gtk.gdk . want make grayed out, wanna draw gray rectangle on 50% alpha value. how this? docs confusing. i thought of way taking half of color's highest values , taking half of number directly between them , putting on lowest number (eg: 0,255,255 127,255,255 or 0,127,255 96,127,255) or taking second highest number , highest number, finding 50%, putting second highest number, doing again absolute lowest number (eg: 0,128,255 > 112,192,255) hope works me , you, right im recommending myself , you, second option, if you're lazy, first option less work

sql injection - Parameterized SQL statements vs. very simple method -

when started write first sql-statements in programs felt quite comfortable protecting myself against sql-injection simple method colleague showed me. replaced single quotes 2 single quotes. so example there searchfield in can enter customername search in customertable. if enter peter's barbershop the select statement like select * customers customername = 'peter''s barbershop' if attacker insert this: ';drop table foo; -- the statement like: select * customers customername = ''';drop table foo;--' it not drop table, search customertable customername ';drop table foo;-- which, suppose, won't found ;-) now after while of writing statements , protecting myself against sql-injection method, read many developers use parameterized statements, never read article "our" method used. there reason it. what scenarios parameterized statements cover our method doesn't? advantages of parameterized statements c...

sql server 2005 - How to use case when in where conditon tsql? -

following part of stored procedure:- @id int @col1 int @col2 int select * table_01 t1 join table_02 t2 on t1.col = t2.col 1 = case when @col1 = 0 1 else (case when t2.col1 = @col1 1 else 0 end) end , 1 = case when @col2 = 0 1 else (case when t2.col2 = @col2 1 else 0 end) end , 1 = case when @id = 0 1 else (case when t2.id = @id 1 else 0 end) end currently if @id = 0 ignores condition if @id has value returns results based on criteria satisfaction i need add condition there :- if @id = -1 should not return result (coz there no match) should act @id = 0 (ignore add expresssion) am clear? :( select ... table_01 t1 join table_02 t2 on t1.col = t2.col case when @id = 0 1 when t2.id = @id 1 when @id = -1 0 else 0 end = 1 if last condition should trump other two, need change order: select ... table_01 t1 join table_02 t2 on t1.col = t2.col case when @id = -1 0 wh...

actionscript 3 - Flash allocation scheme, bug or feature? -

having following code: var loadingsoundtitle:string; var loadingsound:sound = new sound(); function loadfile(str:string) { loadingsound = new sound(); //(1) loadingsoundtitle = str; try { loadingsound.load(new urlrequest(loadingsoundtitle)); } catch(err:error) { trace(err.message); } } doesn't work if line marked (1) there, if comment out line, able load 1 single file, before stops working. using actionscript 3.0 under cs5 edit: i'm new flash! loadingsound.addeventlistener(event.complete, function(e:event) { list.additem({label:loadingsoundtitle, data:loadingsound}); process.value = 0; //for nice little processbar got :) }); there's lot that's missing here. think see problem though. firstly, as3 livedocs tell sound object instance can load 1 , 1 external mp3, it's no surprise removing line marked //(1) work, 1 time. the other problem see here when do include line marked //(1), you...

java - Apache Commons Configuration trigger event on property file change -

i'm using apache commons configuration library store app properties. can monitor changes of property file using filechangedreloadingstrategy , works perfectly. trigger configurationchanged event of configurationlistener when property file changed. this case works if try property code directory = myconfiguration.getinstance().getstring("directory"); this line trigger configurationchanged . need event triggered when filechangedreloadingstrategy catches changes in file without doing redundant calls. thanks. the filechangedreloadingstrategy works checking file modification time every time read parameter. if don't read anything, apache configuration code not invoked there no way send notification you. for app, more desirable because don't care file change until need use it. you can write new strategy accomplish want. need start new thread , monitor file periodically.

java - Single threading a task without queuing further requests -

i have requirement task executed asynchronously while discarding further requests until task finished. synchronizing method queues tasks , doesn't skip. thought use singlethreadexecutor queues tasks well. looked @ threadpoolexecutor reads queue task executed , therefore have 1 task executing , minimum of 1 task queued (the others can discarded using threadpoolexecutor.discardpolicy). the thing can think off use semaphore block queue. i've come following example show i'm trying achieve. there simpler way? have missed obvious? import java.util.concurrent.*; public class threadpooltester { private static executorservice executor = executors.newsinglethreadexecutor(); private static semaphore processentry = new semaphore(1); public static void main(string[] args) throws interruptedexception { (int = 0; < 20; i++) { kickoffentry(i); thread.sleep(200); } executor.shutdown(); } private static voi...

java - Creating dir on deploy with a bootstrap -

i need create dir when deploy web-application. dir contain profilepics of users. code: public class imagebootstrapper { public static void initialise(servletcontextevent sce) { boolean mkdir = new file(sce.getservletcontext().getrealpath("webapps").replace('\\','/') + "/profilepictures").mkdir(); } } result: creation of dir ("profilepictures") failed.. path uses: c:/apache-tomcat-7.0.6/webapps/spring-1/webapps/profilepictures what need: creation of dir ("profilepictures") @ path -> c:/apache-tomcat-7.0.6/webapps/spring-1/profilepictures spring-1 application context you can this: boolean mkdir = new file( sce.getservletcontext().getrealpath("/profilepictures")).mkdir();

for loop - Flow control in a batch file -

reference iterating arrays in batch file i have following: for /f "tokens=1" %%q in ('query termserver') ( if not errorlevel ( echo checking %%q /f "tokens=1" %%u in ('query user %userid% /server:%%q') (echo %%q) ) ) when running query termserver command line, first 2 lines are: known ------------------------- ...followed list of terminal servers. however, not want include these part of query user command. also, there 4 servers not wish include. when supply userid code, program promptly exiting. know has if statement. not possible nest flow control inside for-loop? i had tried setting variable names of servers wanted check, iteration end on first server: set termservers=server1.server2.server3.server7.server8.server10 /f "tokens=2 delims=.=" %%q in ('set termservers') ( echo checking %%q /f "tokens=1" %%u in ('query user %userid% /server:%%q') (echo %%q) ) i...

tree - Level-order in Haskell -

i have structure tree , want print tree levels. data tree = nd [tree a] deriving show type nd = string tree = nd "a" [nd "b" [nd "c" [], nd "g" [nd "h" [], nd "i" [], nd "j" [], nd "k" []]], nd "d" [nd "f" []], nd "e" [nd "l" [nd "n" [nd "o" []]], nd "m" []]] preorder (nd x ts) = x : concatmap preorder ts postorder (nd x ts) = (concatmap postorder ts) ++ [x] but how levels? "levels tree" should print ["a", "bde", "cgflm", "hijkn", "o"]. think "iterate" suitable function purpose, cannot come solution how use it. me, please? you need compute levels of subtrees , zip them after root: leve...

javascript - document.getElementById doesnt work with "input id", how can I do it? [+Greasemonkey] -

i have line on website <input type="text" autocomplete="off" value="" maxlength="20" class="shipbox" name="firstname" id="firstname"> and want greasemonkey automatically fill this... i'm trying had no success document.getelementbyid("firstname").setattribute("autocomplete", "on"); document.getelementbyid("firstname").value = "bruno" what you're doing correct way. the usual reaqson not working second element same id somewhere in document. by way, setattribute not recommended way of setting attribute in html, i've been reminded today. simple ...getelementbyid("firstname").autocomplete = 'on' do.

console - Streaming data to text files -

i can stream viewable data in windows console, stream data text file using --raw>output.txt command line this text file continue grow in size long data streaming. possible end streaming initial text file , start streaming second text file? perhaps after 10 minutes? you need use pipe operator redirect output tool perform required cutting. cutting can implemented or you'll find ready use

internet explorer - Google Forms w/ jQuery Validate Not Submitting to Form in IE 7 -

in ie7, when user fills out google form w/ jq validate.js, , clicks submit button, page navigates "success" page, our form isn't showing submitted content. http://www.xtracycle.com/lifetime-freeradical-warranty-and-guarantee/ i read ie 7 has issues input elements having both type , class/id/name of "submit", when try , change button input's name, google js no longer submits form content in ff or on mac. thanks insight issues ie 7 has jq validate , google forms. you not using input field submit button, button object. internet explorer treats button objects bit different other browsers. w3schools page addresses of issue. html button tag if instead use input field type of submit have less compatibility problems.

javascript - create a web page with drag and drop to work on PC, iPad & iPhone -

is possible or easy create web page allows users drag , drop divs around screen, , work in brwoser, whether on pc, , iphone, or ipad? my web page uses few divs contain content, , user able move these around wish. it created using asp.net dragpanelextenders, if have abandoned, it. to workign, have create 2 versions of page: 1 pc based on mousemove events, , 1 iphone/ipad based on touch events? one option jqtouch. http://www.jqtouch.com/ http://www.gotproject.com/blog/post2.html explains how drag , drop on webkit based browsers (iphone, ipad, android, ...) write code see if page running on computer or phone, , use linked code if on phone.

python - App Engine gives error in number formatting when deployed -

i have deployed app , go on homepage '500 internal server error' page. having looked through logs got following error: type 'exceptions.syntaxerror'>: non-ascii character '\xc2' in file /base/data/home/apps/spare-wheels/1.348259065130939449/sparewheels.py on line 465, no encoding declared; see http://www.python.org/peps/pep-0263.html details (sparewheels.py, line 465) the line in question looks this: self.template_values['price_pounds'] = "£%.2f" % (float(self.event.price_pence)/100) this worked fine when running on localhost: there number formatting google apps version of python doesn't support? check encoding of python file, utf-8? error message suggests may have saved file ascii format international characters in file (aka "£") causing google's python runtime barf 500 error. also try tossing line on first or second line of python file: # coding=utf-8

abcpdf - Tips for making PDFs smaller (using ABCPdf7) -

i'm generating pdfs html (using abcpdf , c#) , files coming out reasonable size. however, i'm interested in tips has making pdfs small possible. anyone great ideas? the html being rendered basic, table of names , dates etc - doesn't have pretty. cheers! -ev if layout simple, try relinquish generation html , write pdf directly c# tools , libs. read data form html shouldn't problem.

Why isn't Xcode building a file in my project -

i have static library project inherited developer. added class project , built it. when include static lib in project, build fails symbol not found error class added. i looked @ build logs static lib project , noticed .m file isn't compiled. file visible in xcode, right next of other class files. can think of reason file wouldn't built? how xcode discover files builds? make sure new file included in target you're trying build. click on filename in left pane of xcode , open inspector (command-i), @ "targets" tab verify target you're building checked. if necessary, can expand target (in left pane) see build steps, , drag file directly build step (for example "compile sources") needs be.

batch file - What does %* mean? -

i installed pychecker , noticed batch file should use run pychecker has these entries: c:\python26\python.exe c:\python26\lib\site-packages\pychecker\checker.py %* what second line mean? what seeing isn't python code. windows command script. %* means pass arguments passed batch file.

Download File in vb.net desktop Application -

can me on how can download file form computer , save computer.. not sure want download or from, i'm guessing you're looking download website local file , if so, @ webclient.downloadfile . see http://msdn.microsoft.com/en-us/library/system.net.webclient.downloadfile%28vs.80%29.aspx more info. otherwise, if mean copying files in local network, can use file.copy . http://msdn.microsoft.com/en-us/library/system.io.file.copy.aspx

C# Robotics / Hardware -

i'm aware of phidgets, however, i'm looking other types of hardware can interfaced c#. anyone got ones? advantech has nice set of usb io boxes can interfaced hardware. have nice native .net framework examples in c#. the 1 i'm using control robotic workcell i'm developing: http://www.advantech.com/products/usb-4751/mod_1-2mljna.aspx

visual foxpro - COPY TO xxxx.xls TYPE XLS (VFP 8.0 SP1) -

i downloading table sql 2008 using vfp 8.0 (sp1) using command: copy xxx type xls of data in excel disappearing. example, table in sql: cus(id int(4), cusnam varchar(35)) when issue following command @ vfp forms: (a) copy xxx type fox2x [data display correctly following] *id cusnam 1 abc 2 def* (b) copy xxx type xls [2nd record disappear] *id cusnam 1 2 def* appreciate helps! for testing, copy vfp directly table see if writes out correctly. can copy out there.. using view designer , connection, or manually controlling via like nhandle = sqlconnect( "yourconnectionstringinfo" ) sqlexec( nhandle, "select * yoursqltable", "intolocalvfpcursor" ) select intolocalvfpcursor copy permanentlocalvfptable use permanentlocalvfptable browse sqldisconnect( nhandle ) in years of vfp / sql, don't ever recall such data loss. however, when doing dump excel, there limit of records 65535... max of older excel file format c...

asp.net - Virtual Directory root vs Default web site root -

i using iis 5.1 in have only 1 default website, i have 2 projects v2 , v3 my website points v2 projects , have folders images, styles etc have virtual directory under website hosting project v3 , having same folder hierarchy v2 in home page of both projects have img src="\images\edlogo.gif" alt="logo"/> but shows same image in v2 directory, how can show different images both projects. using "\" root of web site how can root of virtual directory under website this static method returns full http path root folder of application (web site or virtual directory) public static string getapprooturl(bool endslash) { string host = httpcontext.current.request.url.getleftpart(uripartial.authority); string approoturl = httpcontext.current.request.applicationpath; if (!approoturl.endswith("/")) //a virtual { approoturl += "/"; } if (!endslash) { approoturl = approoturl.substring(0, ...

python - Colour chart for Tkinter and Tix -

this isn't question answer others might run issue. i wanted visualise basic colours, pick appropriate ones colour scheme. couldn't find colour chart anywhere modified sample display hope find useful. import tix tk # import tkinter.tix tk # python 3 colors =['snow', 'ghost white', 'white smoke', 'gainsboro', 'floral white', 'old lace', 'linen', 'antique white', 'papaya whip', 'blanched almond', 'bisque', 'peach puff', 'navajo white', 'lemon chiffon', 'mint cream', 'azure', 'alice blue', 'lavender', 'lavender blush', 'misty rose', 'dark slate gray', 'dim gray', 'slate gray', 'light slate gray', 'gray', 'light grey', 'midnight blue', 'navy', 'cornflower blue', 'dark slate blue', 'slate blue', 'medium...