Archive for the ‘programming’ Category.

AJAX

I found a place for AJAX at work!  It’s so rad! :D   It’s not in a customer-facing application, but where I was able to use it, it’s increased the speed of the app by about 300% or so.  I’d love to show you!  but, I probably shouldn’t.  You can ask me about it in general terms, though!

The application feels more like a desktop app now.. and a lot less like a web app.  This is very exciting stuff, I just needed to find a place for it.  Now I can see lots of other places for it. :)

Technorati Tags:

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

change “find in reference” in BBEdit

This is very cool.  You can change the site the BBEdit uses to “find in reference”, as helpfully noted by Peter Rukavina… thank you Peter!

If you use TextWrangler BBEdit to edit PHP files, you may find the following shell command useful (pointer from here):

defaults write com.barebones.bbedit Services:ADCReferenceSearchTemplate "http://www.php.net/%@"

This will set the TextWrangler “Find in Reference” contextual menu item to look up the selected text on the PHP website (rather than on the Apple Developer Connection site, which is the default).

Technorati Tags: , , ,

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

Can desktop software be continuously developed?

Can desktop software be continuously developed?:

Between the Lines comments:

» Bill: Give us the new Office 12 interface now | Between the Lines | ZDNet.com

…the new model for software today is continuous improvement, not big bang costly upgrades that promise “better results, faster” in 18 months or two years…

Indeed.

But it may not be that easy.  It’s the delivery mechanism, the Place in marketing speak, that gets in the way.  Because desktop software typically doesn’t auto-upate on each launch, it needs to have fewer bugs at the time the user installs it.  Server-based software can be updated anytime, and users receive the benefits of new features and bug fixes on their next launch without any hassle.

RIAs are the key to bridge this gap…

Welllll, sort of.  Let me tell you a story about SecondLife.  I’m not a daily visitor to Secondlife, but, I might pop in twice a week for a minute or two.  Nearly every time I launch the app, there’s a new version.  Seriously.  Once a week.  20+ Megs of downloading, almost every time I launch the program.  Usually to fix a simulator-critical bug that causes EVERYONE to have to upgrade before they can get in.  It borders on ridiculous.

Then there’s Ecto… which updates every month or so, much more sane, but, if I don’t update, it’ll remind me to download the update even if I already have, but haven’t installed it yet.  “remind me in a week” would be nice here. Or, even better, “remind me after my next reboot”.

Technorati Tags: ,

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

shaving code

I have a huge survey tool that I’ve been working on for a long time.  It’s a dynamic system that lets you add as many questions as you like to a survey, and has some standard abilities for error checking, being nice when it finds you missed a field that was required, uh, a gigantic and growing administration tool and reporting engine with n-level drill down, all with graphs, charts, excel export, etc, etc, etc.

The unfortunate scenario I’m in here is that when I’ve failed to anticipate a contact info field that someone’s going to want to ask for, it’s extremely difficult to add them, system wide.  The system wasn’t built from the beginning to be very dynamic.  There’s 3 tables to alter, and at least 9 processors (so far that I’ve found) that need to be touched when the contact info fields list grows.  This is 3 year old code… php web code, so that’s like 15 dog years.  (and do the math from there…)  Fortunately, the list of possible contact info fields is getting to a ridiculous level… I’m having a hard time imaging needing to do this again in the future, but… just in case…

This round, I’m creating a wiki page to document the entire process, and I’m dynamizing code where I can so that it’s a non-issue moving forward for some of these cogs.  I just shaved 800 lines of code out of my survey processor by stepping through fieldnames and values dynamically and then checking that fieldname against the contact-info-field-required-list table dynamically too.  Even special casing fields like “state”, “shipping state”, and an “exclude” list for fields that we just never really need to check – “address 2″, “shipping address 2″, et cetera. 

It’s staggering how much code I’ve written for this engine, and it’s not even close to zoomerang yet.  It might be if I could roll out an easier deployment system.  Right now it’s still pretty manual for me to have to roll a survey out.  That’s really not such a bad thing right now, but, it’s an obvious problem, long term.  There’s still some not-so-basic features (like asking different questions based on responses), and some scalability concerns before I can really open it up company-wide.  Some of our potential company-wide surveyable audiences number in the hundreds of millions.  I seriously doubt my little survey tool would stand up to an onslaught like that.

Maybe someday…  some… day.

Anyway, hardcoding bad, dynamic code good.  Yay, brain. Go me.

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

HOWTO: smarter BBEdit multi-file searching

In the new(er) versions of BBEdit, you can get really specific about what files to multi-file search through.  I love this, check it out, you can include/exclude grep patterns.

I take advantage (?) of BBEdit’s auto-backup feature where it iterates a file name on the date with a version number so that you’re never overwriting your only copy. It saves the previous version as index-20050818-01.php or whatever.  This is good.  However, when you’re searching a directory for a criteria in the contents of your folder, this can _really_ bog down your time to completed search results.

If you create a criteria when you do a multi-file search with the following set up:

Bbeditscreensnapz001

then it will skip over all of your backup files and only search the “live” or “non-backup” files.  Extremely cool. :)

Technorati Tags: , ,

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

Get the next 5 business days

If you’re looking for a way to get php to return the next 5 working or business days, here’s one way to try:

[php]

$how_many_business_days_ahead = 0;
$how_many_business_days_to_count = 7;

for ($i=0;$i<$how_many_business_days_to_count;$i++)
{
$jump=$i+$how_many_business_days_ahead;
$evalday = mktime(strftime ("%d/%m/%Y", strtotime("+$jump days")));
$theday = strftime("%A", strtotime("+$jump days"));
if($theday != "Saturday" and $theday != "Sunday")
{
$days = $how_many_business_days_ahead+$i;
$the_days[$j] = strftime("%A, %B %d, %Y", strtotime("+$jump days"));
$j++;
}
}

$k = $how_many_business_days_ahead;

foreach($the_days as $eachday)
{
echo "$k business days from now = $eachday
“;
$k++;
}
?>
[/php]

this will give you:

0 business days from now = Tuesday, August 16, 2005
1 business days from now = Wednesday, August 17, 2005
2 business days from now = Thursday, August 18, 2005
3 business days from now = Friday, August 19, 2005
4 business days from now = Monday, August 22, 2005

yay, included in the php docs :)

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

postie works!

Photo_071405_001.jpg

Thanks to the head geek over at economysizegeek.com, I can now post photos straight from my phone to my blogs using a plugin called “postie”. Thanks dude!

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

skype chat with Olivier Gillet

Most excellent. I just had a text chat with Olivier Gillet, of bhajis loops fame. What a nice guy. I’m planning on a podcast interview with him for my music blog, some sounds we like, probably in the august timeframe.

This is one SMART DUDE!! You don’t even know yet! Holy crap!

Technorati Tags: , ,

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

quartz coreimage command line tool

ok, it’s not quartz or coreimage, but if you’re looking for a command line image manipulation tool for mac os x, you’re probably looking for “SIPS” – scriptable image processing system.

Ok, so, why? my favorite lazy gallery software PHPix3 is really just killing me with the PHP internal GD thumbnail generation time. I’m thinking it’s about time to take advantage of the internal tool available to me since I’m rockin’ tiger server. So, I’m thinking all I need to do is go locate the code the determines whether the image tool the scripts use is “int” or “ext” and maybe add another piece of logic to act on “sips” as the value. Hopefully it will run faster than GD. If not, I guess I can go back to ImageMagick. Although it would be nicer if apple’s command line tool were fastest… we shall seeeee…

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

how much do I make?

here’s a fun little calculator I made that tells you how much you make per second, minute, hour, day, week, month, year. You can punch in, and then have it tell you how much you’ve made at your pay rate since you punched in. This is a work in progress, but, check it out.

life dashboard v1

Technorati Tags: , ,

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

HOWTO: replace “st.” with “saint” with PHP

occasionally, you might need to lookup something based on a user-specified piece of info like “city”. Don’t let the lazy ones prevent you from performing at your best.


<?php 

$echothis = strtolower(str_ireplace("st.","saint",$_GET['string']));

echo $echothis;

?>

<form action"<?php echo $_SERVER['phpself'];?>" method="get">
<input type="text" name="string">
<input type="submit">
</form>


What this does is replace an abbreviated “st.” with the fully spelled out “saint”. I found it useful, maybe you will too. “strtolower” is added to just normalize the string so that str_ireplace… Oh, that’s funny. I probably don’t need to strtolower the string, because str_ireplace is case “i”nsensitive. str_i(nsensitive)replace. Oh well, live and learn.

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

exploring text in space

txtkit (OSX) by Prof. Hans Ulrich Reck
is an Open Source text mining tool for visualizing, managing, sharing,
and exploring large amounts of multilingual texts. The interface
promotes a collaborative effort to share and suggest text through a
dynamic display of user activity and textual information. (demo video)

(Via futurefeeder, and bruce sterling.)

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

Tiny URL… well.. a small URL anyway

Holy crap, TinyURL is so cool. There’s even a dashboard widget for it. The only problem I ran into is that their server wasn’t allowing mysql connections to it. Hmm, bummer. This is a cool service, but.. what’s going on here? It’s a table of urls that they’re encoding some small key to relate to, so when you ping the tiny url, it says “you said ‘EHY54′… and my table says you wanted ‘http://www.google.com’… so here you go (redirect)”

Pretty cool. A very simple idea, but extremely useful. So useful, that I’ve come to rely on that kind of technology to be able to pass obnoxiously long URLs to gallery pages like this one:

http://sc-fa.com/blog/2008/07/06/steve-cooley-showing-at-workssan-jose/

which isn’t really all that obnoxious, but it sure looks like it when you pass it to someone in an email and the URL breaks because of the wordwrap or something. So, since tinyurl.com wasn’t returning URLs, I made my own small URL maker.

It’s basically three components: a DB table, a form to make ‘em small, and a landing page where the small urls turn into big ones. Now if I only had a short domain name..

HEY, I do! http://3rl.us

so, said large url turns into: http://3rl.us/e8c31 which is much smaller. :)

AND, I added a hit counter, so I can see how many times a URL has been pinged. Now all i gotta do is dive into the widget making world and make my own for my small url maker.

oh yeah! make your own small URL here: http://3rl.us

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

php manual widget

High five, Simon Ganiere! Get the PHP Manual lookup dashboard widget.

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

tiger: quartz composer, the other shoe…

Oh. They really are screen savers. Oh my god. Wow.

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter