Click here to Skip to main content
15,896,912 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: Clipboard.Clear() cause Excel Crashes at startup Pin
Luc Pattyn5-Oct-09 6:47
sitebuilderLuc Pattyn5-Oct-09 6:47 
GeneralRe: Clipboard.Clear() cause Excel Crashes at startup Pin
Delven Foo5-Oct-09 7:19
Delven Foo5-Oct-09 7:19 
GeneralRe: Clipboard.Clear() cause Excel Crashes at startup Pin
Richard MacCutchan5-Oct-09 7:33
mveRichard MacCutchan5-Oct-09 7:33 
Generalno crash Pin
Luc Pattyn5-Oct-09 7:34
sitebuilderLuc Pattyn5-Oct-09 7:34 
QuestionKey Press Event : ctrl + C Pin
bonzaiholding5-Oct-09 4:19
bonzaiholding5-Oct-09 4:19 
AnswerRe: Key Press Event : ctrl + C Pin
DaveyM695-Oct-09 4:35
professionalDaveyM695-Oct-09 4:35 
GeneralRe: Key Press Event : ctrl + C Pin
bonzaiholding5-Oct-09 5:00
bonzaiholding5-Oct-09 5:00 
QuestionCrystal Report Plug-ins Pin
satsumatable5-Oct-09 4:02
satsumatable5-Oct-09 4:02 
Questionhelp in updating ms acess is needed! Pin
TGiril5-Oct-09 2:52
TGiril5-Oct-09 2:52 
AnswerRe: help in updating ms acess is needed! Pin
Henry Minute5-Oct-09 3:49
Henry Minute5-Oct-09 3:49 
GeneralRe: help in updating ms acess is needed! Pin
TGiril5-Oct-09 19:52
TGiril5-Oct-09 19:52 
Questioni need help Pin
Mohamed El-Wehishy5-Oct-09 2:46
Mohamed El-Wehishy5-Oct-09 2:46 
AnswerRe: i need help Pin
Luc Pattyn5-Oct-09 3:08
sitebuilderLuc Pattyn5-Oct-09 3:08 
GeneralRe: i need help Pin
Mohamed El-Wehishy5-Oct-09 3:46
Mohamed El-Wehishy5-Oct-09 3:46 

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.