Random data from db

Hi all,
im doing a java project on my school Object Orientated Analysis and Design module. i'm doing a disc rental system, and was trap in one of my class file.
i have 3 files here,
1. ChooseDiscForm.java
the GUI class, which contain all my buttons, table, labels etc.
2. ChooseDiscController.java
this file is link to my ChooseDiscForm, where it store the method of
what should my buttons should do when i click on it. The method here link my button to my database (db) connection file called Disc.java,
3. Disc.java
stores all the dbQuery and connection to my db.
Inside my db, which contains all my discs record, like movie title, decription of movie bla bla, and EACH disc has a unique discId.
i need to do a random generating code for my button inside ChooseDiscForm.java, where it will call a method named ''processToRandomSearch()' inside my ChooseDiscController, and from thise processToRandomSearch(), it will call another method named ''ArrayList<Disc> dataList = d.getRandomDisc(id)'' which is stored inside Disc.java.
i have found the java random number coding. but i dunno how do i put inside my disc.java.
in my disc.java, where i will retrieve my disc info out of my db, my lecture suggested me to create a arraylist, to store my all discId(from db), and put it inside he random number code. but i tried it many times. it cant work.. ;'(. here is my code:
ChooseDiscForm.javau
//delare object link to RentDiscController.java
ChooseDiscController getControl = new ChooseDiscController();
//action for my button.
private void submitSearchByRandom(ActionEvent e){  
                     //inside ChooseDiscController.java file                                    getControl.processToRandomSearch();
                     //my table to put the data into.
     jScrollPane.setViewportView(getJTable1());
//my table
private JTable getJTable1() {
     if (jTable1 == null) {
     String[] columnNames = {"Disc Title",
                   "Disc ID",
                   "Status",
                   "Type",
                   "Description",
                                   "Language",
                   "Rating",
                   "No. of Disc",
                   "Cost Price",
     jTable1 = new JTable(data1, columnNames);
                     jTable1.setBounds(new Rectangle(13, 22, 483, 224));
        return jTable1;
ChooseDiscController.java
//create object link to Disc.java entity
Disc d = new Disc();
static ArrayList<Disc> getDiscArray = new ArrayList<Disc>();
static Object[][] data = new Object[13][13];
//method from my button
public void processToRandomSearch(){
                      // this method is in my disc.java file.
      ArrayList<Disc> dataList = d.getRandomDisc(id);
                      //this print my data into the table.
         getDiscArray = dataList;
    public Object[][] getData(){
         for(int i=0; i<getDiscArray.size();i++){
              data[0] = getDiscArray.get(i).gettitle();
          data[i][1] = getDiscArray.get(i).getdiscId();
          data[i][2] = getDiscArray.get(i).getstatus();
          data[i][3] = getDiscArray.get(i).gettype();
          data[i][4] = getDiscArray.get(i).getdesc();
          data[i][5] = getDiscArray.get(i).getlanguage();
          data[i][6] = getDiscArray.get(i).getrating();
          data[i][7] = getDiscArray.get(i).getnoOfDisc();
          data[i][8] = getDiscArray.get(i).getcostPrice();
     return data;
disc.java
//Search by random db connection
public ArrayList<Disc> getRandomDisc(String id){
ArrayList<Disc> discList = new ArrayList<Disc>();
/*this funtion is what i found on net. not sure is this the right place to put in.*/          
Random r = new Random();
// Code to access db
ResultSet rs = null;
String dbQuery = "SELECT * FROM Disc where discId \'" + id + "\'";
DBController db = new DBController();
System.out.println(dbQuery);
db.setUp("IT2292");
rs = db.Request(dbQuery);
try{
/*i have to make it a while loop, so that my data printed on my table will not overlap one another. but print all my disc out.*/
while (rs.next()){
/*my lecture wanted me to cast my discId into an array, its a cheating way to declear the new String[20],  i dunno what is the right way to get the size from my db, and my disc records inside db contain 20 disc with a few with the same name like Transformers. but they are unqiuely identify by their discId like 'ECM0001' etc.*/
/*this chunk of codes here, i need to randomly generate 10 records from my db which includes all the disc info and display it into my table.     */                    
         String[] y = new String[20];
         y[i] = rs.getString("discId");
        int w = Integer.parseInt(y); // this line.
/*error here. as i compile, it's able to find the discId, but somehow, the console say there is a error here they din tell me why. pls help me. thanks /*
w = r.nextInt(10);     
     String a = rs.getString("title");
     String c = rs.getString("status");
     String e = rs.getString("type");
     String f = rs.getString("desc");
     String g = rs.getString("language");
     String h = rs.getString("rating");
     String k = rs.getString("costPrice");
discList.add (new Disc(a,b,c,e,f,g,h,j,k));
     catch (Exception e) {
     e.printStackTrace();
     db.terminate();
     return discList;
thats all. sorry for the long winded story.. i have burned many night of mid-night oil trying to get this done.. im only 3 days to my presentation day.. and i need to hand it up as soon as possible for my team lead to compile them. pls help me java experts!! thanks:)
Message was edited by:
Titus-tan

Hi pal,
the item i retrieved out from my db is String, so i have to pass it into a string. and from the example of the random, it is called as int w = r.nextInt();, and i have to pass my string into this random coding. shouldnt i pass my string into integer?
Titus

Similar Messages

  • Random data generator

    hi,
    i'm thinking of writing a java application that would be able to simulate random data and be able to use that data to pass to other program/client. an example would be creating random data from plot extractor of a radar scan, and pass those data (coordinates,bearings etc) to another program.
    what classes and objects do i need to create in the radar program?
    thanks.

    Apart from looking up java.util.Random, I'd strongly advise that you use Object as the superclass of all your other classes. This provides substantial benefits in any Java application.
    Sylvia.

  • I'm having some difficulty with Time Machine.  It appears to be deleting backups from random dates on my external hard drive.  I am not deleting them.  Are they hidden and how do I prevent this from happening?  Can I retrieve them?

    I'm having some difficulty with Time Machine.  It appears to be deleting backups from random dates on my external hard drive.  I am not deleting them.  Are they hidden and how do I prevent this from happening?  Can I retrieve them?

    ... I didn't know that Time Machine was more a last resort back up instead of main back up.
    Don't rely upon Time Machine to the exclusion of all else. I compliment Time Machine with a periodic "clone". TM is much better than nothing, but it's a safety net, not a hammock
    Here is my understanding of Time Machine's file deletion algorithm, distilled from Pondini's FAQ, Apple's KB articles, and my own observations.
    Time Machine deletes ("thins") files from the backup disk as follows:
    Hourly backups over 24 hours old, except the first backup of the day
    Daily backups over 30 days old, except the first backup of the week
    Older backups get deleted when Time Machine requires space and you deleted them from the source disk.
    Therefore, assuming TM has been performing at least one backup per day, backup files will remain available:
    at least thirty days, if they existed on your Mac for at least a day
    until you run out of space, if they existed on your Mac for at least a week
    In addition to the above, Time Machine always keeps one complete copy of your source disk so that the entire volume could be restored if necessary. Any files that remain on your source volume will be present on the TM backup, no matter how old they are.
    If you are using 250 GB of space on your source disk, its Time Machine backups are likely to require at least twice that much. A good estimate of the minimum required backup volume size would be about three times the size of your source disk - 1.5 TB in your case.
    A more thorough explanation would require Pondini since he has plumbed Time Machine's mysteries far more than I have.
    http://support.apple.com/kb/HT1427

  • Arranging Random Data Pieces From SLX/Smart Catalogue Into Table Format

    Hi,
    We have a performance data grid that needs to appear on our quotation report.  The data is organized currently into rows in a 2-table linked format and manually entered as plain txt by the user.  We are now migrating towards designing a report in Crystal Reports to try to recreate this table layout but still needing to mine data for other purposes.  Therefore, the data pieces need to be distinct and separate.  Further, the data pieces required for the table can vary and can be organized in up to 9 different ways depending upon the given situation.  Is there an effective way to aesthetically arrange random data pieces in a table format?  The data pieces are coming from SalesLogix / SmartCatalog.  Has any other user of Crystal Reports attempted to do this - i.e. create a data table on a Crystal report?
    Sincerely,
    Sarah Imig
    International Sales Administrator/Database Administrator
    HayssenSandiacre

    Hi,
    We have a performance data grid that needs to appear on our quotation report.  The data is organized currently into rows in a 2-table linked format and manually entered as plain txt by the user.  We are now migrating towards designing a report in Crystal Reports to try to recreate this table layout but still needing to mine data for other purposes.  Therefore, the data pieces need to be distinct and separate.  Further, the data pieces required for the table can vary and can be organized in up to 9 different ways depending upon the given situation.  Is there an effective way to aesthetically arrange random data pieces in a table format?  The data pieces are coming from SalesLogix / SmartCatalog.  Has any other user of Crystal Reports attempted to do this - i.e. create a data table on a Crystal report?
    Sincerely,
    Sarah Imig
    International Sales Administrator/Database Administrator
    HayssenSandiacre

  • IMAP messages from random dates?

    I recently added an IMAP account to my iPhone. The phone show 25 messages, however, they're not the most recent ones. They seem to be from random times but are displayed in order. When I receive a new message however, it gets displayed in the right order.
    Also, if I click "load more messages", it'll load random messages from like a year ago, I was hoping that it'll load more in chronological order.
    Anyone has any idea what's going on?
    Thanks

    The iPhone fetches the messages in the order they were modified, not in the order they were sent or received. Here is what I did not work around this problem:
    1. Go to MobileMe webmail
    2. Sort the problematic mailbox by date, newest on top. For me it was my Sent messages.
    3. Set the prefs to display the largest number of messages that's possible (200)
    4. Create a new mailbox called Temp for example
    5. Choose Select All. Choose Move to Folder... and choose to move the selected messages to the Temp folder
    6. Go to the Temp folder, sort the messages by date.
    7. Select All, move back to the original folder.
    The messages have now been modified in the order then were sorted. For me, my iPhone now displays at least the 200 latest emails in the correct order and that is good enough for me.

  • How to randomly select data from excel using labview.

    A very good day to all. I am actually working on a system that will be selecting integer number from randomly generated set of number. If that wouldnt be possible, I would like the system to be able to select number from the set of numbers which have already been randomly generated from excel. kindly help me with the solution. To make myself clear, supposing I have set of numbers from 1 to 10, I want a labview setup that will be picking these numbers one after the other either with replacement or without from excel or self generated. I know this is possible in matlab but would prefer labview if possible.  Thanks
    Solved!
    Go to Solution.

    Most, if not all, of the languages I've run across have a rand() function that returns a random number between 0 and 1.  Getting some other range is up to the programmer.  Usual method is to multiply by the range you need and add an offset to adjust the mean.  For instance if you need a random number between 200 and 300 the formula might look like  " rand()*100+200 ".   If you need an integer, you can use the round function (which will leave it as a float with no decimal pportion) or the conversion (to int).    All of this is doable and straightforward in LabVIEW.  Have a look: http://digital.ni.com/public.nsf/allkb/FCCDCD678EEF3A9186256D7B008054F5
    If you feel more comfortable pulling from a file, try this: http://digital.ni.com/public.nsf/allkb/C944B961B59516208625755A005955F2 

  • Can not export data from form tracker

    Hi there,
         I have set up a lovely form for collecting data. It all comes into the Adobe Tracker and the Responses file fine.
         What i wish to do is export data from the responses file into another format. I should be able to do it from the Export button on the left but it is 'blanked out' and does nothing if I push it. I can't find any details on here or the internet relating to this. And yes, there is data in the file to export .
    Hoping you can help.
    Many thanks in advance.

    I have the same problem but... I created two forms for two separate purposes and have had responses to both.
    One of them allows me to export the data and the other does not.
    Does anyone out there have an answer for this seemingly random anomoly?
    Regards
    Sydman

  • Reading a Random Line from a Text File

    Hello,
    I have a program that reads from a text file words. I currently have a text file around 800KB of words. The problem is, if I try to load this into an arraylist so I can use it in my application, it takes wayy long to load. I was wondering if there was a way to just read a random line from the text file.
    Here is my code, and the text file that the program reads from is called 'wordFile'
    import java.awt.*;
    import java.awt.geom.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    public class WordColor extends JFrame{
         public WordColor(){
              super("WordColor");
              setSize(1000,500);
              setVisible(true);
              add(new WordPanel());
         public static void main(String[]r){
              JFrame f = new WordColor();
    class WordPanel extends JPanel implements KeyListener{
         private Graphics2D pane;
         private Image img;
         private char[]characterList;
         private CharacterPosition[]positions;
         private int charcounter = 0;
         private String initialWord;
         private File wordFile = new File("C:\\Documents and Settings\\My Documents\\Java\\projects\\WordColorWords.txt");
         private FontMetrics fm;
         private javax.swing.Timer timer;
         public final static int START = 20;
         public final static int delay = 10;
         public final static int BOTTOMLINE = 375;
         public final static int buffer = 15;
         public final static int distance = 4;
         public final static Color[] colors = new Color[]{Color.red,Color.blue,Color.green,Color.yellow,Color.cyan,
                                                                          Color.magenta,Color.orange,Color.pink};
         public static String[] words;
         public static int descent;
         public static int YAXIS = 75;
         public static int SIZE = 72;
         public WordPanel(){
              words = readWords();
              setLayout(new BorderLayout());
              initialWord = getWord();
              characterList = new char[initialWord.length()];
              for (int i=0; i<initialWord.length();i++){
                   characterList[i] = initialWord.charAt(i);
              setFocusable(true);
              addKeyListener(this);
              timer = new javax.swing.Timer(delay,new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        YAXIS += 1;
                        drawWords();
                        if (YAXIS + descent - buffer >= BOTTOMLINE) lose();
                        if (allColorsOn()) win();
         public void paintComponent(Graphics g){
              super.paintComponent(g);
              if (img == null){
                   img = createImage(getWidth(),getHeight());
                   pane = (Graphics2D)img.getGraphics();
                   pane.setColor(Color.white);
                   pane.fillRect(0,0,getWidth(),getHeight());
                   pane.setFont(new Font("Arial",Font.BOLD,SIZE));
                   pane.setColor(Color.black);
                   drawThickLine(pane,getWidth(),5);
                   fm = g.getFontMetrics(new Font("Arial",Font.BOLD,SIZE));
                   descent = fm.getDescent();
                   distributePositions();
                   drawWords();
                   timer.start();
              g.drawImage(img,0,0,this);
         private void distributePositions(){
              int xaxis = START;
              positions = new CharacterPosition[characterList.length];
              int counter = 0;
              for (char c: characterList){
                   CharacterPosition cp = new CharacterPosition(c,xaxis, Color.black);
                   positions[counter] = cp;
                   counter++;
                   xaxis += fm.charWidth(c)+distance;
         private void drawThickLine(Graphics2D pane, int width, int thickness){
              pane.setColor(Color.black);
              for (int j = BOTTOMLINE;j<BOTTOMLINE+1+thickness;j++){
                   pane.drawLine(0,j,width,j);
         private void drawWords(){
              pane.setColor(Color.white);
              pane.fillRect(0,0,getWidth(),getHeight());
              drawThickLine(pane,getWidth(),5);
              for (CharacterPosition cp: positions){
                   int x = cp.getX();
                   char print = cp.getChar();
                   pane.setColor(cp.getColor());
                   pane.drawString(""+print,x,YAXIS);
              repaint();
         private boolean allColorsOn(){
              for (CharacterPosition cp: positions){
                   if (cp.getColor() == Color.black) return false;
              return true;
         private Color randomColor(){
              int rand = (int)(Math.random()*colors.length);
              return colors[rand];
         private void restart(){
              charcounter = 0;
              for (CharacterPosition cp: positions){
                   cp.setColor(Color.black);
         private void win(){
              timer.stop();
              newWord();
         private void newWord(){
              pane.setColor(Color.white);
              pane.fillRect(0,0,getWidth(),getHeight());
              repaint();
              drawThickLine(pane,getWidth(),5);
              YAXIS = 75;
              initialWord = getWord();
              characterList = new char[initialWord.length()];
              for (int i=0; i<initialWord.length();i++){
                   characterList[i] = initialWord.charAt(i);
              distributePositions();
              charcounter = 0;
              drawWords();
              timer.start();
         private void lose(){
              timer.stop();
              pane.setColor(Color.white);
              pane.fillRect(0,0,getWidth(),getHeight());
              pane.setColor(Color.red);
              pane.drawString("Sorry, You Lose!",50,150);
              repaint();
              removeKeyListener(this);
              final JPanel p1 = new JPanel();
              JButton again = new JButton("Play Again?");
              p1.add(again);
              add(p1,"South");
              p1.setBackground(Color.white);
              validate();
              again.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt){
                        remove(p1);
                        addKeyListener(WordPanel.this);
                        newWord();
         private String getWord(){
              int rand = (int)(Math.random()*words.length);
              return words[rand];
         private String[] readWords(){
              ArrayList<String> arr = new ArrayList<String>();
              try{
                   BufferedReader buff = new BufferedReader(new FileReader(wordFile));
                   try{
                        String line = null;
                        while (( line = buff.readLine()) != null){
                             line = line.toUpperCase();
                             arr.add(line);
                   finally{
                        buff.close();
              catch(Exception e){e.printStackTrace();}
              Object[] objects = arr.toArray();
              String[] words = new String[objects.length];
              int count = 0;
              for (Object o: objects){
                   words[count] = (String)o;
                   count++;
              return words;
         public void keyPressed(KeyEvent evt){
              char tempchar = evt.getKeyChar();
              String character = ""+tempchar;
              if (character.equalsIgnoreCase(""+positions[charcounter].getChar())){
                   positions[charcounter].setColor(randomColor());
                   charcounter++;
              else if (evt.isShiftDown()){
                   evt.consume();
              else{
                   restart();
              drawWords();
         public void keyTyped(KeyEvent evt){}
         public void keyReleased(KeyEvent evt){}
    class CharacterPosition{
         private int xaxis;
         private char character;
         private Color color;
         public CharacterPosition(char c, int x, Color col){
              xaxis = x;
              character = c;
              color = col;
         public int getX(){
              return xaxis;
         public char getChar(){
              return character;
         public Color getColor(){
              return color;
         public void setColor(Color c){
              color = c;
    }

    I thought that maybe serializing the ArrayList might be faster than creating the ArrayList by iterating over each line in the text file. But alas, I was wrong. Here's my code anyway:
    class WordList extends ArrayList<String>{
      long updated;
    WordList readWordList(File file) throws Exception{
      WordList list = new WordList();
      BufferedReader in = new BufferedReader(new FileReader(file));
      String line = null;
      while ((line = in.readLine()) != null){
        list.add(line);
      in.close();
      list.updated = file.lastModified();
      return list;
    WordList wordList;
    File datFile = new File("words.dat");
    File txtFile = new File("input.txt");
    if (datFile.exists()){
      ObjectInputStream input = new ObjectInputStream(new FileInputStream(datFile));
      wordList = (WordList)input.readObject();
      if (wordList.updated < txtFile.lastModified()){
        //if the text file has been updated, re-read it
        wordList = readWordList(txtFile);
        ObjectOutputStream output = new ObjectOutputStream(new FileOutputStream(datFile));
        output.writeObject(wordList);
        output.close();
    } else {
      //serialized list does not exist--create it
      wordList = readWordList(txtFile);
      ObjectOutputStream output = new ObjectOutputStream(new FileOutputStream(datFile));
      output.writeObject(wordList);
      output.close();
    }The text file contained one random sequence of letters per line. For example:
    hwnuu
    nhpgaucah
    zfbylzt
    hwnc
    gicgwkhStats:
    Text file size: 892K
    Serialized file size: 1.1MB
    Time to read from text file: 795ms
    Time to read from serialized file: 1216ms

  • How to load data from one Infocube to another request by request using DTP

    Hi All,
    I have a scenario where we are maintaining backup Infocube B for Infocube A.  User loads data from a flat file many times a day in different requests.  We need to maintain backup of the Infocube A on weekly basis.  i.e data to be refreshed with delta update from cube A to cube B.  There are some situations where user deletes some of the requests in Infocube A randomly after use.  Will this change effect in back up cube B when performed data refresh from cube A to cube B.  i.e. this functionality is similar to reconstruct in BW 3.5.  Now we are running on BI 7.0 SP 9.
    Can anyone answer this ASAP.
    Many Thanks,
    Ravi

    You cannot load request by request, " Get Data By Request " DTP loads request by request on " First In First Out " basis. You can run some Pseudo/Fake DTP's if you dont want to load data from a particular request.
    If the user deletes a request from Cube A, it wont be loaded to Cube B but if it is already loaded in Cube B and later the user deletes the request from Cube A you have to delete the request frm Cube B. Inorder to monitor request by request run DTP with   " Get Data By Request set.

  • Safari on iPad Air 2 flashes random pages from history

    iPad Air 2 64GB WiFi running 8.1.3
    When I open Safari, a random page from my history (usually from days or weeks ago) flashes on the screen for 1/2 second and then shows the current webpage.
    I've cleared History and Website Data in Settings>Safari. Still does it. Safari even flashes pages that should have been cleared In that process!
    I then restored the iPad as a new device through iTunes. Still does it.
    I've had the iPad since November. It never did this until January. Hopefully the next iOS update will take care of it. Very annoying.

    Forgot to mention- this happens upon launching Safrari from either a "quit" state or "background" state.

  • Palm Desktop seems to back up only select data from Treo 650

    I recently transferred my Palm Desktop program and backup files from my old XP PC to my new PC running Windows 7 (64bit).  Aside from the frustrations of being unable to HotSync using USB, I was more concerned that that address & calendar files in my user folder were nearly empty.   My calendar contained 14 random events from within the last month and the address book contained three contacts (my Treo contains hundreds).  Each folder should have contained considerably more data.  I went back to the original user folder on my old PC and the saved data was no different.  Although hundreds of events & contacts appear on my Treo and in the Palm Desktop, my user file has less than 1MB of data in those respective folders.
    Can I conclude that my monthly HotSyncs have been faulty all of this time?  Or am I looking in the wrong place for my complete data.  Until I find a workaround the Windows 7 problem, I want to make sure all my data is at least present on the hard-drive (even though I can't HotSync). 
    FYI, this is where I found my skimpy data:   C:/Palm OS Desktop/(username)/address   and   C:/Palm OS Desktop/(username)/datebook     .   The Palm Desktop is Version 6.2.2
    Thank you! 
    Post relates to: Treo 650 (Sprint)

    An update to the above issue:   All of the datebook & address data IS present within the *.aba files within my user folder when opened via Microsoft Access.  However, when I import those files into Palm Desktop, only a small handful of events (28 out 5000+) and addresses (3 out 1000+) appear.

  • Obtain the determinat​e data from the NI-DAQmx Simulated Device

    Dear All,
           How to config in MAX in order to obtain the determinate data from the NI-DAQmx Simulated Device?
           For example, the vi will run when the Digital I/O line is High, but using the Simulated Device, the result is  random. In another word, I can't set the line is high or low.
           Would you please give me some suggestion?
           Thank you!
    Hugo

    Here is what I mean of stopping the DAQmx stimulated device. I do from step A - E; and step E is what I mean stopping the DAQmx stimulated device.
    3. Use the NI-DAQmx Task in VI Logger Lite to complete a data logging application.
    a. Open VI Logger Lite. If you do not have VI Logger Lite, download it or request a free CD.
    b. Right-click My System>>VI Logger Tasks and select Create New.
    c. Select Using NI-DAQmx and click Finish.
    d. Select the NI-DAQmx task for the NI-DAQmx simulated device. Leave all settings in the defaults, and click Run task in the toolbar.
    Figure 9. VI Logger Lite data logging task.
    The data logging task begins. Data from the NI-DAQmx simulated device is displayed in the Real Time Data viewer.
    e. Click Stop task.
    ====================
    =Labview 7.0 & 8.0 & 8.5=
    =====================

  • The "More Everything Plan" is ruining my life!  (and adding random data charges to my bill)

    Hello,
    I recently changed my data plan a few months ago to the 6 GB Data plan with 2 phones tied to my service when I upgraded my phone to the Samsung Galaxy 5.  For the most part my wife and I have been doing pretty good at keeping the our monthly data usage down to the 6 GB.  On Nov 4th was I upgraded to the new 10 GB my everything plan and ever since that change, my account has been making RANDOM data charges at all hours of the night!  I pulled both my wife's Data Usage report and my own and compared them. 
    Looking at my wife's data usage below, you can clearly see that there are automated data spikes that her phone went through on the same exact time on different days!  Looking at the dates, these spikes did not start to automatically occur until we upgraded our plan on Nov 4th.  The same goes for my data usage below.  There are multiple days that my phone surged on the same exact time with large spikes of data!  These reports were organized by largest "Unbilled Data Usage" spikes.
    These spikes SHOULD NOT be occurring and have nothing to do with what apps we have installed our phones.  We have both filtered our usage by apps on our phones and they do not add up.  What's the point of having a larger data plan, if that data plan just steals MG randomly off your phone for no reason???  Because of these spikes, I have add to pay over $100 in overage fees and in November, I have already had to buy MORE DATA ($20 for 5 GB more) because I was already at 90% of my usage with 2 weeks still to go in the billing cycle!  I need actions and not suggestions.  I'm not the only one with these problems and this needs to be addressed.
    Please help!!!!!
    (Wife's Data Usage)
    (My Data Usage)

    You're right, data usage can be confusion...especially when your response above doesn't make sense.
    If data usage is counted in 6 hour blocks, then how in the world did Nov. 5th last 138 hours???  Data was calculated 23 times on 11/5/14 and 14 times on on 11/4.  These are just 2 examples of when the data was pulled in in "6 hour blocks of time". Nearly every day in my pulled report this month shows 2 dozen or more times the data was recorded and billed each day. (see below)
    Further more, if data usage actually was counted in 6 hour intervals, that still doesn't explain why my phone randomly surged 1.27 GB of data at 5:36 AM in the morning on 11/12/14.  Even if this counted data since 11:36 PM the night before on 11/11/14 night, there's no way I would have used this much data!  Since I work during the weekdays 9-5, I am already in bed at this time and not using my phone.  And it can't be recorded data usage after 5:36 AM, because then what would be the point of having a time stamp in the report?  Where was this data coming from???  (see below)
    The timing of my spike in data is just way too coincidental of when I upgraded my data to 10 GB earlier this month.  If you compare our data usage against other months (when I had 6 GB) we didn't have random spikes like we are seeing now.  There is something wrong with the new data plan on our phones, and I really wish someone could clearly point out where these additional charges are coming from.  Please have a representative contact me at your earlier convenience.
    6 Hour Blocks of Time?
    Data pulled at 5:36 AM
    Data Spike in the Past Months

  • How to fetch the data from databse table and get the required output

    Hi,
    I have made a project that connects CEP to database table but i m getting some problem in fetching the data from database.
    From the following code :
    If the where condition is removed then the application runs fine but i am still not able to fetch the data from the table because it is not showing any output.
    Can anyone please suggest me that how to write WHERE statement correctly and how i will be able to see the output.
    Following is the config.xml for processor:
    ======================================
    <?xml version="1.0" encoding="UTF-8"?>
    <wlevs:config xmlns:wlevs="http://www.bea.com/ns/wlevs/config/application"
         xmlns:jdbc="http://www.oracle.com/ns/ocep/config/jdbc">
         <processor>
              <name>JDBC_Processor</name>
              <rules>
                   <query id="q1"><![CDATA[
                             SELECT STOCK.SYMBOL as symbol, STOCK.EXCHANGE as exchange
                             FROM ExchangeStream [Now] as datastream, STOCK
                             WHERE datastream.SYMBOL = datastream.SYMBOL ]]></query>
              </rules>
         </processor>
         <jms-adapter>
              <name>JMS_IN_Adapter</name>
              <jndi-provider-url>t3://CHDSEZ135400D:7001</jndi-provider-url>
              <destination-jndi-name>jms.TestKanikaQueue</destination-jndi-name>
              <user>weblogic</user>
              <password>welcome1</password>
         </jms-adapter>
    </wlevs:config>
    Following is the assembly file:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"
         xmlns:wlevs="http://www.bea.com/ns/wlevs/spring" xmlns:jdbc="http://www.oracle.com/ns/ocep/jdbc"
         xmlns:spatial="http://www.oracle.com/ns/ocep/spatial"
         xsi:schemaLocation="
              http://www.springframework.org/schema/beans
              http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/osgi
              http://www.springframework.org/schema/osgi/spring-osgi.xsd
              http://www.bea.com/ns/wlevs/spring
              http://www.bea.com/ns/wlevs/spring/spring-wlevs-v11_1_1_3.xsd
              http://www.oracle.com/ns/ocep/jdbc
              http://www.oracle.com/ns/ocep/jdbc/ocep-jdbc.xsd
              http://www.oracle.com/ns/ocep/spatial
              http://www.oracle.com/ns/ocep/spatial/ocep-spatial.xsd">
         <wlevs:event-type-repository>
              <wlevs:event-type type-name="StockEvent">
                   <wlevs:properties>
                        <wlevs:property name="SYMBOL" type="byte[]" length="16" />
                        <wlevs:property name="EXCHANGE" type="byte[]" length="16" />
                   </wlevs:properties>
              </wlevs:event-type>
              <wlevs:event-type type-name="ExchangeEvent">
                   <wlevs:class>com.bea.wlevs.event.example.JDBC_CEP.ExchangeEvent</wlevs:class>
              </wlevs:event-type>
              <wlevs:event-type type-name="StockExchangeEvent">
                   <wlevs:properties>
                        <wlevs:property name="symbol" type="byte[]" length="16" />
                        <wlevs:property name="price" type="byte[]" length="16" />
                        <wlevs:property name="exchange" type="byte[]" length="16" />
                   </wlevs:properties>
              </wlevs:event-type>
         </wlevs:event-type-repository>
         <bean id="readConverter" class="com.bea.wlevs.adapter.example.JDBC_CEP.Adapter_JDBC" />
         <bean id="outputJDBCBean" class="com.bea.wlevs.bean.example.JDBC_CEP.OutputBean_JDBC">
         </bean>
         <wlevs:adapter id="JMS_IN_Adapter" provider="jms-inbound">
              <wlevs:listener ref="ExchangeStream" />
              <wlevs:instance-property name="converterBean"
                   ref="readConverter" />
         </wlevs:adapter>
         <wlevs:processor id="JDBC_Processor" advertise="true">
              <wlevs:listener ref="OutputChannel" />
              <wlevs:table-source ref="STOCK" />
         </wlevs:processor>
         <wlevs:channel id="ExchangeStream" event-type="ExchangeEvent" advertise="true">
              <wlevs:listener ref="JDBC_Processor" />
         </wlevs:channel>
         <wlevs:channel id="OutputChannel" event-type="StockExchangeEvent"
              advertise="true">
              <wlevs:listener ref="outputJDBCBean" />
         </wlevs:channel>
         <wlevs:table id="STOCK" event-type="StockEvent"
              data-source="StockDs" table-name="STOCK" />
         <wlevs:table id="STOCK_EXCHANGE" event-type="StockExchangeEvent"
              data-source="StockDs" table-name="STOCK_EXCHANGE" />
    </beans>
    ExchangeEvent.java:
    package com.bea.wlevs.event.example.JDBC_CEP;
    public class ExchangeEvent {
         public String SYMBOL;
         public String symbol;
         public String exchange;
         public ExchangeEvent() {
         public String getSYMBOL() {
              return SYMBOL;
         public void setSYMBOL(String sYMBOL) {
              SYMBOL = sYMBOL;
         public String getSymbol() {
              return symbol;
         public void setSymbol(String symbol) {
              this.symbol = symbol;
         public String getExchange() {
              return exchange;
         public void setExchange(String price) {
              this.exchange = price;
    Adapter Class:
    package com.bea.wlevs.adapter.example.JDBC_CEP;
    import com.bea.wlevs.adapter.example.JDBC_CEP.MyLogger;
    import com.bea.wlevs.adapters.jms.api.InboundMessageConverter;
    import java.text.DateFormat;
    import java.util.Date;
    import com.bea.wlevs.adapters.jms.api.MessageConverterException;
    import com.bea.wlevs.event.example.JDBC_CEP.ExchangeEvent;
    import javax.jms.JMSException;
    import javax.jms.Message;
    import javax.jms.TextMessage;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.Random;
         public class Adapter_JDBC implements InboundMessageConverter{
         @SuppressWarnings("unchecked")
         public List convert(Message message) throws MessageConverterException, JMSException {
              Random rand = new Random();
              int unique_id = rand.nextInt();
              DateFormat dateFormat;
              dateFormat = DateFormat.getTimeInstance();
              dateFormat.format(new Date());
              MyLogger.info(unique_id + " CEP Start Time is: " + dateFormat.format(new Date()));
              System.out.println("Message from the Queue is :"+ message);
              TextMessage textMessage = (TextMessage) message;
              String stringMessage = textMessage.getText().toString();
              System.out.println("Message after getting converted into String is :"+ stringMessage);
                   String[] results = stringMessage.split(",\\s*"); // split on commas
                   ExchangeEvent event1 = new ExchangeEvent();
                   event1.setSYMBOL(results[0]);
         List events = new ArrayList(2);
         events.add(event1);
         return events;
    Output Bean Class :
    package com.bea.wlevs.bean.example.JDBC_CEP;
    import com.bea.wlevs.ede.api.StreamSink;
    import com.bea.wlevs.event.example.JDBC_CEP.ExchangeEvent;
    import com.bea.core.datasource.DataSourceService;
    public class OutputBean_JDBC implements StreamSink{
         public void onInsertEvent(Object event) {
         if (event instanceof ExchangeEvent) {
              ExchangeEvent cacheEvent = (ExchangeEvent) event;
         System.out.println("Symbol is: " + cacheEvent.getSymbol());
         System.out.println("Exchange is: " + cacheEvent.getExchange());
         System.out.println(DataSourceService.class.getClass());
    Kindly let me know if you need further info.

    Do you have StockDs configured in your server config.xml?
    I think the query should look more like this:
    SELECT stocks.SYMBOL, stocks.EXCHANGE
    FROM STOCK as stocks, ExchangeStream [Now] as datastream WHERE stocks.SYMBOL = datastream.SYMBOL
    Thanks
    andy

  • How can I use Automator to extract specific Data from a text file?

    I have several hundred text files that contain a bunch of information. I only need six values from each file and ideally I need them as columns in an excel file.
    How can I use Automator to extract specific Data from the text files and either create a new text file or excel file with the info? I have looked all over but can't find a solution. If anyone could please help I would be eternally grateful!!! If there is another, better solution than automator, please let me know!
    Example of File Contents:
    Link Time =
    DD/MMM/YYYY
    Random
    Text
    161 179
    bytes of CODE    memory (+                68 range fill )
    16 789
    bytes of DATA    memory (+    59 absolute )
    1 875
    bytes of XDATA   memory (+ 1 855 absolute )
    90 783
    bytes of FARCODE memory
    What I would like to have as a final file:
    EXCEL COLUMN1
    Column 2
    Column3
    Column4
    Column5
    Column6
    MM/DD/YYYY
    filename1
    161179
    16789
    1875
    90783
    MM/DD/YYYY
    filename2
    xxxxxx
    xxxxx
    xxxx
    xxxxx
    MM/DD/YYYY
    filename3
    xxxxxx
    xxxxx
    xxxx
    xxxxx
    Is this possible? I can't imagine having to go through each and every file one by one. Please help!!!

    Hello
    You may try the following AppleScript script. It will ask you to choose a root folder where to start searching for *.map files and then create a CSV file named "out.csv" on desktop which you may import to Excel.
    set f to (choose folder with prompt "Choose the root folder to start searching")'s POSIX path
    if f ends with "/" then set f to f's text 1 thru -2
    do shell script "/usr/bin/perl -CSDA -w <<'EOF' - " & f's quoted form & " > ~/Desktop/out.csv
    use strict;
    use open IN => ':crlf';
    chdir $ARGV[0] or die qq($!);
    local $/ = qq(\\0);
    my @ff = map {chomp; $_} qx(find . -type f -iname '*.map' -print0);
    local $/ = qq(\\n);
    #     CSV spec
    #     - record separator is CRLF
    #     - field separator is comma
    #     - every field is quoted
    #     - text encoding is UTF-8
    local $\\ = qq(\\015\\012);    # CRLF
    local $, = qq(,);            # COMMA
    # print column header row
    my @dd = ('column 1', 'column 2', 'column 3', 'column 4', 'column 5', 'column 6');
    print map { s/\"/\"\"/og; qq(\").$_.qq(\"); } @dd;
    # print data row per each file
    while (@ff) {
        my $f = shift @ff;    # file path
        if ( ! open(IN, '<', $f) ) {
            warn qq(Failed to open $f: $!);
            next;
        $f =~ s%^.*/%%og;    # file name
        @dd = ('', $f, '', '', '', '');
        while (<IN>) {
            chomp;
            $dd[0] = \"$2/$1/$3\" if m%Link Time\\s+=\\s+([0-9]{2})/([0-9]{2})/([0-9]{4})%o;
            ($dd[2] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of CODE\\s/o;
            ($dd[3] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of DATA\\s/o;
            ($dd[4] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of XDATA\\s/o;
            ($dd[5] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of FARCODE\\s/o;
            last unless grep { /^$/ } @dd;
        close IN;
        print map { s/\"/\"\"/og; qq(\").$_.qq(\"); } @dd;
    EOF
    Hope this may help,
    H

Maybe you are looking for