Thursday, October 28, 2010

Powerbuilder Function

In every modern programming languages, there is a feature call FUNCTION, as well as Powerbuilder.

FUNCTION is a collection of scripts or statment which it can be re-used. Normally, FUNCTION has a return value.

In Powerbuilder, there are 2 types of FUNCTION: Function and Window Function. The different is FUNCTION can be use anywhere in object that has capabilities to call function, but Window Function just can called in the window itself.

In this article, I will show you the steps how to declare the function in Powerbuilder. I'm using Powerbuilder version 6.5 and I'm sure it will be the same for all versions above

In the main toolbar, click Function painter.

Click New to create a new Function

Type the name of the function, in the example: f_yearafter
Also specify the type of return variable, in this example: date
Function can has many parameters. Parameters can used to passing some value(s) into function, so later can be used to process or calculate something in the script of function. Beside the name of parameters, you must specify the type of parameters, and the Pass By. There are 3 types of Pass by: value, reference, and readonly. Use reference if you want to change the value parameter then inside the function script.
Click OK to create.

Now you can type the script inside the.
In this example, we create a function call f_yearafter. The function will return a date type value, which it is the date result after some year added.

Once the function created, you can't change or rename the function name, but you can still change the return value, the parameter, etc. Please pay the attention, changing all of that value, will affect into the script inside the function. You can click the function painter icon in the toolbar, to edit the function

To call the function, just add the script like this:

Date dReturnFunction

//add 2 years for the date
dReturnFunction = f_yearafter("01/01/2008",2) // will return "01/01/2010"


Monday, October 25, 2010

Unlock SA login in Microsoft SQL Server

If you or your team members who has access to your Microsoft SQL Server database with SA login, did type the wrong password three times, normally the SA login will be locked. It should be an error :

Login failed for 'sa' because the account is currently locked out. The system administrator can unlock it.

To solve this problem, you need an authority to access the database server directly. Login with the administrator login name, then open Microsoft SQL Server Management Studio. Choose Windows Authentication mode, then click Connect.

Now, in Query windows type this statement then execute


There's an option to avoid the sa login to be locked forever, just go to Security, Logins, sa, Properties, then uncheck Enforce password policy option.

Saturday, October 23, 2010

How to create Sparkline GraphMicrosoft Excel 2010

One new feature in Microsoft Office Excel 2010 is Sparklines. 
Sparklines is a graph display of the collection of data in Microsoft Office Excel, but displayed only in one cell. 
There are 3 types Sparklines: Line, Column and Win / Loss. 
To make it, you are required to have a set of data, just as if you want to create an other graph. Click on the Insert ribbon menu, and select the desired type sparkline. And as usual, you are prompted to set the data that you show with this sparkline graph, and finally determine the cell where you want to display these sparkline.

Especially for type Win / Loss, sparkline this type is used if you have a set of data in which there is a negative number. 
And as usual, you sparkline graph can be modified in appearance, ranging from about the color until the value to be displayed.

Wednesday, October 20, 2010

Powerbuilder Pipeline

Another feature in Powerbuilder programming is Pipeline.
According to manual help of Powerbuilder, a Pipeline system object is used to manage a data pipeline during execution.

You use a Pipeline object by defining a standard class user object inherited from the built-in Pipeline object in the User Object painter. You can then access the Pipeline events by writing scripts that contain code for the events.

Now I will show you how to execute pipeline by writing the script.

The scenario of this case is you want to pipeline a table from one database to another database. So, first you need at least 2 transaction objects, which mean we must declare first in the top of the script. Since we have a default database connection SQLCA, we only have declare another new transaction object called SQLCAtarget, which represent for the target database connection. Remember, in this case, SQLCA will be the source of database connection

transaction SQLCAtarget // declare this variable as INSTANT variable

SQLCA.DBMS = 'your source dbms name'
SQLCA.Database = 'your source database name'
SQLCA.LogId = 'your source database login id'
SQLCA.LogPass = 'your source database password'
SQLCA.ServerName = 'your source database server'

SQLCAtarget = CREATE transaction
SQLCAtarget.DBMS = 'your target dbms name'
SQLCAtarget.Database = 'your target database login id'
SQLCAtarget.LogPass = 'your target database password'
SQLCAtarget.ServerName = 'your target database server'
SQLCAtarget.LogId = 'your target database login id'

Next step, you need to build pipeline object by clicking Pipeline painter in main toolbar. Remember, use MAIN TOOLBAR, if you want to pipeline the data to ANOTHER DATABASE.
Setup your source database and the target database profile, chooce the table(s), column(s) and criteria(s), then save as pl_mypipeline.

Choose source and target of Pipeline

Set the table, column and criteria of your pipeline

save your pipeline

Create a window, then put 1 datawindow object and 1 button object. You don't need to put dataobject for the datawindow, just keep it blank. And put the script below at clicked event in button object.

integer iReturn
pipeline myPipeline
myPipeline = CREATE pipeline

myPipeline.DataObject = "pl_mypipeline"
iReturn = myPipeline.Start(SQLCA, SQLCAtarget, dw_1)

// always disconnect your database connection

iReturn should be has 0 (zero) value if the pipeline run smoothly.

Friday, October 15, 2010

How to activate Microsoft Office Trial Version which bundled with Toshiba Notebook

When you buy a new Toshiba notebook, usually you will be given within Microsoft Office applications. By default, the application can only run for 60 days since it was first used, and even then you have to do the activation online, if not you can only use as much as 25 times.

How do I activate Microsoft Office applications are to be used for 60 days for free?

First of all, you need an internet connection, because this activation process requires an Internet connection directly into Microsoft's network of sites.

After you ensure that your notebook is connected to the Internet, you must run the registration application is Microsoft office, by clicking the icon on the desktop of your notebook. Follow all these steps, and at the end of the process, you will be informed 25 number keys for subsequent activation process. Keep these numbers carefully.

Finally you will be prompted to enter a 25 digit keys to activate the Microsoft Office

Wednesday, October 13, 2010

Modify Compute Field Expression in Powerbuilder

Compute Field is an object in Powerbuilder programming, which can be inserted in datawindow. One of mandatory property of Compute Field is Expression.

Expression is set of statement or syntax which represent what you want to show at this compute field. Can be static text, calculation, or the other things.

When you create a datawindow and insert a compute field object, you can set the expression visually. But some times, you want to change the expression statement dynamically, which mean the expression will change depending of condition. Let say, if one of condition is fulfilled, you want to show: OK in the compute field, otherwise is NO.

Let say, in a Datawindow named dw_1, we create 1 compute object named co_1. The default expression is if(kd_kategori=2,'OK','NO'). It's mean if kd_kategori's value is 2, then we want to show text: OK, otherwise is: NO.

But, in some condition you want to change the default expression into if(kd_kategori=200,'OK','NO'), let say if someone in STAFF level is accessing the application.

Then you must create a script like below:

IF userlevel='STAFF' THEN
   dw_1.object.co_1.expression = "if(kd_kategori=200,'OK','NO')"
   dw_1.object.co_1.expression = "if(kd_kategori=2,'OK','NO')"

Saturday, October 9, 2010

Toshiba Portege R700 Short Review

When I first received the Toshiba Portege R700, the first impression is, I admire the luxury of a notebook that is worth about $ 1499.
Physically, the keyboard feels very comfortable, because it uses technology Spill Resistant Keyboard. The distance between one button to another button is separated with a space big enough, so those of you who have big fingers will feel comfortable using it.
Since Toshiba's tag line for this notebook consign this to the business class, the various facilities have been embedded in the Portege R700 is. For example, a dedicated button that is destined for those of you who often make presentations. In another model, you are required to press the fn and F5 key combination to move or duplicate your screen to a projector, now you simply press a button located on the top right of the keyboard. Also for those of you who are not comfortable using its touch pad, and often use the mouse, provided also that the key could direct to turn off the touch pad. Not forget to mention, thinness of this notebook is only about 19 mm and the weight started to 1.39 kg, makes you comfortable when you travel.

With enhanced processor from Intel ® Core
TM i3-350M processor (2.26GHz, 3MB L3 cache), Microsoft Windows 7 Home Premium (32/64-bit), and 4GB memory and a Solid State Drive (to a certain type), Toshiba Portege R700 in the claim has more battery life than other types.

For detail specs for every models of Toshiba Portege R700, you can click here

Friday, October 8, 2010

Rumor: Microsoft will buy Adobe

Adobe Systems Inc. stock price on Thursday (10/07/2010) New York time listed on the Nasdaq stock exchange, had jumped 17 percent to 30 dollars per share before closing at 28.69 dollars per share. Speculation that Microsoft may acquire Adobe's stock price surge triggers the software maker (software) this.

Earlier, The New York Times reported that privately, Microsoft CEO Steve Ballmer has been met with Adobe CEO Narayen Chantanu at Adobe offices in San Francisco recently.

Reportedly, the two talk about the dominance of Apple Inc. in the mobile phone industry and various options to deal with it. According to several employees and consultants involved in the discussion, one of the options they are talking about is the possibility of Microsoft acquiring Adobe.

If it does occur, by referring to Adobe's stock price in the market today, the acquisition price could reach about 15 billion U.S. dollars. This action also will be one of Microsoft's most aggressive step to master the Internet and mobile media markets platform.

With the acquisition of Adobe, Microsoft will master the Flash Player software that is very popular. Now, software has become one of the software required a website to display video and pictures.

Analysts on Wall Street rate, the news of this acquisition makes perfect sense. Because, in this way, Microsoft can integrate graphics and video capabilities in software application Adobe mobile phone or tablet computer product. In this way, the possibility of Microsoft has the opportunity to be able to offset the dominance of Apple's iPhone and iPad fib.

Not too surprising as well if Adobe accept Microsoft's proposal. Because, during Apple CEO Steve Jobs is always criticizing the quality of Flash Player. In fact, he did not recommend that software developers use Flash on the iPhone and iPad.

"Very possibly. It could be a case of so-called enemy of my enemy is my friend. Microsoft and Adobe have a common enemy," said Toan Tran, Morningstar analyst, told Reuters.

However, until now, the good management of both Microsoft and Adobe is not willing to comment on this news.

Notes only, in fact, Microsoft already has a media player on a web platform called Silverlight that compete directly with Flash. However, this product is not too successful with users.

Wednesday, October 6, 2010

How to program Right Click Event in Powerbuilder

As we know at least there are 2 buttons in every mouse that you use with your computer. Known as Left and Right button.

For right-handed user, Left Button is for SELECT purpose. And Right button usually is for displaying the Popup Menu to shortcut the steps.

Now, I am trying to explain how to script Right button to show the Popup Menu in Powerbuilder.

In almost objects in Powerbuilder, there is an event called RBUTTONDOWN. In this case I will use with Windows object.

First, you need to create Menu object with 3 choices, then save as m_rightpopup.

Create new window and save as w_main, and put this script at RBUTTONDOWN event.

m_rightpopup popMenu
popMenu = CREATE m_rightpopup
popMenu.PopMenu(w_main.PointerX(), w_main.PointerY())

The script above, will shown a Popup Menu when you try to click the right button of your mouse, located exactly at your mouse pointer


Tuesday, October 5, 2010

Toshiba Libretto W100 Short Review

In order to celebrate the 25th birthday of their notebook products, Toshiba launched a special product called Toshiba Libretto W100.  Libretto, is one of the classes in Toshiba notebook, which is devoted to small-sized notebook.

Uniquely, the Libretto W100 has 2 screens at once, and has no physical keyboard, such as notebooks in general. When first opened, we will be faced with 2 screens, top and bottom, each measuring 7" wide, with a resolution of 1024x600. The screen can be opened 180 degrees. By default, the screen is "integrated" into a main screen. By pressing the button" keyboard "on the left below, which are made in a dedicated, then at the bottom of the screen will display a virtual keyboard.

The 2 screens are powered by the touch screen technology, so you no longer need any additional equipment such as mouse. But if necessary, has prepared an additional touchpad to move the cursor, again in virtual mode.

I had the opportunity to use this W100 Libretto for 30 minutes. The first impression was, his form was so tiny, a little bit heavy. When I tried the first time it features touch screen, my large-sized fingers facing difficulties to operate the touchscreen commands. Touchscreen technology brings motion gesture, so that like the Apple iPad, you can touch and slide your fingers to enlarge or shrink an image, or to rotate the image.

When tried rotated clockwise, the Toshiba Libretto W100 screen immediately change its position in line with positions such as reading books, in other words the motion sensors are buried in this product.

One disadvantage I found is its internal speakers, a sound which is very soft. To overcome this problem have been provided plug 3.5 "for the earphones

Broadly speaking, the Toshiba Libretto W100, in which embedded possessor U5400 (which is claimed to save energy), OS Microsoft Windows 7 Home Premium, and 62 Gigabyte Solid State Drive, can be a friend in your journey or when you're relaxed, mainly because of its so tiny portable, and relatively long battery endurance because Toshiba Battery 8 Cell buried in it.

For detail spec, you can click here

How to connect to 2 databases in Powerbuilder

How to connect to more than 1 database in Powerbuilder

Some times, you need to connect to more than 1 database in your application. In Powerbuilder, there's 1 object for database connection that you can create programmatically. The object call: TRANSACTION.

In this example, I will explain how to connect to 2 databases, which mean 1 is with default database connection object (named SQLCA), and the other is the object that we create mannualy.

I'm using Microsoft SQL Server 2000 as a database engine.

First of all, we need to create a transaction object. It's depending on what the purpose of the transaction. You can declare with Instance, Global or even Local variable for this object.

Let's say we create Instant Variable, called: SQLCAID

transaction SQLCAID;

On Open Event, we must create first the transaction object, then setup the properties of the object.

Note: You can try first on the Database painter, to get the right property values, and to make sure that you can connect to the database. Then copy and paste the script.

SQLCAID = CREATE transaction;
SQLCAID.DBMS = "MSS Microsoft SQL Server"
SQLCAID.Database = "database1"
SQLCAID.LogPass = "password"
SQLCAID.ServerName = "localhost"
SQLCAID.LogId = "sa"
SQLCAID.AutoCommit = False

// Try to connect the database
// REMEMBER, you must add USING SQLCAID statement at the end of your SQL Statement, every times you want to execute your database that related with SQLCAID transaction


// Trap the error if the object can't connect to database

    MessageBox("Connection Error to "+SQLCAID.Database, &
        "Unable to connect to database. Make sure you type the correct password." + &
        "~r~nTry Again. If the problem persists, contact IT Officer" + &
        "~r~nSQLDBCode = " + String(SQLCAID.SQLDBCode) + &
        "~r~nSQLErrText = " + SQLCAID.SQLErrText)

At the other side, you still must declare the DEFAULT SQLCA transaction object.

SQLCA.DBMS = "MSS Microsoft SQL Server"
SQLCA.Database = "databasedefault"
SQLCA.LogPass = "password"
SQLCA.ServerName = "localhost"
SQLCA.LogId = "sa"
SQLCA.AutoCommit = False
SQLCA.DBParm = ""

// Just for make sure that you connect with SQLCA transaction


// Trap the error if the object can't connect to database
    MessageBox("Connection Error to "+SQLCA.Database, &
        "Unable to connect to database. Make sure you type the correct password." + &
        "~r~nTry Again. If the problem persists, contact IT Officer" + &
        "~r~nSQLDBCode = " + String(SQLCA.SQLDBCode) + &
        "~r~nSQLErrText = " + SQLCA.SQLErrText)

Now you already connected with 2 databases.

Remember, always put USING SQLCA or USING SQLCAID statement at the end of your SQL Statement to make sure that the SQL Statement will execute into the database that you purpose


string sProductID, sProductName

// will retrieve the product_id and product_name column from SQLCAID transaction
SELECT product_id, product_name INTO :sProductID, :sProductName FROM product_master USING SQLCAID;

// will retrieve the product_id and product_name column from SQLCA (Default) transaction
SELECT product_id, product_name INTO :sProductID, :sProductName FROM product_master USING SQLCA;

Sunday, October 3, 2010

AVG Anti-Virus 2011 Free Edition Short Review

Release on Sept 28th, 2010, AVG Anti-Virus Free Edition 2011 brings some new features.

With around 110 MB file size, at least 2 new features added on this version.

1. Social Network Protection
With tag line: Keeps social networks safe for you and your friends, AVG brings the protection to all use who use the social network application. AVG will protect all the send and receive links freely knowing they've all been automatically checked for safety,

2. PC Analyzer

Module to scan your PC and report errors that affect its performance. There are 4 categories that will be analyze, including Registry, Junk Files, Fragmentation and Broken Shortcuts. You need to download separate module called: AVG PC TuneUp to fix all the errors. You only have once time free to fix the error, then you must purchase yearly to unlimited tuneup.

You can download the AVG Anti-virus 2011 Free Edition from their official site or via CNET's