|
cechode wrote: a lambada expression
you'll need quite a swing to pull this one off.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
i've been swingin and missing for a bit now.
now trying to somehow get
among the things i've tried so far
tried to convert this to a self calling kinda thing
var PP = A.Where(x = > x > 0).SelectMany(g = > B.Where(c = > c > 0).Select(c = > new { aa = g, bb = c })).ToList();
but to no avail
then tried to get a bunch of from clauses ( one for each inner list )
var ttt = (from g in A
from c in B
select new { aa = g, bb = c }).ToList();
but also failed
now i figured i'd ask the experts here
|
|
|
|
|
Ok... As a warning, my brain is a little lopsided today... Here's the first weird idea that popped into my head... Partly in pseudocode, and haven't tried it out, but here ya go...
private IEnumerable<List<int>> Test(List<List<int>> data)
{
int numDigits = data.Count;
int lastCount = data[numDigits - 1].Count;
int[] indices = new int[data.Count];
while (indices[numDigits - 1] < lastCount)
{
indices[0]++;
for (int idx = 0; idx < numDigits - 1; idx++)
if (indices[idx] == data[idx].Count)
{
indices[idx] = 0;
indices[idx + 1]++;
}
}
}
Bit of a different angle from what you're trying... Instead of going for recursion, think of it like a series of digits. What this really does is count through the following sequence (Assuming all of your arrays have 3 digits):
000, 100, 200,
010, 110, 210,
020, 120, 220,
001, 101, 201... etc
And it forms results such that, for example, 120 = the second, third, and first digits of the elements, respectively...
Anyway, you get the idea. If you know for a fact that you'll be dealing with 3-digit inner lists, you can simplify this a bit...
|
|
|
|
|
Hi there
We've recently been tasked with creating a setup project for our application. All seems easy enough, but I can't seem to figure out how I can specify the path to the icon files that I'm using in my app. How did I add my icon files? I right-clicked on my solution name while in Visual Studio, then selected "Add New Folder" and I named the new folder "Icons". This adds an "Icons" folder in the same folder where the source files reside (2 folders back from the Debug folder). And then I simply added all my icons in this folder. But now how do I specify this path when creating a setup project? Or do I need to move the icons folder relative to where my EXE resides? (which is the Bin folder).
Any help would be appreciated
|
|
|
|
|
Okay I removed all icons from my application and created a setup project and it then runs fine after installation, so it's definately the icons' path that isn't specified properly. I can copy the Icons folder to the Bin folder which will solve this issue, but how do I then specify this new path?! Because it was simple when using the other way, I could just browse to the Image Source property and select the appropriate icon, but now obviously the icons won't show up in this list anymore because they aren't added as resources.
|
|
|
|
|
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;
}
|
|
|
|
|
Hi
Does anyone know why Excel Crashes at startup
after c# app calls Clipboard.Clear();
even app exits
thanks
|
|
|
|
|
I can clear the clipboard (with Clipboard.Clear) and successfully launch Excel 2007.
I suggest you check your facts.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Hi Luc Pattyn
Thanks for your info.
I tried 3 machines with vista ultimate sp2 / Excel 2007 all of them fail to launch.
|
|
|
|
|
if your app clears the clipboard and then fails to launch Excel, seems to me you have made some mistake.
Can't help lacking any additional information or code.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Thanks Luc Pattyn
I found interesting scenario that crashes vs2005 c# IDE
public Form1()
{
InitializeComponent();
Clipboard.Clear(); // crashes vs IDE
}
|
|
|
|
|
Delven Foo wrote: Clipboard.Clear(); // crashes vs IDE
I have not used the clipboard in C#, but in C++/Win32 you need to use the OpenClipboard() call to get access before changing anything. This is because the clipboard is a systemwide resource so you need to avoid conflicts with other processes.
|
|
|
|
|
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Hi,
I have a RichTextBox and i want to do something when the user press on the RichTextBox with the combination of the keys : ctrl + 'C'.
I created this event :
private void m_richTextBox1_KeyUp(object sender, KeyEventArgs e)
{
if (e.Control && e.KeyData== Keys.C)
{
}
} but when the user press on the keys it's recognize only the 'ctrl' key and not the char 'C'.
What is the problem and what should i do?
10X.
|
|
|
|
|
In either KeyDown or KeyUp
if (e.KeyCode == Keys.C && e.Modifiers == Keys.Control)
{
}
|
|
|
|
|
|
Hi
Is there any way to write addons (plug-ins) for Crystal report using C#? That has to basically read data from that report.
Thanks
|
|
|
|
|
Hi all
I have aroblem: I want to save is ms access, datatable, but all lines are marked as new, and all the sta is re insert to the db!
when I debug I see the row state is added!(even if it is not true!!)
what can I do??
|
|
|
|
|
And what, exactly, does this have to do with C#?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
the code is in c#
foreach (DataRow Row in ds.Tables["Tasks"].Rows)
{
switch (Row.RowState)
{
case DataRowState.Added :
..................
DataRowState.Added - is always true, thats the problem
|
|
|
|
|
hi guys
i captured an image
ok
then i want to repeat this image to three times
and the all four images are saved in one file
that file in a jpg format
my code is
Graphics g1 = pictureBox1.CreateGraphics();
Image MyImage = new Bitmap(pictureBox1.ClientRectangle.Width, pictureBox1.ClientRectangle.Height, g1);
Graphics g2 = Graphics.FromImage(MyImage);
IntPtr dc1 = g1.GetHdc();
IntPtr dc2 = g2.GetHdc();
BitBlt(dc2, 0, 0, pictureBox1.ClientRectangle.Width, pictureBox1.ClientRectangle.Height, dc1, 0, 0, 13369376);
MyImage.Clone();
g1.ReleaseHdc(dc1);
g2.ReleaseHdc(dc2);
MyImage.Save(@"c:\PrintPage.jpg", ImageFormat.Jpeg);
thanks,
Mohamed El-Wehishy
|
|
|
|
|
Hi,
this is what I would try (not tested), and it doesn't use a PictureBox:
Bitmap bmIn=(Bitmap)Image.FromFile(sourceFile);
Bitmap bmOut=new Bitmap(4*bmIn.Width, bmIn.Height);
Graphics grOut=Graphics.FromImage(bmOut);
for(int i=0; i<4; i++) grOut.DrawImage(bmIn, bmIn.Width*i, 0);
bmOut.Save(destinationFile, ImageFormat.Jpeg);
grOut.Dispose();
bmIn.Dispose();
bmOut.Dispose();
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
thanks very much my friend
it is done
thanks
Mohamed El-Wehishy
|
|
|
|
|
you're welcome.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Hi All,
I have to burn CD using C# window application with the progress bar can any one tell me how to start and do this.
Thanks,
Amit Patel
|
|
|
|