Archive for the ‘Linux’ Category.

Linux tools on Windows

If you are like me, you don’t want to be bothered to remember if you are working on a Windows or a Linux box. Things like ls, curl etc, should just work. So if you are missing the Linux tools on Windows and you don’t want to install the heavy Cygwin, then the is an alternative, Gow is a lightweight set of Linux Tools for Windows.

Gow can be found here

Linux daily driver

As I posted previously , I was thinking about switching my newest computer I use day to day to Linux instead of Windows. Recently I did the big switch, not really that big when you consider Mac, Linux and Windows are starting to look and feel pretty similar to each other. In any case I installed the latest Linux Mint 13 about a month ago and I’m very happy. I was cautious and installed Win Xp in a Virtual machine with the programs I was already using on my Win xp, frankly I haven’t turned it on for a few weeks now. After the install I plugged in the old Win hard drive, to my surprise Linux mounted it for me without any tinkering. I can access all the windows files directly from the hard drive, sweet.

I was most worried about video production on Linux, I knew Mint takes good care installing all the video codecs, no problems there. I found WinFF which is great for any conversion between different video formats. The video editing software I like the best are Cinalerra, OpenShot and Kdenlive, in my case I like Kdenlive best. I did a couple of short videos with it that came out pretty good. The only complain is that the finer control of video and audio is not as easy as in Adobe Premier. I still have Premier on the Win Xp running in virtual machine, but I’m trying not to reach for it. The overall productivity on the desktop has gone up and one can’t beat the workspaces. With the workspaces you can group together programs your using together. Often I find myself having a browser and email in one workspace. Development tools in another and sometimes terminal, database tools in another. Things seem to be more readily available to you than in Windows. I also like the look and feel, graphics are smother and better overall.

To answer the question I was going to answer. Am I happier on Linux than Windows, do I like the switch ?
Yes, you bet ! I just can’t figure out why I didn’t switch sooner. I might have something to do with old habits. You just get used to something and you stick with it. In the past when I would install Linux on my old box there was always some tinkering under the hood. Not good for the average user that is not technically inclined. However with my Mint 13 install I have not had to tinker under the hood for anything at all, it just works !

Tomcat multiple instances on Linux, Ubuntu / Mint

I was trying to figure out how to run multiple instances of Tomcat6 the other day on my Mint Linux. After a bit of searching and poking around I came to a very slick solution. But it took a while to find it, so I figure I will share the quick and dirty here, to get you up going quickly if your searching for the same.

Lets go through the whole thing, install Tomcat6
>sudo apt-get install tomcat6

You might have to set your java path if not set already, for example
>export JAVA_HOME=/usr/java/jdk1.6.0/bin/java
To check the setting
>echo $JAVA_HOME

You probably want to install the examples as well, just to mae sure things are working servlets, jsp etc,
>sudo apt-get install tomcat6-examples

If all is well as you would fully expect, you can start your Tomcat
>sudo sh /etc/init.d/tomcat6 start

And in return you will be able to access your tomcat in your browser at
http://localhost:8080

So lets take a look at how to configure multiple instances on the same linux box. Go to a directory where you want your new tomcat instance located. Then you do something like this
>tomcat6-instance-create myInstance

This will create a new directory called myInstance which will host your new instance of Tomcat. It will have it’s own configuration files, logs, etc. The first thing you probably want to do is to go to the config directory and change the ports in the server.xml file. Once you have the ports changed from the usual 8080 you can start your instance from /myInstance/bin directory.
>sh startup.sh

Just as you would with any other instance of Tomcat and shut down with the shutdown.sh script. Next time you need another instance on another port just create a new one
>tomcat6-instance-create myInstance_8030
and so on and so forth.

All the details can be found in the Ubuntu documentation.

It’s time for daily Linux Mint

I have always run my Linux on a hand me down box. My current computer, the one I’m using daily always runs some flavor of Windows. When I buy a new computer as the old one isn’t fast enough I will take the current one and make it my new Linux box. As such the Linux box is always one generation or more behind. That means old hardware that doesn’t even have good graphics.
It is that time again, I need a new computer soon. As I was thinking about it I was thinking how well my Linux desktop will run on the new hand me down window box after all it’s still pretty powerful. Then I thought, I have been saying to myself for years that I should start running Linux as my daily computer. I never felt it’s quite “there”, but with my latest Linux desktop experience on Mint 10 I really think it’s “there”.
I do also know why I think its really there, there were two problems that bothered me in the past. The graphics and the resolution on the desktop were just not good enough. I could never get it right on Ubuntu, after I switched to Mint it was practically setup for me automatically. Something I had been digging for both from control panel config settings and lower lever configuration on Ubuntu, it just didn’t happen. The second thing is that I’m used to the windows keyboard and the numeric keypad works differently on Linux. Yes they have windows compatible mode as well that you can set and your good to go. Once I had both these things going I have been pretty happy on the Mint desktop, pretty productive as well.
I think the time is really here, I’m getting a new daily computer that’s going to run Linux Mint. I will keep the current / old box around for windows for a while, just in case. However I will be running the windows stuff I might still need in a virtual machine on the Linux box. That should take care of any windows needs I might have. I can’t see many off hand, maybe some graphics and video editing. Open office will take care of the usual documents or google docs might do just fine. Although Mono develop is available I will most likely have to run Visual Studio, Mono is always a little bit behind .Net. The good news is that Eclipse works fine on any platform. Frankly there is not much that I have to run on Windows anymore and Linux is getting to be pretty nice and usable desktop. Linux has of course always been really strong as a server and that won’t change.

Adobe Air development

I was talking to a friend about lack of a good interface for discovering NetFlix movies that do actually stream. The problem is that most of the movies are DVD distribution only. Further the streaming movies are sometimes streaming and sometimes not. It has something to do about when they are showing on TV. If your like me, you want to watch your movie at the end of the day when there is nothing on TV. In that case you want it streaming right there and then.

So I figure why not create a small app that will keep a list of the movies your wanting to see and it should be able to refresh and show you which ones are available for NetFlix streaming at any given time. Sounds easy enough, but there is a catch, I wanted it cross platform as my friend mostly uses a Mac. Hmm so I was thinking that’s easy enough just create simple C# program that will run smoothly on Mac under Mono. No that’s too easy, then it came to me, I have wanted to look at Adobe Air apps, this is a perfect opportunity. Let’s give it a try, as added bonus I wanted to do some dev on my Linux box. It should be fun to create this little app on the Linux and have it run on PC and Mac as well.

Well it turns out that Adobe only supports the FlashBuilder on Win and Mac, no Linux for you my friend. But we don’t give up that easily, I don’t want to run under Wine, turn to google and I find Fb4Linux. As it turns out after installing a bunch of libs and the FlashBuilder and some Sdks and such that I couldn’t get it to run under Linux ( I might try again later ). I’m probably not running the same versions of stuff as the author of the instructions, or maybe I just can’t follow instructions that well. Oh well, back to Windows, get the install from Adobe and it installs fine, then run the IDE, it plugs into Eclipse. Sure enough nothing to be found there, but wait a minute, not only do they ( claim to ) install it as plugin in your existing Eclipse, they also install a whole new instance of Eclipse. Sure enough when I run that new instance FB comes up and works as expected, you can start a new FB project etc.

Now with all the install trouble out of the way let’s give it a spin. File -> New Flex Project, the basics are setup for you by the wizard. Drag a couple of controls on the panel, goto properties and create click event for the button, there you have it “Hello World” Then click export, go through the wizard and an .air install file has been created. That’s pretty nice considering that I didn’t read any quick starts tutorials. But wait a minute, I click the air file to run it on my desktop and get some error indicating corrupted Air install file, contact the provider for a new file etc. Google search to the rescue and after un-installing and re-installing Air, nothing had changed. Then I uncheck the option of having a Timestamp in the digital signature of the .air file and that did the trick, now I can run and install, uhh.

Things seem to be looking up, time to code this puppy….. when I get to it, not sure if I’m going to pursue that or not, might be a follow up post. Notice all the javascript, might be too web-ish for my taste.

Here is Hello World in code

<?xml version=“1.0” encoding=“utf-8”?>
<s:WindowedApplication xmlns:fx=“http://ns.adobe.com/mxml/2009”
                                           xmlns:s=“library://ns.adobe.com/flex/spark”
                                           xmlns:mx=“library://ns.adobe.com/flex/mx”>

                <fx:Script>
                <![CDATA[
                        import mx.events.FlexEvent;
                       
                        protected function button1_clickHandler(event:MouseEvent):void
                        {
                                txSome.text = “Hello World !”;
                        }
                ]]>
        </fx:Script>

        <fx:Declarations>
                <!– Place non-visual elements (e.g., services, value objects) here –>
        </fx:Declarations>
        <s:Button x=“37” y=“10” label=“Button” click=“button1_clickHandler(event)”/>
        <s:TextArea x=“37” y=“52” id=“txSome”/>
</s:WindowedApplication>

And the app itself

Update
—–
I got Flex builder working later on the Linux box after some tinkering, that’s how the sample looks there.

Custom Nant Task

When using Nant there is not much you can say is lacking. Sometimes you find yourself wondering why you are cutting and pasting good amount of code between different scripts. There has to be a better way of reusing code and sure enough there is. Just write your own Nant extension and it’s pretty simple, let’s take a look.

First create a class that extends the nant Task then declare the name of the task and setup the properties you want available to the user. Lastly you will have ExecuteTask procedure that will be called by Nant when your Task executes. That’s all the magic !

[TaskName(“setVersionAssembly”)]
    public class CxSetVersionAssembly : NAnt.Core.Task
    {
        [TaskAttribute(“file”, Required = true)]
        [StringValidator(AllowEmpty = false)]
        public string file
        {
            get { return msAssemblyFile; }
            set { msAssemblyFile = value; }
        }

        [TaskAttribute(“buildNumber”, Required = true)]
        [StringValidator(AllowEmpty = false)]
        public string buildNumber
        {
            get { return msBuildNumber; }
            set { msBuildNumber = value; }
        }

        // Executes the nant task
        protected override void ExecuteTask()
        {
            // Don’t catch errors, it will display in the build log if any
            Project.Log(Level.Info, “start setVersionAssembly”);
            ChangeAssemblyVersionNumber(msBuildNumber, msAssemblyFile);
        }
}

When you use it in your Nant script you will have to load your assembly first. Once your assembly has been loaded you can start using your custom Task.

<loadtasks assembly=“bin\debug\DE.Nant.Extensions.dll”/>

    <setVersionAssembly
         file=“${tempFile}”
         buildNumber=“3.333.3.3000”
    />

This is a very brief and simple example, there are bunch of properties and other goodies you can use as you build out your custom Nant Tasks.

The Custom Nant Task I wrote is used to update the version of our .net assemblies during build. Attached is the complete code including Nant script and unittests. Get the code