Archive for the ‘tech’ Category

i’m branching out: c, python, maybe even java…

Sunday, June 8th, 2008

Though I had made my mind up a while ago to start seriously hacking other languages besides PHP, I saw something today that really reinforced that decision: average programmer salaries.

Erlang $99,000 (added 8 June 2008) … Java $79,000 Python $78,000 Perl $77,000 Ruby $74,000 COBOL $73,000 (added due to demand)
JavaScript $72,000
ColdFusion $64,000 (8 June 2008)
Delphi $64,000 PHP $64,000 …

Yikes!

twitter has bad code push; world ends

Monday, April 21st, 2008

As a person addicted to the internet, it is fascinating/terrifying for me to watch others who are even more addicted. Check out the getsatisfaction.com thread about Twitter’s recent cache issue:

I am one of those users who has ceased to exist on Twitter’s timeline for a lot of people. Really weird. Feel like I’m tweeting alone. Like I’ve been muted. So not fun. Any idea when this will be fixed?

This one is at least partially in touch with the world outside her monitor:

And here I thought all my buddies had simply decided to walk away from ‘technology’ for a while and enjoy their weekend ‘offline’. Hoping to see this get fixed soon.
silly I’m sad, but this ‘outage’ gives me an excuse to focus on other things…

Of course, some people use Twitter for journalistic ends:

No pressure guys-but Tuesday is Penn. Primary and Web 2.0 and New Comm Forum kick off next week too. of my 2000 plus followers, only a handful can see me. They all think I’m dead.

but that’s not Twitter’s problem. That’s your own problem.

Another voice of sanity:

!@#$ you all. Seriously. Twitter is FREE. You haven’t paid a cent to use it. You still don’t pay a cent to use it. It’s not a god given right, it’s not a utility. Don’t like it? Stop !@#$-ing whining and build your own social network. Go buy a server, install Rails, set up one of the open source Twitter clones, and take your stupid friends and your whining with you.
sad I’m irritated.

game neverending

Tuesday, April 1st, 2008

For April fools, Flickr brought back Game Never Ending – the game they were working on when they decided to make Flickr instead (not linking to the game itself, since it’ll likely be offline before anybody reads this).

I think they should keep it and ask Filo for some hardware to support it – in my opinion, the monetization strategy practically writes itself. It would probably be more profitable than 90% of Yahoo’s other properties! Though some might argue that isn’t much of an accomplishment…

GNE Monetization

Really, I just wanted an excuse to show off my desktop after I spent a few hours Sunday morning tinkering with gtk and firefox :)

So What Happened Last Night?

Monday, March 24th, 2008

Fail, that’s what happened. A big fat sack of fail.

So as I was working on mihasya.com, I was simultaneously tinkering with ked_core – a natural thing to happen, since mihasya.com is a test for how ked_core actually does when used in practice (it kicks ass, fyi). I got the idea to permit actionless views (more on how, once again, I did that better than you later), so I got all excited and immediately hacked up the code. So now I had this code that was directly applicable to mihasya.com (a lot of the inner pages don’t do much, so don’t need a controller function defined) in the ked_core svn, but not on the site.

The problem is: now that ked just ships as a big hunk of folders with the internal files and the site’s own files mixed in, the separation gets tricky. Also, my blog/ folder (the WordPress install) had to go under mihasya.ked/www/blog, as that was what my mihasya.com folder was symlinked to… Long story short, I straight up deleted mihasya.ked. That was fine, I thought, because I still had all that code in svn…. OOOOPS. Thank goodness for database storage.

Where This Leaves an Ambitious Mother F@#$%#

Well, this is a problem I gots ta solve. It’s plagued me for years, as applications come shipped in huge tarballs that just extract like they’re kings of the world. If you want to selectively update something, you have to cp files one at a time. Fuck that.

How do I elegantly, and from within the framework, permit the developer to upgrade ked files, but not affect his own? This could be solved easily by some sort of package manager like apt or rpm, but we don’t have that luxury. Or rather, I won’t give myself that luxury. This will be solved with bash, php, and svn in the spirit of minimalistic requirements. After all, it has to work on Dreamhost :)

What I Intend To Do

This is how it’s goin down, homegirls: I am going to write a shell script which will fetch a special file from a predetermined svn location (the repository doesn’t have to be static, as I’m sure ked will have thousands of mirrors as it sweeps the market ;) ) The file will contain a listing of files which are internal to ked. It will probably just look something like this:

...
inc/controllers/internal
inc/core
inc/tpl/layouts/internal
...
The script will check the internal files on the repository for updates (including a self-update), download them to a separate copy (to avoid messing up your own .svn folders, if any are present) and copy them into your own dev tree.

One problem I’m already seeing before I even start hacking this up is that www/index.php contains configuration information that I refuse to move into a conf file (extra file read) that might get overwritten in this way, but I can probably figure out a way to handle that without quite developing a full blown package manager variable manipulation deal. Or maybe I’ll just do that. Cuz I can, son!

Stay tuned for more on this and other ked shenanigans.

Dreamhost + SVN + WebSVN = WIN!!!

Sunday, March 23rd, 2008

I recently set up my public Subversion repository – I decided that setting up a sourceforge or google code account for my stuff would just be lame, given that I have my own website that I’ve recently started putting effort into making presentable. By default, however, svn displays a very basic browser that doesn’t really give any info and is just ugly:

crowley’s ugly svn

My 5 year old step-nephew (moptop from here on out) can do better than that. Here’s my how-to for setting up a baller ass looking Subversion tree like this one. Also, I just like ripping on Crowley.

Things we’ll be using:

  • Dreamhost panel’s svn manager
  • Subversion
  • WebSVN – a kick ass php web-based SVN browser
  • Enscript – a GNU app for highlighting source code.

We’ll start with the hardest, yet optional part:

Optional: Installing Enscript

If you want WebSVN to have broad highlighting support, follow this how-to to install it before we begin.

Setting up Subversion

  1. create a subdomain using this page. Mine is svn.mihasya.com.
  2. go to the dh svn manager and set up you repository. The two examples I’ll use are ked_core and mihasya.com. Make sure you make the repository a “public project”. Set up a username or however many you need. Your respositories can now be found at http://your.svn.subdomain.com/repository_name and locally at /home/username/svn/repository_name
  3. Do the usual commit/import routine so your repository isn’t empty.

Installing WebSVN

This part is easy. From your DH home folder run: (you should obviously replace the URL with teh latest WebSVN tarball and the svn.mihasya.com with the appropriate subdomain’s folder.

$ wget http://websvn.tigris.org/files/documents/1380/39378/websvn-2.0.tar.gz
$ tar -zxvf websvn-2.0.tar.gz
$ mv websvn-2.0/* svn.mihasya.com
$ rm -Rf websvn-2.0
WebSVN is ready to go. Going to your.svn.subdomain.com should now load WebSVN with no repositories.

Configuring WebSVN

Also easy. Now that your WebSVN files are in your subdomain’s folder (/home/mihasya/svn.mihasya.com for me) find the includes/distconfig.php and rename it to includes/config.php.

In that file, find the lines that look like this:

// $config->addRepository('NameToDisplay', 'URL to repository (e.g. file:///c:/svn/proj)');
Copy that, without the comments naturally, and change it to point to your repository. My example:
$config->addRepository('ked_core', 'file:///home/mihasya/svn/ked_core');
Save and refresh the WebSVN page – your repository should now appear. You could be done here, but if you’re not lazy, you could really be a rockstar. Like me.

Optional: Setting up Highlighting Using Enscript

By default, my understanding is that WebSVN only highlights PHP – probably just uses PHP’s highlight functions ;) Remember how we (might have) set up Enscript earlier? Well, now find this line:

// $config->setEnscriptPath('Path/to/enscript/command/');
Uncomment it and replace it with your path from step 1. Mine:
$config->setEnscriptPath('/home/mihasya/packages/bin');
Then find this and uncomment it:
// $config->useEnscript();
Enable Additional Extensions

If you’re like me and use Smarty with somethign like .tpl for files that are really mostly html, do this in the same section to tell Enscript what known filetype to associate that extension with:

$extEnscript['.tpl'] = 'html';

Optional (but awesome): Block Ugly UI Using Rewrite

There is still one problem to be solved. Going to http://svn.mihasya.com/ked_core still goes to the stupid old SVN interface (the one Crowley is using above). You can’t be doin that if you wanna be a rockstar. However, there is one thing it remember (which I initially didn’t): you use the exact same URL when running svn commands. Nothing a little RewriteCond magic can’t fix. Put something like this in the .htaccess file in your svn subdomain’s root folder (where we copied WebSVN earlier):

[ UPDATE: turns out you have to put the RewriteCond statement before every rule (if someone has a better way of doing this, holler); also added the [NC] flag to make the condition not case sensitive, just to be safe ]

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} !^SVN [NC]
RewriteRule ^ked_core$ /listing.php?repname=ked_core [R,QSA]
RewriteCond %{HTTP_USER_AGENT} !^SVN [NC]
RewriteRule ^mihasya.com$ /listing.php?repname=mihasya.com [R,QSA]
That second line makes sure that the URL isn’t being called by a Subversion client. Browsers will be directed to the pretty new interface, while svn will operate as usual. Fucking WIN!

Conclusion

Now you can be cool like me and show off your code off your own domain with a sweet ass interface. Not like the chumps with that generic garbage… Explore includes/config.php some more if you want to tailor things more to your tastes.

WebSVN TreeWebSVN Single File

ked_core update

Saturday, March 22nd, 2008

Basics

All code for ked_core and my other projects can now be found here.

Slight change in nomenclature (aka stuff I hate) – the package that contains the framework itself will now be called ked_core, to accomodate future projects like ked_pdo and ked_auth that will play nicely with the framework. Those will have to wait until I un-dumbass myself by doing some more reading. And just completely stop giving a fuck about school and dedicate all my time to hacking.

Some General Thoughts

I’ve decided I can’t call it an MVC framework – because I don’t believe in models in the way Rails does. I don’t think an application has to be based around a model. Just because Rails has a built in implementation is not a good reason, to me, to use one. I have legitimately written an application that was very useful, but used NO database whatsoever. Anyone is free to use a 3rd party model implementation or write their own, but ked won’t require one by default.

Change in Goals/Scope

So as I was fucking around with the code, I decided to stop and revisit my goal: building a framework that can follow a site as it grows from something completely tiny hosted on something like Dreamhost to a massively scaled site with its own farm. For that two things are needed: leanness (least possible number of required operations and disk reads/writes per page load) and maintainability. The overall goal is now to be able to just download a ked skeleton to any host with PHP5 (I’m using my 5.95/mo Dreamhost account as a benchmark; if it works there but not on your host, kill yourself), then be able to grow it from there and move it to any other host near seamlessly. The changes to the core are as follows:

  • ked will now only run through a single index.php file, which will then load all the appropriate files for all the controllers. It ends up actually being 1 fewer include per page, thus one fewer fs operation. I realize that isn’t a big deal if APC is involved with opcode caching, but remember – every little bit counts.
    • no apache configuration needed beyond RewriteRules in .htaccess.
  • ked now also supports grouping controllers/views into folders. Naming your controller admin_mainController adn placing it into /ked_app_root/inc/controllers/admin/main.php will work. Your views can then go into /ked_smarty_dir/templates/admin/main/viewName.tpl.
  • Similar functionality for layouts.
  • ked_core is still probably ~100 lines of actual code. Everything uses single quotes and only basic string operations – no regular expressions except in my print_r wrapper dump(). There are minimal advanced functions used – one instance of reflection, I believe.

My general stance on what ked will/won’t do also changes, so it will INDEED now wipe your ass for you for the sake of maintainability.

  • ked will generate controller/view skeletons for you via a webbased control panel (pending user permission limitations – to be investigated)
    • if PEAR_DocBlockGenerator is installed, it will use that to generate docblocks for those skeletons
  • ked will support phpUnit integration (but obviously won’t require it) as well as svn hooks to automatically run the unit testing and append test failure notices to the -m msg, citing who committed the failing code.

To Be Done:

  • the basic ked_admin package for skeleton generation/management (which will, btw, use ked_core ;) )
  • rewriting mihasya.com to use ked_core to demonstrate TEH POWAERS, hence its presence in my subversion tree – you’ll be able to compare the original tree with the ked’d tree.
  • investigating integration with PEAR_DocBlockGenerator, phpDoc, phpUnit, Subversion, and my taint.

Forum Etiquette

Friday, September 14th, 2007

Though I’m sure I’ve been guilty of this somewhere, it drives me absolutely NUTS when I am searching forums for an answer and find a thread with the exact problem I’m having, only to discover that after several solutions were proposed, the original poster just left the thread hanging without any sort of feedback on whether any of the solutions had worked.

Question: is it a good idea for forum software writers to implement an optional feature which would mark threads as open or closed (sort of like bugs in bugzilla) and bug thread starters who leave their threads open too long? What would be the best way to implement this?

SFTP on Windows

Thursday, September 13th, 2007

On with it, then :)

A while ago, Richard Crowley wrote that not having direct sftp access to the files you are editing encourages bad programming practice, at least for web programming. I forget what his exact complaint was and can’t find the entry now, but I agree in any case and can reconstruct my own argument for it – you write large chunks of code without testing what it actually looks like in the browser. Then, once you’ve finally synced up with the web server and hit refresh in your browser, you end up with either something that doesn’t work, or worse, something that appears to work but actually doesn’t because something is actually going wrong in one of the intermediate steps. Being able to hit Ctrl+S and then refresh your browser to see immediate results is invaluable to web programming and styling. It’s basically poor man’s unit testing. Having the ability to browse the tree of your web directory editing the files in it at will is also crucial. For what it’s worth, it’s also just so much faster and more convenient than having to hit upload in an FTP program or run a sync script.

Problem: most free IDE software (the only kind I like) does not have robust file tree browsing capabilities; the ones that do are usually limited to FTP, not SFTP. Coincidentally, the latter is what most hosts I’ve had to work on offer, and with good reason. Naturally, in Linux the solutions are ample, down to Nautilus having essentially native support for the functionality which integrates well with GEdit (I should note that my requirements for an IDE aside from file browsing are low to very low). However, I’m not quite ballsy enough yet to put Linux on my work laptop, and switching between two laptops depending on who I’m doing work for was getting tedious fast. Here was my list of requirements:

  • Decent Highlighting
  • Code Collapsing
  • File Browsing
    • SFTP Capability
  • Not painfully ugly
  • As cheap as possible
  • Lightweight would be a plus

One solution is to shell out the cash for something like Zend Studio, which handles SFTP beautifully – but that’s not how I do things. I needed something free, or at least cheap.

One solution I found was a program called “WebDrive” which lets you “mount” an SFTP connection as a shared drive. It’s not free, but it’s only $50. I figured that for the number of sites I could use this for, it might be worth the money, so I downloaded the free trial. However, I quickly discovered that this approach was very slow, at least in Eclipse (Note: though Eclipse seems like an odd choice given my low requirements for an IDE, I got into using it when I got to Yahoo! almost as a result of peer pressure – I had had access to Zend Studio at my previous job, but now had to choose a freeware IDE; the majority of the guys around me were using Eclipse or straight vi, so I opted for the former) so I wanted to see what it would be like in another IDE. The first thing that came to mind was jEdit, so I downloaded it and it seemed to work ok. However, jEdit felt incredibly ugly, so it was failing one of my requirements.

Crowley suggested Notepad++. It seemed to get lots of positive reviews online, so I gave it a shot (plus, I don’t question Crowley); it felt much better right away, though I won’t get into the details of why I liked it here. It even had an FTP plugin, but naturally no SFTP support. It worked alright with WebDrive, but I still did not want to pay $50 for it. Then I found this article on particletree.com by searching for “notepad++ sftp” in which one of the comments suggests using WinSCP as the file browser and setting its default editor to be notepad++. Though it involves having two windows open, I’m alright with this, as I do most of my code on a 19″ monitor (24″ when I’m in CA) so nothing is maximized anyway. Further, tweaking the WinSCP interface a little and doing some rearranging results in what almost looks like a sidepane file browser.

Solution: completely free super lightweight hacked-together IDE with SFTP support. I will probably be switching over to TortoiseCVS/SVN and abandoning Eclipse all together. I can only handle so many random Java crashes.

So if you’re stuck on a Windows machine and are looking for a way to streamline your work flow on SFTP hosts without spending any money, WinSCP+Notepad++ are a winning combo for you… as long as you’re willing to put up with two windows being open, aka you have a large enough monitor. Naturally, the search continues for an even better solution.

Update: I’ve discovered that Dreamweaver, which Yahoo! has a site license for, has the exact functionality I need. It’s free to me :)