Wednesday, June 29, 2011

PostreSQL -=- Find all row count for every tables

In order to find all row count for every tables in a database, you can type the following SELECT

SELECT schemaname,relname,n_live_tup 
  FROM pg_stat_user_tables 
  ORDER BY n_live_tup DESC;

Tuesday, June 21, 2011

Subversion -=- Can't find a temporary directory

When trying to checkout or update my code, I'm getting this error:

Cannot checkout from svn: Can't find a temporary directory: Error string not specified yet

We got this error because the is no remaining space on the drive. After freeing some space on the drive, everything goes well.

Tuesday, June 14, 2011

EDI & EDIFACT Document Mapping


Here's a mapping between commons EDI & EDIFACT transactions.

Price Sales Catalog 832 PRICAT
Price Authorization Acknowledgement/Status 845 ATHSTS
Specification/Technical Information 841 PRDSPE
Request For Quotation 840 REQOTE
Response To Request For Quotation 843 QUOTES
Electronic Bid Form 833 --
Purchase Order 850 ORDERS
Purchase Order Acknowledgement 855 ORDRSP
Purchase Order Change 860 ORDCHG
Purchase Order Change Acknowledgement 865 ORDRSP
Order Status Inquiry 869 ORSSTA
Order Status Report 870 ORDREP
Contract Award 836 --
Planning Schedule/Material Release 830 DELFOR
Shipping Schedule 862 DELJIT
Production Sequence 866 --
Ship Notice/manifest (ASN) 856 DESADV
Report of Test Results 863 QALITY
Material Safety Data Sheet 848 --
Contract Award 836 --
Shipment Information (Bill of Lading) 858 IFTMCS
Receiving Advice 861 RECADV
Non-conformance Information-Disposition Transaction, Cause/Correction 842 NONCON
Inventory Inquiry/Advice 846 INVRPT
Product Transfer and Resale Report 867 SLSRPT
Product Transfer Account Adjustment 844 --
Response To Product Transfer Account Adjustment 849 --
Invoice 810 INVOIC
Freight Invoice 859 IFTMCS
Payment order/Remittance Advice (EFT) 820 REMADV
Lockbox 823 --
Financial Information Reporting 821 --
Functional Acknowledgement 997 CONTRL
Application Advice 824 BANSTA
Trading Partner Profile 838 PARTIN

EDIFACT -=- List of Documents

Hi here's a list of all EDIFACT documents.

  • 270-A1 Eligibility, Coverage or Benefit Inquiry
  • 271-A1 Eligibility, Coverage or Benefit Information
  • 276-A1 Health Care Claim Status Request
  • 277-A1 Health Care Claim Status Notification
  • 278-A1 Health Care Services Review -- Request for Review
  • 278-A3 Health Care Services Review -- Response to Request for Review
  • 820-A1 Payment Order/Remittance Advice
  • 834-A1 Benefit Enrollment and Maintenance
  • 835-W1 Health Care Claim Payment/Advice
  • 837-Q1 Health Care Claim Professional
  • 837-Q2 Health Care Claim Dental
  • 837-Q3 Health Care Claim Institutional
  • APERAK Application error and acknowledgement message
  • AUTHOR Authorization message
  • AVLREQ Availability request - interactive message
  • AVLRSP Availability response - interactive message
  • BALANC Balance message
  • BANSTA Banking status message
  • BAPLIE Bayplan/stowage plan occupied and empty locations message
  • BAPLTE Bayplan/stowage plan total numbers message
  • BERMAN Berth management message
  • BMISRM Bulk marine inspection summary report message
  • BOPBNK Bank transactions and portfolio transactions report message
  • BOPCUS Balance of payment customer transaction report message
  • BOPDIR Direct balance of payment declaration message
  • BOPINF Balance of payment information from customer message
  • BUSCRD Business credit report message
  • CALINF Vessel call information message
  • CASINT Request for legal administration action in civil proceedings message
  • CASRES Legal administration response in civil proceedings message
  • CHACCO Chart of accounts message
  • CLASET Classification information set message
  • CNTCND Contractual conditions message
  • COACSU Commercial account summary message
  • COARRI Container discharge/loading report message
  • CODECO Container gate-in/gate-out report message
  • CODENO Permit expiration/clearance ready notice message
  • COEDOR Container stock report message
  • COHAOR Container special handling order message
  • COLREQ Request for a documentary collection message
  • COMDIS Commercial dispute message
  • CONAPW Advice on pending works message
  • CONDPV Direct payment valuation message
  • CONDRA Drawing administration message
  • CONDRO Drawing organisation message
  • CONEST Establishment of contract message
  • CONITT Invitation to tender message
  • CONPVA Payment valuation message
  • CONQVA Quantity valuation message
  • CONRPW Response of pending works message
  • CONTEN Tender message
  • CONWQD Work item q uantity determination messa e
  • COPARN Container announcement message
  • COPAYM Contributions for payment
  • COPINO Container pre-notification message
  • COPRAR Container discharge/loading order message
  • COREOR Container release order message
  • COSTCO Container stuffing/stripping confirmation message
  • COSTOR Container stuffing/stripping order message
  • CREADV Credit advice message
  • CREEXT Extended credit advice message
  • CREMUL Multiple credit advice message
  • CUSCAR Customs cargo report message
  • CUSDEC Customs declaration message
  • CUSEXP Customs express consignment declaration message
  • CUSPED Periodic customs declaration message
  • CUSREP Customs conveyance report message
  • CUSRES Customs response message
  • DEBADV Debit advice message
  • DEBMUL Multiple debit advice message
  • DEBREC Debts recovery message
  • DELFOR Delivery schedule message
  • DELJIT Delivery just in time message
  • DESADV Despatch advice message
  • DESTIM Equipment damage and repair estimate message
  • DGRECA Dangerous goods recapitulation message
  • DIRDEB Direct debit message
  • DIRDEF Directory definition message
  • DMRDEF Data maintenance request definition message
  • DMSTAT Data maintenance status report/query message
  • DOCADV Documentary credit advice message
  • DOCAMA Advice of an amendment of a documentary credit message
  • DOCAMI Documentary credit amendment information message
  • DOCAMR Request for an amendment of a documentary credit message
  • DOCAPP Documentary credit application message
  • DOCARE Response to an amendment of a documentary credit message
  • DOCINF Documentary credit issuance information message
  • ENTREC Accounting entries message
  • FINCAN Financial cancellation message
  • FINPAY Multiple interbank funds transfer message
  • FINSTA Financial statement of an account message
  • GENRAL General purpose message
  • GESMES Generic statistical message
  • HANMOV Cargo/goods handling and movement message
  • ICASRP Insurance claim assessment and reporting message
  • ICSOLI Insurance claim solicitor's instruction message
  • IFCSUM Forwarding and consolidation summary message
  • IFTCCA Forwarding and transport shipment charge calculation message
  • IFTDGN Dangerous goods notification message
  • IFTFCC International transport freight costs and other charges message
  • IFTIAG Dangerous cargo list message
  • IFTICL Cargo insurance claims message
  • IFTMAN Arrival notice message
  • IFTMBC Booking confirmation message
  • IFTMBF Firm booking message
  • IFTMBP Provisional booking message
  • IFTMCA Consignment advice message
  • IFTMCS Instruction contract status message
  • IFTMFR International Forwarding And Transport
  • IFTMIN Instruction message
  • IFTRIN Forwarding and transport rate information message
  • IFTSAI Forwarding and transport schedule and availability information me
  • IFTSTA International multimodal status report message
  • IFTSTQ International multimodal status request message
  • IHCEBI Interactive health insurance eligibility and benefits inquiry and
  • IHCLME Health care claim or encounter request and response - interactive
  • IMPDEF EDI implementation guide definition message
  • INFCON Infrastructure condition message
  • INFENT Enterprise accounting information message
  • INSDES Instruction to despatch message
  • INSPRE Insurance premium message
  • INSREQ Inspection request message
  • INSRPT Inspection report message
  • INTCHG Interchange Control Structures
  • INVOIC Invoice message
  • INVRPT Inventory report message
  • IPPOAD Insurance policy administration message
  • IPPOMO Motor insurance policy message
  • ISENDS Intermediary system enablement or disablement message
  • ITRRPT In transit report detail message
  • JAPRES Job application result message
  • JINFDE Job information demand message
  • JOBAPP Job application proposal message
  • JOBCON Job order confirmation message
  • JOBMOD Job order modification message
  • JOBOFF Job order message
  • JUPREQ Justified payment request message
  • LEDGER Ledger message
  • LREACT Life reinsurance activity message
  • LRECLM Life reinsurance claims message
  • MEDPID Person identification message
  • MEDPRE Medical prescription message
  • MEDREQ Medical service request message
  • MEDRPT Medical service report message
  • MEDRUC Medical resource usage and cost message
  • MEQPOS Means of transport and equipment position message
  • MOVINS Stowage instruction message
  • MSCONS Metered services consumption report message
  • ORDCHG Purchase order change request message
  • ORDERS Purchase order message
  • ORDRSP Purchase order response message
  • OSTENQ Order status enquiry message
  • OSTRPT Order status report message
  • PARTIN Party information message
  • PASREQ Travel tourism and leisure product application status request - i
  • PASRSP Travel tourism and leisure product application status response -
  • PAXLST Passenger list message
  • PAYDUC Payroll deductions advice message
  • PAYEXT Extended payment order message
  • PAYMUL Multiple payment order message
  • PAYORD Payment order message
  • PRICAT Price/sales catalogue message
  • PRIHIS Pricing history message
  • PROCST Project cost reporting message
  • PRODAT Product data message
  • PRODEX Product exchange reconciliation message
  • PROINQ Product inquiry message
  • PROSRV Product service message
  • PROTAP Project tasks planning message
  • PRPAID Insurance premium payment message
  • QALITY Quality data message
  • QUOTES Quote message
  • RDRMES Raw data reporting message
  • REBORD Reinsurance bordereau message
  • RECADV Receiving advice message
  • RECALC Reinsurance calculation message
  • RECECO Credit risk cover message
  • RECLAM Reinsurance claims message
  • RECORD Reinsurance core data message
  • REGENT Registration of enterprise message
  • RELIST Reinsured objects list message
  • REMADV Remittance advice message
  • REPREM Reinsurance premium message
  • REQDOC Request for document message
  • REQOTE Request for quote message
  • RESETT Reinsurance settlement message
  • RESMSG Reservation message
  • RESREQ Reservation request - interactive message
  • RESRSP Reservation response - interactive message
  • RETACC Reinsurance technical account message
  • RETANN Announcement for returns message
  • RETINS Instruction for returns message
  • RPCALL Repair call message
  • SAFHAZ Safety and hazard data message
  • SANCRT International movement of goods governmental regulatory message
  • SKDREQ Schedule request - interactive message
  • SKDUPD Schedule update - interactive message
  • SLSFCT Sales forecast message
  • SLSRPT Sales data report message
  • SOCADE Social administration message
  • SSIMOD Modification of identity details message
  • SSRECH Worker's insurance history message
  • SSREGW Notification of registration of a worker message
  • STATAC Statement of account message
  • STLRPT Settlement transaction reporting message
  • SUPCOT Superannuation contributions advice message
  • SUPMAN Superannuation maintenance message
  • SUPRES Supplier response message
  • TANSTA Tank status report message
  • TAXCON Tax control message
  • TIQREQ Travel tourism and leisure information inquiry request - interactive
  • TIQRSP Travel tourism and leisure information inquiry response - interactive
  • TPFREP Terminal performance message
  • TSDUPD Timetable static data update - interactive message
  • TUPREQ Travel, tourism and leisure data update request - interactive message
  • TUPRSP Travel, tourism and leisure data update response - interactive message
  • UTILMD Utilities master data message
  • UTILTS Utilities time series message
  • VATDEC Value added tax message
  • VESDEP Vessel departure message
  • WASDIS Waste disposal information message
  • WKGRDC Work grant decision message
  • WKGRRE Work grant request message

Monday, June 13, 2011

Java -=- Listing directories


If you want to list only the directories in Java, you can use the following code:

File dir = new File("/My/Directory/Path");
File[] directories = dir.listFiles((FilenameFilter) DirectoryFileFilter.INSTANCE);
for (int i = 0; i < directories.length; i++) {
    // Each file is a directory

Saturday, June 11, 2011

Math -=- Good Right-angled Triangles Calculator


I found this site really interesting. It calculates the angles and width for us. No need to do sin, cos, tan...

Friday, June 10, 2011

Java -=- Renaming a file

To rename a file, simply do the following:

// File (or directory) with old name
File file = new File("oldname");

// File (or directory) with new name
File file2 = new File("newname");

// Rename file (or directory)
boolean success = file.renameTo(file2);
if (!success) {
    // File was not successfully renamed

Java -=- Moving a file

To move a file from a directory to another, simply do the following:

// File (or directory) to be moved
File file = new File("filename");

// Destination directory
File dir = new File("directoryname");

// Move file to new directory
boolean success = file.renameTo(new File(dir, file.getName()));
if (!success) {
// File was not successfully moved

UNIX -=- GREP with OR operand

To find HR or FS in a file named myfile, type the following command in a terminal:

egrep 'HR|FS' myfile

Tuesday, June 7, 2011

JDEdwards -=- How to search JDE EnterpriseOne Data Dictionary from SQL

The Issue

The JD Edwards EnterpriseOne database does not contain any table or field name aliases with meaningful English descriptions. This lack of descriptions creates an issue for application and software developers in accessing the Table File Definitions and Field Descriptions contained in the JDE Data Dictionary. Without access to the table descriptions and the field descriptions, developers are not able to easily navigate the data needed for developing applications or reports.
Normally there are only two ways to get this information; both native methods of accessing table and field description information are inside the JD Edwards application. This requires that developers be trained in JDE to access the information they need. The first native method of access is to log into the JDE Fat Client and search through the Data Dictionary for the specific field aliases and/or table names. The second method is to pull up the Table Browser inside the EnterpriseOne Web Application, or Fat Client, and browse the data table, toggling between the field names and the field descriptions.
Most developers prefer to stay inside of SQL, or their chosen Integrated Development Environment (IDE), while maintaining access to all the information necessary to identify JDE fields and tables.  Additionally, the ability to see field lengths and data, to search for specific field aliases throughout JDE, and to to perform wild card searches for field descriptions, aliases, data types, and other information in the Data Dictionary, from the development environment, is a huge time saver.

The Solution

I have developed a simple table function, called TFD (Table File Descriptions), which allows developers to search and display table file descriptions and JDE Data Dictionary information with a SQL command inside of a query window of your chosen IDE. How it works is simple. You just type a select statement and use the TFD() function in the “From Clause”. The TFD() function will return a table result based on the table name passed in, and any additional “Where Clause” constraints.


A basic query using the TFD() function will result in a standard Table File Description result set as follows:
The statement:
select * from tfd('F4211')
Produce the following results:

A more complex SQL Statement such as this:
distinct [JDE Table], [Table Name], [JDE Field], [Item Description] 
from TFD('%')
where alias = 'UOM4'
order by [JDE Table]

Will yield the following results:
Notice that I used the wildcard character ‘%’ (percent) to show all tables where the Pricing Unit of Measure (UOM4) is used.
You can use any combination of wild cards and select statements with the TFD() function. You can also search on any field in the result set. If, for example you wanted to find all the fields in the JDE EDI tables (‘F47%’) containing the word ‘%Partner%’ in it, you could write a query as follows:
select [JDE Table], [Table Name], [JDE Field], [Item Description] 
from tfd('F47%')
where [Item Description] like '%Partner%'
The result would be:

As you can see from these few examples, the TFD() function can save time in development by making JDE object names and descriptions visible to the SQL, VB, C#, or Java integrated development environments. Developers can save time finding which fields or tables contain the data they need, and begin making sense of the cryptic JDE alias names.

The code

Simply copy the following code and execute it in the IDE of your choice. I used SQL Management Studio to develop and create the function. Once the function has been created in the JDE database, it’ll be ready to use.
Note: you’ll have to change the schema names and database names to match your JDE EnterpriseOne environment.
GOCREATE FUNCTION [dbo].[tfd] (@tbl varchar(99))
-- =============================================
-- Written by Bryant Avey, InterNuntius, Inc.
-- Provided free "As Is" with no warranties or guarantees
-- I just ask that you keep these comments in the function, if you use it.
-- The complete article describing this function can be found at: 

-- Description: Retrieve Table and Field Descriptions for any JD Edwards Table
-- Use: execute this function by passing in the table name as a parameter:
-- select * from tfd('F47012')
-- you can also use it to find where fields are used:
-- select * from tfd('%') where alias = 'UOM4'
-- =============================================
RETURN (       
-- Get the table field definition data
        select "JDE Schema", "JDE Table", simd "Table Name",
        colorder "Field Sequence", "JDE Field",
        f9210.frdtai Alias,
        frclas "Data Class",
        frdtat "Data Type",
        frdtas Size,
        frdtad "Decimals Stored",
        frcdec "Decimals Displayed",
        frowdi "Item Description",
      --frdsca "Dictionary Description",
        length SQLlength,
        prec SQLprecision,
        isnullable SQLnull
        from sysobjects
        join syscolumns on =
        join jde812.dd812.f9210 on substring(,3,99)
                                 = f9210.frdtai
        join jde812.ol812.f9860 on = siobnm
        join sys.schemas on sysobjects.uid = sys.schemas.schema_id
        where like @tbl and sysobjects.xtype = 'U'

Please see original article at :

Monday, June 6, 2011

Subversion -=- Resolve Tree Conflicts

To resolve all tree conflicts in a project with Subversion, do the following steps:

  1. Open a Terminal
  2. Go in your project's root
  3. Type svn resolve --accept working -R .
  4. All conflicts will be resolved
  5. Commit changes

Mac OS X -=- Disabling Dashboard Function From The Middle Mouse Button

For Dashboard - change the mouse section to either Nothing (-) or add modifier keys to the mouse click (eg. hold any combination of CommandOption, and or Shift when choosing what mouse button to use).
Screenshot of Exposé and Spaces

Excel -=- Remove duplicates in list

Method 1: Use the Unique Option in Advanced Filter

  1. To the right of your data, copy the heading from the column where you want to find unique values.
  2. Select a cell in your data set.
  3. In Excel 97-2003, choose Data - Filter - Advanced Filter. In Excel 2007, choose the Advanced icon from the Sort & Filter group of the Data ribbon.
  4. Choose Copy to another Location
  5. In the Copy To box, specify the copy of your heading. In the Figure, this is cell D1
  6. Click the box for Unique Records Only
  7. Click OK
Excel will provide you a unique list of customers in column D. 
Method 2: Use a Formula to Determine if This Record is Unique
The COUNTIF function can count how many records above the current record match the current record. The trick to making this work is to use a single dollar sign in the reference. If you are entering a formula in C2 and you reference A$1:A1, this is saying, "Start from the absolute reference of A1 and go down to the record above the current record". When you copy this formula down, the first A$1 will stay the same. The second A1 will change. In Row 17, the formula in C2 will read: =COUNTIF(A$1:A16,A17)=0.

Once you have entered the formula in C2 and copied it down to all rows, you should copy C2:C15 and then use Edit - Paste Special Values to convert the formulas to values. You can now sort descending by column C and the unique values will be at the top of the list.
Method 3: Use a Pivot Table to get Unique Customers
A pivot table is great at finding unique values. This is the fastest way in Excel 2000-2003.
  1. Select a cell in your data set.
  2. Choose Data - Pivot Table and Pivot Chart Report.
  3. Click Finish.
  4. In the Pivot Table Field List, click on the Customer Field. Click the Add To button.
Excel will show you a unique list of customers. 
Method 4: New in Excel 2007 - Use Conditional Formatting to Mark Duplicates
Excel 2007 offers new methods for finding duplicates. Select the range of customers. From the Home ribbon, choose Conditional Formatting - Highlight Cells Rules - Duplicate Values and click OK. 
If a name is found twice, Excel will highlight both occurences of the name. You would then want to sort all of the highlighted cells to the top.
  1. Click any field in the customer column. Click the AZ button in the Data ribbon.
  2. Find a cell that has the red highlighting. Right click the cell. Choose Sort - Put Selected Cell Color on Top.
Method 5: New in Excel 2007 - Use Remove Duplicates icon
This method is highly destructive! Make a copy of your dataset before you do this!
  1. Copy your range of data to a blank section of the worksheet
  2. Select a cell in your data set.
  3. From the Data ribbon, choose Remove Duplicates.
  4. The Remove Duplicates dialog will give you a list of columns. Choose the columns which should be considered. For example, if you needed to remove records where both the customer and invoice were identical, check the box for both fields. In this case, you are trying to get a unique list of customers, so choose only the Customer field.
  5. Click OK.
Excel will delete records from your dataset. It will report that n duplicates were removed and nn records remain. 
As you can see, there are many methods for dealing with duplicates. Excel 2007 adds two new tools to your arsenal.


Friday, June 3, 2011

Firefox -=- Could not initialize the browser security component

For an unknown reason, this morning Firefox can't load SSL web site.

I've reinstalled Firefox but the problem was still there.

Here's the solution:

Start the profile manager, delete my user and create another one
/Applications/ -profilemanager