| Latest |Kites |Pictures |Programming |Life |
|
Hacking code together. Is it art? Is it science? Can it be quantified? Are comments really essential? Who knows, I sure as hell don't. ![]() PHP Closeures ![]() PHP 5.3 has closures in it! Finally we get some good stuff to play with: PHP 5.3 and Closures. This is excellent news, even if the closures look weird -- look at the strange use keyword.
![]() Zend Framework DB Insert NOW ![]() Some keywords: SQL Insert Update Zend_Db_Table_Row NOW() now function Zend_Db_Table Zend_Db_Expr Use the SQL function NOW() in ZF: $k = new My_Table(); This works because DB Expr doesn't escape the string 'NOW()'. Yay. ![]() Why LISP is better than me ![]() I wish I could do this in any of the languages I use: porting-perls-qq-to-common-lisp. A few simple lines of code and you have a new language operator qq. Ugh. This would be soooo cool. I had a problem the other day where I had an object with various members, some of which I wanted to have the extra attribute 'merge-able' some how. This is how it looked: class moo{ Then in a method inside moo: foreach( prop in this ) and what I wanted was to somehow 'hide' height from the iterator... I guess there are two ways of doing this, first override the 'iterator' or 'foreach' operator. This is impossible in ActionScript. Or second add an attribute to each property, kinda like: class moo{ But there's no way to do this and no way to extend the language to make it work. It is most irritating. I have 40 or 50 objects and I iterate over all of them. And I have this problem in one or two of them.... argh! How annoying. The only thing I can think of is to have an iterable properties list, then: foreach( prop in this.iterable_properties_list() ) But this means keeping my object definition and iterable_properties_list method in sync (for over 40 different objects.) Filth. I guess I could hack it using PHPs naming scheme, anything that starts with an underscore is 'special'. Then I could do: foreach( prop in this ) ![]() Larrabee new Intel chip ![]() Shit! The new intel chip, Larrabee has 32 cores! Core me up y'all. 8th of July, 2008@1:11:33 PM permanent link to article ![]() a better type of php ![]() Some interesting links about PHP. PHP 6 may use the Parrot virtual machine to run. That would be very interesting, for example when the Perl guys port CPAN to Parrot, PHP would have access to that vast, vast library of code. Compiling PHP to Parrot (or .NET or Java) would speed up the code, reduce the memory consumption and just make everything much more nicer. But until we get that, there are a few PHP op-code cachers and PHC a PHP compiler. Sweet. ![]() Python csv NULL BYTE fail re regex split ![]() My problem is that I have a csv file that Python can't read because it has NULL bytes in it. Python has a built in csv reader, but this chokes and dies :-( (booo) Problem 2: line.split(',') also chokes because some lines look like this: 1,2,"3,4,5",6 which have to split into 4 items. Ack. I thought I was going to have to write a little finite state machine (which I like doing) but my csv file is 18meg. So fsm may = slowness. After some searches I came across this funky bit of regex that I made into even funkier Python: >>> subject = """1,2,3,"4444","55,55,,,,55",99""" :-) wtf? I'm not sure what is going on, I got lost at "Assert that it is impossible to match the regex below starting at this point (negative lookahead)" hmmm. Yes. Magic. ![]() Zend Framework Ajax ![]() You need to turn off the layout renderer and the view renderer: public function busyAction() Then use Zend_Json to encode your values and output them. For the client side I suggest you grab jQuery or prototype to make things easier. |
| Server Grind [0.2844 seconds] |