Jess Ryan

Greenhorn
+ Follow
since Feb 16, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jess Ryan

A gyroscope is a simple device that essentially wants to stay in the same orientation in which it was started. It doesn't need electricity to run. You can make a gyro by taking a bike wheel and putting a handle through its axis (like a broom stick). Start the wheel spinning, then try to tilt the handle and you'll feel it fight you. Depending on how big the wheel is and how fast you got it spinning, it can take alot of strength to move it. They make little toy gyros for kids (including us grown up kids) that are started with a string:
Gyroscope at Amazon

Planes use gyroscopes floating in a near frictionless liquid to help keep the pilots oriented when they can't see out the window. The gyro is set so it remembers what "level" is, and then when the plane deviates from level flight, the gyro will remain in its original, level orientation (because its floating in liquid), and then the pilot can see that the plane is in a different orientation than level because it no longer matches the gyro.

The electronic gyros in the iPhones work using the same concept. They remember a position and then when the orientation of the phone changes, sensors report the difference in orientation to you in a form your programs can use!
13 years ago
iOS
Yes, I agree that the alert would be more appropriate since it is requiring only a simple yes-no answer.
13 years ago
iOS
I mean the components I pass as "options". I'm not quite familiar with the synth stuff. Guess I'll just stick to making my own.

Thanks!
15 years ago
Howdy,

Is it possible to right justify the components that you pass as options to a JOptionPane, and if so, how? I love the convenience of the JOptionPane.showOptionDialog(...), but I need to have the buttons right aligned instead of centered.

Thanks!
-Jess
15 years ago
Thanks everyone!

Actions sound like a good solution. I just may do that when it's refactor time.

Thanks again!
15 years ago
Ah. Alrighty, I'll do the same. Thanks!!
15 years ago
Ok, I'm stumped. I've searched the 'net but found nothing... probably because no one else in the world has ever encountered this issue.

The situation is that I've got a few menu items that I want to share between an edit menu (in a jmenubar) and a popup menu. I build the popup menu first, then add the menu bar. Here's the 'issue' part: when I add the shared menu items to the edit menu, they are removed from the popup menu.. AND, only one is added to the edit menu (where, for example, there are 4 menu items that I'm adding). What in the world is happening? Below is a runnable example that just prints out the number of items in the menus to show my point.

Any insight will be hugely appreciated!

15 years ago
Great! Good luck and have fun!
15 years ago
Hi there,

Here's just an overview...

Well, it looks like your project has two core issues:
1. sending email (via JavaMail or the simple mail transfer protocol (SMTP) for examples)
2. creating your email body (by merging the static info with the dynamic info)

How you go about both depend on what restrictions will be placed on your program. For instance, if you are making some kind of servlet that runs on GoDaddy, they won't allow you to use the SMTP I don't think. However, they do give you access to the java mail library so you can use that.

Personally, I prefer the SMTP method because it is fast and allows nice flexibility. But since it is not as widely allowed 'in the real world', I would suggest you go the JavaMail route. I haven't used it in a bit, so can't offer specifics, but I know that you can find some simple easy tutorials on using JavaMail. It's quite easy, you shouldn't have any difficulties barring strange firewalls or something.

For the second part of your project, creating the email body, perhaps you could try storing the static part of your email in a file. Here's an example:

Dear [toName],

Thank you for bla bla bla...

Sincerely,
[fromName]

So, when it is time to send an email, your program can read in this form letter from the file into something such as a String or StringBuffer. Then, you can scan this String and look for your 'hotspots' such as [toName] and [fromName] and substitute them with your runtime variables:

A simple way of doing this would be to copy from the original (generic) String to a new String, token by token (where a token could be defined as any word separated by a space), until you come across a token that is a 'hotspot', and when you do, instead of writing the literal value of that token (the hotspot), write the runtime value that is supposed to replace it.

Make sense?

I know that using StringTokenizer is frowned upon these days.. another way of implementing that functionality is to use java.util.regex. You can split a string with a defined token (for instance a space) and then are given an array of the individual components of the string. That would be handy for you purpose I would think. I mentioned StringTokenizer though because I found it easier to learn.

Whew! Hope that gives you ideas!
15 years ago
Heya folks, thought I'd share (yes, I'm proud as heck)..

JavaRanch is great!

I only got a 73%, which was kind of disappointing.. (I thought I was better prepared)

Perhaps because I didn't use THE exam book by K & B, so my knowledge came from a more scattered array of sources: the Sun tutorials, K & B's Head First Java (only for version 1.4 though, so I had to learn the new 5.0 stuff elsewhere), JavaRanch, and odds and ends on the web.

So, that's just a lesson fer y'all... just get the book, your brain'll appreciate it. But oh well about the score, I still passed. Yay!
[ March 25, 2008: Message edited by: Jess Finley ]
16 years ago

Originally posted by Jelle Klap:


Don't get me wrong I'm all for studying thoroughly, but studying thoroughly != reading the SCJP 5 Study Guide 10 hours a day in my opinion.
Learning this material takes time, so take that time and spend it reading, practicing and reiterating at a reasonable pace that allows you to actually retain the knowledge.



Agreed!!! Yeah, personally, I couldn't do 10 hours a day.. after a couple hours of intense studying, my brains start leaking out my ears. But where there's a will, there's a way.
Sri Karr,
Your explanation is great! Thanks from a bystander!
Saru,

I disagree with Jelle. If you study thoroughly, you will learn this stuff. Sounds like you work hard. Reading is good and is where a lot of your knowledge comes from. But I stress the need to practice that knowledge to make sure you really understand it. When you learn a new concept, write some code yourself (try from memory) to demonstrate it, don't just read through some example code. Finally, check out the Certification FAQ for some mock testing/quizzing resources that will further hone your knowledge. I always think I know something until I test myself or go to write some code and then find myself wondering about those nitty gritty details.

Good luck!
Huh, well, I don't understand the problem... specifically the "Magic" I don't see how you can leave 1/3 of the string behind and still have the whole string. But, you can find out the input string's length (String.length()) and divide that in to three parts, for starters...
16 years ago