Help with Interface, FileFilter/FileNameFilter

I need some help with FileFilter/FileNameFilter i a part of a search engine.
If you type "-s" as argument + suffixes you want to filter, then they are added to a list as you can see...But how to use a filter? I know that i need a new class that implements FileFilter, but how is it supposed to look, and how do i use in my particular application? i should use accept as its required by the filename filter, yes?
can you please write the whole class as i'm quite sure its not that long...and how to use in my app...
And please comment other things in the code if you find any errors...thanks!
//Viktor from Sweden!
import java.io.File;
import java.util.LinkedList;
    This class prints the paths of all files (if -d flag i set),
    also recursively if -r flag is set.
<p>
    You can also filter files by writing -s flag and suffixes.
public class PrintNonDirectories {
        @param args Flags:
    <p>
        -d: Searches specified directory.
    <p>
        -r: Searches recursively.
    <P>
        -s: Filtering specified file extensions.
    public static void main (String[] args) {
        // Creates a list of suffixes.
        LinkedList <String> suffixes = new LinkedList <String>();
        File inputFile = new File(".");
        // Set the flags to false by default.
        boolean recursive = false;
        boolean directory = false;
        boolean suffix = false;
        // Check all arguments.
        for (int i = 0; i<args.length; i++) {
            if (args.equals("-d")) {
if (!directory) {
// Check if "-d" is followed by a valid path.
if (i+1 < args.length && !args[i+1].startsWith("-")) {
directory = true;
String someDir = args[i+1];
inputFile = new File(someDir);
i++;
else {
System.out.println("'-d' must be followed by a valid path");
System.exit(0);
else {
System.out.println("You wrote '-d' too many times");
System.exit(0);
else if (args[i].equals("-r")) {
if (!recursive) {
recursive = true;
else {
System.out.println("You wrote '-r' too many times");
System.exit(0);
else if (args[i].equals("-s")) {
if (!suffix) {
suffix = true;
// Check if "-s" is followed by valid file-extensions.
if (i+2>args.length || args[i+1].startsWith("-")) {
System.out.println("You must write at least one extension/file suffix");
System.exit(0);
else {
// Add suffixes.
for (i = i+1; i<args.length && !args[i].startsWith("-"); i++) {
suffixes.add(args[i]);
else {
System.out.println("You wrote '-s' too many times");
System.exit(0);
else {
System.out.println("Wrong argument");
System.exit(0);
if (inputFile.isDirectory()) {
listFiles(inputFile, recursive);
else {
System.out.println("Not a directory");
// Method lists the path of all files.
private static void listFiles (File f, boolean recursive) {
File[] filesInDir = f.listFiles();
for (File FileInDir : filesInDir) {
if (FileInDir.canRead()) {
if (FileInDir.isFile()) {
System.out.println(FileInDir.getPath());
} else if (recursive) {
listFiles(FileInDir, true);
else {
System.out.println("A file could not be read, you may not have access to the file");

Yes, i know that i must implement the accept method, but how do i use the list that i got from my file, to add all the suffixes?
i've read like
return filname.toLowerCase().endsWith(".jpg")
but how do i get from my list to use like,
return filname.toLowerCase().endsWith(".txt")||filname.toLowerCase().endsWith(".doc")
and so on?
shoud i use a constructor to get my suffixes list?
should i use a for loop to try for all the diffrent file extensions each time?
smthn like
public class SuffixFilter implements FilenameFilter {
    public SuffixFilter(LinkedList<String> suffixes) {
    public boolean accept (File dir, String name){
        for(int i = 0; i<suffixes.size(); i++)
                if(name.endsWith("suffixes.get(i))
                        return true;
                 else
                        return false;
{code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Need help with interface development

    Hi i need help with requirement below with developing interface between or online order system and sap plz lemme know what is bapi i use for creating customer, update and assigining partner id to costumer.
    SAP Development
    1.     Using standards SAP functional module (with BAPI), create interface that will create/change Ordering party customer in SAP. Following fields are mandatory for customer creation:
    •     MANDT     Client
    •     VKORG     Sales organization
    •     VTWEG     Distribution Channel
    •     SPART     Division
    •     KDGRP     Customer Group (= “ZORP)
    •     KUNNR     Customer number
    •     NAME1     Name 1
    •     NAME 2     Name 2 (if required)
    •     SORTL     Search term (short description)
    •     ZZALTKN     Search term 2 (old customer number)
    •     LAND1     Country
    •     ORT01     City
    •     PSTLZ      Zip Code
    •     REGIO      Region (state in USA)
    •     STRAS     Street
    •     TELF1     Primary telephone number
    •     TELFX     Primary Fax number
    •     ZZPRPLANS     Payment Plan
    •     CCINS     Payment card: Card type
    •     CCNUM     Payment cards: Card number
    •     CCDEF     Payment Card: Default Card Indicator
    •     ZBDGID     Customer Budget ID
    •     ZHOLD     Budget Hold indicator
    •     ZZCOSTCENT     Cost Center
    2.     Upon successful customer creation system will issues “S” (success) message that customer has been created.
    3.     New ordering party customer created in step ½, will have to be assigned as new partner to its belonging Sold-to/Ship-to customer. Use standard SAP customer functional module in order to perform this partner ID assignment. Partner ID for ordering party should be “ZO”.
    1.7     Enhancement Functionality
    Apart from creating a new interface to do the required functionality, the Order Create Interface also has to be changed to accommodate a field to pass the Ordering Party Number on the Order. The technicalities of how we are going to implement the interface will be laid out in the Tech Specs.
    Thanks
    in advance

    You have double posted, please mark this one as "solved on my own" and refer to this thread
    need help with interface development
    Regards,
    Rich Heilman

  • Help with interfaces

    I need help understanding where to start with the following study question. If you could give me some tips b/c the book is very vague and I am lost...
    Thanks
    Design a Java interface called Lockable that includes the following methods: setKey, lock, unlock, and locked. the setKey, lock, and unlock methods take an integer parameter that represents the key. The setKey method establishes the key. The lock and unlock methods lock and unlock the object but only if the key passed in is correct. The locked method returns a boolean that indicates whether or not the object is locked. A Lockable object represents an object whose regular methods are protected: if the object is locked, the methods cannot be invoked; if it is unlocked they can be invoked. Redesign and implement a version of the Coin class so that it is Lockable. Submit hard copy of a Rational Rose UML class diagram, the redesigned Coin class and test driver class.

    Heres the interface:public interface Lockable{
        public void setKey(int key);
        public void lock(int key);
        public void unlock(int key);
        public boolean locked();
    }Sample Class:public class Coin implements Lockable{
        private boolean locked;
        private int key ;
        public Coin(){
            locked = false ;
            key = 0 ;
        public boolean locked(){
            return locked ;
        public void setKey(int key){
            this.key = key ;
        public void unlock(int key){
            if(this.key == key){
                locked = false ;
        public void lock(int key){
            if(this.key == key){
                locked = true ;
        public void sayHello(){
            if(!locked) System.out.println("HelloWorld") ;
    }

  • Help with interfaces and Leopard 10.5.2

    Forgive me for my "ignorance" on recording but I thought I could get some decent advice in here...
    I've been a musician for 10 yrs but never recorded something at home besides midi instruments...It's about time I get to record my guitar...And from what I've been reading, neither Digidesign or MAudio interfaces are compatible with Leopard 10.5.2
    I need to buy an interface and would like an opinion...just for small recordings at home. Something like the Firewire Solo or the MBox mini. Does anyone have any preferences? Which one do you think will have drivers released sooner? I'm either gonna run it with Garage or Logic Express.
    Thanks in advance for your input!

    Barbie Rock,
    I personally love the audio interface units by Echo Audio. They are always on top of releasing new drivers when they are called for. I have an Echo Audiofire 12 and it is amazing. But, if you do not need 12 inputs they do have smaller firewire units. The Echo Audiofire2, Audiofire4 and Audiofire8. I have been using Echo Audio products for a long time and I have never had a problem with them. You can visit their website here: http://www.echoaudio.com. Whatever interface you decide on buying, I would strongly suggest not getting something that records over usb. I have had a few different usb devices and I always have problems. Firewire is the way to go.
    -Tyler

  • Help with interfacing old SPEX 270M spectrometer

    I am struggling to interface my computer with an archaic monochromator using the labview drivers downloaded from the horiba jobin yvon website and a RS232 interface. Is there anyone out there who has had experience with this or similar pieces of equipment who could offer some advice? Perhaps some more labview examples of using serial port communications might be useful even?
    Thank you for your help

    If you have the documentation of the command set and the communication protocol, it should be feasible to do what you want.  How easy or difficult depends on the details.
    RS232 is easy in some regards and can be very complicated in others.  Because it does not define the communication protocol (only rates and character frames), the instrument manufacturers can do anything.
    There are plenty of examples of serial communication with a variety of instruments.  Check the Instrument Driver Network  http://www.ni.com/devzone/idnet/   It looks as though there is one driver for Horiba equipment.
    Please be specific in your posts.  Tell us (or, better, post) what you have tried, along with information about what works and waht does not.
    Lynn

  • I need help with interfacing LCD module with 8051

    Hello every one,
    I've been working the MCU and LCD module in  vesrion 10.
    I cant  to make it work. Your help will be really appriciated. we have purchased multisim at our school i need to prepare myself
    to offer it. I seed to be stuck with a few things using the 8051, and LCD is one of them. If i get this right, then i will move to the next.
    here is a code i got from another forum. I have tried different codes, but they all seem not to work. im not sure if it's the code or the design or some bugs with these modules. your help is most welcome.
    here is the code:
    #include <htc.h>
    #include <stdio.h>
    #define LCD_data P2
    #define LCD_D7   P27
    #define LCD_rs   P10
    #define LCD_rw   P11
    #define LCD_en   P12
    /*static volatile unsigned char LCD_data @ 0xA0;
    static volatile bit LCD_D7   @ 0xA7;
    static volatile bit LCD_rs   @ 0x90;
    static volatile bit LCD_rw   @ 0x91;
    static volatile bit LCD_en   @ 0x92;*/
    void LCD_init();
    void LCD_busy();
    void LCD_command(unsigned char );
    void LCD_senddata(unsigned char );
    void LCD_sendstring(unsigned char *);
    void main()
        unsigned char msg[] = "HELLO WORLD";
         LCD_init();
         LCD_command(0x80);
         LCD_sendstring(msg);
        while(1);  
    void LCD_init()
         LCD_data = 0x38;     //Function set: 2 Line, 8-bit, 5x7 dots
         LCD_rs   = 0;        //Selected command register
         LCD_rw   = 0;        //We are writing in data register
         LCD_en   = 1;        //Enable H->L
         LCD_en   = 0;
         LCD_busy();          //Wait for LCD to process the command
         LCD_data = 0x0D;     //Display on, Curson blinking command
         LCD_rs   = 0;        //Selected command register
         LCD_rw   = 0;        //We are writing in data register
         LCD_en   = 1;        //Enable H->L
         LCD_en   = 0;
         LCD_busy();          //Wait for LCD to process the command
         LCD_data = 0x01;     //Clear LCD
         LCD_rs   = 0;        //Selected command register
         LCD_rw   = 0;        //We are writing in data register
         LCD_en   = 1;        //Enable H->L
         LCD_en   = 0;
         LCD_busy();          //Wait for LCD to process the command
         LCD_data = 0x06;     //Entry mode, auto increment with no shift
         LCD_rs   = 0;        //Selected command register
         LCD_rw   = 0;        //We are writing in data register
         LCD_en   = 1;        //Enable H->L
         LCD_busy();
    void LCD_busy()
         LCD_D7   = 1;           //Make D7th bit of LCD as i/p
         LCD_en   = 1;           //Make port pin as o/p
         LCD_rs   = 0;           //Selected command register
         LCD_rw   = 1;           //We are reading
         while(LCD_D7)
        {          //read busy flag again and again till it becomes 0
               LCD_en   = 0;     //Enable H->L
               LCD_en   = 1;
    /*unsigned char i,j;
    3+69
             for(i=0;i<50;i++)        //A simple for loop for delay
                for(j=0;j<255;j++);*/
    void LCD_command(unsigned char var)
         LCD_data = var;      //Function set: 2 Line, 8-bit, 5x7 dots
         LCD_rs   = 0;        //Selected command register
         LCD_rw   = 0;        //We are writing in instruction register
         LCD_en   = 1;        //Enable H->L
         LCD_en   = 0;
         LCD_busy();          //Wait for LCD to process the command
    /* Using the above function is really simple
     var will carry the command for LCD
     e.g.
     LCD_command(0x01);*/
    void LCD_senddata(unsigned char var)
         LCD_data = var;      //Function set: 2 Line, 8-bit, 5x7 dots
         LCD_rs   = 1;        //Selected data register
         LCD_rw   = 0;        //We are writing
         LCD_en   = 1;        //Enable H->L
         LCD_en   = 0;
         LCD_busy();          //Wait for LCD to process the command
    /* Using the above function is really simple
     we will pass the character to display as argument to function
     e.g.
     LCD_senddata('A');*/
    void LCD_sendstring(unsigned char *var)
         while(*var)              //till string ends
           LCD_senddata(*var++);  //send characters one by one
    /* Using the above function is really simple
    // we will pass the string directly to the function
    // e.g.
    // LCD_sendstring("LCD Tutorial");*/ 
    Ihave also attached the schematic. 
    Tahnx in advance 
    Attachments:
    schem.JPG ‏37 KB

    please tell us what model of computer you have, and what RAM it has in it before you started, and what the detaails of the new RAM you are trying to put in are.
    It might be that your new RAM is the wrong type, or that that is not right for your particular PC, or even simply that it has not gone in properly. Trying taking it out, booting up yto see if everything iis OK (at which time you might try installing CPU-Z, running that, and posting some screenshots), and reinserting the new memory card.  They can be a be a bit awkward to insert and a bit stiff, but don not apply too much force, look to see if it has gone it evenly and the same at both ends, can you operate the latches at either end ?
    Woodwood
    30.October.2011

  • Help with interface and abstract

    Hi all
    what is the difference between an interface and an abstract class??

    Suppose if you want to implement all the methods we usually use the interface. if you define a method in the interface you must provide the implementation for this interface in the implementation class.
    In case of abstract, we can have both the abstract and non -abstract methods. Means abstract class can have the methods with the implementations defined in that class and abstract methods which needs to be implemented for the sub classes.

  • Help with interfacing with a DC Regulated Supply "HP Agilent 6260B"

    Hi all,
    I am working on a Battery Charger and need to control the operation of my DC Regulated Supply (HP 6260B) from LabVIEW. Since the Instrument is an old model, it doesn't support the GPIB. However, remote programming is still possible using a variable resistor or external voltage.
    How do I do that? I am comfortable with using any of the two solutions.
    Please let me know if there is any other relevant data which should be provided.
    Regards,
    RJ

    The SCXI 1300 is not a DAQ device. It's a terminal block. You actually need to have another SCXI module that has analog outputs. There are only 2 SCXI modules that have analog output. One is the 1124, which sells for $1649. The other is the 1581, which sells for $2099. I guess that USB one is looking pretty good right about now. Unfortunately, it only goes to 5V. The 9263 can go up to 10V, but it sells for $639. You may be able to find cheaper alternatives by looking at other vendors, though you'd need to look at being able to use them with LabVIEW.
    You could go the variable resistance route. I know there are EEPOTS that can be programmed via I2C/SPI since we've used them in some of the stuff we've built here at work. Don't recall the specific part numbers, though. You can Google for them, or check the major chip makers, like Maxim, etc. You'd need to make up a small breadboard to use it, but you're already dealing with a dinosaur, so it may not be that bad to kludge something up this way.
    As for examples, lots of examples ship with DAQmx.

  • Help about Interfaces in Java

    I need some help with Interfaces since I'm really new to OOP.
    I have 1 interface, 1 class implementing the interface and 1 main function. Here is the structure:
    public interface t_action
          public boolean isvalid(int a, int b);
    public class sec implements t_action
         public boolean isvalid(int a, int b)
         /* Implmentation of this method */
    public class main()
         public static void main(string args[])
              boolean valid = false;
              /* Need to call isvalid in public class sec
                  and assign it to the "valid" variable above
    }My Question is:
    How do i call the method "isvalid" in class sec that implements the t_action interface? I need to assign it to my variable "valid" in class main
    Any help is appreciated.
    Thanks.
    MAZ@McMaster Engineering

    Hey all...
    Thanks for your contribution.
    As I said earlier here: "I'm new to Java" so cut me some slack!!!
    I've been doing C programming all my life so java is similar but quite foreign to me since I started learning it recently on my own
    If this were a normal class and not an interface, it would be:
    class_name myclass = new class_name();
    myclass.isvalid(a, b);But why is it:
    interface_name i = new class_implementing_interface();
    i.isvalid(a,b);Thanks

  • Hello, please help, my interface is connected to the microphone and when i open Logic 9 it does´t work. But I opened garageband to check and it works fine. I can record voice with any effect... With Logic i see the sound passes in the interface.

    Hello, please help, my interface is connected to the microphone and when i open Logic 9 it does´t work. But I opened garageband to check and it works fine. I can record voice with any effect... With Logic i see the sound passes in the interface but does not arrive in Logic. The Loops works fine and i can hear. Is just the sound to record the voice it does not work. What can i do ??? I used Logic before in the same computer and it worked fine. Thank you so much, I´m a begginer recording myself.

    Make sure you go into preferences in Logic and set the audio input to be your interface and the audio output to be either built in output or the interface, if that is hooked up to something else. It sounds like Garageband has the audio interface set as the input but not Logic.
    Also make sure you close all other applications except Logic to ensure it is not running in slave mode...

  • The best way to get help with logic

    I was posting in a thread on support for logic which appears to have been deleted. anyway, what I was going to say I think is useful info for people, so I'm going to post it anyway. to the mods - it doesn't contain any speculation about policies or anything like that. just an explanation of my views on the best way to deal with issues people have with logic, which I think is a valuable contribution to this forum.
    I think there's a need for perspective. when you buy an apple product you get 90 days of free phone support to get everything working nice and neat. you can call them whenever, and you could actually keep them on the phone all day if you wanted, making them explain to you how to copy a file, install microsoft office, or any number of little questions no matter how simple - what is that red button thingy in my window for?.. on top of that, you've got a 14 day dead on arrival period (or 10 days I can't remember) in which if your machine has any kind of hardware fault whatsoever it's exchanged for a totally new one, no questions asked. a lot of people complain that applecare is overpriced.. and if you think of it just as an extended warranty, then it is a little pricey. but if you are someone that could use a lot of phone support, then it's actually potentially a total bargain. the fact that 2 or more years after you bought a computer, you could still be calling them every single day, asking for any kind of advice on how to use anything on the machine, is quite something. many people on this forum have had problems when they made the mistake of upgrading to 10.4.9 without first creating a system clone or checking first with their 3rd party plug in vendors to make sure it was ok. so, with apple care, you could call them and keep a technician on the phone _all day_ talking you through step-by-step how to back up all of your user data, how to go through and preserve your preferences and any other specific settings you might not want to lose, and then how to rollback to an earlier OS version.. they'll hold your hand through the whole thing if you need them to.
    as for applecare support for pro apps like logic, I'd be the first person to agree that it's not great for anyone except beginners and first time users. if you look at what it takes to get even the highest level of logic certification, it's all pretty basic stuff. and logic doesn't exist in a vacuum, there is an entire universe of 3rd party software and hardware, as well as studio culture and advanced user techniques that are going to be totally invisible to some poor phone support guy at apple that did a logic 101. but it's not hard to see that apple are trying to promote a different kind of support culture, it's up to you to decide whether you want to buy into it or not.
    the idea is that they are able to provide basic setup support for new users, including troubleshooting. because it's a simpler level of support, at least they can do this well. so there's no reason why any new user with say a new imac and logic can't get up and running with the 90 days of phone support they get for free.
    but the thing is, for extremely high end pro users it's a different matter altogether. pro use of logic within the context of say, a studio or a film composition scenario is a very different world. it's almost a nonsense to imagine that apple could even hire people capable of giving useful support for this end of the spectrum, over the phone. there are so many variables, and so many things that require a very experienced studio person or in-work composer to even begin to understand the setup, let alone troubleshoot it. and it's a constantly evolving world, you actually have to be working in it and aware of developments on 3rd party fronts as well as changes in hardware.. not to mention even changes in the culture of studio production and the changed expectations that come from that. there's no way some poor little guy sitting at a help desk at apple can even hope to be privy to that kind of knowledge. it's already good enough that they don't outsource their support staff to india, let alone go out to studios and hire the very people with the skills that should be staying in the studio! not answering phones for apple.
    so, given this reality.. companies have two choices. they can either offer an email based support ticket system, which others do. but in my opinion.. this can just be frustrating and only a half-solution. sure you 'feel' like you are getting a response from the people that make the software and therefore must know it.. but it's not really the case due to what I said above. DAWs don't exist in a vacuum, and so much of what you need to understand to help people requires an intimate knowledge of the music industry in which they are working. you still won't get that from steinberg, even if they sort of answer your emails. the other problem is that this kind of system can mean sporadic answers, a lot of tail-chasing, and quite often you won't get an answer that helps you in the end anyway.
    the other model is to foster a strong user support culture. some people react in the wrong way to this idea.. they just think it's a big brush off from the manufacturer, saying we don't care, go sort it out yourselves.. but this isn't true. apple has a classification for pro resellers called 'apple solutions expert - audio'. what this means is that these dealers are recognised as audio specialists and they can receive extra support and training from apple for this. but more importantly than this.. most of them are music stores, or pro gear dealerships that are also mac and logic dealers. they already employ people that have worked or do work in the music industry, and are constantly on top of all of this stuff. apple encourages these dealers to run workshops, and to provide expert sales advice in the very niche area that logic is in, which they can do far better than some generic apple store ever could. but most importantly, they are encouraged to offer their own expert after-sales support and whatever other value-adding expertise they can, to get sales. because margins in computer gear are so tight nowadays, discounting is not really a viable option for these dealers to guarantee getting musicians to buy computers and logic setups from them. the only companies that can entice people with a lower price a big online wholesalers or big chain stores. so the best idea for these niche expert stores to get sales is to offer you their own experts to help with configuration, ongoing support and to generally make it a better idea that you bought your system from them rather than from some anonymous online store. I can see the wisdom of this.. it puts the support back out there on the ground where it's needed, and also where it can work best. apple could never hope to offer the same level of expertise in helping a film composer work through some issues with a specific interface or some highly specific issue they have with getting a task done. no big software manufacturer could do this anywhere near as well as people out there that have worked in studios or currently do work in studios. so in my opinion it's a far better model to foster this kind of support culture, along with training courses, books and training video support. also user forums like this one are possibly one of the most valuable ports of call anyone could ask for. apple couldn't replicate this with their own staff, even if they tried. and even if they made a system where some of the people close to logic development were able to answer emails, it would still be nowhere near as useful, as rapid or as capable of being up to speed with logic use out in the real world with 3rd pary gear, as any of these other methods are.
    the only thing I think they could do better would be to publish a list of known bugs which are officially recognised. this would help everyone and put an end to a lot of wasted time and speculation on if something is a bug totally to do with logic, or if it's a specific issue raised by a particular configuration.
    but really, in my view, a 3rd party support and training culture through a combination of specialist dealers, consultants that literally run a business setting up computers for pro-users and helping them keep it all working, online user-to-user forums and published materials really are the way forward.

    In all honesty this is currently the 3rd "logicboard" (motherboard)
    in my powerbook due to a design flaw regarding the 2nd memory slot....
    Yep. Mine failed five weeks after I bought it. However, I bought it for work and couldn't afford being without it for four weeks while they fixed it, so I had to live with it. My serial number did not entitle me to a replacement either, post Applecare.
    My firewire ports have burnt out from a third-party defective device (no hot-plugging involved)
    My screen is blotchy (my PW serial number did not entitle me to a replacement).
    My battery serial number did not entitle me to a replacement, and is not that good these days.
    My guaranteed Powerbook-compatible RAM is actually not, causing RAM related problems, most notably these days meaning that as soon as I switch to battery power, the laptop crashes, so I can only use mains power. The company I bought it from stopped taking my calls and wouldn't replace it after they replaced it once, so I'm stuck with it. And of course, only one ram slot is working, so I can't even use my original stick in the first slot, which would shift the dodgy stuff away from the lower system area.
    My power supply failed at the weak spot and caught fire. I managed to break apart the power supply and recable it so I didn't have to buy a new power supply, although the connection at the laptop end is loose (all the more fun that as soon as power is lost, the laptop crashes - see above). The power supply is held together with gaffa tape. Silver gaffer tape though, so it's still kind of 'Appley"...
    My internal hard drive is dying - four or five times now it clicks and won't power up, causing the laptop to die.
    One foot has fallen off (but glued back on).
    The lid is warped.
    The hinge is loosish.
    The S-Video adaptor cable is intermittent.
    But aside from all that, I have looked after it well, and I love it to death. Just as well, because it doesn't look like it will be that long...
    But it still "just works". Apart from the battery power obviously. And the ram slot. And the ram. And the screen. And the hard drive. And the firewire ports. And the feet.
    But everything apart from the main board, the screen, the case, the hard drive and the power supply works fine. So thats... er..
    Hmm.

  • Need help with turning multiple rows into a single row

    Hello.
    I've come across a situation that is somewhat beyond my knowledge base. I could use a little help with figuring this out.
    My situation:
    I am attempting to do some reporting from a JIRA database. What I am doing is getting the dates and times for specific step points of a ticket. This is resulting in many rows per ticket. What I need to do is return one row per ticket with a calculation of time between each step. But one issue is that if a ticket is re-opened, I want to ignore all data beyond the first close date. Also, not all tickets are in a closed state. I am attaching code and a sample list of the results. If I am not quite clear, please ask for information and I will attempt to provide more. The database is 10.2.0.4
    select jiraissue.id, pkey, reporter, summary
    ,changegroup.created change_dt
    ,dbms_lob.substr(changeitem.newstring,15,1) change_type
    ,row_number() OVER ( PARTITION BY jiraissue.id ORDER BY changegroup.created ASC ) AS order_row
    from jiraissue
    ,changeitem, changegroup
    ,(select * from customfieldvalue where customfield = 10591 and stringvalue = 'Support') phaseinfo
    where jiraissue.project = 10110
    and jiraissue.issuetype = 51
    and dbms_lob.substr(changeitem.newstring,15,1) in ('Blocked','Closed','Testing','Open')
    and phaseinfo.issue = jiraissue.id
    and changeitem.groupid = changegroup.id
    and changegroup.issueid = jiraissue.id
    order by jiraissue.id,change_dt
    Results:
    1     21191     QCS-91     Error running the Earliest-deadlines flight interface request/response message     2008-07-16 9:30:38 AM     Open     1
    2     21191     QCS-91     Error running the Earliest-deadlines flight interface request/response message     2008-07-16 11:37:02 AM     Testing     2
    3     21191     QCS-91     Error running the Earliest-deadlines flight interface request/response message     2010-06-08 9:14:52 AM     Closed     3
    4     21191     QCS-91     Error running the Earliest-deadlines flight interface request/response message     2010-09-02 11:29:37 AM     Open     4
    5     21191     QCS-91     Error running the Earliest-deadlines flight interface request/response message     2010-09-02 11:29:42 AM     Open     5
    6     21191     QCS-91     Error running the Earliest-deadlines flight interface request/response message     2010-09-02 11:29:50 AM     Testing     6
    7     21191     QCS-91     Error running the Earliest-deadlines flight interface request/response message     2010-09-02 11:29:53 AM     Closed     7
    8     23234     QCS-208     System Baseline - OK button does not show up in the Defer Faults page for the System Engineer role      2008-10-03 10:26:21 AM     Open     1
    9     23234     QCS-208     System Baseline - OK button does not show up in the Defer Faults page for the System Engineer role      2008-11-17 9:39:39 AM     Testing     2
    10     23234     QCS-208     System Baseline - OK button does not show up in the Defer Faults page for the System Engineer role      2011-02-02 6:18:02 AM     Closed     3
    11     23977     QCS-311     Tally Sheet - Reason Not Done fails to provide reason for unassigned tasks     2008-09-29 2:44:54 PM     Open     1
    12     23977     QCS-311     Tally Sheet - Reason Not Done fails to provide reason for unassigned tasks     2010-05-29 4:47:37 PM     Blocked     2
    13     23977     QCS-311     Tally Sheet - Reason Not Done fails to provide reason for unassigned tasks     2011-02-02 6:14:57 AM     Open     3
    14     23977     QCS-311     Tally Sheet - Reason Not Done fails to provide reason for unassigned tasks     2011-02-02 6:15:32 AM     Testing     4
    15     23977     QCS-311     Tally Sheet - Reason Not Done fails to provide reason for unassigned tasks     2011-02-02 6:15:47 AM     Closed     5

    Hi,
    Welcome to the forum!
    StblJmpr wrote:
    ... I am attempting to do some reporting from a JIRA database. What is a JIRA database?
    I am attaching code and a sample list of the results. If I am not quite clear, please ask for information and I will attempt to provide more. Whenever you have a question, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and the results you want from that data.
    Simplify the problem as much as possible. For example, if the part you don't know how to do only involves 2 tables, then jsut post a question involving those 2 tables. So you might just post this much data:
    CREATE TABLE     changegroup
    (      issueid          NUMBER
    ,      created          DATE
    ,      id          NUMBER
    INSERT INTO changegroup (issueid, created, id) VALUES (21191,  TO_DATE ('2008-07-16 09:30:38 AM', 'YYYY-MM-DD HH:MI:SS AM'),  10);
    INSERT INTO changegroup (issueid, created, id) VALUES (21191,  TO_DATE ('2008-07-16 11:37:02 AM', 'YYYY-MM-DD HH:MI:SS AM'),  20);
    INSERT INTO changegroup (issueid, created, id) VALUES (21191,  TO_DATE ('2010-06-08 09:14:52 AM', 'YYYY-MM-DD HH:MI:SS AM'),  90);
    INSERT INTO changegroup (issueid, created, id) VALUES (21191,  TO_DATE ('2010-09-02 11:29:37 AM', 'YYYY-MM-DD HH:MI:SS AM'),  10);
    INSERT INTO changegroup (issueid, created, id) VALUES (21191,  TO_DATE ('2010-09-02 11:29:42 AM', 'YYYY-MM-DD HH:MI:SS AM'),  10);
    INSERT INTO changegroup (issueid, created, id) VALUES (21191,  TO_DATE ('2010-09-02 11:29:50 AM', 'YYYY-MM-DD HH:MI:SS AM'),  20);
    INSERT INTO changegroup (issueid, created, id) VALUES (21191,  TO_DATE ('2010-09-02 11:29:53 AM', 'YYYY-MM-DD HH:MI:SS AM'),  90);
    INSERT INTO changegroup (issueid, created, id) VALUES (23234,  TO_DATE ('2008-10-03 10:26:21 AM', 'YYYY-MM-DD HH:MI:SS AM'),  10);
    INSERT INTO changegroup (issueid, created, id) VALUES (23234,  TO_DATE ('2008-11-17 09:39:39 AM', 'YYYY-MM-DD HH:MI:SS AM'),  20);
    INSERT INTO changegroup (issueid, created, id) VALUES (23234,  TO_DATE ('2011-02-02 06:18:02 AM', 'YYYY-MM-DD HH:MI:SS AM'),  90);
    INSERT INTO changegroup (issueid, created, id) VALUES (23977,  TO_DATE ('2008-09-29 02:44:54 PM', 'YYYY-MM-DD HH:MI:SS AM'),  10);
    INSERT INTO changegroup (issueid, created, id) VALUES (23977,  TO_DATE ('2010-05-29 04:47:37 PM', 'YYYY-MM-DD HH:MI:SS AM'),  30);
    INSERT INTO changegroup (issueid, created, id) VALUES (23977,  TO_DATE ('2011-02-02 06:14:57 AM', 'YYYY-MM-DD HH:MI:SS AM'),  10);
    INSERT INTO changegroup (issueid, created, id) VALUES (23977,  TO_DATE ('2011-02-02 06:15:32 AM', 'YYYY-MM-DD HH:MI:SS AM'),  20);
    INSERT INTO changegroup (issueid, created, id) VALUES (23977,  TO_DATE ('2011-02-02 06:15:47 AM', 'YYYY-MM-DD HH:MI:SS AM'),  90);
    CREATE TABLE     changeitem
    (      groupid          NUMBER
    ,      newstring     VARCHAR2 (10)
    INSERT INTO changeitem (groupid, newstring) VALUES (10, 'Open');
    INSERT INTO changeitem (groupid, newstring) VALUES (20, 'Testing');
    INSERT INTO changeitem (groupid, newstring) VALUES (30, 'Blocked');
    INSERT INTO changeitem (groupid, newstring) VALUES (90, 'Closed');Then post the results you want to get from that data, like this:
    ISSUEID HISTORY
      21191 Open (0) >> Testing (692) >> Closed
      23234 Open (45) >> Testing (807) >> Closed
      23977 Open (607) >> Blocked (249) >> Open (0) >> Testing (0) >> ClosedExplain how you get those results from that data. For example:
    "The output contains one row per issueid. The HISTORY coloumn shows the different states that the issue went through, in order by created, starting with the earliest one and continuing up until the first 'Closed' state, if there is one. Take the first row, issueid=21191, for example. It started as 'Open' on July 16, 2008, then, on the same day (that is, 0 days later) changed to 'Testing', and then, on June 8, 2010, (692 days later), it became 'Closed'. That same issue opened again later, on September 2, 2010, but I don't want to see any activity after the first 'Closed'."
    The database is 10.2.0.4That's very important. Always post your version, like you did.
    Here's one way to get those results from that data:
    WITH     got_order_row     AS
         SELECT     cg.issueid
         ,     LEAD (cg.created) OVER ( PARTITION BY  cg.issueid
                                          ORDER BY      cg.created
                  - cg.created            AS days_in_stage
         ,       ROW_NUMBER ()     OVER ( PARTITION BY  cg.issueid
                                          ORDER BY      cg.created
                               )    AS order_row
         ,     ci.newstring                     AS change_type
         FROM    changegroup     cg
         JOIN     changeitem     ci  ON   cg.id     = ci.groupid
         WHERE     ci.newstring     IN ( 'Blocked'
                           , 'Closed'
                           , 'Testing'
                           , 'Open'
    --     AND     ...          -- any other filtering goes here
    SELECT       issueid
    ,       SUBSTR ( SYS_CONNECT_BY_PATH ( change_type || CASE
                                                             WHEN  CONNECT_BY_ISLEAF = 0
                                           THEN  ' ('
                                              || ROUND (days_in_stage)
                                              || ')'
                                                         END
                                    , ' >> '
               , 5
               )     AS history
    FROM       got_order_row
    WHERE       CONNECT_BY_ISLEAF     = 1
    START WITH     order_row          = 1
    CONNECT BY     order_row          = PRIOR order_row + 1
         AND     issueid               = PRIOR issueid
         AND     PRIOR change_type     != 'Closed'
    ORDER BY  issueid
    ;Combining data from several rows into one big delimited VARCHAR2 column on one row is call String Aggregation .
    I hope this answers your question, but I guessed at so many things, I won't be surprised if it doesn't. If that's the case, point out where this is wrong, post what the results should be in those places, and explain how you get those results. Post new data, if necessary.

  • I need help with Creating Key Pairs

    Hello,
    I need help with Creating Key Pairs, I generate key pais with aba provider, but the keys generated are not base 64.
    the class is :
    import java.io.*;
    import java.math.BigInteger;
    import java.security.*;
    import java.security.spec.*;
    import java.security.interfaces.*;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    import au.net.aba.crypto.provider.ABAProvider;
    class CreateKeyPairs {
    private static KeyPair keyPair;
    private static KeyPairGenerator pairGenerator;
    private static PrivateKey privateKey;
    private static PublicKey publicKey;
    public static void main(String[] args) throws Exception {
    if (args.length != 2) {
    System.out.println("Usage: java CreateKeyParis public_key_file_name privete_key_file_name");
    return;
    createKeys();
    saveKey(args[0],publicKey);
    saveKey(args[1],privateKey);
    private static void createKeys() throws Exception {
    Security.addProvider(new ABAProvider());
    pairGenerator = KeyPairGenerator.getInstance("RSA","ABA");
    pairGenerator.initialize(1024, new SecureRandom());
    keyPair = pairGenerator.generateKeyPair();
    privateKey = keyPair.getPrivate();
    publicKey = keyPair.getPublic();
    private synchronized static void saveKey(String filename,PrivateKey key) throws Exception {
    ObjectOutputStream out= new ObjectOutputStream(new FileOutputStream(filename));
    out.writeObject(key);
    out.close();
    private synchronized static void saveKey(String filename,PublicKey key) throws Exception {
    ObjectOutputStream out= new ObjectOutputStream( new FileOutputStream(filename));
    out.writeObject(key);
    out.close();
    the public key is:
    �� sr com.sun.rsajca.JSA_RSAPublicKeyrC��� xr com.sun.rsajca.JS_PublicKey~5< ~��% L thePublicKeyt Lcom/sun/rsasign/p;xpsr com.sun.rsasign.anm����9�[ [ at [B[ bq ~ xr com.sun.rsasign.p��(!g�� L at Ljava/lang/String;[ bt [Ljava/lang/String;xr com.sun.rsasign.c�"dyU�|  xpt Javaur [Ljava.lang.String;��V��{G  xp   q ~ ur [B���T�  xp   ��ccR}o���[!#I����lo������
    ����^"`8�|���Z>������&
    d ����"B��
    ^5���a����jw9�����D���D�)�*3/h��7�|��I�d�$�4f�8_�|���yuq ~
    How i can generated the key pairs in base 64 or binary????
    Thanxs for help me
    Luis Navarro Nu�ez
    Santiago.
    Chile.
    South America.

    I don't use ABA but BouncyCastle
    this could help you :
    try
    java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
    java.security.KeyPairGenerator kg = java.security.KeyPairGenerator.getInstance("RSA","BC");
    java.security.KeyPair kp = kg.generateKeyPair();
    java.security.Key pub = kp.getPublic();
    java.security.Key pri = kp.getPrivate();
    System.out.println("pub: " + pub);
    System.out.println("pri: " + pri);
    byte[] pub_e = pub.getEncoded();
    byte[] pri_e = pri.getEncoded();
    java.io.PrintWriter o;
    java.io.DataInputStream i;
    java.io.File f;
    o = new java.io.PrintWriter(new java.io.FileOutputStream("d:/pub64"));
    o.println(new sun.misc.BASE64Encoder().encode(pub_e));
    o.close();
    o = new java.io.PrintWriter(new java.io.FileOutputStream("d:/pri64"));
    o.println(new sun.misc.BASE64Encoder().encode(pri_e));
    o.close();
    java.io.BufferedReader br = new java.io.BufferedReader(new java.io.FileReader("d:/pub64"));
    StringBuffer keyBase64 = new StringBuffer();
    String line = br.readLine ();
    while(line != null)
    keyBase64.append (line);
    line = br.readLine ();
    byte [] pubBytes = new sun.misc.BASE64Decoder().decodeBuffer(keyBase64.toString ());
    br = new java.io.BufferedReader(new java.io.FileReader("d:/pri64"));
    keyBase64 = new StringBuffer();
    line = br.readLine ();
    while(line != null)
    keyBase64.append (line);
    line = br.readLine ();
    byte [] priBytes = new sun.misc.BASE64Decoder().decodeBuffer(keyBase64.toString ());
    java.security.KeyFactory kf = java.security.KeyFactory.getInstance("RSA","BC");
    java.security.Key pubKey = kf.generatePublic(new java.security.spec.X509EncodedKeySpec(pubBytes));
    System.out.println("pub: " + pubKey);
    java.security.Key priKey = kf.generatePrivate(new java.security.spec.PKCS8EncodedKeySpec(priBytes));
    System.out.println("pri: " + priKey);
    catch(Exception e)
    e.printStackTrace ();
    }

  • Need some help with the colour profile please. Urgent! Thanks

    Dear all, I need help with the colour profile of my photoshop CS6. 
    I've taken a photo with my Canon DSLR. When I opened the raw with ACDSee, the colour looks perfectly ok.
    So I go ahead and open in photoshop. I did nothing to the photo. It still looks ok
    Then I'm prompt the Embedded Profile Mismatch error. I go ahead and choose Discard the embedded profile option
    And the colour started to get messed up.
    And the output is a total diasater
    Put the above photo side by side with the raw, the red has became crimson!!
    So I tried the other option, Use the embedded profile
    The whole picture turns yellowish in Photoshop's interface
    And the output is just the same as the third option.
    Could someone please guide me how to fix this? Thank you.

    I'm prompt the Embedded Profile Mismatch error. I go ahead and choose Discard the embedded profile option
    always use the embedded profile when opening tagged images in Photoshop - at that point Photoshop will convert the source colors over to your monitor space correctly
    if your colors are wrong at that point either your monitor profile is off, or your source colors are not what you think they are - if other apps are displaying correctly you most likely have either a defective monitor profile or source profile issues
    windows calibrate link:
    http://windows.microsoft.com/en-US/windows7/Calibrate-your-display
    for Photoshop to work properly, i recall you want to have "use my settings for this device" checked in Color Management> Device tab
    you may want to download the PDI reference image to check your monitor and print workflows
    and complete five easy steps to profile enlightenment in Photoshop
    with your settings, monitor profile and source profiles sorted out it should be pretty easy to pinpoint the problem...

  • Can anyone help with email in my old G4 17"  ??

    My G4 17", bought December 2004, is considered an antique by Apple, and no longer supported. (I now mostly use my early 2011 MacBookPro.)
    But the big screen on by G4 is very useful for Sibelius 4, the music program I mostly use (Sibelius 7 in the MacBookPro - but much too fussy for me.)
    Sibelius 4 in the G4 continues to work flawlessly.
    But my email account recently sort of died. It's  POP account (whatever that means). I can no longer receive messages, BUT I can still create and
    send new messages, and of course forward any saved message to myself in the MacBookPro.
    ALSO:  if I have to shut down the G4, it usually reopens with a horizontally divided display, and it usually takes many restarts before it will open
    will a full screen display (seems to reopen correctly more often if left in a cool place overnight.)
    Can anyone help with one or both these issues? I want to keep the G4 going as long as I can.  BTW, I don't use it for browsing anyone, Safari installed,
    because it is now so slow. The MacBookPro handles all that for me.
    Thanks very much, James Johnson in Plattsburgh NY (where it is still cold and wintry, o f--k)

    To RCCHARLES: THANKS !!!!  I did the safe boot start, following the link you provided, then waited, and waited, and waited, and ---
    Well that is interesting. Amoung other things safe boot does:
    -- check and fixes up your file system.  The files system allows you to keep files on your harddrive.
    -- Does all video rendering in software.
    You could have a one time glitch or harddrive is slowly failing.  If you never replaced the harddrive, it is time for a new one.
    You may want to consider getting a new harddrive.  The easiest way is to get an external drive.  No disassembly of the machine is required.
    You need an external Firewire drive to boot a PowerPC Mac computer [ a few G5's will boot from USB ].
    I recommend you do a google search on any external harddrive you are looking at.
    I bought a low cost external drive enclosure. When I started having trouble with it, I did a google search and found a lot of complaints about the drive enclosure. I ended up buying a new drive enclosure. On my second go around, I decided to buy a drive enclosure with a good history of working with Macs. The chip set seems to be the key ingredient. The Oxford line of chips seems to be good. I got the Oxford 911.
    I'd give OWC a call. 1-815-338-8685.
    FireWire 800 + USB 3, + eSATA
    save a little money interface:
    FireWire 400 + USB 2.0
    This web page lists both external harddrive types. You may need to scroll to the right to see both.
    http://eshop.macsales.com/shop/firewire/1394/USB/EliteAL/eSATA_FW800_FW400_USB
         (2) FireWire 800/400 Ports (Up to 100MB/s / 50MB/s)
         (1) USB 3.0 Port (Up to 500MB/s / 60MB/s)
         (1) eSATA Port (Up to 300MB/s)
    Has a combo firewire 800/400 port.  Not sure what this is.  Looks like you will  need 400 cable.
    http://eshop.macsales.com/shop/ministack

Maybe you are looking for

  • ITunes 10 wont install

    Hi, itunes 10 won't install. It keeps giving me the error that "can't delete ipod service". I cancelled out and tried installing from from Tools>download only . No luck. I had this problem in going from 8 to 9 and I had to delete everything according

  • Grouping  windows to bring to the front

    I am curious if anyone knows a way to link or group the windows of certain applications to appear, say when only ONE of the applications is selected(clicked) from the dock. part of me got very used to virtual windows on unix based systems. i am tryin

  • Tigger to automatically save deleted row(s)

    How can I create trigger that saves the row(s) to be deleted in some other table???

  • Problem with External HDD and Disk Utility

    I'm having issues with my external hdd, I keep all of my media on it, and randomly it is no longer readable, and doesn't show up on the desktop, it only gives me the options to initialize, ignore or eject, when I try to initialize it and run first ai

  • Schedule sequence heuristic

    We are currently on scm 5.1 version. planned orders are generated for a together for multiple sale orders by variable heuristic. start dates will be based on the requirement date of sale order. suddenly the priority changes. the first priority sale o