Black Cat's blog (Black Toolkit and Linux)
Official Blog of The Black Toolkit project.
Search This Blog
Thursday, February 16, 2017
The Black Toolkit 1.7 is released
The Black Toolkit 1.7 is released with new features, and some bugfixes.
Friday, January 22, 2016
The Black Toolkit 1.6 will be released on February, 2016
The Black Toolkit 1.6 will be released containing some bugfixes on the PHP and Java syntax checker, and more improvements.
BlackJS:
The generated AJAX/CSS/Javascript routines will now use a library we call BlackJS. The web projects will provide it for custom web components. Feel free to modify its CSS/Javascript definitions if you want to.
BlackJS 's license is very flexible: you can use it, modify it or not, and sell it in your projects without fees.
Visual RAD Editor:
It will have some improvements:
BlackJS:
The generated AJAX/CSS/Javascript routines will now use a library we call BlackJS. The web projects will provide it for custom web components. Feel free to modify its CSS/Javascript definitions if you want to.
BlackJS 's license is very flexible: you can use it, modify it or not, and sell it in your projects without fees.
Visual RAD Editor:
It will have some improvements:
- Supporting a new Tab Control display control (making much better the behaviour of Java Swing's JTabbedPane component).
- Fixed a Web Document's bug on v_align=center and h_align=center. Now a Javascript function will put the object on the top/left if it does not fit on the browser. The object will appear on the correct v_align/h_align position on the Editor, also.
- Web Documents will have some new Components: Tab Controls, XML Autocompletors, CSS Menus. These will be using BlackJS.
Saturday, May 16, 2015
The Black Toolkit 1.5 is released today
The Black Toolkit 1.5 is released today containing new features and bugfixes.
Saturday, May 2, 2015
The Black Toolkit 1.5 will be released soon
The Black Toolkit IDE, version 1.5, will come before June 2015.
It will contain some more features, as a syntax checker for PHP and Java, including in RAD forms.
Friday, October 24, 2014
Will The Black Toolkit have a port for Android?
For now, The Black Toolkit has ports for Windows and Linux, in native PC achitecture.
Its source code is in Object Pascal using Lazarus IDE, but it doesn't mean that some units cannot be compiled as a java library.
The FPCJVM compiler can compile a Object Pascal source code and output to Java (and Dalvik) Virtual Machine format. It has some restrictions, but it can be made.
Since The Black Toolkit 1.4 (May 2014) I have made some tests with FPCJVM and the source code of the tool.
I have seen the docs of androidlcl too, but writing for a native CPU achitecture instead of Java is not good for compatibility :(
My choice was not to use androidlcl, but a pure FPCJVM app using some units of the PC version of The Black Toolkit. Others units, like activities need to be new Java Classes, with a new interface and more useful for small screen resolutions.
Some parts of source need to be reallocated or rewrited for a concurrent build (PC and Android). It will take a lot of work, but it is very possible to goes well.
Its source code is in Object Pascal using Lazarus IDE, but it doesn't mean that some units cannot be compiled as a java library.
The FPCJVM compiler can compile a Object Pascal source code and output to Java (and Dalvik) Virtual Machine format. It has some restrictions, but it can be made.
Since The Black Toolkit 1.4 (May 2014) I have made some tests with FPCJVM and the source code of the tool.
I have seen the docs of androidlcl too, but writing for a native CPU achitecture instead of Java is not good for compatibility :(
My choice was not to use androidlcl, but a pure FPCJVM app using some units of the PC version of The Black Toolkit. Others units, like activities need to be new Java Classes, with a new interface and more useful for small screen resolutions.
Some parts of source need to be reallocated or rewrited for a concurrent build (PC and Android). It will take a lot of work, but it is very possible to goes well.
Sunday, May 4, 2014
The Black Toolkit 1.4 is released today
The Black Toolkit is in constant evolution and it is released today. Containing new bugfixes and improvements from the last versions of the tool.
Saturday, April 26, 2014
The Black Toolkit 1.4 is almost ready for release
The Black Toolkit 1.4 will come with new improvements like the support for MySQL 5.5 and 5.6 with native drivers (non ODBC).
I've tested it also with MariaDB and it works, thanks for the new versions of Lazarus and SQLDb!
A new old icon of the app, from 1.0.7.1 is back! The new one always had drawing problems on Windows platform. Sorry!
We 'll spend next days fighting against bad behaviours of the past versions. Like saving a PHP Visual RAD Form, now it automatically closes the code popup window for the programmer go the navigator easily.
The SQL Client now remembers the last 20 connections made before.
The DAO Generator will have better compatibility with more than one DB vendor, because it will generate a method getGenerator() for getting the SQL for the generator (or sequence) for the table. You just need to override this method for each subclass to get the generator for the table in a encapsulated way with genID().
A sequence in Oracle is called this way:
select the_seq.nextval from dual
A generator in Firebird is called this way:
select gen_id(the_gen, 1) from rdb$database
I've tested it also with MariaDB and it works, thanks for the new versions of Lazarus and SQLDb!
A new old icon of the app, from 1.0.7.1 is back! The new one always had drawing problems on Windows platform. Sorry!
This is an Hybrid version in development. |
We 'll spend next days fighting against bad behaviours of the past versions. Like saving a PHP Visual RAD Form, now it automatically closes the code popup window for the programmer go the navigator easily.
The SQL Client now remembers the last 20 connections made before.
The DAO Generator will have better compatibility with more than one DB vendor, because it will generate a method getGenerator() for getting the SQL for the generator (or sequence) for the table. You just need to override this method for each subclass to get the generator for the table in a encapsulated way with genID().
A sequence in Oracle is called this way:
select the_seq.nextval from dual
A generator in Firebird is called this way:
select gen_id(the_gen, 1) from rdb$database
Friday, January 31, 2014
The Black Toolkit 1.2 is released
The Black Toolkit 1.2 is released is released containing new improvements and bugfixes, specially on the new SQL Client.
- Fixed some bugs.
- Supported new HTML5 events!
- SQL Client has new improvements.
Friday, January 24, 2014
Making Heavy Metal SQL Client recognize your DB through ODBC.
The Black Toolkit is made to be extensible, that means you can install XML files to add more functionality to the software.
To make SQL Client to work with another DB you need to make an XML for it, and place it in the sql\ installation dir of The Black Toolkit. There´s one file for DB:
<ondetect>Heavy Metal will detect the XML file to use if the DB it recognizes the query in ondetect tag. Must be a query just this DB recognizes</ondetect>
<ongettables>An SQL Query statement for getting the tables of the DB. You can return more than one column, such as database,schema,table_name (PostgreSQL) or database,table_name (MySQL) </ongettables>
<maptypes>
Types for SQL-to-java and java-to-SQL mapping made for the tool. Examples:
<map type="TEXT" javatype="String"/>
<map types="LONG" javatype="long" />
</maptypes>
<ongetfields>An SQL Query for getting the fields for a table. Heavy Metal will expand %1% and %2%... by the db/schema/table names returned by ongettables. The query must return the column name and type as in maptypes.</ongetfields>
<ongetpkfields>An SQL Query for getting the Primary key field names for a table. Heavy Metal will expand %1% and %2% ... by the schema/table names returned by ongettables.</ongetpkfields>
<ongetfkfields>An SQL Query for getting the imported fields for a column: Heavy metal will expand %1% and %2%... by the schema/table names returned by ongettables, and the %3% (or %4%) by the column name.
</ongetfkfields>
<sequencecmd>An SQL Query for access the sequence or generator of a table. This is for the SQL importer.</sequencecmd>
<onselect>An SQL Query for making a SELECT statement of a table</onselect>
<object name="ObjName" global="true" query="..." >
This will declare an database object. You can declare object as much as you like.
name=Name of the object (Like Indexes, Views, Functions...).
global="false" if it depends of a table (like an Index), "true" if does not (like a Function).
query=SQL for query these objects. Must return a full list of details of the objects in the database.
<action name="Action1" helpurl="...">
SQL for the user can make actions for the object. Like CREATE, ALTER, etc. You can declare action as much you like. Heavy Metal will expand %1% by the db.table name and %3%, %4%,... for the query return (for non global objects). And %1%,... by the query return (for global objects).
</action>
</object>
To make SQL Client to work with another DB you need to make an XML for it, and place it in the sql\ installation dir of The Black Toolkit. There´s one file for DB:
<ondetect>Heavy Metal will detect the XML file to use if the DB it recognizes the query in ondetect tag. Must be a query just this DB recognizes</ondetect>
<ongettables>An SQL Query statement for getting the tables of the DB. You can return more than one column, such as database,schema,table_name (PostgreSQL) or database,table_name (MySQL) </ongettables>
<maptypes>
Types for SQL-to-java and java-to-SQL mapping made for the tool. Examples:
<map type="TEXT" javatype="String"/>
<map types="LONG" javatype="long" />
</maptypes>
<ongetfields>An SQL Query for getting the fields for a table. Heavy Metal will expand %1% and %2%... by the db/schema/table names returned by ongettables. The query must return the column name and type as in maptypes.</ongetfields>
<ongetpkfields>An SQL Query for getting the Primary key field names for a table. Heavy Metal will expand %1% and %2% ... by the schema/table names returned by ongettables.</ongetpkfields>
<ongetfkfields>An SQL Query for getting the imported fields for a column: Heavy metal will expand %1% and %2%... by the schema/table names returned by ongettables, and the %3% (or %4%) by the column name.
</ongetfkfields>
<sequencecmd>An SQL Query for access the sequence or generator of a table. This is for the SQL importer.</sequencecmd>
<onselect>An SQL Query for making a SELECT statement of a table</onselect>
<object name="ObjName" global="true" query="..." >
This will declare an database object. You can declare object as much as you like.
name=Name of the object (Like Indexes, Views, Functions...).
global="false" if it depends of a table (like an Index), "true" if does not (like a Function).
query=SQL for query these objects. Must return a full list of details of the objects in the database.
<action name="Action1" helpurl="...">
SQL for the user can make actions for the object. Like CREATE, ALTER, etc. You can declare action as much you like. Heavy Metal will expand %1% by the db.table name and %3%, %4%,... for the query return (for non global objects). And %1%,... by the query return (for global objects).
</action>
</object>
Monday, January 13, 2014
Importing data with foreign data wrappers on PostgreSQL
Foreign data wrappers is a new feature of PostgreSQL 9.1. It serves to read data from external data sources. The data sources can be...
Oh! http://wiki.postgresql.org/wiki/Foreign_data_wrappers
The list is extense! but will need to compile the extension from source, in a Linux server is easy. In Windows you ´ll need MinGW.
There´s 2 FDW which comes with PostgreSQL 9.3 for Windows: the file_fdw and postgres_fdw.
create extension file_fdw;
create server files foreign data wrapper file_fdw;
create foreign table foo_csv (
field1 varchar(13),
field2 varchar(50),
...
) server files options(format 'csv', encoding 'windows-1252', header 'true', delimiter ';', quote '"');
For Postgres_fdw here a example:
create extension postgres_fdw;
create server pgserver foreign data wrapper postgres_fdw options( host 'myhost', port '5432', dbname 'mydb');
create user mapping for myuser server pgserver options(user 'postgres', password '##@%¨$&¨'¨);
create foreign table my_foreign_table (
id int,
datet timestamp,
...
) server pgserver;
For copying data to a real table you can give a simple command:
create table foo as (select * from foo_csv where field2='E467');
Oh! http://wiki.postgresql.org/wiki/Foreign_data_wrappers
The list is extense! but will need to compile the extension from source, in a Linux server is easy. In Windows you ´ll need MinGW.
There´s 2 FDW which comes with PostgreSQL 9.3 for Windows: the file_fdw and postgres_fdw.
create extension file_fdw;
create server files foreign data wrapper file_fdw;
create foreign table foo_csv (
field1 varchar(13),
field2 varchar(50),
...
) server files options(format 'csv', encoding 'windows-1252', header 'true', delimiter ';', quote '"');
For Postgres_fdw here a example:
create extension postgres_fdw;
create server pgserver foreign data wrapper postgres_fdw options( host 'myhost', port '5432', dbname 'mydb');
create user mapping for myuser server pgserver options(user 'postgres', password '##@%¨$&¨'¨);
create foreign table my_foreign_table (
id int,
datet timestamp,
...
) server pgserver;
For copying data to a real table you can give a simple command:
create table foo as (select * from foo_csv where field2='E467');
Sunday, October 20, 2013
The Black Toolkit 1.1 is released
The Black Toolkit 1.1 was released yesterday, containing the new Heavy Metal SQL client, supporting also Pascal sources and generating a better DAO code for JDBC Java.
Wednesday, October 16, 2013
Built-in SQL client?
The Black Toolkit 1.1 will have a fully featured, built-in SQL client, instead of just a CRUD Class importer.
The supported drivers are:
They are XML files because anyone can write a driver for other DB and connect it via ODBC.
The Black Toolkit 1.1 must be released until the end of October 2013.
- MySQL.xml
- PostgreSQL.xml
- Firebird.xml
- Oracle.xml
- SQLite3.xml
They are XML files because anyone can write a driver for other DB and connect it via ODBC.
The Black Toolkit 1.1 must be released until the end of October 2013.
Friday, October 11, 2013
The Black Toolkit 1.1 will be released soon
The Black Toolkit 1.1 will have some new improvements:
- The Java DAO will generate a more robust code. Less a bug.
- The CRUD/DAO importer will not just import from SQL, but analyze the database's objects and permit to write queries and scripts.
- It will support Pascal and it will be extensible with other programming languages.
Sunday, September 22, 2013
The Black Toolkit 1.1 will be released in October
The Black Toolkit 1.1 will be released in October, and will contain some new useful features:
- It will support extensible programming languages via XML (Kriss Engine), not just RAD forms. You just need to have a .XML extension file for it.
- It will support Pascal as this extension.
Saturday, September 21, 2013
Omega Base 1.0.6 will be released in October
That's right, Omega Base 1.0.6 will be released containing some more improvements:
- Select many documents to delete them.
- Mass import files, to documents and attachments. Files already imported are just updated and not created another attachment. (Omega Syncro).
- Send comments about documents, and send email.
- Manage the max size of attachments.
- Attachments will have version control also.
Tuesday, August 20, 2013
Omega Base 1.0.5 is released
Omega Base 1.0.5 is released today.
The new version has a new design and better scalability compared to older versions.
The new version has a new design and better scalability compared to older versions.
- Because of the new indexes, the SQL part redone, and the robust PostgreSQL engine, it now supports millions of documents without problems.
- The documents keep the groups-based security and now supports versioning: that's it, you can come back a document to any older version.
- The file keywords indexer now supports MS Office DOCX.
Thursday, July 25, 2013
The Black Toolkit 1.0.9.1 is released
The Black Toolkit 1.0.9.1 is released today.
Some of new funcionalities:
Some of new funcionalities:
- Fixed the bug of "Types.LONG" of the Java DAO.
- The Java and PHP CRUD has new functionalities:
- DAO's Query() method now supports joins.
- DAO's new Load() method to get from request ($_POST, $_GET or request.getParameterMap()).
- DAO's method component to create visual methods from CRUD.
Friday, July 5, 2013
Example loading a fixed-text file to PostgreSQL with a Stored Procedure.
"Stored Procedures are evil", "Stored Procedures do break database independency", "Do not use Stored Procedure in my enterprise".
This are some of words I hear about SPs. But you can do simple loads of data quickly.
With Stored Procedures, you can load big data quickly, (and make very fast systems also).
I will use PostgreSQL, which is a DB I can use for this.
Let's see a file...
0000023ABRAAO 09081985
0000045JOSEPH 10071997
...
The format table is:
create table employee (
ID NUMER(7)
NAME CHAR(100)
HIRE_DATE DATE --(MMDDYYYY) in file
);
A log table is:
create table log_errors (
id bigserial,
table_name varchar(100),
error_date timestamp,
line text,
message varchar(200),
constraint log_errors_pk primary key(id)
);
A staging table for the file (we'll COPY file into this):
create table temp_employee
file_line text,
id bigserial,
constraint tepk primery key(id)
);
Let's divide the SP in parts.
Part 1: Header.
CREATE OR REPLACE FUNCTION load_employees()
RETURNS boolean AS
$BODY$declare
line text;
emp employee%ROWTYPE;
begin
Part 2: Loading the data to the real table. We'll make it by the complex way: update or insert and log the bad records into log_errors.
for line in select file_line from temp_employee order by id
loop begin
emp:=null;
emp.name:=trim(substr(line,9, 100));
emp.hire_date:=to_date(substr(line,110, 8), 'MMDDYYYY');
emp.id:=substr(line, 1, 8);
update employee set
name = emp.name,
hire_date = emp.hire_date
where id = emp.id;
if not found then
insert into employee(id, name, hire_date) values
(emp.id, emp.name, emp.hire_date);
end if;
exception
when others then
insert into log_erros (table_name, error_date, line, message)
values ('employee', now(), line, 'Error');
end;
end loop;
Part 3: Cleaning records from temp_employee.
delete from temp_employee;
Part 4: SP Footer.
return true;
end;$BODY$
LANGUAGE plpgsql VOLATILE
Part 5: Call the function from psql.
bash-4.2$ cat /tmp/employee.txt|psql -h thehost db -c "copy temp_employee from stdin;select load_employees()"
If you need to run it automatically, remember to put the "Part 5" in the crond service. For Windows server, use the Task Scheduler.
This are some of words I hear about SPs. But you can do simple loads of data quickly.
With Stored Procedures, you can load big data quickly, (and make very fast systems also).
I will use PostgreSQL, which is a DB I can use for this.
Let's see a file...
0000023ABRAAO 09081985
0000045JOSEPH 10071997
...
The format table is:
create table employee (
ID NUMER(7)
NAME CHAR(100)
HIRE_DATE DATE --(MMDDYYYY) in file
);
A log table is:
create table log_errors (
id bigserial,
table_name varchar(100),
error_date timestamp,
line text,
message varchar(200),
constraint log_errors_pk primary key(id)
);
A staging table for the file (we'll COPY file into this):
create table temp_employee
file_line text,
id bigserial,
constraint tepk primery key(id)
);
Let's divide the SP in parts.
Part 1: Header.
CREATE OR REPLACE FUNCTION load_employees()
RETURNS boolean AS
$BODY$declare
line text;
emp employee%ROWTYPE;
begin
Part 2: Loading the data to the real table. We'll make it by the complex way: update or insert and log the bad records into log_errors.
for line in select file_line from temp_employee order by id
loop begin
emp:=null;
emp.name:=trim(substr(line,9, 100));
emp.hire_date:=to_date(substr(line,110, 8), 'MMDDYYYY');
emp.id:=substr(line, 1, 8);
update employee set
name = emp.name,
hire_date = emp.hire_date
where id = emp.id;
if not found then
insert into employee(id, name, hire_date) values
(emp.id, emp.name, emp.hire_date);
end if;
exception
when others then
insert into log_erros (table_name, error_date, line, message)
values ('employee', now(), line, 'Error');
end;
end loop;
Part 3: Cleaning records from temp_employee.
delete from temp_employee;
Part 4: SP Footer.
return true;
end;$BODY$
LANGUAGE plpgsql VOLATILE
Part 5: Call the function from psql.
bash-4.2$ cat /tmp/employee.txt|psql -h thehost db -c "copy temp_employee from stdin;select load_employees()"
If you need to run it automatically, remember to put the "Part 5" in the crond service. For Windows server, use the Task Scheduler.
Saturday, June 15, 2013
The Black Toolkit is no more Beta
Because the proven stability trought these 1.5 years, The Black Toolkit has lost its Beta flag in https://www.sourceforge.net/ yesterday and changed it to Production/Stable.
Next and more advanced versions maybe will receive also a Mature flag, but there´s some work to do.
Next and more advanced versions maybe will receive also a Mature flag, but there´s some work to do.
Thursday, June 13, 2013
How to use JBoss with The Black Toolkit without deploys
- With The Black Toolkit, go Configuration->Java, find and add the JSP jars to the classpath: jsp-api.jar and servlet-api.jar. They can be at JBOSS_HOME/lib, but depends of the version of JBoss.
- Start a new JSP project, and save it in JBOSS_HOME/<deploy_folder>/<your_project_name>.war. The folder name must finish with .war.
- You must change some configuration details for autodeploy. This configuration changes every version of JBoss. So check http://www.jboss.org.
- For JBoss 7 (and latest 6),you must create a empty file <your_project_name>.dodeploy in JBOSS_HOME/<deploy_folder>.
- Do not use 7.1.1.
Wednesday, June 12, 2013
How to use Apache Tomcat with The Black Toolkit without deploys
- Stop Apache Tomcat.
- Edit conf/context.xml and define <Context> to <Context reloadable="true"> just for Tomcat reload your classes automatically when compiling a .JAVA.
- Do NOT use Step 2 with production systems.
- Start Apache Tomcat.
- With The Black Toolkit, go Configuration->Java and add the JSP jars to the classpath: TOMCAT_HOME/lib/jsp-api.jar and TOMCAT_HOME/lib/servlet-api.jar.
- Start a new JSP project, and save it in TOMCAT_HOME/webapps/<your_project_name>.
- Go to WEB-INF/vform and index.vform, change and save it, you can see it in the Browser.
- Go to WEB-INF/classes, create, modify, compile classes. And note: No deploys!!
Installing SQL client libraries for Black Toolkit´s CRUD importer
Oracle:
You ´ll need to install the client libraries (OCI) for C.
Firebird:
You ´ll need to install the either ODBC driver or Firebird Server itself.
PostgreSQL:
Dirty, but works. You 'll need to download the ODBC driver (DLL, 32bits) which contains also the libpq.dll. Unpack those into Black Toolkit´s directory and it will work.
SQLite:
The same for PostgreSQL, but with the Windows binary.
MySQL:
OK, The Black Toolkit is made in Lazarus and has SQLdb' s limitations. ZeosBDO has its also.
The client library cannot be newer than version 5.1.You will need to use ODBC to avoid problems. The ODBC driver connects and extracts CRUDs without problems. But cannot see the table names and field types automatically, because of information schema.
For Linux you need to install UnixODBC and it will work the same.
Monday, June 3, 2013
The Black Toolkit 1.0.9 is released!
The Black Toolkit is released today with some new features:
- RAD support to HTML5 elements.
- Java Swing RAD Editor updated to 7.
Sunday, January 13, 2013
Tuesday, November 27, 2012
What is The Black Toolkit?
Rock the Cat |
The Black Toolkit is an RAD IDE for development of web JSP, PHP, ASP or static HTML pages. It was created initially by Raphael Vinícius Corrêa.
The tool is totally free, the interface supports drag and drop HTML components, and generating a very fast code, with no additional softwares layers or libraries, but you can put libraries, like jQuery. The generated code works with all browsers.
What it supports?
- Visual programming, in PHP, JSP, ASP and Java Swing.
- Visual event-driven programming.
- Works in all browsers
- Online help access.
- Integrated programming and debugger for Java and C++.
- Support for MingGW, GCC and Winegcc compilers for C++
- Built-in AJAX support.
- PHP-PDO and JDBC db support.
- Bult-in SQL Client.
The project was made with these main goals:
- To be a fast IDE, running even in old hardwares.
- Support visual programming, in many programming languages.
- Run in most Operating Systems.
- Be more extensible as possible.
- Support free tecnologies.
- And of course, give the maximum of productivity.
The downloads include:
- The installers for 32 and 64 bits Windows.
- The .rpm and .deb packages for Linux (need GTK+2).
- A portable version, you can put it in an USB stick to run in any PC. It loses nothing for the installer versions.
The system is in sourceforge.net in the URL: http://sourceforge.net/projects/theblacktoolkit.
Saturday, November 10, 2012
Omega Base 1.0.1 is released
Omega Base 1.0.1 is relased with new features:
Can be used since as your own cloud, in a home computer, or even in a big and concurrent enterprise network.
- The file indexer now supports FreeMind (.mm) and Dia (.dia) Charts also.
- The PDF indexer now uses PDFBox library instead of iText. Less bugs.
- Some bugs fixed.
Can be used since as your own cloud, in a home computer, or even in a big and concurrent enterprise network.
Saturday, September 29, 2012
Generating a DAO Class in The Black Toolkit.
DAO (Data Access Object) code pattern has advantages over using exposed DB commands:
Since 1.0.7 the IDE has a Visual RAD Form to generate and maintain the DAO class and Transfer Object for Java and PHP.
Since 1.0.8 the IDE can import it from a SQL table, and support many drivers. Just go Database->Import DAO/CRUD, and connect to the database
Just do a right-click on the files panel and go New->Visual Form->DAO Class.
If you use many DBs you 'll need to create a concrete subclass of this DAO class for each DB, like this:
public class CategoryDAOPgSQL extends CategoryDAO { //Using PgSQL Syntax
@Override
public long genID() {
...
}
@Override
public Category[] findByDescription(String description) {
return this.query(
"WHERE to_tsvector('portuguese', name||' '||description) @@ to_tsquery('portuguese', '"+description.replace("'", "''")+"')");
}
}
You 'll also need to create the Factory Class which encapsulates the DAO Class:
public abstract class DAOFactory {
public abstract CategoryDAO getCategoryDAO();
public abstract EmployeeDAO getEmployeeDAO();
public static DAOFActory getInstance() {
return new DAOFactory() {
CategoryDAO getCategoryDAO() { return new CategoryDAOPgSQL(); }
EmployeeDAO getEmployeeDAO() { return new EmployeeDAOPgSQL(); }
};
/*
return new DAOFactory() {
CategoryDAO getCategoryDAO() { return new CategoryDAOOracle(); }
EmployeeDAO getEmployeeDAO() { return new EmployeeDAOOracle(); }
};
*/
}
}
- Database independency: What DBs are you using? MySQL, Oracle, LDAP, PostgreSQL,...? Can be SQL or not. DAO isolates the DB data from the rest of the code, making easy to support many DBs.
- Performance for SQL: SELECT with many JOINs are slower than a SELECT per table joined by the programming language. DAO avoids using much of these JOINs.
- Maintain code: Separating the DB code from other parts of the source makes it much more easy to maintain.
Since 1.0.7 the IDE has a Visual RAD Form to generate and maintain the DAO class and Transfer Object for Java and PHP.
Since 1.0.8 the IDE can import it from a SQL table, and support many drivers. Just go Database->Import DAO/CRUD, and connect to the database
Just do a right-click on the files panel and go New->Visual Form->DAO Class.
- Set the Form properties.
- Create a Field Instance for each Field in the table, and set its attributes.
- If using it in many DBMS, you will need to set abstractDAO as true and make DAO class abstract.
- If the class is not abstract, set the getConnection event to get the PDO/Connection object.
- Create your own (abstracts or not) methods in the declarationsDAO event.
- The IDE gives the Transfer Object class and the Data Access Object class with some SQL generic methods:
- select() - selects a row.
- query() - selects many rows. You can add a WHERE / ORDER BY clause for parameter. This method will NOT load fileds which loadonquery property is false You may use this method just in the subclasses or not, depending for what you want to do.
- map() - maps an array to a key-value array, by the primary key. It's for joining with another table's query.
- insert() - inserts a row. You probably will need also to put the primary key 's value, using a generator or sequencer.
- update() - updates a row.
- delete() - deletes a row.
If you use many DBs you 'll need to create a concrete subclass of this DAO class for each DB, like this:
public class CategoryDAOPgSQL extends CategoryDAO { //Using PgSQL Syntax
@Override
public long genID() {
...
}
@Override
public Category[] findByDescription(String description) {
return this.query(
"WHERE to_tsvector('portuguese', name||' '||description) @@ to_tsquery('portuguese', '"+description.replace("'", "''")+"')");
}
}
You 'll also need to create the Factory Class which encapsulates the DAO Class:
public abstract class DAOFactory {
public abstract CategoryDAO getCategoryDAO();
public abstract EmployeeDAO getEmployeeDAO();
public static DAOFActory getInstance() {
return new DAOFactory() {
CategoryDAO getCategoryDAO() { return new CategoryDAOPgSQL(); }
EmployeeDAO getEmployeeDAO() { return new EmployeeDAOPgSQL(); }
};
/*
return new DAOFactory() {
CategoryDAO getCategoryDAO() { return new CategoryDAOOracle(); }
EmployeeDAO getEmployeeDAO() { return new EmployeeDAOOracle(); }
};
*/
}
}
Wednesday, May 2, 2012
Aligning web objects to left-right-center or top-center-bottom
The Black Toolkit comes with the v_align and h_align properties to align objects in the parent object.
These aren't from HTML itself, but you can use it to align the object in the parent box without problems.
These aren't from HTML itself, but you can use it to align the object in the parent box without problems.
Thursday, April 26, 2012
Using AJAX with the Visual Editor
AJAX is powerful, and with the Black Toolkit it is very easy to use.
You can use a AJAX component, or a simpler AJAX form.
For the AJAX Form:
For the AJAX component:
The functionname 's parameters are (method, url, async, data, contentType, contentLength):
Example:
ajx_getcustomers("POST", "../ajax/customers.php", true, "all=true&type="+frm.type.value);
You can use a AJAX component, or a simpler AJAX form.
For the AJAX Form:
- In the Visual Editor click the "Custom" tab, and then click the AJAX Form component.
- After dragging the component to the HTML, set the functionname property to the function name, and the action property to the url of the AJAX page on server..
- In the events tab, set the onreadystatechange4 event. It is the event when the AJAX response is successfully retrieved.
- Put form objects, like inputs, selects, etc... as you need inside the form. Note the functionname property will make the AJAX code automatically.
- You can use a AJAX submit button or call the functionname property directly to call AJAX.
For the AJAX component:
- In the Visual Editor just click in the "Script" tab, and then click in ajax component.
- After dragging the component to the form, set the functionname property to the function name.
- In the events tab, set the onreadystatechange4 event. It is the event when the AJAX response is successfully retrieved.
The functionname 's parameters are (method, url, async, data, contentType, contentLength):
- method - Supported are "POST" and "GET".
- url - The URL to the page.
- async - Asynchronous, generally is true.
- data - The "POST" data.
- contentType(optional): The "POST" contenttype header. If it is not filled, is"application/x-www-form-urlencoded".
- contentLength(optional): the "POST" contenLength header. If it is not filled is data.length.
Example:
ajx_getcustomers("POST", "../ajax/customers.php", true, "all=true&type="+frm.type.value);
Monday, March 26, 2012
How can I extend the Visual Editor for other language, like C++?
The Visual Editor of The Black Toolkit was made to work with many programming languages, and be extended for other needs of RAD Visual programming...
The good part is: ...just with XML.
The Componentset API is here: http://sourceforge.net/projects/theblacktoolkit/files/1.0.3.2/Extending_XML_Visual_Editor.pdf/download
Acctually the Black Toolkit supports (natively) is Web documents (HTML, PHP, JSP, ASP), Java Swing with NullLayout. But you can write the componentset for your favorite language, without recompiling the IDE.
I have too much work in developing the toolkit plus writing the componentsets. Because of this I had to drop the Win32 Form, to work on it some months later. Someone wants to help me?
The good part is: ...just with XML.
The Componentset API is here: http://sourceforge.net/projects/theblacktoolkit/files/1.0.3.2/Extending_XML_Visual_Editor.pdf/download
Acctually the Black Toolkit supports (natively) is Web documents (HTML, PHP, JSP, ASP), Java Swing with NullLayout. But you can write the componentset for your favorite language, without recompiling the IDE.
I have too much work in developing the toolkit plus writing the componentsets. Because of this I had to drop the Win32 Form, to work on it some months later. Someone wants to help me?
Sunday, March 25, 2012
Creting your own language support in the Black Toolkit
This is an easy part. The IDE doesn't need to be recompiled for this.
- Go to the languages folder and copy the en.ini to <your_country_code>.ini
- The file encoding is UTF-8. Edit <your_country_code>.ini, changing just the values part to your language's text.
- Make sure to keep %s, %d, %f from values part because they will be expanded in printf()/Format() functions. Like "Do you wish to save %s". The %s will be expanded to the file name.
- Start the editor. Choose from menu Configurations->Languages and choose your language.
Tuesday, March 6, 2012
Connecting to a remote Black Toolkit through X11 and SSH
The black toolkit has some advantages, in being centered in a X11-forwarded SSH server, above others editors:
To connect the black toolkit in a Linux server you need:
Now, in the client side, it depends of the operating system:
On Windows, you need to install XMing for access SSH.
XMing: https://sourceforge.net/projects/xming
For Linux client is a bit simple, just install SSH-client (already comes with) package and do:
$ ssh -p <port> <-X or -Y> <-C> user@server blacktoolkit
You can use it in cell phones, like Android:
http://code.google.com/p/connectbot/
https://play.google.com/store/apps/details?id=com.theqvd.android.client
I hope had helped everyone.
- It is faster compared to most of editors, consuming less resources.
- It runs on Linux.
- SSH is open source.
To connect the black toolkit in a Linux server you need:
- Install Black Toolkit in the Linux server.
- Turn on SSH server, if it is not already enabled.
- Enable X11 forwarding in SSH server (X11Forwarding yes), on /etc/ssh/shhd_config, and restart SSH.
Now, in the client side, it depends of the operating system:
On Windows, you need to install XMing for access SSH.
XMing: https://sourceforge.net/projects/xming
- Activate XMing service
- Configure XLaunch to call blacktoolkit, instead of Xterm, and call the software.
Running Black Toolkit (from a Linux server) on Windows XP |
For Linux client is a bit simple, just install SSH-client (already comes with) package and do:
$ ssh -p <port> <-X or -Y> <-C> user@server blacktoolkit
You can use it in cell phones, like Android:
http://code.google.com/p/connectbot/
https://play.google.com/store/apps/details?id=com.theqvd.android.client
- Install ConnectBot and QVD.
- Start QVD service.
- Start ConnectBot and configure connection.
- Remember to do a port forward of the port 6000 for ConnectBot.
- Connect with ConnectBot and call the program you want, or blacktoolkit.
- Now see the QVD window.
- The Xvncpro home page contains the documentation for double-clicks, right-clicks, etc.
I hope had helped everyone.
Friday, February 24, 2012
Installing Slackware softwares with Blackpkg
The semi-official site of packages is http://www.slackbuilds.org, but compiling them can be difficult.
By using Blackpkg http://sourceforge.net/projects/blackpkg/files/blackpkg-1.1-noarch-Sbo.tgz/download you can install packages of the repository in just one line of command, and set flags like the processor.
Example installing Google-Chromium. ( -march=native to compile natively for my CPU):
# export SLKCFLAGS="-O2 -march=native"
# blackpkg -y libevent chromium
Installing ExtremeTuxRacer with all 3D power of CPU!
# export SLKCFLAGS="-O2 -march=native"
# blackpkg -y extremetuxracer
By using Blackpkg http://sourceforge.net/projects/blackpkg/files/blackpkg-1.1-noarch-Sbo.tgz/download you can install packages of the repository in just one line of command, and set flags like the processor.
Example installing Google-Chromium. ( -march=native to compile natively for my CPU):
# export SLKCFLAGS="-O2 -march=native"
# blackpkg -y libevent chromium
Installing ExtremeTuxRacer with all 3D power of CPU!
# export SLKCFLAGS="-O2 -march=native"
# blackpkg -y extremetuxracer
Subscribe to:
Posts (Atom)