Login to your Ubuntu, and run the following command: openssl req -nodes -newkey rsa:2048 -sha256 -keyout myserver.key -out server.csr It then will ask you some information for the certificate, fill them in and complete the process. Country Name (2 letter code) []: (FR in France for example) State or Province Name (full name) [Some-State]: (your state or province name, name of your département in France) Locality Name (eg, city) []: (the name of your city) Organization Name (eg, company) []: (your organization name) Organizational Unit Name (eg, section) []: (do not fill – advised – or enter a generic term such as “IT Department”.) CommonRead More →

When you encounter this error message on your Samsung or any Android device: “Unfortunately, the process com.google.process.gapps has stopped.”. This could be that your Download Manager was disabled. Try to enable it to see if it works. Here are the steps to enable Download Manager on Samsung / Android: Settings -> More -> Application Manager -> All , scroll down and look for Download ManagerRead More →

There was a blog post that I have used multiple times to format a drive at or over 3TB in size. Unfortunately the original blog post recently went offline and I had to use the wayback machine to get it’s contents. The original URL of the post is: here and a link to the wayback machine archive of it is: here. If the original author puts the article back online I would be more than happy to link to it and remove the archived version I have posted below. I hope this helps other people as well but I am posting it here mainly as a guide forRead More →

Long time ago, when i design the database, i never think of the character set for my database. But recently, i have to work on some non-english language like Chinese and Korean. I found that my database does not store the info correctly. So here is my suggestion: No matter if you decide to support multiple language or not, when you design your database, you should use UTF-8 as the character set. If you are using mysql and your database is not not with UTF8 – you should use this query to convert it to UTF8. ALTER TABLE table_name CONVERT TO CHARACTER SET utf8 COLLATERead More →

Here is the code to utilize Google Translate to translate any text to English for free. / this function translates chinese to english if you want to use this function, please write your own curl_post_content – it’s just a curl request using post method – i have my own curl_post_content which i can’t publish here. the data that google returns doesn’t work well with json_decode function, we have to fix it a little bit, see the str_replace function here / function translate_to_english($text) { $url=”https://translate.google.com/translate_a/single?client=t&sl=auto&tl=en&hl=en&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&dt=at&ie=UTF-8&oe=UTF-8&otf=2&srcrom=0&ssel=0&tsel=0&source=btn&kc=2&tk=523995|731640“; $data=array(); $text=strip_tags($text); $data[“q”]=$text; $response=curl_post_content($url,$data); $response=str_replace(“,,”,”,0,”,$response); $response=str_replace(“,,”,”,0,”,$response); $response=str_replace(“[,”,”[0,”,$response); $obj =json_decode($response,true ); //true converts stdClass to associative array. $result=””; foreach($obj[0] as $v) {Read More →

I have a Chinese text file that’s not encoded in UTF8 , it’s encoded with gb2312 . I have been struggling to insert it into mysql. When i copy the text file & import it to mysql via phpmyadmin, it display chinese character very well, but if i use php to insert it, it display some weird characters. It turned out that i need to re-encode gb2312 to ut8 in php before inserting to database. The reason when it’s working fine via phpmyadmin, it’s because when we copy & paste, the browser already re-encode from gb2312 to utf8. here is the function i use: $text=Read More →

Mounting a Windows (SMB) share on Ubuntu gives us a “cannot allocate memory” error. Executing a command like this: mount -t cifs //toad/Backup /media/backup -o user=username,password=password,iocharset=utf8,file_mode=0777,dir_mode=0777 We get an error like this: mount error(12): Cannot allocate memory Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) Solution: First, check the permissions on your shared folder. Right-click the folder and selectProperties. Your Windows user must be allocated permissions on both the Securityand the Sharing tabs. Open regedit, and set the following registry key to ‘1’. This key tells Windows to set aside enough system cache for sharing large files. Commenter Raoul Duke (thanks!) adds that this change is unnecessary on Windows 7 and later.Read More →

Debugging Autofs problem If you are having trouble automounting your file systems, want to check where the log that autofs being saved, it may be useful to run automount in the foreground. Stop the autofs daemon sudo service autofs stop Run automount in the foreground with verbose information sudo automount -f -v From another terminal, try to mount your file-systems by changing directories into the mountpoint. Check the output from the first terminal for clues as to why the mount failed or was not attempted.   Hope it help.Read More →