|
|
I will answer them only if you can answer yes to any of the following:
Have you gone to class once this semester?
Are you looking forward to bagging my groceries next year?
Do you know how annoying it is to have kids come here before mid-terms and ask basic questions they should have known by class #3?
Do you understand that this series of mock questions is your last call to go see your teacher and get a tutor before you flunk out of your program?
Seriously, this is your last chance.
|
|
|
|
|
I did think of giving him single word, truthfull but unhelpfull answers, but decided he would probably talk to me if I did. Perhaps Google has stopped working for him?
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
This could be a take home interview and he is a senior .NET consultant with 20 years experience charging $7 an hour.
|
|
|
|
|
Yes and no. You decide which questions these apply to.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
I have a groupBox that has N PictureBox controls on it.
Each PictureBox is named thmb1-N e.g thmb26.
I have a list of paths, of thumbnail images, which I want to iterate through and set PictureBox control ImageLocation properties for each PictureBox .
The code I have written below is a first rather messy and quick attempt - which is cumbersome and I really don't want to be iterating through every object.
Is there a better way of doing this?
If I could do something like thmb + N.ImageLocation = ... but i realise I cannot do this in C# so any help in directing me towards how to do this would be much appreciated.
Guy
for (int i = 0; i < bubble.thumbs.Count; i++)
{
foreach (Control ctrl in this.groupBox8.Controls)
{
if (ctrl is PictureBox)
{
if (LeftRightMid.Left(ctrl.Name.ToString(), 4) == "thmb"
&& Convert.ToInt32(LeftRightMid.Right(ctrl.Name.ToString(), 1)) == i)
{
((PictureBox)(ctrl)).ImageLocation = bubble.thumbs[i];
}
}
}
}
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|
|
You could do this:
PictureBox pic;
for (int i = 0; i < bubble.thumbs.Count; i++)
{
string ctrlName = "thmb" + i;
pic = this.groupBox8.Controls[ctrlName] as PictureBox;
if (pic != null)
{
pic.ImageLocation = bubble.thumbs[i];
}
}
But I would probably re-think my whole approach! If you have to use .Controls, then you are hard-wiring your code to a specific implementation - not at all good for re-usabillity!
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
Thanks - your code is much more elegant than mine.
I agree with you about re-thinking my approach.
I use SAS in my work, C# being a hobby, and in SAS you can do something like:
n=1<br />
thmb + n .imagelocation = "C\image.jpeg" <br />
Which is the dynamic equivalent of thmb1.imagelocation = "C\image.jpeg"
I have googled and looked on code project but I think it is a case of not knowing which question to ask - as I have not found anything similar to my example above for C#.
Thanks for your help - I will use what you suggest until I find what I am looking for.
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|
|
How about a List<string, System.Windows.Forms.Control> ? You could iterate through the components when the form is done loading, adding the PictureBoxes to a List. Then you could use a for/each construct to loop through the pictureboxes
I are Troll
|
|
|
|
|
Thanks
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|
|
Hi,
You have two nested loops, which is one too many for the job at hand.
You either drop the loop over controls (that is what Griff suggested), or even simpler, you drop the one looping over the bubbles, like so:
foreach (Control ctrl in this.groupBox8.Controls) {
pb = ctrl as PictureBox;
if (pb != null && LeftRightMid.Left(ctrl.Name, 4) == "thmb") {
int i = Convert.ToInt32(LeftRightMid.Right(ctrl.Name, 1));
pb.ImageLocation = bubble.thumbs[i];
}
}
Note:
- I used "as" instead of "is", removing the need for later casts
- I dropped some ToString() calls, as the object already was a string
- I use "i" as an index, no need to repeat that in a loop
- this code should be faster than Griff's one, as his Controls[name] lookup takes much more effort than a simple array index operation.
BTW: I doubt ANY of the versions shown will work correctly for N>=10 as you only are using one character to extract the thmb number from the control's name. The fix for that would be to take the substring that starts at the position (hence counting from the left side, not the right side); string.SubString() is what you would use then.
|
|
|
|
|
Thank you for all of your help.
Yes I was thinking the ToString was a bit ott on my part in some places.
Good point on the N>=10 issue - you have written the code for me without me even having to say 'plz help meez'
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|
|
You're welcome.
|
|
|
|
|
hello
im making my final year project i.e. speech recognition.but i dont have any idea how to start?what will be the first step?i intend to work on c#.plz can anyone guide me.
thnx
|
|
|
|
|
I am in no way being sarcastic-- I would not recommend speech recognition as a school project. It is a highly complex field that is still very much in its infancy.
|
|
|
|
|
|
|
|
biak wrote: what will be the first step?
Read about Speech SDK.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
biak wrote: i dont have any idea how to start?
As the Irish would say, "ah well you wouldn't want to be startin' here".
MVP 2010 - are they mad?
|
|
|
|
|
As d@nish mentions find out about Speech SDK - you will find articles on cp.
I have written a speech recognition application for flight simulation pilots - Clickety - which may give you some idea of what can be accomplished.
In so far as you mention speech recognition - in itself it is fairly straightforward due to the Microsoft SDK.
What is really going to make your project shine is what you wrap around this speech recognition.
I probably spent in the region of 100 times longer coding the interface around the speech recognition than I took getting the Speech SDK integrated and working.
So good luck and my suggestion is think bigger than just speech recognition as this part is already written for you by Microsoft.
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|
|
Use Windows speech library i.e speech.dll,available in windows/system32/speech/speech.dll,
In the visual studio(speaking about in 2008) use "add a reference" in the solution explorer and browse the above discussed .dll file and import it to your project.
Double click on the imported reference and the methods and members in the reference will be viewed in object browser,,,,,.search for recognition methods and use as required by u in the project......
Any douts regarding this contact me:
e-Mail:srikanthsuryadevara4@gmail.com
or ph.no:8099108525
|
|
|
|
|
I was given the task to write a program (c#) to import the 100k rows per dbf to SQL Server. I am happy that they decided to do so but at the same time I have to do it :p . So here it goes:
Before I write code (just testing out)
1. I tried using the import from method from ssms it worked once then failed.
2. I went to the business intelligence studio option and that ended in tears.
3. I then exported from FoxPro to flat txt/excel then I was hit with indexes cdx.
Is there any suggestion on how to do it? Not requesting for code.
Thank you
|
|
|
|
|
The fastest way to get the data from a FoxPro table into SQL is by using SSMS. It is best to create your own package to run rather than using the default Import functionality, if for no other reason than you can have a permanent copy of the code.
In my experience you must always pre-process the foxpro data into a staging table (still in foxpro). The most common pre-processing task is to sort out dates as Foxpro handles a far wider range of dates to SQL. The other major concern is that foxpro has three data 'states'. These are Populated, Empty, and Null. SQL only has two (Populated and Null). Again dates are the worst culprit. Empty dates should be either SQL Null or the earliest SQL date (1/1/1900 for shortDateTime and 1/1/1753 for DateTime).
|
|
|
|
|
C# CODE SNIPET FOR RUN AS ADMINISTRATOR
I want my C# application to automatically RUN AS ADMINISTRATOR on VISTA and WINDOWS 7 by default. Please I need the code snipet to achieve this. Thanks for your reply.
omoniyiogunderu@yahoo.com
|
|
|
|