Your Ad Here
Aug 11

We, as you the others on the globe, like blogging a lot in Turkey. Some of my friends write in English but most of the blog-writers have Turkish blogs. So it is wise to have a Turkish blog script to publish your Turkish contents. Indeed we have many scripts in Turkish, it is nice to have the BlogEngine.NET in Turkish.  Check the official site  

Thanks guys,

Tags:
Aug 08

Microsoft has announced a free tool for Windows Mobile programmers that can take stock of what resources applications are using. The "Windows Mobile API Usage Tool" performs static analysis of selected binaries, then reports on their usage of APIs (application programming interfaces) and other resources, the company says.

As a new posting on Microsoft's Windows Mobile Team blog notes, some APIs in Windows Mobile have been deprecated and may not be present in future versions of the operating system. Therefore, it's important to be aware of all the APIs an application is using.

The Windows Mobile API Usage Tool is designed to run on desktop computers running Windows Vista or XP, and requires Visual Studio 2005 or 2008. It is a command-line utility that allows selecting either a Windows Mobile application (in .CAB or .MSI format), or a directory containing multiple applications, as input. It will examine the selected code, then create a report listing its system dependences, optionally including any deprecated APIs, says Microsoft.

The tool saves its output in a SQL Compact Edition database (.SDF) file, and is said to be capable of creating a collection of useful reports. The Windows Mobile Team is encouraging developers to examine their applications with the tool, then send in copies of its reports to the company. This will aid in planning the future evolution of Windows Mobile, according to Microsoft.

To read the Windows Mobile Team's posting about the Windows Mobile API Usage Tool, see its blog, here. To obtain further background and download the tool, go to the Microsoft website, here.

kick it on DotNetKicks.com
Aug 07

As most of you know, a very nice series is going on dev102.com site for a while. Instead I was following the questions; I couldn't find any time to answer them till now. Here is this week's question “Point In Polygon” and below is my answer.  

   1:  //Solution : assume we draw a line parralel to x-axis. on CheckPoints y value, 
   2:  //from left side of the polygon to the point. 
   3:  //we need to count number of the borders intersects with this new line.
   4:  //if the number of intersections is odd, the point is inside
   5:  //if even then it is outside.
   6:  Point p1, p2;
   7:  int IntersectionCount = 0;
   8:  for (int i = 1; i < Polygon.Count; i++)
   9:  {
  10:      p1 = Polygon[i - 1];
  11:      p2 = Polygon[i];
  12:      //Check to draw the line from -infinity to the CheckPoint.
  13:      if ((p1.x < CheckPoint.x) && (p2.x < CheckPoint.x))
  14:      {
  15:          //Check if any intersection
  16:          if ((p1.y <= CheckPoint.y) && (p2.y >= CheckPoint.y))
  17:  IntersectionCount++;
  18:          if ((p1.y >= CheckPoint.y) && (p2.y <= CheckPoint.y))
  19:  IntersectionCount++;
  20:      }
  21:  }
  22:  if (IntersectionCount % 2 == 0)
  23:      Console.WriteLine("Outside");
  24:  else
  25:      Console.WriteLine("Inside");

Download the source. Program.cs (2.04 kb)

Tags:
Aug 06

As you see on the right side I’ve many widgets and planning to add some more. But I think having so many widgets, especially if they are tall, is not visually so nice and effective. I searched for anyone who had the same problem and found Chris’s blog and his a brilliant solution,  Collapsible Widgets”.

The idea is really nice but on the other hand, setting the display style directly to none or block causes sharp and graceless transition. Hence there are many js codes for animated div transitions; I decided to go for another solution to collapse/expand the widgets with animation. After a quick search I found a handy animation on DynamicDrive.

The rest of work is just to place these js files correctly into BlogEngine and configure it. To do this, fist; add these two js files into js folder (create a new folder named as js in the webroot ) in your webapplication’s root.


Then we need to add these js files into the generated pages on runtime. BlogEngine has a nice page structure and so easy to add js files with the
AddJavaScriptInclude function in BlogEngine.Core/ Web /Controls/ BlogBasePage.cs file. Add the following lines to the BlogBasePage.cs in line 89.

 

   1:  //add JS files for animatedPanel
   2:  AddJavaScriptInclude(Utils.RelativeWebRoot + "js/jquery-1.2.2.pack.js");
   3:  AddJavaScriptInclude(Utils.RelativeWebRoot + "js/animatedcollapse.js");
   4:   
   5:  //and the original code goes on
   6:  AddJavaScriptInclude(Utils.RelativeWebRoot + "blog.js");
   7:  if (User.IsInRole(BlogSettings.Instance.AdministratorRole))


Then, we need to configure widgets to toggle theirselfs to collapse/expand. Editing App_Code/ Controls/ WidgetBase.cs as following will be enough to complate our changes.

 

   1:  if (ShowTitle)
   2:     //Change the title text to an active link to toggle collapse/expand toggle
   3:     sb.Append("<a href=\"javascript:animatedcollapse.toggle('widgetContent" + WidgetID + "')\"><h4>" + Title + "</h4></a>");
   4:          
   5:     //old title
   6:     //sb.Append("<h4>" + Title + "</h4>");
   7:  else
   8:     sb.Append("<br />");
   9:   
  10:     //Change the contentDiv and give the id starts with widgetContent
  11:     sb.Append("<div  id=\"widgetContent" + WidgetID + "\" class=\"content\">");
  12:   
  13:  writer.Write(sb.ToString());
  14:  base.Render(writer);
  15:  writer.Write("</div>");
  16:  writer.Write("</div>");
  17:   
  18:  //Initialize animatedcollapsepanel for widget.
  19:  writer.Write("<script type=\"text/javascript\"> animatedcollapse.addDiv('widgetContent" + WidgetID + "', 'fade=1'); animatedcollapse.init();</script>");


That’s all, you can see the result on my widgets by clicking their titles.

I think having smooth UI transitions and animated stuff in your webpage is not bad :)


Download the codes
: AnimatedWidgets-BlogEngine.NET.rar (21.97 kb) 

kick it on DotNetKicks.com
 

Aug 05
A while ago I was working on Web Parts and their personalization futures so I worked with custom editors and editor zone. As you know, editor zone is displayed at a fixed location. But for users it is really handy to have editor zone on top of the each corresponding webpart, please check your igoogle page and try to edit one of the widgets. You will see what I mean.  

So at the beginning I searched for injecting editor zone into webpart. But after really complicated and dirty code, it didn’t work efficient. Later on I made a little investigation on rendered HTML page with IE Developer Toolbar. I found out that every webpart has a table identified as “WebPart_” + WebPartID. So if we have an HTML table than it is a piece of cake to inject a div (editor zone) into it with javascript.  

Here is the javascript that positions the editor zone on the selected webpart.

<script language="javascript" type="text/javascript">
          function PositionEditor(part) {
                if (document.getElementById('EditorZone2') != null) {
                       
var tr = document.getElementById('WebPart_' + part).insertRow(1);
                        var td = tr.insertCell();
                        td.appendChild(document.getElementById(
'EditorZone2'));
                      }
          }
</script> 
 

And for sure, we need to register that function call on the page render as fallows: 

protected void Page_Prerender(object sender, EventArgs e)
{
    
if (WebPartManager1.SelectedWebPart != null)
            
ScriptManager.RegisterStartupScript(this, typeof(Page), Guid.NewGuid().ToString(), "PositionEditor('" + WebPartManager1.SelectedWebPart.ID + "');", true);
}


That’s it.


kick it on DotNetKicks.com
Tags: | |
Aug 04

Good job Turkish MVPs. As the MVPs, we all are participating in communities some how. But Turkish MVPs did a nice job. They were working on a very special and brilliant project, on a “Best Practices” book for last couple of months. All individual MVP had something to say put these articles together in a book.

Now it is a printed, unique handiwork. It’s available via idefix and alfakitap and you may also want to see the blog and leave comments.



PS: I did a small piece of editorial work, but in the second version I know what to write from now on.

kick it on DotNetKicks.com
Tags: | |
Aug 04

W3C announced new standards that will make it easier for people to browse the Web on mobile devices. Mobile Web Best Practices 1.0, published as a W3C Recommendation, condenses the experience of many mobile Web stakeholders into practical advice on creating mobile-friendly content.

You may want to look.

Tags: | |
Software Blogs TopOfBlogs