Friday, October 29, 2010

Change Oracle Password

Just a note to remind myself how to change the password for GCSS.

Goto "Start", "Run"
type
sqlplus username/password@tnsnameconnection
type
password
enter old password
enter new password an confirm new password.
A message will appear on success.
CTRL-C to exit.

Wednesday, October 27, 2010

Junk Mail Proof Letter Box and SingPost

Regarding the Junk Mail Proof Letter Box and SingPost. Town Council simply ask me to opt out (according to their reply to me). They are not going to stop SingPost.

According to ST reporter Irene Tham in her article "Locked out of Competition?", IDA replies "it is not an area that the IDA policies."

SingPost has a reply in Stomp. They are obligated to deliver "addressed or unaddressed."

So what is the result? No where to turn to.

Well in that case we should be obligated to return it via the "return mail" letter box as the junk mail is "wrongly addressed". Don't throw it away as it is deemed by SingPost as legitimate. If you throw it away you are unethical. You are throwing away an admail which is "not addressed to you" and which SingPost deemed it as legitimate "mail".

Since the admail is not addressed to you, it should be a wrong delivery as it is not addressed to you. You are, therefore, obligated to return the wrongly delivered mail to the sender via SingPost. In this way, you keep the lobby area of your HDB Block clean and did a good civil service. SingPost can't complain that you throw junks into the "return letter" letter box otherwise they slap themselves.

Tuesday, October 26, 2010

SingPost and Junk Proof Letter Box

It used to be quite disgusting when your fellow residents simply drop the junk mail on to the floor in front of the Letter Box. Like myself, they are also so sick of the countless daily dosage of the junk mail. I still remember the first day when I moved in and checked the letter box. It was jam packed with junk.

The installation of "junk mail proof letter box" seemed to be a timely relief.

Actually the new letter box come as a surprise. There was no letter informing us of the change. One day you walked to the letter box and find empty and void at the place where it used to be. Then you notice some stickers with arrow pointing you to the new location.

The newly moved letter box looks totally shameful. It was dusty and dirty all over. Dust was even found inside the letter box. How the dirt gets into the letter box is anybody's guess. Since my letter box was actually at the side of the letter box set, I think the worker actually puts his hand into my letter box as a grip support.

It goes on for a few week till there is a letter informing us to collect the new letter box. I was quite glad when the keys was collected. It signals the new era of "No Junk Mail".

When I get the first ever junk mail from the letter box. I was quite surprised. How did the junk mail get into the box. The lid on my letter box is openable but is latched and can only be unlatched from the inside after you opened the letter box with your key.

On the next day, I happened to go downstairs and a post delivery man was putting in mails. I realize that he actually put in a junk mail into the letter boxes. I also noticed that there are quite a lot of fliers on his bike when he moved the bicycle pass me. Now, how did this happen? Then I realize that SingPost was privatized. This is, perhaps, another way they could earn money.

Since my new letter box is junk mail proof type, I would think that it is designed to prevent junk mails from getting in. Even the mail delivery person has no rights to put in junk mails right?

I wrote in to SingPost to check out. Their reply is candid. They simply say that they do put in "admail" and even indicate to me the schedule of what junk mail they put in.

Stop there! Why are they doing it? Is it not my letter box is now "junk mail proof"? On what authority can they put in "junk mail" while all others are now not able? If they can put in one, what is stopping them from not putting a whole bundle of it. In which case, what then is the "junk mail proof letter box" is for huh?

Does the Town Council install the "junk mail proof letter box" to benefit us or SingPost? Surely the former is the case. If SingPost can bypass that purpose and enjoy the monopoly of it then I may ask again "who benefits from the junk mail proof letter box"?

I am writing to MP, Town Council, forum, blogs, facebook etc. to highlight this strange behavior of SingPost. Hopefully more people can query the various authorities of this oddity.

Thursday, October 21, 2010

Enter Foreign Language for some applications

Modern program usually allows Unicode displays and input. However, many programmer still does not cater to Il8n (Internationalization). How then could I input and read Simplified Chinese instead of English in these programs.

Microsoft did provide some help however limited it is. You could set one language as the "system locale". According to Microsoft help "the system locale is the language that is used to display menus and dialog boxes for programs that do not use Unicode."

Setting it is simple.

  1. Go to "Control Panel".
  2. Click to open "Regional and Language Options".
  3. Click "Administrative" tab.
  4. Under "Language for non-unicode programs 'system locale'", click "change system locale".
  5. Choose the language of your choice and click "ok".
The above applies to Vista only. Also, you would have installed the Simplified Chinese IME. If you can't get it from Microsoft. Go to Google and search for "google IME". Unfortunately, there are only two IME available. The other one is Japanese IME.

I am not sure if Google selectively show IME available for the region. I sure hope so.

Wednesday, October 20, 2010

Testing Ajax

I normally create Ajax that calls a PHP which generates the XML code.

If the PHP page generates the XML nicely, Ajax will be able to process the data accordingly. However, if there is a PHP error, Ajax will not return the correct result.

Testing the called page is a headache if you use IE.

For example, if the page has a missing parameter

IE will show "The following tags were not closed:yourxmltag....". If you try to "view source", IE will tell you "The xml source file is unavailable for viewing".

Firefox will at least tell you that "SQL failed". At lease Firefox shows the php error when "view source".


Monday, October 18, 2010

SSIS Editing

When I start to use SQL SERVER 2005, I have no idea how to change the legacy DTS packages migrated from the old version of SQL Server to a SSIS package. It took me a long time to find myself around how to edit SSIS before I manage to create one SSIS package. In the process, I actually have to install Visual Studio (visual basic).

I changed a new laptop recently. To my surprise, the visual studio express series is available but I don't seems to be able to download it. There is no link to download it at all even though the Microsoft MSDN download shows the page.

Searching the internet actually turns out the fact that SQL Server itself has the tool to edit SSIS without installing Visual Studio externally. The installation is in the install disk 2 (tools). It is under Client Components, Business Intelligence Development Studio. When you select this option, the installation will actually install Visual Studio and with it the BDIS.

Friday, October 15, 2010

IF ELSE using Ternary condition.

I used to code simple if/else condition codes for simple operations. For example,

if ($x > $y)
$mycolor="red";
else
$mycolor="green";

echo "$myvalue";

It is just a if/else condition.

I have just discovered that there is a simpler method to do so. This is by the Ternary conditioning ?: code.

The example can be made simpler as follows

$mycolor= ($x > $y") ? "red" : "green";
echo "$myvalue";

It sure makes thing easier and less coding.

Dollar Sign function in JS

I have seen function like $("myid") in a number of javascript libraries. It worked fine for most browsers. JQuery, Prototype etc all uses this type of function name or name prefixed with $ sign. By itself it is no big deal. However, you cannot mix different libraries that uses functions that has $ signs or function names that prefixed with $. Inevitably, you may come across with functions with the same names across different libraries.

The following is a basic example of the use of $ function.

function $(idname){
return document.getElementById(idname)
}

var mytext=$("myid").innerHTML

Many Javascript Libraries have much more elaborate functionalities using this type function name.

Tuesday, October 12, 2010

Running a SSIS package from the web.

I have some data to import into SQL Server so I done it manually in SQL Server Management and save the process as a SSIS package. It was save as "SQL server".

It took me quite sometime to find out where is it stored. It was found in MSDB database. I actually have to start SQL Management under the "Integration" service to see that.

The bad news is that I can't edit it at all.

Ok, then I save it as file. and I am able to edit it with SQL Management "file open" method. And I actually noticed that I cannot create new SSIS package. I must have missed some steps in the "new Project" creation process.

Back to the original issue. Now that I have it created, I want to run it in an ad hoc way rather than schedule it. I then realize that I could not do it in Stored Procedure. It require XP_CMDSHELL to be enabled. According to internet, this is not a good security practice.

Other netizens recommended to create a SQL job to run the SSIS but don't schedule it. A Stored Procedure is created to run the job by using "sp_run_job 'myjob'".

I then create a php page to run the stored procedure by its name.

In this way, I could actually execute the SSIS package in an ad hoc way.

My question is - why have to make it so complicated to run a ssis package?

Monday, October 04, 2010

Javascript associative array testing

Try the following to see if it worked.

myary=new Array();
myary["xx"]=1
if ( myary == "")
alert("myary is null/undefined/nothing")
if (typeof myary =="object")
alert("is obj")

It returns two alerts. But it is not correct as myary did have a value.

change myary["xx"]=1 to myary[0]=1

You will get only the second alert.

try the original script but this time change if(myary == "") to if(myary === "")

again only the second alert is shown.

Checking an array to see if it is empty is kind of awkward. It is not null or "undefined" as you already defined it as array.

Depending on the type of array, the results may be different between using "== " and "===" to compare with "" (empty).

1. If there is no value defined, "==" returns "true" whereas "===" return "false" and the length returned is 0.

2. If there is a valued defined (normal array), both test shows "false". The length returned one or greater.

3. if there is a value defined for associative array, "==" returns "true" whereas "==="return" false. The length returned is always 0.

As you can see, "===" always return false regardless of whether the array has a value. Using this to test whether the array is empty will not be fruitful.

On the other hand "==" actually returns "true" for associative arrays if it has a value. But then if the array has no value, "==" also returns "true".

The only sure way that I know is to use the following method to test

mytruefalse=false
for(x in myary){
mytruefalse=true
break
}

Friday, October 01, 2010

Fixed menu again

Although the fixed menu worked fine with IE7, Firefox and chrome, when IE 6 is used, the same age old problem of SELECT showing over DIV still exists when you scroll the window.

I have just noticed that when the web page is shown with the SELECT positioned just behind the DIV, it actually works. But when you scroll the SELECT again go on top of the DIV.

I have a stupid but working solution to this. Just do the following.

Create a javascript right at the end of the page which will only appears if the browser is IE 6 and below using the
<!--[if lte IE 6]>... <![endif]--> syntax to ensure that the script will not be used for IE7 and above.

Add the following in the script

mytime =setInterval("goforit()",100)
function goforit() {
hf=document.getElementById("hiframe")
hf.style.display="none";
hf.style.display=""

Finally add a IFRAME between the two DIV. with style similar to the second DIV. The SRC should be <html></html> but replace the greater than and lesser than with the escape code for the two character. The height and width should be same as the second div. Give it and ID (hiframe in the script example).

It will be good to hide the IFRAME if it is not IE 6 and below or other browsers.