Saturday, July 31, 2010

https certificate expired and chrome does not like it (by default)

Don't get me wrong.  I don't like Google Chrome personally even though I use it.  See? Hating does not mean you cannot live with it.  Right now, I have to run both Firefox and Google Chrome on the same machine as I don't know yet other way around to separate sessions / cookies of the same website on different tabs.  One thing I need, for example, is to access 2 gmail accounts at the same time (and I just want to do it through web-based only but not pop3/imap).

Today I wanted to sign up for a hotmail email as I needed a dummy email for testing purpose (I won't use hotmail for my personal emails anyway).  I used Google Chrome, went to www.hotmail.com, clicked "sign-up", and then I got this red alert page:




live.com's SSL has expired!? ... I wouldn't expect such a big company like Microsoft to make this kind of mistake unless it was by intention.

By default, Google Chrome does not allow us to access website under https with an expired certificate.  Unlike Firefox where on the same alert page, it gives us a confirm button to click which will allow us to access that suspicious web page.

Anyway, it is not difficult at all to change the default behavior just by going to this dialogue of Chrome:




And make sure you uncheck the "Check for server certificate revocation":




After that, you have to refresh that https web page and Google Chrome will allow you to access the web page under https with expired ssl certificate.

Friday, July 30, 2010

lftp error "Delaying before reconnect"

lftp is a well-known ftp client.  I use it with both MacOSX and Grml Linux.

Few days ago I had to download all files from a virtual host directory which resides in a shared hosting environment.  A bad thing about using these cheap shared hostings is that it provides us ftp to be the only mean of file transferring which sucks.  (When possible, I would rather go with sftp, rsync or fully shell access where there are a whole bunch of other fancy ways to choose from.)

I searched on Google to find any alternative ways (other than lftp) to sync files from ftp site to my local directory instead of having to download the whole files again and again which is too expensive.  (By synchronizing I mean to fetch only newer or modified files on the next synchronizations.) (which lftp's man page does not state precisely whether it can do it or not so I assume it can't.) Unfortunately, I couldn't find an OpenSource one for Linux.  I could see only proprietary softwares for both Windows and Linux.  If anyone can suggest me for Linux, please do.  I know WinSCP for Windows is free-to-use and supports synchronization but I need one for Linux.

OK.  So it seemed I had no other choices.  I had to go with lftp to download the whole files to my local disk then.

As usual, I logged on to the ftp server with lftp, switched to the directory I wanted (in my case it was public_html/), then issued "mirror" command.  Unfortunately, I got this error:

[Delaying before reconnect: 57]  

I then pressed ctrl+c and tried "ls" and this is what I got: 

[lftp 4.0.2] someuser@somehost ~ % ls
`ls' at 0 [Delaying before reconnect: 57]  

I was like #wtf (oops!).  I then turned debugging mode of lftp on.  With the error message I got from running lftp in debugging mode, I then found out (from Google) that if I ran into that mysterious problem, I should try:

set ftp:ssl-allow no

And it just worked....!  Now I can use both mirror and ls and assumably everything... ha ha

Note that as I am just a lazy nerd so I didn't go further to find out why we need to unset that ssl-allow property : P  I would greatly appreciate if anyone can tell me why : )

Recommended Softwares

Tuesday, July 27, 2010

how to modify svn log

It is universally a best practice for everyone who uses Subversion (svn) (or any other source version control system) to enter very detailed log for each svn commit.  If for any reasons you disagree with what I just said, please think about situations when you work on a project with 5 or 6 people (or more) and you encounter some mysterious bugs.  What will happen, for a worst case scenario, is when you ask everyone around who has worked on these files.  (It is so easy to get a name list from svn log.)  Alas, no one can remember what he/she has done.  They all know their names are there however they just really forget about it... and this just sucks (given that it really happens too often).  Idealistically, I would say a good enough log has to be able to help a single person to see just the logs and result from "svn diff" and then they can understand what happened, why it happened and how it happened without consulting other people.  Anyway... let's get back to the topic...

Some times we forget to put some useful info into the log for some svn commits.  Or maybe we find additional info that we think it will be worth adding them into the logs of some older revisions.  Good news, we can accomplish that with not much effort.  Though, It is not enabled by default, we only have to enable it.

Assuming your svn repository is in:

/svnrepo/

You should see a file there:

/svnrepo/hooks/pre-revprop-change.tmpl

All you have to do is to rename it like this (remove the .tmpl):

$ mv pre-revprop-change.tmpl pre-revprop-change

Then, you have to grant execute permission to it like this:

$ chmod +x pre-revprop-change

After that you can modify already committed svn log by, for example:

$ svn propedit --revprop -r 11 svn:log file:///svnrepo/

Assuming you want to edit svn log at revision 11.

references

how to adjust font in an existing pdf file to fit my sony prs-505 digital reader (a.k.a. e-book reader)

I own a digital reader sony prs-505 (red colour model) bought around 2 years ago from sonystyle.ca.  It is so cruel that even now they still don't sell it in Thailand (or even with Thai ip address).

As with any other digital readers, its screen resolution and size are different and much smaller than ordinary monitors (for computer desktop or laptop).  For my prs-505, it is 175x122x8 mm (6.9" x 4.8" x 0.3") with 600x800 pixels. (source : wikipedia.org)

With these differences, any pdf files that are not generated specifically for prs-505 contain risk of being blurred and consequently impractical for reading.  However, not only the screen size and resolution that matter but also the font being used in pdf file.  One might argue that pdf is a vector format where we can zoom in and out without losing its sharpness.  I completely agree and understand that but, however, prs-505 comes with only 3 levels of zooming which are small, medium and large.  With just these 3 levels, we can't expect prs-505 to be able read all pdf files properly without extra works.

Usually, I use Calibre to collect rss feeds and convert them into epub format which is a format that works on prs-505.  There are lots of predefined news feeds come with Calibre such as bbc, cnn, telegraphs, reader digest, etc.  A good thing about choosing news from the predefined list is that Calibre knows it well so it fetches the data and formats them very properly for prs-505 which is a known target device to Calibre.  As such, I have nothing to concern about reading news with my digital reader.

However, just recently, I ran into a problem when I tried to read a technical textbook downloaded from some website.  It was in pdf format.  Unfortunately, its font and sizes didn't fit prs-505 as you can see from the picture below (notice that the font colour is too light which causes problem to my eyes):



The page layout / size looked perfect while the font didn't.  All texts were blurred.  They become clearer when I zoomed in it but the large zoom level was too big which just broke the page layout and everything.

I decided I had to make some changes to this pdf file.  There were several approaches I tried:
  1. Using Calibre's GUI to convert the imported pdf file into epub by telling it to change font size to be 12pt, 14pt and 16pt.  In the output, the text's font size was really increased which was good.  But, a bigger problem arose.  For some unknown reason, whenever I changed the base font size via Calibre's GUI, each sentence was divided into separate line which made the entire page looked truly ugly.  This method does not work.
  2. Using Adobe Acrobat Professional to change font of existing pdf.  With Touch Up Text Tool, I was able to change font of the pdf to be Tahoma, for example.  I tried it with a paragraph and it just worked.  It looked great on prs-505.  But, alas, there was no way I could change the font of the entire pdf document.  This is just ludicrous.  It is impossible for me to go through page by page to do that.  Failed again.
  3. Using tools to convert pdf into various formats such as plain text, html, png, rtf, ps (postscript), odt, doc, etc... None of them worked.  Each of them yielded different slight problems when it was used with my prs-505.  Some examples are too big of size file, images distorted, wrong font, wrong paragraphs layout, etc.  It just does not work.
  4. Surprisingly, I decided to get back to Calibre.   For some unknown reason, I tried command-line version of Calibre instead of the GUI using the almost exact same option I chose when I used GUI version:

    $ ebook-convert some_file.pdf some_file.epub --base-font-size 14

    Then I transfered this epub file to my prs-505 and the output looked a lot better as you may notice:




    You will also notice some slight bug such as the second paragraph that is combined into the first paragraph.  Hence, it is not a perfect method yet.  I will just have to live with it meanwhile.

     More details of how to use Calibre's command-line tool to convert books can be found here:

    http://calibre-ebook.com/user_manual/cli/ebook-convert.html#ebook-convert

    Isn't it funny that GUI version and command-line version of Calibre yield different result?  I can only guess that it maybe because the GUI somehow has more options than just "--base-font-size" that I am unaware of!

    Monday, July 26, 2010

    external harddisk access error in macosx

    I have a 1TB external harddisk connected to my MacMini via USB port.  I used it for:
    • Back up with Apple's TimeMachine
    • Back up other data
    • Store movies and softwares
    Just today when I turned my machine on there was no disk icon shown in either Finder or Desktop.  I went to Disk Utility (a gui disk management for MacOSX) where I could still see my external harddisk listed.  I was so sure something really went wrong.

    In Disk Utility, I tried clicking both Verify Disk button and Repair Disk button.  None of them worked as you can see from the screenshot:


    This is frightening.  I then went to shell in Terminal and tried fsck like this:

    $ fsck_hfs  /dev/disk1s2

    And here is what I got:

    ** /dev/rdisk1s2 
    ** Checking Journaled HFS Plus volume.
    ** Detected a case-sensitive catalog.
       Invalid node structure
    (4, 0)
       Invalid B-tree node size
    (4, 0)
       Invalid node structure
    (4, 0)
       Invalid B-tree node size
    (4, 0)
    ** Volume check failed.

    (Note that I knew it was /dev/disk1s2 from the command "diskutil list".)

    The error message looks the same as what I got from Disk Utility.  I found later that Disk Utility's Repair Disk button made use of fsck which is why it yielded the same result.

    I also tried attaching the harddisk with my Grml Linux laptop and mounted it as hfsplus.  I could see all the files there (and of course, I can access all files and even copy them to anywhere else so my ass is still safe).  Though, fsck.hfsplus in Linux did not work either.

    After spending time researching about this issue, I can conclude that:
    • This is a rare case (assuming my harddisk is still in a good condition as I just recently bought it).
    • fsck is not the right tool to fix this special case.
    • All lead me to use Disk Warrior to fix the problem in my harddisk.  People claim it knows hfsplus file system more than fsck_hfs.
    And it just worked!  Here are the steps it took:
    1. Open Disk Warrior
    2. Under Directory tab, choose your external harddisk device in a drop down list
    3. Click Rebuild and wait for a long while depends on how much damage and how large your harddisk is
    4. Once it's done, it will popup a report telling us what kinds of damages it detects and etc.  All we have to do is to click Replace button and wait for another while
    5. And that's it!
    Good luck, everyone : )

    Sunday, July 25, 2010

    how to sync ftp directory with a local directory in linux [part 1]

    Surprisingly, I could not find a (free and opensource) tool in Linux that states precisely in their manuals that they support syncing directory in ftp with a local directory in my computer.

    That I said "syncing" I mean it will only fetch the changes from the last sync into my local directory only instead of re-downloading the whole thing again which can be cumbersome.

    That I said "ftp", yes, I really mean the retarded ftp which I am always against it.  If I could, I would never use ftp.  As you may already guess, I have to use it as I have no choice.  The company I work with subscribe to several shared web hostings which usually come with retarded ftp server as the only mean to transfer files between our local computer and the servers which just totally SUCKS.

    The first thing came up to my mind was,  of course, rsync - but the problem is that it does not support ftp.

    The second thought was to use "mirror" command of lftp.  However, the manual page does not say exactly whether or not it does "sync".  I have a hunch that it can only downloads new files but can't keep the local directory in sync with what are on the ftp server.  So this does not work either.

    The third idea is what I chose.  Though, later I found that there were problems due to low quality of local ADSL Internet connection and etc which made it difficult to download directory that had many subdirectories and lots of small files.  Anyway, I suppose if your Internet quality is not bad, this can be a good try.

    The idea is to use curlftpfs to mount a directory in an ftp server to a local directory in your harddisk.  Now that you can access files (in ftp) as if they were your local files, you can choose any of your favourite backup tools to sync files in ftp and your local directory.  I use rdiff-backup to create versions of files in ftp in my local harddisk.

    See part 2 where I figured out how to sync ftp directory via lftp:

    how to sync ftp directory with a local directory in linux [part 2]

      

    Original Nokia N97 Wall Charger is on sale in eBay



    view it in eBay!


    Some history


    I bought Nokia N97 last year.  All the accessories are with my friend abroad for some reason except this wall charger (and a stylus which I will sell it too later) .  I just don't know what to do with it so I decide to sell it on eBay.

    Other details

    It was rarely used as I had a situation where I forgot to bring the charger and I decided to buy a new charger being an impatient person.  Therefore, it is in a perfect condition.


    Specifications

    NOKIA AC-10U
    INPUT: 100-240V~/50-60Hz/160mA/16VA
    OUTPUT: 5.0V/1200mA
    MADE IN CHINA B

    Thursday, July 22, 2010

    Surfing websites anonymously with Tor

    I completely don't understand why my government (in Thailand) has to invest a considerable amount of money on blocking undesirable websites.  As per my clear technical knowledge, it is impossible to do such thing.  Even within The Great Firewall of China, anyone who want to enjoy their activities on the Internet freely can, at least, subscribe to a pretty cheap and affordable VPN service from any providers outside China and then route their traffics through the VPN gateway instead and live a happier life since.

    I'd like to introduce you of how to browse websites anonymously (which also bypasses the Internet Censorship somehow) through a well-known proxy system, Tor.

    Regardless of how complexity Tor is which you will never really have to concern and if you run Grml Linux, you are coming to a right way.  The set up is very easy as follow:
    • grml_2009.10 (Hello-Wien) - I'd assume for any newer versions of grml, it should be relatively easy still
    • # agi tor
    • # /etc/init.d/privoxy start
    • # /etc/init.d/tor start
    • Install Torbutton for Firefox
    Now when you want to browse website anonymously via Tor, you can just click at the Torbutton on the bottom-right corner of Firefox (just make sure privoxy daemon and tor daemon are up and  running).

    Thursday, July 15, 2010

    fring complained about skype



    QUOTE

    Needless to say, we are very disappointed that Skype is now trying to muzzle competition, even at the expense of its own users.

    apple bluetooth keyboard model no: a1255

    I got this second hand keyboard from a good friend at very cheap price.  It requires 3 AA-size battery.  On the first week. I was really shocked to see that its battery level went down so fast like around 5% to 10% everyday.  I thought this keyboard might be damaged or something.  However, after the battery level reached like 60%, it then started dropping very slow.  I think after 2 months, it is now still left 36% which is amazing!

    Tuesday, July 13, 2010

    how to use unicode font with palringo for linux (wine)

    Palringo is a chat application that is famous for its mobile phone support.  I have heard it is an application that somehow tries to help non-BB users to fulfil the need for BBM-like application which is only for BlackBerry users.  To name a few of such prominent features:
    • ability to send voice clips
    • ability to do group chats (via chat rooms)
    It also supports other basic functionalities such as:
    • text chatting
    • sharing photos
    • supporting of various chat protocols e.g. palringo (default), msn, google talk, icq, facebook (jabber), and etc
    Desktop platforms that it supports are WIndows, MacOSX and Linux (wine).  Mobile platforms that it supports are Android, BlackBerry, iPhone, Symbian and WIndows Mobile.

    For Windows version and MacOSX version, they run natively on the operation systems.  But for Linux, which has a third-class support from Palringo, we have to run it on wine.  wine is a cool application / platform that lets us run a number of Windows-based applications on Linux.  I don't have enough experience with wine to tell you pros and cons about it.  However, I can notice that some times it can be sluggish.

    Now, let's come back to the topic of this post.  I have no idea which fonts are pre-installed with wine and Palringo (wine version).  But it does not support, at least, Thai characters by default.  All Thai characters I typed or received were displayed as squares.  I did some research on Google and found that Palringo (wine version) uses Tahoma font by default.  However, the Tahoma font come with Palringo installation does not support unicode character.  (Again, I don't have knowledge about fonts so I can't actually confirm this.)  In order to make it works, basically, I needed to copy Tahoma fonts from Windows which are:
    • tahomabd.TTF
    • TAHOMA.TTF
    which can be found in (WIndows) c:\windows\fonts\ directory, and paste them in (Linux):

    /home/unsigned_nerd/.wine/drive_c/windows/Fonts/

    After that I restarted Palringo and it just works.

    Sunday, July 4, 2010

    web based chart builder

    There were times when I needed to write flow charts or (computer) network diagrams.  Usually, people would just expect me to use Microsoft Visio and I just wouldn't disagree with that expectation.  In fact, even though I prefer Linux and I am fed up with anything Microsoft already, I still  like Microsoft Office per se.

    There was a day when I had to create a (computer) network diagram of my office.  Normally, I had Windows operating system installed on a virtualization but unfortunately it was already gone due to a harddisk failure which I hadn't been able to install it again due to my problematic old machine which for some reason would crash if I tried to read/write harddisk too  much which was the case when I wanted to install Windows on a virtualization so .... I didn't have Windows at the time.

    Luckily, I found a good web application (a Flash application):

    My Lovely Charts
    my.lovelycharts.com

    It's free as in beer.  It's easy to use.  I could export it into either png format or jpg format.  I could do everything with the free version.  The only features with the paid version that concerns me are:
    You may find more ... but as I said the free version is good enough (at least for me).