toarray

Doctrine toarray does not convert relations.

Hi, so..I followed doctrine documnetation to get started. Here is the documentation http://www.doctrine-project.org/documentation/manual/1_2/en/working-with-models#dealing-with-relations:retrieving-related-records My code is $User = Doctrine_Core::getTable("User")->find(1); when I access relations by $User->Phonenumbers, it works. ...

jquery ui sortable serialize from children

I want to send an Array with image paths and captions to a PHP script after I sorted the images. I can do 'serialize' or 'toArray' on the lists, but how to get the attributes from the img tag? <ul class="gallery"> <li id="li-1"> <img src="tn/001.jpg" alt="first caption" /> </li> <li mycaption="some caption" id="li-2"...

Java Object Array item to String Array

Say I have the following: Class myclass { public string stra ="", strb = "" myclass(String a, String b){stra=a;strb=b} } //then in the app I want to do: myclass myclassinst1 = new myclass("blah","xxxx"); myclass myclassinst2 = new myclass("blah2","yyyy"); myclass myclassinst3 = new myclass("blah3","zzzz"); list <myclass> my...

Lock vs. ToArray for thread safe foreach access of List collection

I've got a List collection and I want to iterate over it in a multi threaded app. I need to protect it every time I iterate it since it could be changed and I don't want "collection was modified" exceptions when I do a foreach. What is the correct way to do this? Use lock every time I access or loop. I'm rather terrified of deadlock...

Split html row into string array

I have data in an html file, in a table: <table> <tr><td>001</td><td>MC Hammer</td><td>Can't Touch This</td></tr> <tr><td>002</td><td>Tone Loc</td><td>Funky Cold Medina</td></tr> <tr><td>003</td><td>Funkdoobiest</td><td>Bow Wow Wow</td></tr> </table> How do I split a single row into an array or list? string row = streamRe...

Java: how to implement `toArray` for `Collection`

Right now, I have: public <T> T[] toArray(T[] old) { T[] arr = Arrays.copyOf(old, old.length + size()); int i = old.length; for(E obj : this) { arr[i] = old.getClass().getComponentType().cast(obj); ++i; } return arr; } (Note that this does not follow the contract ...