Why isnt this working? add container to frame..

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class MortgageCalcFrame {
    private static void createAndShowGUI() {
        //Create and set up the window.
        JFrame frame = new JFrame("Mortgage calculator");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        // Add's a container in the frame
        Container content = new Container();
        frame.getContentPane().add(content, BorderLayout.SOUTH);
        JButton btn = new JButton("test");
        content.add(btn, BorderLayout.EAST);
        JTextField input = new JTextField(5);
        frame.getContentPane().add(input, BorderLayout.CENTER);
        //Display the window.
        frame.pack();
        frame.setVisible(true);
    public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
}

Well the problem you got is that the layout of a Container is null. You've got several options here.
1. You set a layout for your container like this
    Container content = new Container();
    content.setLayout(new FlowLayout());2. You use a different container that inherits from container like Panel or JPanel since this one already got a FlowLayout set.
Panel content = new Panel();or
JPanel content = new JPanel(); //better since you're currently mixing Swing components and AWT.

Similar Messages

  • Why isnt this working urgent please help

    why isnt this working im trying to connect a panel to a scrollpane the panel will contain several dozen text fields
    the scrollpane shouls be about 350, 450 , but the pane is 350
    by 1200 the problem now is that the scorllbar isnt created and even when I explictly create it it contains no knob, and it will
    not scroll up or down please someone help this is urgent
    import java.awt.*;
    import com.sun.java.swing.*;
    public class ScrollDemo extends JPanel {
         private Rule columnView;
         private Rule rowView;
         private ScrollablePicture picture;
         class UnitsListener implements ItemListener {
              public void itemStateChanged(ItemEvent e) {
                   if (e.getStateChange() == ItemEvent.SELECTED) {
                        // Turn it to metric.
                        rowView.setIsMetric(true);
                        columnView.setIsMetric(true);
                   } else {
                        // Turn it to inches.
                        rowView.setIsMetric(false);
                        columnView.setIsMetric(false);
                   picture.setMaxUnitIncrement(rowView.getIncrement());
    public ScrollDemo() {
         Two t = new Two(columnView.getIncrement());
              JScrollPane pictureScrollPane = new JScrollPane(t);
              pictureScrollPane.setPreferredSize(new Dimension(300, 250));
              pictureScrollPane.setColumnHeaderView(columnView);
              pictureScrollPane.setRowHeaderView(rowView);
         public static void main(String s[]) {
              JFrame frame = new JFrame("ScrollDemo");
              frame.setContentPane(new ScrollDemo());
              frame.setVisible(true);
    import java.awt.*;
    import com.sun.java.swing.*;
    public class Two extends JPanel implements Scrollable{
    private JPanel ivjJPanel3 = null;
         private JScrollPane ivjJScrollPane1 = null;
         private int maxUnitIncrement = 1;
    public Two(int m)
         getJPanel1();
         maxUnitIncrement = m;
         setSize(300,1200);
    private void getJPanel1() {
                   setLayout(null);
                   setSize(250,1200);
                   add(getJLabel1(), getJLabel1().getName());
    public Dimension getPreferredScrollableViewportSize() {
              return getPreferredSize();
         public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation,
         int direction) {
              if (orientation == SwingConstants.HORIZONTAL)
                   return visibleRect.width - maxUnitIncrement;
              else
                   return visibleRect.height - maxUnitIncrement;
         public boolean getScrollableTracksViewportHeight() {
              return false;
         public boolean getScrollableTracksViewportWidth() {
              return false;
         public int getScrollableUnitIncrement(Rectangle visibleRect,
                                                      int orientation,
                                                      int direction) {
              //Get the current position.
              int currentPosition = 0;
              if (orientation == SwingConstants.HORIZONTAL)
                   currentPosition = visibleRect.x;
              else
                   currentPosition = visibleRect.y;
              //Return the number of pixels between currentPosition
              //and the nearest tick mark in the indicated direction.
              if (direction < 0) {
                   int newPosition = currentPosition -
                                       (currentPosition / maxUnitIncrement) *
                                       maxUnitIncrement;
                   return (newPosition == 0) ? maxUnitIncrement : newPosition;
              } else {
                   return ((currentPosition / maxUnitIncrement) + 1) *
                        maxUnitIncrement - currentPosition;
         public void setMaxUnitIncrement(int pixels) {
              maxUnitIncrement = pixels;

    I personally didn't play with swing components when they were in the com.sun.java.swing state, but I have a strong feeling it is very buggy and could be causing your problem.
    Before posting gui issues, please use a newer API, even jdk1.1 would be fine, anything would be better than what your using.
    you wrote: I dont care if its javax.swing or
    com.sun.java.swing
    I would also gather from this statement that your attitude could be one of your other issues.

  • Why isnt this  working

    After a big loss of out-pulled hair here is the code:
    setInterval() calls getNewMess function but it happens
    nothing with onNewMess function.
    Instead, if i click refresh-button, it gives me result
    correctly.

    evt.target._parent
    is just using the event argument that is dispatched to and
    therefore received by your listener function. It is dispatched/sent
    by your button component instance. The event object from components
    - in as2 - normally contains at least two properties. A type
    property... in this case that's "click" , because its a click event
    and a target property. The target property is a reference to the
    component instance from which the event originated. It can be
    particularly useful if you have one listener handling events from
    many sources. So.....
    evt.target._parent is referring to the container clip of the
    instance that sent the event. i.e. The _parent of the button in
    this case.
    That's why I replaced it with t (=this) which is a reference
    to the timeline that the button is running in. Now it doesn't need
    to get that reference from checking the _parent of the evt.target
    property from the evt argument. Which means the argument that the
    newMess function receives can be ignored and its no longer reliant
    on it. Sounds confusing but once you "get" it, it all makes sense.
    Eventually, lol.
    And of couse you don't need to have a button if you don't
    want one.

  • HT204380 Why isnt this working

    I have an Ipad2, every single time i facetime with someone using a iphone 4s, i can hear what they are saying but they can't hear what i am saying.how do i fix this?...i enjoy having to write down what i think on paper, but i would rather talk =)

    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime: Set-up, Use, and Troubleshooting Problems
    http://tinyurl.com/32drz3d
    I saw one post where a user said dust got inside the small microphone hole. Using a vacuum cleaner removed the dust and restored the audio.
     Cheers, Tom

  • Why isnt this working?? - I really need this!!!

    Hi, can you please have a go at this problem? Thnx!!
    Here is the code:
    import java.io.*;
    public class Main {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    private String newname=null;
    public void setName ()throws Exception{
    System.out.print("Hello, please enter your attribute");
    newname = in.readLine();}
    public String getName(){
    return newname;}
    public Main()throws Exception{
    Main m = new Main();
    m.setName();
    import java.io.*;
    public class Main2 {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    private String newname=null;
    public void setName ()throws Exception{
    System.out.print("Please enter your sign");
    newname = in.readLine();}
    public String getName()throws Exception{
    Main z = new Main();
    z.setName();
    if(newname.equals("=")){
    return ("==" + z.getName());}
    else{
    return "Error";}}
    public Main2()throws Exception{
    Main2 p = new Main2();
    p.setName();}}
    import java.io.*;
    public class Main3 {
    public static void main(String[] args)throws Exception {
    Main2 p = new Main2();
    System.out.print("Hello "+p.getName());}}

    For one, Main2 has a recursive constructor:
    public Main2() throws Exception
      //Main2 p=new Main2();
      //p.setName();
      setName(); // You don't need another instance
    }Also, there is no reason to create a new class to get every entry from standard in. You could just do:
    System.out.println("Enter A: ");
    a=in.readLine();
    System.out.println("Enter B: ");
    b=in.readLine();

  • HT4113 why isnt this thing working

    why isnt this working

    Because of the actions of an unsympathetic deity.
    Try to ask a sensible question with a clue or two, and us folk might be able to help you. With your present standard of asking, you have no hope.

  • Questions, Extreme begginer - Why wont this work.

    /* My Java Program
    Failing To Compile 2009 - CurrentDate()
    /* Importing */
    import java.util.Scanner;
    import acm.graphics.*;
    import acm.program.*;
    class run {
         public static void main(String args[]){
         //Variables
         Scanner ninjatext = new Scanner(System.in);
         Scanner Clarinet_Request = new Scanner(System.in);
         System.out.println(ninjatext.nextLine());
         double pye, var1, ans;
         String yodawg;
         var1 = 2;
         pye = 3.14;
         yodawg ="I heard you like saxaphones  ";
         ans = var1/pye;
              System.out.println("Hello Cruel World?");
              System.out.print(yodawg);
              System.out.print("So i bought you ");
              System.out.print(ans);
              System.out.println(" Saxxes");
              System.out.println("So How many Clarinets Would you like????");
              System.out.println("Enter Number::");
              System.out.println("So " + Clarinet_Request.nextLine() + " Is how many clarinets You would like? Cool");
         /*Please end up working*/
         // Declaring Variables Semi-Randomly Works, Right?
         String test1 = "Ok i hope this works";
         int test2 = 10;
         double test3 = 4.9;
         int test4 = test2/test3; //Random Weird Awnser right???
         System.out.println(test2 + "Divided by" + test3 + "Is Equal To" + test4);
         /* This all should work, at least in theory.... But it wont right? */
         /** What have i gotten myself into? Oh well it sounds like it should work */
         Console console = System.console();
         String username = console.readLine("Lets Do This?: ");
         if (/* String? */username == "yes" || "Yes" || "YES"){
              testingthiscrap LeroyJenkins = new testingthiscrap
              LeroyJenkins.LetsDoThis()
         /* Guaranteed to not work */
    public class testingthiscrap extends GraphicsProgram {
         /** Runs the program */
         public void LetsDoThis() {
              GRect rect = new GRect(100, 50, 100, 100 / PHI);
              rect.setFilled(true);
              rect.setColor(Color.RED);
              add(rect);
              GOval oval = new GOval(150, 50 + 50 / PHI, 100, 100 / PHI);
              oval.setFilled(true);
              oval.setColor(Color.GREEN);
              add(oval);
    /** Constant representing the golden ratio */
         public static final double PHI = 1.618;
    /* Standard Java entry point */
    /* This method can be eliminated in most Java environments */
         public static void main(String[] args) {
              new FeltBoard().start(args);
         }//If anything i just typed i now feel heroic.
         // public static void
         Ok, sorry if the titles not good enough but i am a php programmer between begginer and intermediate but who wants to know java so i can say write a applet or something that can run from the desktop directly, also i wanted to lean OO and it in php confuses me infinately so i decided in the context of knowing nothing i might pick it up better thus java.
    So most of what im doing is confusing to me so i just tried to type some code (Well the first 20 maybe lines i compiled and tested but after that i couldnt test so i just ran with it. Today i tried to compile and poof, nothing.
    Any clues what im doing wrong and what i should do instead?
    BTW this stuff feels weird, i feel like to take imput it should have a html form or something. I dunno.
    also i dont even seem to have these acm packages im trying to import, any clue why?

    jman888 wrote:
    Ok, sorry if the titles not good enough but i am a php programmer between begginer and intermediate but who wants to know java so i can say write a applet or something that can run from the desktop directly, also i wanted to lean OO and it in php confuses me infinately so i decided in the context of knowing nothing i might pick it up better thus java. Ok?
    So most of what im doing is confusing to me so i just tried to type some code (Well the first 20 maybe lines i compiled and tested but after that i couldnt test so i just ran with it. Today i tried to compile and poof, nothing.I assume you got a compile time error, if so next time you post a question incorporate this piece of information.
    Any clues what im doing wrong and what i should do instead?I can take a stab at your code.
    BTW this stuff feels weird, i feel like to take imput it should have a html form or something. I dunno.One step at a time
    String yodawg;
    yodawg ="I heard you like saxaphones  ";This is not an error but plain weird IMHO, if you are declaring a variable then initializing it, you might as well do it all on one line.
    if (/* String? */username == "yes" || "Yes" || "YES"){
      testingthiscrap LeroyJenkins = new testingthiscrap
      LeroyJenkins.LetsDoThis()
    }This code will not compile and should produce one of possible many compiler errors. The condition inside the if statement requires each condition to be independent of one another. e.g. (username == "yes" || username = "Yes" || username == "YES").
    This also represents one of the most common errors presented to new comers. Equivalence of Objects such as Strings are compared using a method .equals() and not the term "==". The latter actually compares two Strings by the address stored in memory.
    class runBy convention all Class names begin with a capital letter
    Also it appears that the class run contains main method and an inner class in which itself contains a main method. I will conclude right here that you are biting off far more then you can chew. Start with the basics, e.g. Google for Java tutorials and start from "hello world" then make your way from there. Tackle one problem at a time and learn the concepts of the tutorial which will hopefully stay with you, as these fundamental concepts will be your foundation to development using the Java language.
    Mel
    Edited by: Melanie_Green, apparently CODE tags don't like me tonight

  • Why isnt drawLine() working??

    Does anybody know why the drawLine method isnt doing anything?
    ive made sure that done is true when i call it and x1, x2, y1 and y2 all have values. i dont know why it wont work
       public void paintComponent (Graphics page)
          super.paintComponent(page);
          for (City spot : cityList)
              page.fillOval ((int)spot.getX(), (int)spot.getY(), SIZE, SIZE);
              cityIcon.paintIcon (this, page, (int)spot.getX(), (int)spot.getY());
              if(done1 == true)
                   page.drawLine(x1, y1, x2, y2);
       }

    class Algo1
         private static ArrayList<City> cityList = new ArrayList<City>();
         static ArrayList<City> goodList = new ArrayList<City> ();
         static City thePoint = null;
         public Algo1(ArrayList<City> cityList)
              Algo1.setCityList(cityList);
         public static ArrayList<City> algo1 (ArrayList<City> cityList)
                ArrayList<City> thisList = new ArrayList<City> ();
                thisList.addAll((ArrayList<City>)cityList);
                City tempPoint = null;
                double firstXValue = 600;
                for (int i = 0; i < cityList.size(); i++)
                    tempPoint = new City(thisList.get(i).getX(), thisList.get(i).getY(), true);
                    if (tempPoint.getX() < firstXValue)
                        thePoint = thisList.get(i);
                        firstXValue = thePoint.getX();
                        thisList.get(i).removeCity();
                goodList.add(thePoint);
                while(!thisList.isEmpty())
                     thisList = onlyTrue(thisList);
                     if(!thisList.isEmpty())
                               thePoint = thisList.get(0);
                              City nextCity = getNextPoint(goodList.get(goodList.size() - 1), thisList);
                              nextCity.removeCity();
                              goodList.add(nextCity);
                return goodList;
            private static ArrayList<City> onlyTrue(ArrayList<City> trueList)
                  ArrayList<City> finalList = new ArrayList<City> ();
                  for (int i = 0; i < trueList.size(); i++)
                       if (trueList.get(i).checkIt() == false)
                            trueList.remove(i);
                  return trueList;
         private static City getNextPoint (City tempPoint, ArrayList<City> thisList)
                double minDist = 1000000;
                Point2D firstCity = tempPoint;
                Point2D secondCity = null;
                for (int i = 0; i < thisList.size(); i++)
                         if (firstCity.distance(thisList.get(i)) < minDist)
                             minDist = firstCity.distance(thisList.get(i));
                             secondCity = thisList.get(i);
                City nextCity = (City)secondCity;
                return (City)secondCity;
         public static void setCityList(ArrayList<City> cityList) {
              Algo1.cityList = cityList;
         public static ArrayList<City> getCityList() {
              return cityList;
    class City extends Point
         double x;
         double y;
         boolean onList;
         public City (double x, double y, boolean onList){
              this.x = x;
              this.y = y;
              this.onList = onList;}
         public City (Point abc){
              this.x = abc.getX();
              this.y = abc.getY();
              onList = true;}
         public boolean removeCity(){
              onList = false;
              return onList;}
         public double getX(){
              return x;}
         public double getY(){
              return y;}
         public boolean checkIt(){
              return onList;}
    class CityList
    static ArrayList<City> cityList = new ArrayList<City>();
        public CityList()
             cityList = cityListReader();
        public static ArrayList<City> cityListReader()
           Vector<Double> xCoord = new Vector<Double>();
           xCoord.addElement(new Double(78));
           xCoord.addElement(new Double(399));
           xCoord.addElement(new Double(207));
           xCoord.addElement(new Double(557));
           xCoord.addElement(new Double(280));
           xCoord.addElement(new Double(156));
           xCoord.addElement(new Double(285));
           Vector<Double> yCoord = new Vector<Double>();
           yCoord.addElement(new Double(326));
           yCoord.addElement(new Double(194));
           yCoord.addElement(new Double(306));
           yCoord.addElement(new Double(132));
           yCoord.addElement(new Double(143));
           yCoord.addElement(new Double(257));
           yCoord.addElement(new Double(365));
           for (int i = 0; i < xCoord.size(); i++)
               City newCity = new City((double)((Double)xCoord.elementAt(i)),
                                                (double)((Double)yCoord.elementAt(i)), true);
               cityList.add(newCity);
           return cityList;
    }

  • Why does this work?

    I've been practicing some IPSec VPN scenarios, starting with the typical site-to-site VPN:
    Router A
    crypto map mymap 10 ipsec-isakmp
    set peer 1.1.1.2
    set transform-set myset
    match address 101
    access-list 101 permit ip 10.1.1.0 0.0.0.255 10.1.2.0 0.0.0.255
    Router B
    crypto map mymap 10 ipsec-isakmp
    set peer 1.1.1.1
    set transform-set myset
    match address 101
    access-list 101 permit ip 10.1.2.0 0.0.0.255 10.1.1.0 0.0.0.255
    This works as expected. Traffic from 10.1.1.x on Router A gets picked up by the crypto map and sent to RouterB and vice versa. What is confusing me is a more advanced scenario where I'm tunnelling GRE over IPSec with OSPF (why? Because I can).
    http://www.cisco.com/en/US/tech/tk583/tk372/technologies_configuration_example09186a008009438e.shtml
    Everything works just fine, but I'm bothered by the ACLs being used in the example. I don't see how everthing should be working- OSPF is fat and happy, and if I ping one spoke from another spoke from a loopback interface, it works as well. In this case, is the network traffic being picked up by the Tunnel interface first, and all the crypto map sees is GRE traffic by the time the packets make it that far?

    Ian
    You ask a question about the access lists and I believe that it will be easier to answer the question if we have the access lists to refer to. So here they are:
    7206:access-list 130 permit gre host 14.36.88.6 host 14.38.88.40access-list 140 permit gre host 14.36.88.6 host 14.38.88.20access-list 150 permit gre host 14.36.88.6 host 14.38.88.102610:access-list 120 permit gre host 14.38.88.10 host 14.36.88.63620:access-list 110 permit gre host 14.38.88.20 host 14.36.88.6
    3640:
    access-list 100 permit gre host 14.38.88.40 host 14.36.88.6
    one of the first things to understand here (and you briefly mention it in your post) is that they are running OSPF dynamic routing protocol over the tunnels. So each router sees the path to get to the other router as being through the tunnel. So when the 2610 wants to get to the 7206 it will send that traffic to the tunnel interface. The tunnel interface will encapsulate the original packet in a GRE header. So yes the only thing that the access list will see is GRE traffic.
    Anything that goes through the tunnel (whether it be a data packet or an OSPF routing update) is encapsulated in a GRE header and the access list does not see the original data but sees only GRE.
    HTH
    Rick

  • Why aint this working???

    have pasted object thru a constructor like this:
            Write screen   = new Write(ring);
    //and rezive it here in the constructor
         public Write(Object ring)
              buffer = ring;
    // and use it like this:
              System.out.println(buffer.remove()); // This line gets an errorSo why is this error comming?
    cannot resolve symbol method remove()

    public class RingBuffer
        public static void main(String[] args)
             Ringen ring = new Ringen();
             Write screen   = new Write(ring);  // Henter tekst fra ringbuffer og skriver den ut p? skjermen.
             Generate genr  = new Generate();   // Lager tekst "automatisk" og legger den inn i ringbufferen.
             Input_txt intxt= new Input_txt(ring);  // Lar brukeren taste inn noen ord som lagres i ringbufferen.
             screen.start(); //
             genr.start();   //  Starter tr?dene.
             intxt.start();  //
    public class Write extends Thread
         private Object buffer;
         public Write(Object ring)
              buffer = ring;
         synchronized public void run()
              //Ringen buffer = new Ringen();
              while(true){
                   try{
                        System.out.println(buffer.remove()); // Pr?ver ? skrive ut hvert sekund
                        Thread.sleep(1000);
                   }//end try
                   catch(InterruptedException e){
                        System.out.println(e);
              }//end while
    import java.io.*;
    public class Input_txt extends Thread
         Object buffer;
         public Input_txt(Object ring)
              buffer = ring;
         synchronized public void run()
              try{
                        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
                        System.out.println("Skriv inn noe tull");
                        String inTxT = in.readLine();
                        buffer.insert(inTxT);
              catch(Exception e) { System.out.println(e);}
    public class Ringen implements Buffer
         private static final int BUFFER_SIZE = 10;
         int in, out;  // peker p? f?rste ledige og siste okuperte.
         int count;    // Teller hvor mange objekter som er i bufferen.
         private Object[] buffer;
         public Ringen()
              count = 0;
              in = 0;
              out = 0;
              buffer = new Object[BUFFER_SIZE];
         public void insert(Object item)
              while (count == BUFFER_SIZE)
                   ;// do nothing..
              // Legger til et object i bufferen
              ++count;
              buffer[in] = item;
              in = (in + 1)% BUFFER_SIZE;
         public Object remove()
              Object item;
              while (count == 0){
                   try{
                        System.out.println(buffer[0]);
                        Thread.sleep(4000);
                   }//end try
                   catch(InterruptedException e){
                        System.out.println(e);
              }//end while
              --count;
              item = buffer[out];
              out = (out + 1) % BUFFER_SIZE;
              return item;
    public interface Buffer
         // producers call this method
         public abstract void insert(Object item);
         // consumers call this method
         public abstract Object remove();
    }

  • Why isnt this loop working?

    I am trying to fill an array with the Fibonacci sequence.
    Oh and, I know its very silly to use 'long i' instead of 'int i' as my incrementor in the for loop. But... I have a reason.
    import java.math.*;
    public class euler20{
         public static void main (String arghp[]){
              BigInteger a[]=new BigInteger [1000000];
              a[1]=new BigInteger("1");
              a[2]=new BigInteger("2");
              for(long i=3;i<10;i++)     
                        System.out.println(a[(int)i]);
                        a[(int)i]=new BigInteger(""+a[(int)i-1].add(a[(int)i-2]));
              Tell me I am doing something REALLY stupid..

    uhm well, I imporvised my code a little..
    replace a[(int)i]=new BigInteger(""+a[(int)i-1].add(a[(int)i-2]));with
    a[(int)i]=a[(int)i-1].add(a[(int)i-2]);However, the problem persists.

  • Filter as autoload trigger; why does this work?

    In my efforts to use PS consoles more and CMD consoles less, I've been "porting" my environment over. One of the things I can't live without is my 'cd aliases'. I have several aliases like: "src=cd /d c:\src" (loaded in doskey). Separate
    functions for each alias seemed kludgy, so after a bit of playing around, I came up the little module below to mimic the functionality. The function takes a look at the alias that invoked it and sets the location based on values in a hashtable.
    Since the aliases are dynamically created and thus aren't available to trigger the autoload, I decided to add a filter to do the triggering (I could just import the module in my profile, but I try to keep my profile lean).
    My thought was that I could type 'src' and if the module wasn't loaded, it would cause the autoload to happen which would override the filter 'src' with the alias 'src'. Typing 'src' a second time would actually set my location to my source directory.
    When I tested the 'filter autoload' however, I was pleasantly surprised that not only did it autoload the module, but it did the set-location on the
    first invocation.
    My guess is that PS sees the command 'src' and when it's passed looks at the modules that can satisfy the command. Finding a filter named 'src' in CdAlias.psm1, it autoloads. Then PS, knowing that the needed module is now loaded, resolves 'src' against the
    now-current environment, finds the alias, resolves that to Set-XLocation and we are off to the races. That said, I'm only guessing here, and since this seems like something that could be useful in other places, it would be cool if someone could confirm my
    guess or explain what's really happening.
    thanks,
    K.
    Note: This is the prototype, I will actually store the hashtable in the registry along with functions to edit the entries.
    <#
    .Synopsis
    Sets location based on the alias name used to call the function
    .DESCRIPTION
    Uses the name of the alias used to call the function to look up
    a path in the script-scoped dictionary 'xlocation' then sets
    the location to that value.
    .PARAMETER ChildPath
    Optional child path, if passed it will be joined with the base.
    .NOTES
    Not sure why the filter trick works, but it does. Since src is my
    most commonly used alias location, I can use it to auto-load. What
    really confuses me is that it still sets the location to src the
    first time I type it.
    #>
    function Set-XLocation
    Param
    [string]$ChildPath
    $k = $MyInvocation.InvocationName
    if ($Script:xlocation.ContainsKey($k))
    Set-Location -Path (Join-Path -Path $Script:xlocation[$k] -ChildPath $ChildPath)
    else
    Write-Warning "`$xlocation does not contain the key '$k'."
    $Script:xlocation = @{
    src = 'C:\src';
    one = 'C:\src\one';
    zero = 'C:\src\zero';
    mod = "$mod";
    foreach ($k in $Script:xlocation.Keys) { Set-Alias -Name $k -Value Set-XLocation }
    filter src
    Export-ModuleMember -Function Set-XLocation -Alias *

    I do not understand what the issue is.  If you have to create a filter for every alias you are not really gaining anything over defining a function or alias.
    I do not believe the filter does anything except create a reference:
    PS C:\src> get-alias src
    CommandType     Name                                              
    ModuleName
    Alias           src -> Set-XLocation                              
    CDAlias
    ¯\_(ツ)_/¯

  • Why doesnt this work, its so simple

    The following piece of code I guess should print "THEY ARE EQUAL" but it doesnt. I dont know why???????????? anybody help.
    String check = new String("new���".getBytes("iso-8859-1"), "iso-8859-1");
    for(int i =0 ; i< check.length(); i++)
    if(check.charAt(i)=='���') System.out.println("THEY ARE EQUAL");
    }

    You aren't comparing whether the two strings contain
    the same data, you are comparing whether the two
    references point to the same objects. Try it again
    using the .equals() method to compare the contents of
    the two strings instead of using ==.For the first time in my life have I seen DrClap err. So he is human too. amit234 is comparing characters and not Strings
    I found the solution to your problem your the corresponding line in your code with this one and it would work
    if(check.charAt(i)=='\u20AC') System.out.println("THEY ARE EQUAL");
    happy coding

  • Work-around The Whine: why does this work? And is it BAD?

    Hello everybody, sorry to bring up The Whine again, but I was wondering if anyone can figure out why the following trick works to eliminate the noise.
    Also, could doing this regularly (all the time, basically) potentially be bad for the system in any way?
    This is the work-around I've been using:
    1. Open Photobooth, then Force Quit that application (you must Force Quit rather than simply quit)
    2. Put the Macbook to sleep, waiting a few seconds until the indicator light starts pulsing.
    3. Wake up the computer.
    Voila. That always does the trick, eliminating the whine until either the next time I boot up or the next time I open and quit Photobooth in the normal way.
    I suppose force quitting may keep the processor slightly busy somehow?
    Don't know...

    John P.,
    You say that all the notebooks that you know of make
    some kind of noise. How many notebooks is that? Not
    trying to be a jerk or anything but it better be like
    dozens and dozens to make this claim. I have heard
    the exact opposite of this claim from users that have
    owned a few notebooks as well.
    Hi Jerome,
    No problem... I'll clarify..
    5 notebooks personally, so when I say "all notebooks that I know of", it's a true claim because that is exactly what I'm saying.
    If this noise is caused by capacitor that is at some
    miniature threshold then why does the noise go away
    when said remedies are employed? Does the capacitor
    get bigger? Doesn't make sense but I appreiate that
    you want to reassure original poster.
    Actually I may have misspoken--it may be called a "voltage regulator" and it sits directly West of the CPU and controller chip. They do make noise and from what I have been told and remember, they can dampen it w/ a capacitor but that's about it. It's just the nature of the beast for that type of component, I'm told.
    What "I" think it may be is the power fluctuations, or lack thereof, in the Intel chip causing it--when you put a load on it, there's a power fluctuation because your CPU usage is going up/down a little bit, but when you're not doing anything it's very little it causes it to make a little noise. No big deal, but just as long as it's not blaring in your ear when you're trying to use your computer. My ZV6000 does the same thing, but it doesn't matter when you've got a load or not--seems to do it more when I have Cool 'n' Quiet enabled.
    This is not right. I am sorry.
    If this noise is normal then I'll take no MacBook.
    You know it is being fixed apparently on the MacBook
    Pros by motherboard replacement.
    I never said anything about pro. I don't own one, nor have I used one. I can't say how profound in comparison to the Macbook (non pro) it is.
    I'm sure if Apple thought it was a big enough problem, they would act either more quickly about it, but it's not stopping me from checking my e-mail or going on the Web.

  • Why does this work in MS SQL and not in Oracle

    ALTER TABLE Stk
    DROP COLUMN ComCode;
    This BASIC statement works perfectly
    in MS SQL, but after 2 hours now, it
    simply refuses to work in Oracle,
    although the syntax seems correct, I
    get :
    ALTER TABLE Stk
    DROP COLUMN ComCode
    ORA-00905: missing keyword
    null

    Stop trying! Oracle simply does not support the DROP COLUMN syntax. A work around is:
    CREATE another table based on the original table, minus the column you want to drop.
    (CREATE TABLE new_table AS SELECT col1, col2 , ... FROM old_table)
    DROP the original table.
    (DROP TABLE old_table)
    RENAME the new table the old table.
    (RENAME new_table TO old_table)
    Your have to manually add the constraints, if the old table has any.
    Eric Ma

Maybe you are looking for

  • HT4007 How to I find my serial number for Aperture 3. Just moved it to a new imac.

    I purchased Aperture 3 from the Apple App Store in 2010 and downloaded it.  I received an activation key but no serial number. Now I have transferred Aperture 3 to a new imac but it asked for a serial number.  I put the activation number in but is sa

  • Maximum Parameter Size?

    I am working on a report which the user can select from a number of text templates from a web form. One of the options is custom text (if the pre-defined ones aren't good enough). This text is passed from the ASP page to Crystal as a parameter, and p

  • Plain HTTP Adapter - How to add CR/LF into Prolog?

    Hi all! I have to do a multipart/formdata request to an external HTTP Server. This requires to set boundaries etc. AND to add Carriage Returns / Line Feeds into the HTTP-Body. I think I could solve the problem using the Prolog / Epilog functionality

  • Drag and Drop items among JList

    Hi, I want to drag item from one JList and drop into another JList using JFrame in java Swing. Please provide me code for this. Thanks Nitin

  • Export Images as Cropped in CS3?

    We have produced a photographer's portfolio in InDesign CS3.  We now would like to take the images in the portfolio and prep them to go onto her web site.  Is there some convenient way to export all of the images from the portfolio file cropped as th