Friday, June 12, 2009

Checking camera used for clicking image

Hi all,

Two days back i was in discussion with one of my frd that how to confirm when image was taken which camera was used for clicking that image. After one hour of search i was able to find out some easy ways to do so. Actually this information for which we are looking for is stored in the image at metadata part and called Exif data for the image. Now a days this information is kept in the images from nearly all cameras in world. One can use following link for getting that info from images

http://camerasummary.com/ [For online check]

http://www.sentex.net/~mwandel/jhead/jhead.exe [For checking on desktop]

viewing this information is much easier in WinXP Without using any extra software. Check screen shot given below

Ok there are some other ways also with even using any specific software. One can open the file with notepad or anyother file openning software. And by reading some specific locations which were easily indentified by vieweing them. just have a look on below image as understanding depends on computer knowledge i left it on you. which mode you choose to open the file. yellow ring tell camera make. red ring tells camera model and pink rectangle tells the date image is taken.

Virat

Tracking ip using email, tracking email

Hi All,
Actually today when i was chatting to one of friend i got one request from XYZ@gmail.com to add as friend at Gtalk. I accepted that And then started i got some nude images from that XYZ. Now when i was getting these mails i was thinking to figure out who (s)he is ???

i tried to check the mail header but as everyone knows that google removes the sender information from the mail header so hopefully i didn't find any thing useful there. Now the real mystery begins but after one minute thinking i got fairly simple idea. i have one server for http://abc.com there i kept one image and then i embedded the link of that image in my email and sent to the XYZ@gmail.com and bingo!!! as soon as that fellow opened the mail i got the IP on my server's Access log and i know with whome i am dealing with. :)

One can get the server access log location at win server using following steps:-

1. type %SystemRoot%\system32\inetsrv\iis.msc in run box
2. then right click on default website
3. then at website tab check the enable logging option
4. then click on the properties in that option. which will open a new dialouge.
5. now in this new dialouge box one can see the log path. and just below the path log file name is also provided.

Now once you got the current log file open that

#Software: Microsoft Internet Information Services 5.1
#Version: 1.0
#Date: 2009-01-29 20:25:04
#Fields: time c-ip cs-method cs-uri-stem sc-status
20:25:04 127.0.0.1 GET /images/12n2ous7jwh9x16dfo51.jpg 404
20:25:04 127.0.0.1 GET /images/usgeacviq89qexvvu3gd.jpg 404

here i have 127.0.0.1 as IP but once user open the mail you will get that same ip in log.

Virat

Wednesday, April 1, 2009

Group By on DataSet using DataView

I've got a GroupBy function on one forum[http://episteme.arstechnica.com/eve/forums/a/tpc/f/6330927813/m/349006142831] . I feel this is something really nice i am using this right now after come changes but here i am pasting there the original copied code from that forum(check it before you use it for your need)
public static DataTable GroupBy(DataTable table, string[] aggregate_columns, string[] aggregate_functions, Type[] column_types, string[] group_by_columns)
{
DataView view = new DataView(table);
DataTable grouped = view.ToTable(true, group_by_columns);
for (int i = 0 ; i < aggregate_columns.Length ; i++)
{

grouped.Columns.Add(aggregate_columns[i], column_types[i]);
}
foreach (DataRow row in grouped.Rows)
{
List <string> filter_parts = new List &l;string> ();
for (int i = 0; i < group_by_columns.Length; i++)
{
filter_parts.Add(string.Format("[{0}] = '{1}'", group_by_columns[i], row[group_by_columns[i]].ToString().Replace("'", "''")));
}
string filter = string.Join(" AND ", filter_parts.ToArray());
for (int i = 0; i < aggregate_columns.Length; i++)
{
row[aggregate_columns[i]] = table.Compute(aggregate_functions[i], filter);
}
}
return grouped;
}
And you should use something like
string[] column_names = new string[] { "number", "avg_price", "total" };
string[] column_functions = new string[] { "count(products)", "avg(price)", "sum(charge)" };
Type[] column_types = new Type[] { typeof(int), typeof(decimal), typeof(decimal) };
string[] group_by = new string[] { "order_id" };
DataTable grouped = GroupBy(data, column_names, column_functions, column_types, group_by);
Which will be the equivilant of the SQL command:
select order_id, count(products) as number, avg(price) as avg_price, sum(charge) as total from data group by order_id
it may need some extra handling to account for DBNull values in the columns that you are grouping by.

Synchronous process execution from VC++


Following is the Sample code for executing a process in VC++ synchronously. We can use System command also but that display a command propmt flash also. To avoid command prompt flash i have used earlier ShellExecute API but that runs a process Asynchronously.

ShellExecute(NULL,NULL,"C:\\Test.exe","Test Argument Param",NULL,SW_HIDE);

ShellExecute just returns the value 42 [If it fails return value is suppose to be <= 32] and program execution proceed to next line of code. This can create problem when one want ShellExecute to complete it's processing before it go to next line of code in program. Following is the solution i implemented for the same after avoiding ShellExecute and ShellExecuteEx APIs.

STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);

si.dwFlags = STARTF_USESHOWWINDOW; // For enabling custon flags e.g. wShowWindow
si.wShowWindow = SW_HIDE; // For hiding the window of application
ZeroMemory( &pi, sizeof(pi) );
if (!CreateProcess( "C:\\Test.exe"," Test Argument Param",NULL,NULL,FALSE,0,NULL,NULL,&si,&pi))
{ printf("%s\n","ProcessFailed"); }
WaitForSingleObject( pi.hProcess, INFINITE ); // Wait until child process exits.
CloseHandle( pi.hProcess ); // Close process and thread handles.
CloseHandle( pi.hThread );

Please do comment if need anything furthur.

Saturday, March 28, 2009

fatal error C1083: Cannot open type library file: '<<AnyName>>.dll': No such file or directory

Hi,

This is one of the error you can encounter while building a project and it means whether developer don't have <<AnyName>>.dll on the machine or dll is not registered. I faced the same error as follows

fatal error C1083: Cannot open type library file: 'regobj.dll': No such file or directory
Later i corrected it by downloading the regobj.dll from
http://download.microsoft.com/download/vb60pro/update/6.0/w9x2k/en-us/regobji.exe
i place the dll in System32 but one can keep it anywhere they want.

Same can be done for <<AnyName>>.dll , just check do you have <<AnyName>>.dll on your machine. if not then get it on you machine by downloading or taking from any other machine. Once you have it on your machine then register it using one of the following
regsvr32 <<AnyName>>.dll
or
regasm <<AnyName>>.dll /codebase


Virat

Monday, October 20, 2008

Airport Hassle

I was at airport on 17th Oct [2008] and looking out of window of airplane. I was looking at the kingfisher cabs roaming around the plane. suddenly i recalled a very nice incident of mine, one of an airport trip. I was coming back from my cousin's marriage to Bangalore. i had a hectic schedule for his marriage. For two days i couldn't get a proper sleep and i was totally rest less. I reached at airport around 3:30 AM to catch my flight from Delhi to Bangalore on 5:00 AM. I collected my boarding pass and moved in at boarding area. it was about an hour for my flight, so i started reading newspaper. My eyes were burning because of restlessness so just for sake of giving them some rest i closed my eyes. Suddenly because of some announcements i opened my eyes. There was an announcement for some passenger who is still not on board for his flight. I started cursing people like these who cause flight delay like this and make trouble for others. Same time i looked at my watch and i was shocked it's 6:30 AM and i had a flight on 5 AM. I had missed my flight. Suddenly from angry mode i came to sad mode. Just now i have wasted Rs. 5K. I started thinking what should i do now.

While i was thinking about what to do next after missing the flight I paid attention on announcement. it was about my flight and those fellows were calling my name. Hurra !.. i picked up my baggage and started running towards the runway entry. As soon as i reached there i saw two eyes staring at me like i am a waste fellow who is causing delay for others. :) what big deal if one airplane is waiting for me. They called cab to board me on plane. I started feeling like prince who was getting a royal treatment. People are waiting for me and i was getting treated very nicely.

All this day dreaming ends when i boarded on plane and come to know plane was delayed because of fog not because of me. They were giving just a formal announcement before takeoff and luckily i woke up. :)

When i finished this recalling moment, person sitting next to me was amused why i am smiling without reason and i kept on smiling leaving him guessing.

Memories

I am visiting my native and rolling eyes over my old papers i just saw one of the poem i wrote when i was in college. So here it is..


If I cry in the rain
can u see my tears..
if i blew a kiss in the dark
can u catch it..
If i hug u in my dreams
can u feel it..
if answer is no then y
don't u try it once for me...

If i sing a song far away from u
can u hear it...
if i didn't show u my feelings
can u know about it...
if i say "i coudn't live without u"
can u belive it...
If answer is no then y
don't u try it once for me


and in the last
if i die without your love
can u bear it....
if answer is no then y
don't you....