Posts
60
Comments
36
Trackbacks
18
February 2009 Entries
Basic For Loop Java

Here is a demo for anyone that wants to use for loops.  It demonstrates the for (with index) and the for each (without index).  Each has its own particular usage and this shows one way that it can be used.  In the future I may publish a more practical use of each, but for now this is a good start.  I have also attached the video and the files we created in Netbeans.

For loop with index:

for (int i = 0; i < str.length(); i++)
{ //Start for loop operations
 
    // now we can pick through this
    // string to print only e's (remember that
    // h is 0, e is 1)
    if (str.charAt(i) == 'e')
    {
        System.out.printf("e seen at char %s", i);
    }
} //End for loop operations

For each loop without index:

for (char ch : str.toCharArray())
{
    if (ch == 'e')
    {
        // This should only print out once
        System.out.println("e reached");
    } //end if
} //end for

Executable (Captivate) Video Video.zip

Netbeans Project Project.zip

Please feel free to leave comments or email me if you have any questions.

posted @ Wednesday, February 25, 2009 7:05 PM | Feedback (0)
Blogging is Easy

I try to weblog several times a week.  Sometimes this doesn't quite work out the way I want it to.  It ebbs and flows, sometimes its harder, sometimes it isn't.  One of the things that is hardest to keep up with is when I do something technical or more difficult, I really don't feel like blogging it afterwards.  I do still plan on writing a little about an email class I wrote for CSharp (it wasn't that bad, just a headache, because of a lack of documentation, more web hits from Google, yea!), maybe this weekend :-). 

Other than that, I just wanted to thank everyone for reading.  I sure hope you like the new design as much as I do (just changed the theme, took 5 minutes on Subtext).

posted @ Saturday, February 21, 2009 12:12 AM | Feedback (0)
Subtext (2.1.0) Email on GoDaddy Hosting (Shared)

Use the regular SMTP Relay Server for GoDaddy: relay-hosting.secureserver.net

Here is my configuration lines (Notice that: my  admin email address is not even a real email address), ~line 172~

<add name="SystemMailProvider" 
    type="Subtext.Framework.Email.SystemMailProvider, Subtext.Framework" 
    smtpServer="relay-hosting.secureserver.net" 
    username="" 
    password="" 
    adminEmail="admin@YOUR DOMAIN NAME.com" 
/>
<!-- NEAR LINE 310 - NOTE: This is that I get my comments on. -->
<add key="HostEmailAddress" value="HOST-EMAIL"/>

After this, it does work.  However, I warn you not to type in your own address.  For some reason trying to send yourself an email doesn't work too well.

posted @ Friday, February 13, 2009 9:15 PM | Feedback (0)
Add User to Default Role, Asp.Net Memberships

Just a quick way to make a default role for everyone that signs up for your web site if you are using ASP.NET Memberships, with ASP.NET MVC.

First, add this to the top of your AccountController...

using DotNetRoles = System.Web.Security.Roles;

Then, you want to add this around line 105 of the same file.  Please note that in this example, I already have a role "Users" that I want everyone to default to.

DotNetRoles.AddUserToRole(userName, "Users");

Here is an image of the modified method.

2-7-2009 12-31-28 AM

After that, you are good to go.  Enjoy.

Technorati Tags: ,,
posted @ Saturday, February 07, 2009 12:22 AM | Feedback (0)
A Perfect St Charles Christian Academy

2-6-2009 7-25-39 PM

I am just writing a short post to let every one know that I feel the nicest St. Charles County Christian Academies in the greater St. Louis Metro area is Westgate Christian Academy.  They are a group of wonderful people that absolutely adore the children.  If you need a preschool or primary school in St.  Charles County, Missouri, there is no better place to send your kids.  If you have any questions or want a referral, send me an email at jancel@gmail.com.  Here is their web site address:

http://www.westgateacademy.com/

2-6-2009 7-26-05 PM

posted @ Friday, February 06, 2009 7:28 PM | Feedback (2)
Beating High Blood Pressure Without Medicine

I say beating high blood pressure without medicine, when what I mean is "controlling high blood pressure without medication" or another translation could be "controlling high blood pressure with diet and exercise".  Here is how I am beating high blood pressure.

I went to the doctor last week, on January 29th, 2009.  I was found to have high blood pressure that measured my systolic at 124 and my diastolic at 96.  I was very frustrated to get hit by this, but figured it would come eventually since I am by most parts a geek that just sits behind his computer and punches keys (which is not yet considered physical activity).  That's OK though, I asked the Doc for some time to take care of this issue on my own and he has given me 12 weeks.  The first thing I did was travel to work and re-measure on a machine that that I could use normally, the result was similar 148 over 97; the only difference is this is the same machine I will use over the next twelve weeks to monitor my progress.

Week 1 is now over, and this is me holding my self accountable, now that the world can see it.  The doctor told me to lose 10 pounds by dieting and exercise, so here is the type of exercises I have chosen and the frequencies that I complete them.

Exercise Frequency Tool
Yoga 6x a week (~20 minutes) Wii Fit
Isometrics 6x a week (~20 minutes) Wii Fit
Aerobic 5x a week (~35 minutes) Elliptical
Weight Resistance 2-3x a week (30 minutes) Home gym

My diet is Herbalife (which if I have inspired you to sign up, then leave a response or email me at jancel@gmail.com and I can discuss your goals and options with you).  The long and short is that this diet really helps to control your appetite, provides a healthy vitamin course, and really does make a difference in the way you feel day to day.  Here is what my schedule looks like for eating.

Meal Amount Time
Shake/Meal Replacement 8 Ounces Soy Milk, Herbal Life Shake Mix 5:45AM
Peanuts/Soynuts/~90 Calorie healthy snack 1 ounce of peanuts or similar amount of soy nuts 9:00AM (this roughly translates to as late as possible)
Shake/Meal Replacement 8 Ounces Soy Milk, Herbal Life Shake Mix (Different flavor then breakfast) 11:00AM
Fruit/Crackers/~90 Calorie healthy snack Cheerios, Fruit, Wheat Thins, etc 2:00PM (this roughly translates to as late as possible)
Salad/Complex Carbs/Decent Dinner Equivalent fruits, veggies and meat to about 800 calories 5:45PM-6:15PM

Throughout the day, I try to drink as much water as possible.  Currently my daily consumption of tea, water and coffee equate to about 80 ounces, which isn't enough but is a start.

Week 1 Result

I was able to maintain the diet and exercise appropriately.  This has caused my Tivo to get backed up with shows, the amount of shows I was watching was unbelievable (WOW!).  So I hope my hard drive is large enough.  I may have to re-factor this to a Tivo upstairs as well so I can watch shows while I am exercising (this would add about 5 hours of TV catch up every week).   My wife did real well too, though she has slipped a little on the Aerobic and weight training.  It may be important to mention that she doesn't have high blood pressure and has less weight to control than I do.  Here is a breakout of my results for the week.

Week Measurement Jeff Lani
0 Blood Pressure 148/96 -
1 " 138/82 -
0 Weight Lost 0lbs 0lbs
1 " 5lbs 3lbs

Please note that we both have been feeling much better and other parts of our life have been increased very well for the first week of a diet.  This is an amazing result, of which I will try to update weekly.  This is my accountability system, and it may help to motivate my wife as well.

Tips for Success

Currently, the tips I am going to provide are ones that I am following closely.

  1. Lock a diet plan in place for at least the first 2 months, similar habits, meals, exercise, etc.  The less you move from this, the more likely you will be to maintain it for the long haul.
  2. After an initial period of time, still stick as close to possible to the plan but be more flexible in your choices. (i.e. replace peanuts with another equivalent)
  3. Set goals.  Determine what you want to get out of this diet.  Remember that eventually you will want to start calling this a lifestyle change, as that is actually what this is
  4. If done properly, you will see measurable differences (especially in the beginning).  If it is not measurable, you may have to increase duration, frequency or eating habits.

I will be back next Friday with another update.  I hope this has helped.

posted @ Friday, February 06, 2009 9:45 AM | Feedback (1)
News
My Developer Notebook! This also happens to be my opinion place. Thanks for coming by.