Sunday, February 24, 2008

Free alternative to Flash / ActionScript

Flash is a technology developed by Adobe, which is quite popular for creating dynamic content for web pages. It lets you make animations, games and interactive applications.

To make these apps, most people use Adobes own development environment. However, their newest Flash Professional CS3 sets you back almost $700.

If you don't have that kind of money (or you are a cheapskate) you can still create Flash apps using the free haXe language. haXe is an open-source compiler, that lets you compile to not only Flash, but also Javascript and Neko thus letting you create both the client-side and the server-side of Ajax applications!

Sound interesting? Well it is! I'll point you in the direction of haXe:

You might also want a good editor to go with that. You can for example use FlashDevelop, which is free and open-source:

Saturday, February 23, 2008

Choosing a Python development environment

If you are going to be doing any kind of serious development, you will most likely want an integrated development environment (an IDE). This will help you organize your projects and source files, and give you additional tools like automatic code completion and syntax highlighting.

Many people get by using just their favourite text-editor, be it a simple one like notepad, or more complex editors like Emacs or UltraEdit. And there is nothing wrong with that, I guess - but me I prefer to use a tool where everything is integrated.

For Python development, there are quite a few free alternatives. Idle is one of them, and comes bundled with Python when you download it. It's a no-fuzz editor and shell, and is great for those who like simplicity. It's fast and does everything you really need.

If you want to step up a bit, there is Pype, or Python Programmers' Editor which is an editor targeted specifically at Python development. It has lots of nice features which helps you speed up development.

None of these are what I would call a real IDE though. For that, look to Eclipse. This is my favourite IDE for any programming language, not only Python. It was originally intended for Java, and is written in Java, and so can be a bit more than you need and also might be a bit sluggish at times. It does however have all the features you will ever need, and more.

Eclipse is fully modular, meaning that you can add support for different languages as you go along. Java, C / C++, Python, Perl, PHP - whatever you throw at it, you can be almost certain that there is a module for Eclipse that supports your language.

Also Eclipse is free and open-source, which is one of the reasons I like it so much.

There are of course also quite a few commercial IDE's for Python. I haven't tried any of them, but some of them (like the Wing IDE) look quite good. You might want to look for some evaluation versions, if you want to fork out some cash for a professional solution (though Eclipse is VERY professional).

Check out the links:

3D Programming

Are you thinking about writing the next Crysis? Well, you most likely won't. At least not by yourself. But if you want to write smaller games or virtual worlds in 3D, there are some good quality free libraries that you can use.

For me, this boils down to a battle between a cuddly pandabear and a trollish ogre, represented by two excellent free libraries called Panda3D and Ogre3D.

Panda3D is a library written by Disney, and maintained by Carnegie Mellon University's Entertainment Technology Center - while Ogre3D is a true open source project.

For simple usage, they are almost equal - but in my opinion Panda is easier to use while Ogre has the most features and cutting edge technology.

While both are written and optimized in C / C++, Panda is intended for programming in Python. If you are a Python user this is a good thing, as everything is very "pythonic". You can also get Python bindings for Ogre, but since this is more of an afterthought you can clearly see it's legacy from C++.

Why would I program a 3D application in Python anyway, you might ask. Isn't that really slow? Well, not really. Since all the 3D functions are already programmed in C / C++ there is no real slowdown in the rendering process. Your Python code is only "glue". And with Python, you get a lot more done in less time - so it makes sense if you are programming on your own or in a small team.

So in the battle of Panda vs. Ogre, who will win? If you are a C / C++ programmer, the choice is clear - Ogre is the most suited for you. If you, like me, like Python, the answer is more "it depends". I would go for Ogre because of it's more advanced features, but you might like the Panda better because it is very pythonic and a little simpler to use.

Check them out yourself here:

There is also Irrlicht, which is an impressive one-man effort. It also has a Python wrapper called Pyrr. It's real easy to start using, all you need is right there. However, it is somewhat lacking in features compared to Ogre and Panda, and seems to be geared at writing FPS games. You can check it out here:

Friday, February 22, 2008

Linux search and replace in files

So you want to replace a regular expression in multiple files under Linux?

Well, there are two convenient ways this can be done with a single line from a shell.

First, you can use SED

sed -i -e 's/source/destination/g' *.txt

"source" is of course the part to search for, and "destination" is what you want it replaced to. Also replace *.txt with whatever.

The second solution is to use perl

perl -pi -e 's/source/destination/g' *.txt

If you want something really nasty, you can use perl mixed with the 'find' command

perl -pi -e 's/source/destination/g' `find . -name '*.txt'`

Note the different quotes here... Might be a bit tricky to find, depending on your keyboard layout. This lets you replace in the files found by the find command, and is a quite powerful form of search and replace.

Thinking about learning a programming language?

Have you ever had an idea for a dream application, but never knew how to program it?

A lot of people starting to program use Java or C / C++. Java is considered to be easy, because it handles things like garbage collection for you, and there is no such thing as pointers - which is something that confuses new programmers a lot in C / C++.

Most end up using C / C++ because it is the "industry standard" - but this does not automagically mean that this is the best language. If you are thinking about learning to program, I suggest you check out the Python language.

Python is a "scripting language", but is extremely powerful. It can be used with ease for programming web-pages for example in the place of PHP or Perl, but also for full blown applications with a nice user interface and all the bells and whistles.

The saying among Python programmers is that it makes you 10 times more productive than if you were programming in C++, because you have to write a lot less code. This is an important point if you are programming by yourself or in a small team, because your program is ready for market in a much shorter time - and you also have a lot less code to maintain.

By using wxWidgets for Python, you can have a multi-platform (Linux / Windows / Mac) application with a GUI ready in a few hours, if not minutes.

Python really lets you do a lot of things that C / C++ doesn't, because the philosophy is that you, the programmer, should be in charge - and decide for yourself the best way to accomplish a solution to your problem.

I recommend you check it out if you are interested in programming:

If you want a graphical GUI builder, check out wxGlade, which can generate wxWidgets source code for Python and C++

Delete all emacs backup-files under linux

Do you ever use emacs on linux? In that case you most certainly have noticed that it creates backup files for you (filenames ending in ~).

Backups are great, but sometimes you don't want them cluttering your directories. What if you could remove them with a single command line? Well you can. The following line will remove all files ending in ~ from your current directory and all subdirectories.

$ find ./ -name '*~' -exec rm '{}' \; -print -or -name ".*~" -exec rm {} \; -print

More here: AnyExample.com

Welcome

Welcome to my little corner of the intarweb, if you have come here then you must truly be lost.

I will try my best to point you in the right direction from here, whereever that may be for you.

Expect to be given hints and tips, and links, to technology related stuff - things that atleast I myself find somewhat useful. Enjoy!