Thursday, January 31, 2013

Problems with Google Analytics


Most of the Google utilities I use are great - they usually have an intuitive design that make them frictionless and have most of the features someone needs. The features they have usually work as expected too, which isn't trivial with some other competing utilities.

Lately I've been using Google Analytics and the truth is, I don't like what I see... :(

The most annoying part of using Google Analytics is that there's no way of testing it!
It would seem like a trivial feature to me, but apparently not to the people at Google. Maybe most people don't have this problem, since you set up the analytics reports when first designing the website, and then the testing process is done on your production environment which could be really easy, and if you have no stats, then you obviously have nothing to ruin.
When I was trying to make some of the most minor changes to the way we report some of the stuff on the website I work on at my job, the first thing that interested me was how I was going to test the changes.

When you have many users in production, there's no chance you'll notice the change you made when you login. Even if you would, I could by accidentally affect other analytics and I was obviously afraid to do so. So, I set up a test account, and tried reporting to the test account from my local machine. This didn't work since Google makes sure you make the request from the domain you registered in the GS (Google Analytics) account, which is great! After looking into this a little, I found out that I can tell GA to ignore the domain that the request is coming from so that this will work. From their documentation, this feature was meant to be for using multiple subdomains, but it works for reporting from any domain. Since this helped my cause, and I'm not afraid of others causing harm to my test account, I won't go into why this is a bad idea, and can be harmful to some other sites using this... :/
After doing all that, I came to realize that the analytics aren't reported in real time, which is also logical, since an analytics system usually needs to deal with large amounts of data, and it takes time to handle the load. (Not only it's not real-time, but it's pretty far from being almost real-time as well) BUT, this doesn't mean there shouldn't be a way around this for testing, like an option I could turn on, just so the reports effect will be seen in real time, even if it's limited for a really small number, just for testing!

In case someone reading this ran into the same problem - The configuration setting I used like this :
_gaq.push(['_setDomainName', 'none']);


By the way - From my experience with the Adobe Omniture utility, they have a great 'debugging' utility that you can use a bookmarklet. It opens on any site, and shows you the live reports going out, which is a GREAT tool for testing, and should've been implemented by Google in the same way.

Another issue I had (and frankly, still have) with GA, is that some of their documentation isn't full... For example : There are some pages (like 'Page Timings') where you can view the stats of different pages, and the average. You can sort this list by 'page title' or some other parameters. The problem is that when you have many pages that are the same, but with dynamic content (meaning all the 'page titles' are different), you might want to group them by a 'user defined variable' that you report on that page.
Great! You have this option. ...BUT, in the documentation, the way you report a 'User defined variable' is by using the '_setVar' method. It continues on by stating that the '_setVar' method is soon to be deprecated and they don't recommend using it. Instead you should '_setCustomVar'. The problem here is that 'Custom Var' and 'User Defined Variable' aren't the same, and in some pages you can view one and in some the latter. There is no documentation anymore for the '_setVar' method, so I searched various blogs about people writing about this in the past, and found the way to use it, but it works in a different way, and I couldn't find a way to define it's lifespan (per session/page/user/etc.) like you can do with '_setCustomVar'.

Long story short... It seems like they have quite some work to do on this before it's perfect, or close to being perfect, and I'm not 100% I'll be using this again as a full site solution for web page analytics.

Friday, January 18, 2013

It's time for yet another change...


I started out programming ~13 years ago, when I was only 12 years old. The first language I learned was VB. I was building some small winforms utilities for myself. Then (about a year after) I started learning php and went into web development, building some dynamic websites (mostly php & MySQL) for the next 6-7 years...

Once I drafted to the military (mandatory in Israel), I did some programming for the Air Force. It was then when I got into the .net world, and was doing most of the programming in C#. I got used to it really fast, and learned to like it, so after the military (~3.5 years), I went on to work for ICC (the Israeli VISA company) as a .net programmer for 2 and a half years. After that I immediately got a job for Sears Israel, mostly developing in C# but also doing some java.

The past couple of years I learned a lot of new technologies and new programming paradigms, but it was mostly using the Microsoft platform. I didn't get to work with other programming languages, not to mention working on Linux platforms...

So... I think it's time for yet another change... :)
I'm not talking about quiting my job (note to my employer: no need to worry yet), but I'm talking about learning some new languages and technologies on my own. I'm not kidding anyone here - I've been programming since a young age and have been loving every moment of it. I do it a lot at home and a lot in my spare time just for fun!
I recently decided that I will dedicate my spare time to learning some new technologies and new languages. I'm sure, even this won't pay off immediately at work, the knowledge I will be gaining will still be priceless and will definitely help me in the future, possible even at my current work place.

First step - A couple of weeks ago I installed Linux on my home computer. I went for the Ubuntu distribution, since I heard it's the most user-friendly, and this way I could hit the ground running.
It's only been a couple of weeks, and I already know how to do everything I need from the terminal. Manage my files, install new packages and even work with vim. Seriously, if I didn't need a web browser, I would be installing the server version. Now, I started copying all my old files I want to backup from my Windows installation, and planning on removing Windows all together.

Next steps - I decided I need to learn new technologies as well. Recently reading about nodejs a lot got me really excited and so I started learning it. I also figured it would be easy for me to get into, since after years of web development I can say I know a fair amount of javascript.
I'm already working on a small project just for myself which is coming out really cool (might blog about this soon). I'm working with the expressjs mvc framework, jade view engines, stylus and even implementing OpenId in javascript!

I'm always thinking about how I can use this information to leverage some utilities we have at work... :) Every programming language has its strengths and it's all about choosing the right tool for the job.

What's next ? Well, I think after I finish my project in nodejs I'll go onto learning python which has also been interesting me for a quite a while now...
I already read a lot about it, and now I just need to get my hands dirty a bit too.

In conclusion I will say that learning new technologies is always a good idea, can always be a lot of fun, will always give you new tools to deal with everyday problems and put you ahead of many other programmers that are 'stuck with the same technology for years'. I already feel I have quite the experience - programming in VB, php, C#, javascript, using MySQL, Oracle, SQL Server, (and many frameworks within each language) and having at least a couple of years of experience with each of these. I really believe this puts me ahead of most, especially when it comes to solving new problems - I have a better point of view then others and a lot of experience to lean on.

Monday, January 14, 2013

Some good to know C# attributes


Just felt like writing about a couple of C# framework attributes that I happened to use lately, and not enough programmers know about (in my opinion, and this usually surprises me).

The first (and the name of my blog) :
DebuggerStepThroughAttribute
This attribute can be used to tell the debugger not to "step-into" a piece of code, and instead, it will skip over it. The best use for this that I can think of is when using an IoC/AOP framework and you have method interceptors, debugging can be a big pain in the ass... You keep on going through each interceptor, on every method call!
All you need to do is add [DebuggerStepThrough] above your interceptor, and the code won't be debugged.
e.g.:
[DebuggerStepThrough]
public class DontDebugInterceptor : IInterceptor
{
    // do something...
}

DebuggerDisplayAttribute
This attribute is used to tell the debugger what to display when in the 'Watch' window or when hovering over the variable in debug mode. Most people know that if you override the 'ToString()' method than you get the same effect, but sometimes this just isn't possible, since you might need the 'ToString()' method for something else.
All you need to do is add [DebuggerDisplay('Some string representation')] to the field/property/class you want to modify. You can also evaluate code inside the string given to the attribute constructor, just by wrapping it with curly braces.
e.g.:
[DebuggerDisplay('This class is : {OutputClass()}')]
public class MyClass
{
    private string OutputClass()
    {
        return "Whatever you want here...";
    }
}

Saturday, December 29, 2012

Everything should be everyone's business!

When working with more than 2-3 developers on a big project, you can't always be aware of everything that happens around you... Never the less, you should and even need to!

What am I talking about ?
You should be aware of everything that happens on your project - from open bugs, to the build server status, the site/product performance, to new implemented features, errors in the log, and the list goes on...
Every aspect of YOUR project should interest on a daily basis!

Why is this hard ?
When working with many people, on a big project, you can't really go over all the commits, the new features, always check the performance graphs, search the logs for errors and QA the site for new bugs.

How is this done ?
Sometimes all you need to do, is make things a little easier for everyone. What do I mean by that ? I mean that sometimes you need to give developers the right tools to view the logs, sometimes you need to put up a new monitor in your company hallway and display the performance graphs for people to see each time they go for a coffee break and sometimes you need to build a system that will send automatic emails to each developer that breaks something to get their attention...

A couple of things I am working on in my company to make things more transparent and 'in their face' :
- We have a custom built internal performance profiler that we use a lot. It looks like the mvc-mini-profiler (built by StackOverflow) and is displayed when adding a secret cookie. This wasn't good enough for me! I wanted everyone to be seeing this all the time. So, I modified it to be displayed for everyone coming from inside our office networks.

Numbers are pixelated intentionally

- Performance graphs... We heavily use graphite, and store there TONS of data... The problem is, it's sometimes hard to look for exactly what you need, and it's not that comfortable. This also is unacceptable... What I did was create a really nice looking dashboard with very little information, but just enough to see what's important, and soon we're going to hang it in the hallway for everyone to see all the time!


Numbers are pixelated intentionally

- Bugs... Sometimes people run into them, but it's not that easy taking care of them... I created a button that will be rendered on our site, for everyone within the network, and clicking on it will allow you to report a bug really easily - you just need to enter a title for the bug, and the system will add all other relevant information (a screenshot, what version, which user, errors previously caught, and so on). This will automatically open a bug in our bug system.


- Logs - We have an internal utility that reads the log every day and checks for the top erroneous components. I decided I needed to put this up on another monitor in the hallway, and next to each component I put the name of the person responsible for everyone to see! :) No one wants to be on this monitor, and therefore this is bound to work...


I strongly believe in this whole philosophy, and won't quit until the cleaning lady will be calling me in the morning to tell me that the monitor is red! :)

Sunday, December 16, 2012

I'm back...


I didn't write any posts for quite a while and I'm really disappointed about that...
Most of the things I do, or try to do, on a regular basis turn into habits that are eventually just part of my system. Every once in a while when something unusual happens that 'knocks me off the wagon' I realize it's hard to get back to doing it. Eventually I force myself to get back to it, and then everything gets back to normal...

In this case, blogging - I have abandoned it for quite a while now. It started a couple of months ago when I started preparing myself for a month long trip to Japan, and since I returned I haven't got to it.

So... sorry for disappointing you, the reader, if you were expecting something technical, or computer related, but I just felt the need to write something here just to get the ball rolling again.

And since I'm here, and I already told you about my trip to Japan, I thought I'll at least post some photos to feast your eyes on... :)


The character on the billboard is one of the most famous singers in Japan. Young teenagers buy tickets in advance and fill up entire stadiums just to watch 'her' sing on a giant screen!


Used laptops going for really cheap...


Typical Japanese cosplay @ Takeshita Dori


Some interesting architecture... (Maybe this building was straight before all the earthquakes! )


The average grocery store filled with lines of people reading the new weekly manga


Enjoy :)
I'll be back soon with something more technical for you...

Tuesday, July 31, 2012

Sears Israel 2012 Hackathon

As my first hackathon, I must say it was quite awesome!...
For two days at work, everyone was crunching at their projects, trying to get as much of it done as humanly possible in that short period of time. I stayed pretty late those days, and even worked a little more on the weekend after, as some others did too.

Some of the projects included creating apps on top of the application framework we have on our site (which is kinda like building a facebook app - You are hosted in an iframe on the site and can work against the site's api).
I created a 'polyvore' like app - It lets you create a collage of products on a canvas for others to see (mainly intended for women's use).
Some other cool apps were games like "The price is right" for products on our site, or an item tagging compatibility game where you need to tag items identically with a partner to score points.
There were some actual features developed for the site, like a 'GeoFeed' - The capability of presenting a users newsfeed on a map, with relevant feeds in his area. Some people took the time to install or implement tools that will help us get our job done better daily, like a cool dynamic dashboard that can contain almost any information we want, or installing an IRC server that will give us a better communication channel for development issues than email.

Whatever the project was - I think it was fun for everyone working on them, and very thoughtful of the company to hold such an event...

Here are just some cool pics from the hackathon -

Me working on my hackathon app...


Our R&D VP working on his app...


The team in Chicago working on their app...


It's not a real hackathon, unless you have hackathon water!


...and lots of energy drinks!


...and a big hackathon timer on the hallway monitors :)

Sunday, July 8, 2012

Always wear sunscreen while maintaining a blog


Many people think that maintaining a blog is a lot of work. I think saying that is like saying reading the paper is a lot of work - You need to go out, buy it, free some time and actually read it. ...But that's not the reality of it, you just grab it during some breaks you have during the day, and read a little...
No commitment, no strings attached and nothing happens if you don't finish the article you started...

The same should go for a blog -
You don't need to make a fuss about it and you don't need to free any time for it.
Just start one, and whenever you have something on your mind - something new you learned, something you feel like expressing, then just jot it down.

Don't think about what others will think.
Don't think about what will happen if you never finish the post.
Just start typing...

Now, when there are so many easy to use and free tools to get the job done, it should be happening 100 times more than it actually is!...

Just write it for yourself. If someone else happens to learn from it, or connect to it in any way, well, then that's just an added bonus.
You'd be surprised by the amount of knowledge you'll be learning by publishing one on your own.
Even if you only ever have one or two good posts, it's worth having them out there for others to read, but that should never be what it's about.

Don't look at how many people read your blog.
Don't think you have to be an expert to start one.
Don't believe everything you read in other blogs, and don't think that every blog is written by some expert.
Read a lot of blogs yourself, and comment when you feel like you have something to say on the matter.
You'd be surprised by the amount of comments you'll be getting (or not getting) on your posts...

People don't start reading your blog just because you posted something. They'll read it because they were looking for something that you posted about. That might happen today, maybe tomorrow and maybe only in 3 years from now...
They won't stop reading it just because you don't post anything either...

It's all about saying what you have to say, whenever you feel like it. Nothing more.
So just do it, have fun doing it, and always wear sunscreen.

:)
Gilly.