List of All Locales and Their Short Codes?

The importance of locales is that your environment/os can provide formatting functionality for all installed locales even if you don’t know about them when you write your application. My Windows 7 system has 211 locales installed (listed below), so you wouldn’t likely write any custom code or translation specific to this many locales. Edit: The …

Read more

What throws an IOException in Java?

Assume you were: Reading a network file and got disconnected. Reading a local file that was no longer available. Using some stream to read data and some other process closed the stream. Trying to read/write a file, but don’t have permission. Trying to write to a file, but disk space was no longer available. There …

Read more

Arduino Sketch upload issue – avrdude: stk500_recv(): programmer is not responding

I had this problem with a Crowduino, running the Arduino IDE on OS X. The solution for me was to switch on verbose output during upload (in the Arduino IDE preferences pane). Then, when uploading, you can see AVRDUDE sending three packets avrdude: Send: 0 [30] [20] (with corresponding RX flashes on the board) right before the avrdude: ser_recv(): programmer is …

Read more

ValueError: invalid literal for int() with base 10: ”

I am creating a program that reads a file and if the first line of the file is not blank, it reads the next four lines. Calculations are performed on those lines and then the next line is read. If that line is not empty it continues. However, I am getting this error: ValueError: invalid …

Read more

Why do we need virtual functions in C++?

Here is how I understood not just what virtual functions are, but why they’re required: Let’s say you have these two classes: In your main function: So far so good, right? Animals eat generic food, cats eat rats, all without virtual. Let’s change it a little now so that eat() is called via an intermediate function (a trivial function just …

Read more