sklar.com/blog
sklar.com/blog
home blog work projects fun contact
sklar.com/blog
...composed of an indefinite, perhaps infinite number of hexagonal galleries...
friday, october 19. 2007
subversion time machine
jon aquino, my talented cow-orker built a time-lapse view for subversion. this is fantastic.
we switched from perforce to subversion recently (at ning), and one of the things that i miss about perforce was its handy time-lapse-view feature. no longer!
posted by david
in software, ning
at
12:17
| comments (0)
| trackbacks (0)
friday, october 12. 2007
api design talk slides
the slides from my api design talk yesterday are available.
if you missed zendcon, come to the dc php conference in a few weeks. i'll be talking about api design there on november 8.
posted by david
in php, ning, conferences
at
13:40
| comments (2)
| trackbacks (0)
thursday, october 4. 2007
ning turns two
as diego and gina have pointed out, the ning platform has just celebrated its second birthday.
the past two years have been a lot of work and a lot of fun. it's been gratifying to see the crazy, heartwarming, innovative uses folks have come up with for the platform and also extremely rewarding to work with such talented people.
i wonder what i'll have to say in a blog post a year from now that links to this one?
posted by david
in php, 24hl, ning
at
10:39
| comments (0)
| trackbacks (0)
monday, september 24. 2007
zendcon 2007
zendcon (aka "the 2007 zend/php conference and expo") draws near. i'll be there giving a talk about api design in php and undoubtedly getting sucked into various conversations about how php's disorganized ugliness is its greatest asset.
posted by david
in php, conferences
at
11:14
| comments (0)
| trackbacks (0)
thursday, july 12. 2007
e-mail address validation and mission creep
+1 to what ndg said in response to jacob's post about e-mail address validation.
i think jacob sort of touches on this in his post but too often it's not explicit what people are looking for under the vague and broad umbrella of "e-mail validation".
if it's "did the aol user signing up for my site forget the '.com' part at the end of the address?" then some pretty simplistic text-based matching will do.
if it's "is the address supplied a valid mailbox that is controlled by the person who is supplying it to me?" then all the string parsing in the world isn't going to save you. you'll need to roundtrip something out to the mailbox with confirmation instructions. and even then you're not out of the woods -- maybe the user's mailbox is full, or a transient dns error is causing a problem.
i think e-mail address validation tends to be a bit of a tarpit for nerds (myself included) because the delicious complexity of rfcs 822 and 2822 makes writing code to handle the grammars they describe a fun challenge. that makes it easy to forget what the point of the address validation in the real world actually is: handholding well-meaning users that may have made a careless mistake, or robust protection against malicious users, or bot protection (in which case you probably want to ban rfc-valid addresses that have known-suspicious domain names or components), etc.
posted by david
in php
at
10:27
| comments (2)
| trackbacks (0)
wednesday, july 11. 2007
api design in php at zendcon 2007
i'm going to be giving a talk on "api design in php" at zendcon 2007 in october.
our php api at ning is a little over two years old at this point. there are some things i love about it that i think we've done really well, some things that we have revised, some things we can do better, and some interesting things planned for the future.
the talk is all about what we've learned developing, building, and supporting the api with both a ferocious devotion to backwards compatibility and a rapid new release cycle.
see you in october!
posted by david
in php, ning, conferences
at
16:52
| comments (2)
| trackbacks (0)
wednesday, may 16. 2007
runkit, "static", and inheritance
a php issue that comes up over and over again is how the static keyword doesn't know about inheritance. that is, code such as:
class masons {
static $where = "world-wide";
static function show() {
print self::$where;
}
}
class stonecutters extends masons {
static $where = "springfield";
}
stonecutters::show();
prints world-wide, not springfield because the self inside masons::show() is bound at compile time to the masons class. this is different than how $this works in instances, so it can be unexpected.
there are plenty of good reasons why php 5 works this way and it seems that in php 6 the static keyword will be able to be used in place of self to get the dynamic behavior a lot of folks are looking for (that is, print static::$where; in masons::show() would cause stonecutters::show() to print springfield.
all well and good once php 6 is done.
in the meantime, i was noodling around with runkit and came up with some glue that lets you do something like this:
class model {
public static function find($class, $filters) {
// this method would actually do an sql query or
// rest request to retrieve data
print "i'm looking for a $class with ";
$tmp = array();
foreach ($filters as $k => $v) { $tmp[] = "$k=$v"; }
print implode(', ', $tmp);
print "\n";
}
public static function findbyid($class, $id) {
return self::find($class, array('id' => $id));
}
}
class monkey extends model { }
class elephant extends model {
public static function findbytrunkcolor($color) {
return self::find(array('color' => $color));
}
}
and then after the mysterious (for a few seconds) glue:
methodhelper::fixstaticmethods('model');
you can do:
monkey::find(array('name' => 'george', 'is' => 'curious'));
// prints: i'm looking for a monkey with name=george, is=curious
elephant::findbyid(1274);
// prints: i'm looking for a elephant with id=1274
elephant::findbytrunkcolor('grey');
// prints: i'm looking for a elephant with color=grey
monkey::findbyid('abe');
// prints: i'm looking for a monkey with id=abe
(the innards of methodhelper after the jump...)
continue reading "runkit, "static", and inheritance"
posted by david
in php, ideas
at
10:29
| comment (1)
| trackbacks (0)
wednesday, april 25. 2007
visiting each character in a string
so i've got this string (in php) and i need to scan through it character by character. i can't scan byte by byte because it's 2007, our users write in all sorts of languages, and the string is utf-8.
the php 5 solution uses mb_strlen() to find the length and then mb_substr() to grab each character:
$j = mb_strlen($thestring);
for ($k = 0; $k < $j; $k++) {
$char = mb_substr($thestring, $k, 1);
// do stuff with $char
}
in php 6, one would do:
foreach (new textiterator($thestring, textiterator::character) as $char) {
// do stuff with $char
}
some rough benchmarks on a 1500 character (and 2900 byte) string (linux, whatever processor is inside this thinkpad t43 here, your mileage may vary, etc etc etc) give me about 61 scans/sec with php 5.2.1, where a "scan" is just moving through the loop above with mb_substr and doing one if() test comparing the char to '
ubuntu feisty fawn vs. cisco vpn client
i upgraded a machine to ubuntu feisty fawn (7.10) today and was having trouble recompiling the cisco vpn client. thanks to this thread, i went to this blog post and applied this patch and everything was fine.
i must admit that applying some random patch to one's vpn client inspires a moderate amount of queasiness, but fortunately the patch is simple enough to understand so one can be confident no mischief is involved.
posted by david
in software, infrastructure
at
09:51
| comments (4)
| trackbacks (0)
friday, november 3. 2006
what function are you?
this story from george via andrei is simultaneously hilarious and scary.
i'm not sure, if i were a php function, which function i'd be. although figuring that out would be a lot easier if my name were, for example, max levenshtein.
posted by david
in php, conferences
at
17:27
| comments (0)
| trackbacks (0)
thursday, september 28. 2006
swanky new ning sites!
it's been a lot of hard work, so i'm quite excited that we've just released three great new ning sites: ning videos, ning photos, and ning group.
i particularly like the embeddable slideshow that ning photos has, and its companion in ning videos, the embeddable player -- so you can put photos or videos on your blog or wherever. both apps let you e-mail in content from your phone, too. ning group has some spiffy html parsing and file upload features so you can share documents with folks and incorporate music, pics, or anything else in the forums.
plus, all three sites have the juicy bits that every site on the ning platform gets -- things such as cloneability, complete customization, and built-in rest apis. i've been watching the feeds for clones of photos and videos -- i suppose seeing who's cloned sites you care about is the web 2.0 version of ego surfing.
more on the ning blog and from kyle.
posted by david
in software, php, ning
at
00:37
| comments (0)
| trackbacks (0)
tuesday, august 29. 2006
php cookbook, 2nd edition
the new edition of php cookbook is on the way! i got one copy yesterday, so it should be making its way into bookstores and online-bookstore-warehouses any day now.
there is lots of new material in this edition -- completely revamped xml and oop sections, new stuff on pdo, ajax, testing, performance tuning, regular expressions, and lots of other goodies.
posted by david
in php, writing
at
12:40
| comments (3)
| trackbacks (0)
thursday, august 24. 2006
zend framework, php community on ning
some neat ning + php related stuff recently: ben and elizabeth set up a group clone for phpcommunity -- http://phpcommunity.ning.com.
ben also set up an app -- http://zendfw.ning.com -- where he installed the zend framework and made a few tweaks so it's runnng happily on the ning playground. i was pleased to see that our url mapping support can handle everything that zend framework needs.
posted by david
in php, ning
at
10:59
| comments (3)
| trackbacks (0)
thursday, july 27. 2006
oscon 2006 presentation
the slides from my oscon 2006 presentation, "i'm 200, you're 200: codependency in the age of the mashup," are available at http://www.sklar.com/files/i'm-200-you're-200.pdf.
posted by david
in ideas, infrastructure, conferences
at
17:03
| comments (4)
| trackbacks (0)
tuesday, july 25. 2006
heading to oscon
i'm heading to oscon today. things i'm looking forward to (in no particular order): portland, giving a new talk, seeing friends, learning lots of new things. if you're at (or going to) oscon, say hi and tell me how wonderful (or stinky) you think my blog is.
posted by david
in php, conferences
at
09:06
| comments (0)
| trackbacks (0)
(page 1 of 8, totalling 112 entries)
» next page
calendar
october '07
mon
tue
wed
thu
fri
sat
sun
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
quicksearch
archives
october 2007
september 2007
august 2007
recent...
older...
syndicate this blog
rss 0.91 feed
rss 1.0 feed
rss 2.0 feed
atom 0.3 feed
rss 2.0 comments
copyright © 1994 - 2004 david sklar - feedback
sklar.com/blog Précédent 871 Précédent 870 Précédent 869 Précédent 868 Précédent 867 Précédent 866 Précédent 865 Précédent 864 Précédent 863 Précédent 862 Précédent 861 Précédent 860 Précédent 859 Précédent 858 Précédent 857 Précédent 856 Précédent 855 Précédent 854 Précédent 853 Précédent 852 Précédent 851 Précédent 850 Précédent 849 Précédent 848 Précédent 847 Précédent 846 Précédent 845 Précédent 844 Précédent 843 Précédent 842 Suivant 873 Suivant 874 Suivant 875 Suivant 876 Suivant 877 Suivant 878 Suivant 879 Suivant 880 Suivant 881 Suivant 882 Suivant 883 Suivant 884 Suivant 885 Suivant 886 Suivant 887 Suivant 888 Suivant 889 Suivant 890 Suivant 891 Suivant 892 Suivant 893 Suivant 894 Suivant 895 Suivant 896 Suivant 897 Suivant 898 Suivant 899 Suivant 900 Suivant 901 Suivant 902