Changing The Date And Time Format In Awesome WIndow Manager

Awesome Window Manager is… well… awesome. Except I had some trouble changing the date format. By default it was in 24-hour format, and I wanted 12 hour time format. Here is how to change the date and time format in awesome.

Open a terminal and enter:

cd ~/.config/awesome

Now type

ls

You should at least see a file called rc.lua. Open that with a text editor:

vim rc.lua

Now look for this line:

mytextclock = awful.widget.textclock({ align = “right” })

There is no format entered here, so it uses the default date/time format provided by Awesome. All we have to do is pass our own date/time format as a parameter. Here is an example (the green text was added by me):

mytextclock = awful.widget.textclock({ align = “right” }, “%a, %b %d %I:%M”)

(You will have to restart Awesome to view the changes). This will result in a format like this:

Mon, May 26 03:42

You can modify it to format as you please. There is a complete list of available date modifiers here.

Restoring A Bitcoin Wallet From Backup In Ubuntu

If you have a backup of your Bitcoin wallet and need to restore it in Bitcoin-Qt, here is how to do it in Ubuntu.

First, if you have bitcoin stored in your wallet now, move them somewhere else. This process will overwrite your current wallet and you will lose those bitcoins.

Also, close the bitcoin client completely. I don’t know if it is bad to do this with bitcoin running, but we will have to restart it anyway when we are done, so just turn it off.

When you are ready, go to the bitcoin data directory using:

cd ~/.bitcoin

You should see a file called wallet.dat. Just to be extra careful, I backup this file using:

cp wallet.dat wallet.dat.bak

When I saved my backup, I renamed it to “bitcoin-qt-wallet”, but the wallet file you want to restore should be called wallet.dat, so rename to that if you have to. Now just copy it into the ~/.bitcoin directory. I do this all in one command using:

cp bitcoin-qt-wallet ~/.bitcoin/wallet.dat

The last step is to tell the bitcoin client to check the wallet again because we changed it. We do this by starting bitcoin with the rescan option, like this:

bitcoin-qt -rescan

That’s it. The restart will take a long time (it took about 10 minutes for me), but when it is done, you should be good to go.

Make Firefox Open New Tabs To A Specific URL Without Add-Ons

If you want to make new tabs in Firefox open to a specific URL, there is no built-in option in the preferences. There are a few add-ons that do this, but there is no reason you should need an add-on for such basic functionality. I poked around and found a way to do it without add-ons.

First, open Firefox. In the URL bar, type:

about:config

It will ask if you want to continue, say yes. The page will have a search bar. Type in:

browser.newtab.url

When it pops up with a result, right click on the value and click “Modify”.

Type in whatever URL you want new tabs to open to. That should do it.

Get Awesome WM To Work In Lubuntu

I’ve been playing around with Awesome Window Manager today, and it worked fine on my desktop running Linux Mint. But when I tried it on my netbook running Lubuntu, the option to login into Awesome wasn’t available on my login screen. Thanks to this thread, I was able to fix it.

All you need to do is open /usr/share/xsessions/awesome.desktop with a text editor.

Find the line that says “NoDisplay=true” and change that value to false. Logout, and the Awesome window manager should now be shown in your list of window managers on the login screen.

Hope that helps.

[SOLVED] CodeIgniter “You did not select a file to upload” Error

I’ve been learning my way around CodeIgniter lately, and building my first real site with it. So far, I really like it and look forward to more projects with it.

The site I am building requires a file upload ability, which is actually built in to CodeIgniter. But it was giving me an error that read “You did not select a file to upload”, even when I did in fact select a file to upload.

My solution comes in two parts. The first has to do with the field name given to the CI upload helper. To upload a file, you pass the name of the input field like this (from the CI documentation):
$config['upload_path'] = ‘./uploads/’;
$config['allowed_types'] = ‘gif|jpg|png’;
$config['max_size'] = ’100′;
$config['max_width'] = ’1024′;
$config['max_height'] = ’768′;

$this->load->library(‘upload’, $config);

if ( ! $this->upload->do_upload()){
$error = array(‘error’ => $this->upload->display_errors());
$this->load->view(‘upload_form’, $error);
}
else{
$data = array(‘upload_data’ => $this->upload->data());
$this->load->view(‘upload_success’, $data);
}

So if the file upload field is named “filename”, you would just put ‘filename’ into the do_upload method. The problem I was having was that I was doing this:

$this->upload->do_upload($_POST['filename']);

That made sense at first because the form is being POSTed to the server. But the do_upload method doesn’t need the POST part. Just input the name itself and the do_upload method figures out the rest. So the correct way to do it is just:

$this->upload->do_upload(‘filename’);

This solved my problem.

I then got a different error message saying that my filesize was bigger than the filesize allowed by my PHP configuration. This is an easy fix.

Just open /etc/php5/apache2/php.ini and look for upload_max_filesize. Change that to something big enough for your files.

Don’t forget to restart Apache using

sudo service apache2 restart

Those two fixes got me up and running. None of the stuff I found online helped, so maybe this will help someone.

Aaron

My HTML Ebook Is Finished!

Learn HTML with HTML YourselfI have finished writing my HTML Ebook! If you want to learn HTML and CSS, checkout HTML Yourself, my new web development course.

From the start, I wanted to create a book that taught the entire process of building a site. This 170 page ebook teaches the entire process, starting with a blank text editor and ending up with a real website.

If you have always wanted to learn HTML but didn’t know where to start, this is the book you need. It requires no previous knowledge of programming or web development, just an ability to use a browser and a text editor.

Get it here!

Fixing Apache After Upgrading To Ubuntu 13.10

Today I was upgrading my web server to Ubuntu 13.10. The upgrade itself went well, except when it was done, my websites didn’t work. Instead of seeing my sites, I was greeted with the default “It works!” page given by Apache. After some searching, I found out how to fix it.

The problem is caused by an Apache upgrade that is part of the upgrade to Ubuntu 13.10. The new Apache version 2.4.6 uses a different syntax than the previously installed version 2.4.

The first thing you need to do is go to /etc/apache2/sites-available. You will notice that the default site config is now 000-default.conf. So you have to change your site config files so they end in .conf.

For example, if my apache config file is called example.com, I would use this command:

sudo mv example.com example.com.conf

This moves the site config file to example.com.conf. In my case, I then had to re-enable the site in Apache, using this command:

sudo a2ensite example.com

Notice that this command does not have .conf on the end.

Now reload Apache using:

sudo service apache2 reload

Try your site now. If it works, great. However, on my site I was greeted with a “Forbidden” error. Thanks to this thread on Stack Overflow, I found out how to fix that. Open up your example.com.conf file and modify your site directory settings to include “Require all granted”. For example, it should look something like this (depending on your setup, there will likely be other stuff in there already. Just add this part somewhere in there with it):

<Directory /var/www/example.com>
Require all granted
</Directory>

Now just reload Apache again, and it should work.

Off-Road Mode In Opera Web Browser

I recently installed the Opera web browser so I could see how my websites look in it. It is actually my first experience with Opera, and I must admit that it is a decent browser. One of the things that grabbed my interest was a setting called “Off Road-mode”, and I did some searching to find out what that was all about.

It turns out, Off-Road mode is designed to speed up page loading when you are on a slow Internet connection. The idea is to limit the amount of data sent over the slow connection by first telling the Opera server what page you want, then the server gets the page for you. Once it has the page, it compresses it and strips out “unecessary elements”– which I assume is things like HTML comments and what not– then sends the stripped down version to you.

This system limits the amount of data that has to be sent over the slow connection. I didn’t do any scientific testing of the speed difference, but I don’t really notice any difference when it is on. Then again, maybe the speed difference is more noticeable over a slow connection, such as the public Wi-Fi at my library.

As far as Opera itself goes… I like it, but I’m not leaving Firefox to switch permanently. Firefox just has too many cool add-ons that make my life a lot easier.