How to return only filename without extention using File.list() ?
I want to return every filename into an array using File.list() However I want my return String array to be filtered out file extention. That means only return file name without extention. How? Please advice! Thanks.
Use the following method for every file in the list (it's from the top of my head so maybe there are a few typos):
private String getNameWithoutExtension(File f) {
String s = f.getName();
String name = s;
int i = s.lastIndexOf('.');
if (i > 0 && i < s.length() - 1) {
name = s.substring(1, i);
return name;
}
Similar Messages
-
How to deactivate only 1 EXIT (extention ) in CMOD ?
Hello !!
How to deactivate only 1 EXIT (extention ) in CMOD ?
BR, JAcekI dont think you can do it....Ideally, you will have code only in EXIT which you want.....
-
How do I only edit one page using DW?
How do I only edit one page using DW?
What community should I join?Thanks for your suggestion but that doesn't seem to work. That was the first place that I went to look and everything was checked. Just doesn't work but it does work in Safari.
-
Anyone know how to select only even or odd numbered files in lightroom?
Anyone know how to select only even or odd numbered files in lightroom? I need to reduce the quantity of images in my timelapse sequence and this would help me greatly since there are 8250 images and doing this maually would be tediuos and make me want to kill myself.... : )
Do this.
If they are jpegs, use .jpg instead of CR2
Be sure to save this as a preset, as you WILL need it again. Mine is named "select even CR2", that is why it says that in the upper right. -
How do I only allow people on my buddy list to contact me (and stop spam)
How do I only allow people on my buddy list to contact me (and stop spam)
Go to iChats prefs/accounts
-
OutOfMemoryError while using File.list()
I'm facing OutOfMemoryError while using file.list(). Below is the description of the requirement
We have a directory structure of the following format -
**sourcedir\<date folders>\No Retry\<reason folders>\..\..\....\<*.ini files>**
sourcedir will be passed as argument to the program. The directories present in between "<>" can be in multiples of 10. The *.ini files can be in multiple of lacs in each directory.
The program is required to browse through the directory structure and look for *.ini files. The *.ini files are parsed for some data which needs to be stored in data base. We are using "File.list()" to load the name of files and FileFilter to find *.ini" files. As the number of files are huge the program is throwing OutOfMemoryError. We have increased heap space, it solved the problem. But we are looking for a solution which will not throw this error in future as the number of files may increase.
Can you please suggest us a technique to solve this permanently as we are beginners to java.I suggest you try using a memory profiler to see where your memory is being used.
The problem you suggest shouldn't consume so much memory. -
How to return only the first string
Hi Guys,
I have a mapping where I am creating a filename from data in within my data file, I am using one of my variables i.e. Account
The data looks like this
Account:
123
123
123
456
456
456
789
789
789
What I want is to is return only the first row u201C123" and concatenate it with a constant to make up the filename.
Any help will be appreciated.
Kind Regards,
CJ Bestervery simple
use copy value standard function like below.
Account------->copyvalue(0)----------->
CONCAT------------->TARGET
Constant------->
Regards,
Raj -
How to return only rows belonging to an authenticated user?
Hi, i have a basic JHeadstart application with a form which is currently returning all the rows of a tasks table containing tasks belonging to users, and allows update and insert of new rows to this table.
I wish to extend this application to include a basic login screen to authenticate the users initially, and then somehow pass the username onto the Jhs form and have it return only the rows from the tasks table which have a userid matching the login username.
So basically i want to hide the userid column from displaying on screen, and code the form so that the userid column must always match the login username during any view/update/insert/delete operation the form initiates.
Currently the users are all separate database users and are not known/controlled by the Jdeveloper app yet, so a database connection based authentication method would be most relevent I believe, however I haven't seen any mention in the DB authentication based blogs regarding using the login information in the application such as restricting the results of a table form in the way described above.
Any pointers appreciated,
ThanksHi,
it's used in conjuction with JAAS / Container managed security. The user requests a page which is within a protected resource and is then prompted to login. Once logged in the user principal is available (can be referenced) in both the user interface and model layers.
The VPD option is there to reduce the coding required in the ADF model layer.
This article explains how to get JAAS to use a custom database LoginModule which sits undeneath JAAS.
http://www.oracle.com/technology/products/jdev/howtos/1013/oc4jjaas/oc4j_jaas_login_module.htm
This you how to reference the currently logged in user in the various layers within the application:
http://brendenanstey.blogspot.com/2007/05/j2ee-container-managed-security-how-to.html
The security setup is also covered in the ADF Developer guide which is here:
http://download.oracle.com/docs/pdf/B25947_01.pdf
Brenden -
How to sort random number without the used of order by
Hi ,
how should 5 random number be sorted without the use of order by in PLSQL
eg.
id amount
1 2
2 9
3 3
4 5
5 7
Edited by: sake1 on 1-dec-2010 8:16I used Altavista and found one example, how does it look?
DECLARE
/* there is no built array in oracle, you must declare
your own */
TYPE Numarray IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
/* the array of numbers - using assoc array because I can start
with zero like traditional arrays */
Nums Numarray;
n NUMBER := 0;
Temp NUMBER;
BEGIN
/* load up the array, put 20 random values in the array,
in array indicies 0 to 19 */
FOR i IN 0 .. 19
LOOP
Nums(i) := Round(Dbms_Random.Value(1, 1000));
END LOOP;
/* get the array size */
n := Nums.Count();
/* display the unsorted values - loop through the whole array and
print out the values */
Dbms_Output.Put_Line('unsorted:');
FOR i IN Nums.First .. Nums.Last LOOP
Dbms_Output.Put_Line(Nums(i));
END LOOP;
/* bubble sort - using two loops, compare each value with the one
after it
if the one after the current one is smaller , then
switch their locations in the array, this is just like standard
bubble sorts
in other languages. The only real diff is the syntax.
FOR i IN 0 .. n - 1 LOOP
FOR j IN 0 .. n - (i + 1) - 1 LOOP
IF (Nums(j) > Nums(j + 1)) THEN
Temp := Nums(j);
Nums(j) := Nums(j + 1);
Nums(j + 1) := Temp;
END IF;
END LOOP;
END LOOP;
/* display the values sorted */
Dbms_Output.Put_Line('sorted');
FOR i IN Nums.First .. Nums.Last LOOP
Dbms_Output.Put_Line(Chr(9) || Nums(i));
END LOOP;
END;
unsorted:
155
909
795
977
942
214
105
269
283
820
108
594
784
921
856
736
802
457
951
411
sorted
105
108
155
214
269
283
411
457
594
736
784
795
802
820
856
909
921
942
951
977
*/In the code the first comment is wrong actually i think, that one:
"there is no built array in oracle, you must declare your own"
I remember there were some system collection-types, if i'm not mixing with something, i remember there was some kind of such but they were un-documented ones, so we can juridically say that the comment in the code was still correct. -
How to Return only alpha-numeric Values
In my query, I want to return only records for which data in a specific column is alpha-numeric. Any records having this field as NULL, or containing symbols, I want to exclude. What's the best way to do this?
Thanks,
Briceselect str from tab1
where str is not null
and translate(str, '_0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','_') is null
/Regards
Dmytro -
How to print only fatal error in log file in tomcat4.1
Hi all ,i m using tomcat4.1
1> i want to print only fatal error in log file ,but it print all thing in log file ,how i can avoid it(because i think this process is consuming my resource)
assume below ip address is corect:
this is exact printing in my log file
.12.2.3.3 - - [24/Oct/2007:00:00:00 5050] "GET /menu/ir.jsp HTTP/1.1" 200 2828
12.2.3.3 - - [24/Oct/2007:00:00:00 5050] "GET /menu/bottomAdv.jsp HTTP/1.1" 200 528
12.2.3.3 - - [24/Oct/2007:00:00:02 5050] "GET /menu/alerts.jsp HTTP/1.1" 200 323
12.2.3.3 - - [24/Oct/2007:00:00:02 5050] "GET /alerts/createAlertShow.jsp HTTP/1.1" 200 26140
123.2.3. - - [24/Oct/2007:00:00:05 5050] "GET /menu/getsensex.jsp HTTP/1.1" 200 642
12.2.3.3 - - [24/Oct/2007:00:00:05 5050] "GET /menu/latestRecommendation.jsp HTTP/1.1" 200 5210
12.2.3.3 - - [24/Oct/2007:00:00:05 5050] "GET /portfolio/watchlist/displayWatchlistItemsShow.jsp?watchlistId=20070509013642953_1&watchlistName=First&refreshRate=900&flag=1 HTTP/1.1" 500 7257
12.2.3.3 - - [24/Oct/2007:00:00:05 5050] "GET /menu/iwealthNewsScroller.jsp HTTP/1.1" 200 2828
112.23.3 - - [24/Oct/2007:00:00:06 5050] "GET /menu/alerts.jsp HTTP/1.1" 200 323
112.23.3 - - [24/Oct/2007:00:00:06 5050] "GET /menu/bottomAdv.jsp HTTP/1.1" 200 528
12.2.3.3 - - [24/Oct/2007:00:00:07 5050] "GET /menu/alerts.jsp HTTP/1.0" 200 323
12.2.3.3 - - [24/Oct/2007:00:00:09 5050] "POST /Transaction/equity/modifyConfirmShow.jsp?DelId=0 HTTP/1.1" 200 28661
12.2.3.3 - - [24/Oct/2007:00:00:09 5050] "GET /menu/getsensex.jsp HTTP/1.1" 200 6422>what will happen if i change timestamp="false" and what is the significance of verbosity="1" or "2" or "3" ,or "4" and what happen if i change debug="1" or other in below code
<Logger className="org.apache.catalina.logger.FileLogger" debug="0" directory="logs" prefix="www.xyz_log." suffix=".txt" timestamp="true" verbosity="4"/>Edited by: Deepak23 on Oct 24, 2007 10:41 PM
Edited by: Deepak23 on Oct 24, 2007 11:16 PMOne of my standard answers (which will explain the use of Directory Objects)...
The UTL_FILE_DIR parameter has been deprecated by oracle in favour of direcory objects because of it's security problems.
The correct thing to do is to create a directory object e.g.:
CREATE OR REPLACE DIRECTORY mydir AS 'c:\myfiles';Note: This does not create the directory on the file system. You have to do that yourself and ensure that oracle has permission to read/write to that file system directory.
Then, grant permission to the users who require access e.g....
GRANT READ,WRITE ON DIRECTORY mydir TO myuser;Then use that directory object inside your FOPEN statement e.g.
fh := UTL_FILE.FOPEN('MYDIR', 'myfile.txt', 'r');Note: You MUST specify the directory object name in quotes and in UPPER case for this to work as it is a string that is referring to a database object name which will have been stored in uppercase by default. -
How to copy only an alias, not source file in ARD?
I'm trying to copy an alias from my computer to all the imacs in my lab with ARD 3...but instead of the alias, the folder the alias points to is being copied. How can I only copy the alias. My apologies if the question has been asked recently.
Cheers
Colin
Message was edited by: Host <to clarify Subject>The command below would create a symbolic link (alias) on the current user's desktop called 'Apps' that points to Applications. Note: You would run this command with the radio button clicked that says "run as current logged in user".
ln -s /Applications ~/Desktop/Apps
You can open up terminal and type in man ln to see the other options and how the command works. -
HEllo my problem that i putted an passcod for my i phone then i forget it so i tryed many time than they gave me i should conect to i tunes but i want to know how i can unlocked my phone without losing my files please tell me
Locked Out, Forgot Lock or Restrictions Passcode, or Need to Restore Your Device: Several Alternative Solutions
1. iOS- Forgotten passcode or device disabled after entering wrong passcode
2. iPhone, iPad, iPod touch: Wrong passcode results in red disabled screen
3. Restoring iPod touch after forgotten passcode
4. What to Do If You've Forgotten Your iPhone's Passcode
5. iOS- Understanding passcodes
6. iTunes 10 for Mac- Update and restore software on iPod, iPhone, or iPad
Forgotten Restrictions Passcode Help
You will need to restore your device as New to remove a Restrictions passcode. Go through the normal process to restore your device, but when you see the options to restore as New or from a backup, be sure to choose New.
Also, see iTunes- Restoring iOS software. -
How to check in metadata without check in files
I only want to check in some metadata for search purpose.
What should I do to allow ucm to do it without check in files?
ThanksCheck out Kyle's blog post.
-
Why did you not explain how to return a filled form via pdf file?
Why is there no explanation on how to return form via pdf file?'
Unfortunately, because IRS forms are XFA forms, the flattenPages method that the tool Gilad mentioned won't work, and neither will Preflight or PDF Optimizer.
You can fill-in and save the form with Acrobat or Reader, open it in Preview, and select: File > Print > PDF > Save as PDF
or "Save as Adobe PDF" for that last step. You may have to fiddle with the scaling to get it right.
Maybe you are looking for
-
IPhone mail app stopped loading new emails
Hello, since two days I recognized increased Battry consumption. Found out that the IOS mail app is the reason for. Once mail launched, app says loading - the internet access circle appears and nothing happens. Same happens with my wife's iPhone. We'
-
I am writing in behalf of a friend who just moved from Edinburgh to Glenluce and is unable to get satisfactory service from BT. They were promised that a router package would be delivered a week ago today. No package. After calling, they were told th
-
How to Supply the form field values to a pdf form when loading it
I am working on a web site project using Asp.net where the user has to fill in a PDF eform in acrobat reader. Then when he clicks on submit it returns to my asp.net app and the PDF form supplies the values back to my asp.net app. So my asp.net app ha
-
Can I get info about what Filter a layer have been set?
I'm not sure if this is the right place to bring up this issue. I hvae read the photoshop reference guide , the ArtLayer Object have many Methods about to set Fillters to layer , like ApplyClouds ,ApplyBlur....... unfortunately there is no such pr
-
Hi, I'm trying configure a workstation without Client32. I can map drive letters using Net Use with CIFS as a first step now I'm trying to log in as another user so that user's local account get created but it doesn't. Is Client32 required for a dyna