Clearing OpenCart Sample Data

I’ve been dabbling around with OpenCart lately after needing to take a much needed break from Magento. One of the things I needed to do was wipe out all of the sample data which was added during the initial setup of the catalog.

A quick search online lead me to a thread on the community forums. The technique described there worked perfectly, but since it wasn’t totally portable, I hacked up a little script which improves things a bit. Namely:

  • Brings everything into PHP for easier refactoring should tables be added/removed or have their names change
  • Uses the native OpenCart API so it’s guaranteed to work so long as their DB libraries work
  • Uses your DB configuration (read: no find/replace for that annoying DB prefix)
  • Use TRUNCATE TABLE ... rather than DELETE FROM ... to reset the auto increment counter.

You can find the source in this Gist on Github.

To use it, just call:

php destroy-sample-data.php -p /path/to/your/opencart/directory

If you forget to pass in the -p option, it assumes the current working directory. Note: If that’s how you’re doing it, you’re doing it wrong. Hopefully I shouldn’t need to explain why…

Posted in PHP | 2 Comments

JavaScript Design Patterns

For those who are interested, I’ve started cataloging some of the design patterns common in modern JavaScript programming.

For those of you who have been following me for some time, you’ll recognize this as an evolution to a post series I began writing last year. I think that by moving it out of this blog and into a public Github repository makes more sense and will encourage more people to contribute to it.

You can browse the code directly in the repository but it’s far more useful to simply fork the repo in its entirety:

git clone git://github.com/mgirouard/JavaScript-Patterns.git

If you have a pattern you want to contribute, please clone, modify and submit your pull request!

via mgirouard’s JavaScript-Patterns at master – GitHub.

Posted in JavaScript | Leave a comment

High-performance JavaScript: Why Everything You’ve Been is Wrong

I’ve been going through some old videos from the YUI podcast. This is an old one, but a good one.

via Joseph Smarr: “High-performance JavaScript: Why Everything You’ve Been on Yahoo! Video.

Posted in JavaScript | Leave a comment

Cache on Delivery

Epic hack for mining memcached data. Well worth the 20 minutes of digestion time.

via Slideshare.

Posted in Bookmarks | Leave a comment

Blueboxing, Revisited

I just had one hell of a nostalgic moment after watching the two videos below on blueboxing.

Steve Jobs has a wonderful way with words, but the most notable quote in this video is clearly:

If we hadn’t made Blue Boxes, there’d be no Apple.
– Steve Jobs

But it should go without saying that the video with Cap’n Crunch in it is going to be my obvous favorite.

Seeing Woz and Cap’n telling the story of them getting caught at a payphone reminds me of when I was popped while beigeboxing (think of that as the “gateway drug” of boxing if you’re unfamiliar with these concepts). Hearing Jobs proudly go on record as saying that “If we hadn’t made Blue Boxes, there’d be no Apple.” makes me not worry too much about it either; though, from the way the story unfolds in the video, I think that they got off a lot easier than I did.

via 9 to 5 Mac.

Posted in Misc | Leave a comment

Falls from the South Rim

More Yellowstone awesomeness.

Posted in Misc | Leave a comment

FCC to Developers: Push Us Forward

The whole Gov 2.0 initiative is nothing short of magical to developers like me. I mentioned previously about the MTA’s recent change of heart so it should be clear that this kind of news really makes my day…

The United States Federal Communications Commission is calling on web developers to help push the agency forward. The FCC Chairman spoke at the O’Reilly Gov 2.0 Summit in Washington D.C., as the organization announced four new RESTful APIs and a new website aimed at fostering a developer community around FCC data and services. It’s a first step that hinges on how the FCC can incorporate input from developers and create self-sustaining value.

Personally, I find the Census Block Search API to be the most interesting of the four mentioned in the original post on Programmable Web, though it’s obvious all are worthy of a good weekend of attention.

via FCC to Developers: Push Us Forward.

Posted in Bookmarks | Leave a comment

Traffic Jam

Sorry for going dark, but as all of you know, there are only two reasons for me doing so: intense work and travel. As you can see below, there wasn’t much work going on.

This is what a traffic jam looks like in Wyoming coming into Montana from Yellowstone’s Northeast Entrance…

Other sizes are available if you’re interested.

Posted in Misc | 2 Comments

WordCamp NYC 2010

WordCamp NYC 2010 is officially on the calendar this year and I’m looking forward to spending some time my fellow bloggers and developers.

WordCamp NYC 2010 will bring together the New York community of WordPress-loving web publishers and developers the weekend of October 16, 2010 at Baruch College.

Ticket sales will open mid-September, but for now, mark your calendars!

The call for speakers was announced yesterday and I put my proposal (below) in just a few minutes ago (offering some backstory and elaboration to a past post).

I can’t wait to see you all there.

Proposed Topic:
“Learning to Love WordPress: The Story of Me Pulling My Head Out of my A**”

Description:
Once upon a time (about when PHP 5 came around) I found myself discovering the wonderful land of enterprise development. ‘Patterns! Abstraction! Architecture!’ I would proudly profess to the neophytes who learned from me. Whenever the topic of WordPress came up, I’d point and laugh at the amateur who would dare bring such a topic up during an adult’s conversation. ‘I could write a blogging system 100x better using my own framework…’ It wasn’t long before I came to the realization of what actually matters in the real world: software that creates value simply by working. Oh yeah, I never got around to writing that blog either…

via WordCamp NYC 2010.

Posted in WordPress | Leave a comment

Ultracompressing JavaScript and CSS

Just read about an incredible way to compress JavaScript and CSS using PNGs on Sitepoint today.

This hit everyone’s radar from the recent 10K Apart contest where a few contestants used this to cleverly circumvent the size budget.

You can read a quick and dirty summary of the technique on the Sitepoint blog, but if you’re interested in the details of the technique and implementation see Jacob Seidelin’s blog as well as the PNGStore library.

Posted in Bookmarks | Leave a comment