Türkçe   |   English
Calendar
Categories
Archive
Links
Blogroll
Files

02.12.2009
String.Join

It's easy to produce a string output of an array of strings in our applications. But it's even easier with the String.Join function:

string[] arr = new string[3];

arr[0] = "a";
arr[1] = "b";
arr[2] = "c";

string joined = String.Join("|", arr);
MessageBox.Show(joined);

This code will return an output of "a|b|c"

This overload takes the seperator as the first parameter and string array as the second parameter.

Code
Comments(0)

20.11.2009
WMI Code Creator
WMI Code Creator is a very useful tool that generates WMI code. It generates the code in C#, VB.Net and VBScript. You can download it here. In the download, the code of the application is also included.
Code
Comments(0)

02.11.2009
Viewing .flv files
In order to be able to view .flv files in our web applications, there is a setting that we need to make in IIS. If we don't make this setting, it's highly possible that we get an error like "videoname.flv not found". In IIS, in the Properties screen of your site, open HTTP Headers tab. In Mime Types, type .flv as the extension, video/x-flv in the content type. When you save the changes, you are ready to view the flv files in your application.
Code
Comments(0)

20.10.2009
Visual Studio 2010 Beta 2 is released

Visual Studio 2010 Beta is now ready for download for MSDN subscribers. For detailed information you can visit:

http://go.microsoft.com/fwlink/?LinkID=151797

News
Comments(0)

18.09.2009
#if DEBUG and [Conditional("DEBUG")]

If we want a code block to run in only debug mode, we can use one of these 2 ways:

  private void Form1_Load(object sender, EventArgs e)
        {

#if DEBUG
            MessageBox.Show("debug");
#else
                MessageBox.Show("not debug");
#endif
            RunInDebug();
        }

        [Conditional("DEBUG")]
        static void RunInDebug()
        {
            MessageBox.Show("Debug mode");
        }

Code
Comments(0)

11.08.2009
How to get IE version
In our applications, there might be times that we need to know the user's Internet Explorer version. In order to achieve this, we can query the Version item's value in Registry under HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer.
Code
Comments(0)

09.07.2009
Getting operating system's user interface language
In order to get the language of the operating system that our application is running (also in cases that a MUI is installed), we can query the Registry Editor's HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Language\ location's InstallLanguage item.
Code
Comments(0)

11.05.2009
101 LINQ Samples

Here is an MSDN link that you can view 101 samples about LINQ syntax:

http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx

Code
Comments(0)

20.03.2009
Internet Explorer 8
I was using Internet Explorer 8 RC wıth many cool new features for a while and it has been released today. You can download it here.
News
Comments(0)

24.12.2008
Changing SQL Server collation

While formatting and reinstalling my computer on Sunday, I realized that my SQL Server Collation wasn't installed in Turkish. Since I was incredibly bored of installing programs, I didn't want to uninstall and reinstall SQL Server. I searched the web and found out that there's a way to change the collation of SQL Server. The answer to do this is in the setup.exe in C:\Program Files\Microsoft SQL Server\90\Setup Bootstrap folder. When you run the command below in command prompt you can change collation of your SQL Server. Important: There is one thing to remember before running this command: you should back up all your user databases!!!!

C:\Program Files\Microsoft SQL Server\90\Setup Bootstrap>start /wait setup.exe /qb INSTANCENAME=MSSQLSERVER REINSTALL=SQL_Engine REBUILDDATABASE=1 SAPWD=pass SQLCOLLATION=TURKISH_CI_AS

Code
Comments(2)

20.12.2008
Catching Internet Explorer tab closing

When we want to do something with javascript when a user closes an Explorer window, we simply handle the body onunload event. But when a user is working in an explorer that has more than one tab open, this event doesn't work when we want to do something if the user closes a tab, not the explorer window. So, if we need to do something when a user closes an explorer tab and since a browser tab is a window, we can simply handle the window.onbeforeunload event:

<script language="javascript" type="text/javascript">
window.onbeforeunload = opengoodbyepage;
function opengoodbyepage()
{
window.open(
'bye.aspx', 'popUpWin',
"toolbar=no,location=no,menubar=no,resizable=no,width=410,height=300,top=300,left=400");
}
</script>

Code
Comments(1)

03.08.2008
Shadowfax and Palantir in CodePlex!
My first open source project Palantir, that helps you manage the frequently used remote desktop connections and Shadowfax, another open source personal blog project that Tamer Öz and I developed and use in our blogs are now published in CodePlex. You can check them out from the links below:

Shadowfax
Palantir
News,Open Source
Comments(0)

10.06.2008
Creating thumbnails

In order to generate the thumbnails of the pictures that users have uploaded in our applications, we can use the method below:

public void SaveThumbnail(string path,string thumbnailPath,int newWidth,int newHeight)
        {
            System.Drawing.Image i = System.Drawing.Image.FromFile(path);
            System.Drawing.Image thumbnail = new System.Drawing.Bitmap(newWidth, newHeight);
            System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(thumbnail);
            g.DrawImage(i, 0, 0, newWidth, newHeight);
            thumbnail.Save(thumbnailPath, System.Drawing.Imaging.ImageFormat.Jpeg);
        }


Code
Comments(0)

12.05.2008
Experience WorldWide Telescope
If you want to try and see Microsoft's virtual telescope WorldWide Telescope, it can be downloaded from here.
News
Comments(0)

04.05.2008
How to format Business Data Catalog (BDC) List Web Part with Sharepoint Designer

One of the coolest things that comes along with MOSS 2007 is that we can now acquire data via a web service or a database with Business Data Catalog and publish it on Sharepoint portal. Let's say you've created your Application Defition File and you acquired the data over your Business Data List and viewed it on the portal. But you've noticed that unlike the other list web parts, there is no grouping, sorting interface in business data list web part that you can apply these particular operations. At this point, you can edit web part's xsl by clicking the XSL Editor button that you can see in the edit window of the web part. But if you don't want to deal with xsl, Sharepoint Designer comes to your assistance. In order to edit your business data list web part with Sharepoint Designer, open the site that contains the web part from the File menu by clicking Open Site. After that, open the page where the web part is located by double clicking. Select the Business Data List web part that you want to edit. You'll see the > button on the top right corner of the web part. Click it and the menu below will open:



In the menu, click the Dataview Properties link. In the General tab, check the Show toolbar with options for: checkbox and among Filter, Sort, Group actions, check whichever ones you want to apply:



That's it! Thanks to this menu that is opened by clicking the top right corner of the web part, you can not only arrange grouping, filtering etc, but also change things like web part content and table style, paging settings and conditional formatting.

Code
Comments(1)

14.04.2008
Application.Lock() and ApplicationUnLock()

As all of we know, in web applications if we want to keep a global variable that applies to all users and sessions, we can use the ApplicationState. Since ApplicationState can be accessed by more than one thread at the same time, in order to prevent the Application object's value to be set in more than one thread, while setting a value to an Application object, we should call the Lock method of the Application object, set its value and call the UnLock method so that its value is freed for other threads to set:

Application.Lock();
Application["isil"] = "asdasd";
Application.UnLock();

Code
Comments(0)

04.03.2008
Image - RotateFlip

You can call the RotateFlip method of the Image object in order to rotate your images 90, 180 and 270 degrees in your applications. The RotateFlip method takes RotateFlipType enum as parameter. In these enums, you can call the ones with 'Flip' if you want to rotate them on X or Y axises:
 private void Form1_Load(object sender, EventArgs e)
        {
            Image img = Image.FromFile(@"C:\a.jpg");
            img.RotateFlip(RotateFlipType.Rotate90FlipX);
            pictureBox1.Image = img;
        }

 

Code
Comments(0)

02.03.2008
WorldWide Telescope
Microsoft created a virtual telescope application by blending the images acquired from the telescopes on both earth and space with the Visual Experience Engine™ technology. The application is named WorldWide Telescope and will be available for use this Spring. Thanks to WWT, we will be able to use our computers like a telescope and we will be able to view planets, stars and approach them. In WWT website, it's also emphasized that it will be a cutting edge resource in astronomy education. In order to have detailed information on WorldWide Telescope, you can visit the FAQ section in http://www.worldwidetelescope.org/.
News
Comments(0)

25.02.2008
.ashx and null session issue

If session is null while working with ASHX and you can't manage to access session state implement IReadOnlySessionState in your class:

C#

public class Sertifika : IHttpHandler, System.Web.SessionState.IReadOnlySessionState
{
     public void ProcessRequest (HttpContext context)
     {
           context.Response.ContentType = "text/plain";
           context.Response.Write(context.Session["isil"]);
     }


     public bool IsReusable
     {
       get
       {
           return false;
       }
     }
}

VB:

Public Class Sertifika
    Implements System.Web.IHttpHandler
    Implements SessionState.IReadOnlySessionState

    Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest

        context.Response.ContentType = "text/plain"
        context.Response.Write(context.Session("isil"))

     End Sub
     ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
        Get
            Return False
        End Get
    End Property

End Class

Code
Comments(6)

08.11.2007
I've updated my blog!

I updated my blog that has been on air since last April with its new design and infrastructure a couple of days ago. On the code part, we aimed the infrastructure to be completely extendable (thanks Tamer:)) and on the apparent part, it's completely redesigned (thanks Erbuğ:)). As new features, besides the new parts of articles, photo album and news, there is also multilanguage support in this new version of my site:) From now on, I'll be sharing stuff with you both in Turkish and English. I'd again like to thank Tamer and Erbuğ for their great support and contribution.

News
Comments(0)

Photos
Me in MSDN Forums
-   Answered the question How can i get it in the Visual C# General forum
-   Answered the question How to add the VAT to the ammount in the Visual Basic General forum
-   Contributed a proposed answer to the question How to add the VAT to the ammount in the Visual Basic General forum
-   Replied to the question How can i get it in the Visual C# General forum
-   Replied to the question How to add the VAT to the ammount in the Visual Basic General forum
-   Answered the question How to show ToolStripMenuItem's hot key? in the Windows Forms General forum
-   Contributed a proposed answer to the question How to show ToolStripMenuItem's hot key? in the Windows Forms General forum
-   Answered the question Expert to Excel Missing Some Data In Grid View in the Visual C# Language forum
-   Contributed a helpful post (total votes:1) to the forums thread Expert to Excel Missing Some Data In Grid View in the Visual C# Language forum
-   Replied to the question How to show ToolStripMenuItem's hot key? in the Windows Forms General forum
Entries
News
Articles