Unable to see .htaccess or dot files in File Manager, cPanel

0

I was attempting to “edit” .htaccess file to make some url redirection for a page and I realised I wasn’t unable to locate the file in my web root. The first instinct is that I didn’t have any .htaccess file and I decided to create one. However, I was given an error that ERROR: Could not create file “.htaccess” in path. File exists..

This indeed confused me as I cannot locate the file. Upon further probing, I realised what was wrong. You have to check on the option Show Hidden Files (dotfiles) when you open up File Manager in your cPanel.

Tick the options Show Hidden Files (dotfiles).

Tick the options Show Hidden Files (dotfiles).

NUS Students are getting a lifelong email in the cloud with 50GB!

0

Most of the NUS students should have received an email from the NUS Computer Centre that we will be getting a lifelong email hosted on Office 365! What’s more, it is going to be 50GB huge! They are going to come with Lync and OneDrive as well! However Lync and OneDrive are only for current students. This implies that we no longer have access to those services, except for email, after graduation!

The email domain that we are using right now @nus.edu.sg will be valid till 31 December 2014.

The new email domain for NUS students will be @u.nus.edu.
The new email domain for Duke-NUS students will be @u.duke.nus.edu.
The new email domain for Yale-NUS students will be @u.yale-nus.edu.sg.

Press here to read the full report.

Converting Binary to Gray Codes

0

I am doing one of the tutorial in CS2100 in NUS SoC and one of the questions require us to convert between binary and gray codes.

I have decided to write a simple tutorial on how to convert from binary to gray codes.

What is Gray Code?
“….is a binary numeral system where two successive values differ in only one bit. The reflected binary code was originally designed to prevent spurious output from electromechanical switches.”
~http://en.wikipedia.org/wiki/Gray_code

What is Binary Code?
A binary code represents text or computer processor instructions using the binary number system’s two binary digits, 0 and 1.
~http://en.wikipedia.org/wiki/Binary_code

Before we start, lets look at an Exclusive OR, XOR(sometimes EOR gate, or EXOR gate)’s truth table.

The whole concept on how to do the conversion between the 2 number system heavily uses the XOR truth table.

 

 

 

Binary to Gray Code Conversion

Binary to Gray Code Conversion : Step 1 – Prepare a table like this

Binary to Gray Code Conversion

Binary to Gray Code Conversion : Step 2 – Copy down the Most Significant Bit (MSB) of Binary onto Gray Code row

Binary to Gray Code Conversion

Binary to Gray Code Conversion : Step 3 – Get the MSB and next MSB of Binary and XOR them and copy its result down

Binary to Gray Code Conversion

Binary to Gray Code Conversion : Step 4 – Get the MSB and next MSB of Binary and XOR them and copy its result down

Binary to Gray Code Conversion

Binary to Gray Code Conversion : Step 5 – Get the MSB and next MSB of Binary and XOR them and copy its result down

Binary to Gray Code Conversion

Binary to Gray Code Conversion : Step 6 – Get the MSB and next MSB of Binary and XOR them and copy its result down

Binary to Gray Code Conversion

Binary to Gray Code Conversion : Step 7 – Get the MSB and next MSB of Binary and XOR them and copy its result down

Binary to Gray Code Conversion

Binary to Gray Code Conversion : Step 8 – Get the MSB and next MSB of Binary and XOR them and copy its result down

Gray Code to Binary Conversion

Gray Code to Binary Conversion : Step 1 – Prepare a table like this

Gray Code to Binary Conversion

Gray Code to Binary Conversion : Step 2 – Copy up the Most Significant Bit (MSB) of Gray Code onto Binary row

Gray Code to Binary Conversion

Gray Code to Binary Conversion : Step 3 – Take the MSB of Binary and next most MSB of Gray Code and XOR them. Copy its result upwards.

Gray Code to Binary Conversion

Gray Code to Binary Conversion: Step 4 – Take the MSB of Binary and next most MSB of Gray Code and XOR them. Copy its result upwards.

Gray Code to Binary Conversion

Gray Code to Binary Conversion: Step 5 – Take the MSB of Binary and next most MSB of Gray Code and XOR them. Copy its result upwards.

Gray Code to Binary Conversion

Gray Code to Binary Conversion: Step 6 – Take the MSB of Binary and next most MSB of Gray Code and XOR them. Copy its result upwards.

Gray Code to Binary Conversion

Gray Code to Binary Conversion: Step 7 – Take the MSB of Binary and next most MSB of Gray Code and XOR them. Copy its result upwards.

Gray Code to Binary Conversion

Gray Code to Binary Conversion: Step 8- Take the MSB of Binary and next most MSB of Gray Code and XOR them. Copy its result upwards.

Address in address bar in right to left

0

I am sure this will be useful to some of my audience who may have similar experience as me.

There was this one day when I accidently click on some stuffs(which till date is still unknown to me what I did) and I accidently changed a setting which I shouldn’t had.

This causes my address bar to be reading from right to left as you can see below

To solve it, right click on the address bar and uncheck “Right to Left Reading Order”

Studying in National University of Singapore

0

Its been a month plus since I ORD’ed and matriculated into National University of Singapore(NUS). You can refer to my ORD post here (ORD LO). Week 0 was on 5 August 2013 and our official lessons started a week later on 12 August 2013. First 2 weeks are purely just lectures and sectional teaching(just like lectures) and during these 2 weeks, we are bidding for our tutorials and lab slots. This semester is 13 weeks long for me(inclusive of 1 week eLearning and 1 week recess week(on week 7)).

In my first semester of year 1, I took the following modules.

  1. MA1301 – INTRODUCTORY MATHEMATICS
  2. CS1020 – DATA STRUCTURES AND ALGORITHMS I
  3. CS2100 – COMPUTER ORGANISATION
  4. IS1105 – STRATEGIC IT APPLICATIONS
  5. SSA2209 – GOVERNMENT AND POLITICS OF SINGAPORE

Besides CS2100 which I spent 211 points to bid for it from my Programme Account and SSA2209 which I spent 50 points. The rest were pre-allocated and 1 points for each were deducted from my Programme Account. Its interesting how we have to fight for the modules that we would want to take. This is something very different from what we have in polytechnic.

I am entering week 5, which is the e-learning week for this semester. I would say that the whole ecosystem of NUS is very different from Temasek Polytechnic. No more caregroup system, you are now “given more responsibility” for your own education. No more checking of homework by tutors, if you do not participate actively in class and finish up the tutorials, you are going to pile up your backlogs and before you know it, its already exam.

To end off, some useful links that would benefit a new student or existing undergraduate.

Useful links
NUS MyISIS
NUS IVLE
NUS Email Login
NUS SoC Email Login
NUS CORS
NUS SoC CodeCrunch
NUSMods
SoC Undergraduates – Useful Course Schedule
NUS Library Portal
NUS Library Portal – Exam Papers
uTown Facilities Booking
Will update this blog more often! Time to change a theme!

ORD LO

0

Original post can be found here: so basically it meant uncheck cs1020 tut 6 (its alternative) and replace it with tut 5.. same placement order.

17544 hours: the number of hours that I am rightfully employed as a National Serviceman Full Time by the Singapore Armed Forces. This amount of time is considerably shorter compared to most regulars in the regulars-dominated RSAF(the service I am in) but I dare say that my Air Force story is as colourful as any regular in the service. I enlisted with a heavy heart on 2nd August 2011 to Pula Tekong. Up to the time when I was taking the “penguin ferry”, I still could not comprehend why there was a need for National Service. It was so disruptive and intrusive to my life.

I was recruited into Leopard Company, Platoon 1, Section 4, Bed 11. (L1411) under the charge of 2SG(NS) Wei Chong and LTA(NS) Weng Yew for my Basic Military Training(BMT). I was very lucky to have them as the sudden change of environment was certainly a culture shock to most of us but their patience allowed us to settle down and transit smoothly into this phase of our life.

In BMT, I made lots of friends and buddies. From strangers to friends, we rolled in the mud together, punished together, and trained under the sun together. The first time we stripped our “wife”, had our IMT(known as real-life counter-strike), went into a live range and shot real bullets and even threw grenades, it was certainly an experience that one would never forget.

I went on to AFTC as an AOS(trainee). I had good course commanders who listened to us and to the feedbacks of the course and improved from there. The new friends, new buddies, bunk mates that I made undoubtedly made our compacted and stressful syllabus much more fun and easy to learn allowing us to be competent in our skill-set in our upcoming unit life.

Shortly after my Passing-Out Parade(POP) in Sembawang camp(under the rain), I was posted to Air Combat Command from Air Force Training Command. I knew that signified the start of my unit life. Horrible stories had been spreading around on how bad unit life can be and most of us were very reluctant to move on from AFTC, myself included; I was quite apprehensive to move on to my new unit.

The day came and I was supposed to report to my unit in Changi Airbase (West). My uncertainty was very soon eased. I really enjoyed working with my superiors. They put their trust in me and did not treat me like an NSF(not in a bad way). We worked together with the same agenda and objective in mind. I learnt a lot from their leadership and better understood their decision-making calculus from a HQ point of view.

Not forgetting the 4 squadrons, their officers, and their specialists whom I have crossed path and worked together with, as well as the advice and guidance they have given me, I am really glad I made great friends inside.

A special thank you message to the following people (usually people will say in no particular order but in this case, in the order of rank)

SLTC Mike – Sir. Thank you for your patience with me when I was covering your secretarial work especially during the times of uncertainty. You are very close to the ground and many SQN personnel appreciate you. You shared with us your stores of the Air Force and you did not distant yourself from us despite of your appointment as the Commanding Officer. I have also learnt a lot from you like the process of understanding situations and making certain decisions. Sir, thank you!

LTC(NS) Song – Sir, once again, thank you for your guidance and showing me your drive in your work. You are really knowledgeable. While you may or may not have noticed, you changed my life, the way I view things, and the way I handle things. Sometimes when I am confused on what decision to make, I ask myself, “What would you do if you were in my shoes?” Sir, thank you very much!

LTC Ian Tan – Sir, thank you for your unlimited amount of patience when I approached you randomly on advice on my life and studies. You are like a mentor to me. The smile that you always wear on your face makes me wonder sometimes if you ever have worries. Thanks for your guidance!

LTC Ravi – Sir, despite the fact that I had barely worked with you for 3 months, I can never forget the cheerfulness you brought to the office. I have, right in front of my eyes, seen how you pulled things together and got it working(to your ideal state) and thought of the situation from a broader view for the organisation. Your constant care and concern for the people (including me even after you posted out) around you certainly brought a warm touch to our life. I am glad to have worked with you. Congratulations once again on your promotion.

MAJ Kevin Tan – Sir, even though the time I got to work with you was short, I had always been amazed by your straight-forwardness and foresight.

CPT ChuaJ – Sir, it had been an honour to be able to work under you. Despite the fact that you get a lot of injects from all over the places, it was always miraculous to see how you could pulled things together and get the stats/data and information submitted to respective stakeholders on time. All the best to your upcoming endeavours.

CPT Derrick Kong – Sir, your exciting life(that you shared with me) before you signed on was truly amazing. The calm composure that you portrayed all the time coupled with the smile(and the spiky hair that you always gel) is something that I would never forget about. Your sharing of your university life benefitted me and allowed me to be better-prepared for the life I am about to embark on.

Mei – Mdm, thank you for everything and for being around when I was at my all-time low(due to the sudden demise of my bro) and all-time high(most of the time). You have taught me a lot, so much so that I will not be able to list them all here. Wishing you all the best in your health. Thank you so much!

Ryan – Bro, we may very well be working together in the future. :p I hope you will not have to cover Mdm Mei as much as I do(in a positive way).

Yan Yang – Bro, like I always say, you are lucky to be here. Enjoy yourself well and spend your time fruitfully! Thank you for contributing.

*There are so many more people that I have crossed path with in the service that I did not mention here, this does not mean that you did not impact my life. My Air Force story is so colourful that I would be able to go on and on for a few pages. It is just that I have decided to only credit the people in my office to keep this short…. relatively short.

Not forgetting my brothers and sisters, friends and families who had supported me throughout my 2 years stint with the service. Your constant support and encouragement made me realise my contributions to the National Service is worthwhile.

A verse from Every Singaporean Son : “Through the years, we have realised why we fought the battle deep inside.”

2 years later, on 1st August 2013, I collected my pink IC and change the status on my 11B from enlistee to NSman. Reflecting back, these 2 years of contributions were small yet important to ensure that our homes and freedoms are safeguarded. I realised the importance of National Service and was glad that I had so many people around me who supported me and made this journey more fun and more fruitful. Thank you!

While I am excited and am looking forward to the next phase of my life, the 2 years’ worth of memories(the friends and buddies I made, the lessons I learnt) are kept deep in my heart.

Allow me to conclude with a video titled Priceless ( http://youtu.be/XrGXtLHfJRM ) by Kenny Tan. It was one of the nomiations for ciNE65 and the film won Overall Best Film and Best Screenplay. The boy who acted in this short film happened to be one of the students i taught in Wufang previously.

I certainly know what I am protecting now and thank you for giving me such a wonderful Air Force story!

3SG(NS) Lim Guo Hong

Using Windows Explorer as a FTP client

0

Recently I have been talking to Kiat Siang on some of the things we are doing and he questioned me on how we could use “Windows Explorer” to access the FTP. Interesting he is not the first to ask me that question. Though its easy but often overlooked. Made this quick guide on how one can do so.

 

Step 1 : Open up File Explorer and click on the address bar.

 

 

 

 

 

Step 2: Type in the ftp address, remember to prefix it with the ftp protocol.

 

 

 

 

 

 

Step 3: After it went in, right click on the content area and select Login As…

 

 

 

 

 

 

 

 

 

 

Step 4 : Login dialog will appear, type in your ftp username and ftp password

Delete data from database automatically at regular interval

0

Recently I attended a session where a few developers would discuss about the website they have done. One of the developers approached me and asked me if there is a way that you could delete data from MySQL database once a week / at regular interval. I thought this short tutorial will be useful for one who wish to do so on the LAMP stack.

Step 1: We will come up with the php file that will do the delete function, from MySQL database and upload it.

$link = mysql_connect(‘localhost’, ‘mysql_user’, ‘mysql_password’);

if (!$link) {
die(‘Could not connect: ‘ . mysql_error());
}

mysql_select_db(‘mydb’);

mysql_query(“DELETE FROM mytable WHERE WHERE dateInserted > ’2012-9-9′”);

In my sample code above, i did, “DELETE FROM mytable WHERE WHERE dateInserted > ’2012-9-9′”. It depends on what you want to do, you can always change the conditions on why it should be deleted. I have also saved it as DeleteData.php

 

Step 2: Since I have cPanel, i used cPanel and go into Cron Jobs

 

 

 

 

 

 

 

Step 3: I will setup the cron job to run at once a week.(Of course you can set otherwise)

 

 

 

 

 

 

Note that for Command, you have to specify where the file lies, after you upload.

You can download the mentioned, DeleteData.php here.

Delete records from mysql automatically

Hope this is helpful for those who are finding a quick tutorial on how this can done. If you have any questions, please feel free to email guohong@limguohong.com, use the contact us form or alternatively you can comment. :)

I will post a tutrial on how we can do this on WISA stack.

Windows Phone 7 – Textbox On Focus Color

0

Was browsing around Stackoverflow and saw a question that someone asked, (WP7DEV) Textbox background changes when typing

Thought it will be useful for someone who needs it.

Explaination:
By default, a textbox on Windows Phone 7 will look at the one you see in the screenshot on the left, below, but when you were to focus on it, it will turn into slightly white-ish, as seen on the right.

Some of the scenarios for your development do not allow that and requires them to be the same. Written this quick guide in case someone needs it.

1. Attach a GotFocus event handler to the textbox you want to have the effect on.
2. Add this code in the method.

textBox2.Background = (SolidColorBrush)Resources["PhoneTextBoxBrush"];
textBox2.BorderBrush = (SolidColorBrush)Resources["PhoneTextBoxBrush"];

*Please remember to change textBox2 to the correct id of the textbox that you want the effect on.

For those of you who are curious where I get the Resources from, you can view a list of the available resources here : http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff769552(v=vs.92).aspx#BKMK_BrushResources

You can download the solution here too:
https://skydrive.live.com/redir?resid=29F099C37B76CA59!2793&authkey=!ACBRpIRyDopM5Lo

生於憂患 死於安樂 : 天降大任於斯人也,必先苦其心志,勞其筋骨

0

舜發於畎畝之中,傅說舉於版築之閒,
膠鬲舉於魚鹽之中,管夷吾舉於士,
孫叔敖舉於海,百里奚舉於市。

故天將降大任於斯人也,必先苦其心志,勞其筋骨,
餓其體膚,空乏其身,行拂亂其所為,所以動心忍性,曾益其所不能。
人恆過,然後能改;困於心,衡於慮,而後作;徵於色,發於聲,而後喻。
入則無法家拂士,出則無敵國外患者,國恆亡。
然後知生於憂患而死於安樂也。

Go to Top