Friday, March 19, 2010

Simple LINQ Examples


Linq command


output


“shashi”


shashi


"YES!!!".Dump ("Foreign
key constraints"
);



Foreign key constraints


YES!!!


from n in new[]
{
"Tom", "Dick", "Harry" }

where n.Contains ("a")

select n



5IEnumerable<String>
(1 item)


Harry


from word in "The
quick brown fox jumps over the lazy dog"
.Split()

orderby word.Length

select word



5IOrderedEnumerable<String>
(9 items)


The


fox


the


dog


over


lazy


quick


brown


jumps


var words =

    
from
word
in "The
quick brown fox jumps over the lazy dog"
.Split()

    
orderby
word.ToUpper()

    
select
word;

    

var duplicates =

    
from
word
in words

    
group
word.ToUpper()
by word.ToUpper() into g

    
where
g.Count() >
1

    
select new {
g.Key, Count = g.Count() };



5IOrderedEnumerable<String>
(9 items)


brown


dog


fox


jumps


lazy


over


quick


The


the


5IEnumerable<>
(1 item)


Key


Count


THE


2




123.Dump();

Regex.Match (
"my favorite color is...", "colou?r").Dump();

formatting:

TimeZoneInfo.Local.Dump (
"Bet you never knew this type
existed!"
);







new[] { 11, 5, 17, 7, 13
}    .Dump (
"Prime
numbers"
)

.Where (n => n >
10)        .Dump
(
"Prime numbers > 10")

.OrderBy (n =>
n)            .Dump
(
"Prime numbers > 10 sorted")

.Select (n => n *
10)
        .Dump (
"Prime
numbers > 10 sorted, times 10!"
);

123


5Match


color


Groups



5GroupCollection
(1 item)



qMatch


color


Success


True


Captures



5CaptureCollection
(1 item)



qMatch


color


Index


12


Length


5


Value


color


▪ Bet you never knew
this type existed!



5TimeZoneInfo


(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi


Id


India Standard Time


DisplayName


(GMT+05:30) Chennai, Kolkata, Mumbai,
New Delhi


StandardName


India Standard Time


DaylightName


India Daylight Time


BaseUtcOffset


05:30:00


SupportsDaylightSavingTime


False

 


▪ Prime numbers



5Int32[] (5
items)


11


5


17


7


13

 


▪ Prime numbers >
10



5IEnumerable<Int32>
(3 items)


11


17


13

 


▪ Prime numbers >
10 sorted



5IOrderedEnumerable<Int32>
(3 items)


11


13


17

 


▪ Prime numbers >
10 sorted, times 10!



5IEnumerable<Int32>
(3 items)


110


130


170


(new[] {"Tom", "Dick", "Harry"}
).Where (n => n.Length >=
4)



5IEnumerable<String>
(2 items)


Dick


Harry


 


 


Microsoft SharePoint Server 2010 (Beta)

http://technet.microsoft.com/en-us/sharepoint/ee263917.aspx

What's New in SharePoint Server 2010?

What's New: Business Connectivity Services (BCS)

What's New: Enterprise Content Management (ECM)

What's New: SharePoint Enterprise Search

What's New: PerformancePoint Services

What's New: Excel Services

What's New: User Profiles and Social Data

Word Automation Services Overview

http://msdn.microsoft.com/en-us/library/ee557323(office.14).aspx
Detect if string is numeric
// Detect if a string is numeric

public static bool IsNumeric(string text)
{
return Regex.IsMatch(text,"^\\d+$");
}
-----------------------
Protect string content by marshalling
// Protect string content by marshalling

IntPtr bstr = Marshal.SecureStringToBSTR(password);

try
{
// ...
// use the bstr
// ...
}
finally
{
Marshal.ZeroFreeBSTR(bstr);
}

Locate string on webpage

private bool SearchPage(string URL, string StrToLocate)
{
StreamReader SR;
WebResponse Resp ;
WebRequest MyWebRequest;
string PageStr;

MyWebRequest = WebRequest.Create(URL) ;
MyWebRequest.Timeout = 10000 ;
try
{
Resp = MyWebRequest.GetResponse() ;
SR = new StreamReader(Resp.GetResponseStream()) ;
PageStr = SR.ReadToEnd() ;
SR.Close() ;

PageStr = PageStr.ToUpper();
if ( PageStr.IndexOf(StrToLocate.ToUpper(), 0, PageStr.Length) != -1 )
return true;
else
return false;
}

catch ( WebException wex )
{
if (wex.Status == WebExceptionStatus.Timeout)
Response.Write("The request has timed out!") ;

else
Response.Write("There was some exception: " + wex.Message) ;

return false;
}

}

Saturday, March 13, 2010

http://shashi-bhushan-mca.blogspot.com/

ms-doscom virous removal tools




To kill MS-DOS.com, Global.exe, system.exe, svchost.exe manually
------------------------------------------------



B1: Use IceSword simultaneously kill 3 Process: system.exe, Global.exe, svchost.exe
For do this- first of all start computer login and immediate press ctrl+alt+del
and kill above three process

B2: Find and delete all the files have been analyzed at the
B3: Using Autoruns to check & remove all key viruses created in the registry
B4: Reboot computer.
B5: Download antivirus program (such bkav) to scan again! (If the computer has antivirus program is removed and then installed again!)
B6: Open Run -> CMD: type in sfc /scannow or sfc /scanonce and XP disk to edit the file failed.
B7: Reboot computer. (If necessary)
This script originally provided by lecuong.info blog for point B2, B3.Blog computer-experience.blogspot.com: I enhanced this script for point B1/ and add some points of B2, B3 so it modified and I solved my issue at home with this virus. Don't forget to continue to B5, B6 as well.
Use this script to your own risk.


For details:-
http://computer-experience.blogspot.com/2009/01/how-to-kill-virus-ms-doscom-globalexe.html

Friday, March 12, 2010

SharePoint Questions ?.........

• What is safe mode processing and Safe Controls?
• Can you explain WSS model?
• How can we use custom controls in SharePoint?
• How can you view a detail error in SharePoint?
• How can we display ASCX control in SharePoint pages?
• What are WebParts and in what ways does it vary in SharePoint environment?
• What are the different life cycle events that WebPart goes through?
• What’s the difference between WebParts in WSS 2.0 and 3.0?
• Can you explain the 6 steps we need to create a WebPart in SharePoint?
• How can we implement customization and personalization in WebParts ?
• How can we create a custom editor for WebPart?