Birthday pictures

By: graffic

It’s better late than never.

Here are the pictures from my birthday party. I had to remove them due to facebook draconian terms of service. But now they’re again online.

It was the first party organised in my small dungeon. If you were there I hope you enjoyed.

The copyright of these pictures are from their owners :)

Tags:, , , »
Comments (2) »

Greek Independence Day

By: graffic

Infusion

Today, 25th of March, is the Greek Independence Day. For me it was “day off” in the middle of the week. I guess the same I’d be if I were in Spain and today was October 12th or December 6th.

I was expecting to do nothing and relax at home. I “did” the first but I spent all the day out and eating. The day started with a good breakfast and an appointment two hours later for some food in the centre of Athens. The typical food today is codfish with garlic paste. So if you want to taste it in a restaurant you have to be early. Many people went out today to see the military parade.

I heard some helicopters and checked on the TV how politicians were saying nonsense things and leaving in their expensive cars. It was time to find a way to get to the restaurant. I was lucky to find a bus to get near the meeting point. In they way I saw some of the expensive cars heading back home. Also buses with soldiers returning to their… base?

The codfish at Barba Giannis was excellent. After the meal it was time for a coffee: I was falling asleep! We got more company with us and we got a nice conversation. We also visited a park that some citizens built from a parking (Yes! people doing things for people). It was just amazing.

After the coffee: more food with some Ouzo in our favourite place: Lesvos (like the island). I didn’t eat much. It was the third time in 6 hours I was feeding my stomach. I started to think about having a huge siesta till next day. But the day wasn’t over.

Chocolate was waiting for us after the ouzo. There is a small place near Akadimias were you can taste a really good hot chocolate. We waited a bit outside but in the end we got our sofa inside.

A good breakfast, lunch, coffee, more food, chocolate. I arrived home and my stomach was shouting: please stop!. So now a cup of tea is waiting for me (also the shower and the bed). I hope to wake up hungry and fresh for two more working days till the weekend :)

Tags:, , , »
Comments (3) »

Software Architecture: Logic vs Physical Layers.

By: graffic

Layers vs Layers

First I’d like to point out that talking about physical things in software is a bit non-sense. But I hope this distinction will help to understand what’s next.

Going into business, I’d like to talk about a software architecture discussion I had today. I was asked if the development team in my office was using the “3 layer” architecture in the applications I was developing. The typical high level architecture where you define data, business and User Interface layers. (Example in a in Microsoft tutorial).

While we divide between data access and business, we do not do it always in different projects (physical parts. Now you can laugh). Usually we create projects with specific functionality and internally (logically) we organize the code in different parts. After this explanation the face of the one who made the question was “a bit of a poem” (literal translation from Spanish to say that his face showed clearly what he was thinking).

The question that came immediately after was: Does an architecture layer mean a different project? Does the idea of having 3 layers means that we should have 3 huge “physical” blocks to build our application?

Time ago, in a galaxy far away, you could find those SQLUtil classes/files with all the SQL you’ll need for your application (and for the rest of your life). It seems to me that the idea of having a project for the same purpose is like the modern version of SQLUtil, but now v2.0 . Huge data queries put together for the sake of being data queries.

But why a physical part on the application cannot contain functionality for 2 logical layers?

Many times you find yourself building a part of an application and using specific data structures to make it work. Even more, usually you encapsulate the data behind and provide it in a more structured, organized and meaningful (for the software) way. That’s how in a N-Tier application an upper layer use the services of the lower layer.

Now is time for you to contribute with your experiences to this post: how do you organize your “physical” and your “logical” layers?

Tags:, , , , , »
Comments (3) »

Repairing a Macbook AC Adaptor

By: graffic
Fixed Macbook Charger

The problem

A mouse decided that one of our MacBook AC adaptors was the most healthy food available for him. So he chewed the thin cable connecting the charger with the notebook and he did it exactly in the join between the cable and the charger.

Result: the charger was working but some days after the few cable left wasn’t able to stand all the current and it got burnt. The charger survived so there were two options: repair the cable or buy a new charger.

A new charger costs around 100 Euro in Greece. Before giving such amount for a new one it’s better to try a “Do it yourself” solution. (One day Apple will remove its finger from its <auto-censored> and they’ll start doing something about their overpriced products and awful service in Greece.)

Solution – Step 1: Open the shell

If the cable were cut in the middle, you could fix it easily. But being cut in one extreme requires you to open the charger. There is only one problem with that: the charger wasn’t designed to be opened.

Both parts of the charger shell are stuck together. You’ll need to cut your way through. A Dremel multitool could help, but we did the job with a small trowel, a blade and a hammer. You need something to cut through, not to divide it. It’s quite well stuck and you could break the outer shell if you apply too much force.

Do not cut too deep. The charger has a metallic shell inside.If you use a Dremel you should be careful to remove only the external plastic when cutting through.

Step 2: cables

Cable holder

The thin cable white cable contains two cables inside. One in the core, and the other around as a shield. As the connection point was burnt and melted I couldn’t understand which one was the inner or the outer cable.

A clean cut in the plastic piece that holds the cable against hard tugs can help. The results are:

  • Black is for the outer cable.
  • White is for the inner cable.

Soldering.

The inner cable is the easy part. The outer cable was the difficult part. I know there is special tubing to join the shielding part with another cable. But the dirty patch worked.

Get some heat shrink tubing to protect the soldering points and to wrap the full fix. I forgot to put tubing around the entire solution. But the important is not to use tape in the bare cable because with heat and after 2 days is going to unstick.
Finishing the job.

To protect the new joint against pulling it too hard and having to fix it again, I used thermal glue. I stuck the cable to the charger and put some glue in the soldering points. The result is here:

Fixed ChargerMacbook AC Adapter working

Till now the AC Adaptor works (1 week). It’s not as beautiful as a healthy one but if it does the job we’re happy :)

Tags:, , , , , , »
Comments (2) »

26 days of 2009

By: graffic

Snow and chains

The new year came while Christmas started to fade. When holidays were over the normal routine attacked again. I got a bit lost in the daily office-home-weekend cycle. It’s difficult to wake up when you’re warm under the covers.

So it’s time to stretch a bit with a post. This one will go into the “Personal” category.

2008 gave me:

  • My life back. I changed job and my life is better now.
  • Knowledge about what I like to do and what I don’t like.
  • Friends visiting me in Athens. Thank you all, I had a really good time.
  • A Greek residence permit and a Greek driving license. Now I can get a traffic fine.
  • 50% of a car. Now neighbours can scratch it.
  • Friends to spend time with.
  • A special person to share my flat with :)

In 2009 I’d like to:

  • Get a scooter and a motorbike license. I hate waiting 20 minutes for the bus.
  • Improve my Greek. It’s time to take it seriously.
  • Learn how my IPTV box works. Cat’s curiosity.
  • Train a bit. Too much sofa is bad.
  • Travel more than last year.
  • Write more useful things here :)

Have a nice 2009 :)

Tags:, , »
Comments (1) »

One DevDay at Microsoft Greece

By: graffic

From time to time Microsoft gives you the opportunity to learn more about their products. Today I attended to one “DevDay” called “Unleash the Power of Microsoft .ΝΕΤ 3.5” (link). A set of brief presentations to the new key features in the .NET Framework 3.5.

I was lucky and there was not much traffic in the way to Microsoft premises. Also the bus featured a more or less accurate system to announce the name of the next stop. I got off when the voice named my stop and Microsoft building was there, waiting for me with warm coffee, croissants and christmas sweets. They now how to take care of the ones who will extend their empire (we, developers).

The programme was the following:

WCF Framework

Working more or less as expected from the first day, this framework let’s you communicate with almost any kind of “service protocol”. And also provide services using the same list of protocols. Simple, easy and based on the well known SOAP (hey! WCF it’s not a new protocol. It’s a framework for many protocols).

Workflow Foundation

This is new in Microsoft. People in the Java world know more about BPEL and workflows. For Microsoft this is their first gig and they provide a do it yourself workflow.

This can be good because is so simple that you can implement it even in a console application. But it can be bad because you need to develop almost every detail. If you’re used to something like Websphere, this is not for you.

I like that is lightweight. So perhaps, and with some basic code, you can implement a workflow service for your needs.

WPF Architecture

This wasn’t a “Look a cube rotating with buttons floating! and this is your user interface”. Windows Forms applications were lacking from architecture. Many people were doing bussiness logic directly in the function executed when you click a button. Fast, easy but 2% scalable, 1% testable and 0% adaptable 1 year later.

Microsoft has created an improved copy of the web 2.0 (Where the html is not only for the content, but for the user interface). Its the View, Model, ViewModel pattern (link).

  1. Where you used a designer and photoshop, now you use the designer with illustrator.
  2. Where you used the services of some company/guy to put that design in HTML/CSS. Now you put a guy in Microsoft Expression Blend creating XAML for WPF.
  3. Where you had a developer creating the template, now you create a ViewModel.
  4. Where you had a developer creating the functionality of the application, you have the same guy doing the same and preparing “commands” to be executed by the WPF application.

As far as the guy speaking said, it seems that developers were complaining because they couldn’t do the same mistakes as they were doing before. Also he stated that you cannot test a Win Forms application. However if you divide the code in the right parts i believe is feasible and also the correct way to do it.

ASP.NET The horror begins

Not everything can be perfect, and this presentation followed this rule. It was based on 3 Demos: WCF JSON services, another based on linq using SQL and the ADO Entity framework and the last about a Dynamic Data application.

I’ll leave here some pearls/jewels: (I believe the guy was quite nervous)

  • “Without the ASP.NET AJAX framework we would have to code the AJAX calls by hand”. This guy doesn’t know jQuery, Dojo or Prototype (for example).
  • “A tool than can help you to see what’s happening is Fiddler“. Fiddler is a really good tool. But it makes more sense to me Firefox + Firebug instead of Visual studio to debug javascript, IE to view the page and Fiddler to see the HTTP traffic.
  • “We will see this on the console” (Of a web application). Web applications don’t have console. 5 minutes looking for the console.
  • He made a databind  in the Page_Load of a huge amount of data. This means to mark the data as dirty and force the inclusion on the VIEWSTATE. So he was pushing and encoding half customer list into the HTML produced.
  • “With LINQ to SQL you can only use MS SQL Server”. He should use Google more and visit this link.
  • “You cannot put stored procedures in LINQ to SQL”. Latter he did that on an example and stated that “You cannot put database functions in LINQ to SQL”. I do use SQL functions through LINQ in my daily job. So I guess I should be using something from another planet.
  • He got lost trying to show how to insert or delete on LINQ. I told him where to find what he was looking for, but my comment was futile.

Summary

I guess I learned some useful things about .NET in this small seminar. So if you have the time and you’re interested in Microsoft products, DevDays are worth to attend.

Tags:, , , , »
No comment »

DotNetNuke on IIS + Apache as proxy

By: graffic

I've been setting up a development environment with Apache HTTPD and IIS. My Apache HTTPD listens on port 80, so IIS has to listen in another port(s). We’re using DotNetNuke (DNN) for a small web portal, and is installed in the IIS. This implies DotNetNuke working in a non standard port.

Problem

While we can give people in the local network the address with the port, they do not understand the address with this symbol “:” and they forget or mistype it. Also we’re used to type addresses like: redmine, svn, wiki, and go to the desired service. Why not the same for an IIS application?

DotNetNuke was configured with the option UsePortNumber set to True. This allows you to access the application using another port. It seems like a hack for the redirection service. If you don’t put that DotNetNuke will do a redirect loop. DotNetNuke will ignore the port in your request and will try to go to the default site alias:

  1. You visit test:90
  2. DotNetNuke finds only test as host
  3. DotNetNuke redirects to the default site alias: test:90
  4. Go to point 2.

But UsePortNumber forces the port number always. If you’ve made your connection using port 90, but you ask for host mydevhost, DotNetNuke will alter the host to mydevhost:90 and force a redirect (302). This can be a mess if you have an apache as a reverse proxy not using that port for requests. DotNetNuke will always redirect you. If you have access to the redirected host, is ok, but if not, you won’t be able to access (imagine apache serving internet requests for a intranet installation).

Solution

Configure your apache reverse proxy using mod_proxy. Example:

<VirtualHost *:80>
  ServerAdmin yo@yoyo.yo
  ServerName mydevhost
  ServerAlias mydevhost.mydomain.local
  ProxyPreserveHost On
  ProxyPass / http://localhost:90/
  ProxyPassReverse / http://localhost:90/
</VirtualHost>

Add mydevhost as an alias for your portal and in your web.config disable UsePortNumber.

This will stop you from accessing DotNetNuke in the 90 port, but will let the proxy work and won’t force any strange redirect. Perhaps with mod_rewrite something better can be done, but I haven’t tried.

I Hope this helps :) .

Tags:, , , , , , »
Comments (1) »

Jamón & Co. in Greece

By: graffic

If you decide to live abroad some things you enjoy in your home country won’t be available. You change a bit your clothes, the food you buy and prepare and even the coffee and tea you drink. But even if you do change you still miss some things.

Sascha likes to buy Swiss cheese and prepare delicious pasta. Me, being from Spain, there is something that I miss a lot: Jamón. I also miss Spanish cheese and other “embutidos” (sorry, I can’t find a translation for it). So here is the question: What can you find in Greece?

Chorizo: you can find chorizo in Carrefour supermarkets as Τσοριθο. The quality is not very good but is edible.

Embutido: In AB supermarkets and form a Spanish company (Iglesias) you can find a tray with salchichón, lomo, chorizo and jamón. Good quality and around 6.5 euros per tray (250 grams).

Jamón: Also in AB supermarkets you can find a tray with jamón in slices from the same spanish brand. You can also buy a clean leg without bones and fat. The price in this case goes from 25 euro/kilo for jamón serrano to 58 euro/kilo for jamón ibérico.

I believe this is only a small part of all things you can find. If you, reader, know where to get any other typical Spanish products (wine, cheese, restaurants) feel free to comment :)

“Que aproveche”

Tags:, , , , »
Comments (6) »

References in Java and C#

By: graffic
1
2
Whatever  blah= new Whatever();
blah= utility.GetANewBlah();

Today is the second time I get a piece of code like this and I have to stand this huge misunderstanding about references. This time was done in C# but the first was in Java. Anyway, they behave in the same way for this matter.

Java and C# behave with variables that point to objects as placeholders for references. Using the example code as a guide, we execute the following steps in order:

  1. Define a variable called blah
  2. Create a new instance of Whatever
  3. Assign to the variable a reference to the new instance we’ve just created.
  4. Call a method in the object utility. The utility variable in turn holds a reference to another object.
  5. The method returns a reference to an object of type Whatever. We assign it to blah loosing the previous reference.

There is the mistake. We create a new object for the fun of typing code and then we forget about it. This behavior should be avoided in 99% of the cases because when the programmer does that he believes he is assigning the contents to the first generated object, when in fact he is forgetting about it and assigning a new one. This, if done in C++, will make your application eat your memory for breakfast.

This misunderstanding can lead to the following snippet I saw in a previous project.

1
2
3
4
5
6
7
List<Url> blah= new List<Url>();
...
blah.Add(icanhascheezburger);
....
blah= utility.GetANewBlah();
...
this.useBlah(blah);

Of course icanhascheezburger was lost and the coder was wondering why. In this case the previous coder assigned to that project did the same, and the new coder, not being used to the Java language, followed his example copying the behavior. From this snippet we have to understand that in line 5 we loose the reference to the object and if we don’t have a copy of that reference whatever we did before is lost.

C# notes.

  • No, the equal operator cannot be overloaded in C#.
  • Doesn’t apply on properties. A property can replace the behaviour of the equal operator and, for example, on assignment copy the content. But we have to code that behavior.

Use with caution.

We can use this behavior in some restricted cases. For example when the new assignment is “exception prone” and we want to continue no matter the result.

1
2
3
4
5
6
Whatever blah= new Whatever();
try {
blah = utility.GetPreviousBlahs();
}
catch () {}
this.DoSomething(blah);

In this case perhaps GetPreviousBlahs should return an empty list. Anyway, in case it fails, we can continue and operate with blah because it’s initialized.

Summary

Do not waste your time,others time, memory and CPU time. Object variables are references and the = operator removes the previous reference and assigns a new one.

Tags:, , , »
Comments (2) »

Eurosport evening

By: graffic

Yeah! All evening watching Eurosport.” I’m quite sure that many of you have listened something equal or similar to this. Put another channel, or add some specific sports. The image of a guy drinking beer while watching basket or soccer will come into your mind. I have to say that I’m not a fan of TV sports, but this last evening I spent it enjoying some TV sports (without beer but with feta cheese).

Eurosport 2 - Championshin Gaming series 2008

But I didn’t watch neither soccer nor basket. There is a trick. I found a broadcast of the Championship Gaming Series 2008 on Eurosport 2. I guess it was the quarters of the World Championship: Dallas vs San Francisco. Dallas was the favourite but the last Counter Strike round was amazing and San Francisco got the points.

It’s nice to see again some faces I saw in the documentary Frag. Like the Dallas team manager. At the same time is sad to see how the image changes from having fun playing games to teenagers squeezed by teams that use them to get money from sponsors.

TnT Quake Clan

Years ago I was playing games. I wasn’t good, but I enjoyed a lot. We had our clan and we used to meet to play games online and with our computers. We even used to go to lan parties together and had really good moments. We were the TnT Quake Clan. The good of been a free teenager.

Now I don’t play many games. Some times I play Wii Sports (I like to be pwned by betabug at Tennis) and some DDR, but not these times where you get tired of playing. I have some games I want to play still in the shelf. And today I realized that Red Alert 3 is out (but reviews don’t say good things about it). Buah! I want a month off!

By the way. If you’re in Athens and you play DDR or love C&C game series. We have a coffee pending :)

Tags:, , , , , , »
Comments (1) »