jeffcogswell 175 Light Poster Featured Poster

This is a topic near-and-dear to my heart. Although my day job is development, I supplement my income through writing. Like other people, ads drive my crazy. Yet, in the past ads were what allowed sites to pay me quite nicely to write for them. Now we see sites giving 3 or 4 "free" articles per month, after which you have to subscribe. Or we see sites pop up a huge message asking us to disable our ad blockers to continue. People hate ads; and now ads aren't working anymore. I don't actually subscribe to any online magazines, so I only get to read their articles a couple times a month. But one thing I do take part in is patreon. I follow a lot of Youtube people, and now I donate between $5 and $10 per month to many of them on their patreon page. Their content is still free for everyone, but by donating through patreon, often I get content before other people. Or just a warm fuzzy feel-good feeling that I'm helping out. So long story short, I'd be all for a $5 per month, provided the content is still open and free for everyone; maybe the $5 could provide some additional perks (not sure what though...).

jeffcogswell 175 Light Poster Featured Poster

SQL Server is touchy about the names. Depending on how it's configured you may or may not be able to just use an IP address like you're using in the connection string. When I'm faced with this, I first try to make sure I can connect to the server using SQL Management Studio. First try it with the IP address like in your connection string. If it doesn't connect, you'll need to check the actual name of the server and try that. Then if Management Studio can connect, you know you're good, and you can paste the name back into your connection string.

Also, just a thought as I look again at your connection string. It looks like you have both integrated security (which refers to logging in with your existing Windows account), as well as a username/password. I'll need to check, but I think you shouldn't have both. (I might be wrong there, though.)

jeffcogswell 175 Light Poster Featured Poster

Since you're incrementing by two, you're basically skipping the final \0. Look at when you get to the 'Y'. You print that out, and then you go two more, which puts you one past the \0. So your test (letters[i] != '\0') never sees the \0. It sees the one before it, and whatever is in memory after it, and it eventually stops when it happens to see another \0 in memory.

jeffcogswell 175 Light Poster Featured Poster

Here are two references for learning regular expressions, one site and one book. I recommend you get the book and study it, and also study the site. The site is www.regular-expressions.info. The book is called Mastering Regular Expressions.

jeffcogswell 175 Light Poster Featured Poster

I'll probably just insert the markdown myself. I do my professional writing in the word processor and copy it over. (I have a version control system and entire workflow set up for it. :-) )

jeffcogswell 175 Light Poster Featured Poster

I agree! Creating things is what it's all about!

jeffcogswell 175 Light Poster Featured Poster

Do you know if there's any macro or something that will take a Word doc and convert it to Markdown? When I uploaded my tutorial a couple days ago, it took a really long time to copy and paste from the word processor, especially in places where there was a lot of code and text interspersed. I guess though I could put the markdown marks right in my doc and then just paste the whole thing in...

jeffcogswell 175 Light Poster Featured Poster

Also, here's another thought about why I like this library. I'm building a pretty big app right now that runs in the browser, with about ten thousand lines of JavaScript. Throughout the program, I have many dialog boxes. By using this library, I can bind every dialog box to a JavaScript object. When the user fills in a dialog box and clicks OK, I don't need to go through and gather up the values for all the text boxes and drop downs. The data is automatically in my objects, ready for me to process. And similarly, if the user needs to edit existing data, I don't need to write code that prepopulates the form fields. I just push the data into an observable with one line of code, and the fields get filled in automatically with no work from my end. Then when the user is finished editing the data, again I don't need to do anything. My data structure is automatically filled in for me. This has saved me a huge amount of coding.

jeffcogswell 175 Light Poster Featured Poster

Well I'm not necessarily saying it's better. But I've found it has greatly sped up my development time. I'm creating data-bound user interfaces much more quickly than I used to for the web, more like in my days as a desktop software developer. And for me personally, the non-obtrusive JavaScript thing really isn't an issue. When desktop development started offering data-bound controls, life got much easier for many of us. And that's what I see here. I really don't have a problem if there's an intrusive or tightly-coupled aspect between the UI and the data structures. I'm not building my UIs to be reusable anyway. But that's just my own opinion. Others might differ. (And thanks for replying! I wasn't sure anyone was going to. :-) )

jeffcogswell 175 Light Poster Featured Poster

This is actually a really good discussion, something I suspect a lot of beginning and even intermediate programmers might be wondering about. I think I'll write my next Tutorial about this topic. (I work for Daniweb as a volunteer.)

jeffcogswell 175 Light Poster Featured Poster

So you don't actually have to copy it into the heap. It gets created there.

jeffcogswell 175 Light Poster Featured Poster

Oh! Sorry, I guess I didn't explain that. When you call malloc in C or new in C++, it gets created on the heap and you get a pointer to its location in the heap.

jeffcogswell 175 Light Poster Featured Poster

No, when it's on the heap it stays right there and the main and other functions just access it through the pointer. The pointer gets passed around and anyone can use it.

jeffcogswell 175 Light Poster Featured Poster

Correct, except for the part about the pointer. When you allocate something on the heap, the heap stays around and is there for all the functions to share. (In C, I think you use "malloc" to allocate it on the heap. I haven't done straight C in years though.) So what you do is this: In your function, you allocate the structure on the heap, and get back a pointer to that structure. At the end of your function, you return the pointer. The code that called the function gets the pointer to that same spot on the heap, and continues working on the structure. So that's actually a good bit more efficient. Also, if you're doing C++, by calling new, your object automatically gets allocated on the heap and you get back a pointer to it.

jeffcogswell 175 Light Poster Featured Poster

Do you want to actually copy the data from one table to another or just display it on the screen that way? If you just want to display it, you might consider creating a view in the database.

jeffcogswell 175 Light Poster Featured Poster

When you have a function in C (or C++), the function gets an area of memory on the stack to use for its local variables. If you create a variable like this:

MyStruct X;

inside your function, then the X structure will get created on the stack. If you return the variable like this:

return X;

then when the function ends, the code can't return the actual structure that's on the stack, since that stack space goes away (out of scope). So the code will actually create a copy of it and return that copy by copying over the members. However, the way around that is to allocate the structure on the heap, and instead pass around pointers to that structure. Then you're always working with the same copy. (In C++ you can accomplish this same thing using the new keyword.)

Does that help?

Jeff

jeffcogswell 175 Light Poster Featured Poster

This might help, at least with some of it. This is an article I wrote about page transitions. The main topic is local storage, but I also get into the animations. Perhaps if there's enough interest, I'll write more on this here on Daniweb.

http://html5center.sourceforge.net/blogs/Local-Storage-with-HTML5-Heres-How

jeffcogswell 175 Light Poster Featured Poster

As I spend time in the Daniweb forums, I see some questions that ultimately come down to the issue of manipulating JavaScript data and a user interface on a website. When you build a GUI that lets your user view, add, edit, and delete data, a common approach is to spend a lot of time copying data back and forth between the JavaScript variables and the user interface. Further, this often involves managing the user interface, such as adding new elements as new data is added.

However, often people perform extra work that isn't necessary. In addition to the extra time, such work usually means writing extra JavaScript code, which opens up room for more bugs. It turns out that there are several JavaScript libraries that are well written, heavily tested, and do a fine job of simplifying what I'm describing here.

One such library that I personally like is called Knockout, which you can find at knockoutjs.com. Other libraries work well, too; I just find this one to be more suited to my tastes. In this tutorial I'll show you how to get up and running with it.

A basic model

First let's build the basic data structure. I prefer to start there, with the data modeling. For this example we'll create a simple array that holds information about US presidents. Each item in the array will have a first name, a last name, and a number representing the order of the president, with George Washington being 1:


       
jeffcogswell 175 Light Poster Featured Poster

Are you using jQuery? If so, they have an example that uses the jQueryUI autocomplete and does basically what you're describing: http://jqueryui.com/autocomplete/#multiple-remote

jeffcogswell 175 Light Poster Featured Poster

That's the error I'm seeing. But it looks like when you call FB.init, you're not passing in your app id:

FB.init({channelURL: 'http://www.daniweb.com/js/fb_channel.html',
    status: true, cookie: true, xfbml: true});

There's supposed to be an appId member in the object you're passing to the init function.

jeffcogswell 175 Light Poster Featured Poster

Your code almost worked for me, except I had to change line 9 to remove the moveFromTop animation. After that fix, it completely worked:

$(".navigation li a").click(function() {
    var currentId = $(this).attr("href");
    $('.current').removeClass('pt-page-moveFromTop').addClass('pt-page-moveToLeftFade').removeClass('current');
    $(currentId).addClass('pt-page-moveFromTop').addClass('current');
});
jeffcogswell 175 Light Poster Featured Poster

Dani, did you get this worked out? I'm not seeing this error. I'm using chrome, but I am seeing a couple other FB errors.

jeffcogswell 175 Light Poster Featured Poster

Hi! The problem is your overflow:hidden is hiding it. Get rid of both of those (lines 38 and 53 of the CSS file). But then your layout will be thrown off, so add a min-height:83px to your body > header. Then it will work. :-)

jeffcogswell 175 Light Poster Featured Poster

Yeah, as Pritaes said, use $.ajax and add the option cache:false. What jQuery does in this case is adds a random, unused number on the end of the query string. That effectively changes the URL, and as such the browser performs the request without caching. Something like this: $.ajax({url: 'url', cache: false, success:function(data) { console.log(data); } })

jeffcogswell 175 Light Poster Featured Poster

A minor update to the 1.6 version of jQuery was just released today. After a big outcry of version 1.6's changes to the way properties work, the jQuery team quickly released version 1.6.1 to make the new techniques more compatible with the older functionality, hopefully preventing sites from breaking. The release also fixed some bugs, as did version 1.6.2.

And now 1.6.3 also fixes several bugs, along with one change that some people will find disappointing: They dropped support for the requestAnimationFrame API. When 1.6 came out, support for requestAnimationFrame was added to allow for smoother animation. However, requestAnimationFrame itself has some issues, and as a result it didn't carry forward very well into jQuery. People were reporting problems with the way some animation would wait to occur, and then would run through the whole sequence at an extremely fast speed. (They called it a wormhole.) So the jQuery team decided the jQuery world would have to wait, and they completely dropped requestAnimationFrame from jQuery. They're hoping they can re-introduce it after they get the kinks worked out. (Of course, requestAnimationFrame is still there, just not a part of jQuery, so you can still use it yourself.)

In addition, there are a few minor fixes. There's a security fix to help prevent script injection. When you precede a selector with a # (which is used for specifying IDs), the jQuery library won't allow HTML tags to be in the selector. The whole list of bug fixes is pretty …

jeffcogswell 175 Light Poster Featured Poster

People who know me know that Python has always been one of my favorite languages. And over the years, I've been pleased with the array of development tools that have been created for it, including the different IDEs.

I also do a lot of work in .NET, primarily with C#. And although I once wrote a raving review of the .NET implementation of python called IronPython, truth be told, I never use IronPython anymore. Not at all. In the past, oh maybe four years, I've created a grand total of two IronPython programs, each consisting of maybe three lines of code, just to try it out. As such, I've had little use for the IronPython tools for Visual Studio, which is a tool that lets you develop and debug IronPython code from within Visual Studio. Instead, when I use python, it's the original python, called CPython (because it's written in C), that I use. And when I want to target .NET, I use C#.

And so while the IronPython tools for Visual Studio have sat idle on my computer, I'm certainly open to a new tool put out by a team at Microsoft called Python Tools for Visual Studio. Why? Because it supports CPython, not just IronPython. The tool is free and open source, and it works in any of the non-free versions of Visual Studio, or with the free, standalone Visual Studio Shell. Let's take it for a test drive.

Trying Out Python Tools For Visual Studio

First, in …

Gribouillis commented: very nice review +13
jeffcogswell 175 Light Poster Featured Poster

Every year or so for the past couple of decades I've seen new products appear that claim to let you create software without having to know how to code. And every time the next one comes out, I roll my eyes, because they always fail to deliver as promised.

Usually the concept is the same: You use a tool to design your data, and some other tool to draw out the screens. Then you get a program. The program automatically gets the basic database functionality: A data browser, a data entry form, a search form. But the problem is the moment you want to take the app to the next level and add more sophisticated features, you hit a roadblock. I've seen this all too many times, from tools that claim to be for non-programmers, to more sophisticated tools that claim to be RAD (Rapid Application Design).

Last week, Microsoft released yet another product into this space. It's called Lightswitch, and it actually runs inside Visual Studio. When I heard about it, I downloaded it, installed it, tried a couple quick tests, and was tempted to write a three-word review: This product sucks.

But then I started using it more, trying out more things. And I became a bit more intrigued. Now I have to be honest: My ego really wants to hate this thing. I really want to say that this thing is a joke and will bomb. But to be totally honest, it's actually proving to be pretty …

jeffcogswell 175 Light Poster Featured Poster

A couple weeks ago, Microsoft Research made available a project that had been under development for a while called Debugger Canvas. This is a visual tool for debugging applications where your functions appear as bubbles, similar to a database diagram or UML diagram. It only works on Visual Studio 2010 Ultimate due to the fact that it uses some internal features that are only included in the Ultimate edition.

Because Debugger Canvas is a project of Microsoft Research, it's not "official" in that it's not actually a part of Visual Studio, nor is it an official, supported Microsoft product. And it contains bugs. It's the culmination of research and development, and is a prototype of sorts. It's buggy, and it doesn't quite do everything you might want. But nevertheless, it's pretty cool and you'll want to try it out. (And there's a good possibility it'll be part of a future version of Visual Studio. Several projects in Microsoft Research have become actual, official Microsoft products. Perhaps the biggest one right now is the Kinect.)

Normally when I do a product review, I try to give about 3-5 screen shots, because more than that gets a little cumbersome. But this time I'm going to break that rule, and instead go with the old saying that a picture is worth a thousand words.

To get going, I created a short console program with a class, a derived class, and a main that creates an instance of the derived class. I set a …

jeffcogswell 175 Light Poster Featured Poster

Thanks, Abe, for the correction. So the price I found included support. I'll have the editors at DaniWeb put in a correction to the article. (To others reading this, if you check the box on the page that Abe provided that says "Purchase Licenses & Support Separately" then you can see the 329 price.)

Thanks!
Jeff

jeffcogswell 175 Light Poster Featured Poster

Back around 2004 and 2005, I had embarked on a web project that included the ability for my users to draw on a web page—or at least, that was one of the requirements. At the time, most of my web development had been server-side, with very little JavaScript. Long story short, I ended up shelving the project—not because the project wasn’t a good idea (it was a project planning and collaboration tool), but because the browsers simply weren’t up to it. I explored numerous libraries for drawing on the browsers, but talk about a major headache. The reason for the trouble was simple: Some browsers didn’t include any drawing support and instead required a plugin, and other browsers had built-in support but there was no common standard. Firefox used SVG, but to use SVG in IE, you needed a plugin. But the only decent plugin was created by Macromedia, but they got bought by Adobe, and they shut down the project. Instead, with IE, you had to use Microsoft’s own technology, VML.

To this day, it astounds me that Microsoft refused to include support for SVG in their earlier browsers and instead tried to embrace their own proprietary technology (which is actually nothing unusual for them.) And I suppose Adobe might have seen SVG as a threat to Flash, which they also acquired when they bought Macromedia, and perhaps that’s why they shelved the SVG plugin. But SVG was—and still is—an excellent technology dating back to 2001. Either way, SVG …

jeffcogswell 175 Light Poster Featured Poster

Yes, good one! For the other people reading this thread who might be new to jQuery, what Airshow is saying is absolutely correct. When you call $() (which is shorthand for jQuery()) you get back a single object. That single object contains a list of references to elements that matched your selector. So, for example, if you call:

var x = $('div')

you'll get back what appears to be a list of all the divs in your document. In fact, what you're actually getting back is a single jQuery object that contains a list. That list holds references to your div elements, and that list might have zero items, one item, or many items depending on your document. Or if you call

var x = $('.MyClass')

then you'll get back what appears to be a list of all the elements in your document that have the class MyClass. (The dot in '.MyClass' means class.) But regardless of how many elements you have, you're actually always getting back a single jQuery object. The reason is that you can do further operations like this:

$('.MyClass').click(function() {
});

Conceptually, this calls the click function on each element that you get back, assigning the passed-in function as a click handler for each element. But in reality, you're calling the click function on the single jQuery object you get back: The $('.MyClass') call returns a single object, and that object has a member function called click. You're calling …

jeffcogswell 175 Light Poster Featured Poster

...in fact, a quick correction to my last comment, when I said "might" contain a list, in fact, it always contains a list; the list might contain only one element. --Jeff

jeffcogswell 175 Light Poster Featured Poster

Hi Airshow,

Excellent, YES on all counts! You're absolutely correct. What I'm passing in is, in fact, a single jQuery object that contains a list of references. For that matter, I'm glad you brought that up, because it's easy for people new to jQuery to forget that the call jQuery() or $() returns a single object which in itself might contain a list. And that, of course, is how chaining like $('div').a().b().c() works.

Jeff

jeffcogswell 175 Light Poster Featured Poster

Steve, thanks for the tips! I can probably post some of my own jQuery tips here, and maybe others can too and see what we can come up with. (I'm on a tight deadline right now, but it would be fun to do that this weekend.)

Jeff

jeffcogswell 175 Light Poster Featured Poster

I'm Jeff Cogswell, and I wrote the article. I don't have anything to do with the programming of this web site. Is there an error in the article? If so, let me know and I'll fix it. Thanks!

jeffcogswell 175 Light Poster Featured Poster

I've been using jQuery for a few years now, and the more I use it, the more I like and appreciate it. It seems like I'm always finding new ways to use it, and usually those new techniques result in me writing less code and ultimately being more productive. On May 3, jQuery 1.6 was released; then almost immediately, on May 12, came a new patch for this major release called 1.6.1.

The 6.1 release included a major change to the way jQuery handles attributes, and a lot of people were upset about the change, as it had the potential to break earlier code. But the jQuery team heard the gripes (unlike a certain giant company called Facebook), and responded by fixing it, allowing you to continue using jQuery the way you had before, while also allowing for a new way of using it with what are called properties. In this review, I'm going to look at that in more detail.

But first, speaking of updates breaking older code, I've seen people online ask how to write their code so that their HTML files always include the latest and greatest jQuery, without hardcoding a particular version. My response has always been that that's a bad idea, and the release of 1.6 shows just why that is: If you wrote some JavaScript code to always include the latest and greatest jQuery, and you have that code live on production server, there's a possibility that your site would have broken when 1.6 …

almostbob commented: Thankyou +13
jeffcogswell 175 Light Poster Featured Poster

Update! Hey everyone, this is Jeff, the author of this article. The very friendly NS Basic people contacted me right after I wrote this article, and provided some clarification regarding the use of Basic. Turns out there's an option to choose all JavaScript, and I missed it. Click on the project in the name in the Project Explorer, and then in the Properties window there's an option called Language. Click JavaScript and now it's all in JavaScript. Very cool! Now that gives me a bit more incentive to try out NS Basic for my client development.

Also, here are a couple tutorials they pointed me towards that provide some communications examples like I mentioned in the article:

http://www.nsbasic.com/app/tutorials/TT07.htm
http://www.nsbasic.com/app/tutorials/TT09.htm

jeffcogswell 175 Light Poster Featured Poster

UPDATE: see author's comments after article

When you develop for mobile devices these days, you pretty much have two paths you can take: You can use the OS manufacturer's SDK and develop native apps, or you can create an application that runs in the device's web browser.

Developing for the web browser is often an easier path for many reasons. First, you can bypass any restrictions put into place by the app's marketplace. You can just post a link to the site hosting the app. Then the app, which is written in HTML and JavaScript, will just run in the browser. If the device is an iPhone, for example, you just give the URL to your clients, and Apple never has to approve the app before it will run.

It's also easier because you can develop on nearly any desktop computer. If I want to develop an iPhone app, I don't need the SDK that runs on a Mac; instead, I can create the application right on my Windows desktop.

And finally, once I do develop the app, if I stick to web standards, it should (in theory) run on any modern mobile browser. (And many mobile browsers are incredibly advanced. For example, the iPhone browser supports a huge amount of HTML5, and did before most desktop browsers did. For at least a time, it was one of the most advanced browsers around.)

For me as a web developer, this is a much more enticing approach to developing an application. …

jeffcogswell 175 Light Poster Featured Poster

re - buggy vs solid

I just mean solid design, but buggy code because it's still in beta. Whatever. No big deal.

re - cloud

What I'm really talking about is a type of hosting where your servers can grow dynamically. Originally, that's all the term meant. As you already know, in the past, when you would rent server space, if you rented a virtual private server, you would get a fixed portion of a server under which your OS would run. With a resource-intensive OS like Windows, the result was extremely poor performance. But then they came up with a different type of virtualization whereby resources could be added dynamically, and the server itself could grow automatically as needed (or you could manually modify the amount of space dynamically). Originally, that's all "cloud" meant before marketing people and tech journalists latched onto the term and destroyed its usage.

In this article, I only used the word "cloud" once (other than the name of the product) and that was here:

"One of my hosted cloud servers is a Windows 2008 server, and I can easily remote in and get to work."

And that's what I'm referring to. I'm talking about what we techie people call hosting, but not just any kind of hosting but specifically one that uses hypervisor virtualization and methods for adding memory and other resources dynamically as needed. Unfortunately, marketers and even tech journalists have grabbed the term "cloud" and used …

jeffcogswell 175 Light Poster Featured Poster

When I first started working on this article, I was originally planning on reviewing a different product, a new project from Eclipse called Orion. However, it turns out that project just isn't ready for prime time. It's still in a very early stage, and I don't feel I would do it justice by reviewing it yet. But while I was reading about it, I realized that a new product that I had already known about had just officially been released. That product is called Cloud 9 IDE.

Now right up front I want to point out that even though Cloud9 has been officially released, it's still kind of buggy. But after spending several days using it, I have to say it is, nevertheless, very solid and something I'm certainly excited about.

What exactly is it? It's a full IDE for developing software that runs completely in the browser. Or, at least almost completely in the browser. But I'm getting ahead of myself. Let's take a look at it.

The main web site is www.cloud9ide.com . You can sign up for a free account, or a commercial account. Free accounts are only for testing or for developing open source apps. If you want to develop commercial apps, you need to pay for a subscription. And either way you can download the full IDE and run it on your own server, which is what I ended up doing.

It's primarily intended for developing web applications using server-side JavaScript, specifically Node.js. …

jeffcogswell 175 Light Poster Featured Poster

IE9 is on the horizon, and there has been plenty said about it. But what about its web development aspects? In this article I look at its web developer tools, and decide whether I'll start using it in my own web development.
Like most web developers, I abandoned IE several years ago, only using it when I have to fight with cross-browser compatibility issues (which, thankfully, have mostly gone away thanks to third-party libraries such as jQuery, where other people took care of the cross-browser headaches for me). At some point with an earlier version of IE, Microsoft managed to catch my attention very briefly when they announced their "Developer Toolbar." But after a bit of toying with it, I discovered it was just that--a toy.

Instead, like most web developers, much of my in-browser development time is spent using Firebug, the fantastic add-in for Firefox. (Firebug was, in fact, created by Joe Hewitt, who was involved in early Firefox development.) After Firebug had been around for a couple of years, the Chrome browser was released, and it has a built-in "Developer Tools" window, which is very similar to Firebug. Both work great, and in the past few months I've been spending more time in Chrome's debugger, trying to decide which I like better: Firebug of Chrome.

And now along comes Internet Explorer version 9. The official release isn't out yet, but it's coming soon, as the release candidate is out. The good news is that IE finally …

jeffcogswell 175 Light Poster Featured Poster

Last week, I took a look at Node.js, a powerful server-side implementation of JavaScript. But one thing I found lacking was the way to easily create a web server. Essentially, Node is an implementation of CommonJS, which adds operating systems features to JavaScript. But Node is not a web application framework. If you want to build a web application in Node, you either need to do a lot of coding, or find a good framework that somebody else built. And that's what I found here—a framework called Express.js.

In four words: This thing is sweet. Let's take a look at it.

I've done a lot of web application development, mostly with PHP or C#/ASP.NET, so I'm able to compare express.js to those platforms. And I can say that the creators of Express.js (who includes the creator of Node.js) have done an awesome job putting this thing together.

First off, you have to download it, adding it to your Node installation. The instructions are on the web site , so I won't repeat them here, except to say that you need to follow the steps exactly as shown on the installation page. Next, you have to install a view engine called Jade (along with a replacement to Jade that I personally prefer; more on that shortly).

After all is installed, and the node installation directory is added to your path, you create a directory on your Linux box. Then, at the command prompt, simply type:

express

This …

kvprajapati commented: nice post! +12
jeffcogswell 175 Light Poster Featured Poster

. Some more HTML follows, and then the original requested URL gets written out, mainly as a demonstration.

The original call to createServer returns a server object, and then we call that object's listen method, which you can see in the line second from last. This call says to listen on address 127.0.0.1 via port 8124. (Normally web servers use port 80; I used the same address in the example that came with node for this sample.)

And the final line writes a quick message to the console—this information doesn't get written to the web browser, but rather the console in which this program is running.

To run the program, you go to the directory where you saved it, and type (assuming the code is saved in the file called example.js, and that node is available in the path):

node example.js

Here's the full session running in the Linux command prompt window: webserver.png

This is the web server itself running. Let's try it out. I opened up a web browser and put in the following URL: http://127.0.0.1:8124/hello/there/everyone

Here's what I saw in my browser:

browser1.png

Notice that I put in the same address and port as specified in the code. When I right-click in the browser and click View Source, here's what I see:

Greetings
/hello/there/everyone

Dani commented: Pretty interesting :) +25
pritaeas commented: Nice tool indeed, I agree with your rating. +7
Airshow commented: Well written and informative article +3
kvprajapati commented: Good post :) +12
F-3000 commented: Well written and interesting +1
jeffcogswell 175 Light Poster Featured Poster

Netbeans is a free, open source IDE for developing software in Java. It's been around for almost 15 years, having gotten its start around the time Java began. Version 7.0 is about to be released, and I got my hands on the Beta release of this new version.

In the past I've generally preferred Eclipse for my Java development—not because I felt it was necessarily better, but simply it's what I used at various jobs and grew accustomed to. So I didn't spend much time on NetBeans. But they do have a lot in common. One common element is that you can now use both of them for more than just Java development. NetBeans supports development in several languages, including PHP and C++ (as does Eclipse). And also like Eclipse, NetBeans is itself written in Java.

Rather than try out the whole product and review it here (which would basically be re-iterating what's been written all over the place), I wanted to just focus on the new features.

According to The Great Wikipedia, the all-knowing, always correct reference guide (he said sarcastically), NetBeans was originally code-named Xelfi, to sound like Delphi, but with an X for Unix. Indeed, the Wikipedia page points to the original home page for NetBeans, which also says it was called Xelfi. I'm not sure if they meant Delphi as in Borland Delphi; but what makes that timely for today is that Borland Delphi went on to be a great RAD tool with a full drag-and-drop …

jeffcogswell 175 Light Poster Featured Poster

Good point! The eval version should work just fine. Thanks for the tip!

Jeff

jeffcogswell 175 Light Poster Featured Poster

Last week, Microsoft released a set of tools for developing software for the new Windows Phone 7 using Visual Basic. In order to use the tools, you have to have Visual Studio 2010 Professional or better (right now the Express versions don't work, although I've heard that will change).

But here's the catch: You're coding for Silverlight. You're building Silverlight apps that run on Windows Phone 7. However, that's not necessarily a bad thing. Normally I have my reservations about Silverlight in browsers on desktops, because that's just one more runtime that needs to be downloaded and installed next to, for example, Flash, Java, and all that. And while there are versions of Silverlight for Linux (called Moonlight), those versions are always a bit behind, making it hard to ensure that your Silverlight application runs in all browsers on all platforms. But in the case of Windows Phone 7, that whole issue goes away: You're writing an application just for Windows Phone 7, which has Silverlight built right into it.

Nevertheless, on a recent job, I had to develop a set of Silverlight apps, and I have to say, even though I have the concerns I just mentioned, it's great to program for. If you've done any ASP.NET programming, you'll feel very much at home. You use a declarative syntax similar to ASP.NET for laying out your GUIs, a syntax called XAML (pronounced Zamel, rhymes with Camel). And then you attach code to them, where you can use either VB.NET …

kvprajapati commented: Good article. +11
jeffcogswell 175 Light Poster Featured Poster

This past Summer, Microsoft announced the beta of a new product called WebMatrix. Two weeks ago, the third beta came out. But before I talk about it, I have to ask: Is this a new product? Or am I having déjà vu? webmatrix2.png WebMatrix (one word) is, in fact, a brand new product from Microsoft (contrary to what some tech journalists have reported), even though the name has been recycled from an earlier web development tool called Web Matrix (two words) that many of us remember dating back to the around 2003. That earlier product has very little in common with this product, and is, by all regards, not the same thing. Only the name has not been changed! (And by the way, at the time of this writing, if you Google WebMatrix and end up on Wikipedia, be warned that the article confuses the two products.)

This new WebMatrix is a sophisticated IDE for creating web applications with the focus audience being beginners. But don't let that sway you from learning some of its features, because, in fact, WebMatrix has some new features that are going to find their way into ASP.NET. And so in that regard, I'm encouraging programmers to view WebMatrix as a test bed for future ASP.NET features, at least for now. As for WebMatrix itself, I'm personally skeptical of its future. It seems to have a sharp learning curve for beginners, and, as I've seen other people note elsewhere, if it does …

kvprajapati commented: (: +11
jeffcogswell 175 Light Poster Featured Poster

Here's the Einstein fellow! Thanks to google image search.

jeffcogswell 175 Light Poster Featured Poster

There were other options besides just the paper clip. There was this pretty cool Albert Einstein character.

jeffcogswell 175 Light Poster Featured Poster

The other day Google announced a new API console to simplify working with their various APIs. These APIs are basically REST-based calls into the Google servers where you connect through a URL, passing different parameters in the URL itself, and get back a response. The response comes back as either XML, or as JSON, which is ideal for a client-side JavaScript program. (Although most server-side languages such as PHP and C#/ASP.NET provide parsers for JSON as well, so you can process the results on server-side if you prefer.)

As has been the case since the early days of the Google API, you must include an API key. That way Google knows who is using the APIs and can put daily limits so you don't slam their servers.

Much of this is nothing new, but what is new is the addition of the API console as well as two new APIs, a Custom Search API (which replaces the previous Web Search API), and a new Translate API, which is a brand new replacement for the older translation API.

I took the console and these two of these new APIs for a quick spin so I could report them back to you.

The console is incredibly easy to use. It's just a web page that you log into with your Google account, and offers several links for activating the different APIs (and not just the new APIs, but several others as well, including Buzz API, Moderator API, and others).

Initially you're …