Thursday Oct 23, 2008

MySQL Improvements in NetBeans 6.5

Here's a new vid from Andrei Badea on the new MySQL support in NetBeans 6.5. Enjoy!

<script type="text/javascript" src="http://www.netbeans.tv/js/swfobject.js"></script> <script type="text/javascript"> </script>

Monday Oct 13, 2008

NetBeans Platform Training Taking Off

Geertjan is just back from a trip around Europe giving the NetBeans Platform Training to various institutions. He was joined by Petr Suchomel for an in-house training at an ISV, then David Strupl and Dream Team member Toni Epple at the University of W├╝rzburg. He also stopped off at a JUG in Dresden on the way back to Prague.

We've been blown away by the demand for the NetBeans Platform Training. Businesses that are already building on the platform want us to come help them expand their knowledge. Universities love it because it offers a real-life application of Java concepts and skills. In fact, we've had so much interest that we just can't keep up. (We're working on a NetBeans module that clones Geertjan, Petr, Jarda, and other Platform experts, but so far it's only in Alpha.)

That's why it's so awesome to have the community come help us give these trainings. It's not just that it helps us deal with the load of training demands - it gives us a valuable insight into how the APIs are used. We have written the APIs, but few people inside Sun have used them for anything other than writing IDE modules. So having someone who has actually used the APIS for doing RCP apps makes for a much better class.

If you're interested in the course, check out the main NetBeans Platform Training page. Also check out what Toni (with pictures) and Geertjan had to say about the course.

Tuesday Oct 07, 2008

New Demo - Using EclipseLink with JPA in a web application

This comes from Troy Giunipero, docs writer here in Prague for NetBeans. It's a great screencast on using EclipseLink with the Java Persistence API in a web app. Check it out.

<script type="text/javascript" src="http://www.netbeans.tv/js/swfobject.js"></script> <script type="text/javascript"> </script>

Check out more web application tutorials and demos from netbeans.org.

Wednesday Oct 01, 2008

Cool PHP Demos in NetBeans

I've been looking at the excellent work that people have been doing at the NetBeans PHP Blog and especially at the excellent screencasts and video tutorials that Petr Pisl has been putting out. He's got a Demo on using class property variables and a great demo about developing WordPress plugins with NetBeans. This along with Roman's slightly outdated but still great PHP Editor Demo gives you a nice overview of the PHP functionality that you can watch while drinking your morning coffee.

Wednesday Sep 24, 2008

Mac vs Vista

Over the last year I've gone from Windows XP to Mac to Vista in a weird series of events where I keep picking up other people's computers. I actually started out on a Mac back in the 80s. My mom had the Big Mac 512, the original series that has a plate on the inside with the signature of the whole development team. I logged many hours playing Dark Castle on that baby. But economics eventually drove us to the PC and I'd been using PCs since college.

So when I picked up a departed colleague's MacBook Pro last year, my excitement quickly turned to annoyance at having to learn another OS. And now that my fingers are finally doing the right things, my MacBook lease ran out and I inherited a Toshiba with Vista on it. Despite the pervasive presumption that Mac does all things right in the usability realm and Windoze is designed by a team of dyslexic monkeys, there are some things that each OS does better than the other. Here's some random thoughts:

Mac Wins

  • Stability Stability Stability You don't miss your water till your well runs dry. Well, one week back on Windows and man am I appreciating the stability of a Mac. I think I had to do a hard reboot maybe twice in the whole year I was on Mac, and although some programs would freeze up, they would never take the whole operating system with them. Windows, well, you know...
  • Performance Performance Performance Same as above. Startup, general responsiveness of the entire system, it's just so much more solid on the Mac. The most annoying example is just putting the computer to sleep and waking it up. Mac - just close the lid and open it again, it never chokes. Windows (or just my Toshiba) - try just closing the lid and it will not be happy when you open it again. Kind of like trying to put my kid to bed when he's not ready. I have to manually put it to sleep first, and on this Vista that takes something like 20 seconds. Royal pain.
  • Expose I know, not very original, but I really got used to it. Windows is I guess trying to copy it with their Start-Tab view, but that's just eye candy over the regular Alt-Tab view. Kind of like lipstick on a hockey mom.
  • QuickSilver Again, has turned into a must-have. Everyone's getting on the built-in search bandwagon. Vista has it in their Start menu now, but it really doesn't work as well as QuickSilver, especially since it just gives you programs and folders and not recent URLs and that kind of stuff. Even NetBeans now has it with the quick search toolbar, which lets you quickly search for commands and files. They're going to put us docs writers out of business! But I digress...
  • Screen-grabs I know, not high on everyone's list but as a former docs writer the ability to grab a screenshot of a certain area and have it come out in a ready-to-use PNG is key. On windows I get a useless full-screen bitmap that I then have to crop and convert in another tool.

Windows Wins

  • Alt-tab Maybe one reason why I like Expose on the Mac so much is because Alt-tab is so totally dysfunctional on the Mac. I just want to Alt-tab between all open windows, please. If I'm writing an email and I want to go back to my inbox, it's ridiculously difficult to do on Mac. I guess they just expect that all Mac users are artists who constantly have one hand on the mouse.
  • Keyboard Shortcuts While we're on the topic, could we please have a common group of keyboard shortcuts for all Mac programs. I'm just talking about simple things, like moving the cursor to the end of a line. Alt-Left Arrow on one program, Command-Left Arrow on another, etc. I love just being able to hit the Alt key and navigate menus in Windows. My default working position is the couch, not the desk, so please don't make me use that track-pad.
  • Surely there must be others...

Actually there are none I can think of right now. But add your comments and I'll add more to this post as it comes to me, I've only had Vista a week so it's all still pretty fresh.

Friday Jan 04, 2008

Report Envy - Making Omniture Look Like Google Analytics

I wish I could merge Google Analytics and Omniture together. Just put the polished UI and responsive search times of Google Analytics over the more powerful functionality of Omniture. Take for example the Top Content report for Google Analytics:

Classic Google design - has all the vital information in one screenfull by default. So how to get this in Omniture?

When you go to Paths > Pages > Pages > Most Popular Pages, you just get the Page Views. You can add more columns to the report by clicking Page Views in the header of the Details column and adding the following to the report:

Then for the Bounce Rate, you need to define it as a Calculate Metric. Click the Calculated tab and then click the Define New Metric button. Name it Bounce Rate, set the Metric Type to Percent, and enter [Single Access]/[Entries] in the Formula field.

Then add Bounce Rate to your report as well and viola, you've got a nice Google-esque Top Content Report.

A quick note on possible uses of this information. We've got two types of pages that we track the most - informational pages like videos and tutorials, and index pages that lead people to the information. So we look closely at the bounce rate for the pages. If a tutorial has a high bounce rate, that's not necessarily bad. The user may have found what they were looking for and then left the site. So we look at both the time spent and the bounce rate. A tutorial with a high bounce rate and a low time spent on page means the user probably did come to the page, say yuck, and leave completely.

When this happens it's time to look at the searches that brought people to the page. Google is again better off in this because you can see the bounce rate for each search term, so you can see which ones are making people go yuck the most. Not sure how to get this running in Omniture yet.

Of course, index pages with high bounce rates are big warning signs as well. When that happens it's time to look at the design of the page altogether.

Monday Nov 26, 2007

New vs. Returning in Omniture

One of the things that Google Analytics does really well is New vs. Returning users. I really like this metric, because it shows you a lot about how different users are using your site.

So this is where I admit my ignorance and ask a bunch of questions rather than give great insight. While New vs. Returning is cool, it really becomes powerful when you can use it as a segmentation tool. Google Analytics lets you do some segmenting for new vs. returning through the drop-down in the New vs. Returning report. The things you can segment are the most important high-level metrics - conversion rate, bounce rate, visits, etc. But it would be nice to allow you to segment more reports by New vs. Returning - things like most popular landing pages, most popular pages, etc.

Now Omniture is the self-proclaimed king of segmentation. Using Discover you can (supposedly) segment anything by anything (as long as the two reports you're using are looking at similar data). But unfortunately, we're having one hell of a time getting New vs. Returning even to show up, much less use it as a basis for segmentation.

Some of the red herrings we've been chasing:

  • Going into Discover and filtering by Visit = visit number does not equal one. Sounds good, but the problem is that if you run the report for the last six months, it only shows you new vs. returning for those six months. So there's no way to do "visit number does not equal one" outside of the range that you're actually generating reports for.
  • Just using Yearly Return Visitors. I'd be fine with just counting returning visitors in the last 12 months rather than "ever". After all, most people delete cookies more than once a year, and with our site, if you haven't been here in over 9 months, you might as well be a new user. Problem is that Omniture seems to count Yearly Unique Visitors as in this calendar year rather than in the last 12 months. Now that's just down-right dumb. Who in web metrics cares about calendar years? You care about trends! And your trends are all messed up because you'll show a huge number of new visitors in January and a low number in December.
  • Doing the math by hand taking all unique visitors and subtracting new visitors. Gets you the number but you can't use if for segmentation.

Now it looks like you can get the info in your conversion reports under Visitor Loyalty, but we haven't been using the Conversion reports because our main conversion metric - Downloads - hasn't been under Omniture tracking for technical reasons. We've finally figured that out so I'll post the results of that quest when I get it set up.

But the long and the short of it is - this really should be much easier in a top-of-the-line pay product like Omniture. If anyone has experience doing this or tips and tricks, feel free to let me know!

Friday Nov 16, 2007

Regular Expressions Anywhere in Google Analytics

So this is just a quick tip that may have been obvious to everyone but wasn't to me and I found it incredibly useful. In Google Analytics, you can use regular expressions in any search field. So if let's say you have an ecommerce site that dynamically forms URLs like this:

thanks.php?from=order;id=13456;type=book

you can go to Top Content and enter a regular expression like this in the search box:

/thanks\\.php\\?from=order;id=(.\*);type=book

Then if you wanted to see all orders for more categories you just replace type=book with something like type=(book|cd|dvd).

Of course, if the site had been thinking about analysis from the beginning, they would have formatted that URL to put type=book before the id, so that you could just search for the most static parts of the URL (thanks.php?from=order;type=book) and not have to use a regex in the search.

So all you webmasters out there, do the analysts a favor! When you formulate your dynamic URLs, the parts that are the most dynamic should go at the end. So if your information looks like this:

Orders
  Category
    Subcategory
      Individual ID

That's the order they should go in in the URL. Makes it much much easier to generate reports.

Another thing I'm figuring out is that I'm going to have to learn regular expressions better. People on the lists are pretty helpful but I think I need to just bite the bullet. Anybody got any advice on a good crash course (preferably online and free) to regex?

Thursday Nov 15, 2007

Round 3 of My Blog

Welcome to the third incarnation for my blog. It's been an interesting ride. My first round at blogging was when I was a technical writer here at Sun Microsystems and I focused mostly on tips and tricks for using NetBeans IDE. Then as our team started making more and more screencasts and demos I reinvented the blog as a Flash blog.

Now that I'm the manager of the NetBeans docs team, unfortunately I no longer have much time to play around with cool technology. But I do have new challenges, such as making sure the NetBeans web site is doing its job: informing users on how to get the most out of NetBeans, driving volume for Sun's technologies and tools, and fostering the growing community of NetBeans and Java users.

Which led me to a new semi-technical passion - web analytics. Digging through Google Analytics and Omniture reports, trying to figure out which key performance indicators really measure success, doing change-measure-change improvements on the web site. I have to say it's a little scary that I like this so much - it seems to appeal to parts of my nature that I didn't even know were there. But it's fun, it's good for the business, and I'm running with it, much to the chagrin of the NetBeans webmasters and our (much more qualified) web analysis team, who gets continually bombarded by my questions.

So what to expect? I'll be asking a lot of questions here, putting up the answers when I find them, doing a lot of complaining about "I can do this in this tool but can't in that tool" type of things. Hopefully you'll find it interesting. So stay tuned :-)

Wednesday Jun 07, 2006

More Automatic JSF Generation

In addition to generating a whole CRUD application using JSF and the Java Persistence API, NetBeans IDE 5.5 dev builds also have some cool JSF generation features. I'm trying to tie everything up before going on vacation (two weeks in Spain - BRING IT!!!) and I was filling in some online help on this feature, so I thought I'd share it.

So let's say you don't want to generate a whole CRUD app, but you do want to generate a form for getting user information and storing it in a database. You'd want to create an entity class for the user information, (let's say a Book class with bean properties for author, title, and genre) and a JSF managed bean that acts a controller (methods for returning all books, saving a new book in the database, etc.). Maybe these things already exist, the developer who handles the DB and back-end has already set them up, and your job is just doing the front-end.

So you open up your web app, create a new JSP page called addbook.jsp. Then you drag the JSF Form palette item into the JSP and release. You get this dialog box, where you fill in the class name and specify you want an editable form (you want to create a new book, not just show the data from an existing book):

Press OK and you get this:

<f:view>
    <h2>Create</h2>
    <h:form>
        <h:panelGrid columns="2">
            <h:outputText value="Title:"/>
            <h:inputText id="title" value="#{anInstanceOfdb.book.Book.title}" title="Title" />
            <h:outputText value="Author:"/>
            <h:inputText id="author" value="#{anInstanceOfdb.book.Book.author}" title="Author" />
            <h:outputText value="Genre:"/>
            <h:inputText id="genre" value="#{anInstanceOfdb.book.Book.genre}" title="Genre" />
        </h:panelGrid>
    </h:form>
</f:view>

Now you need to change anInstanceOfdb.book.Book to a property in the controller class that represents an instance of a single book. Supposing you've got your controller class registered as a JSF managed bean with the name book, it might look something like this:

<f:view>
    <h2>Create</h2>
    <h:form>
        <h:panelGrid columns="2">
            <h:outputText value="Title:"/>
            <h:inputText id="title" value="#{book.book.title}" title="Title" />
            <h:outputText value="Author:"/>
            <h:inputText id="author" value="#{book.book.author}" title="Author" />
            <h:outputText value="Genre:"/>
            <h:inputText id="genre" value="#{book.book.genre}" title="Genre" />
        </h:panelGrid>
    </h:form>
</f:view>

You'd then add a commandButton to submit the form. Run it and here's what you get:

Pretty handy, especially when you've got a lot of user information you have to fill in. Note that you can also use the Read-only function to just present all of the data for an existing book as well.

Thursday Jun 01, 2006

Quickly Adding a Navigation Rule and Navigation Case

Short and sweet revelation regarding setting JSF navigation in faces-config.xml. I thought in NetBeans IDE 5.5 you had to first add a navigation rule with the Add Navigation Rule command, then add a navigation case separately with the Add Navigation Case command.

Actually, you can do both at once by just going to Add Navigation Case right off the bat. If a navigation rule for the page you specified in From View already exists, the IDE'll add the case to that rule. If it doesn't exist, it'll create it.

Which begs the question, why do you need the separate Add Navigation Rule command at all? Would you ever want to create an empy navigation rule? Or is this just for discoverability? I could see a user saying "I can't create a navigation case yet, I haven't even defined the navigation rule!"

All of these puny revelations are brought to you from testing some very cool short tutorials which you shall soon see from the Java EE Tutorials team. So stay tuned!

Wednesday May 31, 2006

XHTML, Facelets, and NetBeans IDE

I was trying to do the Facelets tutorial in NetBeans IDE, and the tutorial calls for lots of XHTML files. Unfortunately, NetBeans makes it very hard to create XHTML pages with the .xhtml suffix.

First I had to actually find the XHTML template. It's not under Web, which is strange because HTML is there. After searching (OK, Geertjan told me), I found it in the Other category. Problem solved, right? Wrong.

The XHTML File Wizard doesn't let you specify the extension and automatically gives an XHTML file an .html extension, although it correctly recognizes it as an XML file and not a regular HTML file.

So the only way to really do this is to register the .xhtml extension as belonging to XML files. Choose Tools > Options > Advanced Options > IDE Configuration > System > Object Types > XML Objects and add .xhtml to the Extension and MIME Types category. (Side note - this setting really needs to get promoted to the main Options panel. It's one I use quite a bit and it's terribly buried in the Advanced Options. Actually, I'd rather be able to right-click any unrecognized file and choose Treat As... to register the extension with an object type.)

Now that the extension's registered, use the Other > Empty File template. This is the only template that will allow you to specify an extension. Give the file the .xhtml extension and it'll show up correctly as a file, although not with any of the skeleton code. It'll just be an empty file. Better than nothing, though.

BTW - if you're trying to do facelets in NetBeans IDE, it's not really easy. There's no code completion in the XHTML files, since schema-based code completion hasn't been implemented yet. If you use jspx files, it's supposed to work, but last I looked at it code completion wasn't working there either. Check out Mark Overdij's blog for a quick run-through of getting it going.

Tuesday May 30, 2006

GlassFish Samples Integrated in NetBeans 5.5

This has been the case for a few weeks now, but I just noticed it now. There are lots more Java EE samples in NetBeans, thanks to the integration of the GlassFish samples. On the Welcome Screen, just click Java EE 5 under Samples, and you can access the following samples:

Friday May 26, 2006

Validating an Email Address in JSF

In earlier installments of the jAstrologer tutorial (see previous blogs) we used a converter and standard validators to validate the input in inputText components. You can also code your own validators if the standard JSF validatiors do not work for you. In our example, we will code a validator that checks a string to see if it is a valid email. To create a custom validator, you create a class that implements the javax.faces.validator.Validator interface and register the class in faces-config.xml. You can then use the validator using the <f:validator> tag.

  1. Right-click the project node and choose New > Java Class. Name the class EmailValidator, place it in the astrologer.validator package, and click Finish.
  2. In the class declaration, implement Validator as follows:
    public class EmailValidator implements Validator {
  3. Use the hint to implement the validate method.

  4. Add the following code to the validate method:
        public void validate(FacesContext facesContext, 
                UIComponent uIComponent, Object object) throws ValidatorException {
            
            String enteredEmail = (String)object;
            //Set the email pattern string
            Pattern p = Pattern.compile(".+@.+\\\\.[a-z]+");
            
            //Match the given string with the pattern
            Matcher m = p.matcher(enteredEmail);
            
            //Check whether match is found
            boolean matchFound = m.matches();
            
            if (!matchFound) {
                FacesMessage message = new FacesMessage();
                message.setDetail("Email not valid");
                message.setSummary("Email not valid");
                message.setSeverity(FacesMessage.SEVERITY_ERROR);
                throw new ValidatorException(message);
            }
        }
    
  5. Open faces-config.xml and add the following code:
         ...
        </application>
        <validator>
            <validator-id>astrologer.EmailValidator</validator-id>
            <validator-class>astrologer.validate.EmailValidator</validator-class>
        </validator>
    </faces-config>
  6. Open greeting.jsp and add the email field:
         ...
            <p>Enter your name: <h:inputText value="#{UserBean.name}" 
            id="name" required="true"/>
            <h:message for="name" /></p>
            <p>Enter your email: <h:inputText value="email" 
            id="email" required="true">
                <f:validator validatorId="astrologer.EmailValidator" />
            </h:inputText>
            <h:message for="email" /></p>
            <p>Enter your birthday: <h:inputText value="#{UserBean.birthday}" 
                id="birthday" required="true">
         ...
  7. Run the project. When you enter a non-valid email in the field, you get the following error:

Thursday May 25, 2006

jAstrologer JSF Tutorial - Custom Validation in the Backing Bean

Although performing validation using required fields and converters is easy, it is also very limited. The error messages are not formatted very nicely and the checking that you can perform is limited. We can acheive more fine-tuned validation and better display of errors by coding validation into our backing bean.

For example, the converter checks that the birthday field is a valid date, but it doesn't check that the date was in the past. We are now going to check for this case in our custom validation and list any errors at the top of the page in a bulleted list.

  1. Open UserBean.java and make the following changes in bold:
    public class UserBean {
        
        private String name = "";
        private Date birthday;
        private ArrayList errors = new ArrayList();
        
    	...
    	    
        public String getErrors() {
            String message;
            if (errors.size() == 0) {
                message = "";
            } else {
                message = "<FONT COLOR=RED><B><UL>\\n";
                for(int i=0; i<errors.size(); i++) {
                    message = message + "<LI>" +
                            (String)errors.get(i) + "\\n";
                }
                message = message + "</UL></B></FONT>\\n";
            }
            return(message);
        }
        
        public String submit() {
            if (birthday == null) {
                errors.add("Valid birthday required");
            }
            else if (birthday.getTime() > new Date().getTime()) {
                errors.add("Birthday must be some time in the past");
            }
            if (name == "") {
                errors.add("Name required");
            }
            if (errors.size() > 0) {
                return(null);
            } else {
                return("submit");
            }
        }    
        
    }
  2. Open greeting.jsp and make the following changes in bold:
        <f:view>
            <h:form>
                <h:outputText value="#{UserBean.errors}" escape="false"/>
                <p>Enter your name: <h:inputText value="#{UserBean.name}" /></p>
                <p>Enter your birthday: <h:inputText value="#{UserBean.birthday}" >
                    <f:convertDateTime pattern="dd/MM/yyyy" />
                </h:inputText> (dd/mm/yyyy)</p>
                <h:commandButton value="Submit" action="#{UserBean.submit}" />
            </h:form>
        </f:view>
  3. Run the project and click Submit without entering any data. You get the following error:

    nicely formatted errors

About

johnc

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today