1,916 Reusable Code Snippet Topics
Remove Filter ![]() | |
This is a module that can be used to save tiff images pass in from a file dialog. This module was translated from C# to VB.net, and the original project can be found [URL="http://www.codeproject.com/Articles/16904/Save-images-into-a-multi-page-TIFF-file-or-add-ima"]here[/URL]. I do not claim rights to this code. You can copy this code straight down into … | |
This is an example of a singly linked list allowing you to enter a number of names and associated ages. The twist is that the names are inserted into the list in ascending order. When the list is displayed, it is already sorted by name. Note: This is not an … Software Development c linked-list | |
| |
Hey everybody, Lately I have written the game Hangman in many different languages (C, JavaScript, Java and PHP so far). Here is the code snippet for Java! It uses a words file, on the bottom of this post you will see a small example of a few words. The source … Software Development java open-source | |
The PySide (PyQT) GUI toolkit can be used to play wave sound files. | |
I made this minesweeper game earlier this summer. It shows many things, including: array use, 1D array to 2D array, gridlayout, changing the way a JButton works depending on mouse button used, floodfill, loops, GUI. slightly long, 382 lines, can probably be condensed. There is one known bug that i … | |
PySide's QWebView can load a given url and display the web page associated with it with just a few lines of code. Software Development python | |
There is free tools to do the same, but I was curious to see what it takes to make one myself. For info see: [url]http://en.wikipedia.org/wiki/LC-3[/url] Software Development python | |
this is a small graphical program in c....which gives you a clear discription about what a graphics can do in c..(a simple one) Software Development c | |
Shows you how to get a Python object's memory size. Notice that there can be a difference between Python versions. Software Development motherboards-cpu-ram python | |
If you decorate a function, then some of the information is lost during the debugging process. Python supplies another decorator @wraps to help out. A decorator for a decorator, very interesting. Software Development python | |
Just use the SetTimer function after you Create the window , and just handle the WM_TIMER message inside the message loop. That's it ! Software Development c++ | |
Squaring a number is a rather common task in programming, but if you want to square an integer. Easy you think! Int MySquare = AnInt *.AnInt; This will happily overflow without giving any exception if AnInt is bigger than 46340, unless you put your code in a checked block. Now … Software Development | |
Similar to echoserver, but this one handles multiple clients by forking the process. Software Development c client-server socket-programming unix | |
This is a simple echo server that I've written while learning sockets programming. Compile the server and run it. You can connect to it using telnet like this: telnet localhost 1337 Disconnect the client by typing "/quit" without quotes. Software Development c client-server socket-programming unix | |
This is a program I wrote for my x86 assembly class which generates matrices, multiplies them, and computes how long the arithmetic took. It uses Irvine32.inc which came with the textbook. Software Development assembly matrix-multiplication | |
This is a function that generates a string of random characters to the length that you specify. | |
This snippet prints a python list of strings in multicolumn format (similarly to linux `ls` command). It uses module prettytable, available in [pypi](https://pypi.python.org/pypi/PrettyTable). Software Development python | |
This snippet is reserved for users of the KDE linux desktop. It adds a *service menu* to kde applications such as dolphin and konqueror, to launch an ipython dashboard in a directory in one click. More specifically, save the text of this snippet as a file `~/.kde/share/kde4/services/ServiceMenus/opennotebook.desktop` (create the directory … Software Development python web-browser | |
A modal dialog is a window that you must respond to. The MessageBox for example is such a window. It is a handy tool for displaying a warning or other kind of message to the user. But, you can configure it only in a limited way. Xcelled194 did a good … Software Development html-css | |
you need to give the input text files in the command line... Software Development python | |
THIS IS DANGEROOUS CODE, if it fails, it may prevent yu frome editing it. also, you can use the functions to do crazy stuff. Look at [this refrence](http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx) and change the `0x12` to what you want. (This one hold alt, so typing r will actibvate the menu that starts with … Software Development python | |
Shows you how to create multiple Tkinter buttons in a loop, each with its own name, label and command response. | |
The code sample shows how to get an image from the internet and show it in a Tkinter label widget. | |
The test.txt file I'm using is: 1,2,3,Name1,Pizza,Pizza Hut,7,8,9 1,2,3,Name2,goose,my home,7,8,9 1,2,3,Name3,chicken,airplane,7,8,9 Most of the explanation can be found in the snippet. Some CSV(Comma Separated Value) files often contain as first line, a header. You could skip this, or threat it a bit differently. I had no header, so I leave … Software Development | |
Just a simple image file slide show using PySide (PyQT). | |
Here is a simple implementation of implementing a simple Left trim (ltrim) and Right trim(rtim) of unwanted characters from a C style string. (null terminated strings). Doesn't suffer the overheads of the memmove implementation in which the worst case scenario (a string containing all junk characters) is approx. N^2 / … Software Development c | |
Here little debugged version of my calculator posted earlier in GUI calculator thread. I prepared it after listening that their teacher did more limited calculator in around 150 lines of code with their graphics module. This is 115 lines without empty lines and comment lines [CODE]>>> li=[i for i in … | |
This example calculates timed x, y points of a projectile motion that can be used for plotting or other calculations. Software Development python | |
A Python sort with a helper function to allow for mixed order sort like age descending and weight ascending. Software Development python | |
This simulator works for: 1. First Come First Serve (FCFS) 2. Round Robin (RROB) 3. Priority (PRIO) 4. Longest Job First (LJF) 5. Shortest Job First (SJF) algorithms. The program is written for gcc linux compiler. In input file a sequence of processes coming to the systems included, where also … Software Development algorithm c operating-system | |
This has by far no practical use. But as I was used to VS, handling most of the code housekeeping "behind the back", I wanted to try to make a Forms program as minimalistic as possible. Start an Empty project, include a reference to System.Windows.Forms and fill in the code. … Software Development | |
Here's a simple class for what it's worth that will do simple base85 encoding and decoding. This only works with the required blocks of data and not large data structures or streams, and does no validation of the data. What it does do is encode a block of 4 8-bit … Software Development c++ | |
The server only does the basics. TODOs: The header method needs expanding. The file send method can't handle too large files. Maybe write custom buffer class since some buffering is done. Keep cache of recent files. Software Development client-server java web-server | |
Just another loan calculation, this time using a handy function in Python module numpy. Software Development python | |
Starting with Python 3.3 you now have access to a high resolution time counter (nanoseconds and better). Software Development python | |
You can teach your linux system that executable python files must be executed with /usr/bin/python. This allows you to write python scripts without the shebang line [icode]#!/usr/bin/env python[/icode]. This snippet shows you how to do it ! Software Development python | |
Python module turtle makes it simple to draw graphics art similar to art done by the Logo language. Software Development python | |
Using Python module turtle to draw a Koch snow fractal. Software Development python | |
The most efficient static sieve generator in python I have seen so far. Returns the list of primes, that are not greater than n. Software Development python | |
Yes, I know Fibonacci(=sun of a good man) again. Most famous for his series, but who among you all, know that he was the man who introduced to the Western world, the Arabic numeral system(including zero) in 1202 A.D.? The Italian merchands of those days adored it. It was far … Software Development c# | |
The luxuries we now have in the amount of pixels on a screen to draw some amazing graphs with, were lacking in the early days of computing. Most of the time you had to resort to rude printed output. It wasn’t that bad always. Sometimes it was and still is … Software Development c# | |
I wanted to draw a 5 pointed star in C# and here is how I finally did it. I leave it as an exercise (some hints are given in the code) to work out how I did this. It was fun to do (but a bit hard, my trig is … Software Development | |
A simple way to find duplicate words in a text. In this case the text is preprocessed to eliminate punctuation marks and set all words to lower case. Software Development python | |
**NOTE** This code won't work at the application level. It directly addresses memory at 0xB8000 which will result in a segfault at the application level. This code must be part of an OS or an application in a not-so-secure operating system like DOS, where applications can directly address any part … Software Development assembly operating-system | |
Here is simple Digital Clock coded in C++ and compiler used is TurboC. A class DIGIT is designed to draw digits. Follwoing are the details for this class: Consructor: DIDGT(); for default settings DIGITE(int s,int c,int st); for user define settings s -> is size of the digit c -> … Software Development c++ | |
Lets say you have lots of data your listview. Now you want to Group This data According to a Perticular Subitems. For Example: Suppose i have some books data in my ListView. this listview items contains Author name and Books Title. And there are 2000 Books in list view. Now … | |
The snippet provided will cover the basics of an on screen keyboard; the only things it doesn't have are numbers, symbols, and extra keys. This will give you the fundementals to build off of. It's written using Microsoft's XNA Framework, however it should be fairly simple to port over to … Software Development | |
I have add the two functions the add and subtract I have to now add the multiply and divsion functions can someone help Software Development c++ | |
In Las Vegas random numbers move billions of Dollars in and out of gamblers' pockets. For the mildly inquisitive here is a test of three simple generators. Software Development c |
The End.