rss
:)
    Find out what I'm doing, Follow Me :)

Tuesday, November 24, 2009

jQuery Intellisense in Visual Studio 2008

Hi guys,

I want to introduce you some cool thing – jQuery Intellisense in Visual Studio 2008.

jQuery makes JavaScript code easier and quicker to write. The library provides helper functions that dramatically increase your productivity while decreasing your frustration.

Every day I find more and more web sites which use jQuery. jQuery is faster and it saves a dozens of lines of code but with this shorter code was come the problems.

When I started to wrote jQuery code I found that I don’t remember all selectors or functions which are available in jQuery. In the beginning I wrote code with open jQuery's web site documentation. But in this way I spent too much time to search the selector or function. I needed the faster way to wrote jQuery code. And I’ve found it ! Jquery Intellisense!

jQuery intellisense will fully integrate with Visual Studio 2010 but if you still using Visual Studio 2008 you should do the next steps to get jQuery intellisense.

  1. Install Visual Studio 2008 SP1 – You can found it here

  2. Install VS 2008 Patch KB958502 – It allow you VS to support “-vsdoc.js” IntelliSense doc. files

  3. Download the jQuery-vsdoc.js file - You can download both the current jQuery release and jQuery –vsdoc.js here


 
Important: After downloading jQuery and jQuery –vsdoc.js you need to place them in the same directory in your project.




You can then reference the jquery files with an "script" tag:
<script src="jquery-1.3.2.js" type="text/javascript"></script>
<script src="jquery-1.3.2-vsdoc.js" type="text/javascript"></script>
After all these steps you will have jQuery intellisense in your VS.




If you want to have jQuery and jQuery intellisense in user control you need to add this block:

<% if (false)
    { %>
        <script src="jquery-1.3.2.js" type="text/javascript"></script>
 <% } %>


Now you can have fun with jQuery without check every minute online documentation when you writing something on jQuery.

Thursday, October 15, 2009

PHP VS - PHP IDE Based on Visual Studio

Hi guys,
I want to introduce you some cool thing.

Before couple of months I had to start writing on php project. I installed XAMPP configured apache, made mySQL database, set up Wordpress :) and start my Visual Studio and made php project :). Yes I started writing php scripts in Visual Studio - this is not a joke. When I asked some of my friends who wrote on php which IDE they used I got huge number of answers:

  • NetBeans

  • PHP Zend Studio

  • Maguna Studio

  • Quanta++

  • PHP Expert

  • PHP Rapid

  • Notepad++

  • Plug-in for Eclipse (If you used this you’ll never should shut down your computer, because if you close once eclipse you have to spend some years of waiting before eclips starts again :))

  • Etc.

So much tools and which should I use?

The answer is only one (for me :) ) – VS.Php

I’m a .NET guy and I like write code in Visual Studio. I want to have power of debugging, I want to view my site when I push some of “F” buttons. The VS.Php gave me this power :) and It is a plug-in for Visual Studio – which I have already installed on my PC, so I don’t have try another tools and install and uninstall them.

So what is VS.Php?

VS.Php is a PHP IDE based on Visual Studio IDE. With VS.Php you can design, develop, debug and deploy PHP applications within the Visual Studio IDE. VS.Php key features are around providing rich PHP editor as well as Smarty editing capabilities. Also is the ability to debug PHP scripts locally as well as remotely.

You have download VS.Php form here http://www.jcxsoftware.com/vs.php

When you install the VS.Php you can start your php project as good as you start the other .NET projects. File-> New …


The cool thing is that the php editor for Visual Studio provides the key features provided by other languages.

You have VS.Php color coding


Real-time syntax check


Intellisense


Code snippets


Goto definition


Html intellisense and auto-completion


The debugging with VS.Php is realy cool.

You have Debug Output Window



After I used VS.Php I think it is really cool.

The only one negative thing is that he is not free. But there aren’t two good things in this world and the world is not perfect :).

Monday, September 14, 2009

Java2Days Conference 08 - 09 October

Hi guys,

I want to introduce you the Java2Days event.


It’s a new event in Eastern Europe and it presents the latest trends in Java development.

The conference will be held at the Inter Expo Center on 8-9 October in Sofia, Bulgaria.

The conference is hosted by Insight_technologies and the Bulgarian National Academy for Software Development (NASD).

Over two days, more than 600 attendees will meet world famous lecturers, engaged all year round in such events as JavaOne, The ServerSide Java Symposium, Jazoon showcasing their latest knowledge in creating more reliable, scalable and secure solutions using Java technologies.

The fees for the conference are as follows:

VIP Pass – 175 EUR


VIP Pass Includes:

• Access to all sessions
• Eco bag with advertising materials
• VIP promoting gifts
• Coffee breaks
• Front row seating
• DVD with all conference materials, video, photos and etc.
• Q & A session with the lecturers

Standard Pass – 110 EUR

Standard Pass Includes:

• Access to all sessions
• Eco bag with advertising materials
• Coffee breaks
• Q & A session with the lecturers

You can add to your pass:

Lunch – 10 EUR per day

The buffet lunch is in a separate hall with plenty of salads, different kinds of meats, vegetarian dishes and desserts.

You can read more about Java2Days conference at http://java2days.com

Sunday, September 13, 2009

The Best Code Highlighter

Code highlighters are very useful tools to present code snippets on your blog or website with a professional look and improve the readability of code you provide for your readers. In this post I want to introduce you the best highlighter which I found.

The past two days I search in Google about code highlighters and I saw so much that I’ve got a headache.

I saw posts about:

• SyntaxHighlighter
• Quick Highlighter
• FV Code Highlighter
• Source Code Highlighter
• Highlight.js
• Etc.

There are so much highlighters but no one can’t highlight the source code in way what I want.

A good part of my posts contain source code snippets to illustrate and/or compliment the content. I’m a .NET developer and I write code in Visual Studio. In my posts when I show source code I want it to be formatted as in Visual Studio, with same colors and styles.
After two days research I found one. I think it’s the best one.

Windows Live Writer

You can download it from here.

The Writer Windows Live Gallery has a growing list of plugins. One of the useful is
Code Snippet plugin for Windows Live Writer.


But the most important to me is:

Paste from Visual Studio

It easily transfer syntax highlighted source code from Visual Studio to elegant HTML in Windows Live Writer.


You can find the plugin here.

If you have some troubles with installation on vspaste.msi file look this articles here and here.

I used Windows 7 beta and when I tried to install .msi file I had the error. But with “less msiérables” I could get the plug-in dll and then move it to “...\Program Files\Windows Live\Writer\Plugins”.

How does Paste from Visual Studio work ? Just copy the code from Visual Studio and insert it directly to Windows Live Writer.


The plug-in generates html and in browsers it is look exactly like code in Visual Studio.


public interface IChangeBoxedPoint
{
void ChangeProperties(int x, int y);
}

struct MyPoint : IChangeBoxedPoint
{
public int X { get; set; }
public int Y { get; set; }

public void ChangeProperties(int x, int y)
{
this.X = x;
this.Y = y;
}

public override string ToString()
{
string message = string.Format("X - {0}, Y - {1}", X, Y);
return message;
}
}


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="TestCaching._Default" %>
<%
@ OutputCache Duration="10" VaryByParam="none" Location="Client" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<
html xmlns="http://www.w3.org/1999/xhtml" >
<
head runat="server">
<
title></title>
</
head>
<
body>
<
form id="form" runat="server">
<
div>
<%=DateTime.Now %>
</div>
</
form>
</
body>
</
html>

The last that you can do is to delete author’s website link– It never shows up on the page, but it is on the bottom in the generated html.




This was a little disappointed to me, but the plug –in does it great job and the only one disadvantage is the hidden author’s link – which you can delete :)

Wednesday, April 1, 2009

Changing Fields in a Boxed Value Type

Hi guys!

This will be my first topic. I hope it will be useful.

Changing Fields in a Boxed Value Type

In many cases, we must get a reference to an instance of a value type. Someone will say “But we already have generics”.

Yes we have generics, but still has cases (if you start working on project, which has been written on Visual Studio 2003 ) in which you should use a mechanism called boxing .

I created a structure (it is of value type).


struct MyPoint
{
public int X { get; set; }
public int Y { get; set; }

public void ChangeProperties(int x, int y)
{
this.X = x;
this.Y = y;
}

public override string ToString()
{
string message = string.Format("X - {0}, Y - {1}", X, Y);
return message;
}
}

What happens when an instance of a value type is boxed?


MyPoint p = new MyPoint();
p.X = 1;
p.Y = 1;
object obj = p;

1. Memory is allocated from the managed heap

2. The value type's fields are copied to allocated heap memory

3. The address of the object is returned


Is it possible to change fields of already boxed value type ?


Let’s see :)


MyPoint p = new MyPoint();
p.X = 1;
p.Y = 1;
Console.WriteLine(p); // Displays X - 1, Y - 1

p.ChangeProperties(2, 2);
Console.WriteLine(p); // Displays X - 2, Y - 2

object obj = p;
Console.WriteLine(obj); // Displays X - 2, Y - 2

((MyPoint)obj).ChangeProperties(3, 3);
Console.WriteLine(obj); // ! Displays X - 2, Y - 2


When I casting obj to a MyPoint (made operation unboxing) and call ToString() method I expect the following result [ X - 3, Y – 3]. Why this result is obtained ?

Because casting obj to a MyPoint unboxes obj and copies the fields in the boxed MyPoint to a temporary MyPoint on the thread's stack! The X and Y fields of this temporary point are changed to 3 and 3.


How to change fields of unboxed object?


With interface and this interface defining a ChangeProperties method



public interface IChangeBoxedPoint
{
void ChangeProperties(int x, int y);
}

struct MyPoint: IChangeBoxedPoint
{
public int X { get; set; }
public int Y { get; set; }

public void ChangeProperties(int x, int y)
{
this.X = x;
this.Y = y;
}

public override string ToString()
{
string message = string.Format("X - {0}, Y - {1}", X, Y);
return message;
}
}


MyPoint p = new MyPoint();
p.X = 1;
p.Y = 1;
Console.WriteLine(p); // Displays X - 1, Y - 1

p.ChangeProperties(2, 2);
Console.WriteLine(p); // Displays X - 2, Y - 2

object obj = p;
Console.WriteLine(obj); // Displays X - 2, Y - 2

((MyPoint)obj).ChangeProperties(3, 3);
Console.WriteLine(obj); // ! Displays X - 2, Y - 2

((IChangeBoxedPoint)obj).ChangeProperties(3, 3);
Console.WriteLine(obj); // Displays X - 3, Y - 3

MyPoint myPoint = ((MyPoint)obj);
Console.WriteLine(myPoint); // Displays X - 3, Y - 3


The code is almost identical to the previous version, but the ChangeProperties

method is defined by the IChangeBoxedPoint interface and the MyPoint type now implements

this interface. I cast the object to an IChangeBoxedPoint. Now this is change the boxed MyPoint's X and Y fields. The interface method ChangeProperties has allowed me to

change the fields in a boxed MyPoint object.