TURKISH BLOG   |  ABOUT ME  |  ARCHIVES  | DELETE LANGUAGE COOKIE

Enes TAYLAN

Mind Hegemony - Mood 1.0 - Total Control Edition

RIA, Silverlight, Microsoft, Oracle, The Future of The Web and Web Technologies

clock February 23, 2010 07:18
Internet and computers are where things change fastest. Look at web technologies (and companies. Google is 12 and Facebook is 6 years old. Their revenues are $23 billion and $300 million, respectively). About in last 15 years user experience on the browser has changed dramatically: from static HTML pages, to dynamic web sites with advanced JavaScript capabilities (look at your Facebook Profile) and to the ultimate Rich Internet Applications (RIA) along with new web technologies to offer best tools for developers and experience for end users. Companies and communities have developed many technologies, programming languages and frameworks on browser and server side: JavaScript, ASP, PHP, Python, Ruby, JSP, JSF, ASP.NET etc. On PHP side, new versions have come to the use of developers and it dominated small websites (like small news websites) and is used by some big companies like Yahoo because of these companies' desire not to be dependent on another companies so they selected open source. JSP on Java side, has been used by many enterprises in their large scale websites. JSF was released as the successor of JSP but couldn't gain market share. On Microsoft side, ASP and its successor ASP.NET were released for dynamic websites and have been used by enterprises generally. All technologies and frameworks have continuosly improved, their new versions have released. Above is the current picture of web technologies. However, the future of internet seems very different from this picture and it seems that without breakthroughs, releasing new versions will not be sufficient for upcoming trends. (How can you build a website like this with Html?)

The reason why future of web will be different is RIA (Rich Internet Applications) because
-Graphic cards improving ceaselessly. PC's are becoming more and more powerful to display advanced UI. Even now they are more powerful than enogh to render traditional web pages.
-Social web applications need much more interactivity that traditional technologies lack.

Therefore, I think in at most 10 years, Html will be dead. When we sit on the laptop and open the browser, we will not see html content but RIA content. Html pages will live in our souvenirs. Along with Html, css will be obsolete also but not JavaScript because it will be used to communicate with browsers by RIA's.

To be able to use PC's rending power, new technologies have already been developed and are going to be improved. Flex (2004), JavaFX (2007) and Silverlight (2007) are RIA technologies by Adobe, Sun and Microsoft. Now let's look at companies' side. I think, the battle will be between Microsoft with its Silverlight and Adobe with Flex, if Oracle doesn't do anything in RIA area (it should improve JavaFX or may support more Flex) . Oracle's JavaFX (Oracle bought Sun last year) is dead now. Adobe's flex is market's No1 for the moment and Silverlight is its 4th version in 22 months. What's important is being in the RIA means also being in web technologies. In the future, when almost all websites will be RIA enabled, a company without RIA technology will be wiped out from the market. Even their server side technology will not be used. Think about Microsoft Silverlight. I think, it is the biggest guarantor of ASP.NET. If you want to use Silverlight, then using ASP.NET on server side and communicate with it via RIA Services it the best and smooth way of doing so. Almost nobody wants to use Silverlight with PHP in the back and use manual web services instead of RIA Services. Therefore, again if Oracle doesn't do anything its JSP (or JSF) will be useless also.


Dragging with Silverlight Thumb Control

clock December 3, 2009 07:59

Dragging can be a useful feature in various scenarios especially in visually compelling ones. In Silverlight we can add drag capabilities to almost every element by using their MouseMove event. However, this method doesn't provide us a smooth drag experience. For example, when we drag a rectangle control by using its MouseMove event, dragging it to LHS immediately after RHS direction just stops the control. Therefore, we'll use Thumb control that is designed to be dragged with its specialized events. Let's begin:

1. Add a Grid control to your .xaml (or just use default LayoutRoot Grid)

2. Add two Grid Row Definitions to define rows
<Grid.RowDefinitions>
 <RowDefinition/>
 <RowDefinition Height="46"/>
</Grid.RowDefinitions>

3. Add a Thumb control and define its DragStarted, DragDelta (core dragging logic) and DragCompleted events as below:
<Thumb x:Name="myThumb" Height="50" HorizontalAlignment="Left" VerticalAlignment="Top" Width="50" DragDelta="myThumb_DragDelta" DragStarted="myThumb_DragStarted"       DragCompleted="myThumb_DragCompleted" >
</Thumb>

4. Add a Textblock with with 4 Run control and 1 LineBreak to show which Thumb event is running and current coordinates of Thumb:
<TextBlock Grid.Row="1" TextWrapping="Wrap">
  <Run Text="Events: "></Run>
  <Run x:Name="EventRun" FontStyle="Italic"></Run>
  <LineBreak></LineBreak>
  <Run Text="Coordinates: "></Run>
  <Run x:Name="CoordinatesRun" FontStyle="Italic"></Run>
</TextBlock>

5. In DragStarted and DragCompleted events just add the code below to populate TextBlock EventRun for informational purposes:

private void myThumb_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e)
{
	EventRun.Text = "Drag Started";
}

private void myThumb_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e)
{
	EventRun.Text = "Drag Completed";
}

6. DragDelta event is fired each time as soon as our Thumb Control is dragged. In this event's handler logic we first determine where Thumb control is (relative to Grid) just before it is moved on the screen. Then we calculate Thumb's new margin by adding current margin and how much it is dragged and assign this new margin to the Thumb's margin property (so it is moved).

private void myThumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
{
	
	double marginLeft = myThumb.Margin.Left;
	double marginTop = myThumb.Margin.Top;
	
	double newMarginLeft = marginLeft + e.HorizontalChange;
	double newMarginTop = marginTop + e.VerticalChange;
	myThumb.Margin = new Thickness(newMarginLeft,newMarginTop,0,0);

        EventRun.Text = "Drag Delta (Thumb is being dragged)";
	CoordinatesRun.Text = newMarginLeft + "," + newMarginTop;
}

For informational purposes, populate EventRun and CoordinatesRun.

Hope, this helps.