16 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for Reverend Jim

I wrote a timer/alarm app in Python that I wanted to be accessible from all Windows Desktops. What I had to do until recently was run the app, select the desktops icon on my toolbar, then right click the app and select "Show this window on all desktops". I was …

Member Avatar for AndreRet
2
767
Member Avatar for jnbgames.dev

The program below is written in **Java** and is used to develop a Web Server that supports these status codes: **200** OK, **302** Moved Temporarily, and **404** NOT FOUND. The code can emulate an **HTTP** server in your local machine. Let me know if you find the code below helpful …

Member Avatar for JamesCherrill
1
158
Member Avatar for jnbgames.dev

The program below is written in **C** and is used to convert numbers to words. These operations are beneficial during the development of word processing applications. The program takes the **input** file that contains the number and **outputs** the results in an output file. Let me know if you find …

Member Avatar for Dani
0
406
Member Avatar for jnbgames.dev

The program below is written in C and is used to perform fast number operations. These operations are beneficial during the development of spreadsheet applications. Let me know if you find the code below helpful and if you have any additional suggestions:

Member Avatar for rproffitt
0
226
Member Avatar for vegaseat

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 …

Member Avatar for laheg
2
25K
Member Avatar for ddanbe

There are many pictures of hearts out there. I just wanted to draw a picture of a heart on my own from a math formula I found on the net. Seems there are many formulas to find. This is how it looks: ![Heart.PNG](/attachments/small/1/4c36fe9d031a39f8b3468f1c4f8a8f3d.PNG "align-left") Enjoy!

3
346
Member Avatar for ddanbe

After reading this excellent [code snippet](https://www.daniweb.com/software-development/csharp/code/492766/display-excel-data-in-a-datagridview) by djjeavons, and just trying to learn WPF, I decided: "Well, let's translate that to WPF!". It was a bit harder than I thought, but a great learning experience! Her's how my screen in action looks: ![WPFscreen.png](/attachments/small/1/ac05d33ccd8a190d0576fa063e54749f.png "align-left") Things that changed compared to the …

Member Avatar for ddanbe
1
541
Member Avatar for William Hemsworth

Quite a while ago, I made [URL="http://www.daniweb.com/code/snippet217147.html"][B]this[/B][/URL] snippet. This code is basically the same, except that it adds animation. This method of blitting is very fast assuming you don't use a surface that's too large. On a 500 x 500 surface, I managed 350fps using only 0-1% of the cpu. …

Member Avatar for thetukiet
1
7K
Member Avatar for vegaseat

Using the Python win32 extensions it is relatively simple to copy to and from the clipboard. Sorry. the Windows OS is a requirement.

0
2K
Member Avatar for BenWard

I had to map a network drive with specific credentials in my PHP script and it kept falling over because I'd already navigated to the drive in windows explorer. This snippet will unmap a network drive using COM regardless of whether or not there is a drive letter associated with …

0
613
Member Avatar for deceptikon

In my job I tend to write a lot of Windows services. Due to this I've pared it down to bare essentials so that the code is as simple as possible, but still fully functional for the needs of each service. What this generally means is I *don't* use the …

Member Avatar for deceptikon
4
409
Member Avatar for deceptikon

Another quickie. This is a basic class for working with Windows path strings. It's based off of .NET's System.IO.Path class, but doesn't contain any API dependencies (and thus doesn't normalize the paths, it's all straight string handling). Methods that I've personally found to be useful are included. The class is …

Member Avatar for deceptikon
0
383
Member Avatar for vegaseat

I borrowed this from C#, where you can easily send output, that normally goes to the ugly black console window, to a nice looking Windows MessageBox with an OK button to close after you read your results. You can accumulate your output in a string to send to one message …

Member Avatar for nagendra_rao
0
853
Member Avatar for TrustyTony

This came up, maybe it is usefull to somebody. Later I plan to do a managing context interface to `with`statement for this.

Member Avatar for TrustyTony
0
2K
Member Avatar for Diamonddrake

This simple class encapsulates the exAnimatewindow api call. I got tired of adding all the jazz to every form I need to use as a pop up, or any borderless forms I used. (Windows 7 and vista don't animate windows with no border by default) This class could easily be …

1
253
Member Avatar for vegaseat

This program uses the Python win32 extension module to get information on disk or flash drives for Windows machines. Specify the drive with its letter. If no drive letter is specified, the current drive is applied.

Member Avatar for Gribouillis
4
3K

The End.