15,746,420 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View Javascript questions
View C++ questions
View Python questions
View Java questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by LanFanNinja (Top 200 by date)
LanFanNinja
18-Mar-12 18:41pm
View
+5
LanFanNinja
6-Mar-12 23:17pm
View
+5
LanFanNinja
26-Feb-12 4:13am
View
Thank you! :)
LanFanNinja
25-Feb-12 19:53pm
View
You're welcome. Glad that it helped.
LanFanNinja
25-Feb-12 19:13pm
View
+5
LanFanNinja
25-Feb-12 19:10pm
View
+5
LanFanNinja
25-Feb-12 18:05pm
View
Check out my solution. I have posted some code for you to study.
LanFanNinja
24-Feb-12 11:30am
View
Why would you want to do this??? I question your motives.
LanFanNinja
24-Feb-12 11:18am
View
Not sure without trying it myself but make sure they have the full
.Net Framework 4 installed.
That is of course if you are targeting the .Net Framework 4 ;)
LanFanNinja
24-Feb-12 11:07am
View
No! This code is correct. See solution 2 for the correct answer.
NOTE: I did not down vote you but someone else could.
LanFanNinja
24-Feb-12 10:59am
View
+5
=== NOTE to the OP ===
On this line
string[] virus = new string[] ("trojan", "virus", "hacker");
The OP is using parentheses instead of curly braces !!
Change that line of code to this
string[] virus = new string[] { "trojan", "virus", "hacker" };
Note the use of curly braces rather that parentheses ;)
Also I see you are creating this array twice!! Once in the try block and again in the catch block?!?
While this is not really an error it is super redundant and makes no sense because it does exactly the same thing in both blocks. You should create this array outside of the try catch and then you can use it within both.
Actually I would change the code to something more like this:
string read = "";
string[] virus = new string[] { "trojan", "virus", "hacker" };
try
{
using (StreamReader stream = new StreamReader(item))
{
read = stream.ReadToEnd();
}
}
catch
{
read = item;
}
foreach (string st in virus)
{
if (Regex.IsMatch(read, st))
{
MessageBox.Show("Virus Detected!");
viruses += 1;
label2.Text = "Viruses: " + viruses.ToString();
listBox1.Items.Add(item);
}
progressBar1.Increment(1);
}
LanFanNinja
16-Feb-12 0:11am
View
+5 But just to be clear CSS is not just for Asp.Net. ;)
LanFanNinja
16-Feb-12 0:10am
View
+5
LanFanNinja
13-Feb-12 9:24am
View
For the first part of your question make sure comboBox2.Text is indeed equal to "select" and not "Select" or "SELECT" etc. Remember C# is case sensitive("select" is not equal to "Select").
Answering the second part of your question will require a better explanation.
LanFanNinja
12-Feb-12 18:48pm
View
You're welcome and thank you for pointing that out to me. :)
LanFanNinja
12-Feb-12 18:41pm
View
+ 5
LanFanNinja
12-Feb-12 18:41pm
View
I embarrassingly did not check the calculations. I read this " I can't figure out why it does not go through the whole array " looked at the code saw the call to Console.ReadLine(); and it was clear this was keeping his loop from running more than once (without a key press).
I then copied and pasted his code only correcting this problem.
I will be more careful next time. ;)
LanFanNinja
11-Feb-12 20:04pm
View
You would pass in the path of the file you wanted to write the data into.
You could use the SaveFileDialog to select your save path. It works very similar to the OpenFileDialog.
Take a look at this link to get an idea of its use.
SaveFileDialog
And here is another example:
SaveFileDialog saveDialog = new SaveFileDialog();
saveDialog.Filter = "Text Files|*.txt";
if (saveDialog.ShowDialog() == DialogResult.OK)
{
using (StreamWriter writer = new StreamWriter(saveDialog.FileName))
{
writer.WriteLine(richTextBox1.Text);
writer.Close();
}
}
When the saveDialog opens just choose a folder to save the file into (for example your Documents folder) then enter a file name into the "File Name" text box (any name you wish to use) and the file will be created at that location.
LanFanNinja
11-Feb-12 15:22pm
View
You're right. I missed this text at the bottom (if it was there when I read the question the first time?).
"Now my question How can I restrict the Console.Readline() to accept only XX(let say 20) number of characters and not allow user to event type on console screen further ?"
I should have been more careful reading the question.
LanFanNinja
11-Feb-12 14:43pm
View
I don't understand what your asking for???
LanFanNinja
8-Feb-12 14:41pm
View
It is also very nice to know just exactly what I wrote all that code for. :)
I really do like it! It is a very cool idea.
"All that I wish is to finish it and to make use of it."
I am certain you will succeed.
LanFanNinja
8-Feb-12 14:39pm
View
Deleted
It is also very nice to know just exactly what I wrote all that code for. :)
I really do like it! It is a very cool idea.
LanFanNinja
8-Feb-12 14:35pm
View
Very Nice!!! Thank you for showing me this.
LanFanNinja
8-Feb-12 14:27pm
View
I trust you enough. :) And thanks for trusting me.
I have downloaded the file so you can delete the link now.
LanFanNinja
8-Feb-12 14:12pm
View
You're welcome.
I tried my best and came up with a lot of different ways to do this but in the end this was the only way to make it work with Google instant predictions.
Best of luck -- Ninja
LanFanNinja
8-Feb-12 13:29pm
View
I have posted my last and final method(/// METHOD 3 ///) of doing this for you in my solution below.
I feel like I have tried most everything and this is the only way I could get it to work with Google instant predictions, Images, etc.
With the little testing I have done it seems to work very well!
Let me know how it works out.
LanFanNinja
8-Feb-12 0:19am
View
+5 And I totally agree about the VB ( VB = Very Bad ?? :) )
C# for me hands down!
LanFanNinja
8-Feb-12 0:08am
View
Like SAKryukov said in the comment above this is a programming website and this is not a programming question! There is plenty of info about this question online use
Google
.
As pointed out in solution 1 Windows games will not run natively on Mac OS. Check out
the WINE project you can get a lot of Windows games to run on Mac OS under WINE.
http://www.winehq.org
http://wiki.winehq.org/
LanFanNinja
8-Feb-12 0:04am
View
+5
LanFanNinja
7-Feb-12 22:26pm
View
You're welcome.
LanFanNinja
7-Feb-12 22:12pm
View
If you are talking about web page links that open up in a new window this code should do the trick.
public Form1()
{
InitializeComponent();
webBrowser1.NewWindow += new CancelEventHandler(webBrowser1_NewWindow);
}
void webBrowser1_NewWindow(object sender, CancelEventArgs e)
{
e.Cancel = true;
string url = webBrowser1.Document.ActiveElement.GetAttribute("href");
if (url != String.Empty)
{
webBrowser1.Navigate(url);
}
}
LanFanNinja
7-Feb-12 20:16pm
View
Great!! Hopefully I will be able to come up with a solution that works for the images as well.
LanFanNinja
7-Feb-12 19:41pm
View
I have posted a new method(/// METHOD 2 ///) of doing this in my solution.
It is much simpler and does not seem to have the problems with Google search that the other method(/// METHOD 1 ///) has. However it has a problem! It does not work for images that are also links. :( And so far I have not found another solution that does.
Anyway I thought I would post it and maybe it will be of some use to you.
P.S. If I come up with a solution that does work for images that are also links I will post it.
LanFanNinja
7-Feb-12 17:24pm
View
Hmmm... well I am not sure but I am investigating a different way to this but I am not sure it will work out. If it does work out I will post it here for you but no promises.
LanFanNinja
7-Feb-12 17:05pm
View
You're welcome.
LanFanNinja
7-Feb-12 17:04pm
View
One other suggestion I can make that might fix your first problem is as I said in another comment set the WebBrowser controls ContextMenuStrip to your contextMenuStrip_Text in the Form1 Constructor after this line
webBrowser1.IsWebBrowserContextMenuEnabled = false;
Example:
webBrowser1.IsWebBrowserContextMenuEnabled = false;
webBrowser1.ContextMenuStrip = contextMenuStrip_Text;
LanFanNinja
7-Feb-12 17:03pm
View
Deleted
One other suggestion I can make that might fix your first problem is as I said in another comment set the WebBrowser controls ContextMenuStrip to your contextMenuStrip_Text in the Form1 Constructor after this line
webBrowser1.IsWebBrowserContextMenuEnabled = false;
Example:
webBrowser1.IsWebBrowserContextMenuEnabled = false;
webBrowser1.ContextMenuStrip = contextMenuStrip_Text;
LanFanNinja
7-Feb-12 16:58pm
View
If I come up with a better way to do this I will post the solution here for you.
LanFanNinja
7-Feb-12 16:58pm
View
Sorry I am not having the same problems you are describing with this code (besides the problems with Google search that I don't know how to fix).
Like I said I have never done anything like this so I really don't know what I am doing either. :)
Just keep experimenting and searching google there may even be other/better ways to do this.
LanFanNinja
7-Feb-12 16:31pm
View
The fact is that what you are trying to do is unique! In fact you may be the first person to ever do something like this.
Expect problems!
LanFanNinja
7-Feb-12 16:23pm
View
"When I am in the google page, the #1-links menu appear everywhere, and only when I click over a link, then on normal text the #2-text menu appear finally"
This should not be happening and does not happen to me with the code exactly as it appears in my solution. Check over your code something is being done or not being done that should or shouldn't be.
"Then, when I search in google, in the page that is loaded, only the #2-text menu appear everywhere."
I was afraid of this! I believe it has to do with Google Instant predictions. The way they are loading the page (probably using AJAX) caused the DocumentComplete event to not fire for so many seconds after the page loads but then for me at least everything is fine at least if you don't press enter or click the search button after typing. I really don't know a way to fix this. :(
If you keep having problems maybe you could post your code and I will take a look.
LanFanNinja
7-Feb-12 15:58pm
View
I also noticed with the URL you provided because there are no links there will be no context menu set to display! So you may want to add this line to the Form1 constructor as well.
// show custom context menu strip for everything else
webBrowser1.ContextMenuStrip = contextMenuStrip2;
To set the WebBrowser controls initial ContextMenuStrip.
LanFanNinja
7-Feb-12 15:53pm
View
Make sure the webBrowser1.Navigating event is hooked up to the webBrowser1_Navigating event handler.
NOTE this line is the Form1 constructor:
webBrowser1.Navigating +=
new WebBrowserNavigatingEventHandler(webBrowser1_Navigating);
did you add this line?
If not you will need to do this or hook up the event inside the designer.
LanFanNinja
7-Feb-12 15:47pm
View
Forget what I said in the second half of my first comment about
"if (links != null)".
If you are not getting a NullReferenceException in the webBrowser1_Navigating event handler without this if statement make sure the event is indeed being fired (I think it is not) by setting a break point.
Because links is set to null when the application starts and the Navigating event fires before the DocumentComplete event there will be an exception here at least for the first page load because links will be set to null.
Hope this makes sense.
LanFanNinja
7-Feb-12 15:34pm
View
"links[i].MouseEnter = 0" will not work the code will not compile.
The code I have posted is the proper way to unsubscribe from events.
LanFanNinja
7-Feb-12 15:08pm
View
Please recheck my solution as I have made some modifications to the code to unsubscribe from the link_MouseEnter and link_MouseLeave events before the browser navigates to a new document.
I am thinking if this is not done it will create a resource leak.
LanFanNinja
7-Feb-12 14:44pm
View
Well I don't really know of any off the top of my head but this should help you some.
http://msdn.microsoft.com/en-us/library/awbftdfh.aspx
LanFanNinja
7-Feb-12 14:31pm
View
Recheck my solution. This code should do what you want.
LanFanNinja
7-Feb-12 14:24pm
View
See let me get this straight you want one custom menu for links and another custom menu for everything else? Let me know and I will update my solution for you.
LanFanNinja
7-Feb-12 14:17pm
View
If you have checked my solution before reading this comment check it again as I have made a small modification.
LanFanNinja
7-Feb-12 14:06pm
View
Check my solution.
LanFanNinja
7-Feb-12 1:32am
View
Sorry I can't I don't really know Java. I found the info above from a Google search and since no one had helped you yet I thought I would post them.
Sorry.
LanFanNinja
7-Feb-12 1:13am
View
FrameGrabbingControl
Perhaps this link will be of some use to you.
framegrabbingcontrol-is-null
LanFanNinja
7-Feb-12 0:44am
View
+5 Why didn't I think of that? :)
LanFanNinja
7-Feb-12 0:30am
View
Not that it matters to you but I truly hate these kinds of popups!
LanFanNinja
7-Feb-12 0:11am
View
It also seems no one debugs there code these days! Has it gone out of style? :)
LanFanNinja
7-Feb-12 0:01am
View
Someone will probably need to see some code!
LanFanNinja
6-Feb-12 23:55pm
View
Post the code for the ArrayCopy class or maybe even just the code for the ArrayCopy.Display() method as this seems to be where the problem is as pointed out in solution 1.
LanFanNinja
6-Feb-12 23:53pm
View
+5 I did the same and it works fine. I also used two for loops to display the items array before and after sort and it is indeed sorting properly.
TO THE OP:
So the problem must be in your ArrayCopy class and we will need to see the source code for that to figure out the problem.
LanFanNinja
6-Feb-12 18:01pm
View
Well honestly from what I see the only reason the button never turns red is because error is never greater than maxerror.
LanFanNinja
6-Feb-12 11:37am
View
LOL!! Thank you and you're welcome.
LanFanNinja
6-Feb-12 10:55am
View
You will need to create fileData at class level. Here is an example of how you would do this.
Public Partial Class Form1
Inherits Form
' fileData is declared here at class level and can be accessed from
' within any method in this class.
Private fileData As New Dictionary(Of String, String)()
Private Sub Form1_Load(sender As Object, e As EventArgs)
' using fileData in Form1_Load event handler
fileData.Add("Google", "http://www.google.com/")
End Sub
Private Sub SomeOtherMethod()
' using fileData in some random method
fileData.Add("Facebook", "http://www.facebook.com/")
End Sub
Private Sub sitesListBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sitesListBox.SelectedIndexChanged
' using fileData inside sitesListBox_SelectedIndexChanged
' event handler
webBrowser.Navigate(fileData(DirectCast(sitesListBox.SelectedItem, String)))
End Sub
End Class
Is this what you wanted to know?
LanFanNinja
6-Feb-12 1:26am
View
Check swapnilKumbhar's comment to my solution maybe it will help you.
LanFanNinja
6-Feb-12 1:15am
View
Deleted
No one has come to answer your question yet?
Maybe you should improve the question and be very exact about what it is you are wanting to do.
To do this use the green Improve question link above.
LanFanNinja
6-Feb-12 0:38am
View
OK so I am looking through your code and there is certainly somethings that are confusing me!
It looks like you are getting the image data on this line
byte[] buffer = (byte[])dr[45];
and then on this line you are writing the data to the buffer again!?!?
strm.Write(buffer, 0, buffer.Length);
so as said in Solution 1 and Solution 2 these two lines are unnecessary
strm.Write(buffer, 0, buffer.Length);
strm.Position = 0;
I wrote an example for you to check out maybe it will help you to figure something out. Maybe you will figure out that the data you are getting on this line
byte[] buffer = (byte[])dr[45];
is not your image data or at least not all of it or perhaps more than all of it.
MSDN says the File.FromStream() method will throw an ArgumentException if the stream does not have a valid image format or is null.
You also said in another comment
"i have inserted the inkpicture image in the sql server in .isf format"
what is this isf format?
I am all but certain the PictureBox control does not support it!
Anyway here is my example.
NOTE: "test.jpg" is just some random image i have on my hard drive.
Bitmap img = new Bitmap("test.jpg");
byte[] imgData = (byte[])TypeDescriptor.GetConverter(img).ConvertTo(img, typeof(byte[]));
MemoryStream ms = new MemoryStream(imgData);
Bitmap bmp = (Bitmap)Bitmap.FromStream(ms);
pictureBox1.Image = bmp;
Good luck.
P.S. I am sorry if non of this make any sense. I am so tired right now that I think I just saw some cartoon looking guy walking around my room to the left of me. =0
LanFanNinja
5-Feb-12 17:58pm
View
Also Thanks for pointing that out I will update my solution to reflect this change.
LanFanNinja
5-Feb-12 17:55pm
View
You're welcome. Glad it works for you. :)
LanFanNinja
5-Feb-12 17:41pm
View
One thing I noticed is this
Image img = Image.FromStream(strm);
pictureBox1.Image = Image.FromStream(strm);//errorinvalid parameter
Why are you doing this?
Why not just do this
Image img = Image.FromStream(strm);
pictureBox1.Image = img;
LanFanNinja
5-Feb-12 17:08pm
View
Hey you need to change the URL in this line
client.DownloadFile("http://mencfw.freehosting.com/", "file.txt")
from
"http://mencfw.freehosting.com/"
to this
"http://mencfw.freehosting.com/file.txt"
let me know if it works now.
EDIT:
I updated my solution to reflect this change as well.
Also when we are done here you may want to remove your URL from the above comment if you don't want your site visited by lots of people just yet.
LanFanNinja
5-Feb-12 16:43pm
View
Sorry I missed the SQL tag. I really have never messed with databases that much so I do not know how to answer your question.
I am sure someone else will be by shortly to help you out but if I find out the answer I will let you know.
Sorry. :(
LanFanNinja
5-Feb-12 15:54pm
View
You're very welcome.
LanFanNinja
5-Feb-12 15:30pm
View
Again if you need any help with the code just ask as I realize my code is not just a copy and past solution it will need to be modified a little for your needs.
LanFanNinja
5-Feb-12 15:25pm
View
Recheck the solution if you need the code in VB I decided to convert it for you anyway.
LanFanNinja
5-Feb-12 15:14pm
View
Thank you
LanFanNinja
5-Feb-12 15:10pm
View
Thank you
LanFanNinja
5-Feb-12 15:07pm
View
Also if the convert at
developerFusion
happens to be down there is another converter here for you to use.
telerik code converter
LanFanNinja
5-Feb-12 15:06pm
View
This code will only list the Name i.e. " Google " in the list and then when the name is clicked on the url will be retrieved from the dictionary and passed to the webBrowser.Navigate() method. The user will never see the URL.
So if I am understanding you correctly this is exactly the functionality you are looking for.
LanFanNinja
5-Feb-12 14:34pm
View
Check solution below.
If you need any explanation of what the code does just ask.
LanFanNinja
5-Feb-12 13:55pm
View
+5 Very good point.
LanFanNinja
5-Feb-12 12:43pm
View
If you must use the WebBrowser control the method you will be interested in is the WebBrowser controls Document.Window.ScrollTo(intX, intY) method.
ScrollTo Method
Google search for more info/examples
LanFanNinja
5-Feb-12 9:44am
View
+5 Agreed. Not enough info to give a proper answer.
LanFanNinja
5-Feb-12 6:42am
View
+5 Very nice indeed!!
LanFanNinja
5-Feb-12 3:36am
View
Sorry! =D
Thanks for the +5
LanFanNinja
5-Feb-12 3:34am
View
+5 My solution shows how much I enjoyed and agreed with this tip!
LanFanNinja
5-Feb-12 2:33am
View
Checkout this link
Getting Started Tutorials
and if you are new to programming
C# Station Tutorial
There are many tutorials like this out there just search around.
C# Tutorials for Beginners
Good Luck!
LanFanNinja
4-Feb-12 15:52pm
View
You're welcome.
LanFanNinja
4-Feb-12 9:18am
View
Deleted
Check my solution
LanFanNinja
4-Feb-12 9:12am
View
Deleted
This might help you.
The Specified Module could not be found
or this
unable to load unmanaged dll
It is likely that your DLL depends or one or more DLLs that are not present.
LanFanNinja
4-Feb-12 8:56am
View
+5 I agree this will not be an easy task.
LanFanNinja
4-Feb-12 7:12am
View
I am sorry I am not able to optimize this code (at least not using managed code). I have never created a screen recorder app and I am realizing This is just a very CPU intensive task to do! Even searching google was of no help as it seems others who have set out to accomplish this task have run into the same problems with no answers to be found. :(
Perhaps you could post this as a new question and see if someone else knows how to optimize it.
Either way I think your instructor will be happy with your code.
Once again I am sorry I could not be more helpful and I wish you the best of luck.
LanFanNinja
4-Feb-12 5:40am
View
Let me play around with this code you posted and see if I can figure something out.
Can you tell me the specs. of your CPU?
LanFanNinja
4-Feb-12 5:27am
View
Deleted
Well .... hmmm. It is really hard to say without being able to run your code myself. Is there anyway you could post your complete code so I can try it out?
Can you tell me the specs. of your CPU?
LanFanNinja
3-Feb-12 17:24pm
View
Thank you Mika
LanFanNinja
3-Feb-12 17:19pm
View
See my comment to Mika Wendelius for info on how to calculate frame rate if you do not know this already.
LanFanNinja
3-Feb-12 17:06pm
View
Yes 25fps should still be pretty smooth.
EDIT: Just in case OP is not familiar with how to calculate this just divide 1000 by the desired frame rate and this will give you milliseconds interval at which you need to capture the images.
Example:
1000 / 25 = 40ms
LanFanNinja
3-Feb-12 17:01pm
View
To fix your CPU performance problem try capturing at 60 frames per second. 60 frames per second is about the maximum framerate our eyes can process, anything above tends to be imperceptible to us.
Set your timer tick interval to 16.67 milliseconds and see how that works for you.
LanFanNinja
3-Feb-12 16:45pm
View
Maybe this would work for you.
Once so many images have been captured (say 50 to 100) write the images in your list out to the hard drive clear the list and repeat.
Or forget the list all together and write them directly to the hard drive as you are capturing.
Then once you are through capturing you can load the images back into the app (only so many at a time though) to do whatever else you may need to do with them.
LanFanNinja
3-Feb-12 16:30pm
View
+5
LanFanNinja
3-Feb-12 16:25pm
View
I agree that this is most likely the problem.
LanFanNinja
3-Feb-12 16:22pm
View
" is there a way to fix this? "
Install more RAM and possibly a new CPU. =D
Look your source code over there is possibly something in your code you could do different/better. There is really no way we can help you with this problem without more code/information.
To me it seriously just sounds like you are working the crap out of your PC!!
What are you planing on doing with this list of images??
You must find a way to accomplish your task without loading all the images at one time. For example load 20 images do what ever with them then load 20 more ...
LanFanNinja
3-Feb-12 12:27pm
View
+5 Nice tip got me think about somethings.
LanFanNinja
3-Feb-12 3:54am
View
+5
LanFanNinja
3-Feb-12 3:47am
View
You're welcome
LanFanNinja
3-Feb-12 3:19am
View
Thank you
LanFanNinja
3-Feb-12 3:01am
View
Check my solution below (solution 4) hope it helps and let me know if it works for you.
LanFanNinja
3-Feb-12 2:31am
View
+5
LanFanNinja
3-Feb-12 2:31am
View
+5
LanFanNinja
3-Feb-12 2:04am
View
It would probably help someone to answer you if you would tell what language you have used to implement all this.
LanFanNinja
3-Feb-12 1:58am
View
+5
LanFanNinja
3-Feb-12 1:53am
View
Thank you
LanFanNinja
3-Feb-12 1:03am
View
Don't know if this will help you but it helped me out a while back.
Regex for 0.00
LanFanNinja
3-Feb-12 0:52am
View
Deleted
Nice Name!! Are you one of those hot kinky programmer girls us guys often hear about but never see?? If so I would like to give my name, phone number, address, and half of my things in the divorce. :)
Please don't take this the wrong way I am only kidding. Or am I?
LanFanNinja
3-Feb-12 0:33am
View
To create a new article first go to the top of the page where you will find the site navigation links ( Home, Articles, Quick Answers, etc. ) next hover your mouse over the " Articles " item and a drop down list will appear ( like magic? ) then click on " Post an Article or Tip " this will take you to the online submission wizard linked to by thatraja.
Hope that makes since.
LanFanNinja
3-Feb-12 0:27am
View
+5
LanFanNinja
3-Feb-12 0:26am
View
+5 LOL!! An article about writing articles. :D
LanFanNinja
2-Feb-12 10:12am
View
Sorry there was an error in my code. =0
I modified my solution with the change below.
from
Array.Resize(ref data, data.Size + 1);
to
Array.Resize(ref data, data.Length + 1);
sorry if there was any problems because of this.
Good day.
LanFanNinja
2-Feb-12 9:50am
View
You're welcome.
Note also that if you use a List<string> you could always convert it to an array for 'insert reason here' if you needed to. i.e.
List<string> data = new List<string>();
string[] dataArray = data.ToArray();
LanFanNinja
30-Jan-12 10:59am
View
Sorry I was going to try and write some comments in the code for you but I ran out of time to do so.
The code doesn't seem very complex a few tutorials should get you up to speed fairly quickly.
Google pygame tutorials and also 2d game development tutorials.
Make sure you have learned the python language and have at least written a few simple programs with it first before attempting game development with pygame as not doing so is a sure fire way to have a nervous breakdown.
NOTE:
If you know zero programming I seriously recommend you take a couple of steps back and really learn programming in general first. Game programming even 2D game programming is very hard to do! Trying to go in blindly with no programming knowledge is hazardous to your health and will surely end badly for you.
Good luck.
LanFanNinja
30-Jan-12 10:36am
View
Deleted
what do you want to know about it exactly?? It has been quite a while since I messed with pygame (or python) but this code is actually looks quite straight forward so I can probably help.
Without getting into a lot of details I could probably just add some comments (simple comments cause I am pressed for time) to the code will that help?
LanFanNinja
30-Jan-12 9:57am
View
Deleted
If I am understanding you correctly you are wanting to get the number of character minus spaces in a word document??
If so check my solution below (solution 2) if not please explain yourself. :)
LanFanNinja
29-Jan-12 1:48am
View
Just to let you know I made one small change to the if statement in clearPlaylistButton_Click event handler. I don't think it matters either way but this just seemed more ... right.
changed from
if (selectedSong != null &&
selectedSong.Name == playListBox.SelectedItem.ToString())
to
if (selectedSong != null)
LanFanNinja
28-Jan-12 23:36pm
View
You're welcome.
I guess I can assume I understood what you where asking for then?
"You are ridiculously helpful."
Well I guess being ridiculously helpful is better than being my normal plain old ridiculous! :)
LanFanNinja
28-Jan-12 22:38pm
View
OK recheck my solution for the latest revision.
LanFanNinja
28-Jan-12 21:33pm
View
"Is there a way to do this ?"
Yes.
Give me a little bit and check back.
LanFanNinja
28-Jan-12 20:11pm
View
Check my new solution for you (solution 4). Hopefully it will help you on your quest for audio playback nirvana. :)
LanFanNinja
28-Jan-12 2:11am
View
You're welcome and thank you.
LanFanNinja
28-Jan-12 2:06am
View
I understand completely and have felt the whole time that it was simply a misunderstanding. Absolutely no harm done.
I have also took your advice and made some other modifications to my code that you suggested such as renaming openFileDialog1 and listBox1 to something more meaningful and changed the access modifiers for the properties.
Please understand I have the utmost respect for you and would not argue a point unless I truly thought I was correct.
Have a good day!
LanFanNinja
28-Jan-12 1:37am
View
"Yes sorry I am very uninformed about classes, objects, etc."
That is very understandable.
"Would it help to paste the whole code for my program (it's small and basic) for someone to help me sort this out"
How small are we talking here?? 50 lines or less?
What are you still having problems with? Post your code and lets have a look I am sure myself or someone else on here will be able to help you out.
LanFanNinja
28-Jan-12 1:23am
View
That is actually part of the point I was try to make! Auto-implemented properties must define both get and set accessors.
So when using auto-implemented properties the only way to make them immutable is to define the set accessor as private.
There is no option to simply leave the set accessor out it must be defined! Therefore I have no other choice than to set its access to private so that the property cannot be set outside of the class it is defined in.
Did you finally get it?
LanFanNinja
28-Jan-12 0:05am
View
I totally agree with what SAKryukov is saying here. I have used applications with text areas that only scroll line by line and for some reason it really bothers the crap out of me.
This is however your application and if you feel you need/want this functionality then by all means go on and implement it. :)
LanFanNinja
27-Jan-12 23:25pm
View
Very well said sir.
LanFanNinja
27-Jan-12 23:22pm
View
I have changed the properties access modifiers from public to internal as per your suggestion.
EDIT:
Also changed my variable names to be a little more meaningful as well.
LanFanNinja
27-Jan-12 23:03pm
View
Please have a look at this code
MSDN Code Example
.
As you can see from the example code these are perfectly legal read-only auto-implemented properties.
LanFanNinja
27-Jan-12 22:57pm
View
Certainly if I declared my properties like this
string name;
public string Name { get { return name; } }
that would be true however when using auto-implemented properties this this is not the case.
for example
public string Name { get; }
Name = "some name";
I would not be able to assign to Name as there is no setter!
EDIT: And yes as you (SAKryukov) have pointed out it would not even compile.
I learned how to implement properties this way from a text book when I learned about auto-implemented properties and I have seen many others write code the same way.
I get absolutely no warning declaring properties in this way.
I have even seen Microsoft programmers declare properties this way.
LanFanNinja
27-Jan-12 22:49pm
View
Sorry my bad I meant to write internal and not protected. I have been on hiatus for three weeks and I think I must have misplaced my mind somewhere! :)
Thank you for the info and suggestions.
LanFanNinja
27-Jan-12 22:45pm
View
+5 Correct. This certainly needed to be pointed out.
LanFanNinja
27-Jan-12 22:36pm
View
#3 I agree with. I was only doing this based on the variable names the OP provided to make it easier for him.
#4 "Private set is redundant -- you never use it, should cause warning"
When declaring properties this way (Auto-Implemented) I have no choice but to add the the setter else I cannot assign to it inside of the class it is declared in and not marking it as private would allow it to be set outside of the class which is not what I wanted. So IMO there is no other way.
LanFanNinja
27-Jan-12 22:28pm
View
Thanks for the vote.
"using public is not justified"
Should I have used protected instead?
"Names like Form1, listBox1 are not acceptable"
This was only an example however I agree I should have used more meaningful names.
LanFanNinja
27-Jan-12 22:22pm
View
If you are reading this comment after checking my solution please recheck it as there was a mistake I fixed.
changed
Song selectedSong = songs[listBox1.SelectedValue];
to
Song selectedSong = songs[listBox1.SelectedItem.ToString()];
LanFanNinja
27-Jan-12 20:42pm
View
Check solutions below.
LanFanNinja
27-Jan-12 0:17am
View
Learn your keyboard like the ninja then you will need no backlight. :)
Seriously though there are a few different laptops out there with backlit keyboards just google it.
My Google Search Results
LanFanNinja
24-Jan-12 9:43am
View
+5 I would do the same.
LanFanNinja
24-Jan-12 9:43am
View
+5 I agree.
LanFanNinja
24-Jan-12 9:36am
View
You're welcome. It is always a good idea plan out what your are wanting to do before you start trying to do it.
LanFanNinja
24-Jan-12 8:56am
View
+5 A bit hard coded but demonstrates the use of the Replace method all the same.
LanFanNinja
24-Jan-12 8:51am
View
Deleted
Don't worry I have done the same more than once. :)
you can delete this comment too and I will delete mine like we were never here :)
LanFanNinja
24-Jan-12 8:49am
View
Deleted
Probably because this is not your code! :) See solution 3
LanFanNinja
24-Jan-12 8:41am
View
Correct.
LanFanNinja
24-Jan-12 8:41am
View
The result of str.Replace("</br>", ""); needs to be assigned to str or another string.
i.e
string str = "Cobalt II</br>";
str = str.Replace("</br>", "");
LanFanNinja
25-Dec-11 1:14am
View
Thank you.
LanFanNinja
24-Dec-11 1:11am
View
You're welcome.
LanFanNinja
24-Dec-11 0:59am
View
Please do not completely change questions like this! It really confuses people. :) Recheck my solution below.
LanFanNinja
24-Dec-11 0:49am
View
That doesn't make any sense !?! Please explain more about what you want to do.
EDIT:
Perhaps your are misunderstanding? The Shown event only fires once when the form is first shown.
LanFanNinja
21-Dec-11 17:04pm
View
True.
LanFanNinja
21-Dec-11 15:25pm
View
You're welcome.
LanFanNinja
21-Dec-11 14:15pm
View
LOL!
+5 for making me laugh.
LanFanNinja
21-Dec-11 13:45pm
View
Note the lack of parenthesis from StartGame.
Your code: Thread theThread = new Thread(new ThreadStart(StartGame()));
My code: Thread theThread = new Thread(new ThreadStart(StartGame));
or
My code: Thread theThread = new Thread(StartGame);
EDIT:
Also in your button1_Click event handler you are creating an instance of Game1 called "ogame" this is not needed an instance of Game1 is being created in the StartGame() method.
In order for you to be able to create "ogame" in button1_Click and the run it in StartGame() would require more work as there would be a cross thread error.
If you need access to the game instance outside of StartGame() you will need to make it global. i.e. something like this:
public partial class Form1 : Form
{
Game1 ogame;
public Form1()
{
InitializeComponent();
button1.Text = "Start!";
}
private void button1_Click(object sender, EventArgs e)
{
Thread theThread = new Thread(StartGame);
theThread.Start();
}
public void StartGame()
{
ogame = new Game1();
ogame.Run();
}
}
LanFanNinja
21-Dec-11 13:42pm
View
Use this code exactly as it is written.
private void button1_Click(object sender, EventArgs e)
{
//Game1 ogame = new Game1();
Thread theThread = new Thread(StartGame);
// OR
//Thread theThread = new Thread(new ThreadStart(StartGame));
theThread.Start();
}
public void StartGame()
{
Game1 game = new Game1();
game.Run();
}
LanFanNinja
21-Dec-11 13:01pm
View
+5"Now, forget that goto exists at all for at least three years."
I would change this to say
Now, forget that goto exists at all for EVER and EVER and EVER !! :)
LanFanNinja
21-Dec-11 12:57pm
View
Show me your code.
LanFanNinja
21-Dec-11 10:41am
View
Not sure I see another way using only a single for loop!?
LanFanNinja
21-Dec-11 10:33am
View
Indeed! Oo
LanFanNinja
21-Dec-11 10:20am
View
Why you change your question from what it was to what it is now I will truly never know ??!?!?!?
LanFanNinja
21-Dec-11 10:16am
View
+5
yes OP needs to read the DragonFireSDK documentation
http://www.dragonfiresdk.net/help/DragonFireSDKHelp.html
And practice, practice, practice!
OP wrote "P.S if i initialize the boxes within the InitializeBoxes() function it works :P"
Your problem is due to a misunderstanding.
LanFanNinja
13-Dec-11 18:48pm
View
+5 Absolutely!
LanFanNinja
13-Dec-11 9:57am
View
+5 Judging by the code posted I would have to agree.
LanFanNinja
12-Dec-11 18:58pm
View
Check my solution.
LanFanNinja
12-Dec-11 18:34pm
View
+5
LanFanNinja
12-Dec-11 18:34pm
View
I am sure someone here would be more than happy to write this program for you. If you pay them some money that is. :)
LanFanNinja
11-Dec-11 21:27pm
View
+5
LanFanNinja
11-Dec-11 21:17pm
View
+4 Correct or better yet
if ($password != $repassword)
or
if ($password !== $repassword)
However you are correct this code
if (!$password == $repassword)
Is straight up WRONG! Using this code the passwords will always match unless one of the strings are empty ("").
for example
$pass = "I am BIG bird";
$rePass = "dog";
if (!$pass == $rePass)
{
echo $pass." and ".$rePass." do not match!";
}
else
{
echo "Match";
}
this code will always echo Match.
LanFanNinja
11-Dec-11 20:53pm
View
I was only considering the fact that the OP wanted to modify and build upon the starter kit to create his own game. I know from experience the problems he will face to convert this particular XNA 3.0 project to XNA 4.0 (a lot more problems than is posted in his question). I thought it was best to avoid these problems all together by offering a link where he can download the already converted solution so he can focus his time on the game.
LanFanNinja
11-Dec-11 19:34pm
View
Check my solution.
LanFanNinja
11-Dec-11 18:54pm
View
Or they need different help than can be found on a programming website. :)
LanFanNinja
11-Dec-11 18:52pm
View
LOL!
LanFanNinja
11-Dec-11 18:26pm
View
+5 definitely! :)
Who wrote this code?? It makes me sick just to look at it!
string p_25, double p_26, int p_27, ... Seriously!?!
EDIT:
My first recommendation to the OP is to rename the parameters to something more descriptive and memorable.
LanFanNinja
10-Dec-11 22:44pm
View
tidu12 please do not post the same question (more or less) multiple times.
If you cannot come up with something using this solution and the code I posted for you in your previous question it is obvious that you need to hit the books and get better at programming before proceeding.
No one is going to create this project for you and why would you want them to?!?
LanFanNinja
10-Dec-11 22:41pm
View
+5 A very nice example to build from.
LanFanNinja
10-Dec-11 21:45pm
View
I modified my solution to demonstrate a way you could keep track of the score and number of rolls. This really is pretty much the extent of my javascript skills. :)
You can modify this anyway you like including using a while loop to call rollDice() and perhaps changing the alert() calls to document.write() or something?!?
I really wish I could help you more but I don't have the time to learn javascript right now (and don't want to) and that is basically what I would have to do to help you any further.
It seems to me you have quite a lot of learning to do yourself. Programming is about exploring and finding new and interesting ways to solve problems. It is not about getting someone else to solve these problems for you.
Good luck!
LanFanNinja
10-Dec-11 20:18pm
View
Deleted
Check my solution.
LanFanNinja
10-Dec-11 17:26pm
View
+5 He/she has been busy posting the question many places on the internet. Most of the posts have been closed.
LanFanNinja
10-Dec-11 17:15pm
View
Homework?
I noticed someone gave you a good answer at this link posted just a few minutes ago.
http://www.webdeveloper.com/forum/showthread.php?p=1183910
In case you have not checked it yet. :)
I also noticed you posted this question to http://answers.unity3d.com
Probably will not get any help there for this question.
Did you also post this question to StackOverflow??
I am not trying to be mean with my comment here. Most people simply do not have the time to create projects for other people. Start creating the project and then if you have problems with something post a question here describing the problems you are having. Maybe we can help you then.
P.S. The name of the game you are describing is called Fifty I think if that is any help to you.
LanFanNinja
9-Dec-11 21:20pm
View
You're welcome.
LanFanNinja
9-Dec-11 18:19pm
View
+5 Good answer.
LanFanNinja
9-Dec-11 18:11pm
View
Check my solution
LanFanNinja
9-Dec-11 5:34am
View
+5
LanFanNinja
9-Dec-11 5:18am
View
+5 I agree!
LanFanNinja
9-Dec-11 4:46am
View
+5 I agree with this solution and the comments.
LanFanNinja
9-Dec-11 4:46am
View
Sorry I was only going by the values posted in your question. I agree with the comments posted in solution 1 and I think you should rewrite this code using there suggestions.
LanFanNinja
8-Dec-11 8:32am
View
And yes language does matter! Judging by the question posted I assumed the OP to be fairly new to programming and most likely only knows VB.Net. So I felt that giving him or her code in C# would only help to confuse them.
Imagine if you will that you speak only Chinese and I speak only Japanese
sure we both speak Asian languages but we still cannot understand each other.
LanFanNinja
8-Dec-11 8:10am
View
Ok well ignoring the down vote for using the wrong language I down voted him yet another star (from 4 to 3) because after trying his code myself I found it to be no good! The reasons why are posted below.
There is no "ListItem" perhaps he meant "ListViewItem" well that is no good either and running the code that way I obviously receive a "Unable to cast
object of type 'System.String' to type 'System.Windows.Forms.ListViewItem'." exception!
The correct code would be something like this
foreach (string item in listBox2.Items)
{
listBox1.Items.Add(item);
}
LanFanNinja
8-Dec-11 8:02am
View
NO it is NOT! Please read both solutions again. You will notice there is an error in his code I pointed out and my solution is in VB.Net (the language the OP is using).
Please understand I do not make it a habit to waste my time posting solutions to questions that have already been correctly answered. I felt this question was NOT correctly answered so I offered my solution.
LanFanNinja
8-Dec-11 7:45am
View
This will work but there is a better way (see my solution). I only voted you 4 because the OP is using VB and your solution is C#.
--EDIT--
Changed vote from 4 to 3 see my comment to Mark Nischalke below for the reasons why.
LanFanNinja
8-Dec-11 7:42am
View
ListBox.ObjectCollection contains no method ToArray()
LanFanNinja
7-Dec-11 5:31am
View
You're welcome.
LanFanNinja
7-Dec-11 5:10am
View
Check my solution
LanFanNinja
7-Dec-11 4:40am
View
Are you trying to save the contents of a TextBox?? Can you give us an example of the code you are using to try and save the "document"?
LanFanNinja
3-Dec-11 19:51pm
View
In addition to solution 1 also check out this
http://www.codeproject.com/KB/architecture/OOP_Concepts_and_manymore.aspx
LanFanNinja
3-Dec-11 19:40pm
View
Considering this is homework I hate to just give you the code to do this but I will tell you it can be easily accomplished using a for loop, if statement, and a integer variable (to keep track of the number of vowels). Try on your own and then if you get stuck come back here and post your code and tell us what problems you are having then we can help you more.
LanFanNinja
3-Dec-11 18:20pm
View
+5 agreed!
Show More