This blog is subject the DISCLAIMER below.

Wednesday, February 27, 2008

Finally EDC date released!!

Microsoft Egyptian Developers' Conference

Today, while checking my Facebook, I found Sherif El-Touny has announced the date of EDC (Egyptian Developers' Conference) finally it released :-) it'll be from 13th to 15th APRIL
I hope to see all there if I could attend, I'll keep you updated with any news...

.. more.

Saturday, February 23, 2008

ERP Solutions & CRM Application

- ERP Solutions & CRM Application :

Did you see these words "ERP & CRM" when you browse software companies' web sites !!!! , so what these words mean ???


- ERP Solutions :

ERP is short for enterprise resource planning , a business management system that integrates all facets of the business, including planning, manufacturing, sales, and markting . ERP Soultions are software applications that help business managers to control business activities such as inventory control, order tracking, customer service, finance and human resources


-CRM Applications :

Short for customer relationship management. CRM entails all aspects of interaction a company has with its customer, whether it be sales or service related .Because of revolution of information technologies , the interaction between companies and their customers is done through a web site application or through WAP phones .So that CRM application is a web application that can interact with customers to gain informations about these customers and through these information we can organise it for proper analysis and action. It is needed to keep that information up-to-date, make it accessible to employees, and provide the know-how for employees to convert that data into products better matched to customers' needs.

For examples about ERP solutions and CRM application products in real life, visit this web site :
-http://ajyal.com/en/index.html " ERP solutions "
-http://ajyal.com/en/solutions/non_commercials.html " CRM application "

.. more.

Friday, February 22, 2008

Microsoft Student Festival

The Modern Approach To Learning
Did you hear about Microsoft Student Festival??
The Microsoft Student Festival is the first event of its kind held on a university campus in the Middle East. It’s objective is to allow students the opportunity to interact directly with Microsoft and learn more about its products and programs. The event also presents opportunities to meet Microsoft partners, regional sponsors, and of course, fellow students.

ATTENDANCE IS BY INVITATION ONLY and you need to register here. hurrrrrrrrrrrry up and take your invitation from your MSP, we are looking forward seeing you there ",)

.. more.

Thursday, February 21, 2008

Debugging Tomcat web applications using JDeveloper

Hello All

I managed to enable JDeveloper to debug with tomcat and here are the steps to accomplish that.

As a prerequisite for this, you must have a tomcat server locally installed. I need to note also that this way you won’t be able to debug jsp files (Only classes). Actually there is a way around that but it’s so buggy and tiresome.

First you need to add those lines to the java options in tomcat configuration:

-Xdebug

-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

Second, go to the folder where tomcat is installed (for me it is “C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\Catalina\localhost”) and create a file called “project1.xml” for example, and paste this line in it.

project1\ViewController\public_html" path="/project1" reloadable="true" />

Where

docBase is the path to your public_html folder

reloadable=”true” allows tomcat to pickup any changes that you make to your jsps.

Path is the path that you can access your web application through.

Third, you need to create a new run configuration for tomcat (we need a remote debugging configuration):

* Check “Remote Debugging and Profiling”
* Go to Debugger -> Remote and change
o Protocol à Attach to JPDA
o Host à 127.0.0.1 as we are debugging through the locally installed tomcat server.
o Port à 8000 ( It should match the port specified in the tomcat configuration as in step 1)

Fourth, we need to change the Output Directory from “ViewController\classes” to “ViewController\public_html\WEB-INF\classes”

And to do this go to View Controller Project settings then to Project Content and change the Output Directory Textbox.

.. more.

Tuesday, February 19, 2008

DreamSpark

How would you like a free copy of Microsoft Visual Studio 2008? How about the entire Microsoft Expression Studio? Not enough...... how about Microsoft Windows Server 2003 and more?

For once, something that sounds too good to be true really is this good and really is true. Starting today (or soon in some areas), students worldwide will be able to download our professional development and design tools for free! It's called DreamSpark and it is upon us.

More on: http://channel8.msdn.com/Posts/2047/

.. more.

Monday, February 18, 2008

A common bar-code problem

A tiny detail that is usually missed when working with bar-codes (written in fonts like: "3 of 9 Extended", etc) is writing the bar-code text between brackets or asterisks:

myLabel.Text = "*"+myBarcode+"*";

or

myLabel.Text = "("+myBarcode+")";

Forgetting using one of the above ways makes the code unreadable by bar-code readers..

.. more.

C# : indexed pixel problem

Here I will mention the solve for a common problem happens when you try to create Graphic object from Bitmap images as in the next two lines..yes, it would fire an exception if your bitmap was indexed pixel .

Bitmap tmp = new Bitmap("Fci-h.jpg");
Graphics grPhoto = Graphics.FromImage(tmp);

Exception : "A Graphics object cannot be created from an image that has an indexed pixel format".

To pass this exception you will need to add some additional lines of code . Just create an image with the same size like the original image (Fci-h.jpg) then draw the original image onto the new Graphics object .

Here is an Example :

Bitmap bm = (Bitmap) System.Drawing.Image.FromFile("Fci-h.jpg",true);
Bitmap tmp=new Bitmap (bm.Width ,bm.Height );
Graphics grPhoto = Graphics.FromImage(tmp);
grPhoto.DrawImage(bm, new Rectangle(0, 0, tmp.Width , tmp.Height ), 0, 0, tmp.Width , tmp.Height , GraphicsUnit.Pixel);

.. more.

Ropes for Java

A Rope is an alternative to the traditional java String. A rope is a kind of heavy weight String that perform faster and more effcient in terms of modification. Basically, the rope is not effcient in normal string operations, but, it is powerfull when in appending its conents, also looping a rope is linear, which means a great performance in terms of time. A Rope is represented as a tree rather than an array of characters as the normal String.

For a deeper look: click here. or here.
To download the latest version of ropes: click here.

.. more.

Thursday, February 14, 2008

Stamping text file in PDF pages

I wrote C# function that Stamping the content of text file (text and hyper links) at the front of the select pages (selected by the user) from the PDF .

NOTE :
This C# function stamp the text with aligning the text at the center of the selected pages ,the function based on the latest library called ItextCharp ( iTextSharp 4.0.8 (2008-01-25) .
Download the library from here

iText

# (iTextSharp) is a port of the iText open source java library written entirely in C# for the .NET platform.
iText is a library that allows you to generate PDF files on the fly. It is implemented as an assembly.

Parameter Example :

string sourcefile --> "input.pdf"
string SaveFileName--> "output.pdf"
float Y_space --> 405
float lead--> 25
float FontSize --> 12
string TxtFileName--> "textostamp.txt"
string _Font --> "HELVETICA"
string pagesRange --> "3,6,8" or "3-6,9-15"


you must to import this namespaces :)
using System.IO;
using iTextSharp.text.pdf;
using iTextSharp.text;
==

/* StamperTxt is a class which stamps the content of text file (text and hyper links)

* at the front of the select pages (selected by the user)from the PDF .

* */

public StamperTxt(string sourcefile, string SaveFileName, float Y_space, float lead, float FontSize, string TxtFileName, string _Font , string pagesRange)

{

PdfReader pdfreader = new PdfReader(sourcefile);

float pagewidth = pdfreader.GetPageSize(1).Width;

int j = pdfreader.NumberOfPages;

bool[] flag ;

flag = new bool[j];

for (int i = 0; i <>

flag[i] = false;

if ((pagesRange.Trim() == "all" )&&(pagesRange.IndexOf("-") == -1 )&&(pagesRange.IndexOf(",") == -1 ) )

{

for (int ii = 0; ii <>

flag[ii] = true;

}

else if ((pagesRange.IndexOf("-") != -1))

{

string[] tempArr = pagesRange.Trim().Split(',');

foreach (string str in tempArr)

{

string[] tempArrhyphen = str.Trim().Split('-');

int startIndex = 0, endIndex = 0;

startIndex =int.Parse(tempArrhyphen[0].Trim());

endIndex = int.Parse(tempArrhyphen[1].Trim());

for (int s = startIndex; s <= endIndex; s++)

{

flag[s-1] = true;

}

}

}

else if ((pagesRange.IndexOf(',') > -1))

{

string[] tempArr = pagesRange.Trim().Split(',');

foreach (string str in tempArr)

{

int index = int.Parse(str);

flag[index-1] = true;

}

}

PdfGState pdfgstate = new PdfGState();

pdfgstate.FillOpacity = 1.0f;

Stream output_stream = new FileStream(SaveFileName, FileMode.OpenOrCreate);

PdfStamper pdfstamper = new PdfStamper(pdfreader, output_stream);

for (int k = 0; k <>

{

if (flag[k] != true)

continue;

PdfContentByte pdfcontentbyte = pdfstamper.GetOverContent(k+1);

float v_space = Y_space;

pdfcontentbyte.SaveState();

pdfcontentbyte.SetGState(pdfgstate);

BaseFont PF = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, false) ;

pdfcontentbyte. SetFontAndSize(PF , FontSize);

StreamReader SR;

string S;

SR = File.OpenText(TxtFileName);

ArrayList chunklist = new ArrayList();

S = SR.ReadLine();

while (S != null)

{

Chunk chk = new Chunk(S + "\r\n", FontFactory.GetFont(_Font, FontSize, Font.NORMAL));

if (S.IndexOf("http:/") > -1)

{

chk = new Chunk(S + "\r\n", FontFactory.GetFont(_Font, FontSize, Font.UNDERLINE));

chk.SetAnchor(S);

}

chunklist.Add(chk);

S = SR.ReadLine();

}

//Console.WriteLine(S);

SR.Close();

Phrase PH = new Phrase();

PH.Font = FontFactory.GetFont(_Font, FontSize, Font.NORMAL);

PH.AddRange(chunklist);

PH.Leading = lead;

PdfPTable table = new PdfPTable(1);

table.DefaultCell.Border = Rectangle.NO_BORDER;

table.DefaultCell.SetLeading(lead, 0);

table.TotalWidth = pagewidth;

table.HorizontalAlignment = Rectangle.ALIGN_MIDDLE;

table.DefaultCell.HorizontalAlignment = Rectangle.ALIGN_MIDDLE;

table.HorizontalAlignment = Rectangle.ALIGN_CENTER;

table.DefaultCell.HorizontalAlignment = Rectangle.ALIGN_CENTER;

table.AddCell(PH);

table.WriteSelectedRows(0, -1,0, v_space, pdfcontentbyte);

}

byte[] arr = pdfstamper.Writer.XmpMetadata;

pdfstamper.Close();

pdfreader.Close();

Console.WriteLine(SaveFileName + "Was Created in Success...");

}////end Function

.. more.

Tuesday, February 12, 2008

The release of large chain in Microsoft

As mentioned in MSDN magazine ,27 of February will be worldwide launch of Windows Server 2008, Visual Studio 2008, and SQL Server 2008 .

Microsoft Windows server 2008 : the most advanced Windows Server operating system yet, designed to power the next-generation of networks, applications, and Web services. With Windows Server 2008 you can develop, deliver, and manage rich user experiences and applications, provide a secure network infrastructure, and increase technological efficiency and value within your organization.

Microsoft Visual Studio 2008 : delivers on Microsoft's vision of enabling developers and development teams to rapidly create connected applications with compelling user experiences for Windows Vista, the 2007 Microsoft Office system, mobile devices and the Web. With the release of Visual Studio 2008 Beta 2, Microsoft is taking a leap forward on its promise to enable developers to harness this next wave of innovation.

Microsoft SQL Server 2008 :provides a trusted, productive, and intelligent data platform that enables you to run your most demanding mission critical applications, reduce time and cost of development and management of applications, and deliver actionable insight to your entire organization.

Downloads :
http://www.microsoft.com/heroeshappenhere/learn-more/downloads/default.mspx

more information : http://www.microsoft.com/heroeshappenhere/default.mspx

.. more.

Sunday, February 10, 2008

How to create a multi-lingual web site Step By Step

As usual there are two ways to make a multi-lingual web site:

· The easy , beautiful and half functional way.

· The hard , ugly but full functional way.

We will go first through the common steps for the both ways

First create your ordinary web site with your VS

In the design view add one label and one button and leave them with their default values

From your solution explorer right click on your web site and click add new item and choose Resource File and rename it with you page name and extension (Default.aspx)

A Massage will pop for you asking for creating a Global Resources folder click no

Add a new folder with the name APP_LocalResources and put your Resource file on it

In the Label and the Button add new attribute meta:resourcekey="ResourceName"

Add a new string value in the resource file with the same resource key name and add .Text like ResourceName.Text and give it the Default language value like English

Copy the resource file and rename the new one to the secondary language name like Default.aspx.as-EG.resx

Give the ResourceName for the button another values in the Arabic resource file like عربي

Here come the easy way

Set the Culture and UICulture to Auto from designer or from aspx file like Culture="Auto" UICulture="Auto"

And now just run you application , The Button and the label now should have the default language values from the resource file

Change the default language for you explorer (most explorers will be from Tools->Internet Options->Language(Button)

If the Arabic language is not already there add it and move it up

Now refresh you page and the label and button should change their text to عربي

That’s easy as you can see :d but what is the user don’t know about how to change the browsers language, then we should use the bit harder way and use a button to change the Culture and the UICulture values from the code.


*You need now to change the Culture information on the button Click event, But the problem here is that the culture information will be reset on the postback, so you can use whatever way to keep its value but here I will use cookies .

Now make a new class with name common and put it in the App_Code folder

Make a bool attribute with the name ISArabic like

public static bool IsArabic

{
get

{
if (Thread.CurrentThread.CurrentUICulture.Name == "ar-EG")

return true;
else
return false;
}
}

Now on the button Click we will create a new cookie(if it doesn’t already exist) and give it the culture value just as fallows

HttpCookie myCookie = (HttpCookie)Request.Cookies["Localization"];

if (myCookie == null)

myCookie = new HttpCookie("Localization");

Then we will set the cookie value acording to the current choosen culture

if (Common.IsArabic)

myCookie.Values["Language"] = "en-US";

else

myCookie.Values["Language"] = "ar-EG";

then we set the cookie and add it and Then we redirect to the same page

myCookie.Expires = DateTime.Now.AddYears(1);

Response.Cookies.Add(myCookie);

Response.Redirect(Request.Url.AbsoluteUri);

Now add a new Item and choose Global Application Class

Add a new event called Application_BeginRequest and put the code which checks for the current culture on it just like that


void Application_BeginRequest(Object sender, EventArgs e)

{

HttpCookie myCookie = (HttpCookie)Request.Cookies["Localization"];

if (myCookie != null)

{

//Read culture from cookie
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(myCookie.Values["Language"]); System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture(myCookie.Values["Language"]);

}

else

{

//Create new default cookie

myCookie = new HttpCookie("Localization");

myCookie.Values.Add("Language", "en-US");

myCookie.Expires = DateTime.Now.AddYears(1);

Response.Cookies.Add(myCookie);

//Set the thread default culture

System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");

System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");

}
}

Don't forget to remove the Auto values for the Culture And UICulture

Now everything should work just fine

You can now use the resource file and change strings, pictures and icons just according to the chosen language

source files could be found here

.. more.

Fedora 9 alpha release

Fedora 9 Alpha have been released a minutes ago here is the link of the page and for downloads

http://fedoraproject.org/get-prerelease

.. more.

Thursday, February 07, 2008

.network.org 2nd gathering

Get ready for the second .network group gathering..

Date: Saturday, February 9, 2008
12:00pm - 4:00pm

Location: CIC (the Canadian International College) campus.

Busses (to the gathering) will be available in front of "Nady EL-Sekka" from 11:00-11:30

Event Agenda:
12:00 - 01:30 Khaled Hnidk, Link Development - WCF – Messaging & Channel Model
01:30 - 02:00 Coffee Break
02:00 - 03:30 Mohammed Meshrif, Microsoft - SQL Server Maintainability
03:30 - 04:00 Lunch


Check the facebook group: http://www.facebook.com/group.php?gid=2409268236
& the Event page: http://www.facebook.com/event.php?eid=7974276601

& join the Yahoo!Group: http://groups.yahoo.com/group/dotnetworkorg/

.. more.