Mike Smith

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

Recent posts by Mike Smith

Thanks Bear this helps greatly!
I have been working with JQuery for some time now and I still feel like there is a gap in my understanding.

Does the JQuery Object follow the Decorator Design Pattern or the Singleton Design Pattern, or is it a combination of the two?

Does anyone have a best practice for managing Javascript files that they wish to share? I often find it difficult to stay organized when working with Javascript files; files become disorganized quickly. I am looking for tools that organize files much the same way as the Dojo toolbox does? Any recommendations?



I would like to have a message box at the top of the form that keeps track of the number of missing fields. The jquery.validate plugin works fine only for the first tab, the 2nd tab is not doing what I wish. Basically all I want to do is the following:
- have a tabbed form that is validated
- if the form fields are missing I wish to have the number of missing fields displayed in the message box.
- 2nd highlight or have the text "missing" displayed next to the field
- if text is entered into the field or if the check box is checked or radio button selected then update that field and remove the error message

Code snippet:

Just to re-iterate, the number of missing fields which are displayed in the message box (above form) appear to be correct when the form is validated (pressing submit - but missing fields exist). But only those fields on the first tab appear to work. For example, if a field is missing on the first tab it will have an error message displayed where I want it and if I enter in text or select a value, the error message disappears. In addition, the number of errors in the message box decrease in value. In contrast, the 2nd tab will display the error message but when you select something the error message does not disappear, nor does the number of errors in the message box decrease. I figure I need a way to iterate over each tab and validate fields to each specific tab instead of trying to validate the entire form at one time, but I am unsure how this is done using tabber.js and jquery.validate.js plugin.
Any suggestions greatly appreciated...
Hello, good day.

I am currently trying to use a class that extends Frame (taken from a text). This class acts as a drawing surface. My goal is create an applet using the Slate class, however, I have not been successful with it. First is this possible? or is there some kind of conflict between invoking paint(). My ultimate goal is to draw the graphics using slate instead of overriding paint in applet and then to create an animated applet. I would assume that creating a new Frame instead a applet would be possible. Any thoughts, greatly appreciated.

15 years ago
Hello all,
I am wondering how it is possible to do the following:
set month=`date | cut -c5-7`
set userInfo=`last "$1" | grep "$month"`
echo $userInfo <---- how do I to put each line on a separate newline? SO that when I echo this variable (echo $userInfo)- It displays identically to just invoking the last command. For example, last username. At the present time, when this command is invoked it appends each new line to the preceding line. I need to iterate over the contents stored in this variable to process the times(add them).

Some background;
I am trying to write a sh script to count how many hours a given user has used the system since this month. However, I run into a sling when I try to use a for loop. I believe I need to correct the problem of echo $userInfo displaying each line as a separate line to use in the for loop; but not 100% certain. I know I need to process the login times from the last command in a for loop and add them(just increment the sum of a variable). And I know that I'll have to implement an if elif clause to test different critera. Any suggestions, greatly appreciated.
Thanks in advance.
17 years ago
Thanks guys for all the help. I managed to fix it. It works! Thanks again.
17 years ago
Hi guys, thanks for the input. I have taken your suggestions into account, along with recoding portions of my code; but now I get the following errors

Size Before:4
Is the priority queue empty? false
Exception in thread "main" java.lang.NullPointerException
at PqList.min(PqList.java:56)
at PqList.removeMin(PqList.java:76)
at PqListTest.main(PqListTest.java:16)

My modified code is

test class

I know there is definitely something wrong with my min() function. If all goes well it should return the entry with the minimum key. Furthermore, my removeMin() function should be able to call the min() function assign the minimum entry to another entry; then delete it from my list. However, It is crashing. I really don't understand how to fix this. The linked list should be dynamic ds so the first value added to the list could have a key of 1000 and the list should be able to accomadate it, correct me if I am wrong. Once again any suggestions greatly appreciated.
17 years ago
Ok, I don't know if I am better off now, but my program doesn't give me array out of bounds error anymore; except now it doesn't return the minimum key. I have double checked and yes I need to use the LinkedList. 0(1) insertions are the only must. Here is my code maybe some one can see something that I am not seeing.

Once again, any suggestions are greatly appreciated. I have been working on this for what seems like forever; it must be something simple.
17 years ago
Thanks Ernest,
yes I have learned about heaps, however, the instructor wants it done with a List from the Java api. It is suppose to be an easy problem, however, I find myself puzzled. I will try the ArrayList, even though he told me to use the LinkedList(maybe he made a mistake). He did make it sound like it should be fairly similar to the stack(which I used the ArrayList to implement). Thanks again for helping out. It is greatly appreciated.
17 years ago
Hello all, I am having a really hard time thinking my way through implementing a priority queue using Java's LinkedList class. I understand the priority queue in general terms. Basically you insert key-value pairs into the PQ in any order; but remove entries(key-value pairs) based on highest priority- in my case lowest key. That is a simple concept but implementing it, seems hard to do, especially when I need to print out both the key and values pertaining to each entry. Ok, I have tackled this many different ways, and thus far the closest I have come to solving it was running off the array(array out bounds), however I then realized I need to use "generics" so I started over. Furthermore, I know I will have to have a entry class(innerclass in my PQList), however, is it essentially that I create a node class as well so that I can properly traverse though the list? I was thinking of storing each entry in a node( or could I treat an entry as a node?). Or could I use the listIterator to accomplish this? Any suggestions greatly appreciated. I have been through the text many times over and over again, but I find this ds text is too hard to follow(data structures & algorithms 4th edition Authors: Mihcael Goodrich & Roberto Tamassia.) I always thought textbooks are to reinforce your understanding; not confuse you more. jk
17 years ago
Actually, its late here. I see what you know mean. I just have to think of a way to count consective 1s and 0s. Cheers.
Thanks again
17 years ago
Hi, I don't understand what you are saying. I am incrementing by 1 if a 1 is found in the string and incrementing by 1 if a zero character is fount. I am also keeping track of the total 1s in the string. I think my logic is correct here. If not please point out where I am missing out. Thanks
17 years ago
Hello all, I had one query. When you append an int to a string, doesn't the variable get assigned a string. For instance I am having a hard time with the following code.

I am using bit shifting, my output looks great for this program; I have to implement, however, when I try to count how many 0s and 1s it get way off a way off answer. Is there something I am missing?
The out put is the following.

I am basically looking on get the following numbers 26 5 4 which correspond to the following: total # of 1 bits, longest 1 bit sequence, longest 0 bit sequence. Thus, the answer should be 26 5 4. I have tried many different ways to implement this and I keep on gettting the same end result. Am I missing the big picture? Please correct me if I am wrong. You enter a key on the keyboard, which corresponds to a ascii code, which then corresponds to a bit pattern, which the computer really works with. I know java uses unicode(could this have something to do with why I am getting this kind of result). Any suggestions much appreciated. Thanks
17 years ago
Hi I also changed the following piece of code; and still the same error. I am starting to really love the NullPointerException.

I may need a another nudge. Thanks again.
18 years ago
Thanks, for the immediate feedback. That makes sense, but where do you conclude that I am passing my incomplete [] to the selectionSort method before it is completely full. I have changed the array size to 23 elements; that is 22 indexes and still get the same problem. Thanks again for any feedback.
18 years ago