Tuesday, November 25, 2008

Get data from Excel via the clipboard

OLEObject excel

Integer li_RetValue, li_rtn
Boolean lb_sheet_rtn
Long ll_cnt

excel = create OLEObject
li_rtn = excel.ConnectToNewObject("excel.application")
IF li_rtn <> 0 THEN
MessageBox('Excel erro','can not run Excel Program')
DESTROY excel
RETURN 0
END IF
excel.WorkBooks.Open( "c:\mysheet.xls" )
excel.Application.Visible = false
excel.windowstate = 2 // 1 : Normal, 2 : Minimize, 3 : Maximize
lb_sheet_rtn = excel.worksheets(1).Activate
excel.Worksheets(1).Range("A1:E5000").Copy // copy to clipboard
ll_cnt = dw_1.importclipboard()
IF ll_cnt <<= 1 THEN
Messagebox("Inf", "Could not find .")
END IF
excel.Worksheets(1).Range("A10000:A10000").Copy //reset clipboard
excel.Application.Quit
excel.DisConnectObject()
DESTROY excel

Monday, November 24, 2008

Scroll 2 datawindows in sync

[ScrollVertical event of dw_1]
dw_2.Object.datawindow.verticalscrollposition = scrollpos

Detect if a row is new

dwitemstatus rowstatus
IF dw.GetRow() > 0 THEN
rowstatus = dw.GetItemStatus( dw.GetRow(), 0, Primary! )
IF rowstatus = New! OR rowstatus = NewModified! THEN
// new row
ELSE
// not new
END IF
END IF

Display only distinct rows

First you need to Sort() the datawindow based on the columns that need to be distinct. After you apply a Filter(), to filter out the non-distinct rows.
For example, we have a datawindow with a column named prod_id and we want to display only one row for each prod_id.
First we turn off the datawindow redraw function to speed up the operation

dw_1.setredraw(false)
Sort the rows based on the prod_id column
dw_1.setsort("prod_id a")
dw_1.sort()
Define the appropriate Filter
dw_1.SetFilter("IsNull(prod_id[-1]) OR prod_id[-1] <> prod_id")
dw_1.filter()
Finally turn back on the datawindow redraw
dw_1.setredraw(true)

Make the ENTER key act as TAB key

First, define a user event to correspond with the pbm_dwnprocessenter event on a datawindow. Then in that event :
Send(Handle(this),256,9,Long(0,0))
RETURN 1

Memory usage with PB7 and MS SQL direct driver

The memory used on the client is very large during a connection and on disconnect it comes back down again.
The fix is to put something in the DBParm property of the SQLCA object. Something like "Application='MyApp'" or whatever. In the development environment, edit the connection properties and make sure something is in the Application Name or Workstation Name on the Network tab.

Display PDF into a Window

Insert the "Adobe Acrobat ActiveX control" OLE control on the window.
Then to load a document from Powerscript
ole_1.object.LoadFile("C:\realhowto-pdf")
With a tool to explore the pdf.ocx, there are more functions :
function LoadFile(none fileName: WideString): WordBool [dispid $00000002]; stdcall;
procedure setShowToolbar(none On: WordBool) [dispid $00000003]; stdcall;
procedure gotoFirstPage [dispid $00000004]; stdcall;
procedure gotoLastPage [dispid $00000005]; stdcall;
procedure gotoNextPage [dispid $00000006]; stdcall;
procedure gotoPreviousPage [dispid $00000007]; stdcall;
procedure setCurrentPage(none n: Integer) [dispid $00000008]; stdcall;
procedure goForwardStack [dispid $00000009]; stdcall;
procedure goBackwardStack [dispid $0000000A]; stdcall;
procedure setPageMode(none pageMode: WideString) [dispid $0000000B]; stdcall;
procedure setLayoutMode(none layoutMode: WideString) [dispid $0000000C]; stdcall;
procedure setNamedDest(none namedDest: WideString) [dispid $0000000D]; stdcall;
procedure Print [dispid $0000000E]; stdcall;
procedure printWithDialog [dispid $0000000F]; stdcall;
procedure setZoom(none percent: Single) [dispid $00000010]; stdcall;
procedure setZoomScroll(none percent, left, top: Single) [dispid $00000011]; stdcall;
procedure setView(none viewMode: WideString) [dispid $00000012]; stdcall;
procedure setViewScroll(none viewMode: WideString; none offset: Single) [dispid $00000013]; stdcall;
procedure setViewRect(none left, top, width, height: Single) [dispid $00000014]; stdcall;
procedure printPages(none from, to: Integer) [dispid $00000015]; stdcall;
procedure printPagesFit(none from, to: Integer; none shrinkToFit: WordBool) [dispid $00000016]; stdcall;
procedure printAll [dispid $00000017]; stdcall;
procedure printAllFit(none shrinkToFit: WordBool) [dispid $00000018]; stdcall;
procedure setShowScrollbars(none On: WordBool) [dispid $00000019]; stdcall;
procedure AboutBox [dispid $FFFFFDD8]; stdcall;
But there is no documentation about them. You can download a free SDK (you need to register) but I believe that you need the Acrobat package to fully use it.
http://partners.adobe.com/asn/acrobat/download.jsp#fullinstall

POWERMIGRATOR


PowerMigrator™ as a service is basically a combination of tool, process & methodology to migrate PowerBuilder application to J2EE or .Net platform based on the requirement.
PowerMigrator™ Components
PowerMigrator™ comprises of a tool (front-end GUI generator) and a Framework (Server side components and environment), which will work in conjunction or insync with each other.
PowerMigrator™ - The Tool
The PowerMigrator™ is a tool, which migrates the Power Builder client/Server application to the web with a minimal of effort. This tool automatically generates GUI components with the same look and feel of the Rich client depending on the required target platform, J2EE or .Net
The PowerMigrator™ tool environment also assists in segregating the business logic and data access logic which in turn will be deployed in the application server.

PowerMigrator™ - The Framework
PowerMigrator™ is a framework, which is deployed in the application server and the web server respectively. This framework will work as a core technology. The migrated business logic and data access logic component will reside on top of this core and work seamlessly to coordinate between web server, application server and database server.
The PowerMigrator™ framework also contains many pre-developed components such as report management, query generation, lookup generation, error handling, dropdown data population etc to name a few, which can be reused and customized according to the user requirement. The benefits are that it reduces the development and testing time.
PowerBuilder to Web
Migrate your PowerBuilder client/ server application to the J2EE based application retaining the look and feel, and functionality of your original application. Our automated process is inexpensive with a faster time to market.
PowerBuilder to .Net
If your organization's direction is in moving to the .Net Platform, we will help you, recover the investments made on PowerBuilder, by migrating your PowerBuilder application to the .Net platform.
PowerBuilder to VB.Net
PowerMigrator™ for VB.Net: - The tool, migrates the Power Builder client/Server application to VB.Net application. This tool automatically generates the WinForm for GUI from PowerBuilder window and Datawindow objects with the same look and feel of the existing PowerBuilder application, offering user friendliness. The GUI code generation will drastically reduce the development time while migrating to .Net platform.
The PM.Net (Framework), deployed in .Net server will take work in synchronization with the business components migrated from the original application.
PowerBuilder to ASP.Net
PowerMigrator™ for ASP.Net: - The tool, migrates the Power Builder client/Server application to .Net application. This tool automatically generates the WebForm for GUI from PowerBuilder window and Datawindow objects with the same look and feel of the existing PowerBuilder application, offering user friendliness. The GUI code generation will drastically reduce the development time while migrating to .Net platform.

The PM.Net (Framework), deployed in .Net server will take work in synchronization with the business components migrated from the original application.
Reference : http://www.ewaksoft.com/html/overview.html

PowerBuilder Maintenance , Performance and Tuning

Today's dynamic business environment requires that businesses update their applications continuously, thereby smoothly reflecting changing business processes. Taking into account that the PowerBuilder applications in most of the organizations are still legacy applications it is all the more necessary to maintain them. Ewak’s Application Maintenance services provide the legacy system maintenance and enhancement services to relieve your programmers to stay focused on enhancing your business requirements that are more crucial to your business. Statistics have proved that the application Maintenance, takes up a lot of time and your in-house resources, leaving them with little time to focus on developing and directing new strategies for your immediate business needs.
Outsourcing your Power Builder Application to Ewak:Ewak is a software company with core competencies in PowerBuilder over the last few years. The benefits of outsourcing your PowerBuilder application are
- Reduction in maintenance, support and enhancement costs
- Faster time to market for new initiatives
- Redeployment of your staff to other projects.
Some of our maintenance offerings:
- Maintenance
- Preventive and Corrective Maintenance
- Bug Fixing (Root Cause Analysis)
- Analysis and Problem Resolution
- 24 X 7 support
- Technical help desk support
- Code review
Production Support
- Monitoring of Environment.
- Database Backups.
- Remove Redundant tables.
- Account Maintenance.
Additional Services
- Upgrade the application from lower version of PowerBuilder to Latest Versions of PowerBuilder.
- We upgrade PowerBuilder version PB3.0, PB4.0, PB5.0, PB6.0, PB6.5, PB7.0,PB8.0, PB9.0 to the latest version PB11.0
Source : http://www.ewaksoft.com/html/pbmaintenance.html

Migrate your PowerBuilder Applications to WEB

Legacy applications are frequently large, monolithic and difficult to modify, and scrapping or replacing them often means reengineering an organization’s business processes (workflow) as well. Legacy migration is about retaining and extending the value of the legacy investment through migration to new platforms. Re-implementing applications on new platforms in this way can reduce operational costs, and the additional capabilities of new technologies can provide access to valuable functions such as Web Access to the client. Once migration is complete the applications can be aligned more closely to current and future business needs through the addition of new functionality to the migrated application. The goal of Ewak’s Power Migrator™ , migrating PowerBuilder™ to J2EE addresses the above business need. J2EE defines the standard for developing multi-tier enterprise applications. The J2EE platform simplifies enterprise applications by basing them on standardized, modular components, by providing a complete set of services to those components, and by handling many details of application behavior automatically. Portability and scalability are also important for long-term viability. Enterprise applications must scale from small working prototypes and test cases to complete 24 x 7, enterprise-wide services, accessible by tens, hundreds, or even thousands of clients simultaneously Ewak’s Power Migrator™ enables the legacy PowerBuilder client Server application’s business code to be ported to the middle tier as components for portability and scalability

PFC Security Q and A

- How do I enable the PFC security service?
A common place to do this the pfc_postopen event of w_frame
gnv_app.of_SetSecurity(True) //Enable security service
- How do I force security to run on a particular object
Argument can be Window, GraphicObject, or DataWindow variable containing the window, DataWindow, or window control for which security is applied.
lb_rc = gnv_app.inv_security.of_SetSecurity(lw_frame)
- How do I initialize the security service?
When initializing the security service, the last argument is used if the user was not assigned to any other group.
inv_security.of_InitSecurity(SQLCA, ClassName(iapp_object), of_GetUserID(), “Default”) //Initialize the security service
- How do I enable security on each applicable window?
In the window open or pfc_preopen event
gnv_app.inv_security.of_SetSecurity(This)

Adding PFC Help to the PowerBuilder Menu

- In the development environment, right click on the menu and select “Customize”
- Click on the Custom radio button
- Drag a new icon to the spot on the menu
- A modal window pops up:
- Command line should have the following text: (note the location of the PFC help file on your PC may be different)
winhlp32.exe C:\Program Files\Sybase\PB6\pbpfc60.hlp
- Add Item Text
- Add Item Microhelp

Remove extra padding blanks in char column

If a char(5) column contains only "a", some drivers are returning "a " and some "a" with the extra spaces removed.
For example, the trimming is done with SQLServer or Access but not for DB/2 or Ingres DBMS. Padding blanks in Char column are Ok according to the ANSI SQL standard it may be easier to assume that extra right spaces are trimmed.
You can let PB do the job for you by adding this parameter in the PBODB60.INI file (in the Sybase Shared folders) :
PBTRIMCHARCOLUMNS='YES' in the section for your DBMS. With that setting, Pb will trim blanks in datawindows only.

Allow user:password in URL

The following URL syntax is no longer supported in Internet Explorer or in Windows Explorer after you install the MS04-004 Cumulative Security Update for Internet Explorer (832894):
http(s)://username:password@server/resource.ext
This change in the default behavior is also implemented by security updates and service packs that were released after the 832894 security update.
By default, this new default behavior for handling user information in HTTP or HTTPS URLs applies only to Windows Explorer and Internet Explorer. To use this new behavior in other programs that host the Web browser control, create a DWORD value named SampleApp.exe, where SampleApp.exe is the name of the executable file that runs the program. Set the DWORD value's value data to 1 in one of the following registry keys.
For all users of the program, set the value in the following registry key:
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\
Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE
For the current user of the program only, set the value in the following registry key:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\
Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE
To disable the new default behavior in Windows Explorer and Internet Explorer, create iexplore.exe and explorer.exe DWORD values in one of the following registry keys and set their value data to 0.
For all users of the program, set the value in the following registry key:
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\
Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE
For the current user of the program only, set the value in the following registry key:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\
Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE
ref Microsoft Article ID : 834489

Disconnect an inactive application

[application idle event]
gnv_app.event pfc_idle()

[appmanager contructor event]
Idle(3600) // that's 3600 seconds


[appmanager pfc_idle event]
IF SQLCA.of_IsConnected() THEN
SQLCA.of_Disconnect()
// HALT CLOSE the application
// or call the pfc_logon event
END IF

PowerBuilder wins Visual Studio Magazine Award Readers Choice Merit Award

Sybase announced that it has been recognized by Visual Studio Magazine with a Readers Choice Merit Award in the category of Software Design, Frameworks and Modeling Tools. The annual awards honor the best Visual Studio-focused tools in 22 categories, and the winners are selected by readers of Visual Studio Magazine. Winners are recognized in three overarching categories, including Readers Choice, Readers Choice Merit and Editors Choice. The Readers Choice Merit category, in which PowerBuilder was recognized, is reserved for products that received a high number of votes, and also demonstrated clear value to Visual Studio Magazine readers. The editors of the magazine note that the Readers Choice awards are particularly significant because they reflect the preferences of the actual users who have daily experience with a broad range of Visual Studio developer tools. The winning products were chosen because they help professional developers do their jobs more efficiently and cost-effectively.

SQL Anywhere for the BlackBerry

Sybase iAnywhere announced it will preview SQL Anywhere for the BlackBerry platform from Research In Motion at the Wireless Enterprise Symposium 2008, and deliver the product as part of the upcoming SQL Anywhere 11 release. With the release, SQL Anywhere’s proven mobile database and synchronization platform is extended to the BlackBerry platform, providing application developers the ability to develop data rich applications for the frontlines of their business.


SQL Anywhere, with over 10 million deployed licenses and powering thousands of embedded and mobile database applications, now offers the increasing number of BlackBerry developers a full SQL relational database and data synchronization client. Developers now will be able to build powerful mobile-centric line-of-business applications such as field service, CRM, asset management, and survey applications on the BlackBerry platform, and integrate them with enterprise systems. Highly mobile industries — from healthcare to transportation/logistics — will benefit from the ability to approve work orders, check inventory and manage customer data in the field and on the go.

SQL Anywhere ADO.Net 3.5 provider

Sybase iAnywhere continues its long-standing commitment and early release of .NET enhancements, announcing delivery on its promise to support ADO.NET Entity Framework and LINQ to Entities. .NET developers can download the SQL Anywhere(R) Entity Framework and ADO.NET 3.5 provider by registering for the SQL Anywhere 11 beta.


SQL Anywhere, with over 10 million deployed licenses and powering thousands of embedded and mobile database applications, is enabling .NET application developers to remove complexity and increase productivity by using .NET objects and IntelliSense. Developers can use the Entity Data Model Designer to define a stable, secure object database layer for their Windows and ASP.NET applications, avoiding SQL statements, complex joins, and parameter binding.

Speed in Development. Speed in Deployment. Speed in Performance.


PowerBuilder 11.2 will be available shortly and we are holding a Web seminar with John Strano to highlight the key features of this release. During this Web seminar, John will show you the new capabilities found in PowerBuilder 11.2 that bring increased performance to your mission-critical applications, including using AJAX and .NET development to EAServer. In addition, John will show you a range of as well as database, UI, and usability enhancements.

The PowerBuilder 11.2 webcast will cover:


Certificate Store Support for Smart Client-published Applications
Usability and UI Enhancements
Database Connectivity Enhancements
Enabling the DEBUG Condition for ORCA and OrcaScript
Application Pools for Web Forms in IIS7
EAServer Support for .NET-deployed PowerBuilder Clients
AJAX Functionality for WebForm-Deployed Applications

Monday, November 17, 2008

Sybase PowerBuilder Takes Honors in Mobile Star Awards

Sybase took honors in several categories of the Mobile Star Awards, including a Gold in the Application Development category for PowerBuilder.

Application Development
Gold Star - Sybase PowerBuilder

Database
Gold Star - Sybase SQL Anywhere

Email
Silver Star - Sybase iAnywhere - Mobile Office

Middleware
Gold Star - Sybase iAnywhere Suite

PowerBuilder in a .NET World seminars in Australia

PowerBuilder in a .NEW World seminars will be held Friday November 14th in Sydney and Thursday November 20th in Melbourne.

Also, special Moving to PowerBuilder 11.5 Masterclasses will be held in Sydney and Melbourne.
PowerBuilder Advanced Development Tour :

PowerBuilder 11.5 just came out and Sybase will share how the new features and capabilities will help accelerate your development, bring aesthetic enhancements to your PowerBuilder applications, and simplify .NET development at the PowerBuilder Advanced Development Tour. So far the dates include:

Washington DC: November 13th 2008 at the Hyatt Regency
Boston: November 19th at the Burlington Marriott
New York City: November 17th 2008 at the Grand Hyatt

PowerBuilder Accelerated Development Tour

Sybase hitting the road to bring the latest in PowerBuilder news, code, and goodies to you.

PowerBuilder 11.5 just came out and we want to share how the new features and capabilities will help accelerate your development, bring aesthetic enhancements to your PowerBuilder applications, and simplify .NET development. We are also working fast and furiously on delivering PowerBuilder 12, which blend the Visual Studio Isolated Shell with the prowess of DataWindow and PowerBuilder technology. Fresh from the labs, we will give you a sneak peek of arguably the biggest news for PowerBuilder since its inception: PowerBuilder 12.



Detailed Overview of Topics

PowerBuilder 11.5
The release of PowerBuilder 11.5 brings a multitude of new capabilities and features that will help accelerate your development, bring aesthetic enhancements to your PowerBuilder applications, and simplify .NET development. Topics covered will include DataWindow® innovations, Native ASE 15, SQL Server® 2008, and Oracle 11g drivers, .NET enhancements: Strong Named Assemblies and IIS7 Support, Security features such as.NET CAS and FDCC, and new premiums included with PB Enterprise: PocketBuilder™ and PowerBuilder Application Server Plug-in.



Sneak Peek at PowerBuilder 12
We're going to cover the new exciting and revolutionary features being built into PowerBuilder 12 including:

Visual Studio Isolated Shell
Front to back WPF
Fully Managed Code @ Runtime
WPF DataWindow
WCF Support
Latest in Web Services technologies
Oracle, Sybase, Informix, and SQL Server Support
Custom Search