RSS
 

Archive for the ‘Web/Tech’ Category

Everyone is wrong about Apple’s Podcasts app

30 Jun

Apple released a podcast app this week that has been met with a fair amount of criticism by the podcast listening community.  Most of these people appear to have already tried many different apps or have been using iTunes podcasting abilities.  I don’t think that this app is targeted toward them.

This app appears to try and turn all of the podcasts that Apple hosts into the content needed for an internet radio.  I have used podcasts in the past, but thought that it was too much effort to keep them all synced when the content quality was just so so for most.  I instead would listen to the radio or listen to an audiobook.  The first was current and the latter was usually great content with very good production.

I believe this app is designed to not focus on individual podcast streams.  It minimizes the “subscription” aspect of a podcast. The main goal I believe is to just pick the topic that interests you, such as history, and then start listening.  After doing this you are presented with the latest podcast in a series that Apple curates for that topic.

This has left me able to pic my genre and start listening to  podcasts with good quality and very little discovery time. If I don’t like it then I skip and go to the most recent episode of the next podcast. It is a much less difficult way to get good content on your phone. I think that is Apple’s biggest goal with this app.  The people that will want to invest a lot of time into maintaining a list of their subscribed podcasts are the minority.  People really just want better radio and this app delivers it in my opinion.

 

The really hidden feature of git

02 Apr

I think I just realized my biggest benefit of git.  I have the freedom to commit things that don’t work.  I have been journaling while programming for the past month or so .  Who knows if it would have actually stuck any other way though.

 
No Comments

Posted in git, Web/Tech

 

New Blog New Focus

06 Jun

Over the past year I have grown quite a bit as a developer and realized that I should talk more about being open to expanding your knowledge outside of the technologies you are currently comfortable with.  One year ago I was a ASP.NET C# webform developer that didn't know exactly why people didn't like ASP.NET and considered it a leaky abstraction.  

I really wanted to get better with testing my software and the path that lead to developing testable websites brought me to the View-Presenter pattern.  This pattern worked wonders to be able to test a webform site and really allowed me to focus on the TDD experience.  During this work I felt that I was finally writing some rock-solid code that was doing what I thought I wanted it to, and with the testing would keep doing it through the changes.

After getting comfortable with this I started to look into Ruby on Rails since there was so much talk about it and how completely agile it was.  The first couple of months that I sat down and used ruby I was not sure that it was worth looking at.  Some of my posts here show my skepticism that I felt.  I thought that without a compiler and with the looseness of the language that "real" applications weren't possible and that it was more the realm of the casual developer that didn't have to make a serious professional program.

After struggling for a couple of months I started to see the light.  Once I was writing tests and really understanding what I could do with Ruby, using C# started to become frustrating.  To get software written in Ruby you really can just go and have a great amount of ease in re-factoring your code because everything isn't tied down so tightly that you had to expressly expose all aspects to being extended or overridden.  In Ruby if you want to replace functionality of a class you can, no special keywords or design considerations.  With C# the style of code that you have to write to become testable changes from what you would write even with good OO principles.

I was learning Ruby so that I could create Rails applications.  What I have enjoyed about Rails the most would be the guidance and ease of developing an application.  Testing is required practically and supported to an extent I had never seen.  The design of the system made sense, it is put together by people that used it daily.  It is added to by people using it and the community was very helpful and exciting to be around.  I was very excited, but thought there must be something that makes Rails development not as easy as it seems.  Otherwise why isn't everyone developing using it?  So far I have not run into frustration.  The only aspect that I am hesitant of is running the web servers using rails.  At the start of my experience there seemed to be quite a bit of memory usage and a need to do frequent server resets.

Worried about this I didn't feel comfortable pushing the technology to co-workers since I didn't want to recommend a system that may not be as solid as what we were used too.  Then Microsoft announced that they would be making a version of ASP.NET that is built with an MVC architectural pattern.  Initially this was somewhat exciting.  All of the benefits of rails I thought, but with the stability of .NET.  

So far this has been a good direction for Microsoft, but it feels to me like I know that the people writing it aren't thinking about using it first.  They are driven by the desire to make maintaining the software easy.  This has led to pain in my experience.  Releases aren't very easy to use with testing.  There are side projects that have been created to ease this, but it is obvious to me that these solutions could have come from the actual framework creators.  To me there is still this we will make the framework you figure out if it works for you mentality.  Usually this isn't a problem if that attitude is from people that are working with the technology, but here I don't believe this is the case.  

I have more and more felt that Ruby on Rails is the best way to develop web based software.  I am more intrigued every day and have yet to run into a decision that I thought was made without the first priority being a benefit to the usage of the framework.  Now with this experience I wonder what other languages and skills would help me solve problems better.  This will be my focus on this blog so that I can chronicle my experience and hopefully meet more people that enjoy solving problems the best way they can.
 
 

RenderUserControl from Controller

15 Jan

Ran into a situation today where I wanted to render a ViewUserControl from my controller.  I had a couple of hard times getting this done with the Microsoft MVC CTP1, but finally have it working.  We did this to support using the Prototype observe to get behavior similar to a cascading drop down.

ASPX View Page

 <% using (Html.Form<Web.Controllers.PlaqueOrderController>
          (action => action.Create())) { %>  
  Season: 
    <p> 
       <%= Html.Select("SeasonId", ViewData.Seasons, "Name", "Id")%>  
    </p> 
  Statistic: 
  <div name="statistic" id="statistic"> 
    <p>
      <select disabled="disabled">
        <option>Select Sport</option>
      </select>
    </p>
  </div>

 <% } %>
 <script type="text/javascript"> 
   Event.observe("SeasonId", "change", function() { 
          new Ajax.Updater('statistic', '/PlaqueOrder/GetStatistics/'
                           + $F("SeasonId")) }); 
 </script>

 

This will observe the season drop down and when it is changed call the PlaqueOrder controller’s GetStatistics action passing the selected SeasonId to the action. The action in the controller then looks like this.  I should mention that I’m using LLBLGen for the ORMapper here.

 

PlaqueOrderController

[ControllerAction]
public void GetStatistics(int id) 
{ 
   SeasonEntity season = new SeasonEntity(id); 
   HtmlHelper helper = new HtmlHelper(
                             new ViewContext(this.ControllerContext, 
                                             this.ViewData, 
                                             this.TempData));
   string html = helper.RenderUserControl(
                       "/Views/PlaqueOrder/Statistic.ascx", season);
   Response.Write(html); 
}

 

We had to give the absolute path to the RenderUserControl because we kept getting The relative virtual path ‘Statistic’ is not allowed here when we used helper.RenderUserControl("Statistic").  We also had to use Response.Write to get the html created from the ViewUserControl to the browser to replace the innerHtml of the statistic div.  Next is the ViewUserControl.

 

Statistic.ascx

<%@ Control Language="C#" AutoEventWireup="true"
    CodeBehind="Statistic.ascx.cs" 
    Inherits="Web.Views.PlaqueOrder.Statistic" %>
<%= Html.Select("StatisticId", 
                ViewData.Sport.Statistics, "Name", "Id")%> 

 

And here is the codebehind that types the ViewUserControl to the Season that we are passing as the ControlData.

 

Statistic.ascx.cs

namespace Web.Views.PlaqueOrder 
{ 
   public partial class Statistic : 
                 System.Web.Mvc.ViewUserControl<SeasonEntity> 
   { } 
}

 

We had a hard time find much information how to do this.  I’m sure there are other ways to accomplish this, but to us being able to render a ViewUserControl from a Controller is helpful with how we have used Prototype for AJAX communication.

 
2 Comments

Posted in .NET, Web/Tech

 

String to number conversion in Ruby

19 Sep

When converting a string in Ruby to and in using the value’s to_i method it will do some interesting conversion.

Examples:

  • ‘5’ becomes 5 — Cool
  • ‘I have 5’ becomes 0 — kind of a weird failure, 0 could be a perfectly fine conversion
  • ‘5 is five’ becomes 5 — Really odd behavior, but the conversion is done until an incorrect character is encountered.  After this the rest of the string is ignored.  So
  • ‘5 is 5’ becomes 5
  • ‘5,000’ becomes 5

Where this is helpful so far is when someone is entering text through the command prompt.  When a person enters text prompted from gets the new line added from the user pressing enter is included.  So if a user enters 5, then the gets string contains ‘5n’.  In most languages this would cause and issue, but with how ruby does it’s conversion of ‘5n’ becomes 5.

 
No Comments

Posted in Web/Tech

 

String Multiplication in Ruby

19 Sep

This is pretty interesting. In ruby you can multiply a string. So if you wanted you could write

puts ‘Repeat ‘ * 3

Which outputs:

Repeat Repeat Repeat

I like this and I do think it makes sense.  It does not work if you write

puts 3 * ‘Repeat ‘

Which I think is wrong because multiplication should be commutative.

 

Now doing this has somewhat caused a problem for concatenation though.  By multiplying string it is not clear what should happen when you do this.

puts ‘Repeat ‘ + 3

So ruby outputs an error, something that I’ve enjoyed recently in .NET has been that if you add or concatenate a string with another object the other object is automatically changed to a string, using the ToString method I believe. 

I would think that this is a much more common scenario than multiplying strings and therefore a bigger loss to productivity and readability of code.

 
No Comments

Posted in Web/Tech

 

First Ruby WTF

19 Sep

Well I was reading through Chris Pine’s Learn to Program and he made a curious statement about how money is handled when programming.

In practice, most programs don’t use floats; only integers. (After all, no one wants to look at 7.4 emails, or browse 1.8 web pages, or listen to 5.24 of their favorite songs…) Floats are used more for academic purposes (physics experiments and such) and for 3D graphics. Even most money programs use integers; they just keep track of the number of pennies!

Now does anyone actually do this in the outside of the Ruby world?  When I use .NET I use an ORM and I map to the SQL money column type to a decimal.  I’m somewhat interested to see what ruby does in this situation.

 
 

LLBLGen Upgrade from 1.x to 2.x

17 Jul

I have found this search to be pretty helpful with my upgrade from LLBLGen 1 to 2. 

  1. To use it start a find and replace and enable regular expressions. 
  2. Then in the Find What box enter PredicateFactory.CompareValue({:w}FieldIndex.{:w}, ComparisonOperator.Equal,
  3. now in the Replace with box enter 1Fields.2 ==

This will then replace the string with the correct syntax for the new query language that uses operator overloads.  These can be modified to capture most of the query types used in LLBLGen.  You will have to go back in however and remove an extra closing parenthesis.

 
 

LLBLGen Presentation

07 May

The presentations went well.  I think they are definitely something that you have to do to get better.  So now I need to find ways to do more talks.  I enjoyed the chance to get to meet people and discuss technology with people I normally wouldn’t. 

The audience for the two presentations I gave were very different.  For the lunch crowd a simple direction was best.  The time was much more crunched and the environment lent itself to more distraction and less interaction.  For the evening you only have 10 people and more time.  So a more in depth presentation would most likely be beneficial for them. 

Other than that I thought that the presentation went well.  It’s a large subject that I will get better at presenting when I show to other developers at MTM and present other topics.  I also won something for the first time ever, a book that started out with this quote.

… the highest simplicity of structure is produced, not by a few elements, but by the highest complexity.

– Ralph Waldo Emerson, "Goethe; or, the Writer"

That’s a good quote, but I think that the development circle I’m following more and more lately tries to do these Simple Complex things as simply as possible.  I know a lot of developers still like their complexity, hopefully every day I’m less and less like that.

P.S. The presentation material will be posted here very soon.

 
 

Mix 07 News

02 May

Interesting News from Mix 07.  There has been a lot of attention today to many of Microsoft’s announcements about upcoming development projects.  Most notable have been Silverlight 1.1 with built in Cross Platform CLR and Jasper.  But two other interesting bits of technology are ASP.NET Application Services and Dynamic Data Controls.

Dynamic Data Controls for ASP.NET

Dynamic data controls are a set of ASP.NET server controls that obtain database schema information at run time, provide default display formats according to common user expectations, and enable you to easily customize those formats. Watch a video showing how to build a task list application using the Dynamic Data Controls from the ASP.NET Futures Release.

ASP.NET Application Services

New services for ASP.NET enable you to add search to your ASP.NET Web applications, using a commercial search engine’s API (such as Windows Live Search) and custom search providers. You can also publish custom and dynamic sitemaps that are configured to assist search engine crawlers. A new service lets you capture JavaScript errors and report them to server-based ASP.NET code.

Source: ASP.NET Futures: ASP.NET Web: The Official Microsoft ASP.NET 2.0 Site