June 2006 - Posts

Test Run: Google Spreadsheet

Google is really serious in making a virtual office by offering a spreadsheet for the web. Now several companies already had offered spreadsheet for the web but I have yet to be impressed by those pioneers. I've used some of them in their earlier incarnations I don't know if they've modified, but it(operations) involves the mouse for navigation, or that you're going to write on a separate toolbox. Kind of awkward.

When Google started randomly invited users to test their app, I was fortunate to be invited. I immedietly write away as if it was excel. And what do you know it does feel, for the most part, an excel application. Here's the initial screen, very spartan but I think effective:


The spreadsheet(in my testing) is COL:A-T and ROWS:1-100, very modest but not show stopper. You can write anytime inside the spreadsheet just like excel, thanks to in-place editing. You can format the cell, enter formula, resize the column just like excel. You can even toggle the CTRL+PAGE(UP)/DWN to switch sheets.


Although I got the occasional cannot connect to server when it's autosaving the spreadsheet to the server, I think to persist the entered data, it was understandable since it's still beta.

It's still a long way off if it's to supplant Excel, which I think isn't what Google's plan, I still think it has it's niche market. I haven't tried the group collaboration of the spreadsheet but I think it's cool for the software able to bring group together.

I'm impressed not by how it's going to turn out, but the way the google heads make applications like this; so responsive and so natural you'll think you're using a desktop application. Web applications have come long long way...

Posted by bonskijr | with no comments
Filed under:

Quick Tip: Character pad right a number

I have been dependent on the pad functions since the clipper days as it helped alot on formatting fixed length ids(invoice no., receipt no., etc.) Although I think the only purpose of formatting a number to fixed length precedeed by (usually) a zero is that it looks good on reports(i.e. 1234 -> 001234), aside from that it constraints the number to the fixed length.

So it's sort of disappointing that Sql Server(at least 2K) doesn't have a function for character padding, and have to resort to writing my own function in T-Sql. I have taken advantage of the default behavior of the STR() w/c right justifies a float expression by padding it with spaces and issue a REPLACE() to replace with our pad character. So instead of my usual:

[code language="T-SQL"]

SET @Delta = LEN(@NumToPad) - @FixedLength

SELECT  @NumToPad + CAST(REPLICATE(@PadChar,@Delta) AS NVARCHAR(4000))

[/code]

where the @Delta is the actual length minus the fixed length.

Taking advantage of STR() I can do it like so:

[code language="T-SQL"]

   SELECT REPLACE(STR(@NumToPad, @FixedLength), SPACE(1), @PadChar)

[/code]

Quick and dirty routine. Some things to note though:

a.) if the number to pad is greater than the fixed length, STR() will truncate it(num to pad) to asterisk(*)

b.)  Using REPLICATE() is faster than REPLACE() as there is no checking of each character involved. But I think it's negligible.

c.) little tricky going the reverse(i.e. pad left), I'd have to compensate with the decimal point(by adding 1 to the fixed length) and call REPLACE 2x: (1) To change the decimal pt to the pad char (2) finally change all spaces to the pad char

[code language="T-SQL"]

   SELECT REPLACE(REPLACE(STR(@NumToPad, @FixedLength + 1, @FixedLength), '.',@PadChar), SPACE(1), @PadChar)

[/code]

In this case better to use the combo of REPLICATE()+CAST().

Posted by bonskijr | with no comments
Filed under: