Get Blogged by JoKi

"The only frontiers are in your mind"
06 | 02 | 2012
Navigation
Syndication
RSS feed syndication RSS 2.0
Latest Tweets
Most Read Articles
Related Resources
Article Time Line
About me
Microsoft MVP - Visual Developer for Visual FoxPro 2006 & 2007

Microsoft Certified Professional

Get in contact

Sharing is caring

Recent books

  • MCTS 70-536 - .NET Framework 2.0 Application Development Foundation
  • Code-Centric: T-SQL Programming with Stored Procedures and Triggers
  • Microsoft .NET Framework-Programmierung in C#

Community

deutschsprachige FoxPro User Group

Microsoft Community Leader/Insider Program

International .NET Association

O'Reilly Verlag
Sponsoring
If you like the information on these pages, your support is highly appreciated.
Thank you very much!
Validation

Valid XHTML 1.0 Transitional
Valid CSS!
Valid RSS
Valid Atom 1.0

Spacer for layout formatting
Microsoft Virtual Academy PDF Version
Development
Thursday, 13 October 2011 11:15

Carpe Diem

It's been since a while that I could write an article for this blog but alas, I was (and still am) very busy with customer's work. Which is actually good. So, what is this article going to tell you? Well, in general, just what I already tweeted, that life is constant process of learning - especially as software craftsman.

Due to an upcoming new customer project in ASP.NET I had to seize the opportunity to get my head deeper into latest available technologies, like Windows Azure and SQL Azure. I know... cloud computing and so on is not a recent development and already available since quite a while but I never any means to get myself into this since roughly two weeks ago.

Microsoft Virtual Academy

I can't remember exactly what guided me towards the Microsoft Virtual Academy (MVA), oh wait... Yes, it was a posting on Facebook from an old CLIP community friend. He posted a shortened URL with #MVA tag that caught my attention. Thanks for that Thomas Kuberek. After the usual sign in or registration via Live ID I was a little bit surprised that Mauritius is not an available country option... Quick mail exchange with the MVA Decan, and yeah, apologies for the missing entry. So, currently I'm learning about Microsoft products and services, and collecting points under "Not Listed Country" until Mauritius is going to be added. Hopefully soon, as MVA honors your effort with different knowledge ranks that are compared to other students with public profiles. I think it's a nice move to add some game and competition factor into the learning game.

The tracks and their different modules are mainly references to publicly available material online, namely on either MSDN, TechNet, Channel9, or other Microsoft based sites. The course material therefore also varies in different media and formats, ranging from simple online articles over downloadable documents (.docx or .pdf) to Silverlight / Windows Media streams with download options.

Self-assessment and students ranking

Each module in a track can be finished by taking part in a self-assessment. Up to now, the assessment I did (and passed) were limited to 10 minutes available time, and consisted of six to seven questions on the module training material. Nothing too serious but it gives you a glimpse idea how Microsoft certification exams are structured.

Conclusion

Nothing really new but nicely gathered, assembled and presented to the MVA students. At the moment, I wouldn't dare to compare the richness and quality of those courses with professional training offers, like Pluralsight .NET Training, LearnDevNow, VTC, etc. at all, but I think that MVA has potential.

Give it a try, and let me know about your opinions.

Add a comment
 
Using Lightbox with _Screen PDF Version
User Rating:rating indicator fullrating indicator fullrating indicator fullrating indicator fullrating indicator full / 4
PoorBest 
Development
Sunday, 31 October 2010 12:06

Although, I have to admit that I discovered Bernard Bout's ideas and concepts about implementing a lightbox in Visual FoxPro quite a while ago, there was no "spare" time in active projects that allowed me to have a closer look into his solution(s). Luckily, these days I received a demand to focus a little bit more on this. This article describes the steps about how to integrate and make use of Bernard's lightbox class in combination with _Screen in Visual FoxPro.

The requirement in this project was to be able to visually lock the whole application (_Screen area) and guide the user to an information that should not be ignored easily. Depending on the importance any current user activity should be interrupted and focus put onto the notification.

Getting the "meat", eh, source code

Please check out Bernard's blog on Foxite directly in order to get the latest and greatest version. As time of writing this article I use version 6.0 as described in this blog entry: The Fastest Lightbox Ever

The Lightbox class is sub-classed from the imgCanvas class from the GdiPlusX project on VFPx and therefore you need to have the source code of GdiPlusX as well, and integrate it into your development environment. The version I use is available here: Release GDIPlusX 1.20

As soon as you open the bbGdiLightbox class the first it, VFP might ask you to update the reference to the gdiplusx.vcx. As we have the sources, no problem and you have access to Bernard's code. The class itself is pretty easy to understand, some properties that you do not need to change and three methods: Setup(), ShowLightbox() and BeforeDraw()

The challenge - _Screen or not?

Reading Bernard's article about the fastest lightbox ever, he states the following:

"The class will only work on a form. It will not support any other containers"

Really? And what about _Screen? Isn't that a form class, too? Yes, of course it is but nonetheless trying to use _Screen directly will fail. Well, let's have look at the code to see why:

WITH This
.Left = 0
.Top = 0
.Height = ThisForm.Height
.Width = ThisForm.Width
.ZOrder(0)
.Visible = .F.
ENDWITH

During the setup of the lightbox as well as while capturing the image as replacement for your forms and controls, the object reference Thisform is used. Which is a little bit restrictive to my opinion but let's continue.

The second issue lies in the method ShowLightbox() and introduced by the call of .Bitmap.FromScreen():

Lparameters tlVisiblilty
* tlVisiblilty - show or hide (T/F)
* grab a screen dump with controls
IF tlVisiblilty
Local loCaptureBmp As xfcBitmap
Local lnTitleHeight, lnLeftBorder, lnTopBorder, lcImage, loImage
lnTitleHeight = IIF(ThisForm.TitleBar = 1,Sysmetric(9),0)
lnLeftBorder = IIF(ThisForm.BorderStyle < 2,0,Sysmetric(3))
lnTopBorder = IIF(ThisForm.BorderStyle < 2,0,Sysmetric(4))
With _Screen.System.Drawing
loCaptureBmp = .Bitmap.FromScreen(ThisForm.HWnd,;
lnLeftBorder,;
lnTopBorder+lnTitleHeight,;
ThisForm.Width ,;
ThisForm.Height)
ENDWITH
* save it to a property
This.capturebmp = loCaptureBmp
ThisForm.SetAll("Visible",.F.)
This.DraW()
This.Visible = .T.
ELSE
ThisForm.SetAll("Visible",.T.)
This.Visible = .F.
ENDIF

My first trials in using the class ended in an exception - GdiPlusError:OutOfMemory - thrown by the Bitmap object. Frankly speaking, this happened mainly because of my lack of knowledge about GdiPlusX. After reading some documentation, especially about the FromScreen() method I experimented a little bit. Capturing the visible area of _Screen actually was not the real problem but the dimensions I specified for the bitmap.

The modifications - step by step

First of all, it is to get rid of restrictive object references on Thisform and to change them into either This.Parent or more generic into This.oForm (even better: This.oControl). The Lightbox.Setup() method now sets the necessary object reference like so:

*====================================================================
* Initial setup
* Default value: This.oControl = "This.Parent"
* Alternative: This.oControl = "_Screen"
*====================================================================

With This
.oControl = Evaluate(.oControl)

If Vartype(.oControl) == T_OBJECT
.Anchor = 0
.Left = 0
.Top = 0
.Width = .oControl.Width
.Height = .oControl.Height
.Anchor = 15
.ZOrder(0)
.Visible = .F.
EndIf
Endwith

Also, based on other developers' comments in Bernard articles on his lightbox concept and evolution I found the source code to handle the differences between a form and _Screen and goes into Lightbox.ShowLightbox() like this:

*====================================================================
* tlVisibility - show or hide (T/F)
* grab a screen dump with controls
*====================================================================
Lparameters tlVisibility

Local loControl
m.loControl = This.oControl

If m.tlVisibility
Local loCaptureBmp As xfcBitmap
Local lnTitleHeight, lnLeftBorder, lnTopBorder, lcImage, loImage

lnTitleHeight = Iif(m.loControl.TitleBar = 1,Sysmetric(9),0)
lnLeftBorder = Iif(m.loControl.BorderStyle < 2,0,Sysmetric(3))
lnTopBorder = Iif(m.loControl.BorderStyle < 2,0,Sysmetric(4))

With _Screen.System.Drawing
If Upper(m.loControl.Name) == Upper("Screen")
loCaptureBmp = .Bitmap.FromScreen(m.loControl.HWnd)
Else
loCaptureBmp = .Bitmap.FromScreen(m.loControl.HWnd,;
lnLeftBorder,;
lnTopBorder+lnTitleHeight,;
m.loControl.Width ,;
m.loControl.Height)
EndIf
Endwith

* save it to a property
This.CaptureBmp = loCaptureBmp
m.loControl.SetAll("Visible",.F.)
This.Draw()
This.Visible = .T.
Else
This.CaptureBmp = .Null.
m.loControl.SetAll("Visible",.T.)
This.Visible = .F.
Endif

Are we done? Almost... Although, Bernard says it clearly in his article:

"Just drop the class on a form and call it as shown."

It did not come clear to my mind in the first place with _Screen, but, yeah, he is right. Dropping the class on a form provides a permanent link between those two classes, it creates a valid This.Parent object reference. Bearing in mind that the lightbox class can not be "dropped" on the _Screen, we have to create the same type of binding during runtime execution like so:

*====================================================================
* Create global lightbox component
*====================================================================

Local llOk, loException As Exception
m.llOk = .F.
m.loException = .Null.

If Not Vartype(_Screen.Lightbox) == "O"
Try
_Screen.AddObject("Lightbox", "bbGdiLightbox")
Catch To m.loException
Assert .F. Message m.loException.Message
EndTry
EndIf
m.llOk = (Vartype(_Screen.Lightbox) == "O")

Return m.llOk

Through runtime instantiation we create a valid binding to This.Parent in the lightbox object and the code works as expected with _Screen.

Ease your life: Use properties instead of constants

Having a closer look at the BeforeDraw() method might wet your appetite to simplify the code a little bit. Looking at the sample screenshots in Bernard's article you see several forms in different colors. This got me to modify the code like so:

*====================================================================
* Apply the actual lightbox effect on the captured bitmap.
*====================================================================

If Vartype(This.CaptureBmp) == T_OBJECT
Local loGfx As xfcGraphics
loGfx = This.oGfx

With _Screen.System.Drawing
loGfx.DrawImage(This.CaptureBmp,This.Rectangle,This.Rectangle,.GraphicsUnit.Pixel)
* change the colours as needed here
* possible colours are (220,128,0,0),(220,0,0,128) etc.
loBrush = .SolidBrush.New(.Color.FromArgb( ;
This.Opacity, .Color.FromRGB(This.BorderColor)))
loGfx.FillRectangle(loBrush,This.Rectangle)
Endwith
Endif

Create an additional property Opacity to specify the grade of translucency you would like to have without the need to change the code in each instance of the class. This way you only need to change the values of Opacity and BorderColor to tweak the appearance of your lightbox. This could be quite helpful to signalize different levels of importance (ie. green, yellow, orange, red, etc...) of notifications to the users of the application.

Final thoughts

Using the lightbox concept in combination with _Screen instead of forms is possible. Already Jim Wiggins comments in Bernard's article to loop through the _Screen.Forms collection in order to cascade the lightbox visibility to all active forms. Good idea. But honestly, I believe that instead of looping all forms one could use _Screen.SetAll("ShowLightbox", .T./.F., "Form") with Form.ShowLightbox_Access method to gain more speed. The modifications described above might provide even more features to your applications while consuming less resources and performance. Additionally, the restrictions to capture only forms does not exist anymore. Using _Screen you are able to capture and cover anything.

The captured area of _Screen does not include any toolbars, docked windows, or menus. Therefore, it is advised to take this concept on a higher level and to combine it with additional classes that handle the state of toolbars, docked windows and menus. Which I did for the customer's project.

Add a comment
 
Future of Active FoxPro Pages - secured PDF Version
User Rating:rating indicator fullrating indicator fullrating indicator fullrating indicator fullrating indicator blank / 4
PoorBest 
Development
Wednesday, 29 September 2010 15:45
Finally some official news about Active FoxPro Pages, aka AFP. Wink

The German company BvL Bürosysteme Vertriebs GmbH bought all rights of Active FoxPro Pages from the insolvency stock. Being a former customer and intensive user of AFP since version 2.0 BvL has own interest in the continuation of AFP on current and future web servers.

Together with their partners Christof Wollenhaupt (Foxpert Software Development & Consulting) and Jochen Kirstätter (IOS Indian Ocean Software Ltd) BvL will continue with development, support and marketing of AFP in the upcoming weeks.

There will be an updated version of AFP, the relaunch of the website, re-enabling of activation server, re-establishment of support channel, and much more...

Personally, I am relieved that this superb product made its way out of the dust of the past years. And of course, to be involved (again) in the development and support of Active FoxPro Pages gives me a big smile. Laughing
Rest assured that there will be more articles on AFP soon!

Here is the original announcement of 27th September 2010 from the online forum of German FoxPro Usergroup (dFPUG) - section Active FoxPro Pages:

Liebe AFP Anwender, liebe FoxPro Gemeinde,

nach den Insolvenzen der ProLib Software GmbH und der ProLib Tools GmbH gab es einige Verunsicherung über die Zukunft der Active FoxPro Pages.

Wir können euch nun mitteilen, dass eine für alle Beteiligten positive Lösung gefunden wurde.
Wir, die BvL Bürosysteme Vertriebs GmbH aus Berlin, haben sämtliche Rechte an der AFP aus der Insolvenzmasse vom Insolvenzverwalter abgekauft. Bereits 1987 wurde die BvL Bürosysteme Vertriebs GmbH gegründet und hat sich seit dem erfolgreich im Markt bewährt.
Wir gehören auch schon seit Foxpro2.0 zur Foxpro-Gemeinde und auch mit der AFP2.0 haben wir unseren Einstieg in die AFP-Gemeinde vollzogen. Wir wollen die AFP nicht in irgendeine Schublade packen, sondern unser Ziel ist es, die AFP weiterzuentwickeln, speziell auch auf die kommenden Serverversionen. Unter der Homepage www.active-foxpro-pages.de wird es demnächst einen neuen Auftritt geben.
An den Preisen soll sich nichts groß verändern, das Handbuch soll anständig aufgelegt werden und selbstverständlich soll der Support und die Weiterentwicklung eine große Aufmerksamkeit bekommen. Mit Christof Wollenhaupt und Jochen Kirstätter haben wir zwei Partner an Bord, die sich um den Support und die Weiterentwicklung kümmern werden. Christof Wollenhaupt wird maßgeblich und federführend an der Weiterentwicklung beteiligt sein. Über Christof Wollenhaupt können auch ab sofort Lizenzen gekauft werden, Christof Wollenhaupt ist für den Online-Vertrieb zuständig, der gerade aufgebaut wird. Sollte ein AFP Server aktiviert werden müssen, können sich alle bisherigen Lizenzinhaber auch direkt an Christof Wollenhaupt wenden.

In den nächsten Wochen werden wir die AFP wieder auf Touren bringen.

Eine aktuelle Version, eine neue Webseite, der Aktivierungsserver, ein Überblick über das leicht geänderte Lizensierungsmodell, und vieles mehr ist gerade in Arbeit.

Die Zukunft und die Weiterentwicklung der AFP sind jetzt gesichert!


Mit freundlichen Grüßen

Ralph-Norman von Loesch

Source: http://forum.dfpug.de/bodyframe.afp?msgid=728069

Add a comment
 
Modified Ultimate Paypal Donations Module PDF Version
Development
Wednesday, 17 February 2010 20:00

The article describes some opinions and modifications for a Joomla! extension called Ultimate Paypal Donations Module by JoomlaSpan.

First of all I have to say that using this extension to provide any kind of PayPal donation element on your site is really easy and straight forward. You just install it, setup your parameters and mdoule location and you are done. It could not be better...

Well, it could.

Actually, my main problem with this module is about XHTML 1.0 compliance. Sadly to see that the current version (as of writing this article) does not follow the W3C rules about XHTML 1.0. Luckily, the necessary changes are very simple to realize by modfying one PHP file. Following is the modified version:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_donations" />
<input type="hidden" name="business" value="<?php echo $paypal_emailID; ?>" />
<input type="hidden" name="item_name" value="<?php echo $item_name; ?>" />
<?php if ($item_number)
{
echo "<input type=\"hidden\" name=\"item_number\" value=\"" . $item_number . "\" />\r\n";
}
?>
<?php if ($amount)
{
echo "<input type=\"hidden\" name=\"amount\" value=\"" . $amount . "\" />\r\n";
echo "<input type=\"hidden\" name=\"lc\" value=\"" . $location . "\" />\r\n";
}
?>
<input type="hidden" name="no_shipping" value="0" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="currency_code" value="<?php echo $currency_code; ?>" />
<input type="hidden" name="tax" value="0" />
<input type="hidden" name="bn" value="PP-DonationsBF" />
<?php if ($image_choice==1)
{
echo "<input type=\"image\" border=\"0\" src=\"" . $donate_image . "\" name=\"submit\"
alt=\"PayPal - The safer, easier way to pay online!\" />\r\n";
}else{
echo "<input type=\"image\" border=\"0\" src=\"" . $own_donate_image . "\" name=\"submit\"
alt=\"PayPal - The safer, easier way to pay online!\" />\r\n";
}
?>
</form>

Modified version of mod_paypal-j15/tmpl/default.php

Despite the tooltip description about choosing your own PayPal button for this module you do not need to specify the full URL including http:// prefix. As you can see in the PHP code any relative path is working too. For reduced number of DNS lookups you should get your preferred PayPal button on your server and change the module to use your 'own' image.

In my changes above you also see a marked if-statement in the code. Well, in the original code there are two identical statements, I just merged them together for better reading.

Add last but not least, I removed the border attribute from input tags that displays the PayPal image on your site. Style information like border attributes belong to CSS files and should not be part of the HTML code.

Add a comment
 
Modified HP Router PDF Version
User Rating:rating indicator fullrating indicator fullrating indicator fullrating indicator fullrating indicator full / 3
PoorBest 
Development
Saturday, 30 January 2010 15:17

While looking for some improvements of Joomla! native SEF engine I found the following extension quite interesting and easy to use: HP Router of Hannes Papenberg. Installation is straight forward and no struggles at all. For best results you might install this extension before starting any kind of search engine optimization for your website.

But after a short time I was confronted with some 'nasty' behaviour in my website that was introduced by this extension. Some articles did not show up properly and ended in an HTTP 404 error message. Well, actually reading the description of HP Router gave me an idea of the problem:

ATTENTION!! There are a few things you have to keep in mind with this plugin:
1. You can't have the same alias for two articles, even though they are in different categories. To be precise, you can't have the same alias for any type of content item. As a rule of thumb: If you can get to the list of this type of content items from the administrator menu, you can't use the same alias on two items in that list.

My 404 problem is directly caused by duplicated aliases... but not the obvious way!

The reason here is that the extension (as of writing this article) does not respect the state of the articles in the Joomla! CMS. And due to migration processing from previous blog databases I had a bunch of duplicated topics but deleted. This refers to state -2 instead of published content that has a state of 1.

To correct this problem it is necessary to modify two PHP files of the original HP Router:

  • hprouter/com_contentrouter.php
  • hprouter/com_contactrouter.php

Almost of the end of each file there are the SQL statements to query the database. After you made a backup of your two files you should change them like so:

$db =& JFactory::getDBO();
if($vars['view'] == 'article')
{
$query = 'SELECT id FROM #__content WHERE state = 1 AND alias = '.$db->Quote($vars['id']);
} elseif($vars['view'] == 'category') {

Modified version of hprouter/com_contentrouter.php

$db =& JFactory::getDBO();
$query = 'SELECT id FROM #__contact_details WHERE state = 1 AND alias = '.$db->Quote($vars['id']);

Modified version of hprouter/com_contactrouter.php

With those modifications the HP Router works as expected and queries only published articles. Currently, I am not using the archive state of articles but in case that you will, just extend those two queries to include the necessary state values.

Add a comment
 
« Start : Prev : 1 : 2 : 3 : 4 : 5 : 6 : 7 : 8 : 9 : 10 : Next : End »

Page 1 of 12
Spacer for layout formatting