Free Microsoft eBook

Once again, there is a large give away of Microsoft eBooks from Eric Ligman, Microsoft Director of Sales Excellence.

The whole list of the free eBooks is available at Eric’s msdn blog.

However, as a developer, we would always love to do a batch download instead of clicking on each file for download.

Here we can simply do a wget to retrieve the entire list and wget again to download them. The entire collection stand at about 3.77GB, so make sure you have enough storage before you get started.


wget http://ligman.me/2sZVmcG
wget --content-disposition --trust-server-names -i 2sZVmcG

Posted in Uncategorized | Tagged , , , | Leave a comment

Backup of outlook data file

Doing backup of your personal files are very critical. That would include backup-ing your outlook pst/ost file. In this post, I would teach you how to automatically create a backup of the pst/ost.

A good idea would be to backup the pst file to a network drive as such NAS or external hard disk.

As you would know, it is not possible to move or copy the pst file while Microsoft Outlook is still open. Hence this tool here will only be activate when you close Microsoft Outlook. There are simply setting such as location of the pst to copy and the destination of where it should be copied too. You could also set a countdown which allow you to abort the copying if you does not want the tool to perform the backup at that moment.

My suggestion is to close Microsoft Outlook when you are going for lunch/break especially if your pst file is huge as cloning the pst file might take a while to complete.

This only works for Windows.

Posted in backup, Uncategorized | Tagged , , , , , | Leave a comment

Detecting OS and Redirect to a specify site

There will be some instance where we need to redirect user to different site based on their platform. As such the following javascript will do the job to which OS the user is on. In this case, Android, iOS, and Windows (Windows Moble) is supported. The following code snippet will be inserted to the head section of your html page.

Lastly you would need to have window.onload = getMobileOperatingSystem to trigger the javascript after the page finished loading.


<script type="text/javascript">
 function getMobileOperatingSystem() {
 var userAgent = navigator.userAgent || navigator.vendor || window.opera;

// Windows Phone must come first because its UA also contains "Android"
 if (/windows/i.test(userAgent)) {
 window.location = "https://www.microsoft.com/store/apps/9nblggh4trj3";
 //return "Windows Phone"; &amp;amp;nbsp;//you may choose to return value instead
 }

if (/android/i.test(userAgent)) {
 window.location = "http://codeinstincts.xyz/apk/TVDrama.apk";
 }

// iOS detection from: http://stackoverflow.com/a/9039885/177710
 if (/iPad|iPhone|iPod/.test(userAgent) &amp;amp;amp;&amp;amp;amp; !window.MSStream) {
 return "iOS";
 }

return "unknown";
}
window.onload = getMobileOperatingSystem;
</script>

Posted in Web Development | Tagged , , , , , , , | Leave a comment

Flask: Hello World

It works on raspberry pi too!

techtutorialsx

The objective of this post is to explain how to create a simple “Hello world” application with Python and Flask.

View original post 985 more words

Posted in Uncategorized | 2 Comments

Backup Digital Ocean VPS to image

While Digital Ocean does provide backup service, it would also be advisable that we have a local backup of our VPS.

You could do the following

$ ssh user@remote "dd if=/dev/vda1 | gzip -1 -" | dd of="/pwd/image.gz"

It might take a while to load the entire depending on how huge your droplet is and there won’t be feedback from the terminal while it is in progress.

Reference: http://unix.stackexchange.com/questions/132797/how-to-dd-a-remote-disk-using-ssh-on-local-machine-and-save-to-a-local-disk

Posted in Digital Ocean, Uncategorized | Tagged , , , , | Leave a comment

Deploying WAR file to Tomcat

In this post, I will continue to go thru the steps required to deploy a WAR file to the raspberry pi. And yes, it will works for other linux based system.

To deploy the WAR file, simply copy the WAR file to /opt/tomcat9/webapps/ folder and restart the tomcat server. The extraction and deployment of the WAR file will start automatically.

For example if your WAR file is named as jack.war, you could simply browse to http://localhost:8080/jack on your browsers to check that it is working.

Next if you want to change the default port in which Tomcat listen to, you would have to head over to /opt/tomcat9/conf/server.xml, below is the default


<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

Personally I had changed it to port 80 as can be seen below.


<Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

Reference used
http://www.mkyong.com/tomcat/how-to-install-apache-tomcat-8-on-debian/

Posted in apache tomcat, Raspberry Pi | Tagged , , , , | Leave a comment

Backup a img of Raspbian for Raspberry Pi

We cannot deny that it is important to always backup your data. It is even much more important to backup your entire Raspberry Pi SD card after going thru so much to setting up all the configuration which you never want to go thru again.

Therefore you should create a img of the SD card by doing the below on either a Linux or Mac machine


sudo dd bs=1M if=/dev/sdb of=raspbian.img

To restore from the img, simply do the below


sudo dd bs=1M if=raspbian.img of=/dev/sdb

While the Raspberry Pi Foundation recommend us to use bs=4M, it does not seem to work for me and hence I had decided to go with bs=1M even though it might be a lot slower but it works.

Just to note, if you are running Raspbian Jessie on Raspberry Pi 2, using the exact same SD card or img on a Raspberry Pi 3 is perfectly fine. There is no need for further configuration and it works out of the box. The only thing is that you might want to do a “sudo apt-get update” to fetch some of the specific updates for Raspberry Pi 3 hardware.

Posted in Raspberry Pi | Tagged , , , , , , | Leave a comment