1. Find a timezone file for your region in “/usr/share/zoneinfo/”.
2. Replace “/etc/localtime ” with the file you found.
For example,
sudo cp /usr/share/zoneinfo/Australia/Sydney /etc/localtime
Now, try type “date” in the terminal. It works!
1. Find a timezone file for your region in “/usr/share/zoneinfo/”.
2. Replace “/etc/localtime ” with the file you found.
For example,
sudo cp /usr/share/zoneinfo/Australia/Sydney /etc/localtime
Now, try type “date” in the terminal. It works!
When I was compiling htmlcxx under Ubuntu 11.10, a compile error occurs. It shows
In file included from ParserDom.h:5:0, from ParserDom.cc:1: tree.h:118:21: error: 'ptrdiff_t' does not name a type
The error is occurred because Ubuntu 11.10 is using GCC 4.6.3.
Here is the common issues with GCC4.6/G++4.6: https://wiki.edubuntu.org/GCC4.6
To fix the error in tree.h:118:21 for ptrdiff_t, just add “#include <cstddef>” to the header.
… to be capable with apple portables.
Remember I have purchased a hard disk last year? (Link in Chinese)
Now this hard is broken since my mac fallen to the ground… After several days, I find out that may be the broken hard disk has problem with the Sudden Motion Sensor. Because it seems that the broken hard disk cannot resume after the disk drive head disengaged.
Here are 2 ways to solve it:
1. Replace a hard drive without the same functionality of SMS.
2. Disable the SMS
It is not safe to turn off the SMS for a hard drive without the same functionality of SMS. Hence, I will buy a new hard disk.
For those who use SSD or a hard disk has the same functionality as SMS, you can disable the SMS by
sudo pmset -a sms 0
or you just want to check by
sudo pmset -g
If you want to enable is just type in terminal
sudo pmset -a sms 1
When malloc() fails, it will return a null pointer. But… What about new? It throws an exception… correct! But… What about the pointer? Any pointers returned?
See following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | // Author Name: Need-Being // Modification date: 22/03/2012 // File description: Sample code to show what happens when throw exception in // constructor. #include <iostream> using namespace std; class Object { public: Object() { cout << "Object: Constructor called" << endl; } ~Object() { cout << "Object: Destructor called" << endl; } }; class Test { public: Test() { cout << "Test: Constructor called" << endl; throw 0; // Throw a exception by force } ~Test() { cout << "Test: Destructor called" << endl; } private: Object object; }; int main() { Test* test = (Test*)1; printf("Test pointer: %p\n", test); try { test = new Test(); } catch (...) { cout << "Exception caught" << endl; } printf("Test pointer: %p\n", test); return 0; } |
Running result:
Test pointer: 0x1
Object: Constructor called
Test: Constructor called
Object: Destructor called
Exception caught
Test pointer: 0x1
In this case you can find out that the Test instance is freed without calling its destructor. Also, the value of test is not changed.
Sometimes it is very annoying that the compiler always tells me there is a lot of warning in third-party headers. For example, boost headers.
After google awhile and found a solution to that in Stack-flow.
Just use #pragma to wrap the third-party and it’s done!
For example:
#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #include <boost/thread.hpp> #pragma GCC diagnostic pop |
This specification is referred to RFC822 which is used in RSS feed standard
date-time = [ day "," ] date time ; dd mm yy ; hh:mm:ss zzz day = "Mon" / "Tue" / "Wed" / "Thu" / "Fri" / "Sat" / "Sun" date = 1*2DIGIT month 2DIGIT ; day month year ; e.g. 20 Jun 82 month = "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" / "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec" time = hour zone ; ANSI and Military hour = 2DIGIT ":" 2DIGIT [":" 2DIGIT] ; 00:00:00 - 23:59:59 zone = "UT" / "GMT" ; Universal Time ; North American : UT / "EST" / "EDT" ; Eastern: - 5/ - 4 / "CST" / "CDT" ; Central: - 6/ - 5 / "MST" / "MDT" ; Mountain: - 7/ - 6 / "PST" / "PDT" ; Pacific: - 8/ - 7 / 1ALPHA ; Military: Z = UT; ; A:-1; (J not used) ; M:-12; N:+1; Y:+12 / ( ("+" / "-") 4DIGIT ) ; Local differential ; hours+min. (HHMM)
First, set up a share folder/directory using the wizard of VirtualBox.
Assuming you have create a shared folder in the VirtualBox and its name is “to-be-shared“.
Then in the Linux client (e.g. Ubuntu), open a new terminal. Make a new directory and mount it using following commands
mkdir share sudo mount -t vboxsf to-be-shared share |
Now it works.
To unmount it just do:
sudo umount share rmdir share |
Then using wizard in the VirtualBox to umount the share folder in the system (you may do this when the client machine is powered off).
To take a screenshot with DOSBox on Mac is pretty easy on Mac.
1. Run your game on the DOSBox
2. Press control+F5
3. Go ~/Library/Preferences/capture/ and see the screenshot files.
Since this site has been set up, all my diaries will be written at news feeder.co at http://newsfeeder.co/wordpress/?cat=6 instead of here.
Old diaries are still maintained here, although there are not many diaries.
The basic protocol for the communication of back-end and front-end is designed.
The protocol is plaintext based, and it will be in binary form in later versions.