I visited Panther Creek Golf Club in Jacksonville, FL yesterday.

The Course

I am only a beginner in golf. I’ve been golfing for four months now. This golf course is not for beginners… in fact… I’d venture to say it isn’t for the ‘occasional’ golfer at all. After playing nine holes here, I was ready to sell my golf clubs, and decided to watch the others in my party for the other nine holes.

The fairways on this course are very narrow. If you have a bad slice, or if you are a beginner, bring an extra box of balls. If you hit it off of the fairway, on most holes, your either in water, woods, or thick briar patches… so not much chance of getting your ball back. Right now there is a pretty bad fire ant problem on the entire course…. so watch out for the ant hills!

The Amenities

Pros:

The cart girl came around about 6 times while we were here. This is the most I’ve ever seen a cart girl at any course I was on. Also, we were plesently surprised that there were bathrooms available half way through each set of 9 holes, which are accessible from several of the holes easily.

Cons:

The parking lot is currently unpaved, and we had to park in the mud.

The club house had poor customer service. My group stopped in after our first nine…. and my playing partner and I ordered a Hot Dog lunch combo and Ham Sandwich lunch combo ( combo comes with a drink and fries ) .. the girl behind the counter said it would be a few minutes. Thirty minutes later, someone went up and ordered a Hot Dog, and received it within 2 minutes. After about 50 minutes total, we received our hot dog and ham sandwich, no fries. I told the woman behind the counter we should have gotten fries, and was completely ignored. I went to the pro shop ( which is pretty empty at the moment ) and mentioned our bad service, at which point the manager said he’d come out on the course to speak to us in about 20 minutes. Never saw him at all.

Overall

Panther Creek gets a 2 out of 5 from me. We won’t be returning to this course until they improve the customer service in the club house and some of the amenities, and until we’re a bit more seasoned in the game. For now, we’ll stick to Fleming Island, Eagle Harbor, Eagle Landing and Magnolia Point.

I work from home most days, however over the last month I’ve had to go into the office for a lot of meetings.  I was getting really annoyed by the glare from the overhead lights on my laptop screen, and started researching ways to get rid of it.

My boss doesn’t really like us to unscrew the fluorescent lights, as he thinks it looks bad, so I needed another option.  I found cubeshield.com, where they make a ‘roof’ to go in the corner of your cubicle that blocks the lights.  I have to admit.. I had a few odd stares at the office after putting it on, but it really works.  I do recommend letting the velcro sit for a while before attaching the shield, so the glue has time to set up…. but other than that… it worked fabulously!

Savannah

We went to Savannah last weekend… have never been before. Apparently January is off-season and most of the shops on Tybee Island are closed. That was a bit disappointing. I found that the seafood there was much better than that we’ve been having in Jax lately. The oysters were excellent. All of the old buildings were really interesting, but the city really needs to do something about their parking situation. I haven’t spent so much time looking for a parking space since my college days at UCF!

We picked up a painting of dogs by Ron Burns at a shop on the River… at the time I didn’t think much about the $80 price tag, until I got home and saw his paintings are selling for $2k. I’m wondering if it was mismarked, as a print ( they had his prints there as well..but we opted for the framed painting instead),… unless there is something about paintings I don’t know about… where this is a different kind that is cheaper??

I find it rather amusing these days when I am looking at job postings for programmers and see ’script.aculo.us’ under the Skills/Experience section, instead of JavaScript.

script.aculo.us is one of many sites out there that have free JavaScript libraries available (granted they’ve done a better job of packaging it up in a bundle… documenting everything… and making the site pleasant). I guess what some people don’t realize… is that sites with libraries of code like these have been available for years … and that most of us developers have been using them all along…. Dynamic Drive, DHTMLCentral ( now defunct and taken over by spambots), Listamatic, YoungPup, thescripts.com, and many others have all been around for a long time, offering up free code ( JavaScript, CSS, Python, PHP, etc. ) to any programmer that wanted to download it and use it as it or modify it for their own needs. Many of us that don’t like to re-invent the wheel for the 500th time use these sites frequently, and contribute code back to them for others to use…. it’s not really a new concept… and I’d certainly never expect to see Dynamic Drive listed under work experience rather than JavaScript!

I’ve had a few people ask me how to do this… so I figured I’d post my sample in case it helps anyone else. Even though I like using Django’s templates and FormManipulators, I sometimes have a case where I need to allow a user to add 1-N number of items…. whether it be multiple contacts they have to multiple photos of something.

Django doesn’t handle this too well .. unless you want to make them just keep going back and adding one at a time, so when I have this need I use ‘old school’ HTML forms… where I have a button that says ‘Add Another’ and I use Javascript to emit additional HTML into my form.

Below is a sample.. which has been generalized. You can take this sample..and modify it to whatever input fields you require.. but this will allow you to dynamically add more form entry fields to your HTML page. You can then write a for-loop on the backend to go through the posted data, until you come to one that does not exist ( alternatively you could post the count so you already know how many you have).

<script language=”JavaScript”>
var itemcount=2

function additem()
{
var newitem;
newitem = “<div style=’padding-left:15px;border:1px dashed #cccccc;’><h4>Some Form Item Title:</h4>”
newitem += “<table cellpadding=’0′ cellspacing=’0′ border=’0′>”
newitem += “<tr>”
newitem += ” <td>”
newitem += ” Some Input A:<font color=’red’>*</font><br /><input type=’text’ id=’some_input_a_” + itemcount +”‘ name=’some_input_a_” + itemcount +”‘ value=” /></td>”
newitem += ” <td>”
newitem += ” Some Input B:<font color=’red’>*</font><br /><input type=’text’ id=’some_input_b_” + itemcount +”‘ name=’some_input_b_” + itemcount +”‘ value=” /></td>”
newitem += “</tr>”
newitem += “</table>”
newitem += “</div><br />”

var dynamic_item_div = document.getElementById(”dynamic_div”);
dynamic_item_div.innerHTML += newitem;
itemcount++;
}

</script>

<form>
.
.
.

<div id=”dynamic_div” name=”dynamic_div”>
<div style=”padding-left:15px;border:1px dashed #cccccc;”>
<h4 >Some Item Title 1:</h4>
<table cellpadding=”0″ cellspacing=”0″ border=”0″>
<tr>
<td>
Some Input A:<font color=”red”>*</font><br /><input type=”text” id=”some_input_a_1″ name=”some_input_a_1″ value=”" /></td>

<td>
Some Input B:<font color=”red”>*</font><br /><input type=”text” id=”some_input_b_1″ name=”some_input_b_1″ size=”30″ value=”" maxlength=”45″ /></td>

</tr>
</table>
</div><br />
</div>
<br /><br />
<a href=”javascript:additem();” class=”buttonlink”>Add Another</a> <a href=”submitmyform();” class=”buttonlink”>I’m Finished</a>

</form>

Lowes sells a great ’sponging’ kit for $20 that allows you to place two different color paints in a pan, and then has a special roller with a sea sponge… and allows you to sponge your walls. I give this product two thumbs up… we painted my bathroom with it this weekend..and it turned out great. The only thing to be careful of…is to make sure you get excess paint out of the sponge holes before starting to roll… or it will drip/fling it all over the place. I did this the first time I dipped it in the paint and made a bit of a mess…as I didn’t realize there was extra paint in the cavities.

Vacation in Vegas

Well, we went to Vegas this past week on vacation.  We had originally planned on going to Boston, but couldn’t get Red Sox tickets again, so went back to Vegas instead.

We stayed at the Riviera, as a friend from Port Charlotte works there and got us a good deal.  One thing that I was disappointed about there, was the betting limit on the Roulette table.  This is what I find most fun in the casinos there, and had read that the Riv had a $5 minimum bet, however, not one site I went to mentioned that it goes up to a $10 minimum at night, which is mostly when we visited the casinos.  Because of this, we pretty much went to Hooters every day to play, as we seem to have the best luck there.  I broke even each day at the Roulette tables, until the last day, when I lost all my gambling money…go figure!  Lori had a better trip than me when it came to gambling, she won a nice chunk of change at the Wheel of Fortune game ( enough to pay for the trip )!

While there, we visited the Mandalay Bay Shark Reef exhibit.  I wasn’t very impressed with this.  When I saw ‘Shark Reef’ as the title, I thought they would have at least one tank with a real reef in it, but unfortunately, it was all fake reef.  The sharks were pretty neat to look at, and they had several large puffers in a display.  I was bothered that they had two large Foxfaces in with aggressive fish, and they were both pretty torn up as they are a peaceful fish.  Their fins and tails were missing … it was depressing.

We also visited the Bodies exhibit at the Tropicana.  This was pretty interesting, although some might be bothered by it… it is basically preserved human bodies w/out the skin.  The purpose of the display is to show the muscular, vascular, skeletal systems in a way you’ve never seen.  I handled most of this pretty well, although the fetal section was a bit harder to walk through than the others.  I don’t really think this exhibit is suitable for kids ( as a child this would have given me nightmares ), although a lot of people had their kids there.

Outside of Vegas we visited the Red Rock Canyon trails ( recently on the CSI season premiere ) … and Mt. Charleston.  One of the most interesting things we saw on the hikes was a Tarantula.

I find the logic that some companies use to determine if a software developer will fit their needs or not rather surprising.

I recently inquired about a small contract job, as it sounded interesting.  The project required using Java with Hibernate.  When the company asked me if I had experience with this, I replied that I worked with Java from around ‘02 - ‘05, with a project similar to Hibernate on several large projects, but that since that time I’ve been working with Python on my current project.  After hearing this, the HR person was immediately disinterested.

What I don’t believe the HR person understood, was that any developer worth a grain of salt, can switch back and forth between languages ( especially those which with they’ve worked before )  almost seamlessly.   Now I haven’t worked with Java recently, but I could surely switch back to it, and pick it right back up after a few hours.  My biggest problem would most likely be remembering to put semi-colons and brackets in the code again, since they are not used in Python.

In my opinion, the language I work with is just a small part of my work.  I see each language as a tool, and most of these tools have documentation, and plenty of samples online if you forget what the function name for ‘functionality xyz’ is in that language after a few years of not working with it.  Now, I could have these tools, and have absolutely no idea how to logically address an issue, and I wouldn’t be able to diddley squat with them, but fortunately I’ve always been quite good at this ( I’m sure that the Logic and Proof courses I took in college helped some with this, but I’ve always been a logical thinker).

A developer needs to be able to logically work out the problem, whatever language they are using.  If they do not have this ability, they are most likely just going to be leaving you with some messy spaghetti code!   Ideally, they’ll have worked with a few languages, and understand OOP as well as DRY principal… but they shouldn’t just be discounted because they haven’t worked with that specific language recently!

So you want to have a dynamic menu, based on who is logged in, and what they are allowed to do. How do you acheive this?

Let me preface this by saying, that this sample is not using the Django admin system, as we had a legacy database with our own security system built in, but I’m certain those using the Django admin utility, can port this to work for them as well.  However, this system works for us, and allows us to define multiple User Roles in the system with privileges associated to each Role.   A user can then have one or more roles, which allows us extreme flexibility with controlling what a user may or may not be able to access in our system.

I have a user class:

class User...
user_id = ....
login = ...
.
.

Then I have a Role class, to define what role(s) my user has.

class Role...
role_id =
role_name = ....

Then I associate one or more roles with a user…

class UserRole...
user_role_id =
role = ForeignKey(Role...
user = ForeignKey(User...

Now I have ‘privileges’ associated with each role. Each privilege will correspond to a page in my system that I want to control access to:

class Privilege...
privilege_id = ...
privilege_name = ...

Now I associated privielges with roles..

class RolePrivilege...
role_priv_id = ...
privilege = ForeignKey(Privilege...
role = ForeignKey(Role ...

So now when a user logs in, I ask him what role he wants to perform in the system if he has multiples and get the role_id corresponding with that.
I then get all of the users privileges based on this role id.

privileges = RolePrivilege.objects.filter(role__role_id=role_id)
privilegeids = list([(field.privilege_id) for field in privileges])
#now get the privilege names
my_privileges = Privilege.objects.filter(privilege_id__in=privilegeids)
#now make a list of their names
privilegenames = list([(field.privilege_name.upper()) for field in my_privileges])

Now I can create my menu… I have a specific order I want things in, so I’m not going to just go through the privilege names..and blindly make one. I’m also using CSS to make this look nice … a vertical flyout menu… see my I’m on Listamatic post to view my css for this.

Normally I don’t break this up so much..but just to make it more apparent what I am doing… I’ve broken it up into small pieces w/ comments…


strMenu=""
# create the outer ul element ul and li have been modified to u-l and l-i to s get this to display as code and not a list for demonstration purposes
strMenu = strMenu + '
#create a top level menu item… this one is for everyo0ne.. no need to check a permission
strMenu = strMenu + ‘Home
#this one we want only to display to people with privilege ‘XYZ’
if (”XYZ” in privilegenames):

strMenu= strMenu + ‘XYZXYZ sub 1People

#this one we want only to display to people with privilege ‘ABC’
if (”ABC” in privilegenames):

strMenu = strMenu + ‘ABC

# we only want this to display to people w/ privilege ‘ABC-1′
if (”ABC-1″ in privilegenames) :

strMenu = strMenu + ‘ABC sub 1

# show this to everyone w/ ABC priv
strMenu = strMenu + ‘ABC sub 2

You get the idea… keep going with the menu…. until you get all the menu items you want to display.

Now… I just store the menu in a session variable:

request.session['menu']= strMenu

And add a TEMPLATE_CONTEXT_PROCESSORSso I can access this variable from the templates. In settings.py find my TEMPLATE_CONTEXT_PROCESSORS line and make it something like this:

TEMPLATE_CONTEXT_PROCESSORS = ('myproject.myapp.utilfile.menu',"django.core.context_processors.request",)

Then in my utilsfile.py I add this function:

def menu(request):
return {'menu': request.session.get('menu')}

Now in my base template file, I emit the menu with just using:

{{ menu }}

ReportLab Charts

There was minimal sample code on the wiki page for generating reportlab charts via Django.  I’ve just added sample code there for generating Line Charts, in addition to the already given Bar Chart sample.

If anyone is interested in a Pie or Scatter chart sample, let me know and I’ll add that to the wiki as well.

http://code.djangoproject.com/wiki/Charts

Next »