Friday, December 12, 2008

Javascript to close the current window

"<script language='javascript'>window.open('','_parent','');window.close();</script>"

Javascript Form Submit Using POST action Into a new Window

<form> element of html have several attributes for controlling submission

method : get or post
action : the url for the post back action
target : the target for the post back action, _blank, _parent, _self, _top, name of a window
name : name of the form

In this topic of using javascript to change POST action of a form so that it post into a new Window, action and target is the most important attribute here.

you can use javascript function window.open(url, name, param)
e.g. window.open(test.html,'','scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,status=no');

to post into another window, we will set the action to the url of the new window and target is the name of the new window.
e.g.

function PostToNewWindow()
{
    form.action = 'newForm.asp?action=submit&param=new'; //any valid url and query string
    form.target = 'NewPopupForm'; // name of the new form
    window.open('', 'NewPopupForm', 'height=50, width=50, resizable = no, toolbar=no, status=no');
    form.submit;

}

Wednesday, December 10, 2008

Trim a string in JavaScript using replace function and regular expression

from this article http://www.nicknettleton.com/zine/javascript/trim-a-string-in-javascript

var trimmed = str.replace(/^\s+|\s+$/g, '') ;

Tuesday, December 2, 2008

SQL SERVER SQL Query Conditional Count with CASE Clause inside COUNT

Suppose you have a master and child table in the following structure and you want to find out how many thing of each category is sold or not

Category       
Music       
Book       
Movie       


Category    Name    Sold
Music    Love Song    T
Music    Rock    T
Music    Classical    F
Book    Dictionary    T
Book    Fiction    T
Book    Textbook    F
Movie    James Bond    F
Movie    MI3    F


You will write the following query for it

Select
    Category
    ,Count(Name) as ProductCount
    ,Count(Case When Sold = 'T' Then Name Else NULL End) as SoldCount
    ,Count(Case When Sold = 'F' Then Name Else NULL End) as UnsoldCount
From Product
Group By Category

NOTE: the NULL value in the else clause is critical, if you put zero there, the query will not work.

Friday, November 7, 2008

SENNHEISER Headphone Spare Parts Online Shop

LINK : http://www.jaudio.co.nz/Earphones/Spares+Parts+Sennheiser/Sennheiser+HD555.htm?osCsid=qbpt8bvdard8t6t41421r1vt77

This online shop sale Sennheiser Headphone spare parts in NZ

Monday, November 3, 2008

College Rifles Badminton Club Booking System


original article http://www.crbad.co.nz/club_play.html

Club play:













































Hall Programme
SUN 6am-5pm

Open Booking

5pm-7pm

Auck. Tamils


7pm-10pm

Club Night
MON 9.30am-1pm

Midweek Club
1pm-4pm

Open Booking
4pm-7pm

Juniors
7pm-11pm

Open Booking
Tues 6am-4pm

Open Booking
4pm-7pm

Juniors
7.30pm-9.30pm

Balmoral Club
WED 9.30am-1pm

Midweek Club
1pm-8pm

Open Booking
8-10pm

Kohi Club
THU 6am-7pm

Open Booking
7pm-10pm

Club Night
FRI 6am-7pm

Open Booking
6pm-7.30pm

Juniors
7.30pm-11pm

Open Booking
SAT 6am-11pm

Open Booking

NB: To book a court you have to be a member. Refer to How to Join


Visitors:

Club visitors are always welcome - $10 per person for club night,
$8 per person for club day.


Use of Courts:

To enable you to book a court, you need to have sufficient funds in
your card account. Payment can be made in the coin slot or note reader
provided or to the secretary in advance.

Refer to instructions on the wall beside the booking meter.

Court Light Instructions:


TWO Club Players
Player One
  1. Swipe your card through the card reader.
  2. Select the nominated court number via the keypad.
  3. Press the ON key.
Player Two
  1. Swipe your card through the card reader.
  2. Select the same nominated court number via the keypad.
  3. Press the ON key.
The operation will time out after a period of 10 seconds - if both players have not selected the
court number and pressed the ON key within this time frame you will need to try again.

NB: Both members need to be current valid and/or paid up members to switch court lights on.

ONE Club Player and ONE Visitor
Player
  1. Swipe your card through the card reader.
  2. Press the MENU key - option 9 - player and visitor
  3. Select the nominated court number via the keypad.
  4. Press the ON key.
Lights will automatically switch off at the end of your allocated period.

Contact details:

Address:

33 Haast Street, Remuera

(Near Upland Road Shops)

PO BOX 87-447, Meadowbank

Phone/Fax: 524-4285

Email: crbad@orcon.net.nz

We are going to be using email to communicate to all members. Can all members please email the office at
crbad@orcon.net.nz to confirm that we have your correct email address.

Office hours:

Club Secretary Sherilyn Bright is in our on-site office on Monday,
Wednesday & Friday 10am - 2pm.

The office is open from the first week in February to mid-December
but may be closed in the school holidays.

Wednesday, October 29, 2008

Install Windows Media Player 11 on Windows Server 2003

Install Windows Media Player 11 on Windows Server 2003

by Zack Whittaker

1)
Download the Windows Media Player 11 setup file from here and save to disk.
2) Run the setup file - the first thing you should see if a validation checker. Just leave this up, don’t go any further.
3) Search the hard drive for “wmp11.exe” - it should be in a temporary directory somewhere. Right click the file in the search then click “Open containing folder” (and not open).
4) Open and run the wmfdist11.exe file, then umdf.exe and wmdbexport.exe. Be warned, you may need to run these files in Compatibilty Mode. Simply right click each file, click Properties. Go to the Compatibility tab, then ensure that Windows XP is selected.
5) After all these are installed, you must restart (very important.)
6) Once you’ve restarted, run the wmp11.exe file in the same directory - this also may require compatibility settings being applied to it. Restart once more.
7) Back into Windows again, go to Start, Run then type in wmplayer then OK. Configure as you like, and viola it’s done

This method has been tested on my Windows 2003 R2 server. and it works. The reason I needed media player 11 on Windows 2003 is that so I can use MediaPortal 1.0 RC3.