Translate Text with YANDEX

For the translation of a user interface I needed a quick way to translate smaller strings into several languages I do not speak.
So the obvious choice would be to call Google to the rescue.
Sadly. the Google Translate API is not free, so I looked for alternatives and found on, of all places, in Russia!
YANDEX, the Russian version of Google, offers comparable services, only they are for free.
As I do not have any ideological issues here, I wrote a quick component that can make use of the YANDEX API for translations.
Interested?

Continue reading

Quick editing of XLSX files

Ever felt the need to modify the content of Excel XLSX files?

Well thanks to Keisuke opening up the intricate content of a Microsoft OPC file (docx;xlsx;pptx;etc…) we can now easily edit the content of the Excel spreadsheets fiddling around with XML.

Or rather, it could be easy if Microsoft had devised their open document formats in a straightforward way, but being Microsoft and having written the decisive chapters of the industry standard cookbook obfuscating code for sociopaths  they have made it as complicated as possible.

Well I can at least help alleviate the pain a bit with a little component you can download here:

Download AC_XlsxEdit from Dropbox

You will need to download the OPC Plugin from Keisukes Github repository:

Keisukes OPC Plugin on Github

The component is V14 but should work with all versions of 4D.

Continue reading

SQL Structure Access

Sadly I lost a client last week as they decided it would be more expensive to pay for all the missed updates of 4D than to buy something completely new…
At least I got them to pay for me helping to export that data from 4D to something  the new supplier (who is using MSSQL server) could read…

Well I thought, that’s going to be quick money and fired up SQL EXPORT DATABASE

Boy was I wrong…

As long as you stay within the 4D Universe all may be fine, but no other SQL database engine can read these Export.sql files 4D creates, simply due to the way they write the INSERT INTO line…

INSERT INTO [ATY_TITLES] ( [ATT_ID] , [ATT_ATY_ID] , [ATT_TITLE] , [ATT_HANDLE] , [ATT_WTS_ID] , [ATT_WTP_ID] )

This may make sense for 4D, as there are apparently still some people out there who use spaces in field and table names (allowing spaces, special characters etc. in object names was not one of the better ideas Laurent ever had…) but all other SQL systems will just reject this syntax as being utterly ridiculous..

I also found out, that contrary to other SQL dumps, for example by MySQL, the 4D dump does not contain the CREATE TABLE statements needed to recreate a compatible structure.

A quick search revealed there is no such command in 4D, all these nice structure exports to XML, HTML, etc. are absolutely useless in this context (has anyone noticed that you cannot print the structure anymore?).

So, only solution, roll my own.

Continue reading

Tools for 4D Write Pro

4D is finally working towards creating a new 4D Write and since 14 R5 we can actually use some of it.

Of course there is still quite a lot missing but with what we already have we can for example create nice looking E-Mails.

Now most of us have worked with 4D Write until now and moving to 4D WritePro requires quite a few conversion in order to prevent us from doing all again.

Converting a 4D Write Document to WritePro works fine, as long as you go through a document on Disk, using Blobs with WP New has yet to work reliably for me.

Using References or Expressions in 4D WritePro works surpassingly well, although the tools for manipulating these References and expressions are a bit lacking.

So I have created a few helper methods that I gladly share here:

Continue reading

OSX 10.10 Working with components and plugins without aliases

Apple has broken Aliases.

Well, at least for us working with 4D and until 4D supports the new OS X aliases that now are more like bookmarks.

So, what can a developer do?
Copy all Plugins and Components into the appropriate folders and overtime a component changes, copy it again to all destinations, hoping you don’t forget one…

Tedious huh?
But aren’t we developers?
Let’s solve this in code:

Continue reading

AC_QuickBase, a Memory based Data storage for 4D V14

Ever needed to keep structured data without creating tables?
Need simple data structures for a component without adding persistent storage tables to the host database or using an external database?
Well, I may have a thing for you:

AC_QuickBase

A simple, memory based Database Component for 4D.

The command set at a glance:

AC_QuickBase – initializes the database system

ACQB_CreateTable – create a database table
ACQB_DropTable – drop the table specified
ACQB_Truncate – clears all records from a table

ACQB_Insert – create a new record
ACQB_Update – modify an existing record
ACQB_Delete – delete a record

ACQB_Value – retrieves a field value
ACQB_ValueToArray – retrieves a field value for multiple records

ACQB_Find – find a specific record, the first match is returned
ACQB_FindSel – find all records matching the request

ACQB_Count – Count records in a table

ACQB_Export – exports the database to disk
ACQB_Import – imports a database from disk

ACQB_Clear – clears the database from memory

ACQB_Editor – displays a data view and editor

Interested?

Continue reading

Copying a Menu

Ever needed to create copy of a menu you defined using CREATE MENU?
For example to use it in 2 separate processes with different settings or different states of enabling/disabling or different lines added or removed?
Well, despair not, here is a piece of code that might come in handy:

Continue reading