Click here to Skip to main content
15,906,181 members
Home / Discussions / C#
   

C#

 
GeneralRe: Funny location!! Pin
DaveyM695-Oct-09 13:06
professionalDaveyM695-Oct-09 13:06 
GeneralRe: Funny location!! Pin
DaveyM695-Oct-09 13:55
professionalDaveyM695-Oct-09 13:55 
QuestionA control on the mainform doesn't update when others do Pin
teknolog1235-Oct-09 8:57
teknolog1235-Oct-09 8:57 
AnswerRe: A control on the mainform doesn't update when others do Pin
DaveyM695-Oct-09 10:33
professionalDaveyM695-Oct-09 10:33 
GeneralRe: A control on the mainform doesn't update when others do Pin
teknolog1236-Oct-09 2:45
teknolog1236-Oct-09 2:45 
GeneralRe: A control on the mainform doesn't update when others do Pin
DaveyM696-Oct-09 7:17
professionalDaveyM696-Oct-09 7:17 
GeneralRe: A control on the mainform doesn't update when others do Pin
teknolog1237-Oct-09 6:17
teknolog1237-Oct-09 6:17 
QuestionSilverlight Vertigo.Slideshow problem in C#/XAML Pin
Richard Hudson5-Oct-09 8:55
Richard Hudson5-Oct-09 8:55 
AnswerRepost to wrong forum Pin
Not Active5-Oct-09 9:43
mentorNot Active5-Oct-09 9:43 
Questionneed help with excel version problem Pin
jashimu5-Oct-09 7:53
jashimu5-Oct-09 7:53 
AnswerRe: need help with excel version problem Pin
Eddy Vluggen5-Oct-09 8:41
professionalEddy Vluggen5-Oct-09 8:41 
GeneralRe: need help with excel version problem Pin
jashimu5-Oct-09 9:13
jashimu5-Oct-09 9:13 
GeneralRe: need help with excel version problem Pin
Eddy Vluggen5-Oct-09 10:54
professionalEddy Vluggen5-Oct-09 10:54 
GeneralRe: need help with excel version problem Pin
jashimu6-Oct-09 5:28
jashimu6-Oct-09 5:28 
AnswerRe: need help with excel version problem Pin
Dave Kreskowiak5-Oct-09 8:51
mveDave Kreskowiak5-Oct-09 8:51 
Questionfind all possible combinations in a List < List < int > > [modified] Pin
cechode5-Oct-09 7:29
cechode5-Oct-09 7:29 
JokeRe: find all possible combinations in a List < List < int > > Pin
Luc Pattyn5-Oct-09 7:41
sitebuilderLuc Pattyn5-Oct-09 7:41 
GeneralRe: find all possible combinations in a List < List < int > > Pin
cechode5-Oct-09 7:58
cechode5-Oct-09 7:58 
GeneralRe: find all possible combinations in a List < List < int > > Pin
Ian Shlasko5-Oct-09 9:04
Ian Shlasko5-Oct-09 9:04 
QuestionSetup Project help Pin
Etienne_1235-Oct-09 5:43
Etienne_1235-Oct-09 5:43 
AnswerRe: Setup Project help Pin
Etienne_1235-Oct-09 7:15
Etienne_1235-Oct-09 7:15 
QuestionI need to move from google search result soap to search result html parser, any help? Pin
Yasser Ahmad5-Oct-09 4:43
Yasser Ahmad5-Oct-09 4:43 
I need to move from google search result soap to search result html parser, any help?




private static string CreateMessage(string key, string query, int startIndex, int maxResults, bool safeSearch, bool filter, string country, string language)
{

System.Text.StringBuilder message = new System.Text.StringBuilder();
message.Append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
message.Append("<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\">");
message.Append(" <soap:Body>");
message.Append(" <g:doGoogleSearch xmlns:g=\"urn:GoogleSearch\" soap:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">");
message.Append(" <key xsi:type=\"xsd:string\">" + key + "</key>");
message.Append(" <q xsi:type=\"xsd:string\">" + query + "</q>");
message.Append(" <start xsi:type=\"xsd:int\">" + (startIndex) + "</start>");
message.Append(" <maxResults xsi:type=\"xsd:int\">" + maxResults + "</maxResults>");
message.Append(" <filter xsi:type=\"xsd:boolean\">" +filter.ToString().ToLower()+ "</filter>");
message.Append(" <restrict xsi:type=\"xsd:string\" />");
message.Append(" <safeSearch xsi:type=\"xsd:boolean\">" + safeSearch.ToString().ToLower() + "</safeSearch>");
message.Append(" <restrict xsi:type=\"xsd:string\">lang_" + language + ".country" + country.ToString().ToUpper() + "</restrict>");
message.Append(" <ie xsi:type=\"xsd:string\">latin1</ie>");
message.Append(" <oe xsi:type=\"xsd:string\">latin1</oe>");
message.Append(" </g:doGoogleSearch>");
message.Append(" </soap:Body>");
message.Append("</soap:Envelope>");
return message.ToString();
}


private static GoogleWebSearchResponse DoSearchHelper(string key, string query, int startIndex, int maxResults, bool safeSearch, bool filter, string country, string language)
{
string message = CreateMessage(key, query, startIndex, maxResults, safeSearch, filter, country, language);
WebRequest soapRequest = WebRequest.Create("http://api.google.com/search/beta2");
//WebRequest soapRequest = WebRequest.Create("http://localhost:3833");
soapRequest.Headers.Add("SOAPAction", "urn:GoogleSearchAction");
soapRequest.Method = "POST";
soapRequest.ContentType = "text/xml; charset=utf-8";

using (Stream requestStream = soapRequest.GetRequestStream())
{
using (StreamWriter writer = new StreamWriter(requestStream))
{
writer.Write(message);
}
}

try
{
WebResponse soapResponse = soapRequest.GetResponse();
string responseText = null;
using (Stream responseStream = soapResponse.GetResponseStream())
{
using (StreamReader reader = new StreamReader(responseStream))
{
responseText = reader.ReadToEnd();
}
}

XmlDocument responseDoc = new XmlDocument();
responseDoc.LoadXml(responseText);
GoogleWebSearchResponse response = new GoogleWebSearchResponse(responseDoc);

return response;
}
catch (WebException ex)
{
using (Stream responseStream = ex.Response.GetResponseStream())
{
using (StreamReader reader = new StreamReader(responseStream))
{
string responseText = reader.ReadToEnd();
}
}

//throw ex;
return null;
}
catch (Exception ex)
{
throw ex;
//return null;
}



QuestionClipboard.Clear() cause Excel Crashes at startup Pin
Delven Foo5-Oct-09 4:40
Delven Foo5-Oct-09 4:40 
AnswerRe: Clipboard.Clear() cause Excel Crashes at startup Pin
Luc Pattyn5-Oct-09 6:10
sitebuilderLuc Pattyn5-Oct-09 6:10 
GeneralRe: Clipboard.Clear() cause Excel Crashes at startup Pin
Delven Foo5-Oct-09 6:27
Delven Foo5-Oct-09 6:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.