Easily Parse XML
No commentsHow to Easily Parse XML
XML is used a lot on the internet and in business . For instance, it is used by Blogs in a format called Real Simple Syndication, or RSS , to allow people to read a blog without actually visiting the blog’s website. XML is also used to store reference information in web services and configuration files on many open and closed source products such as Instant Messager servers , web servers , and Oracle’s SQL Developer .
Since XML has become so popular in recent years, there are tools for most languages that make XML pretty easy to parse and handle.
Here are 2 tools you can use to parse XML:
1) MagpieRSS for PHP
MagpieRSS is a great way to parse almost any format of XML clearly and concisely. Simply include the file "rss_fetch.inc" and then access the entire XML feed as an array.
From their example page:
<item rdf:about="http://protest.net/NorthEast/calendrome.cgi?span=event&ID=210257"> <title>Weekly Peace Vigil</title> <link>http://protest.net/NorthEast/calendrome.cgi?span=event&ID=210257</link> <description>Wear a white ribbon</description> <dc:subject>Peace</dc:subject> <ev:startdate>2002-06-01T11:00:00</ev:startdate> <ev:location>Northampton, MA</ev:location> <ev:enddate>2002-06-01T12:00:00</ev:enddate> <ev:type>Protest</ev:type> </item> Get’s parsed to: array( title => ‘Weekly Peace Vigil’, link => ‘http://protest.net/NorthEast/calendrome.cgi?span=event&ID=210257′, description => ‘Wear a white ribbon’, dc => array ( subject => ‘Peace’ ), ev => array ( startdate => ‘2002-06-01T11:00:00′, enddate => ‘2002-06-01T12:00:00′, type => ‘Protest’, location => ‘Northampton, MA’ ) ); 2) RSSutils Jar and Tag Library for Java First, download and unpack RSSutils from here . Next copyrssutils.jarandrsstaglib.tld into your/WEB-INF/lib directory. Then add the following to web.xml :<taglib> <taglib-uri>/WEB-INF/lib/rssutils.tld</taglib-uri> <taglib-location>/WEB-INF/lib/rssutils.tld</taglib-location> </taglib> Now you can reference the tag library in your JSP page similar to the following example: <%@ taglib uri="/WEB-INF/lib/rssutils.tld" prefix="rss" %> <rss:feed url="http://url/to/xml.xml" feedId="xmlFeed"/> <b>Image: </b><rss:channelImage feedId="xmlFeed"/><br> <b>Title: </b><rss:channelTitle feedId="xmlFeed"/><br> <b>Link: </b><rss:channelLink feedId="xmlFeed" asLink="true"/><br> <b>Description: </b><rss:channelDescription feedId="xmlFeed"/><br> <ul> <rss:forEachItem feedId="xmlFeed"> <li><rss:itemDescription feedId="xmlFeed"/><br><br> </rss:forEachItem> </ul> Make sure you come up with a unique feedId to use throughout the page, especially if you are going to be parsing multiple feeds on a single page. Read a much longer rssutils tutorial here .
Rounded Corners with The GIMP
No commentsCreating Round Corners
These days more often than not, people want rounded corners instead of the regular squares on images for websites, print work, and photographs.
It is true that this can be done in Photoshop and other expensive programs . However, why pay all that money when it can be done very easily with the open source graphic editing tool, The GIMP .
Step 1: Download The GIMP and Install
The GIMP runs on any operating system so you can use it on Windows XP, Windows Vista, Linux, and Mac OS X. Download The GIMP and follow the included instructions to install. Installation should be very similar to any other install.
Step 2: Open and Create Project Canvas
First, open up The GIMP in your respective applications folder and create a new project (say 800 x 600 pixels, the average website size).
Next, click on the Rectangle Select Tool in the Toolbar . If you don’t know what this tool looks like, mouse over each item until you find it. Hint: It is usually the first item in the Toolbox.
Step 3: Create a Rectangle
With the Rectangle Select Tool selected, draw a rectangle on the canvas.
Step 4: Change the Color
If you want to change the color of the rectangle, you should do this now by selecting a new Foreground Color and clicking on the Paint Bucket Tool (Hint: it is the one that looks like the paint bucket ). Once you have selected a color and the Paint Bucket, click anywhere within the rectangle.
Step 5: Round the Corners
Next, click on Select > Round Rectangle in the top menu above the canvas. Play with the radius settings until you get it just right. You can undo the rounded rectangle you just created at any time by selecting Edit > Undo . Remember, the larger the radius settings, the more round your rectangle will be.
Call Web Service in Java
No commentsConsume a Web Service with Java
As I stated before, calling a web service in .Net is easy . However, using a Java Web Service is a little more difficult . This is not because .Net is superior to Java, but instead because of the various standards that Java allows for since it is open sourced. In other words, Java can be extended and new standards can be developed, whereas Microsoft keeps tight control over their beloved .Net framework.
Step 1: Download and Install NetBeans
First you must download and Java IDE such as Netbeans , Eclipse , or Oracle’s JDeveloper . I have used all three and I would recommend NetBeans because I found that JDeveloper was a little behind on certian standards and Eclipse requires that you install additional plugins to allow you to develop with web services. However, the latest version of NetBeans (6.5 as of this writing) comes with everything you need to develop and consume web services, including a choice of embedded web servers for development.
Step 2: Create a Web Project and Web Service Client
Next, create a new Web Project by clicking File > New and selecting Web Project from the list.
Once it builds your project, you must tell NetBeans what type of project you are developing. You can do this by right clicking your newly created Project in the Projects pane and selecting New > Web Service Client . If I remember correctly, this is where a wizard will prompt you for the Web Service WSDL that you are wanting to call .
WSDL stands for Web Service Definition Language and is a document that is generated when you build a web service to tell the applications that want to use it what methods are available to use.
Step 3: Call Web Service
Once your project finishes generating the local methods for calling the external web service, you should see a tree option under your project entitled Source Packages . Open this tree item and all items below it and you should see a Java file "*.java" . Double click this so it opens, then right click > Web Service Client Resources > Call Web Service Operation .
Step 4: Modify and Test
Once the generation is completed, you should be able to reference the web service objects similar to the following:
WsNameOfService port = service.getWsNameOfServicePort();
boolean tf;
tf = port.isReady();out.println("Result: " + tf);
Enjoy and Good Luck!
Note: If your not getting the same menu items as me then you probably created the wrong project type in the first couple of steps. For instance, NetBeans may not allow you to create a Web Service Client in a regular Java project. Start over with a new project and ensure you are selecting the correct project types.
.Net Consume Web Service
No commentsConsume Web Service with .Net
During the past 8 months, I have been playing with web services quite a bit - both calling and developing web services for my employer. However, I had some trouble along the way finding information on the different standards of web services (such as JAX-WS and JAX-RPC ), implementing those web services on the server (Jboss) , and testing the services by writing a web service client (VB.Net) .
So I thought documenting the information I have collected would be useful for others attempting the same thing. The next series of posts will show you how to write, deploy, and consume web services using a combination of .Net and Java.
Consume a Web Service in .NET
Calling a web service in Microsoft .Net framework is super easy. Simply open a new or existing project, click Project > Add Web Reference , then enter the URL to the web service’s WSDL .
A WSDL is an XML document that is used to define a web service , such as Method Names and Parameters for those Methods. Don’t worry, you usually don’t have to write this document by hand. Yes, the programming gods have smiled upon us. Most IDE editors will do this for you including Visual Studio and NetBeans .
After entering the URL as suggested above, just follow the wizard steps and .Net will take care of the rest for you.
Once complete, you should see Web References in the Solution Explorer pane in Visual Studio. You can edit the Reference Name and URL in the Properties pane by clicking on the web service reference (whatever you named it) under Web References .
Now you can reference the web service object that you just created by typing "WhateverYouNamedIt. "
Go ahead and give it a shot!
The Breakdown of Modern Web Design
No commentsThis pretty much breaks-down a day in the life:
How to Succeed in Life - Through Famous Quotes of the Most Successful People on Earth
No commentsThis is a repost and a slight modification from my old website. I thought it would be useful to post again:
Years ago I made it my desire to be successful in life and be able to give back to the world. I was raised on the principle that you should leave the world a better place than when you came.
I have searched high and low, read books, magazines, websites, listened to podcasts, and watched videos seeking guidance in my goals to be, in the words of Borat, a “great success.”
Although the idea of success is different to every person - whether it be money, fame, or something as simplistic as to have a good family life. I have learned that the rules and advice to reach your idea of success are the same everywhere for everyone.
Below is a list of the most common advice that I have collected from those who have made it. Note that in order to make the list, the advice, or some variation, had to of shown up more than once and from more than one person.
So here it is, what one should do in order to become successful.
Convince Your Brain That You Are Already Successful (Think and Grow Rich by Napoleon Hill, Problogger.net)
I truly believe that the human mind is far more powerful than anything in the world. This is why navy seals can hold their breath for so long and why people can learn to ignore pain. With the proper training, you can train your mind to do about anything.
Convincing your brain that you have already achieved a goal makes you that much closer to it. I have learned that goals are much more difficult to achieve when they are placed up on a pedestal. Believing that you have attained them already keeps them on your level and makes them easier to achieve.
“In order to succeed, your desire for success should be greater than your fear of failure.” -Bill Cosby
Learn To Go With Your Gut Instinct (Anyone who has ever founded a startup)
I remember a high school teacher of mine telling me to always go with my first instinct on a test. Well the same rule applies in life and in business. Always do what feels right at the time. Although you probably won’t be right every time, you will be when it really counts.
“When in doubt, don’t.” -Benjamin Franklin
Life Is All About Relationships So Don’t Burn Bridges (Tina Seelig, Stanford Professor)
“The most important single ingredient in the formula of success is knowing how to get along with people.” -Theodore Roosevelt
You will run into the same people over and over again in life so you need to make good relationships now.
You are not going to like everyone and everyone is not going to like you, no matter how nice of a person you are or how much you donate to charity. Just take a look at Bill Gates. He and his wife probably donate more to charity than anyone, yet he still had a group of people who hate him.
“Don’t be so petty. Sometimes you have to do business with people you don’t like. It doesn’t mean you have to be like them or like them.” -Donald Trump
Learn to treat all people with respect, no matter what.
“When angry count to ten before you speak. If very angry, count to one hundred.” -Thomas Jefferson
Learn Everything You Can On Sales And Marketing
“Anything that won’t sell, I don’t want to invent. Its sale is proof of utility, and utility is success… The value of an idea lies in the using of it.” -Thomas A. Edison
No matter how cool the newest technology is, it is useless unless it provides value.
Would you use the slick looking iPod if it was difficult to use? What if it didn’t even play music? Would you use Google if you got back a “No results found” message every time?
Create things with value to the user in mind before anything else. Then learn to convey your message.
Many Ideas Come Out Of Something That Already Exists
Barbara Carey has used this concept to bring over 100 products to market and acquire more than a dozen patents.
“There’s a way to do it better - find it.” -Thomas A. Edison
Be Persistent (Napoleon Hill, Barbara Carey)
“I never did anything by accident, nor did any of my inventions come by accident; they came by work… Restlessness and discontent are the first necessities of progress.” -Thomas A. Edison
Successful people do not get that way accidentally nor do they usually achieve great success on the first try.
“All you need is ignorance and confidence and the success is sure.” -Mark Twain
Make Mistakes Then Learn From Them
“Show me a thoroughly satisfied man and I will show you a failure.” -Thomas A. Edison
If the answer is no, find out why. If you get the wrong answer, learn the right one.
“Success is not final, failure is not fatal: it is the courage to continue that counts.” -Winston Churchill
Know Your Weaknesses And Surround Yourself With Positive People That Can Do What You Cannot
This is similar to the “self-fulfilling prophecy” and why many people who are told that they will never amount to anything often don’t. If somebody tells you enough times that you are a mongoose, after awhile you will probably start believing them. Surround yourself with encouraging people that believe in you and you will believe in yourself.
If you are passionate about your idea, it is likely that others will be also and they will want to help you. Call on those people when you need them.
Learn To Say No
Saying no to someone is better than saying yes and not being able to give 100%. I used to think that I could and should do everything I had an opportunity to do, but have since learned that it is not possible.
“You can do it all, just not all at the same time.” -Tina Seelig
Try New Things And Keep What Works
“When I have fully decided that a result is worth getting I go ahead of it and make trial after trial until it comes.” -Thomas A. Edison
Ideas are like baseball, your going to strike-out more than you hit out of the park and your probably going to bat under .500.
“Results! Why, man, I have gotten a lot of results. I know several thousand things that won’t work.” -Thomas A. Edison
When You Are Ready To Quit, You Are Closer Than You Think (Bob Parsons, Founder of GoDaddy)
“Many of life’s failures are people who did not realize how close they were to success when they gave up.” -Thomas A. Edison
Many things that have failed could of succeeded with a little more effort.
“Our greatest weakness lies in giving up. The most certain way to succeed is always to try just one more time.” -Thomas A. Edison
Learn When To Call It Quits (Om Malik)
In contrast you don’t want to beat your head on to a wall repeatedly and expect different results.
As I said above, try lots of things and keep what works. If nothing works and your most creative part of your brain is exhausted. Maybe you should pull the plug. After all, the most important decision that we make everyday is what we spend our time on.
Never Miss An Opportunity
You never get a second chance to make a first impression. Always give 100%.
“Whenever you do a thing, act as if all the world were watching.” -Thomas Jefferson
Above is the advice that I have collected on my road to success, I hope it helps others as it has helped me.
USF Entrepreneurship in Applied Technologies ranked 5th in Princeton Review
No commentsSo I finally decided to take the plunge and get my masters degree - something that I have thought about since before I graduated from Florida Southern College. Up until last fall I hadn’t found a program that I really liked that was attainable.
After searching around, I stumbled upon the Entrepreneurship in Applied Technologies MS program at the University of South Florida. Princeton Review had the program ranked 9th in 2007 and 5th in 2008 for Entrepreneurship programs and Colleges and Universities. It was exactly what I was looking for and available 30 minutes from my doorstep!
Here are some excerpts from a recent St. Pete Times article:
USF launched its Center for Entrepreneurship in 2002 after decades of offering entrepreneurship courses within its traditional MBA program. It was recognized by the United States Association for Small Business and Entrepreneurship three consecutive years beginning in 2004.
Last year, the Princeton Review ranked it No. 9 in the nation after surveying entrepreneurial offerings from more than 2,300 undergraduate and business schools. In September, the Review named it No. 5.
What makes USF’s program different, says director Michael W. Fountain, is the cross-discipline involvement of the university’s colleges of business, engineering and medicine.
…
Among the more than 30 businesses launched by recent graduates is a health and fitness center, a bath and skin care line, and an independent record label.
All are important to the regional economy, Fountain said, since roots for home-grown businesses run deeper than transplanted ones and are better able to weather adverse economic conditions.
…
But there’s more to the program than starting new businesses, USF officials say. The program also teaches students how to strengthen the performance of existing companies, a talent that makes them attractive hires.
Love-Hate Relationship with Cell Phones
No commentsWith Kristi and I drawing to the end of our cell phone contract with Alltel, I am beginning to look at what other options are available to possibly switch from Alltel. The 3 problems we face by switching providers are:
Friends and Family
Most of our friends and family have Alltel also. This is nice because Alltel offers free cell-to-cell between Alltel customers. So, we can talk for free to just about everyone we talk to on a regular basis and, therefore, never come close to going over our minutes, even with my various business ventures.
Service Great, Phones Suck
With “smart” phones like the iPhone and the G1 from Google being released every few months, it sucks that Alltel is usually the last carrier to get the things the cool kids are using. But in the same breath, my phone has bars where many friends do not get service with carriers such as AT&T, Verizon, and T-Mobile.
Where I Live
I just found out that T-Mobile does not have high speed towers in Central Florida so if I got the G1 we would not have access to many of the advanced features. Asside from that is the alternative of getting an iPhone. They are probably the slickest of the bunch but the plans are over-priced and I swore I would never return to AT&T. I am anxious to see what the new Blackberry looks like and if it solves my problems. (Note: This was written before it’s release)
*UPDATE*
Verizon and Alltel Merger
Now that Verizon and Alltel are joining forces, I think we’ll wait and see what they offer. Last I heard, the merger will commence sometime during mid January. I hope it doesn’t take as long as the AT&T/Cingular merger.
Ignorant People Should Not Vote!
No commentshttp://www.bpmdeejays.com/upload/hs_sal_in_Harlem_100108.mp3
After listening to this the other day, I thought of a brilliant idea. Why not put a simple but relevant 5 question quiz at the top of every ballot and if you cannot get at least 3 questions correct then your vote doesn’t count. This will ensure that only informed people vote. This example is against Obama but I’m sure this kind of ignorance happens on both sides of the coin. Trust me, I live in Central Florida. I see it daily.
Disclosure: Personally, I like both Obama and McCain. I just feel people should be educated before making decisions like this.
iBrowser - Free Image Uploader for Tiny MCE (and SPAW, FCKeditor, Xinha, and HTMLarea)
No commentsI, like many other people, did not realize that TinyMCE did not include the image upload plug-in as shown in the full featured example. But after using TinyMCE for quite some time without the image upload feature, I became comfortable with the interface and the source code, and was hesitant to switch.
In the forum I came across a third party plug-in iBrowser written by Jaeger Consulting that works with Tiny MCE, SPAW, FCKeditor, Xinha, and HTMLarea.
The readme is vague at best and doesn’t offer any solutions to troubleshoot problems. Of course, the plug-in didn’t quite work right out of the box. Following are the steps I took to implement iBrowser.
- Download the latest version of both iBrowser (1.3.8) and TinyMCE (3.1.1 at the time of this writing)
- Upload the “ibrowser” directory to the TinyMCE “plugins” directory
- Create one or more directories to store uploaded images and edit config/config.inc.php
$cfg['ilibs'] = array (
array (
‘value’ => ‘/path/from/webroot/images/’,
‘text’ => ‘Images’,
),
array (
‘value’ => ‘/path/from/webroot/gallery/’,
‘text’ => ‘Gallery’,
),
);
- Ensure that ibrowser/scripts/phpThumb/cache, ibrowser/temp, and your image directories have write privilages (i.e. 755).
- Copy the file ibrowser/interface/tinyMCE.editor_plugin.js with your corresponding version number to ibrowser directory. If your version number is not there, use generic javascript file without the version number.
- When you include TinyMCE in a page with javascript (tinyMCE.init), make sure that the following options are included.
tinyMCE.init({
...
plugins : "ibrowser",
...
theme : "advanced",
theme_advanced_buttons3_add : "ibrowser",
});
- If you included everything correctly, you should see a new icon in your editor. If you don’t, you are either using an incompatible versions of TinyMCE/iBrowser or your paths are wrong. Try the other TinyMCE Javascripts and double check where the iBrowser directory is located. It should be in the plugins directory of TinyMCE. If that doesn’t work, download a version of TinyMCE that is compatible with iBrowser (see interface directory).
- If you do see the new icon but nothing happens when it is clicked then you must add a line to the begining of the javascript file you are using.
var ib = null;
- If you open iBrowser, click Insert, then click Upload and you do not see a green icon with a white arrow to the right of the Browse button then you must modify ibrowser.php to have a smaller input box, say 40 instead of the default 53. This uncovers the upload button.
<input name=”nfile[]” type=”file” class=”fldlg” id=”nfile[]” size=”40″
- That should be all you need to enjoy the benefits of uploading images to web pages with iBrowser. Let me know if anyone else finds any other problems that I didn’t address. Enjoy!


