Linux and accessing the Windows shares

I had the problem of accessing the windows shares on my network, I’m using Ubuntu and getting inside the workgroup directory didn’t show any machines. So, I’ve found the solution which is pretty simple:

1. Samba config

# edit /etc/samba/smb.cnf
# set the name of your work group (although, I have 2 different work 
# groups in my network, and I can access them both after this configs)
workgroup = WORKGROUP
# setup the netbios name. Use whatever name your machine is called. 
# From This sets the NetBIOS name by which a Samba server is known. 
# By default it is the same as the first component of the host's DNS name. 
# If a machine is a browse server or logon server this name (or the first 
# component of the hosts DNS name) will be the name that these services are 
# advertised under.
netbios name = ubuntu
# Reorder the naming services
name resolve order = lmhosts wins bcast host6

2. Add wins to Name Service Switch config

# edit /etc/nsswitch.conf or wherever NSS stores its config
# Add wins to hosts:
hosts:          files mdns4_minimal [NOTFOUND=return] wins dns mdns4

3. Restart Samba

# /etc/init.d/smbd restart

And that’s it, you should be able to access all of the shares across all of the workgroups.

Development environment

This is a quick post on how to set up your own DNS server with custom TLDso you can easily and more quickly get started on your next project. I am doing my programming on the Linux machine (Ubuntu to be Precise :)). The idea behind this set-up is to evade the need to ever modify your /etc/hosts file. Also, there is a possibility to even skip the creating of Apache VirtualHost directive and restarting the web server. Onward with the How-To.


  • I use Ubuntu, so substitute apt-get with yum or what ever you use
  • Anywhere you see the IP, replace with your own
  • I haven’t set up any forwarders in named.conf.options

Install and configure DNS (BIND9)

sudo apt-get install bind9

Edit these files


zone "dev" {
    type master;
    file "/etc/bind/";

zone "" {
    type master;
    file "/etc/bind/db.192.168.1";


$TTL	604800
@		IN		SOA		dev. (
	             2012042301		; Serial
			 604800		; Refresh
			  86400		; Retry
			2419200		; Expire
			 604800 )	; Negative Cache TTL
@		IN		NS	dev.
@		IN		A
*.dev.	14400 	IN 		A


$TTL	604800
@		IN		SOA		dev. (
	     2012042301		; Serial
			 604800		; Refresh
			  86400		; Retry
			2419200		; Expire
			 604800 )	; Negative Cache TTL
@		IN		NS		dev.
253		IN 		PTR		dev.

Be careful to replace 253 in your files for your own last IP octet. Also, the filename should reflect your IP.

DNS servers setup…

Ok, now that we got this set up, we need to tell our system to use the local DNS server before going for the ISP and beyond. To achieve this, use Networking manager in Ubuntu, here’s how mine looks like. The final goal is for the /etc/resolv.conf too read: nameserver

…and finishing up

Now that everything is set up, restart bind:

sudo /etc/init.d/bind9 restart

Test your setup by pinging If you get the response from your server, all is working great.

Apache Virtual Document Root

If your projects have similar / identical directory structure (i.e. public directory for publicly available files) than you can go a step further and setup the Apache Virtual Document Root. In doing so, you will be able to create a new directory in your projects root and have it magically turned up by calling

<IfModule vhost_alias_module>
    <VirtualHost *>
        UseCanonicalName Off
        VirtualDocumentRoot "/path/to/projects/%1/public"

        ServerAlias *.dev

        SetEnv APPLICATION_ENV development

# Enable mod_vhost_alias apache module
sudo a2enmod vhost_alias
# Restart server
sudo /etc/init.d/apache2 restart

I don’t have this enabled for myself, but it does work, although not well tested. For further info on this topic, check the following links:

P.S. Yes, I got carried away while creating the featured image :)

Comment driven development

There is quite a handful of programming techniques out there; TDD, BDD, YAGNI, DRY to name a few. This post will be about something many people might already be doing but don’t know it has a name: Comment-driven development or comment programming.

CDD is helpful for:

  • prototyping,
  • spitting out your thoughts in code editor, so you don’t forget anything later (good for brainstorming sessions),
  • explaining what needs to be done if someone else is going to be writing the code itself,
  • commenting the code :). Comments could remain, so your code is documented from the get-go

I often start the new PHP file or class or even method with the layout in comments. Here’s an example:

// Get the needed models
// Collect todo items
// Get lists that the todo items belong to
// Send to View

Ok, everything is clear. After the real code sets in it looks like this:

public function someAction()
    // Get the needed models
    $todoTable  = new TodoTable();
    $listTable  = new ListTable();
    // Collect todo items
    $todos      = $todoTable->findByAuthor($author);
    // Get lists that the todo items belong to
    foreach ($todos as &$todo) {
        $todo['lists'] = $listTable->find($todo['list_id']);
    // Send to View
    DIC::get('View')->todos = $todos;

As you can see, the comments can stay in place. Even for this simple example, it is good practice to document your code.

The Wikipedia article states:

In comment programming the comment tags are not used to describe what a certain piece of code is doing, but rather to stop some parts of the code from being executed. The aim is to have the commented code at the developer’s disposal at any time he might need it.

And later on:

However, comment programming is used instead of a real implementation. The idea is that many functions can be written like this, and then the design can be reworked and revisited without having to refactor a lot of source code.

So, Wikipedia article is somewhat contradictory to itself. The aspect of comment programming I am writing about here is the “comments instead of a real implementation” part.

Do you write your code with comments first approach? Do you use some other technique?

MySQL Workbench 5.2.35 on Ubuntu 11.10 64bit (Oneiric Ocelot)

Well, if no one is gonna do it, you have to do it yourself. I had the need for latest MySQL Workbench – 5.2.35, but I also upgraded to the latest Ubuntu, the Oneiric Ocelot (11.10). As with most of new things, I couldn’t get it to work out of the box, so little compiling session was in order. If you need the package, you can download the deb. It is for 64bit (amd64) architecture. This is the first time I have created a deb package, so I apologize in advance if I didn’t follow some basic rules.

MySQL Workbench 5.2.35 for Ubuntu 11.10 (64bit)

Test projects viewer

I have a couple of test projects in my test directory. This is where I usually put the latest wordpress, phpBB or any other script or web software I would like to test out or develop and play with. Until recently I had to access those by writing the virtual host path (www.test.local) and then append the directory name ( /drupal). I got tired of it, and coded a nifty little “browser” which displays all of the directories and files. Combined with the DNS wildcards, you can have unlimited virtual domains without having to configure them in vhosts, setting the /etc/hosts and restarting apache server. I have included this in the zip file found at the end of this post.

We are using bind dns server to resolve everything that comes to the “test” domain to your machines IP address. After that, Apache takes care of the rest. And what he does is kinda cool. The .htaccess file has a set of rules to test weather the index.php exists in the requested directory (via subdomain), and if it does, he redirects us to that directory. If the index.php doesn’t exist, our “main” index.php shows the contents of that directory, so you can select any other file and run it. Let’s start.

Continue reading “Test projects viewer” »

I got the (mt) hosting

I’ve seen a lot of hosting servers. Really a lot, I’m a developer. 99% of the time, they had cpanel, 99% of the time, one couldn’t optimize and setup his hosting place to meet his needs. That’s not because of the cpanel, of course, but because of the hosting company. My appetite for features and freedom of configuration got bigger over the years, so I got myself the  (gs) Grid-service hosting plan on Mediatemple. Upon sighting the /etc directory in my root, I got excited.

Continue reading “I got the (mt) hosting” »

Not enough time

5 or so years ago I wanted to make an audio amplifier. This year I finaly came around to doing that, only to be stopped, again, because of my schedule. We never have enough time. A day could have 48 hours, you’ll still be late for something, would forget to do some things you had to do. I don’t know. Where’s the catch? Do less?

Ubuntu + Palm = Something Completely Useless


Palm showing my CPU usage
Palm showing my CPU usage

If you, like me, own a Palm III and also use Linux for your OS, then you are a complete geek. My excuse of owning a Palm is that my friend gave it to me, what’s yours? But that’s not the point of this post. The point of it is to show what ELSE is Palm good for. It is hard to take notes, people look at you as a complete stranger, you can’t connect it to the internet (it’s Palm IIIc we’re talking about), there’s no GPS, so what’s it good for? Well, let’s assume you have a program and want to see the CPU and memory usage while you play use your program. One way to do that is to load System Monitor. But that’s not geeky enough. No, that’s for people who still have a life, not to mention a girlfriend. For us, über-geeks, with no life, external display is the way to go. And Palm is a really good looking external display :). Let’s start.

Continue reading “Ubuntu + Palm = Something Completely Useless” »

How I Learned to Stop using Windows and Love the Linux


Ok, not windows, I have used DOS 6.2, great OS. Move to dir, type command, play game. That’s it. Then installed Win 3.1. Lol. Nice windows. Now what? Windows 95 came out, and I thought “Great, now we’ll have the abilities of DOS and nice interface of Windows”. Errrr. Soon the 98 came out, and the ME. Nope, not there yet. With XP things changed. It worked, was stable (kinda), but ever so often, I had to reinstall my system. Then Vista came out, and after installing it, I was content. Not all programs worked, but that’s normal. I hoped for it to be more compatible, more lightweight.

Past month I decided to let go of the MS operating systems, and go for Linux. Linux always intrigued me. I downloaded my first “flawor”, Red Hat 9, a couple of years ago. Downloaded, burned, installed. Didn’t recognize all my hardware, installing new software was a pain in the ass, and finding good software that was alternative to windows platform was hard. I learned to compile stuff, search for dependencies, uninstall, this, that, but that was not something a normal kid would go for. No games. Sorry. Fedora came out. Ok, nice. A couple more encounters with Linux (System rescue cd was a good find) couldn’t convince me to turn over to open-source. Well, Microsoft did. Vista is just too hungry for RAM. And I don’t wanna buy more RAM. I think 1 gig is enough (if you’re not gaming). The latest Ubuntu was downloaded, burned and ready for install.

Continue reading “How I Learned to Stop using Windows and Love the Linux” »