Ramblings

October 16, 2008

Remember to check your emoticon path for Expression Engine!

Filed under: automation, expression engine, ruby, tool — michaelangela @ 5:50 pm

Getting ready to move a site from dev to production. I often use Charles just to make sure paths are doing what they are supposed to do. I had done an initial test moving from localhost to an actual IP address just to run through the process. I got everything except emoticons and it took a little while to track it down:

Expression Engine Migration Notes | WikiLab Notes

go to Admin > SYSTEM PREFERANCES > Emotican Preferences

Voila. Problem solved. To aid with this sort of thing in the future, this older post has some very helpful tips.

Configuring Expression Engine for multiple servers

The one remaining problem is that, upon installing EE, it hard-codes your site URL and application installation path all over the place, from config files to options stored in the database. This is what makes Expression Engine so unportable — moving from one server to another, say from development to production, requires updating this URL and path information in literally about a dozen places.

To aid with this process, a kind soul has written this ruby script:

Migrating ExpressionEngine from development to production – deeden.co.uk

I’ve never succeeded in migrating successfully using the manual method. I always miss something and have to deal with some small problem that inevitably crops up. Finally, I decided to make it easier on myself, so I wrote a script to perform the update for me. This will not be for everyone, however if you’re comfortable with command line scripts and ruby this may do the job for you.

I haven’t tried the config method or the ruby script yet but it’s good to know.

Advertisements

October 15, 2008

Python and PHP serialization

Filed under: dev, php, python, tool — michaelangela @ 5:57 pm

I have some data that I am pulling via Amara. I need to put that in a database. The app that uses that data is in PHP and would prefer the data to be serialized. Fortunately, there is help! 🙂

Scott Hurring: Code: Python: PHP Serialize implemented in Python: v0.4b

This is a python implementation of PHP’s native serialize()
and unserialize() functions.

Taken along with my perl serialize implementation,
this code will enable you to transfer simple data structures
between PHP, Python, and Perl using PHP’s data serialization format.

This code aims to be a very lightweight data transport
layer between PHP, perl and python using PHP’s native
serialization format.

grep instead of python?

Filed under: automation, bash, cool, linux, one-liner, tip — michaelangela @ 5:29 pm

I have an xml file with a listing of images that I need for a site. Typically I fire up IPython with Amara and do my xml wrangling there. But I also needed the files. I thought about using python to also grab and save the files but a little search led to this post. Ironically, while the tip to use Python is good, there was a tip to use curl to get the feed, grep to parse the images, and finally xargs to feed it to wget for downloading.

Thinking Serious » Using Python to Grab Images From a Web Site

curl -s http://99designs.com/contests/6999/feed | grep -Po “src=\”.*(png|jpg)” | grep -o “http.*” | xargs wget -q

My situation is a bit different though. There are no extensions on the files, they are in a tag, and I need to rename them with extensions. After a little Googling I used this which worked very well.

curl -s http://domain.tld/feed | egrep -o "<tag>.*</tag>" | egrep -o "<tag>(http.*)</tag>" | sed -e 's/<[^>]*>//g'
for f in *; do mv ./"$f" "${f}.jpg"; done

I still need to do some xml wrangling with Amara but the files are now just need to be moved to the right directories. Nice.

October 11, 2008

Notes: Photoshop Sparklines Script

Filed under: adobe, automation, javascript, photoshop cs3, tool — michaelangela @ 11:17 pm

Tufte Sparklines Photoshop Script | La Photo Vita

Sparklines can be hard to produce. Most graphing packages are designed to produce large graphs or charts, and it can be very hard to generate the wide-but-thin lines for incorporation in documents. This was the motivation for writing a Photoshop script that would automate the production of sparklines. It works by reading a data series from a text file and plotting a sparkline image as a Photoshop path, and then stroking it with the pencil tool. This produces a bitmap image which can then be cut-and-pasted into the target document. The user retains control of the color and line style of the sparkline by setting the Photoshop foreground color and pencil tool settings before running the script.

Notes: LOMO Photoshop script

Filed under: adobe, automation, javascript, photoshop cs3, tool — michaelangela @ 11:16 pm

Flickr: Discussing Fake-LOMO Adobe Photoshop Script in Technique

I saw that there are some PS actions for doing LOMOing but they don’t seem to handle multiple sized images well. I threw together this PS script to handle multiple sized images as well as non-flattened images.

Notes: Photoshop recursive save to web script

Filed under: adobe, automation, javascript, photoshop cs3, tool — michaelangela @ 11:15 pm

Ovidiu Predescu’s Weblog: Recursive export to Web in Photoshop CS3

Yesterday I was looking for a way to take a subset of the pictures I
have and convert them to JPG. I want to use the JPGs on a small Mac
Mini to make presentation in FrontRow using a newly acquired Canon SX7 digital projector (more on this in a later entry).

Unfortunately Adobe Lightroom does not offer such a functionality.
You can export all the pictures in a directory to JPG, but there’s no
way to take a directory, and recursively export all the pictures within
it to JPG while maintaining the directory structure they are in.

I could have written a small shell script to do this, but I have a
mixture of TIFF, JPG and RAW images that had to be processed. I wanted
to get the image processing capabilities from Lightroom or Photoshop,
instead of using dcraw. Adobe Lightroom doesn’t have a way to script
it, so I looked at Photoshop CS3 to do it.

Photoshop can be scripted in JavaScript, in addition to AppleScript. I came up with a small script that does the conversion.

October 1, 2008

Getting an int from math calculations in javascript

Filed under: cool, javascript, tip — michaelangela @ 6:02 am

Javascript – Casting to integer on arithmetic division… – Rexiology… – MSMVPS.COM

As Javascript been a weak-typed language, sometimes it’s not able to
cast a variable from one type to another. as in arithmetic division, if
one wants to output an integer instead of a double or else, here is a
way learned from this article that’s useful:

a = ( b / c ) | 0

by using a bitwise OR operation to cast a float / double
back to an integer, to have a way casting some numeric values back to
desired form.

As Javascript been a weak-typed language, sometimes it’s not able to cast a variable from one type to another. as in arithmetic division, if one wants to output an integer instead of a double or else, here is a way learned from this article that’s useful:

a = ( b / c ) | 0

by using a bitwise OR operation to cast a float / double back to an integer, to have a way casting some numeric values back to desired form.

Blog at WordPress.com.