BLOGS

COMMENT

warning: file_get_contents(http://www.telize.com/geoip/54.83.122.227) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /var/www/www.4d.com/docs/includes/common.inc(1762) : eval()'d code on line 4.

4D Pop, KeepIt Rockin'

You know 4D Pop.

 

Today, we will talk about a new 4D Pop module, shipped with 4D v12.1: KeepIt.

 

Please note the first sentence has no question mark: “You know 4D Pop – period”. This is on purpose: All 4D developers know what 4D Pop is. I am aware that writing this could be inappropriate: If a reader does not know 4D Pop, he/she could then feel a bit uncomfortable. But this can’t happen: All 4D developers know what 4D Pop is. QED.

A brief reminder: 4D Pop was first developed with version 6.0 of 4D. It has since been regularly updated until its developer joined 4D (the company). Since then, 4D Pop has been regularly updated.

 

Well, in both cases, before and after the hiring, 4D Pop has been regularly updated.

 

4D Pop has since become an official product, documented and free, all the while provided with its source code. I strongly encourage the reader to look, watch and dive inside this code – it is a wonderful world of 4D programming information, tips and tricks. By default, the compiled versions of the module are installed, but the interpreted versions are right alongside.

 

Second brief reminder about installation: 4D Pop is a component. A set of components, actually. So, you just need to drop it in the “Components” folder near the structure. If you plan to use it for all your developments, you should then drop it inside the “Components” folder of the 4D package/folder itself. Finally, just like for any other component, you can use aliases/shortcuts. This lets you store 4D Pop on your disk and makes updates easier.

 

Note: 4D Pop is also available at http://sources.4d.com. You’ll find the latest version of each component there. So, if there is a bug-fix in 4D Pop between two versions of 4D, you don’t need to wait for next version of 4D to get it.

 

4D Pop comes with its own documentation, a full doc explaining how to install and initialize it. To sum-up, once 4D Pop and its modules (such as KeepIt) are in the appropriate “Components” folder, you only need to add some code in the “On startup” database method. Thanks to 4D macros, this is very simple: just type “Install 4D Pop”, hit the tab key and voilà! 4D Pop’s intialization code is inserted for you.

 

A final reminder: 4D pop is a development tool. Don’t overload the versions of your applications that you give to your customers: The components are part of “Local resources” and 4D Pop will be moved across the network at first connection, while it does nothing at runtime. Just think about removing it from the “Components” folder if it resides there. You don’t need to remove the initialization code, it’s smart and does nothing if the structure is compiled or if the component isn’t there.

 

Here’s the 4D Pop palette with all its modules:

 

4D Pop tool palette

 

Each module is very interesting, at least at some point of the development. For example, the “Migration” module and part of the “XLIFF” module will be very helpful if you are converting a 2004 structure with custom constants and/or string resources (STR#). Please take a look at the “Windows” module. I’m pretty sure you will love it if you use to work with more than 4 windows open at the same time…

 

After this long introduction, let’s go back to the main subject of this post: KeepIt. Vincent, author of 4D Pop, is a 4D developer who – go figure – spends all his time coding with 4D: Internal databases, 4D dialogs (yes, a lot of the 4D interface is built with 4D), etc. And he thinks he can add new modules when he needs to, to increase his productivity (I like to say “increase his productivity.” Sounds serious, doesn’t it?). Last module he added to 4D Pop is named KeepIt. Why KeepIt? Well. Because it is the only name found by Dr de Lachaux (a.k.a. Vincent) to describe what the module does: Keep code snippets in one place and make them available to any structure. More importantly, the goal is to do it easily and simply. So, here is how to use it. You will see how obvious it is:

  1. Select some code in a method. Code that you think you will need often.
  2. Drag and drop it onto the KeepIt icon.
  3. Give it a name.
  4. To use it, just hit “$$” and tab: A contextual menu is displayed with your KeepIt items. Select the one you need and the code is inserted in the method.
  5. Isn’t it marvelous?

Here, for example, is the code of a so-called pseudo-recursive method (it launches itself in a new process), code that I use very often:
 

 

You could argue “But my dear Thibaud, I’ve been doing the exact same thing with macros for ages.” My answer would stand in two points:

 

1/ Thanks a lot for the politeness. Calling me “My dear” is really appreciated.

2/ KeepIt goes far beyond macros, and I’m explaining why in the next paragraph.

 

First, it is much more ergonomic. To write a macro, you need to edit the XML file of the macros in a Text Editor. With KeepIt, well, you don’t need to leave 4D and you don’t care about XML. But, most important, KeepIt hasits own tags which incredibly increase its power and interest. For example, you can use the ask tag to make KeepIt display a request dialog and use the result. You can also tokenize your KeepIt to share them with developers using a localized version of 4D. And you even can insert tags used by macros. Back to the example shown in the video a few lines above, one can insert “<caret/>”. Doing so, after the call to KeepIt, the cursor will be put where the developer can start typing the code:

 

 

KeepIt is an incredible tool that makes development easier. It was designed for 4D developers by a 4D developer. Wow. This is marketing! We should make 4D Pop a paid product!