Sunday, April 30, 2006

Differences between C# generics and other implementations

C++ templates differ significantly from C# generics. Where C# generics are compiled into IL, causing specialization to occur intelligently at run-time for each value type and once only for reference types, C++ templates are essentially code expansion macros that generate a specialized type for each type parameter supplied to a template. So, when the C++ compiler encounters a template, say a Stack of integers, it will expand the template code into a Stack class that contains integers internally as its native type. Regardless of whether the type parameter is a value or reference type, unless the linker is specifically designed to reduce code bloat, the C++ compiler will create a specialized class each time, resulting in a significant increase in code bloat over C# generics.

Moreover, C++ templates cannot define constraints. C++ templates may only define constraints implicitly by simply using a member that might or might not belong to the type parameter. If the member does exist in the type parameter that is eventually passed to the generic class, the program will work properly. If the member does not exist in the type parameter, the program will fail and a cryptic error message will likely be returned. Because C# generics can declare constraints and are strongly typed, these potential errors do not exist.

Meanwhile, Sun has proposed the addition of generics in the next version of the Java language, codenamed Tiger. Sun has chosen an implementation that does not require modifying the Java Virtual Machine. As such, Sun is faced with implementing generics on an unmodified virtual machine.

The proposed Java implementation uses similar syntax to templates in C++ and generics in C#, including type parameters and constraints. But, because it treats value types differently than reference types, the unmodified Java Virtual Machine will not be able to support generics for value types. As such, generics in Java will gain no execution efficiency. Indeed, the Java compiler will inject automatic downcasts from the specified constraint, if one is declared, or the base Object type, if a constraint is not declared, whenever it needs to return data. Further, the Java compiler will generate a single specialized type at compile-time that it will then use to instantiate any constructed type. Finally, because the Java Virtual Machine will not support generics natively, there will be no way to ascertain the type parameter for an instance of a generic type at run-time and other uses of reflection will be severely limited.

Number of the Beast - Wikipedia, the free encyclopedia: " * In Roman numerals 666 represents all the numbers from 1 to 500 in descending order, namely D (500) + C (100) + L (50) + X (10) + V (5) + I (1), or DCLXVI. Robert Graves suggests in his study of pagan symbolism The White Goddess that this is an abbreviation for the Latin sentence Domitianus Caesar Legatos Xti Violenter Interfecit, or 'The Emperor Domitian violently killed the envoys of Christ'.

* Another reading in Roman numerals regards DCLXVI as an anagram of DIC LVX, which is then supposed to be an abbreviation of dicit lux, 'the light speaks.'"

FeedLounge now running on PostgreSQL : FeedLounge:

Alex, Scott,

I’m one of the Wikipedia techs and also a MySQL support engineer and I and one of our performance people are curious about your situation. If you’re interested in our feedback and/or in satisfying our curiosity, please email or post somewhere this information and we’ll let you know what we see:

SHOW VARIABLES;
SHOW INNODB STATUS\G (ideally twice ten minutes apart under load)
SHOW STATUS; (ideally twice ten minutes apart under load)
SHOW TABLE STATUS;
SHOW CREATE TABLE tablename for all tables
Some of your most common queries and EXPLAIN whatever the query output is for them.

Some description of the order in which records are added - in primary key order or not - would be interesting also, since out of order inserts can halve the fill factor of the InnoDB nodes in the worst case.

Our email addresses are james and peter, both at mysql.com.

In case you’re curious, the Wikimedia MySQL boxes do something between 200 and 400 million queries per day but they are quite powerful - typically dual Opterons with 16GB of RAM and six 15,000 RPM SCSI drives.

FeedLounge now running on PostgreSQL : FeedLounge:

Back in August, we switched the FeedLounge database from MySQL’s MyISAM tables to InnoDB tables. This solved a number of problems that we were having with the MyISAM tables, but also introduced a number of other issues including slower performance on a number of queries (counting in particular). As we did more and more research into how to solve these problems, we decided that one promising solution would be to switch to a PostgreSQL database instead of a MySQL database altogether.

That is what we were testing this weekend, and the alpha server is now running live with a PostgreSQL database instead of the MySQL database. This is still in “testing” mode - if we run into any serious issues we might switch back (temporarily or permanently) to the MySQL database (which will have data current through last Friday evening).

Some of the reasons we decided to make the switch to PostgreSQL:

  • Database size - when we switched from MyISAM tables to InnoDB tables in MySQL, the size of our database grew from ~1GB to 10+GB! When we made the switch this weekend, the MySQL InnoDB database was using 34 GB, and the same data in a PostgreSQL database is only 9.6 GB - this should keep our hardware costs down a bit.
  • Load time - The current MySQL setup takes over a day to restore the current database, the load of the data into the PostgreSQL database took just over 4 hours.

Thursday, April 27, 2006

The Blog Ride:

Need Ruby? Nah--get Monad instead

I happened across this blog entry while doing some research on Monad, Microsoft's new command shell (meaning, think "bash" or "csh", not "Explorer"), and found it so similar in many ways to what guys in the Ruby space have been hyping for a year or two now, that I just had to pass it on. Reproducing directly from the site:

One of the scripts I like the most in my toolbox is the one that gives me answers to questions from the command line.

For the past 2 years or so, Encarta has offered an extremely useful Instant Answers feature. Its since been integrated into MSN Search, as well as a wildly popular Chat Bot. MoW showed how to use that feature through a Monad IM interface (via the Conversagent bot,) but we can do a great job with good ol screen scraping.

[C:\temp]
MSH:70 > get-answer "What is the population of China?"

Answer: China: Population, total: 1,313,973,700
2006 estimate
United States Census International Programs Center


Answer: China : Population:
More than 20 percent of the worldâ?Ts population lives in China. Of the co
untryâ?Ts inhabitants, 92 percent are ethnic Han Chinese. The Han are desc
endants...

[C:\temp]
MSH:71 > get-answer "5^(e^(x^2))=50"

Answer: 5^(e ^( x^2))=50 = x=0.942428 x=-0.942428

[C:\temp]
MSH:72 > get-answer "define: canadian bacon"

Definition: Canadian bacon lean bacon

[C:\temp]
MSH:73 > get-answer "How many calories in an Apple?"

Answer: Apples: calories:
1.0 cup, quartered or chopped has 65 calories 1.0 NLEA serving has 80 calo
ries 1.0 small (2-1/2" dia) (approx 4 per lb) has 55 calories 1.0 medium (
2-3/4" dia) (approx 3 per lb) has 72 calories 1.0 large (3-1/4" dia) (appr
ox 2 per lb) has 110 calories 1.0 cup slices has 57 calories
USDA

[C:\temp]
MSH:74 > get-answer "How many inches in a light year?"

Answer: 1 lightyear = 372,461,748,226,857,000 inches
Here is the script, should you require your own command-line oracle:
## Get-Answer.msh
## Use Encarta's Instant Answers to answer your question.

param([string] $question = $(throw "Please ask a question."))

function Main
{
# Load the System.Web.HttpUtility DLL, to let us URLEncode
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Web")

## Get the web page into a single string
$encoded = [System.Web.HttpUtility]::UrlEncode($question)
$text = get-webpage "http://search.msn.com/encarta/results.aspx?q=$encoded"

## Get the answer with annotations
$startIndex = $text.IndexOf('
')
$endIndex = $text.IndexOf('

Results

')

## If we found a result, then filter the result
if(($startIndex -ge 0) -and ($endIndex -ge 0))
{
$partialText = $text.Substring($startIndex, $endIndex - $startIndex)

## Very fragile, voodoo screen scraping here
$regex = "<\s*a\s*[^>]*?href\s*=\s*[`"']*[^`"'>]+[^>]*>.*?"
$partialText = [Regex]::Replace("$partialText", $regex, "")
$partialText = $partialText -replace "", "`n"
$partialText = $partialText -replace "", "`n"
$partialText = clean-html $partialText
$partialText = $partialText -replace "`n`n", "`n"

""
$partialText.TrimEnd()
}
else
{
""
"No answer found."
}
}

## Get a web page
function Get-WebPage ($url=$(throw "need to specify the URL to fetch"))
{
# canonicalize the url
if ($url -notmatch "^[a-z]+://") { $url = "http://$url" }

$wc = new-object System.Net.WebClient
$wc.Headers.Add("user-agent", $userAgent)
$wc.DownloadString($url)
}

## Clean HTML from a text chunk
function Clean-Html ($htmlInput)
{
[Regex]::Replace($htmlInput, "<[^>]*>", "")
}

. Main
That's nifty stuff, if you ask me. And, what's best, this is a loosely-typed, dynamic language every bit as interesting and powerful as Ruby, though admittedly without some of the metaprogramming capabilities that Ruby has. But notice how we're making use of the vast power underneath the .NET framework to lay out a pretty straightforward use of the code, in a way that's entirely dynamic and loosely-typed, including the assumed return value from the if/else block, and so on. It's going to be a whole new world for automating projects (among other things) once Monad ships, and the saavy .NET developer (and even the saavy Java developer who builds on Windows) will already be looking at Monad for ways to streamline the things they need to do on Windows.

Added to my list of developer interview questions: "What is Monad, and why do I care?"

Wednesday, April 26, 2006

The Old Joel on Software Forum: Part 4 (of 5) - Java—what's the point?: "Visual Basic programmers had long got an inferiority complex. They somehow felt that they were kind of ape like. This is because Microsoft did not trust them with complex system stuff. Java meant that some of those apes could actually say 'we evolved'. This is because they can type great stuff like

import blah blah blah and also type semicolons (';')

Never underestimate the power of making men feel like men. Thats the need java fulfills.

K
Friday, April 02, 2004"

Tuesday, April 25, 2006

Is Bill Gates mentally retarded?: "When a person becomes rich and famous we tend to overlook his neurotic qualities. When those neurotic qualities are too severe to ignore, we describe the person as “eccentric.” But when an ordinary citizen behaves in the same manner, he is described as a freak, or as a retard, or as mentally ill."

Linux: Using goto In Kernel Code:

From: Linus Torvalds
Subject: Re: any chance of 2.6.0-test*?
Date: Sun, 12 Jan 2003 12:33:37 -0800 (PST)

On 12 Jan 2003, Robert Love wrote:
> On Sun, 2003-01-12 at 15:22, Linus Torvalds wrote:
>
> > No, you've been brainwashed by CS people who thought that Niklaus
> > Wirth actually knew what he was talking about. He didn't. He
> > doesn't have a frigging clue.
>
> I thought Edsger Dijkstra coined the "gotos are evil" bit in his
> structured programming push?

Yeah, he did, but he's dead, and we shouldn't talk ill of the dead. So
these days I can only rant about Niklaus Wirth, who took the "structured
programming" thing and enforced it in his languages (Pascal and Modula-2),
and thus forced his evil on untold generations of poor CS students who had
to learn langauges that weren't actually useful for real work.

(Yeah, yeah, most _practical_ versions of Pascal ended up having all the
stuff necessary to break structure, but as you may be able to tell, I was
one of the unwashed masses who had to write in "standard Pascal" in my
youth. I'm scarred for life).

Linus

The Blogtoonist: "Anxiety is an unwanted expenditure. A compounded, superfluous investment of emotion that is unproductive. How do you strengthen your soul against the ravages of reason? and of unreason? Which is more pervasive? And what will triumph in the end? Ahhhh...to be human. And found to be wanting..."

Saturday, April 22, 2006

Plug-ins in C# - The Code Project - C# Programming: "Introduction:

First things first: I wrote this article mainly because I’ve found a complete lack of comprehensive information on the subject. Sure there are projects out there that show you how to make a simple plug-in that lets you do something dumb like feed it two numbers, and then one plug-in may add the two numbers together and return the result, while the other plug-in may multiply them instead. This is where I began, and is not bad reading as a prep tutorial to this tutorial. It might not be a bad idea to understand those tutorials first. However, when I began to search for how to bring GUIs into the plug-ins, I was completely lost. My aim is to show you how to do this, and provide some clear explanations. This tutorial will not be a step by step guide to making the program, as if you have the tutorial, you should also have the source code for the Tutorial project. I feel it unnecessary to go through this all, so instead I will only be covering some explanations on the code that is tricky."

Tuesday, April 18, 2006

DBMS - May 1996 - Indexing and Access Mechanisms:

Here's a performance tip that's easy to use: When creating a multicolumn index, put the most selective column first (that is, the one with the most distinct values). If your company has 500 customers and five products, the create index example shown previously would be appropriate. However, if your company has five customers and 500 products, it would be better to create the index with the following command:

CREATE INDEX sales_1996_idx
ON sales_1996 (product, customer);

Because product is 100 times more selective than customer in this example, index lookups will tend to find the desired rows with fewer disk reads, thereby resulting in better performance. On top of that, you will usually be able to perform partial index lookups on product alone, with a speed close to what you would get by building a separate index on product. Furthermore, partial index lookups on customer alone aren't necessary in this case because of the low selectivity, so you don't lose anything by putting customer last. If you put customer first, you lose the ability to perform partial index lookups on product alone.

Index Storage

The most common physical storage structure for SQL indexes is the B-tree. (Note: This article will use the general term B-tree to represent all of the related variations including B+-tree and B*-tree). Almost every SQL DBMS on the market supports B-tree indexes. Plus, some DBMSs support additional physical index structures such as hashing and Index Sequential Access Method (ISAM). B-tree indexes are popular because of their adaptability (the tree structure balances itself dynamically as a table grows, which maintains an efficient index structure by minimizing the number of disk reads to find a given value in the index).

An index is usually thought of as a distinct data structure on disk, separate from the table it is indexing. Although this is generally true, some DBMSs allow you to combine the index and the table data to improve performance. For example, SQL Server has a clustered parameter on the create index command that stores the actual data at the leaf level of the index tree. Because the table is so tightly integrated with the index, only one clustered index per table is possible. Similarly, CA-OpenIngres has a modify table command that restructures a table in the form of an index.

Monday, April 17, 2006

mssql to postgresql

natapos ko na i-convert ngayon yung mga stored procs,views, triggers sa postgresql from mssql. so far soo good, database administration ng postgresql naman sunod na aaralin.

yung front-end code walang nabago, decoupled naman yung data layer ng front-end sa actual database. wala pinapasang tablename sa middletier parameter, in fact pwede baguhin yung mga name ng tables and hindi maapektuhan yung front-end. in short, walang knowledge yung front-end sa actual implementation ng data retrieving and data storing, and it doesn't have to.

Sunday, April 16, 2006

Sony Online opts for open-source database over Oracle - Computerworld:

MARCH 20, 2006 (COMPUTERWORLD) - Sony Online Entertainment Inc. is starting to move away from the Oracle databases that are the foundation of its online games, opting instead for a 2-year-old commercial open-source database based on PostgreSQL.

San Diego-based Sony Online offers a number of popular Massively Multiplayer Online Role-Playing Games, or MMORPGs, including EverQuest, EverQuest 2, Star Wars Galaxies and others.

They have "hundreds of thousands" of subscribers, said Rick Herman, vice president of business and legal affairs at Sony Online Entertainment.

The databases store terabytes of data about the "worlds" in which game characters live, battle and fall in love.

"If you took a virtual character in EverQuest and had him start running in one direction, it would take 30 days before he would reach the end of the world," Herman said.

The games also store data on players’ characters. In Star Wars Galaxies, for instance, every object -- be it lightsaber, X-Wing fighter or blaster gun -- can be heavily customized by its owner. That means the database must store each object in the game individually, rather than storing one version that it provides to every player.

Sony Online now operates more than 150 Oracle 9i databases around the world.

But by midyear, Sony Online expects to have three services moved to EnterpriseDB’s Advanced Server 8.1 database, according to Chris Yates, the company’s vice president of technology.

One will be Sony’s Station Exchange service, which creates an eBay-like marketplace for players of EverQuest and EverQuest 2 to buy and sell online goods such as swords, potions and spells.

The service, which debuted last year, is still small; there were fewer than 1,000 items up for auction at the end of last week, according to Sony. Even so, buyers pay as much as $2,000 for digital items.

Sony also plans to move one of its smaller games, Matrix Online, which it bought last summer, to EnterpriseDB. It also plans to move a message board over to EnterpriseDB.

Yates had been looking for an alternative to Oracle for a year. "We think it’s a great product, but it’s so expensive," he said. "We use a lot of Oracle’s advanced features: clusters, materialized views, high transactions. We knew that our alternative needed to be a real database."



....

"Oracle’s free Express edition was 'not a lot of use,' said Yates, who also looked at open-source databases such as MySQL and PostgreSQL. He liked the latter’s 'richness' and its lower price tag. But Yates balked at the costs and hassle of retraining his staff and rewriting the database applications to run on PostgreSQL.

EnterpriseDB, on the other hand, is based on PostgreSQL but offers Oracle compatibility. That helped Yates overcome his concerns.

'Close to 80% to 90% of our applications don’t need to be rewritten to use with EnterpriseDB,' said David Manifold, director of database services at Sony Online.

Because of the similarity of EnterpriseDB, training has been minimal so far: three days of classes for the Oracle database administrators and developers. 'Most of them have found it to be fairly intuitive,' Yates said.

Savings are 'hard to quantify at this point in time,' he noted. 'We need to prove it out in production first.' Although Sony Online will continue to use Oracle, it will slowly migrate other databases onto EnterpriseDB.

Oracle officials declined to comment about Sony's decision.

Although open-source still gives IT executives 'heartburn,' it has evolved a lot in recent years, Herman said. 'If you'd told me five years ago we'd be looking at open source I'd have said you were insane,' he said.

In a related move, Sony also became a minority shareholder in EnterpriseDB, which was founded in 2004. Sony joined in a $7.5 million round of financing, along with venture capital firms Charles River Ventures and Valhalla Partners and some of EnterpriseDB’s original angel investors."

Booleans in SQL Server:


I want to query a SQL Server database with my VB6 program, using an SQL statement. I want to make a selection on a boolean (WHERE myBoolean = TRUE), but this statement always gives me a syntax error. I guess I need to add some kind of brackets or something in order to show SQL it's a boolean value, like ' ' for strings, { } for dates, ... Can you help me out? Been looking all over the Web for an answer.


Does your database already exist? What is the datatype of the myBoolean column? The reason I ask is because SQL Server does not support a boolean datatype. The closest it comes is the BIT datatype, although most people use TINYINT, SMALLINT, or INTEGER instead, because these integer datatypes offer more flexibility when constructing queries.

Consider the following SQL, which creates and populates a table with a BIT column:

create table test_bit
( id tinyint not null identity
, yesno bit not null )


insert into test_bit (yesno) values (1)
insert into test_bit (yesno) values (1)
insert into test_bit (yesno) values (0)
insert into test_bit (yesno) values (1)
insert into test_bit (yesno) values (0)


select * from test_bit


id yesno
---- -----
1 1
2 1
3 0
4 1
5 0

So far, so good, right? Okay, now try a query:

select sum(yesno)
from test_bit


Server: Msg 409, Level 16, State 2, Line 1

The sum or average aggregate operation
cannot take a bit data type as an argument.

Well, that sort of makes sense, if you accept that BIT is not actually a numeric datatype, even though you must specify values for it using 1 and 0.

Try another query:

select yesno, count(*)
from test_bit
group
by yesno


Server: Msg 252, Level 16, State 2, Line 1
Cannot group by a bit column.

That makes no sense to me. That is, I understand what the error means, but not why SQL Server won't let you do it.

You can get around these limitations by using CAST(yesno as INTEGER) instead. But then why not define the column using INTEGER to begin with? The only time BIT might make sense is if you were storing a yes/no attribute in a tremendously large table and were concerned about total table size.

PostgreSQL: Documentation: Manuals: PostgreSQL 7.4: Character Types: "The notations varchar(n) and char(n) are aliases for character varying(n) and character(n), respectively. character without length specifier is equivalent to character(1); if character varying is used without length specifier, the type accepts strings of any size. The latter is a PostgreSQL extension."

postgresql

create table rank(
a varchar(100),
i int4
);

alter table rank
add constraint pk_rank primary key(a)
;

create index ix_rank on rank(i);

insert into rank(a,i)
select 'John',1
union
select 'paul',2
union
select 'george',3
union
select 'ringo',4
union
select 'brian',5;



create table listword(
i int4,
worded varchar(20)
);

alter table listword
add constraint pk_listword primary key(i)
;

create index ix_listword on listword(UPPER(worded)); -- functional index there is no equivalent in MS SQL


select * from listword where UPPER(worded) = 'ONE';



insert into listword(i, worded)
select 1, 'one'
union
select 2, 'two'
union
select 3, 'three'
union
select 4, 'four'
union
select 5, 'five';





create or replace function ListRank_FuncOne(z int, out xx varchar(200), out yy int4)
as $$

SELECT * from rank WHERE i = $1
$$
language 'sql';





create or replace function ListRank_FuncMore(z int) returns setof rank
as $$
select * from rank where i > $1; -- z
$$ language 'sql';



create or replace function ListRank_SpMore(z int) returns setof rank
as $$
declare r record;
begin
for r in select * from rank where i > z
loop
return next r;
end loop;
end;
$$ language 'plpgsql';


-- scalar-valued function in mssql server parlance
CREATE OR REPLACE FUNCTION WordEquiv(m_z INT)
RETURNS VARCHAR
AS
$$
DECLARE m_S VARCHAR;
BEGIN
/* method 1:
SELECT worded INTO m_S
FROM ListWord
WHERE i = m_Z;
RETURN m_S;*/

-- method 2
RETURN (SELECT worded FROM ListWord WHERE i = m_Z);
END;
$$ LANGUAGE 'PLPGSQL';



SELECT WordEquiv(1);


-- inline table-valued function in mssql server parlance, but returns only one row
create or replace function ListRankWithWord_FuncOne(z int, out xx varchar(200), out yy int4, out wordrank varchar(200), out beatles varchar(200))
as $$

SELECT
rank.a, rank.i,
listword.worded as blahblahblah,
rank.a || listword.worded || rank.a
from rank
inner join listword using(i)
WHERE i = $1
$$
language 'sql';






CREATE TYPE RankWithWord
AS
(
A VARCHAR(200),
I INT4,
Word VARCHAR(400),
HeyHey vARCHAR(200)
);





-- inline table-valued function in mssql server parlance, albeit more difficult in posgtresql(we have to set up a type)
-- seems the recommended approach is to name the type almost similar to the name of the function
create or replace function ListRankWithWord_FuncMore(z int) returns setof rankwithword
as $$
SELECT
rank.a, rank.i,
listword.worded as blahblahblah,
rank.a || listword.worded || rank.a
from rank
inner join listword using(i)
where i > $1; -- z

$$ language 'sql';



-- multi-statement table-valued function in mssql server parlance, albeit more difficult in postgresql(we have to set up a type)
create or replace function ListRankWithWord_SpMore(z int) returns setof rankwithword
as $$
declare r rankwithword;
begin
for r

IN

SELECT
rank.a, rank.i,
listword.worded as wordrank ,
rank.a || rank.a || listword.worded as whatThe
from rank
inner join listword using(i)
where i > z

loop
return next r;
end loop;

r.a = 'michaelbuen';
r.i = 0;
r.word = 'solved';
r.heyhey = 'yeah';
return next r;
end;
$$ language 'plpgsql';





select * from ListRank_FuncOne(2);

select * from ListRank_FuncMore(2);

select * from ListRank_SpMore(2);

select * from ListRankWithWord_FuncOne(2);

select * from ListRankWithWord_FuncMore(2);

select * from ListRankWithWord_SpMore(2);




create local temp table tmp_word as select * from listword;

select * from tmp_word

PostgreSQL: Documentation: Manuals: PostgreSQL 7.3: Pattern Matching: "6.6.2. SIMILAR TO and SQL99 Regular Expressions

string SIMILAR TO pattern [ESCAPE escape-character]
string NOT SIMILAR TO pattern [ESCAPE escape-character]

The SIMILAR TO operator returns true or false depending on whether its pattern matches the given string. It is much like LIKE, except that it interprets the pattern using SQL99's definition of a regular expression. SQL99's regular expressions are a curious cross between LIKE notation and common regular expression notation.

Like LIKE, the SIMILAR TO operator succeeds only if its pattern matches the entire string; this is unlike common regular expression practice, wherein the pattern may match any part of the string. Also like LIKE, SIMILAR TO uses % and _ as wildcard characters denoting any string and any single character, respectively (these are comparable to .* and . in POSIX regular expressions).

In addition to these facilities borrowed from LIKE, SIMILAR TO supports these pattern-matching metacharacters borrowed from POSIX regular expressions:

*

| denotes alternation (either of two alternatives).
*

* denotes repetition of the previous item zero or more times.
*

+ denotes repetition of the previous item one or more times.
*

"

Saturday, April 15, 2006

PostgreSQL: Documentation: Manuals: PostgreSQL 7.3: Pattern Matching:

6.6.2. SIMILAR TO and SQL99 Regular Expressions

string SIMILAR TO pattern [ESCAPE escape-character]
string NOT SIMILAR TO pattern [ESCAPE escape-character]

The SIMILAR TO operator returns true or false depending on whether its pattern matches the given string. It is much like LIKE, except that it interprets the pattern using SQL99's definition of a regular expression. SQL99's regular expressions are a curious cross between LIKE notation and common regular expression notation.

Like LIKE, the SIMILAR TO operator succeeds only if its pattern matches the entire string; this is unlike common regular expression practice, wherein the pattern may match any part of the string. Also like LIKE, SIMILAR TO uses % and _ as wildcard characters denoting any string and any single character, respectively (these are comparable to .* and . in POSIX regular expressions).

In addition to these facilities borrowed from LIKE, SIMILAR TO supports these pattern-matching metacharacters borrowed from POSIX regular expressions:

  • | denotes alternation (either of two alternatives).

  • * denotes repetition of the previous item zero or more times.

  • + denotes repetition of the previous item one or more times.

  • Parentheses () may be used to group items into a single logical item.

  • A bracket expression [...] specifies a character class, just as in POSIX regular expressions.

Notice that bounded repetition (? and {...}) are not provided, though they exist in POSIX. Also, dot (.) is not a metacharacter.

As with LIKE, a backslash disables the special meaning of any of these metacharacters; or a different escape character can be specified with ESCAPE.

Some examples:

'abc' SIMILAR TO 'abc'      true
'abc' SIMILAR TO 'a' false
'abc' SIMILAR TO '%(b|d)%' true
'abc' SIMILAR TO '(b|c)%' false

The SUBSTRING function with three parameters, SUBSTRING(string FROM pattern FOR escape), provides extraction of a substring that matches a SQL99 regular expression pattern. As with SIMILAR TO, the specified pattern must match to the entire data string, else the function fails and returns null. To indicate the part of the pattern that should be returned on success, SQL99 specifies that the pattern must contain two occurrences of the escape character followed by double quote ("). The text matching the portion of the pattern between these markers is returned.

Some examples:

SUBSTRING('foobar' FROM '%#"o_b#"%' FOR '#')   oob
SUBSTRING('foobar' FROM '#"o_b#"%' FOR '#') NULL

Using regular expressions and SELECT (instead of LIKE) with PostgreSQL:

Category: "postgresql"
Topic:

Using regular expressions and SELECT with PostgreSQL

Some time ago I found this list of how Postgres supports regular expression searching, and case-insensitive searching in particular, and then I couldn't find it. If you're familiar with Unix and Perl regular expressions, these are very similar, so it's an easy pickup and very powerful. Just use these regular expressions with SELECT in your PostgreSQL queries instead of the LIKE operator, and you're ready to go. So before I lose my printout again, I thought I better include it's contents here.

Here's a the table of regular expression operators, re-typed from a URL I can't find anymore:

Comparison Operator
regular expression ~
regular expression, case-insensitive ~*
not equal to regular expression !~
not equal to regular expression, case-insensitive !~*

There is also a table of regular expression special characters, but I don't have the time to re-type those just now.

webservices.xml.com: Second Generation Web Services: "There's an old real estate joke that the only three things which make a property valuable are location, location, and location. The same is true in the world of XML web services. Properly implemented, XML web services allow you assign addresses to data objects so that they may be located for sharing or modification."

Slashdot | Summer of Code 2006 is On:

Re:Dear Students,

(Score:5, Insightful)
by someone300 (891284) on Friday April 14, @04:48PM (#15132571)
Summer of code:
- Working on something you enjoy
- Possibility of getting 4500 USD personally and 500 USD for your favourite OSS project
- Doing something that will benefit at least one person somewhere else in the world, if not many thousands.
- Practice for future job probably
- Something reasonably unique to put on CV

McDonalds
- Boring, hot, horrid job
- Shit money
- Further perpetuating the problem of obesity and heart problems by providing overweight middle aged men and women and their kids, for whom they can't be bothered to cook a nutritious meal, with their daily dose of fatty dead animal
- Time spent doing repetitive tasks that require no skill or thought
- Just another generic teenage job to put on your CV, if mentioned at all

List of my computers

June 1995: Cx486 DX2-66 MHz . broken as of June 2000.

Specs: 4 MB Memory, 100 MB(courtesy of Onel) hard disk.

OS: DOS 6.22, Windows 95

Product Developed: nagamit ko pa sa thesis :) done on Assembly Language, TASM 4.1. May 2000

---

Sep 2000: P4 1.5 GHz. still functioning

Specs: 128 MB RDRAM, 40 GB Hard Disk. Gigabyte Motherboard

Product Developed: REIM (Real Estate Installment Manager). Feb 2003

OS: Windows 98, Windows XP, Windows 2000 Advanced Server

---

Feb 2003: AthlonXP 2000+

Specs: 512 MB DDR. 20 GB Hard Disk. ECS Desknote iBuddyXP.

(will never buy a desknote again). not quite a laptop. processor and memory comes from desktop component. overheats so much.

Product Developed: Order Processing System of CEBO. June 2005

OS: Windows XP, Ubuntu

---

July 2005: Pentium M 1.6 GHz 768 MB. Neo TabletPC. not quite a tablet pc, pen needs to be in contact with the surface, any pen will do, even the fingertip.

Product Developed: Photo Archiving of FarEast Footwear. Dec 2005

OS: Windows XP Tablet Edition
OS: Mac OS X 10.4.1

---

Nov 2005: AMD64 3000+

Specs: 512 MB Memory. 20 GB hard disk. MSI-RS480 Motherboard

OS:

Windows XP

Ubuntu Linux, ATI IDE chipset not good on Linux kernel, hard disk speed is very sluggish.

Mac OS X 10.4.3 hard disk very sluggish too

Product Developed: being used by my brother

Sikap Pinoy! Helping Filipinos Towards Financial Liberty and Prosperity: Know Your Electricity Consumption: The Meralco Appliance Calculator:


Thursday, February 23, 2006

Know Your Electricity Consumption: The Meralco Appliance Calculator

The cost of electricity keeps on rising. In our household, our consumption reached more than Php 9,000 per month. Our major electricity guzzler are 2 aircons, 3 televisions and 2 big refridgerator.

There's actually a way to predict or estimate how much a particular appliance will consume electricity. This handy tool is called the Meralco Appliance Calculator. Aside from estimitating the electricity cost of each appliance, this tool will also help you compare the consumption cost when buying new appliances.

Here are some interesting facts:

  • The biggest electricity consumer is our aircon. A 1 HP aircon would consume Php 1,241 a month when used 6 hours a day. Try using it only for 4 hours and your bill drops to Php 827 a month
  • Refridgerators are not expensive to maintain. A 10 cu. ft fridge consume only Php 580 a month. And it's on 24 hours a day!
  • A 21" TV only accounts for Php 88 a month if used for only 3 hours a day.
  • One 20w flourescent lamp, turned on for 4 hours a day cost only Php 34 a month

Hmm, I wonder how come our electricity is Php 9,000 when the above rates are not that expensive????

Bayan Muna:

Ayon sa aking Meralco bill, umabot sa 387 kilowatt-hours (kWh) ang kabuuuang kuryenteng nakonsumo ng aking pamilya noong nakaraang Marso. Nagkakahalaga po ito ng P2,537. Katumbas po nito ay mahigit P80 bawat araw.

Anu-ano po ang bumubuo ng P2,537 na dapat kong bayaran sa Meralco? Himay-himayin po natin:

1. Basic charge: P1,315.80
(387 kilowatt-hours multiplied by P3.40 per kilowatt-hour)

2. Currency adjustment: P80.90
(387 kilowatt-hours multiplied by 21 centavos per kilowatt-hour)

3. Purchased Power Adjustment o PPA: P1,255.80
(387 kilowatt-hours multiplied by P3.22 per kilowatt-hour)

4. Power act reduction: minus P116.10
(387 kilowatt-hours multiplied by 30 centavos per kilowatt-hour)

5. Total amount due: P2,537
(Basic charge + PPA + Currency adjustment - Power reform reduction)

Kung susuriin, hati sa dalawang bahagi ang aking electric bill. Kalahati po ay napupunta sa basic charge na nagkakahalaga ng P1,315. Ang kabilang kalahati po naman ay sa tinatawag na "automatic adjustments" na binubuo ng konrobersyal na PPA na P1,255 at currency adjustment na P80.

OSX on my AMD64 3000+ on Flickr - Photo Sharing!:

OSX on my AMD64 3000+

BibleGateway.com - Passage Lookup: John 1:1-18: "John 1:1-18 (New International Version)
New International Version (NIV)

Copyright © 1973, 1978, 1984 by International Bible Society
NIV at IBS International Bible Society NIV at Zondervan Zondervan

John 1
The Word Became Flesh
1In the beginning was the Word, and the Word was with God, and the Word was God. 2He was with God in the beginning.

3Through him all things were made; without him nothing was made that has been made. 4In him was life, and that life was the light of men. 5The light shines in the darkness, but the darkness has not understood[a] it.

6There came a man who was sent from God; his name was John. 7He came as a witness to testify concerning that light, so that through him all men might believe. 8He himself was not the light; he came only as a witness to the light. 9The true light that gives light to every man was coming into the world.[b]

10He was in the world, and though the world was made through him, the world did not recognize him. 11He came to that which was his own, but his own did not receive him. 12Yet to all who received him, to those who believed in his name, he gave the right to become children of God— 13children born not of natural descent,[c] nor of human decision or a husband's will, but born of God."

Jesus of Nazareth - Crystalinks: "Before then, Jesus' birth was generally celebrated on January 6 as part of the feast of Theophany, also known as Epiphany, which commemorated not only Jesus' birth but also his baptism by John in the Jordan River and possibly additional events in Jesus' life."

Comparison of Hindu and Christian Concepts of Self: "Jesus' subsequent ministry and teaching was not that of a Hindu guru or Buddhist sage. He preached resurrection, not reincarnation. He instructed his disciples to relate to a personal God, not an impersonal principle. He declared and demonstrated himself uniquely to be God in the flesh, not one of many God-realized masters.[2]"

John 1:1 In the beginning was the Word, and the Word was: "In the beginning was the Word, and the Word was with God, and the Word was God. (WEB)

In the beginning was the Word, and the Word was with God, and the Word was God. (ASV)

From the first he was the Word, and the Word was in relation with God and was God. (BBE)

In the beginning was the Word, and the Word was with God, and the Word was God. (DBY)

In the beginning was the Word, and the Word was with God, and the Word was God. (KJV)

In the beginning was the Word, and the Word was with God, and the Word was God. (WBS)

In the beginning was the Word, and the Word was with God, and the Word was God. (WEY)

In the beginning was the Word, and the Word was with God, and the Word was God; (YLT)"

Slashdot | Microsoft to sue Mike Rowe for Copyrights:

Re:*Trademark* not Copyright

(Score:5, Informative)
by ScottSpeaks! (707844) on Monday January 19, @10:29AM (#8020467)
(http://godsexboyfriend.com/ | Last Journal: Saturday January 03, @09:42AM)
The difference between trademark and copyright (and let's not forget patents) is a topic covered in the first week of Intellectual Property 101, and anyone with a stake in IP (like users or developers of open-source software) needs to understand which is which. Saying "copyright" when you're talking about a "trademark" is like typing "rm" when you mean "ls": it's your own fault if the shell misunderstands you.

Copyright - literally "the right to copy" - Covers a particular creative expression of an idea, such as a song, a movie, a poem, or a C++ program. Currently lasts longer than any of us will live.

Trademark - literally "a mark used in trade" - Covers names, slogans, logos, and such when used in the packaging and marketing of a product or service. Lasts as long and only as long as it's in active use.

Patent - literally "openly disclosed" - Gives temporary exclusive rights to a invention [insert debate over definition of "invention" here] in exchange for publishing the details of how it works. Currently lasts longer than the technology is likely to be useful.

(The so-called fourth kind of IP is a trade secret, which is the opposite of a patent: instead of publishing a how-to, the inventor keeps it private, so they can try to keep exclusivity indefinitely.)

Friday, April 14, 2006

Investors practice tough love with AMD | The Register: "It's much easier to fall in love with a glorious future than a shining past."

Errors:

* Lost Connection Error 2013

* MySQL Server has gone away

* di tumutuloy yung backup sa MySQL Admin

nawala lahat yung mga error na to nung tinanggal ko yung Rising Antivirus dun sa win2k server nung client ko

seems yung firewall nung Rising Antivirus is nakaka-interfere sa ports or timeout nung win2k server, hope yun nga yung error, otherwise i-u-upgrade ko sa 5.0.19 yung MySQL. currently 5.0.18 yung version

Thursday, April 13, 2006

How To Connect PostgreSQL thru VB without DSN:

Re: How To Connect PostgreSQL thru VB without DSN
This is a multi-part message in MIME format.

------_=_NextPart_001_01C64C37.539CFDE6
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

For the driver name in the connect string, try {PostgreSQL ANSI} or
{PostgreSQL Unicode}, instead of just {PostgreSQL}. I noticed that the
Windows ODBC administrator inserted this for the driver name.
Unfortunately, the new driver name was not documented in any of the
PostgreSQL documentation I found on ODBC, so it took me hours to debug
this problem.

Regards,
Jamal

-- Function: testfunc2(m_minqty int8)

-- DROP FUNCTION testfunc2(m_minqty int8);

CREATE OR REPLACE FUNCTION testfunc2(m_minqty int8)
RETURNS SETOF record AS
$BODY$



SELECT Item.ItemCode, Item.Qty,
(item.itemcode || item.itemcode)::varchar as yy,
0::int4 as prod ,
COALESCE(SUM(TranItem.Qty),0)::int8 AS SumQty
FROM Item
LEFT JOIN TranItem
ON TranItem.ItemCode = Item.ItemCode
GROUP BY Item.itemcode, Item.Qty

$BODY$
LANGUAGE 'sql' VOLATILE;
ALTER FUNCTION testfunc2(m_minqty int8) OWNER TO "postgres-su";




-- Function: testfunc()

-- DROP FUNCTION testfunc();

CREATE OR REPLACE FUNCTION testfunc()
RETURNS SETOF record AS
$BODY$

declare
m_ItemCode varchar(10);
m_Qty INT8;

rec record;

m_runningTot int8;
begin


m_runningtot = 0;
FOR rec
IN SELECT ItemCode, Qty, (itemcode || itemcode)::varchar as yy, 0::int4 as prod FROM Item order by itemcode desc
LOOP
m_runningtot = m_runningtot + rec.qty;
rec.prod = m_runningtot;
RETURN NEXT rec;
END LOOP;



RETURN;

end;

$BODY$
LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION testfunc() OWNER TO "postgres-su";



/*
select * from testfunc2(7) as x(
itemcode varchar(8),
qty int8,
yy varchar,
prod int4,
SumQty int8);
*/

SELECT * FROM TESTFUNC2(1) AS X(itemcode varchar(8), qty int8, yy varchar, Prod int4);

Recipe 7.6. Generating a Running Total:

Solution

As an example, the following solutions show how to compute a running total of salaries for all employees. For readability, results are ordered by SAL whenever possible so that you can easily eyeball the progression of the running total.
DB2 and Oracle

Use the windowing version of the function SUM to compute a running total:


1 select ename, sal,
2 sum(sal) over (order by sal,empno) as running_total
3 from emp
4 order by 2


ENAME SAL RUNNING_TOTAL
---------- ---------- -------------
SMITH 800 800
JAMES 950 1750
ADAMS 1100 2850
WARD 1250 4100
MARTIN 1250 5350
MILLER 1300 6650
TURNER 1500 8150
ALLEN 1600 9750
CLARK 2450 12200
BLAKE 2850 15050
JONES 2975 18025
SCOTT 3000 21025
FORD 3000 24025
KING 5000 29025


MySQL, PostgreSQL, and SQL Server

Use a scalar subquery to compute a running total (without the use of a window function such as SUM OVER, you cannot easily order the result set by SAL as in the DB2 and Oracle solution). Ultimately, the running total is correct (the final value is the same as the above recipe), but the intermediate values differ due to the lack of ordering:


1 select e.ename, e.sal,
2 (select sum(d.sal) from emp d
3 where d.empno <= e.empno) as running_total
4 from emp e
5 order by 3

ENAME SAL RUNNING_TOTAL
---------- ---------- -------------
SMITH 800 800
ALLEN 1600 2400
WARD 1250 3650
JONES 2975 6625
MARTIN 1250 7875
BLAKE 2850 10725
CLARK 2450 13175
SCOTT 3000 16175
KING 5000 21175
TURNER 1500 22675
ADAMS 1100 23775
JAMES 950 24725
FORD 3000 27725
MILLER 1300 29025

equivalent postgresql syntax



-- MS SQL way
UPDATE Item
SET Qty = ISNULL(X.SumQty,0)
FROM Item
LEFT JOIN
(
SELECT ItemCode, SUM(TranItem.Qty) AS SumQty
FROM TranItem
GROUP BY ItemCode
) AS X
ON X.ItemCode = Item.ItemCode


-- Postgres way
UPDATE Item
SET Qty = X.SumQty
FROM
(
SELECT Item.ItemCode, COALESCE(SUM(TranItem.Qty),0) AS SumQty
FROM Item
LEFT JOIN TranItem
ON TranItem.ItemCode = Item.ItemCode
GROUP BY Item.ItemCode
) AS X
WHERE X.ItemCode = Item.ItemCode

Slashdot | Microsoft Releases Critical IE Patch: "Dammed if they do, dammed if they do not..
(Score:5, Insightful)
by Tominva1045 (587712) on Wednesday April 12, @11:45AM (#15114046)
(http://www.digidroid.com/)


If they don't update their products people will comment on how much they suck.

If they do update them people will claim instability due to the number of patches.

It's a matter of perception. Some people see ongoing updates as true support. Others simply hate anything Microsoft.

You decide."

Wednesday, April 12, 2006

Slashdot | Useful Apps for First-Time Windows Users?:

Living off the grid -- easier than you think.

(Score:5, Interesting)
Let's take a realistic point of view. We have a computer user who seems to be well experienced. They even have a nicely designed blog online where you can write in your favourite Windows-only applications. Yet they claim that they have never been a windows user before (Making me wonder where they have been for the past 10+ years where windows has been the ubiquitous consumer & business software platform.)

I'm a software developer. I've worked for IBM. I maintain and develop several Open Source software applications. And I haven't been a Windows user since Windows 3.1.

I always have to laugh when some Windows user thinks that it is simply not possible to exist in the computing world without using Windows. However, it's quite a bit easier to live outside the Windows world than you think.

How did I do it? Long before Windows 95 existed, I used a fine 32-bit, pre-emptively multitasking operating system called OS/2, which I used for most of the 1990's. Towards the late 1990's, when OS/2 was on the decline, I started working for IBM as an OS/2 developer, where I also did a lot of Unix/Linux work. Around the same time frame, I started running Linux at home in parallel to my OS/2 machine as a way of running software through X that I didn't otherwise have access to.

With the serious decline of OS/2 in the 2000's, I moved over to Mac OS X (along with running a lot of Unix systems). For the last number of years much of my paid work has been in Java comsulting, where I get to pick what platform I use.

So I haven't had a Windows machine since 1993 at this point. True, I have encountered them here and there over the years, but I've been able to avoid being assigned to a Windows machine in my home or at any place of work I've held in all that time. The trick is damn simple for the most part: be so freakishly good at what you do that people will be happy to comply with your platform requests, and let them know up from you have no interest in working with Windows. So far, it's worked every time here.

Yaz.
Windows Free since '93.

The Three Great Virtues Of A Programmer: "Before more people post comments like this one....
From the Article:

Laziness
The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful, and document what you wrote so you don't have to answer so many questions about it. Hence, the first great virtue of a programmer. Also hence, this book. See also impatience and hubris. (p.609)

Impatience
The anger you feel when the computer is being lazy. This makes you write programs that don't just react to your needs, but actually anticipate them. Or at least pretend to. Hence, the second great virtue of a programmer. See also laziness and hubris. (p.608)

Hubris
Excessive pride, the sort of thing Zeus zaps you for. Also the quality that makes you write (and maintain) programs that other people won't want to say bad things about. Hence, the third great virtue of a programmer. See also laziness and impatience. (p.607)"

Coding Horror: Software Developers and Asperger's Syndrome: "> can name Doctors and Accountants as two professions that contain people even 'weirder' than programmers.

Really? Do accountants go home and do a bunch of accounting for fun? Do doctors? Somehow I think that's unlikely, but many programmers do exactly this.

Example. For better or worse, I spend nearly every waking hour (almost literally) in front of a computer. I have a hard time imagining accountants going home and cracking open their accounting ledger and sliding on their green visor, you know, 'for fun'.

I think other professional fields *can* be asperger-y, but few as much as computer science."

Coding Horror: Software Developers and Asperger's Syndrome: "Though no one has tried to convince the Valley's best and brightest to sign up for batteries of tests, the culture of the area has subtly evolved to meet the social needs of adults in high-functioning regions of the spectrum. In the geek warrens of engineering and R&D, social graces are beside the point. You can be as off-the-wall as you want to be, but if your code is bulletproof, no one's going to point out that you've been wearing the same shirt for two weeks. Autistic people have a hard time multitasking - particularly when one of the channels is face-to-face communication. Replacing the hubbub of the traditional office with a screen and an email address inserts a controllable interface between a programmer and the chaos of everyday life. Flattened workplace hierarchies are more comfortable for those who find it hard to read social cues. A WYSIWYG world, where respect and rewards are based strictly on merit, is an Asperger's dream."

Tuesday, April 11, 2006

Error 2013 but server up for 6 days - vBulletin Community Forum:



http://www.mysql.com/doc/G/o/Gone_away.html
http://www.mysql.com/doc/C/o/Common_errors.html
http://www.mysql.com/doc/S/e/Server_parameters.html
http://www.mysql.com/doc/O/p/Option_files.html
http://www.mysql.com/doc/S/H/SHOW_VARIABLES.html

The most common reason for the MySQL server has gone away error

1. Is that the server timed out and closed the connection. By default, the server closes the connection after 8 hours or 28800 seconds if nothing has happened. You can change the time limit by setting the wait_timeout variable when you start mysqld via your server's /etc/my.cnf as well.

2. Another common reason to receive the MySQL server has gone away error is because you have issued a ``close'' on your MySQL connection and then tried to run a query on the closed connection. You can check that the MySQL hasn't died by executing mysqladmin version and examining the uptime.

i.e. to check mysql uptime, in shell as root user type:

mysqladmin -u root -p version

3. You can also get these errors if you send a query to the server that is incorrect or too large. If mysqld gets a packet that is too large or out of order, it assumes that something has gone wrong with the client and closes the connection. If you need big queries (for example, if you are working with big BLOB columns), you can increase the query limit by starting mysqld with the -O max_allowed_packet=# option (default 1M) or via max_allowed_packet variable in your /etc/my.cnf file and restarting mysql after you edited your /etc/my.cnf file. The extra memory is allocated on demand, so mysqld will use more memory only when you issue a big query or when mysqld must return a big result row

4. or simply your host restarted mysql.. i'd contact your web host

Monday, April 10, 2006

PHP vs. ASP.NET:

Making the Choice

Without assuming you've already decided to go with PHP, I'll conclude that its strengths far outweigh its weaknesses. (See the summary in Table 1.) It boils down to price, speed and efficiency, security, cross-platform applicability, and open-source opportunity. Its only weakness is its lack of a pure and perfect OOP implementation; however, this is a minor drawback. Though language constructs do help, ultimately, good coding is a matter of practice, execution, good habits, and discipline.

Table 1

PHP 4 PHP 5 ASP.NET
Software price free free free
Platform price free free $$
Speed strong strong weak
Efficiency strong strong weak
Security strong strong strong
Platform strong strong weak (IIS only)
Platform any any win32 (IIS only)
Source available yes yes no
Exceptions no yes yes
OOP weak strong strong

Price. Here, we must consider not simply the price tag of the initial investment, which, in the case of PHP, is obviously free, but also the implementation, maintenance, and debugging costs. In the case of PHP, you may invest in the Zend optimization engine. With ASP, however, you're investing from the very beginning, and you're spending for add-on technologies—libraries for doing graphics manipulations, for instance. But, in the long term, PHP isn't going to press you to upgrade and collect more licensing fees. Everyone who has dealt with complex licensing also knows that companies spend time and money just ensuring they are compliant. Furthermore, you have a difference in response when getting bugs fixed. This, of course, translates to time, which translates to cost for overall development.

Speed and efficiency. As I mentioned earlier, ASP.NET is a framework allowing you to use various programming languages. In addition, it is touted as having a great object-oriented model. All this is true, but it becomes a detriment as far as speed is concerned. For all that advantage, there is a lot more code to run through to execute the same ASP page than you have to execute in the PHP engine for an equivalent PHP page. PHP is the quick-and-dirty type of solution, the one to get the job done. And though a lot of robustness has been added to it since its 2.0 and 3.0 days, it still retains that core optimized high-speed approach.

Speed is not the only consideration. Memory usage is also important.

Paul McCartney - Wikipedia, the free encyclopedia: "McCartney's friendship with Jackson was short-lived. Not long afterward, Jackson paid a huge sum to acquire the Northern Songs catalogue, which included the publishing rights to most of The Beatles' songs. McCartney has made it clear that he does not wish to have the catalogue back. According to Contact Music [2], McCartney said 'I do get some cash from the publishing already. And in a few years more of the rights will automatically be reverting to me. The only annoying thing is when I tour America I have to pay to play some of my own songs.'"

Sunday, April 09, 2006

Slashdot | Torvalds Says 'Use KDE': "For many people, the choice of whether to use KDE or Gnome will be automatically dictated by the distribution that they happen to choose. After all, most people aren't particularly concerned with pseudo-religious debates concerning Gtk v Qt or C v C++, especially since we seem to have so many zealots in the real world these days."

Slashdot | Torvalds Says 'Use KDE': "My Opinion
(Score:5, Funny)
by Tighe_L (642122) on Tuesday December 13, @10:59AM (#14246427)
(http://www.classicgaming.com/nestable/)
I can sum it up quickly: While KDE has much better applications, and has a nice Kontrol Panel, QT is bloated and slow. Gnome's applications are underdeveloped and lack the features that KDE's applications have, GTK2 is quite fast. Personally I use Gentoo and set my use flags to comple GTK2 support and remove QT support, and for user interface I use fluxbox and aterm. This is quite fast and works well for me. I assume that Linus is refering to newbee's to and kind of _nix. I personally will not be using KDE, I don't care what Linus says, who made him Jesus? I am sure that Jesus would use a command prompt. Hello? 10 Commandments??"

Linus, KDE, and GNOME:


Anyway, a lot of the discussion centered on how mean Torvalds was being to GNOME, and how "Linus is increasingly 'out there' in his hyperbolic statements."

Oh please.

Torvalds has always sounded the way he does today.

If you think he was being grumpy today, check out his exchanges back in 1992 with Andrew Tanenbaum about Minix, Linux, and operating system theory.

Besides, I've been around geeks and developers most of my life. I'm even a bit of one myself. This is how they talk.

Hell has no fury like someone who really knows their technology -- or thinks he or she does, anyway -- making a point about it.

Of course, in Linus's case, he really does understand the technology.

That doesn't mean that the GNOME people don't have a point. Millions of Mac OS X users aren't all wrong, and there are marked similarities between the Mac's Aqua interface and GNOME.

Still, Torvalds is worth listening to anytime he talks about operating systems and their interfaces, and being a techno-wizard, that means sometimes he's going to say it in a way that's going to rub some people the wrong way.

That's how techno people have been, are now, and forever will be.

If I wanted manners, I'd call in Judith Martin, aka Miss Manners. Since I want top technology, I'll call in Linus Torvalds, and be glad that he's actually such a nice guy… except when you get his dander up about technology.

Slashdot | Torvalds Says 'Use KDE': "When someone manages to ship Gnome with the power of KDE, or KDE with the consistency and cleanliness of Gnome, please call me. I still use a few KDE applications - Amarok is way better than Rythmbox, and I switch between KDevelop and Anjuta depending on what I'm doing."

Strategy Letter IV: Bloatware and the 80/20 Myth - Joel on Software: "In his opinion, the program should have been around 95% smaller. The joke is that the utility he dissected is something called RegClean, which you've probably never heard of. This is a program that goes through your Windows registry looking for things that aren't being used and deleting them. You have to be a little bit on the obsessive-compulsive side to care about cleaning up unused parts of your registry. So I'm starting to suspect that fretting about bloatware is more of a mental health problem than a software problem."

Slashdot | Torvalds Says 'Use KDE': "I suffer from mild OCD, and to me simplicity means calm, it means an enhanced ability to concentrate, and it means a better experience overall. KDE, to me, seems so incredibly cluttered and overreaching/overbearing that I shy away from it at every possible moment.

So again, this goes back to simply a matter of preference. Some like KDE, some like Gnome, some like E, but here's my problem. For Linus to get involved in this is just wrong. He can say he uses KDE, that's fine, but to put down Gnome as detrimental to society is base, ill-informed, and callus. If people don't like Gnome, fine, let them be. But this 'disease' of which he speaks affects my mom and grandparents, and yeah, they sure as hell can find their way around a Gnome base installation better and faster than they can around KDE base installation."

Slashdot | Torvalds Says 'Use KDE': "But on the same note I am not a UI religious fanaticl. If KDE 4.0 comes out with an imporoved look and works better and can be made more minimal I would use KDE (or whatever comes along that gets the job done faster)."

Slashdot | Torvalds Says 'Use KDE': "Re:KDE vs. Gnome. Ready...FIGHT!
(Score:5, Interesting)
by drgonzo59 (747139) on Tuesday December 13, @02:42PM (#14248604)
Actually research kind of supports what you say. In an Human Computer Interface (HCI) graduate class I took a couple of years ago we read a paper that compared how people did the same task using a text console and a point-and-click interface (mostly copying, renaming, moving and creating files). It turns out at first people figure out the point and click interface faster but they are more likely to remember how to do all those tasks using a command line. In other words the researchers called those people back a week later and the ones who were using the command line remembered better how to do the tasks."

FOXNews.com - Beatles: Lennon Planned to Visit McCartney In 1974 - Celebrity Gossip | Entertainment News | Arts And Entertainment: "Pang told me the following story: Lennon was making plans to see Paul and Linda McCartney right before Ono pulled her string and brought him home to the Dakota in Manhattan. 'Paul and Linda were going to New Orleans to record the Venus and Mars album,' May recalled. 'And John found out they would be there. He made plans to surprise them down there. He was in a great mood and he really missed Paul"

McSweeney's Internet Tendency: Fun With Names

McSweeney's Internet Tendency: Fun With Names: "And if Yoko Ono married Dave Grohl, she'd eventually break up the Foo Fighters."

Dave Grohl: Spin Q&A: "So you're not lying awake at night filled with existential dread.
No, not at all. In '97, when we were making our second record, everybody was quitting the band; I was going through a divorce and living in [former Scream bandmate] Pete Stahl's back room in a sleeping bag. At night I would sit down and write out all of my problems. 'This member's leaving. This member's quitting.' You know, charts and pie graphs. Just to single them out and fucking work through them one at a time."

Paul McCartney: "It's a religious experience with no actual religion involved"

Interview with May Pang (8-1-05):

E.C.: Your book LOVING JOHN has been out of print for a while. Is there any chance of a new, 'updated' edition, with some of the stories that were left out?

May Pang: Very possible…very possible. I'm actually working on another one, which will be a coffee table book…

E.C.: Yes, the last time we talked you mentioned compiling a Lennon photo book using your own personal photos.

May Pang: Since that time a lot of different things have sidetracked me, and now its time to finally bring it out. I always believed that God works in mysterious ways - and certain things don't happen at the time you want them to. But they happen when they're meant to happen.

Helter Skelter@Everything2.com:

In the late 1960s rock 'n' roll was going through gigantic changes. Artists and bands such as Eric Clapton, Jimi Hendrix, Led Zeppelin, Iron Butterfly and The Who were laying the ground work for what would later be called Heavy Metal. Paul began to pay attention to this emerging sound. "I read in the Melody Maker that The Who had made some track or other that was the loudest, most raucous rock 'n' roll, the dirtiest thing they've ever done." The article was about The Who's I Can See for Miles and Paul felt he could do better. So he started to put Helter Skelter together. When the reviews came back, Paul was tickled to see the papers call his song "the loudest, nastiest, sweatiest rock song we've done."

But in only eight and a half months people received a much different view of the song and arguably Heavy Metal in general. On August 9, 1969 Charles Manson's followers brutally killed six people in Los Angeles including Sharon Tate and her eighth-month unborn baby. The next day members of the Manson Family murdered Leno and Rosemary LaBianca with the same ferocity. At the scenes the killers left messages written in the victims' blood, one of which was "Helter Skelter." Manson believed the Beatles were communicating secret messages in their music, and particularly in their latest work, The White Album. He 'preached' that Helter Skelter predicted a coming race war and that they were to rise up and fight against the Pigs and blacky.

The story was horrifically sensational and dominated the press for months. People read about the effects of hard core rock 'n' roll music on the Manson Family. He once rambled, "The music speaks to you every day but you're too deaf, dumb, and blind to listen. It's not my conspiracy. It's not my music. I hear what it relates. It says rise; it says kill. Why blame me? I didn't write the music." But despite the obvious insanity of Charlie Manson, the music inevitably got its unfair share of the blame. The Manson murders basically created the stigma that Heavy Metal is satanic and evil.

The almost comical fact about all this is that a helter skelter, quite literally, is a slide that spirals around a tall tower. When one gets to the bottom, one climbs the stairs to the top before turning and sliding down again. Much like how Back in the U.S.S.R. makes fun of Pet Sounds, Paul created this heavy, dirty, sweaty piece to show-up and poke fun at this new sound coming from The Who and Jimi Hendrix by making it, not about death, murder, Satan or the like, but about children's play ground equipment.

The song has been covered by more than a few people, including Aerosmith, Motley Crue, Siouxsie and the Banshees, and Pat Benatar. But none is more annoyingly memorable than U2's live recording for their album Rattle And Hum. The tribute begins with Bono's declaration that, "This is a song Charles Manson stole from the Beatles. We're stealing it back." Unfortunately, the song wasn't preformed well. Also, he changed some of the pronouns from first person to second which took like nails on a chalkboard. It would have been nice if they actually were able to steal it back from Manson, but the recording, particularly with the mention of his name, inevitably reminded people of song's ominous past.

kung hindi dahil kay yoko, maari pa nag-songwriting partner uli si john and paul

Interview with May Pang (8-1-05):

E.C.: That's why I feel that there is a need to have your book [LOVING JOHN] reprinted, if for no other reason than to counter some of these myths.

May Pang: Perhaps someday. I'd like to clarify all the timelines. John did not return to the Dakota until February 1975. After the show with Elton in 1974, we took Julian to Disneyland. So, if somebody was a real fan they would realize that the timing is off. We hung out with Bowie, and they collaborated on "Fame" in January 1975.

When we parted it wasn't something that we had planned on. When he came back to tell me, he said it would help his immigration problems - Yoko had convinced him that that was the best way to do it. She also told him that he could still see me.

E.C.: She had more control over him that way…

May Pang: Yes. And slowly, I wasn't supposed to be around anymore.

E.C.: Another little known fact was that he did hang out with Paul again…

May Pang: He wanted to write with Paul again. He asked me if I thought it was a good idea. I told him I thought it was a great idea, "because you two want to do it. There are no contracts, no pressure. Just the most amazing songwriting team ever getting together to create some musical magic." Solo they were great, but together they were unbeatable. He thought about it and he said, "You know what? Let's go down and visit Paul and Linda.

E.C.: In New Orleans? [During the making of VENUS AND MARS]

May Pang: Yes, in New Orleans. Later that week on a Friday afternoon, Yoko called John to say, "today was the day, the stars are right. Gotta come today, we've gotta do this 'cure' to get you to quit smoking." My gut feeling was telling me he shouldn't go. It didn't sit well with me. John saw that I was really upset. He goes, "Let's not fight about it - I'll be home for dinner. Whatever place you wanna go for dinner. And then let's make the plans to go down to New Orleans." And I knew…when he walked out. You know you have a gut feeling? I knew something was going to change.

I told Paul - about 15 years later when I had a chance to see him in England. I said to him, "Listen, for what it's worth, I just want you to know that John really loved you." He said, "Oh, I know that." Then I said, "You know, we were going to come down to New Orleans because he wanted to write with you again." He looked at me and said, "Oh yeah…that would have been great." Now I know he didn't even want to entertain that thought. Coming down to New Orleans? I could tell that he thought I was just being nice.

A year had gone by and I get a call from Paul's office to invite me to his annual Buddy Holly party in New York. So I went and I waved as they came in - and Paul rushed over and said, "Linda, tell her, tell her!" I said, "Tell me what?" "You know how Derek Taylor always sells memorabilia? Well, we got one of his postcards from John." And I said, "What was it?" On the postcard, John wrote "thinking of visiting the Macs in New Orleans". It was then that Paul believed it.

E.C.: So the postcard proved it to Paul?

May Pang: Right! And I didn't even know the postcard existed. And Paul got it. John had written to Derek, he always used to write notes and letters to his friends. Wouldn't that have been great?

Poscript: One can only wonder "what if" John had made it to New Orleans to record with Paul in 1975! I've always wondered about a line of lyrics from the song "Venus and Mars" [the title track of Paul's album started at the New Orleans sessions, recorded in 1975]. Is the "good friend of mine" who "follows the stars" about John?

Re: How are postgreSQL database files structured?:

Re: How are postgreSQL database files structured?



On Sat, 2002-11-23 at 04:12, Hugh Esco wrote:

> But when I take a look at /usr/local/pgsql/data/base, I am baffled by its
> contents. I hear that the directory at: /usr/local/pgsql/data/base/1 is
> the template1 database. But I do not know where the template0 database
> is. And I certainly do not understand how testtest gets named 16555, much
> less what the numbered directories and files subordinate to that directory
> have to do with anything real in the world.

The files in $PGDATA/base are named by the oid of the database record in
pg_database, like this:

postgres ( at ) linda:~$ cd $PGDATA
postgres ( at ) linda:/usr1/postgres/data$ ls -l base
total 33
drwx------ 2 postgres postgres 2048 Nov 23 04:01 1
drwx------ 2 postgres postgres 2048 Nov 23 04:00 1063179
drwx------ 2 postgres postgres 2048 Nov 23 04:00 1063190
drwx------ 2 postgres postgres 3072 Nov 23 04:00 1063237
drwx------ 2 postgres postgres 3072 Nov 23 04:00 1063515
drwx------ 2 postgres postgres 3072 Nov 23 04:01 1064226
drwx------ 2 postgres postgres 3072 Nov 23 04:01 1064465
drwx------ 2 postgres postgres 2048 Nov 18 22:39 16975
drwx------ 2 postgres postgres 2048 Nov 23 04:00 16976
drwx------ 2 postgres postgres 3072 Nov 23 04:00 16983
drwx------ 3 postgres postgres 6144 Nov 23 04:00 3884888
drwx------ 2 postgres postgres 2048 Nov 23 04:01 4989386
postgres ( at ) linda:/usr1/postgres/data$ psql template1
Welcome to psql 7.3rc1, the PostgreSQL interactive terminal.
...
template1=# select oid,datname from pg_database order by oid;
oid | datname
---------+----------------
1 | template1
16975 | template0
16976 | NEUROMR
16983 | accounts
1063179 | comanagers
1063190 | genealogy
1063237 | junk
1063515 | lfix
1064226 | sql_ledger
1064465 | stjohns
3884888 | bray
4989386 | space database
(12 rows)

Similarly, inside $PGDATA/base/, relation files are named by
their oids in pg_class:

stjohns=# select oid,relname from pg_class where oid > 1000000 and oid <
2000000 order by oid limit 5;
oid | relname
---------+------------------------
1064466 | members
1064470 | pg_toast_1064466
1064472 | pg_toast_1064466_index
1064473 | members_pkey
1064475 | perms
(5 rows)

stjohns=# \! cd $PGDATA/base/1064465 ; ls 10* | head -5
1064466
1064470
1064472
1064473
1064475


pg_class has a column, relfilenode, which almost invariably has the same
value as the oid; I'm not sure whether, should they differ, the file
would be named relfilenode or oid, though I would presume the former.

--
Oliver Elphick Oliver ( dot ) Elphick ( at ) lfix ( dot ) co ( dot ) uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"The LORD is nigh unto all them that call upon him, to
all that call upon him in truth."
Psalms 145:18