Just trying to find out which of these five isprime functions is the fastest.

Member Avatar
Member Avatar
+1 forum 7

Wanted to let two forms work together. One form would be the input form and the main form would consume this data. I managed to succeed with the help of a few of my friends here at daniweb., who helped me setup a static form. Just posted a bit of the most relevant code here, the rest of the project can be found in the attachments. I also like to mention a technique used here to attach a value to a selection of a name in a combobox.(Found it on MSDN) See the list of Planets. (Yes, throw a ball …

Member Avatar
Member Avatar
+1 forum 4

What "Hello World" is to the console, the "Bouncing Ball" is to the Graphical User Interface. Nothing fancy, the ball is created via a call to the API function ellipse() and then bounced within the confines of the windows form. For the DEV C++ crowd: Let me know if you find these snippets somewhat helpful in your learning process in the comments section at the end.

Member Avatar
Member Avatar
+1 forum 23

There are times when you need to make sure your counter starts at an odd or even number. Even is pretty simple - `counter = counter + modulus(counter)`. If counter is even it stays, if it's odd it gets incremented by 1. Odd is a bit more complicated - `counter = counter + modulus(counter + 1)`, If counter is odd it stays, if it's even it gets incremented by 1. if you're in danger of counter being the max value you can always subtract instead. These basic algorithms should work for any language that has a modulus operator/function. I've included …

Member Avatar
Member Avatar
+2 forum 4

This Program implements the Predictive Parsing Of the grammar E->E+T/T F->F*T/F F->id(Identifier)

Member Avatar
Member Avatar
+0 forum 9

Haven't programmed in a long time. Last project was a GCODE pathway generator I wrote several years back. My compiler is obviously several years out of date. Uses time(), itoa(), rand(). Current standard compliant compilers should have <chrono>, <thread>, <random>, and to_string() in suppliment to those more deprecated functions. This is a very simple, high speed method of generatinga alot of randomized junk data onto your drive. Make sure you have about 300MB of RAM available for the overhead. An older non-SSD might croak. Useful for making old files unrecoverable by overwriting the old space on a drive. Doesn't go …

Member Avatar
Member Avatar
+2 forum 1

Hi guys, Am developing a clinical management system in VB.net and using Microsoft Access for the database. Everything else is working very well. But the login code is not working. It's throing an error message "Object reference not set to an instance of an object" on line 12. Below is the code for the log in button.

Member Avatar
Member Avatar
+0 forum 1

Above program takes input of coefficient and power separately of 2 different polynomials add them up to a new polynomial.It is successfully compiled and executed in DEV CPP as C file.It Turbo C compiler add void before main function to avoid warning messages.

Member Avatar
Member Avatar
-1 forum 8

This simple isprime(number) function checks if the given integer number is a prime number and returns True or False. The function makes sure that the number is a positive integer, and that 1 is not considered a prime number. To find out if an integer n is odd one can use `n & 1`, to check for even one can then use `not n & 1` or the more traditional `n % 2 == 0` which is about 30% slower.

Member Avatar
Member Avatar
+2 forum 36

The printer seems to be a much ignored computer peripheral when it comes to programming. This little code snippet explores one way to send text to the default printer. It actually draws the text into an imaginary box on the paper. You can specify the upper left and lower right corners of this box.

Member Avatar
Member Avatar
+2 forum 1

When working with TCP client sockets I often find myself frustrated with the lack of event-driven support. I usually end up writing a whole bunch of code to determine disconnects, reconnecting, etc and I figuired it's time to just write my own class for this stuff. I figuired I'd share it with all of you. The implementation is quite simple, I'll provide an example below. I have XML commented all the public properties and methods, the rest is up to you to figuire out if you want to make any changes! public partial class Form1 : Form { EventDrivenTCPClient client; …

Member Avatar
Member Avatar
+5 forum 17

A long standing complaint with the standard progress bar control is that there is no easy way to display text. In spite of numerous requests, Microsoft has not included this capability. The following code includes a class, `CustomProgress` which inherits the standard `ProgressBar` and adds such a feature. It is fairly easy to use. If you want to show a percentage progress you set `Text` to a null string and the percentage will be calculated from the `Minimum` and `Maximum` value properties. If you want a custom string then assign it to `Text`. Either the percentge or custom text will …

Member Avatar
Member Avatar
+4 forum 3

If you press any key on your keyboard, this small Tkinter GUI program will tell you which key and what type of key has been pressed. Great for applications where a simple key stroke is required.

Member Avatar
Member Avatar
+1 forum 1

Demonstrates using .NET Remoting to broadcast to client subscribers. There are three parts: 1) Server.cs - for console app responsible for broadcasting messages (date/time stamp currently) 2) Client.cs - for console app that registers with server to subscribe to broadcasts 3) Agent.cs - class library that facilitates/eposes the interfaces for our client/server communication To use, create the three project types defined above and include the appropriate code found in this snippet. In both the Server and Client projects, add references to the Agent.DLL project. Then, modify the IP address in the ClientClass's creation of the AbstractServer remoteObject to a string …

Member Avatar
Member Avatar
+2 forum 3

An example showing how to use the wx.media.MediaCtrl() widget to play MIDI, MP3, WAV, AU, AVI and MPG audio and video files. I have only tested it with Windows. If you are very ambitious, you could use a random graphics display with the sound, or tie the slider position to a slide presentation.

Member Avatar
Member Avatar
+2 forum 7

This short Python code gets the local time from the PC as a formatted string using time.strftime('%H:%M:%S'). The time string is displayed in a label using a larger font. A recursive function checks the time five times per second, and updates the time string, if it has changed. Five times per second may sound like overkill, but keeps the display from acting spasmodic.

Member Avatar
Member Avatar
+2 forum 13

Let's say you want to send a short private message to your friend, but don't want grandma to snoop around and find it. One way is to use the Python Image Library (PIL) and hide the message in a picture file's pixels. Just looking at the picture you will barely detect any difference between the before and after picture. All your friend needs is the decode_image portion of this simple code to get the message back.

Member Avatar
Member Avatar
+5 forum 15

A simple way to create a toggle button for the Tkinter Python GUI toolkit.

Member Avatar
Member Avatar
+1 forum 13

Pretty neat text-based RPG that I made. Currently my first game.

Member Avatar
Member Avatar
+0 forum 18

This code shows how to obtain and display a GIF image from an internet website using the Tkinter GUI toolkit that comes with the Python installation.

Member Avatar
Member Avatar
+4 forum 7

I was so amazed at how easy it was to embed google maps into a vb app I decided to post a quick example to help anyone get started. This is a simple example. Google's api has all kinds of things to help customize your map. You can find out anything you need to know from here: [url]http://code.google.com/apis/maps/documentation/javascript/reference.html[/url] You will need to: Create a new windows forms app. Add a class named GoogleControl and paste the GoogleControl code into it. Add a new html doc to the project and name it GoogleMap.htm and set its Build action to CopyIfNewer Copy …

Member Avatar
Member Avatar
+4 forum 46

This snippet converts a CIDR notated IP address to a range of IP addresses in decimal, dotted notation. Eg.: 192.168.1.255/31 => 192.168.1.254 - 192.168.1.255

Member Avatar
Member Avatar
+0 forum 2

The snippet shows how to create a menu on a windows form and test it. Original code via BCX, modified to compile with Dev C++ as a Windows Application. This approach does speed up writing of GUI programs.

Member Avatar
Member Avatar
+1 forum 2

Several people have asked how to export data to Excel. This code snippet shows how to export the data from a listview in details mode to a new Excel spreadsheet. Take note of the comments in the header to avoid having orphaned Excel.exe tasks eat up your system memory.

Member Avatar
Member Avatar
+7 forum 15

The present code snippet just does an especific task. This is, given an ordered sequence of natural numbers, starting at zero, generate all the different permutations there can be. When we talk about permutations, the order of the sequence does matter. So, the sequence 0, 1, 2 differs from 2, 0, 1. For example, think about a 4-7-2 lock combination sequence. Changing the sequence to 2-7-4 would not open the lock, of course. Properly speaking in mathematics, we are talking about permutations, because the order does matter. On the other hand, if the order did not matter, we would be …

Member Avatar
Member Avatar
+0 forum 9

Hey, i was just mucking around and improving my code etc and made a calculator, it's not the best calculator in the world, it only can handle 1 or 2 numbers but i think it's good my self :).

Member Avatar
Member Avatar
+0 forum 8

Shows how to create a basic slide show with the Python Tkinter GUI toolkit.

Member Avatar
Member Avatar
+4 forum 19

Yes, WPF. The learning curve is steep, but what amazing things you can do with it! Look at this hexagon window for instance. Serves no purpose in a business environment I guess, but in a gaming situation it could work. For me, it was just fun to get this up and running. I’m using VS 2017. Start up a new WPF window project. Call it HexagonWindow and fill in the missing code. I still don’t understand all the intricacies of WPF, I’m just a mere mortal human being, but my quest on the subject is ongoing. Why don’t some of …

Member Avatar
Member Avatar
+0 forum 2

Well inside the windows operating system there are predefinided dialog boxes. We can use it freely with little effort. Think that you have to get a input file name or file path. The traditional way of doing this is parsing the command line arguments.But here we are in win32 , so we should use GetOpenFileName simple GetOpenFileName just getting an pointer to a data structure OPENFILENAME that defined on Commdlg.h header file. so we just create that structure on the memory and passing pass it's pointer as an argument to the GetOpenFileName function. and after that returns it normally fills …

Member Avatar
Member Avatar
+0 forum 5

This is a remake of the Simple Equation Solver snippet that is written in Java. This is an equivalent version written in C++.

Member Avatar
Member Avatar
+1 forum 7

The End.