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.

Wish Carefully

Author’s note: This article was originally posted back in April 2009. It was back before I had a blog, so I posted it to a different website. I am closing my account on that site, but wanted some of my content to remain, so I reposted it here. Enjoy!

I’m sure you’ve heard the saying, “Be careful what you wish for”. Well guess what, it’s true. I almost learned that the hard way this past summer when I was job searching. It was getting close to the end of the school year, and I made the poor choice of quitting my old summer job before I had lined up another job to replace it. That was the best decision I ever made.

I go to college in Wisconsin, but I am from Ohio, so my life is a constant game of ping-pong between school in Wisconsin and summer work in Ohio. Over the past two summers, I had been going home to work at a great job doing landscaping at a waterpark. It was sweet. I went in really early, prepared the park before visitors arrived, took a lunch break whenever I felt like it, and left around 3:30 in the afternoon. The guy that I worked with at that job is still my friend to this day. Not to mention the fact that the boss was a really cool guy, the kind of guy everyone should have the chance to work for. He wouldn’t ask you to do anything he wouldn’t do himself. So by now you are probably wondering why the hell I gave up such a cool job, especially when I had no other job. That’s where things get interesting.

Near the end of the school year, I decided that I would start looking for an internship. I am studying biology with a minor in Geographic Information Systems, and as much as I loved my landscaping job, it really had nothing to do with biology, it won’t help me get into graduate school like an internship would, and I found out about a really sweet job opening being offered by one of the biology professors at my school. That is when I figured that I should quit my landscaping job and go for the job with my professor. After all, I would get to go around with him all summer in a kayak to collect samples of plants and play with GPS devices and all kinds of cool stuff. This was the perfect job for me. Except for one slight issue: I didn’t get the job.

There was just one thought that came to my head… shit! First of all, I really wanted that job. Second, I didn’t have my old job anymore. And to top it all off, it was early May, well past the deadline for most internship applications. At this point, I began searching around for anything that was even remotely related to biology, and I was ready to take whatever I could get. I was freaking out, because in less than a month school would be out for the summer, and I had no idea where I was going to end up for the summer or if I would have a job when I got there. My friends kept assuring me that everything would work out. I remember one thing in particular that my friend in my martial arts class told me. He said, “Don’t worry. Usually when things are unexpected is when they turn out the best.” Man was he right, because later that very night I checked my email and found a message that blew me away.

I got an email from a non-profit organization saying that I had been accepted into their internship program. They were an organization that does environmental work, which was exactly what I wanted to do at the time (I’ve since become more interested in cellular biology). I would be removing invasive species, protecting endangered species, and using GPS devices. Housing would be provided, they would train me with everything I needed to know, and I would get paid a living expense. It sounded great. Oh yeah, and there was one other little perk. The job was in Hawaii.

So I was off to the Island of Kaua’i to work at a job that I was very excited about. When I got out there to where I was going to work, it was everything I expected. From day one, I enjoyed the work, and the people I worked with literally treated me like family. The housing they provided to me was up in the mountains in a state park, with amazing hiking trails, and part of the job was to go out on camping trips to remote areas where most Hawaiians never even get to go. It was incredible. So why did I say “Be careful what you wish for”? It’s not because of what I got, but because of the job that I almost got. That’s right, I’m talking about the job with my professor.

When the summer was over and I went back to school in Wisconsin, I was talking to the person who got the job instead of me. He said it sucked. Apparently, the job was nothing like the description. He said that instead of going around Wisconsin in a kayak, he spent most of his time alone in a lab doing monotonous work by himself all day. I expressed my sympathy for his boring summer, but inside, I was thinking “sucker!”. If I had gotten that job, I would have been in the lab all summer with that boring job and nobody to talk to. Instead, I lived in Hawaii and went trekking through the rainforest on a daily basis. So basically, I did everything he was supposed to have done, except in paradise.

I guess there are a few lessons to be learned here. First, as I’ve said over and over, is to be careful what you wish for, because it might not be as good as it sounds. Second, I was really struck by what my friend said about the unexpected things being the best, which is a philosophy that I have lived by ever since. Lastly, I have learned that it is important to be able to adapt to sudden changes in life. Instead of sitting around crying about the job that I didn’t get, I changed my job hunting strategy. I completely revamped my resume and disperesed it to anyone willing to take a look. It worked well enough, and I ended up having the best summer of my entire life.

The Alternative Option

Author’s note: This article was originally posted back in April 2009. It was back before I had a blog, so I posted it to a different website. I am closing my account on that site, but wanted some of my content to remain, so I reposted it here. Enjoy!

As I write this, I am currently away from home to go to school in Wisconsin, but I am from Southwest Ohio. In an email from my family back home, I was told that a powerful windstorm blew through the area with wind gusts of 78mph, which is the remnants of Hurricane Ike which blew through the Texas area a couple of days ago.

As a result of this storm, many trees were toppled, power lines were ripped to the ground, shingles were torn off of rooftops, and an overall state of panic ensued. One of the consequences of such destruction was rationing of gasoline at the gas station, resulting in fights over gasoline. There were actually fights over gasoline! This raises a disturbing question: If we result to fighting when the gas station runs out of oil, what are we going to do when the Middle East runs out of oil?

According to the CIA World Factbook, oil exports account for 95% of Iraq’s budgetary income, while Iran’s income is heavily based on oil, with 85% coming from petroleum exports. Other countries are Kuwait and Saudi Arabia, with 80% and 75% of income coming from oil, respectively. Oil is all the Middle East has for a major source of income, and eventually, it will run out. We can conserve oil until the cows come home, but the fact remains; petroleum is a limited resource, and when supplies begin to dwindle to critically low levels, the countries that run out first will need new sources of income. When they look at the country next door and see plentiful reserves, you know as well as I do what will happen– fighting will ensue.

I look at the fight as a microcosm of days to come on a global scale. At the gas station, two people wanted what only one person could have, and they were left with a couple of options to resolve the issue. First, they could have split the oil 50-50, and each pay the gas station for their share. But there is one problem with this; what happens when the third guy sees them splitting the gas and decides that he wants his slice of the pie? Do you split it three ways? Alright, what about the fourth guy, and so on?

Another option would be to let someone on the outside decide what to do. In this case, the gas station attendant would have been a logical choice as a mediator. But on a global scale, who would be analogous to the gas station attendant? Who should act as the authority when countries disagree over oil? Should the United Nations do it? How about OPEC? Or should the US go on another power trip and bring “peace” to the Middle East by itself? What if that third party has an interest in the outcome of the deal? After all, most of the world’s oil comes from the Middle East. Perhaps mediation isn’t the best option after all? Well, let’s examine the other options.

Going back to the gas station example, maybe neither of the two guys should get the oil. But again, we are faced with the dilemma of who should make such a decision. And of course, this obviously is a poor decision at the global level, because the oil in a country belongs to that country, whereas at the gas station, the gasoline belongs to someone else. Fine, what are the other options?

What are the other options? Because as it stands, the same three options facing the men at the gas station are the only three options facing the countries in the Middle East, and as it stands now, none of the possible outcomes look good. You might be thinking that alternative sources of energy will save the day, but not quite. Using other sources of energy besides oil will still raise the problem we face when the oil becomes depleted, which is the lack of income for the oil exporting countries. The only difference is that in the oil depletion scenario, the problem is caused by a lack of supply, while in the alternative energy scenario, we are faced with a lack of demand. Either way, it leads to a lack of income for countries that have people to feed, roads to build, schools to pay for, and a myriad of other expenses required to keep people happy and healthy.

There are various estimates of how long it will take to use up the remaining oil reserves, some as low as three years from now, others saying we have as much as 40 years of oil remaining. Regardless of which estimates are true, we are still faced with the same problem of what to do when it is gone. The only difference is how much time we have before we need to worry about it. But even if we go with the estimate of 40 years, that still puts the end of oil possibly within your lifetime, and certainly within our children’s lifetime. Will this be one more problem that gets thrown off on the younger generations for them to worry about, like we have seen with the environmental problems facing us? The time to act is now.

I suggest a push toward alternative sources of fuel. As stated earlier, this would still lead to a lack of oil income for the countries in the Middle East. However, unlike the depletion of oil scenario, the alternative energy scenario has some potential benefits for the Middle East. First, the creation of alternative sources of fuel will require new machines to utilize that energy, which will create the need for manufacturing jobs. If the oil-producing countries are smart, they will turn this into a valuable source of income for years to come.

Israel is a perfect example of how this could be done. For years, they have been importing raw materials, using them to manufacture goods, and exporting the product to make a profit. This option seems even more attractive when we consider that many other nations, including the United States, are decreasing manufacturing output and shifting to a service based economy, leaving a need for other countries to take up the slack in the manufacturing sector.

Another economic benefit of a manufacturing economy is the diversification that comes from producing many goods. An oil based economy relies completely on oil-based products as a source of revenue, and if something happens to the oil, the income changes accordingly. On the other hand, if a third of income comes from manufacturing cars, a third from building solar cells, and one third from building fuel cells, you have a much more secure source of income. If demand for cars decreases, people will still need solar panels and fuel cells. If fuel cells become outdated in favor of new technology, you can still sell cars and solar panels.

In addition to the economic benefits of alternative energy, there will of course be environmental benefits in the form of decreased carbon output. Considering all of the potential benefits of moving away from an oil-based economy, our leaders should make it a top priority to see that it gets done quickly. However, that is not likely to happen until people start pressing for policy changes. The need for such a change is incredibly urgent, because if we continue on the path we are on now, we are going to have some problems down the road in the form of conflict in the Middle East. But with the economic implications of such fighting, it will quickly spread to other areas of the world. The only way to prevent involvement is to prevent it from starting in the first place by choosing the alternative option; an alternative economic structure based on alternative energy sources. We have choices of what to do, which choice will we make?

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.