Another day of the tentacle

December 23, 2009

Once you go MVC, you never go back.

Filed under: Geeking — amirkatz @ 10:24 am

MVCWell as an initial c# Winform developer I’ve extend my knowledge to Webforms and started to create lots of web application using that. Most of the applications are involved in the insurance price comparison and connectivity.
I’ve masterd the client and server side with lots of server infrastracture and DB, and client html css and javascript.

After the 2008 stock crises we got a very big project that was suppose to lift us back into game. the R&D manager decided to start doint it with MVC and jQuery with combination of Linq. As the senior developer I’ve first opposed since all of our infra is in webforms.
And if it works in a good manner why touch it. Well you don’t need to be the “brightest bulb in the tanning bed” to read the title and figure that we decided to use MVC. The reason is that as a developer in a highway of tech you allways have to stay put and lern the latest tech. And that what developers need to do to stay with the fingers on the pulse.

Well we start learning an writing ‘Hello MVC’ tutorials, we comined that with ‘Hello Jquery’ and ‘Hello LINQ’. The first barrier we had encounter was that we had to change our base perception. We have also decided not to use session! the big advantage is to allow load ballance without sticky session. MVC don’t have all the overweight Webform have it doesn’t use ViewState that can overweight pages most of the time without any purpose. And using Ajax in Webform just… how do I say it in an unoffensive manner…. other that SUCK!
The ajax tool kit is doing a really bad job specially the update panel that is not really ajax.. because if wont allow you to send a string but you have to send the entire form with viewstate and all other overhead that are really redundant in an ajax call.

In MVC the concept is that we split the application in to 2 main modules. The Controller and the View.
The Controller is the logic unit, it can use other logic Dll’s and decide what is the content that we need to use in a certain view.
Than it packs it all in a Model object, that is similar to a struct of properties. that view is getting that package (Model) and it uses to show it. so the View is only the UI if it has logic that have to be UI logic!
The Jquery is a plesure. After working with javascript alot I’ve found that you can do amazing client logic in couple of lines.
When programing jquery I play a game.. I’m tring to create the shortest script I can. single line is always the jackpot :)

MVC is very comfortable in receiving ajax calls, you can easly add authorize logic to controllers and actions. its a big advantage to differ between Get logic and Post in the server to allow same action in an initial call and postbacks. There was one issue that made me feel bad… The notorious “SPAGHETTY CODE”, it felt like after the revolution of webforms, where the server side logic and the aspx were seperated, MVC took us back in time. First, when I used the spaghetty code I told to my self silently “Its only UI.. Its only UI…” to make my self feel better. but after some time I really started to feel like Its only UI! and I’ve notice it’s true. If we have a full seperation on logic and UI. the UI can have nasty spaghetty code. and thats more easy to maintain because its UI. So I really started to like the concept. In Webforms UI bug can be found in the easy case in the aspx and in the hard case some where in the Code behind logic (in the hardest it can have to do with JS).

Well, It is going to be really hard to go back into webforms. the easyness of editing and the flexibility just makes web programming really fun!
Lets see if you go back to the [obsolete] Webforms.

December 6, 2009

Leave your mark in the Internet age.

Filed under: Digging in — amirkatz @ 4:20 pm

Leave your mark

While thinking on the meaning of life, I’ve hover on the assumption that we all would like to leave our mark in this world. Mozart did it in the super artistic means of symphonies and legendary melodies, and Da Vinci made it using a sublime skills of mix between a paint brush and innovative mind. My question is how can any of us do so today?

Today we are in a new age, maybe the most technological advanced age that this earth knew. Where every week we are encountering new innovations in all the technologic industries. I guess that have to do with the new digital era, today all the analogic information is converted to “Ever lasting” digital media that can be transfer easily from one side of the globe to another in minutes.
And the new era of easy global communication and knowledge base sharing, that enable researches to concat conclusion from different researches and get something new out of it. And this is how we got the substrate for an exponential growth in knowledge and innovations.

And all of that made me wonder… if Mozart and Da Vinci would have been born today. Would they achieve what they were able to achieve in the past life? And how they would expose their creation? in YouTube or Facebook?. would they sell their art on eBay or any other e-commerce site? would they create their own web site or get tired of the extreme pace this live requires and just smoke drugs all day and create art in their own home. That made me think that there is a big possibility they wouldn’t get the world fame and recognition they achieved centuries ago.

After this conclusion I’ve start thinking How can one leave his signature today. Well I guess in a couple of ways:

  • Break an amazing world record. like Usain Bolt or 8 an amazing winning streak like Michael Phelps
  • Write common used application such as Windows or default web site like google
  • Invent a best seller gadget like iPhone/iPod
  • Create a great YouTube clip that will be forgiven.

I guess there are lots of ways in this list. But, I have some internal doubts that any of them will last in the next 300 years and become ‘Imortal’ in our culture.

December 2, 2009

Jquery make your own ajax Slider.

Filed under: Geeking — amirkatz @ 1:35 pm

While looking for a slider I’ve found a lot of plugins. But none was customized like the one I wanted. So I started looking for the creation technics to understand how its done. The main concept of the slider is to create a div that will use as a frame to the slider content. 

This div will have a constant width + height and the important thing is to set the overflow as hidden and relative positioning. and will contain 2 divs the first is the content the second is the worker (loader) div. 

The content div will have the  the slider width and height and will have relative positioning 

such as this: 

<div id="sliderFrame" style="width:500px;height:200px;overflow:hidden;position:relative;">
    <div id="contentDiv" style="width:500px;height:200px;position:relative;">[The Content]</div>
    <div id="workerDiv" style="width:500px;height:200px;position:relative;">[The Ajax Content]</div>
</div>

Now we will write a short jquery func to load the content and slide in, I’ve written it in a function but it can easily transform into plug-in. 

You will have to trigger that function in a “next” button or some other trigger. 

 
var loading = false;
function loadGalleryContent()
{
if (!loading)
{
loading = true;
$("#workerSpan").load([Place the server side function],'',function()
{
var syncFlag = 0; $("#workerSpan").css("opacity",0.2);
$("#workerSpan").animate({
"top": "-=200px",
"opacity" : 1
}, 2000,"swing",function()
{
syncFlag++;
if (syncFlag == 2)
{
InitGalleryAfterAnimation();
}
}
});
$("#contentSpan").animate({
"top": "-=200px",
"opacity" : 0.2
}, 2000,"swing",function()
{
syncFlag++;
if (syncFlag == 2)
{
InitGalleryAfterAnimation();
}
}
});
}
}
else
{
setTimeout(loadGalleryContent,1000);
}
}

function InitGalleryAfterAnimation()
{
$("#contentSpan").css("opacity",1);
$("#contentSpan").css("top","");
$("#workerSpan").css("top","");
$("#contentSpan").html($("#workerSpan").html());
$("#workerSpan").html(''); loading = false;
} 

The first function is loading the content, i’ve used the loading bool as a lock mechanisem since $.load() is async and can have muli calls. in the load postback we will call 2 asnc animation functions. That should slide the content from the bottom to the top. This slider can be adjusted by initing the workerDiv in another location and in the animation change the left to – right,top or bottom. for vertical or horizontal. You can custom it however you would like. You can add paging or other jquery animation effects, the important thing is to understant how it works. You can also adjudt it to work with out ajax. just place all the content in the content div (you don’t need the worker div) and play with the content div location.

you can find live example of the custom slider on This site, Its a project I’ve done for a shoe company. They requested a slider to show the shoes. that can run in automatic fashion and in menual.
Hope I’ve helped.

 Comments are more than welcome!

 Amir Katz

November 26, 2009

Another day another war…

Filed under: The begining — amirkatz @ 9:20 am

Morning,

27 years, and what have I learnd? That life are just too complext to explain in a brief. There are just too many layers in us, and in each one of the layers can be so diffrent and complex. The sadest thing is that we can see only the layers we know at other people. Lets say if two people are interacting, than the one who is listening is reading all the information and anylasing the other out of the layers that he have and thinking in his own mind set, and he can miss all the beauti of the other layers.

If people could just read each other in an ‘objective’ matter than I presume we can understand each other better. But I guess that it has to be a good reason that we are so diffrent and we have a mechanisem that won’t let us understand each other.

Why am I decided to start like this… Well I guess that I have couple of reasons… life are just too complex. I belive that the best why to understand something is try to explain it. and by that I mean that i’m in a quest of try to understand how it all became that confusing…

I live in Tel Aviv with my Girlfriend which is psychologist. We are living together for an year.

I think I got it all… Good job, nice ride, great apartment in TA, friend family and health. I got hobbies like jiu jizu and guitar. I’m in good shape and very atletic.

But I feel like my future is blured… When talking with coachers the most important thing that they want is to give you some kind of roadmap.

They ask you to write your life in 20 years.

I’m kind of sure what I want to achive in 20 years, but I don’t know what I want to do tommorow or even in the next year.

All of that makes me feel bad! and ‘On paper’ I should be very happy, I’m not!

Thats what I’m trying to understand.

I hope this blog can guid me or even you! yes I’m talking to you. the reader.

You can leave a comment saying what do you think someone with that feeling can do…

It can be a todo list or any other activity.

Bye for now…

Amir

November 25, 2009

My first post

Filed under: The begining — amirkatz @ 5:29 pm

Hi,

Well after watching ‘Julie and Julia’ I’ve decided to open my own blog!

I’ve decided I’m going to talk about the quest… not a quest game, but the real advanture. I’m going to talk about the most fascinating  issue that I was able to think of.

I’m going to talk about life!

Who’s? Mine I guess… Since I’m the closest person to myself.

That is all for now.

Bye till next time,

Amir

Theme: Rubric. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.