// 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 }
Friday, June 10, 2011
Java -=- Moving a file
To move a file from a directory to another, simply do the following:
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.Examples
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:
Select
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.
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[tfd] (@tbl varchar(99)) RETURNS TABLE
AS
-- ============================================= -- 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:
-- http://wp.me/pBPqA-F-- 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
sys.schemas.name "JDE Schema", sysobjects.name "JDE Table", simd "Table Name", colorder "Field Sequence",
syscolumns.name "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 sysobjects.id = syscolumns.id
join jde812.dd812.f9210 on substring(syscolumns.name,3,99) = f9210.frdtai
join jde812.ol812.f9860 on sysobjects.name = siobnm
join sys.schemas on sysobjects.uid = sys.schemas.schema_id
where sysobjects.name like @tbl and sysobjects.xtype = 'U' )
Please see original article at : http://bryantavey.com/2009/08/17/how-to-search-jde-enterpriseone-data-dictionary-from-sql/
Monday, June 6, 2011
Subversion -=- Resolve Tree Conflicts
To resolve all tree conflicts in a project with Subversion, do the following steps:
- Open a Terminal
- Go in your project's root
- Type svn resolve --accept working -R .
- All conflicts will be resolved
- 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 Command, Option, and or Shift when choosing what mouse button to use).
Excel -=- Remove duplicates in list
Method 1: Use the Unique Option in Advanced Filter
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.
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.
This method is highly destructive! Make a copy of your dataset before you do this!
As you can see, there are many methods for dealing with duplicates. Excel 2007 adds two new tools to your arsenal.
Link: http://www.mrexcel.com/tip138.shtml
- To the right of your data, copy the heading from the column where you want to find unique values.
- Select a cell in your data set.
- 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.
- Choose Copy to another Location
- In the Copy To box, specify the copy of your heading. In the Figure, this is cell D1
- Click the box for Unique Records Only
- Click OK
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.
A pivot table is great at finding unique values. This is the fastest way in Excel 2000-2003.
- Select a cell in your data set.
- Choose Data - Pivot Table and Pivot Chart Report.
- Click Finish.
- In the Pivot Table Field List, click on the Customer Field. Click the Add To button.
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.
- Click any field in the customer column. Click the AZ button in the Data ribbon.
- Find a cell that has the red highlighting. Right click the cell. Choose Sort - Put Selected Cell Color on Top.
This method is highly destructive! Make a copy of your dataset before you do this!
- Copy your range of data to a blank section of the worksheet
- Select a cell in your data set.
- From the Data ribbon, choose Remove Duplicates.
- 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.
- Click OK.
Link: http://www.mrexcel.com/tip138.shtml
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
References:
http://kb.mozillazine.org/Could_not_initialize_the_browser_security_component
http://kb.mozillazine.org/Profile_Manager#Mac_OS_X
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/Firefox.app/Contents/MacOS/firefox-bin -profilemanager
References:
http://kb.mozillazine.org/Could_not_initialize_the_browser_security_component
http://kb.mozillazine.org/Profile_Manager#Mac_OS_X
Subscribe to:
Posts
(Atom)