Analytics


Google

Monday, December 5, 2011

Embedding pre filtered table in Google Site

If you have a Google spreadsheet with lots of data and you want to embed different results in different pages with a Google site, this is how you do it.

First create a Google sheet and share it with the following option (Anyone with link):




Next populate your Worksheet (for example):













Highlight all the data and Insert a Named Range and give it a name.  In this example, I called it SampData.

Insert a new sheet and put in the first cell your query.  In my case, I place the following:

=Query(SampData, "select * where B='Rent'")

One key thing to note that for the where clause, you need to use the cell column in this case is B instead of the field name.

Next insert a Gadget to the worksheet call table Gadget.















You will then be prompted for the range, specify the range in the worksheet that has the query results.  In my case, it is Sheet7!A:E.  

You can create as many worksheets with different results as you want.

Next go to you Google site, create the page and add the table gadget there.    The easiest way, is to click insert Gadget and then add by url and paste the following:

http://www.google.com/ig/modules/table.xml 

The gadget will require the data, the data is available by clicking on the gadget in the worksheet and select Get Query Data source url. Copy and paste the data source url to the gadget in the google site:













You can use the same gadget in the worksheet and change the range (using different sheets) to get different filtered results to display on your Google site.


Thursday, December 1, 2011

Performing Word Search

I finally found something I can't do with Google Search.  It is trying to solve look for words of a specific length, either start with end with etc.  Basically a word search.  We normally do that when we want to solve a puzzle but in this particular case, it was a homework assignment for my daughter. 

Luckily there are a few sites that provide solutions.

http://www.morewords.com/  To find a 5 character word which starts with a, you just search a----

http://www.onelook.com/  To find a 5 character word which starts with a, you just search a????.  However, with this site, you may need to click on common words and phases otherwise it will include a lot of other results which may contain -, ' etc.


Friday, November 25, 2011

What influences Oracle SysDate

Sysdate, per Oracle documentation will do the following:
“SYSDATE returns the current date and time set for the operating system on which the database server resides. The data type of the returned value is DATE, and the format returned depends on the value of the NLS_DATE_FORMAT initialization parameter. The function requires no arguments. In distributed SQL statements, this function returns the date and time set for the operating system of your local database.”
By default if nothing is set, sysdate will return the date/time based on the setting of the OS it is running on.  However, it is possible to set the TZ variable to change it.   On the Unix site, it is a matter of creating an environment setting as follow (which will set the listener to use GMT - your OS could be using a different timezone):

"export TZ=GMT;$ORACLE_HOME/bin/lsnrctl start $LISTENER"

When the above setting is set, all connections that logs into the database using the listener will use GMT timezone.

This means that if I will use the GMT timezone if I connect using the following command.

sqlplus scott/tiger@orcl

However, if I were to connect to the Unix box and then connect without the @ (meaning without going through the listener, I will use the timezone from the O/S.  As in connecting via:

sqlplus scott/tiger

Further description can be found in the Metalink FAQ - 227334.1

Additional note:

  • The timezone is set at the time when the listener is started.  So if you change the timezone after that, it will not be reset unless you restart the listener.  
  • The same applies for the database, it will follow the timezone when you start the database.
  • It is possible to set different timezone for different listener running on different ports.


Reference:
  David Marcos' Blog

Thursday, September 15, 2011

Create Gantt chart using Google Apps

The step by step process is described in the following url.

Key information are as follow:

 In particular, for the Google Gantt chart tool to work correctly, you should include columns with the following data.

    Unique ID (optional) – This column will contain a unique number assigned to each row of the table (1, 2, 3, 4, … for example). You only really need to include this column if certain tasks in your list are dependent on the completion of other tasks and you want this information reflected in your Gantt chart. If not, you don’t have to worry about this column.

    Name – In this column, include the name or a brief description of each task.

    Start – Enter the proposed start date for the task in this column.

    Finish – This column should contain the proposed or actual completion date of the task.

    Percent Complete – The number in this column should indicate what percentage of the task has been completed. Tip: Leave off the percent sign in order for the Gantt chart tool to read this field properly.

    Prerequisites (optional) – Like the Unique ID field, this column is only needed if certain tasks are dependent on others. If they are, input the Unique ID of any prerequisite task here.

Note that you can give these columns any title you wish and that you can include additional columns with other project data – just make sure that the above information is included somewhere in the table.



Wednesday, September 14, 2011

Multi Threading Java Script

I just found out that it is possible to do multithreading with Javascript.    This is only possible with the HTML 5 WebWorker.    The article on this is found here.

Unfortunately, this feature is only selected in several browsers, namely, IE 10, Firefox (since 3.6), Safari (since 4.0), Chrome & Opera 11.


Some snippets below:


/* Checking if Web Workers are supported by the browser */
if (window.Worker) {
    // Code using the Web Workers
}
 
The sample test page is found here. 

The following is from the article.  Read the article for the full explanation and detail:

You’ll then start the worker (and thus a thread under Windows) by sending it a first message:
myHelloWorker.postMessage();
Indeed, the Web Workers and the main page are communicating via messages. Those messages can be formed with normal strings or JSON objects. To illustrate simple messages posting, we're going to start by reviewing a very basic sample. It will post a string to a worker that will simply concatenate it with something else. To do that, add the following code into the “helloworker.js” file:

function messageHandler(event) {
    // Accessing to the message data sent by the main page
    var messageSent = event.data;
    // Preparing the message that we will send back
    var messageReturned = "Hello " + messageSent + " from a separate thread!";
    // Posting back the message to the main page
    this.postMessage(messageReturned);
}

// Defining the callback function raised when the main page will call us
this.addEventListener('message', messageHandler, false);
 
We’ve just defined inside “helloworkers.js” a piece of code that will be executed on another thread. It can receive messages from your main page, do some tasks on it and send a message back to your page in return. We then need to write the receiver in the main page. Here is the page that will handle that:


<!DOCTYPE html> 
<html>
<head>
    <title>Hello Web Workers<title>
</head>
<body>
    <div id="output">div>

    <script type="text/javascript">
        // Instantiating the Worker
        var myHelloWorker = new Worker('helloworkers.js');
        // Getting ready to handle the message sent back
        // by the worker
        myHelloWorker.addEventListener("message", function (event) {
            document.getElementById("output").textContent = event.data;
        }, false);

        // Starting the worker by sending a first message
        myHelloWorker.postMessage("David");

        // Stopping the worker via the terminate() command
        myHelloWorker.terminate();
    &lt/script>
</body>
</html>
 
The result will the be: “Hello David from a separate thread!”. You’re now impressed, aren’t you? Clignement d'œil
The worker will live until you kill it. Beware of that. As they are not automatically garbage collected, it’s up to you to control their states. Moreover, keep in mind that instantiating a worker will have some memory cost and don’t negligate the cold start time neither. To stop a worker, there are 2 possible solutions:
1 – from the main calling page by calling the terminate() command.
2 – from the worker itself via the close() command.

DEMO: You can test this slightly enhanced sample in your browser here ->

http://david.blob.core.windows.net/html5/HelloWebWorkers_EN.htm <-

Posting messages using JSON

Of course, most of the time we will send some more structurated data to the workers. By the way, Web Workers can also communicate between each others using Message channels.
But the only way to send some structurated messages to a worker is to use the JSON format. Hopefully, browsers that currently support Web Workers are nice enough to also natively support JSON. How kind they are!
Let’s then take our previous code sample. We’re going to add an object of type WorkerMessage. This type will be used to send some commands with parameters to our Web Workers.
Let’s use now the following simplified HelloWebWorkersJSON_EN.htm web page:

Hello Web Workers JSON


    
    
 

We’re using here the Unobtrusive JavaScript approach which helps us dissociating the view from the attached logic. The attached logic is then living inside this HelloWebWorkersJSON_EN.js file:

// HelloWebWorkersJSON_EN.js associated to HelloWebWorkersJSON_EN.htm

// Our WorkerMessage object will be automatically
// serialized and de-serialized by the native JSON parser
function WorkerMessage(cmd, parameter) {
    this.cmd = cmd;
    this.parameter = parameter;
}

// Output div where the messages sent back by the worker will be displayed
var _output = document.getElementById("output");

/* Checking if Web Workers are supported by the browser */
if (window.Worker) {
    // Getting references to the 3 other HTML elements
    var _btnSubmit = document.getElementById("btnSubmit");
    var _inputForWorker = document.getElementById("inputForWorker");
    var _killWorker = document.getElementById("killWorker");

    // Instantiating the Worker
    var myHelloWorker = new Worker('helloworkersJSON_EN.js');
    // Getting ready to handle the message sent back
    // by the worker
    myHelloWorker.addEventListener("message", function (event) {
        _output.textContent = event.data;
    }, false);

    // Starting the worker by sending it the 'init' command
    myHelloWorker.postMessage(new WorkerMessage('init', null));

    // Adding the OnClick event to the Submit button
    // which will send some messages to the worker
    _btnSubmit.addEventListener("click", function (event) {
        // We're now sending messages via the 'hello' command 
        myHelloWorker.postMessage(new WorkerMessage('hello', _inputForWorker.value));
    }, false);

    // Adding the OnClick event to the Kill button
    // which will stop the worker. It won't be usable anymore after that.
    _killWorker.addEventListener("click", function (event) {
        // Stopping the worker via the terminate() command
        myHelloWorker.terminate();
        _output.textContent = "The worker has been stopped.";
    }, false);
}
else {
    _output.innerHTML = "Web Workers are not supported by your browser. Try with IE10: download the latest IE10 Platform Preview";
}
 
 
At last, here is the code for the web worker contained in helloworkerJSON_EN.js the file:

function messageHandler(event) {
    // Accessing to the message data sent by the main page
    var messageSent = event.data;

    // Testing the command sent by the main page
    switch (messageSent.cmd) {
        case 'init':
            // You can initialize here some of your models/objects
            // that will be used later on in the worker (but pay attention to the scope!)
            break;
        case 'hello':
            // Preparing the message that we will send back
            var messageReturned = "Hello " + messageSent.parameter + " from a separate thread!";
            // Posting back the message to the main page
            this.postMessage(messageReturned);
            break;
    }
}

// Defining the callback function raised when the main page will call us
this.addEventListener('message', messageHandler, false);
 
Once again, this sample is very basic. Still, it should help you to understand the underlying logic. For instance, nothing prevents you to use the same approach to send to a worker some gaming elements that will be handled by an AI or physics engine.

Thursday, August 4, 2011

Cannot enter info in IE 7

Recently, I heard a few people complaining that they are not able to enter information in the forms on IE 7.  I did a search and found some of the DLLs might suddenly be missing from the registry.  The fix is as follow:

To resolve this issue, re-register the DLL files that are related to Internet Explorer. To do this, follow these steps:
  1. Click Start, and then click Run
  2. Type regsvr32 urlmon.dll in the Open box, and then click OK.
  3. Click OK when you receive the following message:
    DllRegisterServer in urlmon.dll succeeded
  4. Repeat steps 1 through 3 for the rest of the DLL files by replacing the regsvr32 urlmon.dll command in the Open box with the following commands:
    • regsvr32 actxprxy.dll
    • regsvr32 shdocvw.dll
    • regsvr32 mshtml.dll
    • regsvr32 browseui.dll
    • regsvr32 jscript.dll
    • regsvr32 vbscript.dll
    • regsvr32 oleaut32.dll
The information is found on this page.

I was led to the solution above from another page.


Saturday, July 30, 2011

QR Code

QR Code is short form for Quick Response code.  I found this often used on the Android marketplace to help us find the apps to install to our Android devices.  What I did not realize was how easy it is to generate one.

For example, this is one a QR code to my other blog:

qrcode

On the iPhone, you can use QR Reader and on Android devices, there is a app called QR Droid to help you. Both the above devices can read as well as generate the QR Code as shown above.    On the computer, you just need to search for QR to find websites that can generate the images for you.

The barcode reader on Android can also read the code and auto fill the spaces for like when you want to SMS someone.

Wednesday, July 13, 2011

Setting up TP W8901G for Streamyx

This document is taken from the following url.

The setting should be as follow:





My take from the above article are the following:


  1. PVC2 is used instead of PVC0.
  2. VPI needs to be set to 0
  3. VCI needs to be set to 35.
  4. Encapsulation needs to be set to PPPoE LLC
  5. User is the usual account with @streamyx prefix
  6. Password of course is required.
The other important part is the DNS setting.  As is mentioned, in one of the replies:

SourceDNS 1DNS 2
TMNet202.188.0.133202.188.1.5
Google8.8.8.88.8.4.4
OpenDNS  208.67.222.222208.67.220.220

Friday, July 8, 2011

Google Doc Search Operators

The following are operators that can be used in Google Docs.  The full document can be found here.




OperatorDefinitionExample
“ ” QuotesTo find documents that contain that exact phrase.“match this phrase exactly”
ORTo find documents with at least one of the words.tacos OR nachos
- HyphenDocuments that don’t have a particular word. So if you want docs that mention salsa, but not dancing use...salsa -dancing
from:Documents shared from someonefrom:bob@gmail.com
to:Documents shared to someoneto:bob@gmail.com
is:starredItems that you have marked with a star.is:starred
is:hidden or is:archivedItems that you have hidden from the main Documents List by deselecting the Show in Home option.is:hidden
type:Search by the type of document. This covers: document, spreadsheet, presentation, drawing, image, video, image_or_video, pdf, and textdoc.type:spreadsheet
before:YYYY-MM-DD after:YYYY-MM-DDFind items that were edited before or after a certain day.before:2010-12-01
owner:Search according to who owns the item.owner:Frank
title:Search by the item’s titletitle:”Conference 2010”

Tuesday, April 19, 2011

Confio Ignite

Most developers and DBAs are aware of Toad to help with performance tuning and database management.  However, very few are aware of Confio Ignite.  This is an excellent tool for identifying and fixing performance issue in your Oracle, MS SQLServer, DB2, and Sybase.

It help answer questions like

  1. Why is an application waiting on the database and what can be done?
  2. How did the code promotion affect response times in your database?
  3. Did the vendor patch really fix the problem?
  4. Which bottlenecks in your database directly impact end-user service?
To try out the tool, you can use the free version called IgniteFree.

The tutorial is available here.
In addition to that you can also see

There are also Webinars provided:

4 Oracle Performance Tips You Should Know presented 24 June 2010
Learn how to determine the best tuning approach for a SQL statement by utilizing response time analysis and visual SQL diagramming techniques. A "must see" for those who rely on OEM Performance Packs.

Learn a four-step process that will help you quickly find and correct the bad SQL code. Covering topics such as: SQL diagramming, wait type data, column selectivity, and more.





Monday, March 21, 2011

Backing up Blogger Blog

I recently read about disappearing blogs in blogger so I searched for tools to backup my blogs. I found the following tools to backup to your local hard disk:
  1. Blogger Backup
  2. Web Grabber (for OS X)
  3. HTTrack Website Copier
There is also a free service I found:

Monday, March 7, 2011

Saturday, March 5, 2011

Rooting Android 2.2 (Froyo)

There are many apps which will help with rooting Froyo.  The two I have tried are:

z4root
Visionary

Both cases require USB Debugging enabled.

z4root did not work for HTC Desire HD.

Note of caution:

Rooting has a few risk just as going into operation is risky.  If it works, it is fine but when it fails, there are a lot of complications.  It is good to have a copy of your ROM so that you can flash back should you need to or have a service center close by to help you.

Reason for rooting


I rooted my device because I have had to reset my device a few times due to problem with the contact synchronization.   Each time I had to reconfigure everything.  To reduce that need, I wanted to perform a full backup of the device without rooting.

Wednesday, February 16, 2011

Avoiding and fixing contact synchronization between Android and Gmail

I encountered a problem synchronizing the contacts on my new Android phone recently and found that others have encountered similar problems but have not found any solutions on internet.  I finally solved the problem and am sharing it here.

The main cause in my case was the Google Device Policy App.

Avoidance

To avoid the problem be sure to successfully synchronize all your Google accounts before activating the Google Device Policy app.

Fix

If you activated the Google Device Policy app before you successfully complete the synchronization of all your Google Accounts, you may find that the contacts synchronization will not work.

To fix it:

Force stop the Google Device Policy App (to do that go to Settings -> Applications -> Manage Applications -> (find Device Policy) ->
Then go to Accounts & sync to synchronize all your Google accounts.
Once done, you can reactivate your Device Policy App by finding the app under All apps and click on it activate it against your corporate account.

Additional Note


I found another contributing factor to the synchronization has to do with illegal characters in your contact information.  If you have ' in your contact name, it will also cause all the synchronization to stop.  The only way to fix is to remove the illegal characters and then reset the device back to factory config and then set it up again.

However, before you do that, try rebooting your device first.   This may sometimes fix the problem so you don't have to go through the hassle of reconfiguring everything.  I have tried rooting and backing up using Titanium backup but it did not allow me to restore everything.

Monday, January 17, 2011

Puppet - Open Source Data Center Automation and Configuration Management

Puppet is an open source data center automation and configuration management framework. Puppet provides system administrators with a simplified platform that allows for consistent, transparent, and flexible systems management.

Puppet lets System Administrators spend less time on mundane tasks and instead focus on managing their infrastructure strategically.

The following is their website:

http://www.puppetlabs.com/puppet/introduction/

Friday, January 14, 2011

Sitemaps for Blogspot sites

There are two systems in blogspot, the old one and the new one (was previously beta).  To verify, you need to visit to see if you get a XML or a web page.

In the list below, the first three url is the default for sitemap but in the new system, it is redirected to feedburner and will not be recognized by rss readers.  If that is the case then use the last url for the feed.  If it still provide the xml format then you can still continue to use those urls.

Old sitemaps:
http://programmersjournal.blogspot.com/rss.xml
http://programmersjournal.blogspot.com/atom.xml
http://programmersjournal.blogspot.com/feeds/posts/default

New sitemap.

http://programmersjournal.blogspot.com/feeds/posts/full