You can convert different type of files such as .doc into PDF.
Saturday, 7 November 2009
IT Organizational Skills
- Taking good notes from meetings, conference calls, etc
- Setting goals and deadlines
- Having projects done on time.
- Communicate regularly about the progress and strategy improvements
- Reporting to your manager weekly about the progress
- Knowing where everything in the office is located.
- Making good use of time.
- Keeping work area stocked and neat.
- Documenting results
- If you have responsibility of other people as well, you should be maintaining their tasks list and chase them up to do their tasks
- Be aware constantly about what you are saying, to whom and what impact it could have; for instance if you say to your non-technical manager that the Server is down and I am working on it, he might be frightened though you know that it's a 1 minute job to make it work!!!
Project Planning
If you're responsible to write a project plan and task list of your team, you can use the following tools:
- Microsoft Project
- Microsoft Excel
- Microsoft Word
Then this should be maintained throughout the project and should be reported to your Manager e.g. weekly.
Personal Daily Agenda
Have a personal daily agenda for yourself which includes your own works; check the items as you finish them.
You can simply use NotePad for this.
Perception:
How your managers are perceiving you?
Are they constantly aware about your progress and hard work?
Do they FEEL confident in you and about your ability to do your job?
Do they FEEL that you have your tasks under control and they are progressing?
What messages are you sending with your words?
Thursday, 5 November 2009
C# 4.0 New Features
C# 4.0 Major new features - 4 major groups:
- Dynamic lookup
- Named and optional parameters
- COM specific interop features
- Variance
1. Dynamic lookup
It's a new feature which allows you to write the following at runtime: method, operator, property and object invocations.
- The validation of operations of a dynamic object is made at runtime not compile time. So if you have written an incorrect expression, you will only get the error message at runtime.
- DLR (Dynamic Language Runtime) is a new component which runs on top of CLR (Common Language Runtime) and provides dynamic services to C# 4.0.
Create a dynamic object:
dynamic d = GetDynamicObject();
d.M(4); // call a method
d.P = 2; // setting a property
d[1] = 3 // setting through indexers
int i = d + 3; // calling operators
string s = d(5,7); // invoking as a delegate
d = new Employee(); // assigning a static type to a dynamic type
var testInstance = new ExampleClass(d); // testInstance is a static type of ExampleClass not a dynamic type
M will be examined at runtime not compiletime. if d doesn't have a method called M, compiler ignores the error and it indeed at runtime an exception will occur.
What is a dynamic type anyway?
dynamic is a static type an instance of which bypasses the compile-time type checking. In other words, type checking will be defered to runtime.
So, you can use "is" and "as" with a dynamic type:
int i = 8;
dynamic d;
// With the is operator.
// The dynamic type behaves like object. The following
// expression returns true unless someVar has the value null.
if (someVar is dynamic) { }
// With the as operator.
d = i as dynamic;
Conversion:
1)
dynamic d = 7; // implicit conversion
2)
int i = d; // assignment conversion
3)
In C# 3.0:
((Excel.Range)excel.Cells[1, 1]).Value2 = "Name";
whereas in C# 4.0:
excel.Cells[1, 1].Value = "Name";
run-time COM binder in DLR will handle the conversion.
4)
In C# 3.0 this raises an exception at compile time:
object obj = 1;
obj = obj + 3;
Whereas in C# 4.0, this raises an exception neither in compile-time nor in run-time:
dynamic dyn = 1;
dyn = dyn + 3;
Passing a dynamic object to a static method:
Foo foo = new Foo();
dynamic d = new Bar();
var result = foo.M(d);
foo is a static object whereas d is a dynamic object. result would be a dynamic object itself because d which is a dynamic object has been passed to M method of foo.
... to be updated
Thursday, 29 October 2009
All About Batch Files
I can't explain how much I love batch files. You can write your commands in a .bat file, then you can run them. It's great for automation which saves a lot of time.
Ok, what can you do with it?
Start Applications
SET fromFolder=C:\Projects\Beacon\v1.0\code
START %fromFolder%\BrokerService\bin\Debug\BeaconServer.BrokerService.exe
START http://localhost/BeaconClientService.WebUI/Default.aspx
Copy Files
SET fromFolder=C:\Projects\Beacon\v1.0\code
SET toFolder=D:\Projects\Beacon\v1.0\code
xcopy /E /Y %fromFolder% %toFolder%
Build Solutions
SET msBuildFolder= C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
CD %msBuildFolder%
SET rootFolder=C:\SharedFolder\Beacon\v1.0\code\
MSBUILD %rootFolder%BeaconClient\src\BeaconClient.sln
MSBUILD %rootFolder%BeaconServer\src\BeaconServer.sln
pause
More:
Saturday, 24 October 2009
Friday, 9 October 2009
How to Know Which Ports of a Computer Is Open or Closed?
Code:
This is my PortScanner class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
public class PortScanner
{
public string Host { get; set; }
public PortScanner(string host)
{
this.Host = host;
}
public ScannerResult Scan(int fromPort, int toPort)
{
var result = new ScannerResult();
for (int portNumber = fromPort; portNumber <= toPort; portNumber++)
{
if (IsPortOpen(portNumber))
result.OpenPorts.Add(portNumber.ToString());
else result.ClosedPorts.Add(portNumber.ToString());
}
return result;
}
public bool IsPortOpen(int port)
{
Socket sock = null;
try
{
// Make a TCP-based socket
sock = new Socket(AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp);
// Connect
sock.Connect(host, port);
return true;
}
catch (SocketException se)
{
if (se.SocketErrorCode == SocketError.ConnectionRefused)
{
return false;
}
else
{
// An error occurred when attempting to access the socket
Debug.WriteLine(se.ToString());
Console.WriteLine(se.ToString());
}
}
finally
{
if (sock != null)
{
if (sock.Connected)
sock.Disconnect(false);
sock.Close();
}
}
return false;
}
}
This is my ScannerResult class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class ScannerResult
{
public List<string> OpenPorts = new List<string>();
public List<string> ClosedPorts = new List<string>();
}
And this is how to use it:
var portScanner = new PortScanner("127.0.0.1");
var result = portScanner.Scan(1, 65535);
How to Ping a Website or Server Asynchronously
Why?
Sometimes, you need to know whether a Server is down.
Code:
private void btnPing_Click(object sender, RoutedEventArgs e)
{
PingAsync("www.google.com", "I send myself to the callback method");
}
private static void PingAsync(string hostName, object toBeSent)
{
var pinger = new Ping();
pinger.PingCompleted += pinger_PingCompleted;
pinger.SendAsync(hostName, toBeSent);
}
private static void pinger_PingCompleted(object sender, PingCompletedEventArgs e)
{
PingReply reply = e.Reply;
DisplayPingReplyInfo(reply);
if (e.Cancelled)
{
Console.WriteLine("Ping for " + e.UserState.ToString() + " was cancelled");
}
else if (e.Error != null)
{
Console.WriteLine("Exception thrown during ping: {0}", e.Error.ToString());
}
}
private static void DisplayPingReplyInfo(PingReply reply)
{
Console.WriteLine("Results from pinging " + reply.Address);
Console.WriteLine("\tFragmentation allowed?: {0}", !reply.Options.DontFragment);
Console.WriteLine("\tTime to live: {0}", reply.Options.Ttl);
Console.WriteLine("\tRoundtrip took: {0}", reply.RoundtripTime);
Console.WriteLine("\tStatus: {0}", reply.Status.ToString());
}
Unsuccessful Ping:
If a computer is not reached successfully by the ping request, it does not necessarily mean that the computer is unreachable. Many factors can prevent a ping from succeeding such as:
- The machine being offline
- Network topology
- Firewalls
- Packet filters
- Proxy servers
More details:
Subscribe to:
Posts (Atom)


