{Log in or Register}

This Is For Coders and Programmers. Code Anywhere!!!

July 20th, 2009 1 Comment   Posted in AJAX, ASP.NET, C#, Community, PHP, Programming, SEO

Hello Guys,

Check www.meetcoder.com…. and Code Anywhere!!!    This is For Coders and Programmers.  SignUp for UpDates.www.meetcoder.com

Fundamentals of programming for professionalism

March 18th, 2009 No Comments   Posted in Programming
Fundamentals of programming - the future of professionalism
In order to work effectively and begin to understand all the details, the programmer is necessary to examine the foundations of programming. It is important to start with clean language and logic, for example with the same C + + or Pascal. This will allow a special thought to be a programmer, and lay the foundations for future knowledge. It should be noted that the ability nakidat buttons on the form and ask them to handlers of events - frankly little to the understanding of the principles of proper programming. Unfortunately this way of learning programming is now widely used beginners trying, without committing an error. More »

I began to use Zend Framework

October 8th, 2008 No Comments   Posted in PHP

At work develop a project with the use of Zend Framework. To it with wramework’s i did not work, but enough quickly studied basis and beginnings actively to use him.  Today I want talk about feelings and considering which arose up in latter days.

First that it should be noted -  Zend Framework lays on serious rules on the structure of catalogues. It is good, as a clear structure of project gives to understand at once, where for you Comptrollers, Models and files of templates which are responsible for a kind.

More »

Enums in C# - use sbyte

August 14th, 2008 No Comments   Posted in C#

C# Code Specification:

The following example declares an enum type named Alignment with an underlying type of sbyte.

enum Alignment: sbyte
{
Left = -1,
Center = 0,
Right = 1
}

When you use enumerations in C# - you easy can declare new values as sbyte. Standart type of variable is int, but you can use and sbyte type.

C# - start only one copy of the program

August 10th, 2008 No Comments   Posted in C#

If you need that the program was started an only to one copy - can take advantage of such simple and useful class:

public class SingleInstance
{
private bool firstInstance = false;

public bool FirstInstance
{
get { return firstInstance; }
}

public SingleInstance()
{
Mutex mutex=null;
try
{
mutex = Mutex.OpenExisting("ProgramName");
}
catch (WaitHandleCannotBeOpenedException e)
{
firstInstance = true;
}

if (mutex == null)
{
mutex = new Mutex(false, "ProgramName");

GC.KeepAlive(mutex);
}
}
}

Now, we need edit Program.cs like here:

[STAThread]
static void Main()
{
SingleInstance single = new SingleInstance();

if (single.FirstInstance)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}

Now the program will be started only in one copy. A code works on the different versions of Windows - including Vista.


Tags: , ,

PHP - array_map and callback functions

July 30th, 2008 No Comments   Posted in PHP

callback functions of arrays are a very powerful instrument, using which, a programmer can obtain flexibility and simplicity of work with arrays. The callback functions of arrays are created for modification of content of arrays a method “value after a value”.
We will consider the function of array_map(), which in a general view looks so:

array array_map ( mixed $callback , array $array1 [, array $array2... ] )

the first parameter is a function of treatment of array, must work exactly with the that amount of parameters, which you will pass to it. For an example it is possible to consider simple example which will simply illustrate work of this function:

<?php
function format_values($value)
{
	return '<b>'.$value.'</b>+';
}
$myarray = array('first', 'second', 'third');
$formatted_array = array_map("format_values", $myarray);
echo('<pre>');
print_r($formatted_array);
echo('</pre>');
?>

As a result of implementation of this code, we will get the values of our array in a bold style. As the first parameter of function of array_map we passed the name of function which will process every value of array $myarray. It should be noted that function of array_map return an array $formatted_array, every value of which is treated the function of format_values.

Resize Jpeg image using PHP

July 29th, 2008 No Comments   Posted in PHP

If you created galleries once - you know how important create the small preview images. In PHP we easy can do it. Now we write small function which will change the size of image. If you need show the image preview do it:
<img ALT="preview" SRC="resize.php?url=image.jpg" />
Here file resize.php:

<?

function resize($img_src)
{
header('Content-type: image/jpeg'); list($width, $height) = getimagesize($img_src);

$source_img = imagecreatefromjpeg($img_src);

$dest_img = imagecreatetruecolor(64, 64);

imagecopyresampled($dest_img, $source_img, 0, 0, 0, 0, 64, 64, $width, $height);

imagejpeg($dest_img);
}

if(isset($_GET["url"]))
{
resize($_GET["url"]);
}
?>

Function simple and to explain as it works it is not needed. But if you need change size of many images
- it is needed to understand that this function will strongly slow work of site.


Tags: , ,

How to do redirect by web.config in ASP.NET

July 29th, 2008 No Comments   Posted in ASP.NET

If you want create the mod_rewrite analogue and use links as mysite/user/DeVoid or send an user on other page - use web.config option urlMappings in ASP.NET:

<configuration>
<system.web>
<urlMappings enabled="true">
<add
url="~/Article28.aspx"
mappedUrl="~/MyNewBestArtile.aspx"/
>
<urlMappings>
</system.web>
</configuration>

Using urlMappings you will be able to do your site on ASP.NET more attractive for an user

phpDoc in Eclipse - when the comments become more clear

July 27th, 2008 No Comments   Posted in PHP

About importance of commenting of a code was spoken already many times. About importance of commenting of a code was spoken already many times.
If you would want that each class written by you was clear to you and your colleagues - can use the simple standard of record of the comments:

/ **
* Short description - used in indexlists
*
* Multiple line detailed description.
* The handling of line breaks and HTML is up to the renderer.
* Order: short description - detailed description - doc tags.
*
* @param string Target directory for the generated HTML Files
*/

If before the announcement of a class or method to write such comment - IDE will process it and will deduce to you the help at their further use. It is very convenient by collective development and large volumes of a code.
The purpose of methods becomes more clear, the transmitted parameters are deduced, the returned meanings are specified.
It is necessary to note that Eclipse automatically generates preparation under such style of the comment after introduction / ** and pressing Enter before the announcement of a method / class. And to receive the help it is possible on pressing Ctrl+Space after input $myClassName- >.

How-to: Comments in ASP.NET

July 23rd, 2008 No Comments   Posted in ASP.NET, Programming

When you create pages in ASP.NET - you must understand what you write. Comments help you write clean and clear code. Comments are the very important instrument of programmer. At the correct use of comments - his code is always clear a programmer and he can change him not reflecting.
Distinguish comments on the server-side and comments which are added to the outgoing HTML file.

If you want to write a comment which will be represented only inwardly aspx pages, and will not be visible an end user, use such syntax:
More »