Binary Residue

by Alexander Rødseth

Jul

9

How to paint directly on UV-textures in Blender (in 15 steps)

By Alexander

Here’s one way of doing just that:

  1. Learn the basis of the Blender user interface. There’s a nice introduction at blender.org. The introduction uses the term “window” for the 3D-view and other views. I will call them “views” and refer to the content as “panels”.

    Quick version of the introduction:

    • Right click the borders between views to join and split them
    • Middle-click/drag to move the contents of a view around
    • Scoll the mouse-wheel to zoom in or out from the contents of a view

     

  2. Start out with a 3D-view, the UV/Image view and a buttons view, as shown here:
    start

     

  3. Select the cube, press Tab for edit mode and u to unwrap.
    Select the bottom choice: Unwrap (smart projections).
    (If you have complicated 3D-object you might want to mark seams and unwrap with another method).
    Click ok.

    unwrap

     

  4. In the UV/Image view, select Image->New and click ok.
    Scroll the mousewheel down to zoom out, if needed.
     
  5. Press F6 and select texture type Image.
     
  6. With the tiny button in front of Load, select the
    image you created in step 4 (Untitled)

    texture

     

  7. Press F5 and in Map input click the litte UV-button
    (lower right of the screenshot)

    uv

     

  8. In the 3D-view select Texture paint instead of Edit mode

    texturepaint

     

  9. Press F9 and select a color in the Paint panel

    color

     

  10. Now, just paint directly on the cube! Notice how the image that is the UV-texture also updates when you paint. The cube can be rotated with the middle mousebutton.
     

  11. In the UV/Image view, enable painting. Now you can draw directly in the UV/Image-view too.
    uvpaint

     

  12. It is possible to turn off the grid and axes in the 3D-view with View->View properties.
    grid

     

  13. If you switch the 3D-view back to edit mode with Tab, you can paint in the UV/Image view while also seeing the lines of
    the UV-map. Switch back to Texture Paint with Tab if you want to change the brush or color.

    editmode

     

  14. Press F12 to render.
     
  15. That’s it!
    render

     

Now you know how to paint directly on your 3D-models in Blender. :)

May

3

Life is not a road

By Alexander

Life is not like a road.
On a road, you can go back.
On a road, you’re happy to get to the end of it.
On a road, you can stop for a while.
Specifically, there are no crossroads in life.
The road metaphor is silly, and it makes people unhappy.

Life is more like a pink rubber jumpingball.
Sometimes you might fall off, but if you’re not hurt,
it’s easy to get back on.
It’s often fun, but requires a good deal of energy.
It goes up and down and you don’t really get anywhere.

Jan

11

Judging programming languages by the results

By Alexander


There is much to be said about programming languages. If I mention any language, someone will always have something bad to say. The syntax might be ugly, a feature may be missing or the executables might run too slow. Even if you benchmark languages, you can adjust what’s important to you to make almost any language win the benchmark. The really troubling thing is that even if you found your perfect language, that was theoretically brilliant, you still might not be able to become productive with it. Even if it had all the features and the nicest syntax in the world, it still might not be efficient for developing a real-world program.

About six years ago, I started programming with Python. It’s wonderful in so many ways. And if you create a real executable that is optimized to native code with Psyco, you can’t just dismiss it just for being a scripting language either, like some people do, since it won’t matter for all practical situations. However, any Python-program above a certain size get to feel the downside of the dynamic nature of the language. Parts of a Python-program can be totally wrong, but go unnoticed if it’s in a rarely used part of the program. In small programs, this isn’t a problem, since most of the code is tested every time it’s run. But for larger projects, the code hidden in exotic branches quickly can get out of hand. To compensate for this, all companies I know of uses testing-frameworks to test as much of the program as possible with small specially made tests. I’ve worked for a company like this, where the flagship-program was written in Python and we used as much time writing tests as writing the actual program. This doesn’t make Python bad, I still love it, I’m just saying that for programs over a certain size, a lot of testing is required. This problem is also in place for Ruby and all other dynamic languages.

So, after my encounter with Python (and several other languages), I tried searching for a solid language. A language that would give me the feeling of robustness and completeness - a language that would compile executables I could really trust. I learned Scheme at the university, Haskell in my spare time, went through an Erlang tutorial and took a second look at Lisp. Scheme and Lisp are just so much writing. Erlang looks great, but Haskell is the language that really convinced me. Haskell has a strong background from academia, which really shows if you visit #haskell at irc.freenode.net - it’s filled with phd’s and whatnot. So, off I went to learn Haskell. I read tutorials, bought a book, asked questions at IRC and wrote small programs. And indeed - Haskell feels incredibly solid. When you’ve written a program, then you really know that you can trust it. It may take a few attempts to make it compile in the first place, but the result is pure rocket science.

Python and Haskell are opposites, in many ways. Python is a dynamic and object oriented scripting language, while Haskell is static, functional and easy to compile to native executables. Python is like a young dolphin while Haskell is like a big white rhino.

Then I discovered Pixel, a program like Photoshop, written by a single Slovakian guy named Pavel Kanzelsberger, which rivals Paintshop and The Gimp. And unlike Photoshop, it runs on Linux and many exotic platforms like BeOS, QNX and SkyOS. I wonder if it runs on Haiku, please let me know if you find out! I downloaded the demo a few hours ago, and it looks great. The interface is smooth and responsive, and it’s at least as comfortable to work with as Photoshop, Krita, The Gimp, Paintshop and the like. Since it’s uncommon that a program runs on so many platforms - especially programs made by a single guy - I did some research and found out that it was made in Pascal. Pascal! The language of my childhood, right after I learned QBASIC.

While I was first surprised by this, another great program written in Pascal came to mind: Fast Tracker II. It’s a brilliant program for making music with samples, still to see its equal on Linux. Soundtracker is functional, but ugly and Cheesetracker is an Impulsetracker clone. Milkytracker looks great, though, but I wish it was open source. Why select the lukewarm “freeware” instead of trying to earn money like “Pixel” or going the full way with open source? I bet FT2 would be open source if it was written today.

Anyway, to get back on track. My point is that some of the applications I’ve seen written in Pascal are absolutely brilliant! Even though there are good programs written in other languages too, of course, there is something special about FT2 and Pixel that just seems to be harder to achieve with other languages. This might just be my very subjective feeling, but it is my heartfelt impression so far. Besides, the free pascal compiler is really good! It’s mature, compiles quickly, is more cross platform than the average program written in C (not many C-programs are as cross platform as Pixel). It’s object oriented, has templates and is a modern, up-to-date language, unlike the old dialects of Pascal. And Lazarus, an IDE that looks a bit like Delphi, is a lot more responsive then say Eclipse, while having many of the same features. The screenshots of Lazarus looks a bit dated since they compiled Lazarus with the old Gtk. Gtk2 with nice fonts is now possible. FPGUI looks promising too.

Judging by the actual results, in form of applications, Pascal might be the thing! For sure, I’ll give the Free Pascal Compiler a shot next time I’ll write a full fledged GUI-program. What would you choose for your next project?

Nov

13

Android - it works

By Alexander


I downloaded the Android SDK from Google and also the latest version of Eclipse. The documentation for Android is better than expected, with an API that gives a good overview, a tutorial that works flawlessly and even a short video presentation.

Eclipse Europa (3.3) starts up real slow compared to my other desktop programs, but it is stable and has an abundance of features. My experience with Java-programs for the desktop (not for the server) is that they always use a lot more time to start up compared to other desktop programs.

I needed to change the PATH in my environment to set up the SDK, but this is well documented and was easy to do. The example worked straight away, and the emulated Android (mobile OS) was fun to try out and looked polished.

Compared to my ordinary Desktop experience, Android is cumbersome to use (the screen is small and you use the arrow-keys a lot), but it’s on par with Opera Mini 4 which I have on my cellphone.

Due to the openness of Android, the cleverness of the Google employees and the simple design that we are starting to take for granted, I have no doubt that Android will become widespread real quick. Compared to what I’ve seen of the interface for iPhone, Android is not as smooth yet. But, Android has several huge advantages:

  • It’s easy to get started to develop for Android
  • Developers like the Android SDK, since it is incredibly well thought out and open
  • The standard GUI on Android can and will be improved by the hordes of developers out there
  • Everything is ready for innovation to happen on the Android platform, expect at least one killerapp
  • The GUI and the applications are likely to improve at a rapid rate
  • Google is offering a cache price for developers
  • Many mobile phone companies can unite instead of developing crappy systems on their own

If the API is as well thought out as it looks, the libraries as stable as they should and Google as open and non-evil as it can be, this is bound to be a winner.

Nov

6

My first .deb

By Alexander

Remote

After finding out how to use my mobile phone for controlling the cursor on my PC, I decided to make it easy for others by making my first Ubuntu package.

Here’s how you do it if you’re using Ubuntu Gutsy and your cellphone supports it:

  1. Install Remote v.0.1 by clicking the link, selecting “GDebi” and clicking “Install”.
  2. Turn on bluetooth on your phone
  3. Press alt+f2 and type in remote
  4. Select your phone from the list
  5. If needed, the cellphone and PC will ask for a pin-code. Make one up or type in 1234
  6. Answer “yes” when the cellphone asks if you want to control your PC
  7. Use the arrows to control the mouse-cursor

Enjoy the smooth and relaxing experience of mobile browsing - the other way around! :)

Nov

3

A solution for your calendar

By Alexander

GCal

I’ve tried various ways of keeping track of my own calendar: a plain little notebook, several palm pilots, the hipster pda and a Moleskine. Most of them worked perfectly fine, for a period of time.

However, what I really want is to synchronize a web calendar, a calendar desktop program, my palm pilot (over bluetooth) and my cellphone (over bluetooth), all in glorious open source under *nux. Yesterday I researched this possibility, but we just aren’t there yet. Opensync is in the making, but it’s cumbersome to use, and even after browsing the web for hours after a way to do it, I was unable to synchronize either my palm or my phone. Bluetooth works perfectly fine, the mechanisms are in place in both gadgets, it’s the software for synchronization and communication with specific devices that just isn’t there yet. (For the record, I’m good friends with regular serial/usb palm synchronization and the commandline-tools for bluetooth in general).

So anyways; I gave up on synchronization-nirvana and decided to settle for a calendar on the web that would synchronize with my desktop. Sunbird is the new cool program on the block here, so I decided to give it a try. First I tried the 0.5 version that is in the repositories for my distro, but then I found out that the extension that synchronizes with Google Calendar needs version 0.7. (Google Calendar is a very usable calendar, just make sure that your calendar is not public). After installing Sunbird 0.7 manually, including the “Provider for Google Calendar” extension, I’m a happy chap. The synchronization works perfectly fine in both directions, I can work comfortably with the calendar at home and on any computer with a browser. Great. :)

Click the little article-image (created with the brilliant Liquid Rescale plugin) to see a large version of the screenshot.

Sep

27

Gate 88

By Alexander

Gate 88

About a weak ago, I discovered a great little game, Gate 88. You control this little ship and can speed around in what seems like infinite space. However, you can also build stuff, research, shoot stuff and bump into things. Gate88 is like a colorful combination of the action of Asteroids, the strategy of Starcraft and the flow of …Flow.

The amazingly fitting old-school music, smooth animated vector graphics and hypnotizing scrolling backgrounds makes the game quite enjoyable. The gameplay is refreshing and unlike anything I’ve ever played before. I’ve only tried the single-player mode yet, but I’ve heard that the multiplayer-mode is supposed to be even better. I recommend giving it a try, it even has a built in IRC-client. ;)

I’ve recently read an article advocating links describing actions like “click here”, so it’s not old-fashioned to do so anymore:

Click here for the webpage of Gate 88

Jan

4

Haxe is wonderful

By Alexander

Haxe

Using the open source combination of neko (a virtual machine) and haxe (a language + swf-compiler), you can create wonderful things! I wouldn’t be surprised if haxe shows up in the Debian repositories any day now. Here’s a little test I made. Paint with fire!

Nov

3

Four programs and a shortcut

By Alexander

The flame of Vim!

Firefox 2.0: press [ctrl]+[shift]+[t] to undo closing a tab

Nov

1

Ten steps to make ALSA and Flash 9 beta work on Ubuntu

By Alexander

Update: I strongly recommend PulseAudio and the flashsupport-lib instead

Worked for me:

  1. Remove all leftovers from Flash 7, or other flash plugins, from the system:sudo aptitude remove flashplugin-nonfree flashplayer-mozilla libflash-mozplugin
    sudo rm /usr/lib/mozilla/plugins/libflashplayer.so /usr/lib/firefox/plugins/libflashplayer.so /usr/lib/mozilla-firefox/plugins/libflashplayer.so /opt/swiftfox/plugins/libflashplayer.so /opt/flash32/libflashplayer.so
  2. Remove all leftovers from Flash 7, or other flash plugins, from your home-dir:
    rm ~/.mozilla/plugins/libflashplayer.so
    rm ~/.firefox/plugins/libflashplayer.so
    rm ~/.mozilla-firefox/plugins/libflashplayer.so
  3. Start your browser, visit “about:plugins” and make sure that you have no flash-player installed. (It may alternatively appear as something with “SWF”). If neccessary, remove all files that is named something with “flash” from the directories where libflashplayer.so resided.
  4. Flash 9 can use Alsa instead of OSS, which is not only preferrable, but the only way I could make it work. Firefox/Swiftfox needs to be aware of this, and you can make it known by editing /etc/firefox/firefoxrc. Make sure that FIREFOX_DSP=”none”.
    gksudo gedit /etc/firefox/firefoxrc
  5. Get libflashplayer.so from Adobe by downloading and unpacking the file in one go:
    wget http://www.adobe.com/go/fp9_update_b1_installer_linuxplugin -O- | tar zxvf - --strip-components=1 --no-anchored libflashplayer.so
  6. Move the plugin to the Firefox-plugin-directory on the system:sudo mv libflashplayer.so /usr/lib/firefox/plugins/
  7. Link or copy the plugin to wherever else you wish to have it:sudo cp /usr/lib/firefox/plugins/libflashplayer.so /usr/lib/mozilla/plugins/
    sudo ln -s /usr/lib/firefox/plugins/libflashplayer.so /opt/swiftfox/plugins/
  8. Make sure Alsa is working, follow any tutorial on the web. If this command plays a sound, it works:ls -rS /usr/share/sounds/*.wav | tail -1 | xargs aplay
  9. Now, here’s the thing that took a lot of time for me to figure out. It’s not enough to make Alsa play sounds, it has to be configured so that the default Alsa-device and soundcard is the one you wish to play sound through. This may not be an issue for you if you only have one soundcard. Skype has (or had) the same problem as Flash here, so there are some tutorials in connection with Skype that might work for you. For me, it meant:- Commenting out the soundcard-module I didn’t want to be first from:
    /etc/modprobe.d/alsa-base(You can find the name of the modules for each soundcard with a combination of looking in /proc/asound, lspci, lsmod, dmesg and aplay -l)- Then adding the same soundcard-module to the bottom of /etc/modulesCheck that the soundcard you wish to play through is listed first with this command:cat /proc/asound/cards
    - Then, making sure that there weren’t any surprises in /etc/asound.conf or ~/.asoundrc.- And finally ending up with an ~/.asoundrc like this:

    pcm.lydkort0 {
    type hw
    card 0
    device 0
    }

    pcm.lydkort1 {
    type hw
    card 0
    device 1
    }

    pcm.flash {
    type plug
    slave.pcm "lydkort0"
    }

    pcm.!default {
    type plug
    slave.pcm "flash"
    }

    “lydkort” is Norwegian for “soundcard”, you can change the name as you like. This file probably won’t work for you if you’ve got a different setup from me, but it might be a starting-point for editing the file. The “!default”-name is essential, however, and if you change “flash”, remember to change it both places. aplay -d and aplay -D are great for checking some of the settings. You could sudo mv .asoundrc /etc/asound.conf when you’re happy with the settings.

  10. Now, if Alsa works, .asoundrc is correct and all the planets in our solar-system are lined up correctly, you can start Firefox, and both Flash 9 and Alsa-sound will work. You should also double-check with “about:plugins”. At least, it finally worked here. Hopefully you’ll make it work in a shorter amount of time than myself. If it doesn’t, you could always install Flash 7 again, and run Firefox with the FIREFOX_DSP=”aoss”-setting. Good luck to you. :-)