132,726 Archived Topics

Remove Filter
Member Avatar for
Member Avatar for vegaseat

This is a test to get the Python snippets going! For those of you who are scared of snakes, the language is named after the TV program, not the snake. Python is an interpreted language, but programs to compile/combine the code to an exe file are available (Py2Exe). The latest …

Software Development python
Member Avatar for vegaseat
2
3K
Member Avatar for sureshshan1292

Write a C program to Remove even numbers and fill it with zeros. Note: You can use only one loop for your logic. Two variables apart from the array. Input array 1,2,3,4,5,6 Output 1,3,5,0,0,0

Software Development c
Member Avatar for ekambaram
2
3K
Member Avatar for Louis_2

Hello all, I have started an new project which needs a Fibonacci sequence (all Fibonacci numbers below 4,000,000) Here is my code for calculating Fibonacci numbers: numbers_list = [] number1 = 1 number2 = 2 total = 0 while (total < 4000000): total = number1 + number2 number1 = number2 …

Software Development python
Member Avatar for Gribouillis
2
206
Member Avatar for AndreRet

**Modifications Required for VB6 Applications to Work on Vista/7** Thanks to Hassan Basri in VBForums **Application Changes** - Remove SendKeys calls and replace them with API code. - Use the HKEY_CURRENT_USER in the registry for the settings of your application. - Do not write to HKEY_LOCAL_MACHINE. - If you are …

Member Avatar for hefaz
2
5K
Member Avatar for vegaseat

I have joined the thousands who have done it before, and have compared a number of sorting routines. The sorting is done on the same random-integer arrays. No surprises, quicksort wins this simple comparison hands down. There are clever combinations of sorting routines that are faster, like the snippet by …

Software Development c
Member Avatar for vegaseat
2
253
Member Avatar for vegaseat

A few hundred years ago the glorious leader of a big country wanted to reward the creator of the chess game. The creator of the game simply wanted one grain of rice put on the first square of the chessboard, two grains on the second, then doubling it for every …

Software Development python
Member Avatar for vegaseat
2
8K
Member Avatar for BustACode

I needed a random color selector. I found one [here](http://peepspower.com/python-script-to-generate-random-css-colors). I rewrote it to make it more general purpose. "f_GenRandomColor" is the picker. The output is in list form, which should make it suitable for most general applications. "f_HTMLRandomColorChart" is just a way to create an HTML table to test …

Software Development html-css python
Member Avatar for snippsat
2
524
Member Avatar for vegaseat

Let's assume you would have to design a 500 ml (about 1.1 pint) food/beverage container like a can and use the least amount of material. Here is a Python program that explains the steps to achieve this.

Software Development python
Member Avatar for vegaseat
2
1K
Member Avatar for overwraith

So I was recently working on a string program where the strings were easily megabytes long, and I ran into problems with there being out of memory exceptions etc. So I said to myself, this would be a perfect problem which lazy execution solves. Here is a split function that …

Software Development
Member Avatar for sepp2k
2
240
Member Avatar for vegaseat

This shows you how to create a flashcard like quiz game using a Python dictionary. It's up to you to explore the approach and make this a more meaningful game.

Software Development python
Member Avatar for Chance_1
2
7K
Member Avatar for happygeek

Addressing last weeks Securi-Tay conference hosted by the Abertay Ethical Hacking Society in Scotland, Stephen Tomkinson from the NCC Group detailed how Blu-ray players can do more than play videos; they can open up a new attack surface for the hacker. Tomkinson demonstrated a new tool that had been released …

Software Development cybersecurity java
2
409
Member Avatar for vegaseat

A simple code example on how to play wave sound files with the Python module PyGame.

Software Development python
Member Avatar for juanpa_2510
2
2K
Member Avatar for vegaseat

Using http://download.geonames.org/export/zip/ you can get postal information for most countries in the world. The raw data string can be transformed into a Python list of lists that can be searched for zip codes, locations, longitude and latitude coordinates.

Software Development python
2
4K
Member Avatar for vegaseat

Just a small mildly optimized function to check if an integer is a prime number. For very large numbers use the Miller-Rabin primality test. There have been questions why I used `not n & 1` to check for even integer n. The more tradional` n % 2 == 0` is …

Software Development python
Member Avatar for vegaseat
2
3K
Member Avatar for vegaseat

If you draw a series of close spaced shapes your eyes get fooled to see Moire patterns. Here is one example of this.

Software Development python tkinter
2
2K
Member Avatar for ddanbe

To refresh my mind I did some exercises about complex numbers. I was constantly drawing axes and arrows. So I decided to print out some worksheets with a program to make my life a bit easier, and because it is always fun to design a little program to do that …

Software Development
2
256
Member Avatar for fonzali

hi guys , first of all merry Christmas and happy new year since there have been many discussions about favorite idle for python , al sweigart is trying to improve python's own idle and everyone is invited to help out and since this is the best python forum I thought …

Software Development python
Member Avatar for Gribouillis
2
233
Member Avatar for Dani

This is a program I wrote for my x86 assembly class which is basically the Spade Invaders game in all its glory. It uses Irvine32.inc which came with the textbook.

Software Development assembly
Member Avatar for Dani
2
2K
Member Avatar for vegaseat

An example how to use Tkinter's OptionMenu() as a combobox to allow one year to be selected from an option list of let's say the past 15 years.

Software Development python tkinter
2
1K
Member Avatar for vegaseat

Just the very basics on how to draw a rotated text using the Python GUI toolkit PySide (public PyQt). Please experiment and embellish.

Software Development gui python
Member Avatar for vegaseat
2
2K
Member Avatar for deceptikon

I work with images...a *lot*. Often this involves image processing of various types such as resizing, resampling, and various cleanup operations. However, a common issue is that people like to conflate Adobe PDF with images. As such, any application that works with images should also work with PDF. However, since …

Software Development image pdf
Member Avatar for deceptikon
2
1K
Member Avatar for Learner010

As usual, after learning new stuff, I write on it. Yesterday I finished learning on "Functions in C++" and found that functions are very easy to learn and useful. Hope this tutorial helps beginners. # What is function? # Sometimes when we want to execute a specific task wherever it's …

Software Development c++
Member Avatar for Learner010
2
879
Member Avatar for Lardmeister

String input has changed from Python2's raw_input(prompt) to Python3's input(prompt). The old Python2 numeric input(prompt) has gone away with Python3, all input is now string input. The snippet shows a few lines you can add to your program such that you only need to use input(prompt). This makes your code …

Software Development python
Member Avatar for vegaseat
2
222
Member Avatar for vegaseat

The idea of this thread is to help the beginning wxPython GUI programmer with hints and helpful code. Please feel free to contribute! If you have any questions start your own thread! For info on wxPython modules see: http://www.wxpython.org/docs/api/wx-module.html

Software Development api gui python
Member Avatar for HiHe
2
21K
Member Avatar for Mr.M

Hi Dw community I don't know whether it me or, but there is something a bit wrong that keep on happening so I think we should remember that we were all a students once and if we didn't work harder and put much effort in practicing code we wouldn't know …

Software Development gui vb.net
Member Avatar for deceptikon
2
278
Member Avatar for vegaseat

The Pyside GUI toolkit (public PyQt) lets you bring up an interactive web page with its QWebView widget. Here is a simple example.

Software Development gui python
2
700
Member Avatar for vegaseat

The portable version of Python (versions 2.7 and 3.2 are available) can be run from your hard drive or a flash drive. In many ways this makes your live easier, since a lot of libraries are included already. Also, you can take your code to a friend on a flash …

Software Development flash hard-drive python
Member Avatar for sneekula
2
3K
Member Avatar for Jollyyy100

I want to connect my access database to my project in vb 6. What are the steps i should follow? Once i'm done with that, i want to know how to drag them and place them on a form (like the way we do it in VB.NET). Thank you

Software Development microsoft-access vb.net visual-basic
Member Avatar for millyn
2
3K
Member Avatar for vegaseat

This program takes a text string and creates a list of words. Any attached punctuation marks are removed and the words are converted to lower case for sorting. Now you can generate a dictionary of the words and their frequencies. The result is displayed using a sorted list of dictionary …

Software Development python
Member Avatar for snippsat
2
1K
Member Avatar for L7Sqr

Often times it is useful to instrument a program you do not have the source to in an attempt to learn more about it. This can be for debugging purposes, blackbox testing, or for providing alternate versions of common functions/libraries (to name a few). On Linux, there is a very …

Software Development c
2
1K
Member Avatar for ddanbe

Hi, You can simulate this by starting a new WinForm app. Add a datagridview and add some columns. Add a contextmenustrip, add a menuitem, doubleclick it to get a clickhandler. Attach the menustrip to the datagridview in the properties window of the DGV. Then refer to this code and the …

Software Development gui vb.net
Member Avatar for ddanbe
2
3K
Member Avatar for Gribouillis

This small script named `sourcecode.py` is a command line tool to open a python module's source file with the default editor. For example the line $ python sourcecode.py xml.dom.minidom opens the file minidom.py from the python distribution with the default editor. The same works with user-defined modules having a python …

Software Development open-source python
2
637
Member Avatar for Gribouillis

This snippet shows how to find the complex roots of a polynomial using python (tested with python 2.6). You need the scipy or numpy module.

Software Development mathematics python
Member Avatar for Gribouillis
2
3K
Member Avatar for iamthwee

Here is a simple Polynomial class. Its purpose is to show how one can [B]simply [/B]create a Polynomial class without using abstract datastructures such as linked lists etc. Each term is printed out in order of its power - from highest to lowest. Inspiration was taken from a Java source …

Software Development c++ mathematics seo
Member Avatar for parisa_hr
2
15K
Member Avatar for vegaseat

This handy little utility determines the size of a folder and it's subfolders in MBytes.

Software Development file-system python
Member Avatar for kostas89
2
12K
Member Avatar for Gà_1

These programs are not perfect and very coarcenes but I think it understandable for who are new to learning Graph Theory. I will point directly each problem by using example code. Any questions or idea please post here. Thank you. Here are my programs, we will start with a basic …

Software Development file-system pascal
Member Avatar for SalmiSoft
2
410
Member Avatar for Begginnerdev

Hello everyone! I am posting this code for anyone who may be having issues with connecting to a database. Feel free to use this code as you wish. This will be using the OLEDB library. [CODE] 'Imports Imports System.Data.OleDb Public Class Form1 'Declarations Dim con As OleDbConnection Dim cmd As …

Software Development vb.net
Member Avatar for Reverend Jim
2
899
Member Avatar for vunkas

Here's a small piece of code in python that may be helpful to those who like to play with substitution ciphers..... Say we have a text that is ciphered with simple [substitution cipher](http://en.wikipedia.org/wiki/Substitution_cipher), and say we know that the original text contained a certain phrase...but all we have now is …

Software Development encryption python
Member Avatar for nosrac25
2
449
Member Avatar for kRod

I've been working on a Textbox that only accepts 0-9, Decimal Point, and the Backspace Keys. Also keeps it in the base form 0.00. Max value is 999999.99 can be set as needed. It works as expected, but I have to ask if I have remade the wheel. This sub …

Software Development vb.net
Member Avatar for kRod
2
1K
Member Avatar for mike_2000_17

# Introduction # The subject of this tutorial is a bit more advanced than the subjects I have tackled in the past, but I hope this will find some interested readers. From time to time in C++, programmers find themselves torn apart between using a *Generic Programming* style which primarily …

2
2K
Member Avatar for vegaseat

Shows you how to play sound files with the pySFML module and Python.

Software Development audio python
Member Avatar for vunkas
2
768
Member Avatar for Graphix

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
Member Avatar for JamesCherrill
2
4K
Member Avatar for sciwizeh

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 …

Software Development gui java
Member Avatar for sciwizeh
2
860
Member Avatar for vegaseat

Shows you how to create multiple Tkinter buttons in a loop, each with its own name, label and command response.

Software Development gui python tkinter
Member Avatar for CodingCabbage
2
1K
Member Avatar for vegaseat

Just a simple image file slide show using PySide (PyQT).

Software Development image python
Member Avatar for sneekula
2
4K
Member Avatar for vegaseat

Using Python module turtle to draw a Koch snow fractal.

Software Development python
Member Avatar for TheCodeCrimson
2
303
Member Avatar for ddanbe

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#
Member Avatar for Triryche
2
580
Member Avatar for ravi_forum

Sir, I wanted to know the implementation code for krushkal algorithm in C++. Anyone can help me to give the code. ThnQ

Software Development algorithm c c# c++
Member Avatar for naamurad
2
2K
Member Avatar for vegaseat

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
Member Avatar for paddy3118
2
4K
Member Avatar for bumsfeld

This program uses Python module re for splitting a text file into words and removing some common punctuation marks. The word:frequency dictionary is then formed using try/except. In honor of 4th of July the text analyzed is National Anthem of USA (found via Google).

Software Development python
Member Avatar for sujit.shakya.3
2
2K

The End.