1,916 Reusable Code Snippet Topics
Remove Filter ![]() | |
Its a typical implementation of mergesort algorithm. It runs in a stable time of O(n*log(n) ). Just thought, I would add it to the library. Its been tested, although not very throughly, so if any bugs are found, just post it here, so others can be aware of them. Its … | |
A small game of pong I put together in about half an hour :) Enjoy. Software Development c++ | |
Python programming can have its lighter moments. Here we use one of those moments to draw an optical illusion using the Tkinter canvas to draw a rectangle, some lines and circles. | |
ITunes Library Persistent ID Editor. Sample usage: [CODE]fxml = 'iTunes Music Library.xml' # path to xml file fitl = 'iTunes Library.itl' # path to itl file itk = ITunesLibKeys(fxml, fitl) print itk.file_xml # prints path to xml file print itk.file_itl # prints path to itl file print itk.xml_key # prints … Software Development iphone python streaming-service | |
Do I have to spell it out for you? This short C code will do just that. It will spell out an integer number in English words. The banks do that on large checks, and it would be nice to get one of those every now and then. Software Development c | |
This code uses a structure to map a letter to an equivalent representation of Morse code. It simply loops through either a string to encode or decode looking for text to substitute with a replacement string or character. Output is presented to the stdout. Software Development c | |
Hey, I'm writing a program that takes files and renames them to include a timestamp of the current time on them in c++. I'm pretty new to c++ (and programming in general) and any help or advice would be greatly appreciated. So far I have this: When I compile it … Software Development c | |
The code is shamefully short, but here it is. Now you can listen to the many sound files in wave (.wav) format and boing, chirp, chime, bark, booh, laugh and mooh at the people around you. Software Development python | |
Here is my practise with [URL="http://www.boggled.org/"]boggle [/URL]letter square non-overlapping word finder after some drastic debugging and cleaning. I think it is reasonable speed also. Comments wellcome. | |
As suggested by Duki in [URL="http://www.daniweb.com/forums/thread298488.html"]this thread[/URL] I figured I'd compile all the workable examples and explanations here towards the question of "Why do we use get/ set to change properties?" [QUOTE=pritesh2010]Properties provide the opportunity to protect a field in a class by reading and writing to it through the … Software Development data-protection data-structure | |
Aslam o Alikum to all, here is my code to get and change the attributes of a txt file. I want to change the hidden attribute of file. In this code, when i get attribute of file, the number 20 (100000) is returned in cx. I changed this number to … Software Development assembly | |
This bot has some common functions, along with some not so common. I've been using this code to text my wife from work when my phone dies. Requirements: [LIST] [*]Gmail account (for texting) [*]xgoogle (for lang translation) [/LIST] I know it is messy, and the variables are named poorly; sorry. … Software Development python | |
Hello Everyone, my first post - so please don't shoot me if it goes wrong! I'd been looking for this for some time now and have seen a number of related queries but no solutions. I cannot take credit for the whole code here, but I did adapt it to … Software Development c++ | |
A simple function that converts alphabetic values into their respective lowercase value. Software Development pascal | |
This is a simple demonstration of meta programming. It shows the idea of meta programming. It basically calculates the factorial of a number before runtime. When I first saw the concept of meta programming, it blew my mind so badly. I was so surprised that one could do this. Its … Software Development c++ | |
Hi, Ever had an application that you want to store [B][U]user specific[/U][/B] settings on? e.g. login name or Form background colours, User specifc DSN connections etc. So the next time they run the app the information is there for them? This can be achieved in VB.net with just a few … | |
This is not my code! Taken from [URL="http://stackoverflow.com/questions/3230978/code-golf-four-is-magic/3231355#3231355"]this SO post[/URL]. You can use this to get the number of letters in the English representation of an integer, from 0 to 99. So for example 5 (five) is [icode]len("five")[/icode] which is 4. Software Development python | |
Here is my try of changing integers to English written numbers. Here corrected version 3 check: [CODE]from __future__ import print_function import random,sys if sys.version_info[0]==3: raw_input=input to_19 = ["zero", "one","two","three","four","five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" ] tens = ["","","twenty", "thirty", "forty", "fifty", … Software Development python | |
A simple program to count the words, lines and sentences contained in a text file. The assumptions are made that words are separated by whitespaces, and sentences end with a period, question mark or exclamation mark. Software Development python | |
As I was student, the bracketed plurals were absolute 'NO, NO'. With this simple function you can cleanly avoid putting bracket plural(s) after your numbers. If the number deciding singular/plural should not be automatically included, you can make version with [icode]str(n)+' '+[/icode] eliminated. If you want to put automatically space … | |
I new to python . I created the one console application in python for that i used two data bases IBM_DBI and POSTGRESQL8.4. I converted the console application into windows exe for that i used py2exe. It is created, while running the exe it coudn't connect with DB2 data base … Software Development python | |
start Server first start Client by passing the ipaddress of the server eg; java Client 10.0.1.15 if an error pops up change the port in both Client and Server programs Software Development client-server java socket-programming | |
See the link ([URL="http://norvig.com/sudoku.html"]Solve Every Sudoku Puzzle[/URL] for fine description of logic of the code) I attach the top95.txt file of tough problems and the sudoku claimed toughest of all time by Finnish mathematician Arto Inkala ([URL="http://www.kristanix.com/sudokuepic/worlds-hardest-sudoku.php"]The Worlds Hardest Sudoku Puzzle[/URL]) Solving this was piece of cake for the code, … | |
The arguments are passed by value and by reference Software Development pascal | |
Simple package loader to load all packages contents from directory-based or from JAR-compressed class path entry. Software Development java | |
This is a very brief overview of how to achieve an ON-THE-FLY creation of an appointment in the clients outlook calendar. This will not force the user to add it to there calendar but gives them the option to add it automated. Using the older .vcs file extension for outlook … Software Development asp asp.net microsoft microsoft-office vb.net | |
Helps to filter objects by interfaces and annotations their contains/implements with respect to parental relations. Software Development java | |
The code from my answer to thread: [url]http://www.daniweb.com/forums/thread292949.html[/url] Any field names with any same separator separating the values. This is straight text file reading routine, see the original thread for csv module based code. sample.dat: [CODE]id; name; email; homeaddress 123; gishi; gishi@mymail.com; 456 happy st. 345; tony; tony.veijalainen@somewhere.com; Espoo Finland … Software Development python | |
First i'd like to say that this is for testing only. If you try to use this program for any illegal practices what so ever... you will be responsable for your actions and i will be responsable for nothing. you would need some kind of security code generator to illegally … Software Development python | |
Hi ladies and gentelmen Merge sort program has 3 function . 1-func that sorts first array ascending 2-func that sorts other array descending 3-func that merges these arrays together I wrote it by Borland 5.02 . Good Luck! Software Development c++ | |
The wxPython GUI toolkit makes a very nice plotting component/widget available. You can select line or marker plotting, or a combination of both. All you have to supply is a list of x,y point tuples. Other features include zooming and printing. | |
As I told before here is second implementation of one word anagrams, which prepares lookup table for all available words, if it is not generated and afterwards uses it for fast lookup. The implementation of lookup table generation is quite unoptimized, but it is only done once per vocabulary. If … Software Development python | |
Create Panel And ToolStrip in panel Panel Property [CODE] Dock = Dock At Left Or Right Or Buttom Or Top High = 40 Backgroundcolor = Black [/CODE] ToolStrip Property [CODE]Dock = None RenderMode = System GripStyle = Hidden Background = Transparent ImageScalingSize = 32,32[/CODE] U Can Extend any side by … Software Development vb.net | |
I am new to python and this is my first program. The program factorize a number given by a user. It also makes a list of all the primenumbers, that it finds and stores them in a file. Is there anybody who can see a way that I can make … Software Development python | |
The forum is buzzing with questions about tokenizing a C++ string. This is a short function that does it and returns a vector of the tokens. As an option, the delimiter string can represent either a multichar delimiter or a collection of single char delimiters: [code] // multichar delimiter == … | |
I made this program during forum discussion for accessing configuration relative to module directory, not main program's position (which can be accessed by sys.argv[0]'s directoryname). As the thread is closed I post my proves as code snippet. Software Development file-system microsoft-access python | |
This program maintains a employee's record using Doubly linked list.It was a weekly project submission by me for the course CI 031 .Invloves simple graphics and a login menu where i had used file handling to maintain a record of 3 user's name and their password .So before running the … Software Development c ide linked-list | |
Interesting right? If you read [URL="http://www.daniweb.com/forums/post1252636.html"]this[/URL] amazing tutorial by lionaneesh, you will understand why I posted this brain-boggling code. Software Development python | |
Hey all I have seen a lot of stuff about palindrome checkers so I thought I would write one that works for STL containers as well as arrays. it accepts a bidirectional iterator to the first element and an bidirectional iterator to 1 after the last element. Included is a … Software Development c++ mathematics | |
I've spent the last couple of days researching how to connect to a database server and modify the data in that server. I was able to find a lot of information on how to Read from a database, but I found very little material to assist with Writing to a … | |
![]() | Simple functions for binary-to-decimal and decimal-to-binary conversion :) Software Development python |
Let Python do the work for you and figure out the roman numerals for a given integer. I have to ask you to keep the integer values somewhat reasonably low (from 1 to 4999), since roman numerals from 5000 on use characters with an overline and most PCs don't have … Software Development python | |
hello frnd this a c program that removes c c++ style comments | |
its a wrapper class. it combines stl stack class with a custom user class. i made it so that i could rename push and pop if i wanted or size and top :) best of all it combines stack and classes :) something i made to see if i could … Software Development c++ | |
Hey All This code is for matching a string with a wildcard in it to another string. If you want to have a Astrix in the first string be counted as a character and not as a wildcard put a \ in front of it. I have tested it for … Software Development c++ | |
Here is solution number one for one word anagrams, I gave in discussion thread, response time in my humble Athlon PC under 70 ms. List of words is from original posting of the discussion thread. [url]http://www.daniweb.com/forums/post1206616.html#post1206616[/url] This version does not give we'd for input dew. Next time I give final … Software Development python | |
I used this pattern few times to answer a thread and thought to post it as snippet. Software Development hard-drive python | |
Do you know that there is clean way of doing what C-language ternary operator ? does in Python's recent versions. It is if with special twist. The syntax is: [CODE]'The value if true' if <condition> else 'Value when false'[/CODE] Values can be any type. You can put this structure to … | |
Hi guys, Here's my project finally. It's name is C.L.O.S.E - The Command Line Open Source Editor Please review and comment. Mention errors if any, Also, for this code to work. Please download open.cpp, find.cpp, new.cpp, append.cpp, compile them and place all of them including the main source in a … Software Development c c# c++ open-source | |
Many times [inlinecode]strtok[/inlinecode] is recommended for parsing a string; I don't care for [inlinecode]strtok[/inlinecode]. Why? [list][*]It modifies the incoming string, so it cannot be used with string literals or other constant strings. [*]The identity of the delimiting character is lost. [*]It uses a static buffer while parsing, so it's not … Software Development c |
The End.