Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Just because most people will say they are Christian, that doesn't mean they really are Christian. There are some people that call themselves "Christians" and then go out to the bar, strip clubs, parties, etc. Their real title is "hypocrite." And a lot of those "Christians" don't even go to church except for Christmas and Easter. So in reality, it's probably only 50% of the U.S. is truly Christian.

Given that even Christians cannot agree on the definition of "real Christian", any number that you throw out for "real" Christians is essentially meaningless. Therefore if 80% claim to be Christian then you have to just accept that as the case. If your benchmarks are to be the measure instead, then I would figure the truer figure to be close to 3%, not 50%.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

lol i dont need cobalt developers.

They're toxic anyway - I'd stay clear of them.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You will need to store the user id in the session when they log in and retrieve it as needed

$userId = $_SESSION['userId'];
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Quick aside: Place code tags around code to maintain formatting. It really helps readability.

The part you'll need to change is

$insertSQL = sprintf("INSERT INTO messages (message) VALUES (%s)",
                       GetSQLValueString($_POST['textarea'], "text"));

I'm not certain how that table is structured, but you will need to add the user id something like this

$insertSQL = sprintf("INSERT INTO messages (userId, message) VALUES (%d,%s)", $userId, GetSQLValueString($_POST['textarea'], "text"));

$userId could be held in the session along with your other properties $_SESSION. You'll also need to make sure that the query which display the messages returns the user name along with the message and use that instead of the logged in user name from the session.

Does that clear it up a bit?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I need a long string of information to be placed in the blank row, do you have any suggestions if you don't think that I need a another table inserted there

Even inserting another table in the row will not produce the effect you want, which I assume is a cell that spans all of the columns. The JTable just isn't put together that way.

It may be possible to create your own implementations of TableModel and TableColumnModel (which may or may not require further extension of JTable and JTableHeader, but I am thinking it wouldn't), which effectively manage two separate models for the table to display. That is the only way I can see you getting the desired effect if you must stick with a JTable.

If you don't need the info on the blank row to be visible at all times, but rather when a data row is selected, you could place that info in a separate text area.

If you need to maintain the spreadsheet-type feel and interaction is limited to navigation, JEditorPane or JTextPane with HTML might work out for you, since that output would be easy with HTML tables and HyperlinkListener can be used to provide some interactivity with the data.

Those are the only suggestions that come to mind without knowing the full scope of your data display and interaction needs.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Still having problems with this...any ideas anyone?

Post the relevant code. Without that we can only speculate and offer generic suggestions.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ezzaral, I would suggest you read this to, if you have not before, as a sun.audio.* class is not "an old part of the api", I'm sorry to say.

Have fun reading. ;-)

Yes, sun.audio may not be an old part, honestly I don't know and didn't take a long time to look into it since I am am currently at work. I did run across an old (1997) article about using some of those classes to get audio to play in desktop java apps before it was officially supported by the public reference APIs.

Perhaps "old part of the api" was the wrong choice of words, but I did want to convey that he should look into the public javax.sound API instead. Maybe simply stating "Don't directly use sun.* packages" would have been a more appropriate suggestion.

Sorry for any confusion this may have generated.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I've tried setting the $loginuser name and session variables to the user id in the database. Obviously not the right thing to do.

Actually, I would store both the user name and the id in the session. Whatever statement that saves the post just needs to include the id. The query that shows posts just needs to display the name along side the comment, so pull all that info in a single query. If you are confused by that, post your code and we can figure out how to change it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If the login name is the id for the user in the database, then that's fine to keep it in the session while they are logged in. You will still need to write that value to the database with the post though. The page that displays posts should retrieve the name of the poster along with the post from the database.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Are you not storing the user id with the post? If you are then you just need to display the name associated with that id. The name (id) associated with a post should not have any dependency on whether a user is logged in.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I think that is an old part of the api for playing sound in applets. You are probably better off using javax.sound:
http://java.sun.com/docs/books/tutorial/sound/

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Never used any of the media APIs myself, but here is the guide for the Java Sound API
http://java.sun.com/j2se/1.5.0/docs/guide/sound/programmer_guide/contents.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

See if this helps:
http://www.phpbuilder.com/columns/yunus20031124.php3
and perhaps this:
http://conort.googlepages.com/generate-word-from-php

If you don't need any specific Word functionality, a simple text or html document would be the easiest.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Basic XML parsing is not really that difficult if you just get in and play with it. It's well worth your time to learn it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

As Anon said above, drop in a print_r or var_dump of $names to see what you have there.
Also,

foreach ($names as $to) {
  mail($to, "Branches and Roots Weekly Newsletter", "Testing");
}

would make your loop a bit easier.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

By .doc format you are meaning Microsoft Word? Or just a generic text document?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

"Visual Basic using C#" is a very odd title, as those are 2 different languages, but yes, you will learn about GUI applications I'm sure.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ditch JBuilder 3.
There's no reason whatsoever to still use that dinosaur.

Definitely. It dates to JDK 1.1/1.2 I believe.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you want to have both input fields on a single panel with one Ok button, you have two options:
- Create a standard JFrame/JPanel UI form with your fields and button and put the code that processes login and opens the browser in the ActionListener (or a small Action class).
- Create a custom dialog by extending JDialog and returning whether login was successful as the dialog result and opening your browser based on the result.

The JFrame is probably the easier and more conventional option, but there are a lot of ways to skin a cat in Java.

If you are using Java 6, this method will allow you to open a url in the default browser:
http://java.sun.com/javase/6/docs/api/java/awt/Desktop.html#browse(java.net.URI)

If not Java 6, then http://www.centerkey.com/java/browser/ may be of use.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You cannot simply set an array equal to a BufferedReader to get it's contents. You must read the contents in a loop (with readLine() for example) and place the data in your array as appropriate.
The second error is of similar nature - you cannot send a String array to a method that takes a simple String as a parameter.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Info on why some of those are deprecated and what to use in their place can be found here:
http://java.sun.com/javase/6/docs/technotes/guides/concurrency/threadPrimitiveDeprecation.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Thanks, but.. why?

Well, because you said you wanted a language to create GUIs with :) You could also use PHP, Python, or Perl if you want to use a scripting language instead of a compiled language. You asked an extremely open-ended question, so any suggestion here is going to be accordingly generic.

If you don't want to use C++, then C# and Java are the closest next in line to what you already know. Microsoft provides a free editor for C# and on the Java side Eclipse and Netbeans are two popular free editor choices.

In the end, you'll have to figure out what you are comfortable using for the task.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Java is always a free option for you.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Luckily, typing out of one's butt does not produce the same hot air or carbon dioxide, so internet arguments can continue unabated :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

No, the other PETA. You've never heard of them before?

People Eating Tasty Animals :)

mmmm.... beeef.....

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The error would be that you have not imported the classes SlideShow and Slide. I assume you have some library with these classes like POI? You must import the classes to use them and make sure the jar file is in your classpath.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

What is the intended purpose of the blank row? It doesn't sound as if you need to insert another table for anything.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

My experience with NetBeans is that the generated code when building GUIs in particular is extremely difficult to read and subsequently maintain.

That depends on the layout that is selected for the container. I don't find the generated code more difficult to read than any other complex layout code. GridBagLayout, GroupLayout, and SpringLayout do involve quite a bit of code and the GUI builder does save a lot time over manually coding it. That said, I agree it is still a good idea for beginners to learn to code it for themselves so they understand the nuances of those layouts.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I'm sure that it is possible, yes, but the real question would be why? There is probably a more appropriate arrangement of your UI elements that would be less troublesome.

When embedding components into a JTable, there are many cases where you will have to make sure events are forwarded along to the embedded component so they behave as you expect them to. JButtons and click events as an example of this. The JTable will process these events for itself first and may not pass them along to your component as you would expect.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, I suppose you would get it like any other job - searching job listings and perhaps posting your resume in appropriate places (which would not be here by the way).

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You would prefer that substances be tested on human beings instead?

... some of them... :P

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ack, sorry, just saw that I forgot to include the link:
http://www.adobe.com/devnet/dreamweaver/php.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, yes, scripts ARE "codes". You are not going to be able to just throw random files into your project and expect them to work. You will have to learn how to integrate PHP into your site.

See the following page for info on working with PHP in Dreamweaver.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Dreamweaver should open the php scripts just fine. Just open the file.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, there are several Java formatters available. Formatter is a generic formatter like printf or sprintf. It can be used with String.format() or also PrintStream's printf() function. NumberFormat, DecimalFormat and DateFormat are also available for formatting string representations.

Edit: Or, yeah, see the template library jwenting posted above if you are wanting JSP tags. :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, you mention three different languages there. Maybe if you posted some code someone could help?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

As masijade said, you can do that with an ActionListener, however I have to wonder why you are writing a Java program just for a login and then opening a web application. Why not simply login in to the web application?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You need to specify the full name of the driver in the Class.forName() call:

Class.forName("com.mysql.jdbc.Driver").newInstance();
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The easiest way is to create an ImageIcon from the image file and then add that to a JLabel in your frame. See the following Sun tutorial for examples of doing this:
http://java.sun.com/docs/books/tutorial/uiswing/misc/icon.html

If you mean pasting from the clipboard at runtime, you will need to do a bit more work. Here is a tutorial on using the clipboard for copying and pasting in Java:
http://www.javaworld.com/javaworld/javatips/jw-javatip61.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Sorry, until jwenting completes his project generator, you will need to come up with your own project idea. Perhaps if you read a lot of the threads here you will get an idea.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This is due to a missing or incorrect classpath. Classpath tells where to find the files required to compile your program. You specify it by either setting an environment variable CLASSPATH or by using the -cp switch on the javac command:

javac -cp ./;c:/myProjectDir;c:/otherFilesDir MyProgram.java

If it is a single file with no other dependencies, you can compile it from within the directory containing the java file without setting the classpath, but you will need to have the jdk/bin directory on your system path or use the full path to javac to invoke it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I get the link with the prop_id variable. However I want to point something out, if I try to use for example

$varid_id = '$_GET[prop_id]';

And used $varid_id instead of $prop_id I get an error, In other words, I did not have to declare $prop_id to use it in the link.
Again thanks a lot :)

He just included that as an example of retrieving prop_id from a GET page request. If prop_id had been passed in via a link, you would get it with that code. If you are generating the prop_id from another source, you wouldn't need to pull it from the $_GET[] array.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Hi I need help I´ve just installed apache 2.2.4 and php 5.2.3 and everything works fine until I want to load myql extension

I have configured the extensions dir apropiately but somehow the Apache donesnt recognize them

I really need your help

It is generally best not to tack new questions onto the end of solved posts, rather start a new thread for your question.

Your best bet for those configuration issues is to install an AMP package such as XAMPP or WAMPserver if you are working in Windows. Find a LAMP package if you are using Linux.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Um, you do it exactly like you have indicated in your link. I'm not certain what your question is exactly. Are you unsure how to build the link string? Unsure how to retrieve the value in the target page? Please elaborate a bit.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You are selecting one column but trying to read two.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Also, if you are aiming for web development, I would recommend learning PHP instead of C++. C++ has a much higher learning curve and is generally used for standalone application development, not web development.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

From comment posted in POSIX regular expressions section of PHP Manual:

I was having a ton of issues with other people's phone number validation expressions, so I made my own. It works with most US phone numbers, including those with extentions. Format matches any of the following formats:

5551234567
555 1234567
555 123 4567
555 123-4567
555-1234567
555-123-4567
555123-4567
(555)1234567
(555)123 4567
(555)123-4567
(555) 1234567
(555) 123-4567
(555) 123 4567

And any of the following extentions can be added with or without a space between them and the number:
x123
x.123
x. 123
x 123
ext.123
ext. 123
ext 123
ext123

Extentions support between 1 and 5 digits.

Here is the expression:

$regex = '^[(]?[2-9]{1}[0-9]{2}[) -]{0,2}' . '[0-9]{3}[- ]?' . '[0-9]{4}[ ]?' . '((x|ext)[.]?[ ]?[0-9]{1,5})?$';

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If it was a coral snake in a populated area, or if it was on his car, he had good reason. There is no antidote to the poison.

Coral snakes are not found in Oklahoma and it was not on his car. In all likelihood it was a perfectly harmless black rat snake.

This is an example of reckless stupidity and he deserves to be removed from the force and probably charged with negligent homicide.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Did you add the servlet and servlet mapping entries to your web.xml? Example:

<servlet>
  <servlet-name>myServlet</servlet-name>
  <servlet-class>servlet.myServlet</servlet-class>
  <init-param>
    <param-name>load-on-startup</param-name>
    <param-value>0</param-value>
  </init-param>
</servlet>

<servlet-mapping>
  <servlet-name>myServlet</servlet-name>
  <url-pattern>/myServlet</url-pattern>
</servlet-mapping>
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I did some more playing around with it this morning and this seems to work

class KeyProcessor extends javax.swing.Timer {
    
    final static int KEY_1 = KeyEvent.VK_A;
    final static int KEY_2 = KeyEvent.VK_B;
    
    Map<Integer,Boolean> keystate = new Hashtable<Integer,Boolean>();

    public KeyProcessor(int delay, ActionListener listener) {
        super(delay, null);
        keystate.put (KEY_1,false);
        keystate.put(KEY_2,false);
        
        addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                if (keystate.get(KEY_1)&&keystate.get(KEY_2))
                    lblState.setText("State A+B");
                else if (keystate.get(KEY_1))
                    lblState.setText("State A");
                else if (keystate.get(KEY_2))
                    lblState.setText("State B");
                else
                    lblState.setText("none");
            }
        });
    }
    
    public void setKeystate(int keycode, boolean pressed){
        keystate.put(keycode, pressed);
    }
    
}

// This part wherever you are setting up your key listener.
// 200ms seemed to work fine as a time interval
// but tune as you like
keyProcessor = new KeyProcessor(200,null);
txtInput.addKeyListener(new KeyAdapter() {
    public void keyPressed(KeyEvent e){
        keyProcessor.setKeystate(e.getKeyCode(),true);
    }
    public void keyReleased(KeyEvent e){
        keyProcessor.setKeystate(e.getKeyCode(),false);
    }
});
keyProcessor.start();