Archive for the ‘development’ Category

Using the patch utility to remove a patch on Magento Enterprise Edition

I am making an assumption here that you already know the normal forward-usage of the patch command. If you’re unversed In case you didn’t want to decipher the entire man page just yet, you’re in luck. I came across an instance where I had to remove a previous patch file from the Magento Enterprise code-base. The patch was originally applied as so:

patch -p0 < firstpatch.patch

Problems ensued, and I was given a new patch, however it was a cumulative patch so it couldn’t be laid over the first patch. So how to remove? After a man-page reading, it’s quite a breeze. You need the original patch to be removed, and use the patch number you used in the first patching instance. In this case it equates to the following:

patch -R -p0 < firstpatch.patch

now you can add the new patch.

patch -p0 < secondpatch.patch

Hopefully this will save someone a man-page reading on a small terminal in a dimly lit server room. :-)

 

Setup IntelliJ 9 for Lift Framework Development

This small tutorial may seem overly simplified but I think that a lot of newbies out there will find it helpful. I also would consider using sbt instead of just maven but this tutorial covers just maven.
I have been developing using Lift for a little over a year now and I found the IDE choices grim. I tried Eclipse, Netbeans and IntelliJ. My clear favorite is IntelliJ. It does not specifically support the Lift Framework but it does have great support for Scala and Maven. Here’s how I set things up.

Download and Install Maven 2.2.1: http://maven.apache.org/download.html

You MUST set your M2_HOME environment variable. Methods to accomplish this vary from system to system.

Go to a directory where you want to create your Lift app and run something like this(varies depending on archetype)

1
2
3
4
5
6
7
mvn archetype:generate -U        \
     -DarchetypeGroupId=net.liftweb        \
     -DarchetypeArtifactId=lift-archetype-basic        \
     -DarchetypeVersion=2.0        \
     -DremoteRepositories=http://scala-tools.org/repo-releases        \
     -Dversion=0.1		\
     -DgroupId=com.morroni.jagger -DartifactId=store-jagger

Download and install intelliJ 9.02 Community Edition or Ultimate: http://www.jetbrains.com/idea/download/

Open up IntelliJ and goto the menu item IntelliJ->Preferences. Choose the Plugins menu on the left and click the Available tab at the top. Type “scala” to search for the relevant plugins. Highlight the Scala plugin and click the little disk/arrow icon to install them.
plugins1

Open up IntelliJ and goto File->New Project

Choose Import project from external model and click Next
openproject

Choose Maven and click Next
openproject2

Enter the location of the folder where you generated your maven project and click next
openproject3

Select both profile radio boxes and click Next
openproject4

Make sure the only Maven project available is selected and click Next
openproject5

Click Finish.

When you are ready to run your project, right click on it and select Run “store-jagger [jetty:run]”
runit

Open up a web browser and go to http://localhost:8080
scfreenshot

 

Lift Framework Tips

Displaying a menu item only if a user is logged in. If they are not logged in, route them to /login

This is inside Boot.scala

1
2
3
4
val LoggedIn = If(() =&gt; User.loggedIn_?, () =&gt; RedirectResponse("/login"))
val myLoc = Loc("SecurePage", "securePage" :: Nil, "Secure Page", LoggedIn)
val myMenu = Menu(myLoc)
val entries = myMenu ::Menu(Loc("Home", List("index"), "Home")) ::: User.sitemap

Generate the api documents for a lift/scala project

1
mvn scala:doc
 

Wordpress iPhone Themes Are Cool

I noticed a couple of new plugins that are available for wordpress to provide an optimized theme for iPhone viewers. The specific plugin that I am using is called WPTouch. It has more features than I need and was a piece of cake to install. We are recommending that our Wordpress clients start using it.  Check out this blog from an iPhone to see what I am talking about.