Thursday, September 29, 2005

Porting from Oracle PL/SQL:

--
-- instr functions that mimic Oracle's counterpart
-- Syntax: instr(string1,string2,[n],[m]) where [] denotes optional params.
--
-- Searches string1 beginning at the nth character for the mth
-- occurrence of string2. If n is negative, search backwards. If m is
-- not passed, assume 1 (search starts at first character).
--
-- by Roberto Mello (rmello@fslc.usu.edu)
-- modified by Robert Gaszewski (graszew@poland.com)
-- Licensed under the GPL v2 or later.
--

CREATE FUNCTION instr(VARCHAR,VARCHAR) RETURNS INTEGER AS '
DECLARE
pos integer;
BEGIN
pos:= instr($1,$2,1);
RETURN pos;
END;
' LANGUAGE 'plpgsql';


CREATE FUNCTION instr(VARCHAR,VARCHAR,INTEGER) RETURNS INTEGER AS '
DECLARE
string ALIAS FOR $1;
string_to_search ALIAS FOR $2;
beg_index ALIAS FOR $3;
pos integer NOT NULL DEFAULT 0;
temp_str VARCHAR;
beg INTEGER;
length INTEGER;
ss_length INTEGER;
BEGIN
IF beg_index > 0 THEN

temp_str := substring(string FROM beg_index);
pos := position(string_to_search IN temp_str);

IF pos = 0 THEN
RETURN 0;
ELSE
RETURN pos + beg_index - 1;
END IF;
ELSE
ss_length := char_length(string_to_search);
length := char_length(string);
beg := length + beg_index - ss_length + 2;

WHILE beg > 0 LOOP
temp_str := substring(string FROM beg FOR ss_length);
pos := position(string_to_search IN temp_str);

IF pos > 0 THEN
RETURN beg;
END IF;

beg := beg - 1;
END LOOP;
RETURN 0;
END IF;
END;
' LANGUAGE 'plpgsql';

--
-- Written by Robert Gaszewski (graszew@poland.com)
-- Licensed under the GPL v2 or later.
--
CREATE FUNCTION instr(VARCHAR,VARCHAR,INTEGER,INTEGER) RETURNS INTEGER AS '
DECLARE
string ALIAS FOR $1;
string_to_search ALIAS FOR $2;
beg_index ALIAS FOR $3;
occur_index ALIAS FOR $4;
pos integer NOT NULL DEFAULT 0;
occur_number INTEGER NOT NULL DEFAULT 0;
temp_str VARCHAR;
beg INTEGER;
i INTEGER;
length INTEGER;
ss_length INTEGER;
BEGIN
IF beg_index > 0 THEN
beg := beg_index;
temp_str := substring(string FROM beg_index);

FOR i IN 1..occur_index LOOP
pos := position(string_to_search IN temp_str);

IF i = 1 THEN
beg := beg + pos - 1;
ELSE
beg := beg + pos;
END IF;

temp_str := substring(string FROM beg + 1);
END LOOP;

IF pos = 0 THEN
RETURN 0;
ELSE
RETURN beg;
END IF;
ELSE
ss_length := char_length(string_to_search);
length := char_length(string);
beg := length + beg_index - ss_length + 2;

WHILE beg > 0 LOOP
temp_str := substring(string FROM beg FOR ss_length);
pos := position(string_to_search IN temp_str);

IF pos > 0 THEN
occur_number := occur_number + 1;

IF occur_number = occur_index THEN
RETURN beg;
END IF;
END IF;

beg := beg - 1;
END LOOP;

RETURN 0;
END IF;
END;
' LANGUAGE 'plpgsql';

MobileBurn Forums - 7610 lock code: "Series 60

On a Series 60 v1 based phone (N-Gage, 3650, 7650), two key sequences will allow to restore your phone to a cleaner state: Normal Reset (*#7780#) : Restores ini files from rom but preserves user data (photos, 3rd party apps etc)

Deep Reset (*#7370#) :
This reformats completely the C: drive. All applications and files stored on this drive will be lost and clean default files will be rewritten.

In both case, the phone will ask you a confirmation and you will have to enter a security code (12345 by default).

Files and applications stored on E: drive are not be affected by these sequences.

On newer Series 60 phones (6600/6620/7610), the sequence is slightly different:
power the phone off,
press and keep down (simultaneously) the keys green/talk + ’3’ + ’*’, - power on the phone.
release the keys when the formatting starts."

Rockin' on without Microsoft | Newsmakers | CNET News.com: "The myth has been built so big that you can't survive without Microsoft."

Monday, September 26, 2005

to all nanakawan ng cellphones. ipa-block nyo sa ntc, para madiscourage natin yung mga buyer ng snatch cellphone.

wag bumili ng following phones. 6260/6600/6620/6670/7610. parang smart amazing phone madaling maiformat pag nanakaw, maski may lock code pa.

pero meron paraan thru NTC blocking. read on.

Common Problems Q&A - Read this first! - Nokia Talk - Mobiledia: "Q: How do I format my phone?
A: - Normal Reset (*#7780#) : Restores ini files from rom but preserves user data (photos, 3rd party apps etc)
- Deep Reset (*#7370#) : This reformats completely the C: drive. All applications and files stored on this drive will be lost and clean default files will be rewritten.

In both case, the phone will ask you a confirmation and you will have to enter a security code (12345 by default).

Files and applications stored on E: drive are not be affected by these sequences.

For Symbian OS 7 (6260/6600/6620/6670/7610) there is a third method:
Turn phone off, press and hold the green (talk) key on the left + number 3 on the keypad + the * key and then turn the phone back on. "

The phone will start the formatting process without confirmation!
Files and applications stored on E: drive are not be affected by this.




andaling maformat yang mga nokia models na yan. parang smart amazing phone, madali rin ma-format maski may phone lock.

phone lock: (so only you can use your phone)
but locking can be easily erase by formatting the phone. see phone block.

phone block:
block your cellphone to all cellphone networks.

kung nawala or nanakaw cellphone mo ipa-block mo sa NTC
, basta nairegister mo sa ntc through text prior manakaw cellphone, pag nawala o nanakaw sayo, pwede mo later ipa-block. kung hindi mo naman naregister through text prior ma-block, pwede pa rin ipa-block, pwedeng hagilapin mo yung resibo mo and pumunta ng ntc and ipa-block.


ang procedure ng ntc pag nag-b-block ng cellphone(nakausap ko yung isang employee ng taga-ntc nung pumunta ako dun), gagawa sila ng order letter sa lahat ng telcos, globe, smart, sun, etc, para ipa-block nila sa network nila yung IMEI(your cellphone internationally unique id). tinest ko yung blocking ng NTC maski di pa man nananakaw yung cellphone ko to see if it works, hindi sya real time na pagrequest or pagtext mo sa ntc is i-b-block ng mga cellphone networks agad yung dati mo unit. mga 1 or 2 weeks bago ma-actionan ng mga cellphone networks yung blocking request mo. and it works! wala tuloy ako nagamit na cellphone noon. nung ipapa-unblock ko na, naghintay din ako 1-2 weeks para ma-unblock, di ma-unblock. so pumunta ako ntc para irequest na ipa-unblock yung cellphone ko. sabi mas madali raw magpa-block kesa magpa-unblock. and it so happens na malfunctioning na rin yung smart amazing phone unit ko, so punta ako smart wireless, then nung ibinalik nila sa akin, pinalitan na ng smart yung motherboard nung cellphone malaki na raw damage sa board. mahal pa naman motherboard ng cellphone, halos kapresyo na rin ng buong unit. so iba na rin yung IMEI. so hindi ko tuloy na-sure kung ni-actionan ng ntc yung unblocking nung original IMEI ko.


maaaring pwede pang magamit sa labas ng bansa yung nanakaw sa yong cellphone, hindi naman yata nagbibigay ng order letter ang ntc na ipa-block sa telcos sa ibang bansa yung imei mo :)

pupunta nga pala ako ntc this friday or thursday, ipapa-block ko yung nadukot sa akin cellphone nokia 6670, mga ipit gang nakabiktima sa akin, be cautious sa mga ganito gang o kahit ano pa klase ng gang, laglag-barya, laglag-panyo, basta lahat na ng style ng pagnanakaw. malapit na pasko, season na naman ng dukutan.

ipa-block sa NTC ang nanakaw sa inyong cellphone para ma-discourage natin yung bentahan ng snatch cellphone.

heheh revenge is sweet. malamang na mag-away yung magnanakaw and yung nabentahan ng phone once na na-block na yung unit ko. sa mga nanakawan din, ireport nyo sa NTC, dalhin nyo lang yung original box nung unit nyo, the one with the imei, and yung resibo.



------------------------



mga modus operandi ng magnanakaw


nga pala, yung nakabiktima sa akin ipit gang, pormal and disente nga sila manamit.


text NTC


or go to:

National Telecommunications Commission.
NTC Bldg., BIR Road, East Triangle, Diliman, Quezon City 1104

Tel Nos. 9267722

e-mail: ntc@ntc.gov.ph


-----------------------------------------------

iba-ibang kwento ng nanakawan:

story 1

story 2

story 3



Sunday, September 25, 2005

stuff or pad spaces to the left

*MSSQL*

create view vuecollectionsummaryor
as
select ornumber,

ornumberstr =

convert(
char(20),
space(20 - len(ornumber))
+ ornumber),

datecollected,


collection
from collectionsummaryor


*POSTGRESQL*

create view vuecollectionsummaryor
as
select ornumber,

-- ornumberstr =

lpad(ornumber,20) as ordernumberstr,

datecollected,


collection
from collectionsummaryor

PostgreSQL General Bits

emulated mssql dateadd and datediff function to postgresql: note only month is implemented

-- Function: dateadd(varchar, int4, date)

-- DROP FUNCTION dateadd("varchar", int4, date);

CREATE OR REPLACE FUNCTION dateadd("varchar", int4, date)
RETURNS date AS
$BODY$

DECLARE
p_Interval ALIAS FOR $1;
p_N ALIAS FOR $2;
p_Date ALIAS FOR $3;




BEGIN
if p_Interval = 'm' then
return p_Date + cast(p_N || ' months' as interval);
else
raise exception 'dateadd interval parameter not supported';
-- raise exception 'hello';
return null;
end if;
END;
$BODY$
LANGUAGE 'plpgsql';




-- Function: datediff(varchar, date, date)

-- DROP FUNCTION datediff("varchar", date, date);

CREATE OR REPLACE FUNCTION datediff("varchar", date, date)
RETURNS int4 AS
$BODY$

DECLARE
p_Interval ALIAS FOR $1;
p_DateFrom ALIAS FOR $2;
p_DateTo ALIAS FOR $3;




BEGIN
if p_Interval = 'm' then
return ((date_part('y',p_DateTo) * 12) + date_part('month',p_DateTo))
- ((date_part('y',p_DateFrom) * 12) + date_part('month',p_DateFrom));
else
raise exception 'Datediff: Interval not supported';
return 0;
end if;
END;
$BODY$




-- Function: datename(varchar, date)

-- DROP FUNCTION datename("varchar", date);

CREATE OR REPLACE FUNCTION datename("varchar", date)
RETURNS "varchar" AS
$BODY$

declare
p_DatePart ALIAS FOR $1;
p_Date ALIAS FOR $2;

BEGIN
IF p_DatePart = 'm' THEN
RETURN
CASE DATE_PART('month',p_Date)
WHEN 1 THEN 'January'
WHEN 2 THEN 'Feburary'
WHEN 3 THEN 'March'
WHEN 4 THEN 'April'
WHEN 5 THEN 'May'
WHEN 6 THEN 'June'
WHEN 7 THEN 'July'
WHEN 8 THEN 'August'
WHEN 9 THEN 'September'
WHEN 10 THEN 'October'
WHEN 11 THEN 'November'
WHEN 12 THEN 'December'
END;
ELSE
RAISE EXCEPTION 'Datename: date part not supported';
RETURN NULL;
END IF;

END;
$BODY$
LANGUAGE 'plpgsql' ;

Saturday, September 24, 2005

Examples of how to Calculate Different SQL Server Dates: "First Day of Month

For the first example, let me show you how to get the first day of the month from the current date. Remember now, this example and all the other examples in this article will only be using the DATEADD and DATEDIFF functions to calculate our desired date. Each example will do this by calculating date intervals from the current date, and then adding or subtracting intervals to arrive at the desired calculated date. Here is the code to calculate the first day of the month:

select DATEADD(mm, DATEDIFF(mm,0,getdate()), 0)"

pirates

After the announcement that the newly formed Pilipinas Anti-Piracy will start their crackdown on users of pirated software on September 16, I have been receiving calls and emails asking me the details of the said campaign. Questions like how can they legalize their softwares, what softwares are included, how much does it cost, and if it is possible to extend the deadline.

The Pilipinas Anti-Piracy Team was formed to reduce software piracy in the country. Optical Media Board (OMB) Chairman Edu Manzano reminded companies to stop patronizing pirated software and make sure that all software programs they are using in their business are legal because using pirated software in their offices is against the law and they can be made to pay heavy fines and imprisonment for up to Nine (9) years. The team is composed of the National Bureau of Investigation (NBI), Optical Media Board (OMB), Philippine National Police (PNP), the IP Coalition and the Business Software Alliance (BSA).

To answer the question what softwares are included in the crackdown, I believed all the products of the BSA member companies are part of the campaign. They are Adobe, Apple, Autodesk, Avid, Bentley Systems, Borland, Cadence Design Systems, Cisco Systems, CNC Software/Mastercam, Dell, Entrust, HP, IBM, Intel, Internet Security Systems, Macromedia, McAfee, Microsoft, RSA Security, SolidWorks, Sybase, Symantec, UGS and VERITAS Software. So if you’re using any of these products, better legalize it as soon as possible.

According to the official website of BSA (www.bsa.org), there are Five (5) types of piracy:

End User Piracy occurs when a company employee reproduces copies of software without authorization. This includes using one licensed copy to install a program on multiple computers; Copying disks for installation and distribution; Taking advantage of upgrade offers without having a legal copy of the version to be upgraded; Acquiring academic or other restricted or non-retail software without a license for commercial use; and Swapping disks in or outside the workplace.

Client-Server Overuse occurs when too many employees on a network are using a central copy of a program at the same time. If you have a local-area network and install programs on the server for several people to use, you have to be sure your license entitles you to do so. If you have more users than allowed by the license, that’s overuse.

Internet Piracy is when software is downloaded from the Internet. The same purchasing rules should apply to online software purchase as for those bought in traditional ways. This includes pirate websites that make software available for free download or in exchange for uploaded programs; Internet auction sites that offer counterfeit, out-of-channel, infringing copyright software; and Peer-to-Peer networks that enable unauthorized transfer of copyrighted programs.

Hard-Disk Loading occurs when a business who sells new computers loads illegal copies of software onto the hard disks to make the purchase of the machines more attractive. The same concerns and issues apply to Value Added Resellers (VAR) that sell or install new software onto computers in the workplace.

Software Counterfeiting is the illegal duplication and sale of copyrighted material with the intent of directly imitating the copyrighted product. In the case of packaged software, it is common to find counterfeit copies of the CDs or diskettes incorporating the software programs, as well as related packaging, manuals, license agreements, labels, registration cards and security features.

Types of Licenses:

“Concurrent use licenses” limit the number of simultaneous users. The limit may be set at less than the number of active terminals, and software may require a logging-in process to control the maximum number of users. This type of license is often referred to as a “floating network license” to describe the fact that, though the number of users is fixed, usage may float among the terminals.

“Per Seat License” extends to the dedicated machine, user or use while a “per server” license applies to the network server. The price for a per server license usually will be based on an estimate of users dedicated to a specific server.

“Site License” extends to users at one particular site and often includes a quantity discount, the right for users to make copies and a cap on the licensee’s ability to make unauthorized copies. In order to ensure that the license terms are not overextended, the vendor may elect to impose controls such as: (1) requiring all documentation to be ordered directly from the vendor; (2) attaching an identification number on each copy which in turn may be attached to each user; and (3) requiring regular reports and audits to ensure compliance.

“Enterprise License” is extended to all sites within a particular company. Pricing may be determined by the number of servers, frequency of use or number of concurrent users. A licensee pays the vendor periodically for an enterprise system as opposed to a single payment. Periodic maintenance and support may be built into the license.

“Shrink-wrap License” refers to retail software packages that are covered in plastic or cellophane shrink-wrap. License agreements included with software become effective once the customer tears the wrapping off the package. Shrink-wrap licenses describe packaged software while click-wrap licenses describe Internet licensing transactions. Click-wrap may also apply when you install the program.

Where can you get licensed software:

- At retail locations where the software is traditionally offered in stand-alone packaging;
- From the Internet where software may be downloaded directly from the publisher or third party electronic vendor;
- By purchasing a PC with pre-installed software from an Original Equipment Manufacturer (OEM);
- From an Application Service Provider (ASP) by paying a monthly fee, thus acquiring the right to use the software.

Next week I will give you some tips on how to conduct a software audit and how to achieve an effective software management. For now, the most important thing for you to do is to contact your software vendor and have your softwares licensed.

Sunday, September 18, 2005

Old-school theory is a new force | CNET News.com: "Toward the end of the year, Intel will also come out with a toolkit for constructing Bayesian applications. One experiment deals with cameras that can warn doctors that patients may soon suffer strokes. The company will discuss these developments later this week at its Developer Forum.

Despite its popularity today, Bayesian theory wasn't always universally accepted: Only a decade ago, Bayesian researchers dwelled on the fringes of their professions. Since then, however, improved mathematical models, faster computers and valid results from experiments have given new credibility to the school of thought."

Keyboard clicks can lead to security hacks | CNET News.com: "A new security vulnerability has been discovered: the clickety clack of the keyboard.

An audio recording of an individual's typing can be transposed into a transcript of what was typed, according to University of California at Berkeley researchers. The technique works because each key makes a distinct sound when hit, and users, who typically type about 300 characters a minute, leave enough time between keystrokes for a computer to isolate the individual sounds."

Saturday, September 17, 2005

Slashdot | Statically Charged Man Ignites Office: "Just say salt, don't be so fucking pretentious.

You need to calm down. Here, have a cool glass of Dihydrogen Monoxide."

Monday, September 12, 2005

Slashdot | Computer Science Curriculum in College: "Knowing how to learn these 'new tricks' is what distinguishes an educated person from a trained one"

Sunday, September 11, 2005

Former HP boss Platt dies | The Register: "He's said there's two kinds of companies -- the quick and the dead"

Saturday, September 10, 2005

Slashdot | Bulky System Requirements for Windows Vista: "A: 'wow, that's a sweet rig, where'd you get that?'
B: 'It came with my purchase of Windows Vista.'

It's kinda like those people that drive with huge-ass spoilers on their tiny cars. Did the car come with the spoiler or did the spoiler come with the car? "

windows in usb disk

http://www.tomshardware.com/howto/20050909/index.html



All it takes is a minor error in the Windows Registry or a virus infection, and your operating system can become unbootable. But with a properly configured USB flash drive on hand, you'll always have a compatible replacement no further away than your pocket or keychain. In addition, the flash drive can also provide a secure browser and virus scanner, and lets you take your favorite DVD burning and Office software with you wherever you may go.

All that's needed is a bootable USB Flash drive with at least 256 MB of storage capacity and a Windows Setup CD. Using the program Bart PE Builder (Freeware), you can install Windows XP on the flash drive, along with other software as needed (and as available space permits).

Compact

Bart Lagerweij's free utility, PE Builder, condenses the original setup data for Windows XP into a slender operating system that is ready to run from a CD or a USB flash drive. This compact, portable version of Windows includes all the important system tools for dealing with a PC emergency. You can even add other programs to this collection, such as the media writing tool Nero Burning ROM or an anti-spyware package such as Ad-Aware SE Personal, during the installation process.

Friday, September 09, 2005

XML.com: Errors and AJAX: "A Practical Example: Persisting Client-side Errors to your Server

Now that we have the basics of XMLHttpRequest and JavaScript error handling, let's look at an implementation that ties the two together. You'd think that JavaScript errors would be easy to spot given the prevalent 'Yellow Triangle of Death', but I still see them slip past the QA departments of several blue chip organizations' public-facing web sites.

Figure 1

So, here I will present a method for trapping errors and logging them back to the server in the hope that someone might be alerted to fix it. First, let's consider our client. The client should provide a class to be used as a singleton Logger object that can transparently handle the gritty details.

First we create the constructor:

// singleton class constructor
function Logger() {
// fields
this.req;

// methods
this.errorToXML = errorToXML;
this.log = log;
}

Next, we define the method that will serialize an Error object into XML. By default, an Error object only has two properties, name and message, but we will also check for a third called location which may be useful.

// map an error to an XML document
function errorToXML(err) {
var xml = '\n' +
'\n' +
'' + err.name + '\n' +
'' + err.message + '\n';
if (err.location) xml += '' + err.location +
'
';
xml += '
';
return xml;
}

Next is the log method. This is the meat and potatoes of the script that really brings together the principles described above. Notice that we are using the POST method for our call. What I am essentially creating here is a bespoke web service that is write-only and creates new records on each successful request. Therefore, POST is the only appropriate option.

// log method of Logger class
function log(err) {
// feature sniff
if (window.XMLHttpRequest) this.req = new XMLHttpRequest();
else if "

data ado rds Safety settings on this computer ...: "11/13/2004 10:07:59 AM Safety settings on this computer ...

Here is the error message that RDS gives to me:

Safety settings on this computer prohibit accessing a data source on another domain.

Here is the code:

Set Df = Ds.CreateObject('Perfectjobs.Data', 'Http://localhost')

ErrorOccured = df.Getdata(connstring, usercode, ...)

I think I've configured what is required:

ADCLaunch.

BTW, this works when run from VB and Foxpro.

Any idea will be highly appreciated.

**********************************************************************

Sent via Fuzzy Software @ http://www.fuzzysoftware.com/

Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...



11/13/2004 3:47:43 PM Re: Safety settings on this computer ...

I believe you can control this simply by adjusting a browser setting.

Using IE6, look under 'Tools', 'Internet Options', Security tab, the

appropriate zone, and then Custom Level.In the Miscellaneous section, enable

the 'Access data sources across domains'.

Now try it.

Brian

'Adenigba Smart' wrote in message

news:OBoU2uayEHA.2212@TK2MSFTNGP15.phx.gbl...

another domain.

run from VB and Foxpro. Any idea will be highly appreciated.

ASP.NET resources..."

Slashdot | Comparing MySQL and PostgreSQL 2: "Get over yourself. If a DBA fails to 'recongnize their lack of skills', maybe they're doing just fine with the management tools. If his skills are so lacking he'll screw up his own database eventually.

Creating graphical tools to enable more people to do more things easier is a part of Microsoft's business model. SQL Server Enterprise Manager etc. are just examples of where they've succeeded here.

Personally I'd love to see an open source equivalent of these tools, the offerings I've looked at so far are unfortunately lacking.

And don't give me crap about being a click-and-drool reboot monkey. I'm sick of typing SQL to get things done, when I can grant permissions by picking users from a list and ticking the right boxes.

Did you use telnet to post your slashdot comment? No, you used a graphical browser. Because you don't want to type the http request, and the graphical browser presents the HTML to you in a way that is more natural and effective for you.

Seeing me use Enterprise Manager does not make my co-workers think that they could do my job just as easily. They do not end up thinking any 'fool' can do it."

Thursday, September 08, 2005

Logica bypassing India, heading to Philippines | The Register: "LogicCMG said yesterday that plans to expand its outsourcing business could include setting up an operation in the Philippines, noting that skilled labour there is even cheaper than in India.

The company said it will also build on its facilities in India, Slovakia and the Czech Republic, The Telegraph reports. Outsourcing is Logica's fastest growing business, and accounts for around 25 per cent of the group's revenue.

Announcing the company's preliminary half year results yesterday, chief executive Martin Read said he was thinking of moving application management and software development to the Philippines.

'It's lower cost than India and there are very good people,' he said.

Representatives from the Philippines were in the UK in early August to persuade businesses of the benefits of offshoring IT work to the country. ®"

Reload your E-pass:


E-pass account holders who are BancNet ATM cardholders need not worry about running out of credit. Now, E-Pass users can now reload their transponders through BancNet ATMs nationwide.

The PNCC Skyway Corporation (PSC) and BancNet have signed a Memorandum of Agreement for the inclusion of E-Pass reloading among the bills payment facilities offered by BancNet to its cardholders. United Overseas Bank Philippines, a member of the BancNet Consortium has been chosen as the project's exclusive depository.

nice layout

Product Inquiry Form: "Product Inquiry Form"

Wednesday, September 07, 2005

Steve Jobs on Living and Dying: "what has a front, has a back"

Tuesday, September 06, 2005

Slashdot | American Workers: Lazy or Creative?: "Quote from legendary German Field Marshal Rommel:

Men are basically smart or dumb and lazy or ambitious. The dumb and ambitious ones are dangerous and I get rid of them. The dumb and lazy ones I give mundane duties. The smart ambitious ones I put on my staff. The smart and lazy ones I make my commanders"

Slashdot | Comparing MySQL and PostgreSQL 2:

For an enterprise system,you also need:

1) Views
2) Triggers
3) Integrity Enforcement (i.e. if you try to insert 1000000 into a numeric(4,2) column of your enterprise accounting app you should get an error and not have something inserted).

As your system gets large you may also want:

1) Table partitioning
2) Functional Indexes, i.e. create index on table foo (md5(bar))
3) Partial indexes (i.e. create index on table foo (bar) where open IS TRUE)

MySQL hardly offers all of these capabilities.

PostgreSQL 8.1 will offer all of them in usable forms.

BTW, for those interested, my site has a whitepapers section [metatrontech.com] which has a MySQL to PostgreSQL migration guide.

Slashdot | Comparing MySQL and PostgreSQL 2:

'Compares very well to Oracle? In what metric?'

'Please, Oracle has a ton of features that just aren't there in PostgreSQL'

"What metric" is the right question. But I'm not convinced that the best answer is "comparative length of feature lists". One man's feature is another man's bloat, after all.

I've been writing database apps for a living since 1984. I've worked on trading systems for stockbrokers and multinational merchant banks; I've worked for telecoms giants and for manufacturers. I can't think of a single oracle feature that I've ever needed to use that wasn't available in PostgreSQL.

Admittedly, this has a lot ot do with my style - I'm old school enough that I write my logic in C, C++ or Perl and use the database purely for storing and retrieving data. DBMS vendors (and some database researchers, to be fair) would like coders to do program purely with database packages. I've always though this a supremely boneheaded idea - I trust database designers to design databases, but not progamming langauges thank you. However, if that approach appeals, then you probably need a lot more features than I do.

But they ain't necessary, and it most assuredly is possible to write non-trivial real-world apps using the PostgreSQL feature set.

Sunday, September 04, 2005

PhilMusic News : The Eraserheads take another bite of the Big Apple: "Pare, that’s a done deal. We never lose, instead we get things done."

Google Desktop Features: "Google Desktop includes Sidebar, a panel on your desktop which provides convenient, one-glance access to all sorts of personalized information. Sidebar includes the following plug-ins:"

vmware host guest setup. use host-only

Saturday, September 03, 2005

Dr Stephen Juan - Odd News

Paul Thurrott's SuperSite for Windows: Slipstreaming Windows XP with Service Pack 2 (SP2): "But what, exactly, is slipstreaming, you ask? Back when Microsoft was developing Windows 2000, the company decided to create up a more elegant way of integrating service packs and other fixes back into the core OS, so that enterprise customers could always maintain an install set of the latest version of Windows, ready to be installed at any time on new machines. In the NT days, this process was convoluted at best, and service pack installs often required users to reinstall components that had previously been installed. It just wasn't elegant, but Windows 2000 fixed all that, and in XP the slipstreaming process is largely unchanged."

How to understand the javascript class model? - JavaScript

How to understand the javascript class model? - JavaScript:


In general, when all data members 'public', methods should be added via
the prototype object. This produces only one function object for each
method. With the code above, each new object will create new functions
even though they could be shared.

function Class() {
this.member = null;
this.event = null;
}
Class.prototype.memberFunction = function() {
alert('memberFunction: ' + this.member);
this.callEvent();
alert('after call');
};
Class.prototype.callEvent = function() {
alert('callEvent: ' + this.event);
if('function' == typeof this.event) {this.event();}
};

Creating methods as you did should normally be used when utilising
'private' members:

function MyObject() {
var private = 'value';

this.method = function() {
alert(private);
};
}

var o = new MyObject();

o.method(); // 'value'
o.private; // error

[snip]

>
>

The value of id and name attributes should never be used as global
variables. Many browsers do not support this.

var element;

if(document.getElementById) {
element = document.getElementById('hello');
}
if(element) {
element.onclick = obj.memberFunction;
}

> I try to define a javascript class [...]

There's no such thing. Javascript uses a prototype-based inheritance
model, where your objects use other objects as a basis for their
features and behaviours. Your Class, above, is a constructor function
that when executed, can be used to initialise an object instance and
augment the object that results from the instantiation.

> When I call the function: obj.memberFunction(); the event handler was
> fired and alert a message ('event'). But when I try to use a button
> to fire the event, it doesn't work.

The this operator exists everywhere (unlike in other languages), and as
such, its value is determined by how code is executed.

In 'global' scope



the this operator refers to the global object (usually referred to as
window). Similarly, functions that are called directly have the same value:

var o = {
method : function() {alert(this == window);}
},
f = o.method;

f(); // true; this refers to global object
o.method(); // false; same function object,
// but this now refers to 'o'

Notice that in this latter case, the this operator refers to the object
before the last dot operator: 'o'. A similar thing happens in your case.
When the browser fires the event listener, it does so as though it did

buttonElement.onclick()

In other words, the this operator refers to the BUTTON element.

To solve this, you need to keep a reference to the object that you can
use later. One way is to use the 'private' member form I showed earlier:

function Class() {
var instance = this;

this.member = null;
this.event = null;

this.memberFunction = function() {
alert('memberFunction: ' + instance.member);
instance.callEvent();
alert('after call');
};
}
Class.prototype.callEvent = function() {
alert('callEvent: ' + this.event);
if('function' == typeof this.event) {this.event();}
};

Looking at the implementation of the memberFunction member, you can see
that it's defined in terms of the instance private variable. Even when
the this operator will refer to the BUTTON element, instance will still
refer to the object. When the method calls the callEvent method, it does
so through the object reference, so the this operator will refer to the
object again.

Hope that helps,
Mike

Friday, September 02, 2005

Database: a commodity layer: "To some extent the database is a commoditized layer, and they're asking themselves 'Why are we paying money for a commoditized layer?"

JavaScript Text Highlighting

Slashdot | IBM Reports Indicate Linux TCO Is Lower: "IBM cited one reason behind Windows higher TCO: medical bills incurred from employees banging their head on their desk."

Thursday, September 01, 2005

AJAX: Usable Interactivity with Remote Scripting [JavaScript & DHTML Tutorials]

AJAX: Usable Interactivity with Remote Scripting [JavaScript & DHTML Tutorials]:

Transporting Data using an XMLHttpRequest Object

Once an XMLHttpRequest object has been created, we must call two separate methods in order to get it to retrieve data from a server.

open() initialises the connection we wish to make, and takes two arguments, with several optionals. The first argument is the type of request we want to send; the second argument identifies the location from which we wish to request data. For instance, if we wanted to use a GET request to access feed.xml at the root of our server, we'd initialise the XMLHttpRequest object like this:

requester.open("GET", "/feed.xml");

The URL can be either relative or absolute, but due to cross-domain security concerns, the target must reside on the same domain as the page that requests it.

The open() method also takes an optional third boolean argument that specifies whether the request is made asynchronously (true, the default) or synchronously (false). With a synchronous request, the browser will freeze, disallowing any user interaction, until the object has completed. An asynchronous request occurs in the background, allowing other scripts to run and letting the user continue to access their browser. It's recommended that you use asynchronous requests; otherwise, we run the risk of a user's browser locking up while they wait for a request that went awry. open()'s optional fourth and fifth arguments are a username and password for authentication when accessing a password-protected URL.

Once open() has been used to initialise a connection, the send() method activates the connection and makes the request. send() takes one argument, allowing us to send extra data, such as CGI variables, along with the call. Internet Explorer treats it as optional, but Mozilla will return an error if no value is passed, so it's safest to call it using:

requester.send(null);

To send CGI variables using the GET request method, we have to hardcode the variables into the open() URL:

requester.open("GET", "/query.cgi?name=Bob&email=bob@example.com");
requester.send(null);

To send CGI variables using the POST request method, the CGI variables can be passed to the send() method like so:

requester.open("POST", "/query.cgi");
requester.send("name=Bob&email=bob@example.com");

Once we've called send(), XMLHttpRequest will contact the server and retrieve the data we requested; however, this process takes an indeterminate amount of time. In order to find out when the object has finished retrieving data, we must use an event listener. In the case of an XMLHttpRequest object, we need to listen for changes in its readyState variable. This variable specifies the status of the object's connection, and can be any of the following:

* 0 – Uninitialised
* 1 – Loading
* 2 – Loaded
* 3 – Interactive
* 4 – Completed

Changes in the readyState variable can be monitored using a special onreadystatechange listener, so we'll need to set up a function to handle the event when the readyState is changed:

requester.onreadystatechange = stateHandler;
SITEPOINT BOOKS
"DHTML Utopia: Modern Web Design Using JavaScript & DOM"
Photo of Stuart Langridge
by Stuart Langridge
"As the Web becomes a major - if not the major - application development platform, there’s a greater need to give Websites the flexibility and power that client-side applications can provide."
Create usable, slick, and interactive Websites.
Download button Download the free sample now!

readyState increments from 0 to 4, and the onreadystatechange event is triggered for each increment, but we really only want to know when the connection has completed (4), so our handling function needs to realise this. Upon the connection's completion, we also have to check whether the XMLHttpRequest object successfully retrieved the data, or was given an error code, such as 404: "Page not found". This can be determined from the object's status property, which contains an integer code. "200" denotes a successful completion, but this value can be any of the HTTP codes that servers may return. If the request was not successful, we must specify a course of action for our program:

function stateHandler()
{
if (requester.readyState == 4)
{
if (requester.status == 200)
{
success();
}
else
{
failure();
}
}

return true;
}

Even though the XMLHttpRequest object allows us to call the open() method multiple times, each object can really only be used for one call, as the onreadystatechange event doesn't update again once readyState changes to "4" (in Mozilla). Therefore, we have to create a new XMLHttpRequest object every time we want to make a remote call.
Parsing the Data in an XMLHttpRequest Object

If we've made a successful request, two properties of the XMLHttpRequest object may contain data:

* responseXML stores a DOM-structured object of any XML data that was retrieved by the object. This object is navigable using the standard JavaScript DOM access methods and properties, such as getElementsByTagName(), childNodes[ ] and parentNode.
* responseText stores the data as one complete string. If the content type of the data supplied by the server was text/plain or text/html, then this is the only property that will contain data. A copy of any text/xml data will be flattened and placed here as an alternative to responseXML.

Depending upon the complexity of the data, it may be easier to return data simply as a plain text string, thereby making the XML in XMLHttpRequest redundant. However, for more complex data types, you'll probably want to use an XML format, such as this:



John Smith
john@smith.com


We are able to access different parts of the data using standard DOM access methods. Remember that data contained between tags is considered to represent child text nodes of the parent, so we have to take that extra layer of structure into account when we retrieve the data:

var nameNode = requester.responseXML.getElementsByTagName("name")[0];
var nameTextNode = nameNode.childNodes[0];
var name = nameTextNode.nodeValue;

We must also be careful about whitespace: indenting values in the XML file may produce unwanted whitespace in the value, or add additional text nodes.

Once we've parsed the data from the XMLHttpRequest object, we're free to change, delete and write it onto our Web page as we see fit!
An Example Remote Scripting Application

In order to demonstrate how to use the XMLHttpRequest protocol inside a remote scripting application, I've created a simple, one-page example. It assumes that JavaScript and XMLHttpRequest are available in order to make the code more readable, but in any real-world application, you should always check that XMLHttpRequest is available and have a fallback (i.e. normal form submission) where it is not.

The example application will allow the user to send a free ecard to a friend's email address. To do this, the user has first to enter a receipt number, which they received when they purchased goods previously, and which has since been stored in the database of ExampleCo. Then, the user must complete the remaining fields before the ecard is sent, entering the recipient's email address, the message, and the graphic image that will be used for the card

XML.com: Errors and AJAX:

XMLHttpRequest and XML DOM for JavaScript Basics

First, we need to set up a few ground rules. The XMLHttpRequest object in particular, and XML DOM in general, is widely supported in any recent browser (IE, Mozilla, Safari, Opera) although, as usual, Microsoft has taken a slightly different tack on implementation and requires some special care. While our more progressive friends directly implement XMLHttpRequest, IE requires that you instantiate an ActiveXObject with the same properties. An excellent overview and full feature list is available at the Apple Developer Connection site.

A basic example follows:

var req;
function postXML(xmlDoc) {
if (window.XMLHttpRequest) req = new XMLHttpRequest();
else if (window.ActiveXObject) req = new ActiveXObject("Microsoft.XMLHTTP");
else return; // fall on our sword
req.open(method, serverURI);
req.setRequestHeader('content-type', 'text/xml');
req.onreadystatechange = xmlPosted;
req.send(xmlDoc);
}
function xmlPosted() {
if (req.readyState != 4) return;
if (req.status == 200) {
var result = req.responseXML;
} else {
// fall on our sword
}
}

The potential uses for this powerful tool are vast, and exploration of the possibilities has just begun. But before anyone gets carried away with trying to create an XML circus on the web, I suggest we set up a safety net to keep any high-flyers from breaking their necks.
JavaScript Error Handling Basics

JavaScript has come a long way since its earlier versions, which were crude, lacking in features, and just poorly implemented. Newer browsers not only support the try/catch/finally keywords you will recognize from C++ and Java, they also implement an onerror event that can trap any error conditions that arise during runtime. Usage is pretty straightforward:

function riskyBusiness() {
try {
riskyOperation1();
riskyOperation2();
} catch (e) {
// e is an object of type Error with
// at least two properties: name and message
} finally {
// clean up our mess
}
}
window.onerror = handleError; // safety net to trap all errors
function handleError(message, URI, line) {
// alert the user that this page may not respond properly
return true; // this will stop the default message
}

dave cutler

http://www.aceshardware.com/forums/read_post.jsp?id=115081597&forumid=1

http://en.wikipedia.org/wiki/Dave_Cutler

http://www.amd.com/us-en/Weblets/0,,7832_8366_7823_8718%5E7839,00.html

http://www.absoluteastronomy.com/encyclopedia/d/da/dave_cutler.htm

http://www.absoluteastronomy.com/encyclopedia/w/wi/windows_nt1.htm

hey! this man Dave Cutler is very interesting, basahin nyo yung wikipedia, he's 62 years old now, yet he's still programming OS, sya yung main developer ng Windows NT and 2000, he collaborated with AMD to develop 64 bit processor


Cutler left Digital and joined Microsoft in 1988 and became co-leader of the team that developed Windows NT. Later, he worked on targeting Windows NT to Digital's 64-bit (The 1st letter of the Greek alphabet) Alpha computer (itself based on the Prism design), then on Windows 2000. According to Microsoft's website, Cutler is (as of 12 March 2005) working on the 64-bit version of Microsoft Windows.