web development with NetBeans IDE larry's blog

Sunday Oct 12, 2008

The GUI editor in NetBeans has become mighty advanced. Gone are the days when you mess around with the GridBagLayout and nothing seems to work the way you want. Say sayonara to the needless frustration and desire to crush your computer for not doing what you want it to.

This is because of the fact that the form editor uses the Free Design layout manager which means that you can virtually go crazy and do just about anything! Throw in some Swing components like radio buttons and text fields, and bada bing - your done! I had my nephew come around and only after 20 minutes he created the following form:



In other news, I been trying to follow this election like everyone else, and am suprised by all the attention that Sarah Palin's been getting. Mostly lately it's been rather negative, but you know what they say about bad press being good press. Like Tina Fey's recent portrayal on Saturday Night Live. And the way critics have harpooned her over recent performances in TV interviews. It's interesting to see how much the election's dominating the media, which is a phenomenon which I sometimes think has gone a bit too far, but that's not to say I'm not trying to enjoy it as much as I can. Like instead of watching Lost or Big Brother, just click over to msnbc.com and watch some videos under politics.

Wednesday Aug 13, 2008

So I been thinking alot lately about the Internet Protocol Sweet and how it relates to my dreams. These hot and muggy days of August have been affecting my thought processes - the Netbeans 6.5 Beta is supposed to come out soon and there's a lot of work to be done but I can't envisadge it all with my brain on the barby so to speak. We've had some torrential downpoars here in Prague, and from my balcony I watch the rain and think about how everything is interconnected somehow. I've been trying to do some reading other than on the Internet, so I went to a local book store and picked up a book by Sigmund Frued who was also as a matter of fact born in the Czech Repbubilc.

Froed is a pro-verbial gold-mine of knowledge. I'm not talking aboutOedapus Rex syndrome or or anything to do with eel testicals or using cocain for pyschoanalsis. He was capable of drilling to the core of the truth of things. Take the mental processes for example. We often think about the things we think about involantarily. Its like your brain is on auto pilot and you sometimes have no control over the choice of thoughts that come and go. This is more true I have come to realize when you drink beer. After you been on this planet for 45 years or so, you start to stop thinking about the big questions. And while I sometimes feel that beer consomption on a regualar basis might be related to this, I look around in the street sometimes and see that most people are afflicted with the same predicament. Thats how I felt, so I began searching for some deeper ansers...

human model protocol

I been around long enough to know that, when you feel that things are going too well, then that's a sign that the big man upstairs is capable of throwing you a curve ball. I use do not give this much thought, but nowadays I find myself thinking more and more outside the box - I been asking God and myself things like why so many things do happen that you can't predict or explain, why that curve ball was aimed for me, whether Good and Evil truly exist as forces in this world or if they are just figmints of our collective human conscous.

Mainly though I been dwelling on human interaction and what really goes on at the deepest levels of the mind. Supposing you go to the pub with your comrades and you drink five beers. On a good night you start to share something special and although you might not remember what spasifacly that was the next day, you now it was important, and so you savor the remembrance. That's the key phrase her folks: you savor the remembrance of things. Because what really takes place is that unbeknownst to you, your communicating on multiple layers - and when communication goes well on all layers, this creates the memories that we all try and hold on to. Now going back to what I mentioned earlier about the Internet protocol swuit and how everything is interconnetcted. Look at the above example of the Internet protocol sweet that has been adapted to my therourys based on singmud froid using Netbeans UML capabilites.

Now, what is truly profound in relation to the internet protocol sweet is that something takes place called horizontal communication. This means that each layer thinks it communicates with its counterpart when communcation takes place. So if you are talking to you're freinds, what actually occurs beneath the surface is that while your personality communicates with your friends personality, your animal unconscous is at the same time communicating with your freind's animal consciousness. And when you go to sleep and dream, your dream self communicates with the dream network collective. A truly breath-taking glimpse into the heart of this knowledge can be found in this white paper.

So thats the horizontal aspects of communcation. But what about the vertacle communication that comes in to play between layers? Here is something that occurs what I like to call the "trickle down factor." This means that everything that happens to you some how trickles down to the collective consciousness. So while you sleep for example, all the random thoughts you had during the day trickle down into the dream layer, and you begin to formulate cognitions that are the product of your conscious imaginations resulting from your sense perceptions. And those at a deeper level trickle down into the chaotic melting pot that is the collective animal conciousness of humanity.

And so when you look at it this way, you start to see reason for interconnection in everything, like how technical charts can be applied to all aspects of life and how Vincent Cerf bares a uncanny resemblance to Sigmund Froiud and how the Internet and Olympics are just by-products of the fact that everyone nowadays shares the same collection of thoughts no matter what the language.

Sunday Jun 29, 2008

I finally figured out how to get my web pages to be in Spanish. This is been a desire I had now for a long time, but recently I been thinking of moving back to Tiahuana and intagrating my knowledge of the Internet with the tequila culture that florishes there. The'res lots of ways to get online, like if you go to a Internet cafe, but have you every considered surfing the net when your in a tequila bar? No of course not. And most if not all the folks in Tiahuana haven't either. So I'm thinking that maybe theres a gap in the market that no one's yet foreseen (yes, hard to beleive in this day and age): A network of free access points, funded by the city, for all tequila establishments combined with lots of Internet pages translated in to Spanish! Like they say, if you can't bring the horse to the well, bring the well to the horse.

So this is a two-fold process. We all have to sign a petishion that states that culture and education would benifit from the Internet, and after I recieve a thousand email addresses and credit card numbers, we'll present this to the Mayor of Tiahuagna and then we'll need to support some service for the Spanish Internet pages. I been trying to learn Struts lately and I found a way to do this combined with Google transalater:
  1. Create a page in your web project that will be the page thats going to be multilingual. For example I programmed a page that introduces the project and contains a form that will get your name, credit card details, and email:



    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <link rel="stylesheet" type="text/css" href="gstyle.css">      
            <title>Tiahuana Project</title>
        </head>
        <body bgcolor="#eee" style="font-family: sans-serif">
            <center>
                <h1>Tiahuana Project</h1>
                
                <p style="width:50%">The Internet is a primary source of intellectual 
                    stimulation for people of all ages and for collaboration of people 
                    across geographic boundaries. Help support our efforts to intagrate 
                    the Internet into places including, but not limited to, tequila bars. 
                    We need your moral and financial support.</p>
                
                <html:form action="/signup">
                    <table cellpadding="5">
                        <tr>
                            <td align="right">Name: </td>
                            <td><html:text property="name" /></td>
                        </tr>
                        <tr>
                            <td align="right">Email Address: </td>
                            <td><html:text property="email" /></td>
                        </tr>
                        <tr>
                            <td align="right">Credit Card Type and Number: </td>
                            <td><html:text property="ccDetails" /></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td><html:submit value="Donate" /></td>
                        </tr>
                    </table>                        
                </html:form>
                
            </center>
        </body>
    </html>
    
  2. Create a properties file named 'words' in your web project in the WEB-INF > classes folder. If the classes folder doesn't exist then create it. Then create key value pairs for all the text in the page:
    title=Tiahuana Project
    name=Name
    
  3. Then create another properties file in the WEB-INF > classes folder and call it words_es:



  4. Go to the Google Translator Page for a free translation of words into Spanish:

    http://translate.google.com

    Type in the English words and get the Spanish translaiton



    Add the translations to the Spanish properties file:
    title=Proyecto Tiahuana
    name=Nombre
    email=El dirección de correo electrónico
    creditcard=Tipo de tarjeta de crédito y el número
    intro=El Internet es una fuente primaria de estímulo intelectual para las personas de todas las edades y para la colaboración de personas a través de límites geográficos. Ayuda de apoyo a nuestros esfuerzos intagrate los lugares en Internet, incluyendo pero no limitado a, tequila bares. Necesitamos su apoyo moral y financiero.
    example=por ejemplo
    
  5. In the struts-config file add an entry for the properties file (you only have to do one entry, for the words.properties file):
    <message-resources parameter="words" null="false"/>
    
  6. Now go back to the form page and use <bean:message> tags everywhere:
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <link rel="stylesheet" type="text/css" href="gstyle.css">      
            <title><bean:message key="title"/></title>
        </head>
        <body bgcolor="#eee" style="font-family: sans-serif">
                <h1><bean:message key="title"/></h1>
                
                <p style="width:70%"><bean:message key="intro"/></p>
                
                <html:form action="/signup">
                    <table cellpadding="5">
                        <tr>
                            <td align="right"><bean:message key="name"/>: </td>
                            <td><html:text property="name" />
                                <span style="color:grey">
                                    <bean:message key="example"/>: Larry Wales</span>
                            </td> 
                        </tr>
                        <tr>
                            <td align="right"><bean:message key="email"/>: </td>
                            <td><html:text property="email" /> 
                                <span style="color:grey">
                                <bean:message key="example"/>: larrywales@hotmail.com</span>
                            </td>
                        </tr>
                        <tr>
                            <td align="right"><bean:message key="creditcard"/>: </td>
                            <td><html:text property="ccDetails" />
                                <span style="color:grey">
                                <bean:message key="example"/>: Visa 1234-1234-1234-1234</span>
                            </td>
                        </tr>
                        <tr>
                            <td></td>
                            <td><html:submit value="Donate" /></td>
                        </tr>
                    </table>                        
                </html:form>
                
        </body>
    </html>
    
  7. Run the project and you should see the page showed above in your Internet browser. To tell your browser to view the Spanish, you got to change the language settings in it. I did this like this in Firefox on my new computer:



  8. Now when you view the page again the browser shows the Spanish versoin:

Tuesday Jun 24, 2008

The long awaited 6.1 version of NETBEANS is now available for downloading! And it's got lots of new features like a Javascript editor and looks much better now too:

BEFORE:



AFTER:



Now there's a facelift that would fail to turn no heads in a Palm Springs beauty pageant. I for one was blown away, because unlike many folks who work for NetBeans, I wasn't able to see the IDE until only yesterday when I got home from the hospital.

Saturday Feb 23, 2008



The WORLD WIDE FEDERATION OF WRESTLING now proudly sponsers the all new and improved NetBeans Creating a Simple Web Application Using a MySQL Database tutorial. This tutorial, featuring IFPWAFCAD, the INTERNATIONAL FORMER PROFESSIONAL WRESTLERS ASSOCIATION FOR COUNSELING AND DEVELOPMENT, has just been updated for NetBeans 6.0.

For all you wrestling fans and web application developers, ENJOY!!

Sunday Feb 17, 2008

Often I think about how much I enjoy deliscous food, but unfortunatly its either too expensive or takes too long to prepare, or I can't get fresh ingredients. That was the situation I was in when I made Penne Con Huevo this weekend after my landlord cut my gas:



Now I know that you preferrably cook eggs before you eat them, but actually raw eggs contain %20 more vitamin B than do cooked ones. So there's the health factor there that one should consider. Also they say that hunger is the best spice, and I was downright starving when I ate this.

So the MySQL driver is included with NetBeans 6.0. This is actually old news but I wanted to bring it up again becuase I got a problem. Its more a gap in my understanding thats been bothering me. Basically, Im connecting a simple web application to a MySQL database in the IDE and I've downloaded and installed both Tomcat and GlassFish that come with the Web version of the IDE. Now when I run the application using Tomcat everything works OK. And when I run the application using GlassFish everything works OK. So where's the problem?

The problem is that I been looking at this old outdated (ahem) tutorial on connecting a webapp to a MySQL database, and in it it states that you got to add the database driver's jar file to the server. But I no longer do because the Tomcat already contains the jar file:



But with Glassfish, there's no jar file added to the libraries. I checked. So why does it work for me with Glassfish?

Unless the MySQL jar file is maybe buried somewhere in a subfolder in the Glassfish libraries? Or maybe its called something different for Glassfish? Or maybe there's something the IDE does automatically at deployment because the driver is now a part of the installation? Or could it be something else entirely and I just eat too many raw eggs?

Sunday Feb 10, 2008

Conflicts can cause lots of problems. They can hamper your productivity, put you in a bad mood, and even cause you to lose lots of money. In severe cases, they can result in emotional distress leading to live-long trauma. Beleive me, I know. When my next-door neighbor took me to small claims court over the damage I caused when I accidentally drove my pick-up into his son's segway, not only did it breed ill-will, but it ended up costing me $2000 dollars. But that's another story. I wanted to focus on the work I been doing lately with Subversion, a version control software, and try to explain how it is possible to actually create a conflict. Why you ask? Becuase I had the task of doing the screenshots for the updated NetBeans 6.0 Subversion Tutorial, and so I needed to make it look like there was a conflictorial state.

At first, I tried to access the same versioned project through 2 different IDE's at the same time. Of course that didn't work, and the more I think about it, that just seems silly now. I finally realized that the key is in creating a second project and linking to the same repository. Here's what I did:
  1. Create Local Subversion repository from terminal:
    svnadmin create /home/larry/Desktop/svnRepo
          
  2. In NetBeans, link a project with the new repository. There's 2 simple ways to do this:
    1. Create a new project, then, from the project node in the Projects window, choose Versioning > Import into Subversion Repository.
    2. Use the SVN checkout wizard (Versioning > Subversion > Checkout from main menu). Add the path to the new repository:



      Then, when the wizard finishes, it scans the repo (and finds nothing) and asks you if you want to create a project from checked out sources. Do this. When the project opens in the IDE, notice that it already contains versioning badges.
  3. Now, step through the Subversion checkout wizard (again), and this time in the second step, select the project you just created:



    When you finish the wizard, note that you now got 2 identical projects listed in the Projects window, both linked to the same repository:



  4. Open the index.jsp file of project 1, and make some change:



    Save and commit that change to the repository.
  5. Now, open the index.jsp file of project 2, and make some different change to the same line as you did for project 1:



    Save the file.
  6. Then, when you do an update on project 2, the project is compared with the current version of the repository's project (already contains Hola Amigo! from project 1). Here's the conflict, and the Projects window tells you so:



  7. To resolve the conflict, you can open the Conflict Resolver to fix the matter. The Conflict Resolver is like some high-profile lawyer who arrives upon the scene willing to offer legal services pro bono:



    With the click of a button, all your problems go away! Of course, conflicts are much easier to resolve when they're just between you and yourself.

Tuesday Feb 05, 2008

Aside from being drop-dead gorgious, Monica Bellucci is also erudite, gracious and wise. I went to take my nephew last week to see "Shoot 'Em Up", a fast-paced action thriller with Clive Owen and Paul Giamatti. There's one quote in the movie that stuck out in my mind, the whole week while I was working with sample projects from the Google Web Toolkit book by Prabhakar Chaganti. Monica Bellucci says, "Eggs have no business dancing with stones."

Now, I've worked through the NetBeans GWT Quickstart, and have read half the book. The book is awesome, but it is riddled with code typos that have cost me hours and hours of frustration, which is unfortunate but I guess we all go through this sometimes. NetBeans can't really help with these kinds of mistakes. One thing that NetBeans does really well, is that it makes things a lot easier and quicker for developers. For developers. And sometimes, I tell myself, that ain't me.

However... I been sticking with it and only later found out that the download link at the top of the NetBeans GWT Quickstart brings you to a plugin that lets you install not only the sample project from that tutorial, but 5 or 6 more samples which are modelled after the ones in the book! This is truly awesome because where before I couldn't figure out why my project wouldn't run, now I can just compare what I had with the samples and work out where the problem lies. And the samples let you do some pretty neat stuff:

DYNAMIC LISTS:


SORTABLE TABLES:


Doing it this way doesn't really make me feel like a developer, but then I guess that don't really matter. Because despite how I felt when Monica Bellucci was enfirring that I was an egg, with the NetBeans samples and some inspiration from Jimmy Thomas, I feel like I'm on the right path again this week.

Wednesday Jan 23, 2008

I think I know the real reason why Sun bought MySQL, and its got nothing to do with Oracle either. Its got everything to do with the fact that those GUI tools offered on the MySQL website are freakin awesome. At least a few of them suits at Sun possess some serious foresight. Very good work MySQL, but now look where its got you: you're as good as bought!

The best news is that all of these tools are FREE. Take MySQL Workbench for example. Its still in Beta, but who cares. I went and tried the following simple experiment to create a foreign key between 2 tables:

  1. Downloaded the ifpwafcad.sql script which is used in the NetBeans MySQL tutorial.
  2. In Workbench, chose from the File menu: Import > Reverse Engineer MySQL Create Script. I then pointed to the ifpwafcad.sql file. Workbench parses the script and the tables show in the Catalogue window:



  3. Then go to Model > Create Diagram from Catalog Objects and the tables show in the big window:



  4. Now, to create a foreign key between the Subject and Counselor tables, I clicked a Relationship button in the left sidebar. There's a bunch of them. Then clicked on the Subject table and then the Counselor table. I then proceeded to mess around.
  5. In the final step, the 2 tables are holding hands, there's a nifty feature that when you hover your pointer over the line, the relationship goes pink:




Finally, I wanted to create a new sql script from the changes made, that way I could inspect the code that was created by making the foreign key. To do so, File > Export > Forward Engineer SQL Create Script. In the generated script, the foreign key constraint looked like this:

  CONSTRAINT `counselor_idfk`
    FOREIGN KEY (`counselor_idfk` )
    REFERENCES `mydb`.`Counselor` ()
    ON DELETE NO ACTION
    ON UPDATE NO ACTION);

Sunday Jan 20, 2008

How to use JSP tags in the NetBeans? Learn with the JSP Syntax Reference. That's what I did when working through this tutorial. You create 2 pages, get a name from a Internet user, save it and then put it out on another page. Yea, these are baby steps, I know. But everyone must start somewhere.

Thursday Jan 17, 2008

Hey there!

To kick off the New Year, I been wanting to change my ways and become somewhat more productive. This is been a New Years resolution every year for the past 8 years I think, but this time I figure I got to do it otherwise there'll be no way to climb out of this pit of sloth I've been slowly digging. So I'm going all in, as they say in the gambling hall (where I don't frequent no more), and am gonna write about my experiences with the stuff I work with on a daily basis.

So without further adoo, I present all friends, and foes, with this here my weblog. And for anyone who might be interested, here's a list of not-so frequently asked questions about the person responsable for this blog:
  • Who are you?  I am currently a technological writer and have been, off and on, for software products for about 15 years. I began documenting a stock, shipment and inventory application on a quesadilla farm back in 1993 in New Mexico. Unfortunately, the software didn't work right in the first place, and besides most of the employees did not speak English anyway. When the business eventually collapsed, I packed my belongings and moved to Tijuana where I later opened an Internet cafe and tequila bar with my first wife. I am also working as a free-lance web developer in my spare time.

  • Do you really work for Sun Microsystems?  Well technically speaking, no I don't. I'm a contractor who is currently being outsourced documentation that was already outsourced to the NetBeans OutSource team.

  • So what are NetBeans?  NetBeans is the name given to a free, open source IDE (Integrated Development Environment). An IDE is a big computer application that helps you create web, desktop and mobile applications of your own. You can find more information about it here.

  • Does this blog reflect Sun's policies and stratagies?  Nope. This is all just my own thoughts and opinions related to whatever I'm working on. I'm just one small fish in a big pond, just like you or anyone else. So be adviced: I'm first and foremost a writer, and secondly, a novice developer. So any code you find here, or stuff I do in the IDE is probably not the way an experienced engineer would do things.

  • Do you have a real picture of yourself?  I've got this one, which is 3 years old and was taken in an insurance claims office by my third ex-wife:



  • Can old dogs really learn new tricks?  At the ripe age of 47 I am living proof. Shortly after starting this job in 2007, I'd harbored beliefs that NetBeans was a type of smartfood that Sun was secretly feeding to its engineers, and if I poked around in the car park level in the basement, I'd eventually find cans of baked beans with NetBeans labels. It only took a few days before I realized: NETBEANS IS NOT FOOD. But they can make you smarter my freind. And it's never too late to learn. The amazing thing about getting to document this technology stuff is that your forced to learn about it! You have to understand how things work and why they do, otherwise the documentation will be crap. So here I am, trying to wrap my head around things like JSTL, databases and data sources, connection pools, servlets, frameworks, and the like.

  • What do you do in your spare time?  I bowl. Also, another New Years resolution is to learn how to cook well. I like good, tasty food. I got a cookbook by Jamie Oliver called "Jamie at Home" which is great for beginners who don't want to be too careful with proportions. I also been visiting Open Source Food to learn about new recipies and see what other fokes out there are doing.