Wednesday, November 30, 2011

Web Service with Powerbuilder

Since Powerbuilder 10, Sybase introduced the web service feature.

According to Wikipedia, A Web service is a method of communication between two electronic devices over the web. In other word, is a brigde technology for communicating 2 different devices over the web.

Simple explaination, imagine that you want to build a web project, and want to put status ticker to show the exchange rate from your bank. As long as your bank has a web service system to provide their customer to check the exchange rate, you can use it without making an own coding. You just need ask the bank for documentation how to use the exchange rate function.

In this article, I want to show you how to build web service within Powerbuilder and call it from Visual Studio in ASP.NET Visual basic language.

Global explaination is:
  1. Build 1 function in Powerbuilder as a web service to add 2 values or numbers and display the result.
  2. Put the web service in a server, let say the name is: abc.com
  3. Build 1 web project in Visual Studio, and put at xyz.com as a web server
  4. Call the function from abc.com from xyz.com
In this sample, I'm using Sybase Powerbuilder 12.5 Classic Evaluation version, and Microsoft Visual Studio 2008.

Chapter 1 - Building a web service in Powerbuilder
  1. Create a new Workspace and name it as you like (Pict 1)
  2. Create a new Target, choose .NET Web Service, and give a name as n_webservice (Pict 2a and 2b)
  3. Create a new FUNCTION in n_web service object, called of_add2number. Return type is Decimal. Add 2 value arguments in Decimal type, and named it as ARG1 and ARG2
  4. In a script canvas, type RETURN ARG1 + ARG2 (Pict 3)
  5. Create a new new Project and give p_webservice as a name (Pict 4)
  6. In Object tab, make sure you check the of_add2number function in Message Name list. (Pict 5)
  7. Deploy the project, by clicking menu Run then Deploy web service
  8. Make sure that you didn't get an error when you deploy the web service
  9. Let say you uploading the web service into your web server at http://ww.abc.com/webservice directory
Pict 1

Pict 2a
Pict 2b
Pict 3
Pict 4
Pict 5


Chapter 2 - Calling the web service from Visual Studio
  1. Create a new web project and give WSPB as the name, IN OTHER COMPUTER / PC
  2. In Solution Explorer window, right click the WSPB project, and choose Add Web Service
  3. In URL field, fill in with http://www.abc.com/webservice/n_webservice.asmx?WSDL then click Go
  4. It should be like an picture 10, rename the Web reference name as wsPBObj then click Add Reference button. Now we have a web service object with wsPBObj as a name. (Pict 6)
  5. In Default.aspx, add:
  • 2 textboxes and named it as tbNum1 and tbNum2
  • 1 label as lblResult
  • 1 button.
     6. In code behind at Button1 Click event, type the following code.

1:  Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click  
2:       Dim wsFromPB As New wsPBobj.n_webservice  
3:    
4:       Dim dResult As Decimal  
5:       Dim dNum1 As Decimal  
6:       Dim dNum2 As Decimal  
7:    
8:       dNum1 = System.Convert.ToDecimal(tbNum1.Text)  
9:       dNum2 = System.Convert.ToDecimal(tbNum2.Text)  
10:    
11:       dResult = wsPBFromPB.of_add2number(dNum1, dNum2)  
12:    
13:       lblResult.Text = dResult.ToString  
14:  End Sub  

     7. Click Ctrl + F5 to run the form and try to put 10 in Number #1 and 65 in Number #2, click EQUAL (Pict 7).
Pict 6
Pict 7

Wednesday, October 26, 2011

Motorola RAZR hands-on: First look

By GSMArena team

When the original Motorola RAZR came out in 2004 it turned the mobile world upside down with its slim profile and impressive design. Motorola sold more than 50 million units of the device, which makes it the all time best-selling clamshell. However, Motorola didn't quite manage to continue riding the enormous wave of success which the RAZR set and inevitably lost momentum.

Friday, October 21, 2011

NIKON AF-S DX 55-300mm f/4.5-5.6G VR

I just bought this lens 2 weeks ago for around $ 333. Here are some photos which taken with this lens and my Nikon D3000.

All this photos are copyright by me, you are prohibited to publish or to repro or to copy for any purposes.

Wednesday, October 12, 2011

Sony Suspends 93K Online Accounts After Security Breach

Sony Corp. said Wednesday it had found a "large amount" of unauthorized sign-in attempts on its PlayStation Network and other online entertainment services, and that it has temporarily suspended about 93,000 user accounts for those services.

The Japanese electronics and entertainment giant said in a statement that credit card details for those user accounts are "not at risk," Dow Jones Newswires reported.

Wednesday, October 5, 2011

Play MP3 with Powerbuilder


This is the tips how to play single MP3 file with Powerbuilder script

First, declare external function called mciSendStringW. This function originally is from winmm.dll file. When I tried this function, I'm using Windows XP with SP2.

1:  Public Function long mciSendStringW (string lpstrCommand, ref string lpstrReturnString, long uReturnLength, long hwndCallback) Library "winmm.dll"  

then use following script to run mp3 file,

1:  string ls_string  
2:  ls_string=space(500)  
3:    
4:  mcisendstringW("Play "+<your mp3 file including the path>,ls_string,len(ls_string),0)  

to stop the playback,

1:  mcisendstringW("Stop "+<your mp3 file including the path>,ls_string,len(ls_string),0)  

iOS 5 drops October 12th, includes wireless iOS updates

By McKinley Noble and Chris Holt, GamePro

Apple is taking a page from rival competitor Android, with iOS 5 now providing wireless updates and scrollable notifications for App updates. 

Notifications: Apple's new Notification Center feature now groups every update in your iOS device in one place, rather than scattering the reminders in various push notifications. It's a smart solution for people with several apps on their iPhones and iPads that undergo regular updates.

Tuesday, September 27, 2011

How to read Windows Active Directory with Powerbuilder


Here is the tips and trick how to read Windows Active Directory in Powerbuilder script, made by William Franklin (wfranklin@plg.cc) with Powerbuilder version 8, but I'm sure it will run smoothly in other newest version.

First of all we cannot retrieve the password from LDAP, only we can validate the password against it. Here is the code, do the following steps and I tested it in my network it is working fine.

Wednesday, September 14, 2011

INI file with Powerbuilder

In the world of Windows, INI files is one of the most widely file encountered. INI is an acronym for Initialization. Usually processed when an application has just started. INI file typically contains configuration data of an application.

INI file is essentially a plain text file that has a standard structure. For more details, please see http://en.wikipedia.org/wiki/Ini_file

Monday, September 12, 2011

How to check mandatory column in Powerbuilder

Often, we need to check whatever the user(s) fill or not the mandatory columns.

One of my team mates made the function check all the mandatory columns in one datawindow.

His idea is to utilize the TAG property in every columns. Just fill the TAG property value with Column's full name, if you think that column is mandatory.

Friday, July 29, 2011

How to extend your notebook screen to projector

One of the feature of notebook is capability to extend the screen into external device, like second monitor or even  huge large screen via projector. To turn on this feature, user need to do some press of button combination shortcut. For the latest notebook can done with the software side.

Every brands of notebook or laptop has their own button combination to turn this capability. Commonly, their using combination between Fn button with Fx button. Fn means Function button, where Fx are F1 - F12 button. Normally, Fn button is located at the lower row of keyboard, and F1 - F12 are at the top of keyboard.

Thursday, July 14, 2011

Toshiba Thrive's Review

Just read my twitter, and found this article about Toshiba Thrive's review by Wall Street Journal. Thrive is first (actually second) Android tablet from Toshiba. The first is AS100 which i have reviewed couple months ago.

Here's the tweet from the original author. Click the link to see the full review.

RT @allthingsd: Toshiba Thrive Tablet Strives to be More Like a Laptop -by @waltmossberg http://dthin.gs/oRdz90 BlogBooster-The most productive way for mobile blogging. BlogBooster is a multi-service blog editor for iPhone, Android, WebOs and your desktop

Monday, June 27, 2011

Creating MDI Window with Background in Powerbuilder

MDI Window is a type of window that have capabilities to have a menu inside, microhelp bar, Child window inside, etc. Unfortunally, it can't be have an image background capability, at least in Powerbuilder programming. MDI is standing for Multiple Document Interface.

Tuesday, June 7, 2011

What's new in WWDC 2011 ?

iOS5
Forget about USB Cable, forget about iTunes. With iOS5 you can now setup and activate your iDevices right on the device and you are ready to go.
  • Notification Center
  • Newstand
  • Twitter Integration
  • Safari Reader
  • Reminders
  • Lock screen shortcut
  • Volume-up to take picture
  • Mail new features: Identation control, RTF, draggable addresses, search entire message, flag messages, S/MIME, built-in dictionary, split-keyboard 

Wednesday, May 25, 2011

Part 2 - Create Object Programmatically with Powerbuilder

In the previous article, I shown you how to create an object programmatically in Powerbuilder with static object. Now, I'm trying to explain, how if we want to add scripts associated inside the object.


For the first step, you need to create a Window and save it as "w_clickanddrag"

Unlike the static, if you want to add scripts inside the object, you need to create and utilize the user object.

So, create a new Picture user object, with Standard Visual type. Saved and named it as "uo_picture".

Thursday, April 28, 2011

Create Object Programmatically with Powerbuilder - Part 1

In Powerbuilder, we can create an object programmatically, means that you can create whenever you need or conditionally.

In this first part, I trying to explain how to create "static" picture object when user clicking the button. Static mean that we only create the object, without script associated inside the object. The function that will be used it's called: openuserobject

Wednesday, April 27, 2011

Click and Drag with Powerbuilder

This article will show you how to make an object to be click and drag capable in Powerbuilder. In this case, I'm using Powerbuilder 9.0 and Picture Object. In this version, I found DragAuto property in the list of the picture property, one that I can't found in version 6.5. I'm not sure, since when Sybase added this property.

Thursday, February 10, 2011

Printing shrink in IE7 and IE8

Some of my users facing the font shrink-ed when they tried to print the web page with Internet Explorer (IE) version 7 or 8.

To solve this case, if you are using version 8, make sure the option Shrink to Fit option in Page Setup menu, in your IE, is unchecked.

If you are using Internet Explorer version 7, you need to add the Registry Key by doing the steps below:
On the command prompt, type the following statement:

Thursday, January 20, 2011

Toshiba Satellite Pro L640 Review


Toshiba Satellite Pro L640 deliberately designed to run faster than any other Satellite series. 14-inch wide-screen support the easy mobility of users. No doubt Notebook Toshiba Satellite Pro L640 in circles like the design for students and professionals.Again, an interesting texture to be lethal for young people. 

Nintendo 3DS Software Estimated Price


Since Nintendo hasn't given any official word on this subject yet, Joystiq was kind enough to look into retailer price listings for 3DS software. From what we're seeing, it looks like anywhere from $40-50 a pop for a 3DS game card - or in other words games priced at relatively the same cost as Wii games. Now, considering we're getting more for our money, this certainly isn't surprising, but with game prices climbing this high it's hard to say that handheld gaming is shaping up to continue to be the affordable alternative to consoles.

Read more at here

Friday, January 14, 2011

[Updated] Toshiba Folio AS100 Short Review

My last post about Toshiba Folio AS100 review said that the camera quality is poor. Now I want to make a correction that the camera quality is fair for 1,3 MB resolution. All because my boss put the screen protector which block the webcam.

When I tried to remove the screen protector, the camera work well with the fair quality.

Also I have more times to try the Folio. Since the Toshiba doesn't provide the Android Market application yet (confirmed by the Toshiba, but they said they will launch the Android Market for the Folio somewhere in January 2011), you can try to download the applications with the 3rd party applications like Camangi Market or via pandaapp.com

I've tried to install some games and Youtube viewer, some of them work well, some are not.

Friday, January 7, 2011

AVG 2011 Offline Full Installation Download

As the default, when you want to download the AVG 2011 free version, you only download the basic installation file, then you must have the internet connection to continue to finish the installation.

Some times you have another computers (PC / Notebook), which have no internet connection. How to install the AVG 2011 antivirus to the offline computers ?

Just download the offline full installation file from http://free.avg.com/in-en/download.prd-afh, then install it into each offline computers. The installation is for Windows XP, Vista, and Windows 7, both for 32 or 64 bits. And also you can find the newest updates of AVG 2011 in the link.

Thursday, January 6, 2011

Toshiba Folio AS100 Android Tablet - Short Review

Just got Toshiba Folio AS100 from my boss, the first Android tablet from Toshiba.

First impression, it quite good design compared to another tablets. I only have around half hour to try the Folio
 

Motorola Xoom

Motorola has just outed its delicious Honeycomb tablet alongside another device, the LTE-equipped Bionic, on its official site.  A 1GHz dual-core Tegra 2 offers the power from within, and 4G connectivity will apparently be available as an update in Q2 following a Q1 launch. Other specs include a 1280 x 800 resolution, 5 megapixel camera, 720p video recording and 1080p video playback, 802.11n WiFi, Bluetooth 2.1 + EDR, and finally, a healthy 32GB of onboard storage.