QWANtify is excited to announce, effective May 1, 2010, their purchase by Safe Bridge Solutions, Inc. of Madison, WI. Read More »

From the QWANtify Blogs

Factorial Fun

I just got back from Narglethorpe; at least I’m pretty sure it wasn’t a dream. One of the most spectacular animals on the island is called “The Beast of Narglethorpe” or TBON. Now, local legend has it that TBON has some interesting properties. If a person were to come upon this ferocious beast and call out a number, the beast will undergo a miraculous transformation in which it splits up into numerous other (albeit smaller) TBONs based on the number called out. Facing the possibility of being eaten by the beast, I decided that there was scientific merit in trying to verify the legend. So, armed with a machete, some camouflage, and a camera, I wandered into the jungles of Narglethorpe. The foliage was so dense that it was quite dark, but this did not deter me in the slightest. I went further and further into the jungle hoping to catch a glimmer of this monster. After a bit I heard a noise to my left. I turned, but saw nothing. I went on. Soon, I came to a clearing. I got to the middle of the clearing when I felt as if I were being watched. I turned around slowly and I saw that most amazing sight Ii had ever seen! Before me was the magnificent TBON!

Ten feet tall! Giant floppy ears! A cute puffball of a tail!

Terror inched across my body. I was paralyzed with fear. Until I remembered… “One!”, I managed to blurt out. Nothing happened. I thought for sure I was a goner. “Two!”, I shouted. The fearsome TBON split into two identical TBONs before my eyes. Identical beings, but each half the size of the original. Within a few seconds the two turned back into one.

Its eyes gleamed with hunger. Not undaunted, I cried, “Three!”. This time six smaller copies sprang forth. I was beginning to have an inkling as to what was going on. After some time, but longer than before, the six turned back into one. I quickly called out “Four!” Lo and behold, 24 copies appeared. I was quite excited and was ready to make things interesting. I quickly wrote down the following:

public class Factorial {
    public static void main(String[] args) {
        System.out.println(fact(new Integer(args[0]).intValue());
     }public static int fact(int factnum) {
        switch(factnum) {
            case 0:
                return 1;default:
                return factnum * fact(factnum " 1);
        }
    }
 }

Nice and easy recursion. Something about this seems a bit pedestrian, however. What if we tried this a different way?

if ARGV[0].to_i == 0
  puts "1"
 else
  puts((1..ARGV[0].to_i).inject(1) {|total, num| total * num})
 end

Nice and concise.

Another just for kicks:

(begin
  (define fact
    (lambda (n)
      (if (= n 0)
        1<br>
      (* n (fact (- n 1))))))
 (display (fact (string-&gt;number (vector-ref argv 0))))
 (newline))

Ahh… Very helpful. Three different ways to calculate a factorial in three different languages.

I figured that I didn’t have to go past the number five. Any more than that and I would not be able to see the TBONs that split. So I called out “Five!”. As the TBON split into 120 identical (much) smaller TBONs, I broke out into a huge grin. I thought, “This TBON isn’t too scary.” I pet a couple of the TBON clones. After a few minutes, the TBON reassembled itself into the regular, giant TBON. It glared at me again. I became afraid once more.

“Hey!”, said a voice behind me. I did a little jump and turned around slowly. A man stood behind me.

“He really won’t hurt you, you know.”, the man said.

“Oh, really?”, I answered. “He looks quite angry to me.”

“Nah, he’s harmless. I’ve lived here all my life and the Beast has never harmed a soul. He’s looking at you like that because of what you’ve got in your pocket.”

“My pocket?” Oh, how embarrassed I was.

I grinned again, reached into my pocket and pulled out the carrot and tossed to the TBON. The TBON caught the carrot, wiggled its nose, then bounced off back into the jungle. I turned around said thanks to the local and decided it was time to head home.

Authors note: The code samples in this post are all executable. The first is in Java, the second is in Ruby, and the third is in Scheme. They are setup to take a command line argument of the factorial to compute. Save the Java example to a file called factorial.java, compile it using "javac factorial.java" and execute it using "java Factorial n" where 'n' is the factorial to compute. Save the Ruby example to a file and run it using "ruby file.rb n". The Scheme example should be saved to a file and run using (I use MzScheme) "mzscheme -r file.scm n".

Filed in: Team Member Blog Comments (0)1languages

Fourth Post

So far I have talked about the different technologies I am using and getting them setup. Now I want to start talking about the plug-ins I am find useful. Recently I have started to use Acts as Authenticated and SSL Requirement. First if you are looking at the different authentication / authorization plug-ins I strongly recommend looking at Acts as Authenticated. <a title=“Here is a great source of information.”

href=“http://technoweenie.stikipad.com/plugins/show/Acts+as+Authenticated”>Here is a great source of information. The plug-in just gives you basic features. The URL I listed before has lot of modiications to the plug-in to add features like emails authentication, forgot my password, remember me, and many other features. Many even include additional tests.

The next plug-in I have been using is SSL Requirement. This is a great plug-in. It just works! In your controllers you just tell it what actions require SSL and which ones don’t. It handles it from there. I have run into 1 problem, but that appears to be a bug in rails integration test system. Flash messages get lost when doing rails integration tests and switching between http / https. This does not happen in a production environment. I have to check and see if this is a known bug.

Filed in: Team Member Blog Comments (0)

RailsConf 2007

As I stated in my first post, I attended RailsConf for the first time this year. The conference was presented with the help of O’Reilly Media and Ruby Central. I thought they did a really nice job of keeping everything running smoothly. I thought the keynotes were the best part of RailsConf. There were keynotes by David Heinemeier Hansson, Avi Bryant, Ze Frank, Tim Bray, Jamis Buck and Michael Koziarski, and Dave Thomas. I found it interesting that many of the keynotes were not on the technical aspects of Rails but more on community and the evolution of software development.

Ze Frank’s keynote wasn’t even related directly to the software development field. It was more about how technology is now allowing people to express their creativity in new ways, such as through internet websites and tools. He talked about how anyone can now be an author and how that has created a huge influx of new creative material to the internet. He said people basically have three options when it comes to the authors of this new content.

1. You can ignore them.
2. You can try to control them.
3. You can shut them down.

I probably enjoyed his keynote the most because it was very, very funny and entertaining but also because it was really deep.
David Heinemeier Hansson’s keynote summerized what has happened over the last couple of years with Rails and then discussed where Rails is going with Rails 2.0. He said Rails 2.0 would focus onRESTful principles but would not be hugely different from what we have now. He also mentioned the following items that would be in 2.0 as well.

  • Breakpoints will once again be working in Rails and will have some additional features such as the ability to step up and down in the strack.
  • HTTP Performance will be improved using caching techniques for static files such as Javascript and CSS files.
  • Query caching will be improved behind the scenes.
  • There will be a mime type render that can be used in actions to render different view formats including custom ones.
  • The environment.rb file will be split up and better organized.
  • Migrations will be improved so the type information is not repeated over and over again in a migration.
  • HTTP Authentications will be used more for computer API interactions.
  • Rails will generate projects assuming they are going to use the MIT license. If you don’t want to use the MIT license for your project you will need to manually change it.
  • Some functionality of Rails will be moved out to plugins based on how well it fits in with the Rails 2.0 core. Also, currently deprecated functionality will be removed.

Many of the speakers such as Dave Thomas talked about the importance of creating a great community presence around Rails and improving the image of the Rails community in the eyes of the world. Throughout the conference people were encouraged to donate money to charity, for example. This started with the Charity Tutorial put on by Pragmatic Studio(which I attended and was a great overview of Ruby and Rails). People interaction was reenforced by the speakers and through the Bird of a Feather sessions at the end of each day. People also gathered during the provided lunches for discussions and short coding sessions.
All in all the conference was really interesting and I came away from it with more motivation to take part in the community. I also learned some interesting stuff through the sessions, although I think this is an area that could be improved upon next year. I often found myself in sessions that had content that I already new or was much simpliar than I expected. It would have been nice if the sessions were organized more by level of expertise or a similar rating next year. However, it was still incredible informative and I would highly recommend for others to attend next year. I would also highly recommend for novice Railers to take the Pragmatic Studio’s tutorial if they get the opportunity. It is a great way to quickly get up to speed with the basics of Ruby and Rails.

Filed in: Team Member Blog Comments (0)3ruby

Microsoft Wants to Spy on You

A couple of short articles have surfaced recently outlining what Microsoft wants to do with web browsing in the future. The first, http://www.newscientisttech.com/article.ns?id=mg19426046.400&feedId=being-human_rss20, describes how Microsoft wants to be able to identify everyone browsing on the web. This would be a terrible blow to privacy. The greatest thing about the Internet is the ability to view anything you want with relative anonymity. Now, granted, you’re identifiable via your IP address, but you can get around this by using anonymizer services. Fortunately, all of the ways to gather information that are listed in the article can be bypassed. It mentions that Microsoft is thinking about creating a new cookie program to record pages visited, using your browser’s cache, or using proxy server logs to retrieve browsing data.

Sounds like spyware to me. Users don’t put up with spyware secretly grabbing information off of their computers, and I hope they won’t put up with this either. The easiest way around this is to not use Windows as an operating system. All of these sniffing programs or browser cache reading programs will have to be embedded in Windows or Internet Explorer. The proxy server is a little trickier, but I’d be willing to guess that the vast majority of proxy servers worldwide run on UNIX and not Windows. Even if you don’t use a Windows operating system or don’t use Internet Explorer, I’d still recommend that everybody change their privacy settings on their browser to always ask for acceptance when attempting to set a cookie. I think most non-techie people would be amazed at how many cookies are set when browing the web.

The second interesting article, http://www.theinquirer.net/default.aspx?article=39662, describes a new “Identity Layer” for the Internet. This in and of itself is a great idea. Being able to know with the click of a mouse button the identity of a person or a website and being able to verify that identity is a good thing. The interesting thing about this is that Microsoft wants to go it alone. It’s intriguing that they want to create the infrastructure and specifications surrounding this technology. There are efforts in place that are working on such a technology (Liberty Alliance, http://www.projectliberty.org/) in a much more open fashion than Microsoft will ever attempt.

Once again, it seems like this is just a way to “own” more of the Internet and more of the data on everyone. It’s great to be able to verify identities, but it has to be done with an open standard for transparency purposes. It’s hard to trust an authority when that authority has a poor track record when dealing with personal privacy. Unfortunately, Microsoft has so much clout and market share that they seem to be able to muscle their way into everything they take on.

I challenge everybody to be more vigilant when browsing and to think about how their data is used online. Things won’t change unless everybody is aware of what happens to their data.

Filed in: Team Member Blog Comments (0)4privacy

The beginning of my blog

I think the title of this blog posting is more than appropriate. It summarizes quite clearly that something new is on its way or has recently arrived. For me this week has been full of beginnings and firsts. One you may have guessed is the creation of my blog here at QWANtify. It is something I have been meaning to do for ohhhhh… about 6 months that just has not seemed to materialize. So what is different now, why create my blog now. Well, I have had an opportunity to go to an event that gave me something to write about. I went to RailsConf 2007. In fact it ended only 5 hours ago (it took that long to get the wireless in my room again :) ) and it was great. Since this is my first posting, however, I am not going to go into the details of the conference now. I will leave that for my following posts. Instead I will give you a little bit of an intro to me.

My name is Josh Swan and I am a software developer for a company in Madison, WI called QWANtify (that bit may be a bit obvious from my blogs name and url). I have been working in Java for around 5 years professionally but have a wider array of skills than just Java. For example, right now I am functioning more as a web service architect at work and outside of work I am building Ruby on Rails projects. Interests I have include agile development and project management practices, Ruby on Rails, Test First Development, Behavior Driven Development, application integration technologies, and problem solving in general. I’m the kind of person that if I’m trying to solve something I will have a hard time going to bed at night if I can’t figure out a solution. I also tend to be a bit of a jokester too, just to warn you. :-) I like to answer questions and help people when I can, so feel free to email me at josh.swan@qwantify.com or post comments to this blog.

Filed in: Team Member Blog Comments (0)

Third Post

So in my last post I talked about getting my web stack setup. I have Apache 2.2 using Mod Proxy Balancer talking to a Mongrel Cluster with MySQL as the database. I copied over one of my test apps and everything is working fine. Now I wanted the ability to deploy to production from any where with an internet connection. Since I do all this on my spare time sometimes I am coding over my lunch hour from a restaurant.

Thus I read up on Capistrano. Okay let me just say Capistrano ROCKS!!! I can’t believe how great of a deploy tool this is.

This was so easy to do. First I read this Shortcut (its on Safari) : Mongrel

I used that shortcut to make sure I had Mongrel setup and running right.

Next I went online and found lots of different ways to setup Capistrano. Then I stumbled across this shortcut (Again it’s also on Safari): Capistrano.

This worked great. This shortcut talks specifically about setting up Capistrano with small steps that help you prove it is working and what would probably be going wrong. I hit a few issues and this shortcut has all the answers. Also Capistrano was originally created when everyone was using FastCGI. This shortcut leads you down the road of using Apache and Mongrel which is what I am using so again this was perfect.

So I took my test app I have been making and with in a day I read the Capistrano Shortcut and got my app deploying. The next day I went to a local restaurant and pushed out an update over my lunch hour! AWESOME!

So I have started working on the another app at home. Part of the reason for the delay in my posts. Well Over my lunch hour I took that app, applied all the Capistrano Configs, Setup the Production Environment and Databases, and finally deployed the application all in my lunch hour. I have NEVER setup a production environment that fast before.

RAILS ROCKS!!

Filed in: Team Member Blog Comments (0)6general

Apparently Linux has Ceased to Exist and I didn’t Notice

Microsoft’s Platform Strategy Director and head of Microsoft’s Linux Labs, Bill Hilf, made some rather interesting comments recently about Linux. He’s proclaiming that Linux has ceased to exist in 2007 and that the open source movement is dead because many of the developers actually have paying jobs to work on Linux programs. He went on to mention that the rise of Linux had nothing to do with Linux itself, but with the rise of Apache, MySQL, and PHP and the usage of them on the Linux platform. He described those three stalwart components of many web servers as the “Visual Basic of open source”. Oh yeah… IBM, his former employer, also decided to start a standards war by promoting the Open Document Format because they wanted a part of the Office market and people just don’t want the ODF.

Wow! I don’t even know where to begin on this. I don’t know if this is just the standard FUD that comes out of the Microsoft camp, or if Mr. Hilf really believes what he’s saying, but it’s certainly absurd on many levels.

I can start by saying that I’m pretty sure that Linux still exists right now. Gentoo just released the 2007 version of their base installation. My laptop is running Linux just fine. It hasn’t fallen apart. I’m writing this inside version 2.2 of OpenOffice, which still works and supports ODF as its default document format. Things are good as far as I can tell.

Even though Linux isn’t quite ready for the desktop for the average Windows or MacOS user, it has made great strides. The real power is in using Linux as a server platform. It’s certainly not going anywhere anytime soon. On the server the LAMP stack has worked quite well. It’s possible that the AMP combination had the side effect of raising the awareness of Linux, but my guess is that’s more due to performance on Linux vs Windows than anything else. Also, I’m surprised that Mr. Hilf would compare anything to Visual Basic since that’s less of a “real” programming language than PHP (obligatory VB dig).

I’m not sure why people wouldn’t want the Open Document Format. What it does is create an open standard for storing various document data that has no vendor lock-in associated with it. It will force office software vendors to really compete with their products rather than relying on their locked-in format to keep a person from switching to a different office product.

I don’t see it as a bad thing that programmers are getting paid to write Linux and open source software. They need to make a living, too. If a company wants to sponsor the creation of an open source product, that’s great. It makes it even more likely that the product will continue to be improved upon than if the product was created by a programmer who was in between jobs or creating the product in his or her spare time.

So, in deference to Microsoft and Mr. Hilf: I’m sorry, but I don’t think that Linux is going to go away anytime soon.

Here’s a link to an article (PHP, no less) about this, and another link to the Slashdot story.
http://www.bangkokpost.com/090507_Database/09May2007_data05.php
http://linux.slashdot.org/article.pl?sid=07/05/14/2038250

Filed in: Team Member Blog Comments (0)7linux

Scheming on a Thing

I’ve decided that I really need to be more multilingual. Not in the sense that I should speak another verbal language, though that would be a really great idea, but in the programming language sense.

All of the languages that I’ve learned in the past are standard procedural, object-oriented languages. There is a whole other realm of languages which I hadn’t really taken a look at before, functional programming languages. That’s one of the things that really stands out about Ruby. Ruby has a wide range of uses, but the most noticeable thing about it is that even though you can use it as an object-oriented language, it contains a lot of functional programming paradigms.

Functional programming is a bit strange to wrap your head around if you’ve never really used it before. The entire structure is based upon Lambda Calculus which seems to be nearly impossible to understand unless you’ve got a degree in mathematics. Lambda Calculus basically says that you can represent everything as a function that takes one argument and that argument can be another function. There are ways to represent the natural numbers, standard arithmetic, and even logic functions via Lambda Calculus. It’s pretty heady material to read.

I got curious and started taking a look at Scheme. Scheme is a derivative of Lisp, which makes it one of the “parentheses” languages. Lots and lots of them. It’s no worse than having curly braces everywhere, really. Functions are first class objects. It uses stack notation to perform arithmetic, so there is no operator precedence. It’s a really interesting language. I haven’t really used it for anything yet. I’m still looking through the language specs trying to figure out everything it can do. I’m sure I’ll have more things to say about it in the future. Until then, I’m just going to have some fun with it.

Filed in: Team Member Blog Comments (1)8languages

Page 18 of 22 pages « First  <  16 17 18 19 20 >  Last »