Posts for Wednesday, January 20, 2010

a firewall in layman’s terms

Dealing with companies can be frustrating, because they like to appear opaque to the outside world. When you look on the website you find a page with contact information. You’ll find a phone number and an email address, and maybe more than one if it’s a large company with several departments. But they all point to the reception. Few companies are generous enough to give you direct access to their personnel with a listing of employees and their contact information.

So if there is a person you have to get to you have to do it through the reception. “Yes, I am blah and I need bleh and why don’t you just transfer me to the person I need to talk to, per favore!” It’s not a lot of fun, but this way whoever makes this decision to give out only the number of the reception can also decide who may and may not receive calls. And even on what conditions. If you say the magic word then, yes, you can get Frank on the line, otherwise not. And maybe Steve has been known to say too much and has a history of divulging information he wasn’t supposed to. So no, you can’t talk to Steve.

Well, this is the principle of a firewall. The reception screens calls with the discretion to reject or divert according to the protocol that has been instituted. Some people can be reached anytime, others only at certain intervals. Some are available depending on your request, and some are completely unreachable.

This picture, however, conflicts with the original meaning of the word firewall, which is a wall erected to stop a fire from spreading. Unconditionally.

Out of memory... ouch

I've written before about how I'm running four Clojure-driven websites out of a single JVM on my VPS. No problems for many months, but today I tried to make a blog post and got all kinds of out-of-memory errors. Hopefully I didn't lose any / many user comments on this blog in the past couple days, but it's possible.

I restarted the JVM and gave it a bit more RAM to play with, I imagine this will fix things. But we'll see. It occurs to me now that there may be such a thing as too much caching.

Virtualbox looking good

I blathered on a bit about VMWare a while back, and lots of people recommended VirtualBox. I'm trying VirtualBox 3.1.2 with Windows 7 host and Linux guest, and it works surprisingly well. I've used it successfully to hack on a bunch of projects while I'm stuck on a Windows laptop (shudder).

Installing was essentially self-explanatory. I never read any docs, except when it came to installing those "Guest Addition" programs to allow better mouse-handling. And I had to look up how to go about sharing folders between host and guest. But the documentation was clear, I found a short description how to set up the share and then and a command to run to mount the host folder:

sudo mount -t vboxsf ShareName /mnt/mountpoint

I'm using Gnome in my guest, because I haven't used it in a long time and I was curious what'd changed. I'm amazed even Compiz works in the guest. I recall a time in the very recent past when my computer couldn't even handle Compiz natively, let alone in a virtual machine.

Perhaps the best part about VirtualBox compared to VMWare is that there is one product called "VirtualBox" and one download link that took me a matter of seconds to find. Fancy the thought.

Dive Into Python 3 - Review

When I started learning Python, I already knew some programming cause I had had to learn Java at university and I had already done some work in PHP. I was looking for something fun that would allow me to do non-webby things and someone, I can't remember who it was, recommended Python to me. I looked at the website and docs and kinda got things going but I relatively quickly decided I wanted to learn things in a more structured way so I got myself a book. That book was not the first Edition of Dive Into Python, it was some other book, I can't even remember its name. It had the usual dry examples that never felt "real" and it treated you like a dummy not giving you the feeling of real progress.

A few weeks later I got the first Dive into Python (you can read it for free on the Dive Into Python website). I don't know how broken my mind already was from all the Java and PHP but Dive Into Python fixed it: Great writing style and real-world examples that you could apply to your day-to-day problems without trying too hard. I have recommended Dive Into Python to numerous people asking about Python and everybody was really happy with it.

When Python3 (a newer version of Python that introduced a few backwards-incompatible changes to the language to clean it up and remove a few "warts that it had grown) the author Mark Pilgrim (he works for Google on HTML5 and has an absolutely brilliant blog, he also is on Twitter) decided to update the book to Dive Into Python 3. A few months ago he asked on Twitter who wanted a review copy, I said yes and yesterday got a package from him containing a review copy of the book and a few nice words handwritten on the first page - to make a long story short [Disclaimer] I did not pay for the book I'm writing about, it was a gift by Mark, so take this with a grain of salt [/Disclaimer]. With all that said, let's go into detail.

When starting at the beginning with the first chapter I instantly got the impression that this book might actually work better for complete programming newbies than the first edition did. The old book was sometimes hard to understand if you didn't know how to program, you kinda needed to already know the basics and Dive Into Python supplied you with Python's syntax and more importantly a pythonic approach to solving real-world problems. But you had to bring something to the table. Dive Into Python 3 makes it easier to get into the whole topic, but I still wouldn't recommend it to a complete newbie: Knowing any other programming language (well maybe not Prolog) will enable you to quickly pickup what's going on and learn Python with this book. Being able to hack some PHP is enough. On the other hand this book does try to teach you a pythonic approach. There is a lot of bad Python code out there (often written by people with too much Java background) that is not idiomatic, that does things in a way you might use in Java but that's just not how you should use Python. So if you know a lot about some other programming platform, it might actually help to "forget" a little before reading the book to allow you to understand everything. That is not a weakness of the book, I just wanted to make sure who the target audience is.

I'll skip over the "howto install python on your machine" chapter because ... well ... a trained monkey can probably install software and there are more screenshots than there are in ... something really screenshotty. It's clear it's explicit but most people probably won't need that chapter.

Chapter 1 introduces you to Python. You get a real world example ("humanize a number" as in write a readable representation for X bytes as for example 1.3 TB). You get the full code and Mark walks you through how Python modules work, how functions are defined and how you call them. Simple straightforward. Throughout the book there are little info boxes that summarize important hints or gotchas which I found really helpful.

The next chapters deal with Python's native datatypes and how to work with them, but instead of just listing them and going through them, Mark first focusses on lists (lists are really important in Python, you do pretty much everything with lists) and list comprehensions. This allows him to do interesting things (like working with directories and files) at a rather early stage and people can write cool programs after having read the first 3 chapters.

Then he dives into the big one: Strings. Strings have changed a lot from Python2 to Python3 (since Python3 all strings are unicode) so he spends quite a lot of time in the beginning of the chapter explaining what strings actually are and why there are problems. I enjoyed the text but I can imagine that some people might actually not care too much about the underlying thoughts and problems. Maybe a quick note in the beginning of the textblock would have helped because it looks kinda scary considering how the book had been rather "light" with big text paragraphs before. But after that you just get a quick walk through how to deal with strings which kinda fits to the chapter following: Regular Expressions.

Many people think regular expressions are weird or scary and Mark doesn't even try to explain them completely. He builds the chapter around a case study (Street Addresses) and that works really well: Instead of throwing too much theory at the reader, the example helps you to get into the topic and with Mark holding your hand, you walk through the whole case study without any troubles. You will not be able to write huge regex all by yourself, but you know how they work and there is enough groundwork laid out for you to understand the official documentation (which is rather theoretical) a lot better.

The next chapters go through "generators and closures" with "classes and iterators" following. Which might look weird to you considering that Python is object-oriented, but allowing that kind of learning is actually one of the strengths of Python. It allows Mark to build on all the topics he covered earlier and allows him not to use interesting examples for classes (in this case he builds a fibonacci number iterator). What I missed in that chapter was an explanation of inheritance and how it works in Python. "X inherits Y" is used in the iterator explanation but I think that should have been made more explicit and it also should probably have gotten another example to show people when it might make sense to generalize some functionality into a superclass. If people have no idea how inheritance works that part will be quite a hard nut to crack I think.

Chapter 9 goes through unit testing. Unit testing is important but most people don't do it. Why? Cause it looks like a lot of extra work. Mark does build on a previous example of "Converting numbers to roman numerals" and shows how unit tests can really save your ass. Especially in connection to chapter 10 "refactoring" it's make clear why you want to use unittests and how to write them with the build-in unittest module. Those two chapters should be read by unittest-sceptics no matter what language they write code in. Great work here.

Chapters 11 to 14 ("Files", "XML", "Serializing Python Objects" and "HTTP Web Services") work together really well. You learn how to read data from files, how to deal with XML files (using the lxml package) and how to access HTTP apis. Those are real work problems and from the book it all flows really very naturally. Knowledge gained from reading data from files smoothly gets "upgraded" to knowledge about querying for example Flickr or Google apis. At this point the reader can solve many of his (or her) real-world problems with Python. The HTTP chapter is somewhat struggling with the fact that there is quite a lot about HTTP that you have to know (GET vs POST, redirecting, headers) so it does not really work as well as the other chapters: It ends with short code examples on how to post a dent to Identi.ca but the chapter before that throws a lot of "basics" at the user that he (or she) doesn't really care that much about. Maybe having one clearer example would have helped here. It's not that the chapter is bad, every subsection in itself is clear and explains exactly why something is relevant and how it works, I just find the subsections don't tie into each other as they do in previous chapters.

For those amongst you that already know Python2, Chapter 15 is pure gold. Mark goes through the whole process of porting a real life Python2 library to Python3 explaining all the tools to support you Python3 comes with and where and how to fix stuff manually when automatic translation fails. Really helpful and cool chapter!

The last "real" chapter deals with something bad... packaging. If you know Python you also know that its packaging is a huge pain. "easy_install" doesn't integrate well with linux distributions' own package management facilities and it cannot uninstall which completely sucks. On the other hand I think it makes sense to tell people how to publish their code in a rather sane way instead of letting them fight PyPI (Python Package Index) and Distribute all alone. The chapter provides the user with a clear and simple walkthrough on how to package and publish python code. It suggests a directory layout and adds some more best practices so while Python packaging still sucks, I think that this chapter will still help people a lot.

The book finishes with 2 appendices, one showing you how to port code from Python2 to Python3 automatically and the other one listing the "magic functions" python objects have and what to do with them (good reference material).

All in all this is a great book if you want to get into Python. The examples given in most chapters are way better than what many programming books offer, they feel "real". Another great thing is the whole flow of the book: The book goes through aspects not based on some abstract categorization but based on what works together and what allows the user to use the knowledge gained in the previous chapters directly in the next one to do something cool. "Classes" is a good example: Instead of just throwing them at the user very early ("cause Python is object-oriented") it's kept simple for the user, purely based on functions and classes enter the mix only when we need them. The language (as in writing style) is very accessible and avoids unnecessary complexity, I think even people with English as a second language will not have trouble understanding the book.

The layout looks beautiful and the fonts are quite good, too, even though code sometimes "drowns" in text. Choosing somewhat more differing fonts might have been a good idea just for quick scanability of the page.

The Website states that the book is:
The book is freely licensed under the Creative Commons Attribution Share-Alike license. You can download it as HTML or PDF. Über-geeks can also clone the Mercurial repository
. On the other hand the book says that
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher.

I send an email to Mark, maybe he can clear that up, I guess the copyright is not about the content but the layout and stuff, but I'll keep you guys updated.

Dive Into Python 3 is available on Amazon(affiliate link, this one isn't ;-))and most other bookstores so don't hesitate, it is a great book. And if you are unsure and want to check a chapter out or two (or the whole book), visit the Dive Into Python 3 website
avatar

oxygen-molecule

A couple of days ago some friend came by for a beer (or multiple beers, who keeps count anyway?). However after some time I had to show something on my laptop and firefox was still open. So I got some complaints that GTK+ apps in KDE look horrible, which is true.

Now I am a konqueror user but every now and then I need to start Firefox. For some reason my bank can’t seem to properly write web apllications, they do a browser check and konqueror is not supported, faking the bowser string is not that hard but for some reason all the firefox specific things they want to do then fail on konqueror, long story short I sometimes have to use firefox!

So one of the guys suggested to use oxygen-molecule, it is in portage so it is just a matter of compiling and following the README. And I have to admit all of a sudden firefox looks awesome! So to all KDE users that have to run GTK+ apps every now and then get yourself oxygen-molecule!

Posts for Tuesday, January 19, 2010

Gentoo XFCE4 / XDM / TWM Problems

Okay... So with the latest update to xorg-server (I think it was 6.5), xdm stopped loading XFCE4 and I couldn't get it to load anything but TWM.

Here was the problem:

Somehow, an important file got removed.  The file is this one:


  • /etc/env.d/90xsession



The contents of the file is simply:

XSESSION="Xfce4"

With that, (and all the other /etc/rc.conf and /etc/conf.d/xdm settings in place), xdm and slim will now properly load XFCE4!

Just thought I'd share because google was totally confused.  Hopefully this will straighten things out.

Got my T400s!

On Thursday I finally got my brand spankin' new shiney matt laptop — the wonderful Lenovo ThinkPad T400s.

And I *love* it! :D

Everything from the design, matt finish, display, weight (or lack thereof) to the keyboard seems just perfect for me!

Whatever you heard positive about ThinkPad keyboards is true ...and even more so for the new keyboards on the T400s! It's the best keyboard I ever touched! The moment my fingers touched the keys, I knew this will be the laptop on which I'll write my thesis, save the world and do many wonderful things in hopefully as many years as possible.

Another small feature that I adore is the hardware mute button with an integrated red light indicator. As it kicks in already after BIOS it's ideal for dragging along to lectures and into libraries.

The only grudge that I hold against Lenovo on this box is that it comes with only ExpressCard/34, so a SecureCard reader won't fit in it — so much for a flush reader for my fancy Fellowship card :\

I hope I'll sort the problem with the MS Windows tax as soon as possible, so I can wipe the HDD clean and get my nice Gentoo GNU/Linux on it :]

hook out >> going to bed

Posts for Friday, January 15, 2010

avatar

The economics of technology

The long-term success of a company is caused by its people. The long-term success of a product is caused by the producers. Consumers are not the cause of success, they are a symptom of success.

That was the ideaology I got into a debate with my friend the other day. I was pro and he was con – mainly citing how the age-old laws of economics don’t simply break down in an industry and should be the be-all and end-all. I still disagree and have always believed there was something very fundamentally wrong with the whole science of economics. Before I continue I will have to admit that I’m not a fan of economics – you cannot put people on a graph. Even if you were dealing with statistically large enough numbers of people to create an average behavior we must still look to the very core of our behavior – why we do what we do.

A while back I told people why you do what you do – in a nutshell, every action you take is the action that you believe will cause yourself the most happiness, given the conscious or subconscious knowledge you have at the time. If being sad will make you happy – be sad! If you purposely choose to hurt yourself to prove me wrong, it is the satisfaction you gain from proving me wrong that gives you that happiness. If you sacrifice yourself for the benefit of others, it is because you prioritise the happiness of others, and following your belief will make you happy. If you choose to stab yourself, it’s because you believe stabbing yourself is the best thing you could possibly do (otherwise you would’ve have done it). This creates the question on whether or not “which” happiness is the best, but that’s a highly subjective question and thus we must leave delusion to a topic of its own. For this reason instead of referring to it as happiness I would refer to it as the “best”, to remove confusion as to the actual definition of happiness.

When applying this mentality to a society, it still doesn’t change one bit – and will never change no matter how large the sample. When looking at this from an economic perspective, for example in the labour market, we understand that people choose jobs because of this very same trait – and will not leave the job until the benefits of leaving are greater than the benefits of staying. For the factor of production enterprise, we understand that they take the risks and shape the market from what they believe is best. Capital and land are simply instruments of the former two and are therefore only tools that will accelerate the choices of the former two. When looking from the demand-side of things, we see that consumers purchase what they believe is the best to purchase – and it is empirically evident that their purchases will affect the choices of labour and enterprise.

However what I propose is that this influence is very much a short-term effect. If somebody invents a product, that product will exist as long as there is developer interest in the product. The greater the developer interest, the higher potential success of the product. In the long-term, seeing as all factors of production are variable we see that there will always be developer interest in the product as long as one person believes it is the best thing to do at some point to develop the product.

Developer interest is what causes the product to evolve. The product can evolve in either a market-orientated view or a product-orientated view. The market-orientated view is when the actions of labour and enterprise are being influenced by consumers, whereas the product-orientated view is based solely on the producer’s own beliefs. For a product to be successful in the long-term it has to undergo innovation – without this it will be pushed out through the process of creative destruction. Innovation by definition, no matter what its orientation must be producer-originated – and fundamentally the producer will produce what they believe is best. If other developers believe in the same, they will contribute and offer support, causing the product to grow, continue to innovate, and ultimately succeed in the long-run. Why? Because the very reason consumers will buy the good or service is due to this growth and innovation.

The conventional view is that this is a circular process – that consumers influence developer interest and developer interest influence consumers. However I believe otherwise – that producers have the final say in the long-run, but more importantly, in the very-very short-run. The reason is that there two root causes of what might seem to be a circular process, society and money.

  • Money is seen as the primary medium through which consumers can influence enterprise and labour. However in the very short-run money is almost completely disregarded in people’s decisions. Ideas will be chosen on the basis of their substance, not their potential earnings. In the long-run, money is as unpredictable as any other factor and it’s inflow is actually determined by the original short-run ideas.
  • Society is when the decision is based on the reactions of others. When dealing with an idea owned by a single entity, such as in innovation, society plays an almost negligible role in determining the realisation of the idea, even though it may play a role in either impeding or accelerating its progress.

From this we see that the circle is merely a single line of processes. What consumers buy depends on what producers make. How much a consumer will buy in the short run depends on the magnitude of developer interest. In the medium-term consumers will determine what happens to the product but the product will only survive in the long-run if developer interest is maintained.

A quick look at today’s market shows that this “long-run” period is indeed extremely long – almost synonymous with the business cycle. This inability to survive in the long-run is understood, yet disregarded as it is too far into the future to infer any meaningful derivations. This is very true – for most industries. However for the technology industry simply because it is at the forefront of progress this business cycle has been shrinking at an alarming pace, meaning that understanding how ultimately goods and services are producer-determined becomes very important. The implication is that trying to influence consumer-related symptoms, such as advertising, prices, quantitative or qualitative restrictions should be given second priority to trying to influence the mindset of producers.

To illustrate how this mindset is currently not understood I will ask a simple question. You work for a company. Let’s say your manager comes up to you and tells you to create a computer program of your liking. You scratch your own itch, so to say, and develop a product. A few weeks later your manager comes back with the production department manager and takes a look at your product. Both of the managers say “I really like that! I think it’s going to be a huge success!”. Now is the manager a producer or a consumer? If you said producer, you are wrong – they are both consumers. They have the ability to consume the good, but not to develop the good. It is important not to confuse the accelerating properties of capital and land with the developing properties of labour and enterprise. For this reason the success is not likely until other potential developers recognise merit in your work.

Some examples of how success has been producer-originated is in the iPhone, where the main reason consumers buy it is due to the amount of applications available on it. The Windows Mobile phones, due to the large number of applications on it, but failing because there is a lack in core developer interest (the OS has not been updated in ages). Android by Google, whose producer-embracing philosophy of so-called open-source has spun up almost 20,000 applications since its launch and is currently seeing a huge acceleration in market share. Linux – whose stubborn developers continue to progress despite the desktop market saying the complete opposite is now appearing like hot cakes in the market. Firefox and their thousands of add-ons – and its current battle with Chrome, which has exhibited innovation in browsers (and will be pushed out of the market if developer interest is lost or transferred to Chrome). Internet Explorer 6, where developer interest is finally moving away because they finally realise they don’t care about the customers when making websites that much (thank goodness). You think you use Windows because it’s good? No – it’s because it became a standard (even though back then Apple’s OS was miles ahead), which is what attracted developer interest. The list goes on.

This trend is most easily recognised in the technology industry (software, specifically) but is starting to be seen elsewhere, especially in other creative industries. A simple measure to determine the extent to which this trend has progressed in an industry is to ask an employee “why did you choose the job in the first place?” In the future this trend will start to bleed into other industries due to the increasing mobility of factors of production, increasing integration of markets into a worldwide affair, and of course the results of mass-amateurisation.

Finally as a closing note I’d like to throw in the topic of dogfooding – when producers use their own products, thus duplicating the roles of consumers as well as producers (hint: used really extensively in Google for a long time). This is a recipe for a self realising upward spiral of developer interest and consumer interest – finally creating the conventional circular process we think will always exist otherwise.

Related posts:

  1. Future of the Workplace due to Technology
  2. Chrome in the Clouds: The Google OS
  3. Is there such thing as a good monopoly?

Ubuntu and DVDs: Still pathetic in 2010

I'm a little blown away that Ubuntu 9.10 still has no DVD support and can't even install it. Pretty amazing 0_o.

Ah well, after seconds of googling I found a slightly popup laden answer:
http://shibuvarkala.blogspot.com/2009/10/how-to-make-ubnutu-910-karmic-koala.html

Not bad. a) install Mediabuntu repos, b) install DVD support.

Still, it's 2010 and Ubuntu has no support for DVDs. In any way. Lame.

avatar

Greek adblock plus filter on the official subscription list

Six months after my original post on the creation of Greek Adblock Plus filter, the filter is finally added on the official subscription list thanks to Wladimir Palant.
Apart from Adblock Plus add-on for Firefox/Iceweasel/etc, the filter is also usable by the AdThwart extension for Google Chrome/Chromium

Until today the list peaked at 70 subscribers…I hope this will make more people trust my filter list and reach at least 100 subscribers.

As a sidenote, my RBL for Greek spam has moved to a new, better server thanks to a very kind person who donated it and some people administering mail servers have already added it to their spam filters. Since the original announcement the RBL jumped from 500 reqs/min to 2000 reqs/min.

avatar

Three BB apps that are a must have!

Let's face it, you have a blackberry which means:
1. Your employer forces you to use it.
2. You just hate the kiddy phones (read iphone and clones)
3. You love it, you try out every application that gets reviewed on Crackberry and unsuccessfully try to make it replace your laptop/desktop. But then, you do kind of succeed one step at a time and then you give yourself a smug look in front of the mirror.

If you are the no 3 kind, you would definitely understand the problem I am talking about (Because I am the no. 3 kind too!). I try out almost every BB app that floats around. Sometimes, I like them and use them, but most of the times I install an application, try it out and then just forget about it. This has made my phone worse than a Windows XP box : it's slow and it drains battery like someone is actually sucking it out of it with a vacuum cleaner. One other reason my phone's battery drains quickly is that I have wifi always on by default. Although, the main reason I do that is to increase battery life (3g modems typically suck up a lot of power), the end result is probably what I wanted to avoid in the first place although I will never ever admit that. So, in the end, starting with a full charge in the morning, I am almost out by the time I get home around evening.

With most applications running on Blackberries, unless you don't specifically exit the application, the application will just run in the background. That's a major pain and can make things really slow. Quickpull can be a good passive solution for such problems. Its approach is simple, it simulates a battery pull every day (or night) at a specified time. That kills all those nasty background processes! The only downside is the long wait before your phone boots back up. So, the time for the reboot has to be set carefully! There is yet one more impressive application : Memory Booster . Unfortunately, it's a paid app but it does a pretty good job of what it claims to do. Just open it up and click on "boost memory" and it's gonna do its magic to free up some memory. It has also a nice graphical memory map option that shows memory used and java objects in a bar graph. What I like most about it is that it doesn't require a reboot! : very useful to quickly free up some memory when you are trying to open your calendar for example but all you see is a busy icon.

The last application that I am going to mention is SmartWifi. Unfortunately, that's a paid app too but it diligently remembers to turn off your phone wifi on your behalf. Add a wifi location to its list (such as your home) and it will turn it back on once you are home. That does save a lot of battery that would normally go waste on wifi scanning in unwanted places.

So, if your story is somewhat similar to mine, take note of these three apps : Quickpull, SmartWifi and Memory Booster. There's a fair chance that they will make your BB life a little better if not perfect.

read more

Posts for Tuesday, January 12, 2010

libnoise-viewer


i’ve just fixed most bugs in libnoise-viewer [1] and the software is really usable now. it features a QGraphicsScene and a QGraphicsView and to make it faster i’ve used some it::blackmagic called threads. Actually i used QThread and this was my first real use of multi-threading and it works pretty well. When i scroll the planar area small tiles are generated, two at a time are dispatched so that a dual core system is ’saturated’ cpu load wise.

This viewer uses the ‘noise::module::RidgedMulti‘ module to generate the surface in a black/white fashion. All i did was to apply a color-band according to the relative height. As you might have seen already, there is a black/white vs color toggle. Using this you can visualize the heightmap.

if (job.colorstate) {
renderer.ClearGradient ();

renderer.AddGradientPoint ( 1.000000, utils::Color (0, 90, 0, 255));
renderer.AddGradientPoint ( 0.740000, utils::Color (0, 129, 0, 255));
renderer.AddGradientPoint ( 0.700000, utils::Color (0, 190, 0, 255));
renderer.AddGradientPoint ( 0.650000, utils::Color (0, 250, 0, 255));
renderer.AddGradientPoint ( 0.600000, utils::Color (120, 250, 250, 255));
renderer.AddGradientPoint ( 0.390000, utils::Color (20, 120, 200, 255));
renderer.AddGradientPoint ( 0.340000, utils::Color (20, 50, 250, 255));
renderer.AddGradientPoint ( 0.200000, utils::Color (0, 0, 120, 255));

renderer.EnableLight();
renderer.SetLightContrast (3.0); // Triple the contrast
renderer.SetLightBrightness (2.0); // Double the brightness
}

The rendering speed is very good. But see yourself (the upload of the ogv video to wordpress media didn’t work, so i host it somewhere else).

http://lastlog.de/misc/wordpress/libnoise-viewer.ogv

If you want to visualize other ‘libnoise graphs‘ you can edit the sourcode (see renderThread.cpp) , all you need is to add 3 or 5 lines of code:

module::RidgedMulti myModule;
myModule.SetOctaveCount (job.octave);
myModule.SetFrequency (job.frequency);

Again: if you ever have to use threads, use QThreads since signals/slots are threadsafe (coming with qt ~4.2 if i recall correctly) communication between the threads is very easily done using the signals/slot mechanism, which means using the event loop.

I need to say, this is the 3rd project i’ve migrated to cmake and to do that i needed about 30-50 minutes since i also cleaned up the sourcode and did some other things as renaming of files and re factoring of class names.

I’ve also updated to =dev-util/kdevelop-3.9.97 this release fixed all the crashes the previous release had and i absolute love this ide. Currently i can’t think of ever using something else! The cmake integration is very good and makes a lot of fun using it. Renaming of classes or member functions as well as object’s names works like a charm!

Unlike other KDE components kdevelop 3.9.97 works reliably stable for me!

links

[1] http://github.com/qknight/libnoise-viewer

[2] http://github.com/qknight/libnoise

avatar

Unlocking Zimbra Advanced Searches

Hi and welcome to 2010!  This year I plan to blog more, read more, do more, learn more, and have more time left over...

This is a quick post to tell you how to do some nice advanced searching in Zimbra - the webmail client.
  1. In your Zimbra interface, select Preferences then General.
  2. Under the Searches heading, select Show advanced search language in search toolbar.
  3. Save and go back to Mail.
  4. In the Search box, select the Advanced link
  5. Choose some options (my favourite is status:unread; status:flagged; and time is today)
  6. By default this ORs some and ANDs the result with others, giving you a very small set of results:
    ((is:flagged) OR (is:unread)) date:-0day
    Edit the search string and replace everything with OR, and change 0day to 1day:
    (is:unread) OR (is:flagged) OR (date:-1day)

    You will now have a very powerful search, that gives you a quick summary of all todays messages, plus any unread or marked message from the beginning of time!

  7. Save the search, and you can access it at any later time.  Note that other preferences such as the sorted-by column is also saved with this search.

Well that sounds easy enough!  Why can't other email clients do the same thing?  Evolution's advanced search folders were unmatched until I discovered this..

Claws has no advanced cross-folder search that is persistent across instances of the application.


Thunderbird 3.0b2 (the last I played with) has persistent search folders, but they can't pull in related emails (up or down the thread) like evolution can.


Evolution is equipped to handle my business and personal email accounts:
  • I have thousands of emails in multiple pop and imap accounts.  I have no choice but to separate my multiple work and home accounts like this.
  • I have some folders with thousands of emails each, dating back years, which helps with long projects, contracts, and a bad memory!
  • I need some way to keep track of important emails, and at the same time see and sort new emails

Evolution can handle large folders with thousands of emails each.  It can of course filter messages based on mailing lists, subjects, sender and even run an external application test over an email.  I've mentioned it's search folder goodness, and it has powerful quick-searches too that can search the current folder or account.
avatar

Tech tip #4: Copy a random set of files from a directory.

More for archival purposes than anything, today I wanted to copy some songs out of my serious mess of a music "collection" onto my microSD card. I didn’t want to have to choose and I haven’t rated my songs so that wouldn’t help. Instead I wanted a random selection of songs. I’m not a bashmaster (absolutely pathetic at it, actually) but this is what I ended up using – after symlinking all of the various directories I had my files under together:

find -L /home/drive/music -type f -name "*.mp3" | sort -R | tail -n100 | while read file; do cp "$file" /media/disk/music/; done

-n100 represents how many files are going to be copied. Hope it helps somebody! Of course any improvements are welcome.

Related posts:

  1. Tech tip #2: MPlayer play music recursively in a directory.
  2. Tech tip #3: Rip audio from an .FLV file.
  3. Tech Tip: Speed up Firefox to use less CPU.

Posts for Monday, January 11, 2010

The Amazon Kindle and Linux

This year for XMas/my birthday my lovely girlfriend decided that me thinking about buying this or that EBook reader was just not getting anywhere so she'd decide for me and got me an Amazon Kindle. I won't bore you with the technical specs here, it's an Ebook reader with an EInk display (which means you can easily read it in the sunlight and the battery lasts for ages) but it has one feature the other Ebook readers don't have: "Whispernet".

Now I use Linux on all my machines, I avoid proprietary software and hardware as much as the next guy (though the Kindle does run Linux to be fair) and Amazon's files are DRMed and all that crap, but wow, is that Whispernet thing handy. It basically means that I can access the Amazon Store from all over the world wireless for free and that I can access the English wikipedia wireless for free everywhere (well obviously there needs to be a GPRS/3G network). It means that if I subscribe to some magazine or newspaper on the Kindle I get it delivered automagically and without hassle everywhere.

This has already worked on me quite well, I was on a business trip to Brussels, had a book I was reading finished but some time, so I just spend a few minutes to look around and downloaded "The Gunslinger" which I had always wanted to read anyways. It was really convenient (I wished I had had that on my last trip to Malta where I ran out of books and with Malta being an Island they were bloody expensive over there) and simple, just how I like my electronic devices.

Ebooks are not as cheap as they should be (usually around 5 to 10 US Dollars which is a lot considering that I cannot lend the ebook to someone else or resell it when I'm done with it) but there are also free Books in the Kindle store (old stuff, like the Sherlock Holmes books and similar classics). So to make a few things short, the Kindle is really useful for me, it makes it easy for me to read stuff while on the road, which I really enjoy.

Apart from the DRM crap thing it also has one big problem: It doesn't handle PDFs all too well. It can display them without problems but it cannot zoom properly so I cannot setup the font size as I could with "real" ebooks which basically makes reading PDFs of books a huge pain.

But I found a really cool cross-platform Application to deal with that called Calibre. Yes it is Qt which makes it kind of a pain on Gentoo since compiling Qt takes literelly ages, but it doesn't look as terrible as most Qt apps do and it rocks. It automatically detects your Kindle and what's on there, it can convert PDFs and .CBRs (comic book archives) to .mobi Ebooks which the Kindle can handle perfectly, and it can automatically download missing metadata so the Ebook has the proper author and title. Awesome application for Ebook management, can't say enough good about it.

The Kindle is just a mass storage device to the computer, so I could do all this by hand (calibre comes with command line tools like "ebook-convert" to convert files into ebooks without a GUI) and drop the .mobi files on the Kindle folder but Calibre makes it rather simple and pleasant so I'll probably stick to it.

I should maybe mention that amazon also has a conversion service that is actually quite cool: You send an email to a special address customed to your kindle @kindle.com and the document is converted into an Ebook for you, but the big caveat is that you'll have to pay for the whispernet transfer (a few cents).

All in all the Kindle is a really nice device, the display rocks, pageturns are quick, it's really slim and the whispernet is quite cool. The device works great with Linux and if Amazon could maybe just get their heads out of their asses and drop the DRM I'd be a perfectly happy camper. On the other hand there's many authors like Cory Doctorow out there that already offer free ebook editions of their works and I still got some catching up to do in that department so the next few months of reading are basically already on my Kindle.

If you are thinking about getting an ebook reader the Kindle works great. Other might have fancier features (like the B&N Nook with its color touchscreen) but the Kindle works and whispernet is quite a big deal once you gotten used to it.
avatar

Arch Linux interview and Uzbl article

Apologies for only informing you about the second article now. I assumed most of you follow LWN (you probably should) or found the article anyway.
Of all the articles written about uzbl, no one came close to the quality of Koens work. So even though it's a bit dated it's still worth a read.

Posts for Sunday, January 10, 2010

Playing with clang and Qt

You might know that there’s a new kid in the C++ compilers list ; clang. Llvm has been around for quite some time, but until recently the only way to make use of it was through the somehow cumbersome llvm-gcc which binds the gcc C/C++ frontend to the llvm backend. People (mostly Apple) have been working since 2005 on a frontend dedicated to llvm, clang. It is already used ‘in production’ by Apple for the C and objective-c languages.

The C++ part is still very alpha, but i still wanted to play with it. Among other things I wanted to try compiling some Qt projects using qmake. So i hacked this quick&dirty linux-clang mkspec. To use it, uncompress the tgz in your $(QTDIR)/mkspecs/ , edit the clang.conf file to suite your own paths, and do something like:

qmake -recursive -spec linux-clang
make

I’m using it with Qt-4.6, and it works for me (c). As a last advice, I highly recommend the svn trunk instead of the last release for clang. The website has clear information about how to do this.

* Download linux-clang.qt-4.6.mkspecs.tgz

~/.plan for 2010

It's (relatively) early in the new year and it's time to reflect upon the past and make plans for the future, so here's my short list of what I plan to do in 2010 that might be of interest to anyone out there.

In the 90's — at least on the box in highschool where I had my first Linux account ever — it was very popular to write your plans into ~/.plan, so other users on that box could use finger to see your plan amongst other user data.

Althought nowadays this practice is probably already forgotten and most people use a calendar app or at least more sophisticated TODO lists, for nostalgia's sake, let's pretend this is my ~/.plan and you're ...erm ...fingering me on the same box (can't help it, that's how it's called):

  • redesign my website — I'm thinking of a more clear separation of articles and the blog and a more professional look
  • register a .name e-mail alias and use it as the default
  • finally learn to program, starting with Python and use the newly acquired mad skillz to:
  • code a KTorrent script to easily manage Jamendo torrents
  • code a KDE Plasmoid to access EvroTerm and EvroKorpus dictionaries
  • code a KDE Plasmoid for converting article numbers of TEU and TEC before and after the Treaty of Lisbon
  • code a Amarok script for accessing BlocSonic
  • draw up the already promissed OpenHeads emoticon set
  • translate KMyMoney, Semantik, Konversation, KRecipes and some others on my list
  • translate the FSFE page into Slovenian
  • establish FSFE Slovenia

I'm pretty sure things will add up during the year, but if I manage all these I'll be happy :]

hook out >> running to the train station to kiss my gorgeous girlfriend

Posts for Saturday, January 9, 2010

avatar

The state of vendor lock-in on handheld services?

In this day and age it seems as though the word smartphone has replaced (or at least become synonymous with) the traditional phones we grew up with. These devices try to tackle the usual on-the-go services: PIM, messaging, casual browsing, multimedia and social networking. However with this is also an attempt to lock users into proprietary services, say for example, Flickr. I’ve been wondering for quite some time which mobile OS actually fares better on this, with the choices being the iPhone, Blackberry, Windows Mobile, Symbian, and WebOS (that’s Palm Pre).

This is best explained through example, so let’s take Mr Hip and Trendy who are well versed in navigating Facebook for their friends, Flickr or Picasa for their latest photo albums, Last.FM for the music, iTunes for their personal collection, YouTube for cats doing funny things and Twitter for trying to up their cool. Now let’s take away the Hip and Trendy part of all that and leave us with somebody who wants to do things their own way.

We have a neatly categorised library of music and video files on our home computer, and a few re-encoded video files on a remote server specifically made for mobile viewing. None of this iTunes schrwap. We run a shoutcast service for streaming, easily accessible through dyndns. Our latest photo albums, ebook library, and latest LaTeX-compiled (to pdf) essays are neatly stored on our home computer, all tagged as necessary for Nepomuk, and mirrored to the remote server. We have a similarly synchronised set of .ical files for calendars and appointments, and vcards for contact information, and of course mail is on our very own setup on our server. As for social networking, an own-hosted modded Wordpress install is used for (micro)blogging. We don’t mind a little Facebook here and there, but would also love to be kept connected on IRC. Of course it’s a-given that our remote server(s) are all equipped with (S)FTP, SSH, and Webdav support.

I don’t know much about the current state of smartphones but perhaps for those that do – can I bend it to use what I use and still feel a decent sense of integration? With this I mean drag-and-drop transfers for files and multimedia, seamless switching between local and remote locations (with support for above protocols), directory synchronisation (rsync?), PIM synchronisation as necessary for ical/vcard/mail/rss with a custom and remote location (or at least importing), and perhaps clients available (terminal emulation, anyone?) for SSH, IRC, and streaming.

Can I actually use my services the way I want them on a smartphone in this day and age?

I know I’ve had somewhat limited success on my own aging Windows Mobile phone, with third-party apps accomplishing iCal sync, SSH (putty), IRC, mail and RSS, and luckily it isn’t tied to nonsense like iTunes when I want to transfer music over. However the rest of the long-dead OS shove these few glimmers of freedom away in a dark and dusty corner of the market. I quite honestly wonder how the rest is doing – so I ask again:

Is it possible?

Related posts:

  1. The zen of PIM
  2. Top 10 Windows Mobile Applications
  3. Is there such thing as a good monopoly?

Paludis 0.44.0 Released


Paludis 0.44.0 has been released:

  • The ‘everything’ set is now called ‘installed-packages’. A new set named ‘installed-slots’ has been added, which is similar but includes slot restrictions matching installed slots.
  • kdebuild-1 support has been removed, following the Gentoo Council’s decision to remove all mention of it from the Package Manager Specification. Users with installed kdebuild-1 packages must remove them before upgrading.
  • Support for EAPI 4 (formerly known as EAPI 3) is present but not installed, since the specification has yet to be approved.
  • Support for the new EAPI 3 is present but not installed, since the specification has yet to be approved.
  • The [.key=value] syntax for user dep specs now works with sets, sequences and spec trees. If < is used instead of =, a less than comparison is used for numeric values, and for compound values, a match succeeds if any item of the key is equal to the specified pattern.
  • build_options: preserve_work can be used to avoid removing temporary working directories, and to force a non-destructive merge.
  • Profile updates (package and slot moves) are now enabled by default.
  • Workarounds for various interactivity abuses carried out by certain ebuilds have been added.
  • Various large code cleanups and build system cleanups.
Posted in paludis releases Tagged: paludis

Posts for Friday, January 8, 2010

avatar

RBL for Greek spam emails

It’s been some months now that I’ve started collecting some IP addresses of well known Greek spammers and I’ve put them on an DNSBL. I’ve named this list GrRBL. The software I use to run the list is rbldnsd.

The list is strictly moderated by me and only me and I try to be very selective on hosts I add to the list. The list contains hosts not only in .gr zone but also “foreign” hosts used to send spam messages either in Greek language or of Greek interest.

There’s a minimalistic guide on using it with spamassassin, exim, sendmail and postfix on GrRBL’s website. There are currently no statistics and no public listing of IPs in the blacklist. If there’s enough demand for statistics I might create some.

There’s also NO automatic deletion support, once an IP is in the list there’s no automatic way out. Since I am the only one adding IPs to the list, I am also the only one removing them, manually of course.

Even though I use GrRBL in all of the mail servers I own/manage, still I consider the service as beta. I don’t think it’s ever going to eat your emails, but you are still the only one responsible if this happens.

To submit new spam messages for inclusion please send me an email with FULL headers of the spam message to grrbl [at] void [dot] gr and I will try to take a look at it as soon as possible.

If you use it, or plan to, please leave a comment or even better, submit some spam messages so the list gets bigger and better.

P.S. In case you wonder, yes the list contains the IPs of the notorious sofokleous10 spammer.

Logitech G9x Laser Mouse


I got lucky enough to have received a G9x Laser Mouse as a gift recently. Up until this day, I’ve always used whatever mouse came with the computer and never had come to a thought of using otherwise. Being presented with a more advanced mouse, I can’t tell you how much I’m enjoying it.

Logitech defines the G9 as a ‘gaming mouse’. I’m not sure this is a ‘game mouse’, the G9 seems to apply more to the advanced user, but.. ehhh. It has seven mouse buttons, DPI switching, built-in memory for profiles, and an optional grip. The seven mouse buttons are: left-click, right-click, middle-click on scroll-wheel, left-scroll, right-scroll, forward and backward buttons (for use in browsers). The G9 includes a nice, big, fat scroll wheel that has a switch to change from the expected click-scrolling to hyper-scrolling. Hyper-scrolling is a blast. It’s like spinning a Lazy-Susan and just watching it go :).

All settings are hardware-based and get saved to the G9’s built-in memory so there is no need to copy the Window’s settings. The memory is capable of five different profiles that can be customized for gaming, graphic design… The G9 is customizable through Logitech’s Setpoint software which unfortunately isn’t available for Linux. I tried to run the Setpoint installer through Wine on Linux but was unable to. I had to resort to configuring the G9 with my Windows install. With Setpoint a good number of settings can be adjusted: buttons, scroll-speed, mouse speed/acceleration, profiles, LED color… However, some settings are dependent on Windows (mouse acceleration, DPI association with program…), but a good number of them work in both Linux and Windows.

The G9 is a great fit in the hand and I like how it is wider than typical mouses. The buttons have nice touches to them, and I like the weights you can add that make the mouse a bit heavier. The scroll wheel works nice for scrolling though it is a bit loose. This creates a small vibration when scrolling and a bit of loose space from left to right. The buttons of the scroll wheel are the blind spot of the G9 – all three buttons on the scroll wheel are a bit rigid. Mouse button three isn’t too difficult, but doing scroll left makes you move your finger to the edge and push pretty good. I also found that hyper-scrolling wasnt’ real useful. The wheel spins almost freely and I found it’s difficult to go through text in this wheel mode and be able to keep text steady.

Liking this mouse quite a bit, if just feels good. It has a comfortable design, good fit, slides well, good cord length. It also works good in Linux. On my Arch Linux install, most functions worked without any additional configuration. The only bit that doesn’t work is the scroll-left and scroll-right which I have yet to find out how to do. Also I discovered that the LED color can be changed in Linux with a nice program called g9led. Overall, very glad I got this.

Update: Discovered how to remap the keys here… alls golden. Note that previous versions of the G9 may have the buttons mapped slightly different.

On the go

So, what have I got on the go?

  • School: Last semester, just two classes, but they are looking like they'll be delicious and meaty
    • CS 411: Compiler design: We build a java compiler
    • CS 415: We build an operating system, fun times with C!
    • ...actually, I'm also taking spanish!
  • "Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp" by Peter Norvig. I got this for christmas and have started to work through it. I'm really excited about getting further into it. In the middle of it I'll be implementing prolog in Lisp and the in the latter half I'll be working on a natural language processor! Not to mention tons of other stuff, this book is huge and dense.
  • BattleCode 2010 has just started so my team and I are just about to start digging into that. Lots of AI coding to be done there.
  • Peter Michaux's Scheme from Scratch. I stumbled upon this from Hacker News. This fellow wants to write his own scheme to scratch a mental itch, and he's blogging each step and posting the code as well. I think it looks like a great amount of fun and that I too have that mental itch, so I'm following along, using his blog as a guide and looking at his code as well when I get stuck, but doing my best to do it myself.
  • The great mindstab.net migration to the cloud! Yes, setting up an entirely new server and migrating years of site history and email etc can take a lot of work.

So yeah, I have an insane amount of work on my plate, but I couldn't be more excited! All of it is thrilling and amazing!

Also, if I haven't mentioned it before, the dynamic duo of Jono Bacon and Stuart Langridge of Lug Radio fame are back with a new podcast Shot of Jaq! It's fun. Really, those two Brits have been the source of the only podcast's I've ever listened to. They are a great source of both Linux and British in my weekly diet.

But now I'm stoked to just find out that Ximian/Linux rockstar coder Nat Friedman and Tomboy creator and a rock star in his own right Alex Graveley have started a brand new podcast Hacker Medley that is the first new podcast that I'm actually quite excited to try out.

Finally, I'm reading "Pattern Recognition" by William Gibson in my spare time (read: on the bus) and finding it pleasant.

Live from the cloud

... and we're back! Just in time for our 8th birthday.

Mindstab.net's been around. It started back in January of 2002 running on a 486 from my bedroom. A few years later when I had some money, I bought a trusty 1U rackmount server, kvasir, and migrated mindstab there. Kvasir started co-located but when money dried up some, I brought kvasir home and mindstab has been living in my room for the last several years.

That all ended yesterday morning at 3:30am when I was awoken by kvasir's PSU fan screaming to death. The writing had been on the wall for a bit that things were going to have to change. I knew the fan was on its last legs, and hosting from home had been getting ever more precarious as both the local ISPs seem unable to provide a stable and reliable net connection. To that end I'd been playing with a VPS at linode.com (recommended in a blog post by Brian Carper) but I hadn't gotten very far. Actually, after a month I was still poking at the kernel trying to get my general paranoid level of security with grsecurity and PaX to work with the Xen virtual host at Linode. Anyways, at 3:30am yesterday I went into emergency mode and acceptable that their stock kernel "might just suffice" and started madly installing infrastructure software. Since then I've been copying over data and starting to bring services back up. So far we have a firewall, DNS, Jabber and I'm just starting to get the websites back up, this being the first.

Lots of work ahead. I need to get the rest of the sites up. Then I have to dive into the mess that is e-mail. I'd previously been using a qmail/vpopmail/courier system but I think I'm chucking that for a postfix/dovecot system, but I'm sure it'll take some kicking to get it up and get all my mail into it. Hopefully not too much. Then onto less crucial systems, then go back and re-vet alot of things.

So yeah, as of now, mindstab.net is coming to you from my new server Loki, in the cloud... or New Jersey more specifically :P

Planet Larry is not officially affiliated with Gentoo Linux. Original artwork and logos copyright Gentoo Foundation. Yadda, yadda, yadda.