Monday, July 30, 2007

nice google search tip

Check this,

1. Go to Google
2. Click images
3. Type "flowers" or any other word.
4. You will get a page which is having full of images
5. Then delete the URL from the address bar and paste the below script

javascript:R= 0; x1=.1; y1=.05; x2=.25; y2=.24; x3= 1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI= document.images ; DIL=DI.length; function A(){for(i=0; i

betting tips

If you are like me, here are some good betting tips.

Each of these factors has sub-factors, which further contribute to the rating assigned to each horse.

Horse
-Raw ability
-Distance form
-Ground form
-Maturity / Exposure

Jockey
-Weight
-Success individually
-Success with today's trainer
-Success at this course

Trainer
-percentage of winners in the last 6 months
-percentage of winners in the last 4weeks
-Success at this course

By quantifying these factors each with a different weighting dependant on importance - i.e. a 3rd in a Class C event is more valuable in terms of weighting than 3rd in a seller

The final stage for this product to identify the two selections that stand out, not necessarily those with the highest ratings, but those with the greatest percentage above the next best horse in their races.

Friday, July 27, 2007

BCS finally finished

when i was going back home y'day I was it was feeling so dull. when i went back home i saw the results letter from BCS and i knew that was it . i was expecting it from the day i sat for the exam. Finally now i am BCS graduate !!!. yap.. wish me luck. graduation ceremony on Nov 17th

Monday, July 23, 2007

extracting parameter from a url using C#

extracting parameter from a url using C#

where i am looking for key in the url.Query

Regex fileRegex = new Regex(@"^\?key=(?<1>[^&]*)$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
Match fileMatch = fileRegex.Match(Uri.UnescapeDataString(url.Query));
if (fileMatch.Success)
return fileMatch.Groups[1].Value;

Thursday, July 19, 2007

CurrentDeployment.UpdateLocation cached

i came up with a carzy bug last week, in OneClick deployment CurrentDeployment.UpdateLocation.AbsoluteUri always return a cached url ??? it passes first time passed parameters back again and again when you run the application . so always use the ApplicationDeployment.CurrentDeployment.ActivationUri insted of UpdateLocation.AbsoluteUri.

if you are getting a null issue in CurrentDeployment.ActivationUri that means you have not set the application publish->options allow parameters option

how to change the listview selected color ?

one of my colleges asked me that question and i though its the windows default selected color and you can't change it?? i did a google search for this nothing came up; so after spending serious amout of time i came up with this. million with sample where you can't find it anywhere else. this is a combination of a some russian , japanies coding..
=====================================

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace listviewsample
{
public partial class Form1 : Form
{


public static int WM_NOTIFY = 0x004E;
public static int NM_FIRST = 0- 0;
public static int NM_CUSTOMDRAW = NM_FIRST-12;
public static int CDRF_DODEFAULT = 0x00000000;
public static int CDRF_NEWFONT = 0x00000002;
public static int CDRF_SKIPDEFAULT = 0x00000004;
public static int CDRF_NOTIFYPOSTPAINT = 0x00000010;
public static int CDRF_NOTIFYITEMDRAW = 0x00000020;
public static int CDRF_NOTIFYSUBITEMDRAW = 0x00000020;
public static int CDRF_NOTIFYPOSTERASE = 0x00000040;
public static int CDIS_SELECTED = 0x0001;
public static int CDIS_FOCUS = 0x0010;

public static int CDDS_PREPAINT = 0x00000001;
public static int CDDS_POSTPAINT = 0x00000002;
public static int CDDS_PREERASE = 0x00000003;
public static int CDDS_POSTERASE = 0x00000004;
public static int CDDS_ITEM = 0x00010000;
public static int CDDS_ITEMPREPAINT = CDDS_ITEM | CDDS_PREPAINT;
public static int CDDS_ITEMPOSTPAINT = CDDS_ITEM | CDDS_POSTPAINT;
public static int CDDS_ITEMPREERASE = CDDS_ITEM | CDDS_PREERASE;
public static int CDDS_ITEMPOSTERASE = CDDS_ITEM | CDDS_POSTERASE;
public static int CDDS_SUBITEM = 0x00020000;

[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
[StructLayout(LayoutKind.Sequential)]
public struct NMHDR
{
public int hwndFrom;
public int idFrom;
public int code;
}
[StructLayout(LayoutKind.Sequential)]
public struct NMCUSTOMDRAWINFO
{
public NMHDR hdr;
public IntPtr dwDrawStage;
public IntPtr hdc;
public RECT rc;
public IntPtr dwItemSpec;
public uint uItemState;
public IntPtr lItemlParam;
}
[StructLayout(LayoutKind.Sequential)]
public struct NMLVCUSTOMDRAW
{
public NMCUSTOMDRAWINFO nmcd;
public int clrText;
public int clrTextBk;
public int iSubItem;
}

protected override void WndProc(ref Message m)
{
if (m.Msg==WM_NOTIFY && m.WParam.Equals(listView1.Handle))
{
NMHDR nmhdr = (NMHDR)m.GetLParam(typeof(NMHDR));
if (nmhdr.code==NM_CUSTOMDRAW)
{
NMLVCUSTOMDRAW xCustomDraw =
(NMLVCUSTOMDRAW)m.GetLParam(typeof(NMLVCUSTOMDRAW) );
if
(listView1.SelectedIndices.IndexOf(xCustomDraw.nmcd.dwItemSpec.ToInt32())>-1
)
{
if ((xCustomDraw.nmcd.uItemState & CDIS_SELECTED)!=0)
{
xCustomDraw.nmcd.uItemState -= (uint)CDIS_SELECTED;
Marshal.StructureToPtr(xCustomDraw, m.LParam,
false);
}
if
(xCustomDraw.nmcd.dwDrawStage.ToInt32()==CDDS_PREPAINT)
{
m.Result = new IntPtr(CDRF_NOTIFYITEMDRAW);
return;
}
else if
(xCustomDraw.nmcd.dwDrawStage.ToInt32()==CDDS_ITEMPREPAINT)
{
xCustomDraw.clrText = ColorTranslator.ToWin32(Color.Blue);
xCustomDraw.clrTextBk = ((xCustomDraw.nmcd.uItemState & CDIS_FOCUS)!=0) ?
xCustomDraw.clrTextBk = ColorTranslator.ToWin32(Color.Yellow) :
xCustomDraw.clrTextBk = ColorTranslator.ToWin32(Color.Orange);
m.Result = new IntPtr(CDRF_NEWFONT);
Marshal.StructureToPtr(xCustomDraw, m.LParam,
false);
return;
}
}
}
}
base.WndProc(ref m);
}


public Form1()
{
InitializeComponent();
}


}
}

Tuesday, July 17, 2007

joke of the day !

Gender Test ( funny )
Important Test!


Are you male or female??????
To know the answer, look down...












































































.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.



.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.



NOT HERE... MY FRIEND

I SAID LOOK DOWN....

NOT SCROLL DOWN...
@@@@@@@@@@@@ @@@@@@@@@ @@@@@@@@@ @

Monday, July 16, 2007

ActivationData is null??

just wanted to add this to my previous post..

if you get AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData = null then use ApplicationDeployment.CurrentDeployment.UpdateLocation.AbsoluteUri

parameter passing for oneclick installtion url

I have been involve in making our application web enable application for last 2 weeks and now a new requirement came to pass a parameter via the installation back to the application, i did a search on Google nothing much came out so i have post what i did so some one could benefit from it


1. go to project properties -> Publish
2. click on options and check "allow parameters to be pass to the url"
3. use this code snippet extract the parameter value,
4. eg http://www.hostname.com/sample.application?parameter=test



private static string parseParameters()
{


if (ApplicationDeployment.IsNetworkDeployed)
{


string[] activationData = AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData;
if (activationData != null)
{

Uri url = new Uri(activationData[0]);

Regex fileRegex = new Regex(@"^\?parameter=(?<1>[^&]*)$",
RegexOptions.Singleline);
Match fileMatch = fileRegex.Match(Uri.UnescapeDataString(url.Query));
if (fileMatch.Success)
return fileMatch.Groups[1].Value;
}


}
else
{

return null;
}

}