132,726 Archived Topics

Remove Filter
Member Avatar for
Member Avatar for Gribouillis

This snippet defines a `dir()` function which extends python's builtin `dir()` function by adding options to filter the returned sequence of strings by the means of regular expressions. The main use case is live inspection of python objects and modules during an interactive session with the python interpreter. The idea …

Software Development python session
Member Avatar for TrustyTony
2
502
Member Avatar for vegaseat

I am exploring some of the PySide (PyQT public) widgets like the combo box, and how colors are applied ...

Software Development python
2
2K
Member Avatar for cortiknee

I need to figure out how to append an int to a string, so basically i need to convert the int to a string 1st, but I cant figure out how. :rolleyes: any help would be greatly appreciated. thank you, courtney

Software Development c
Member Avatar for dverex
2
15K
Member Avatar for M.S.

How the following code can be rewritten in a better way? #!/usr/bin/env python """Simple program for finding popular names over last 100 years, in response to vegaseat's last post in Projects for Beginners(9/1/2012). It first lists the popular names and then search for entered name by user""" oldnames = """Mary,Helen,Margaret,Anna,Ruth …

Software Development python ruby
Member Avatar for vegaseat
2
273
Member Avatar for ncis_sg1

I am trying to write a code that is giving me a great deal of problems. **The program challenge is as follows:** Write a program that asks the user for the name of a file. The program shold display the contents of the file on the screen. If the file's …

Software Development c++ display file-system ios
Member Avatar for ncis_sg1
2
2K
Member Avatar for vegaseat

Just a simple text editor using the Tkinter expansion TIX. You are encouraged to improve this program with added functions. TIX is included with the latest Python distributions.

Software Development python tkinter
Member Avatar for Lardmeister
2
2K
Member Avatar for thekilon

If you are a non coder that wants the easiest book to start with, something very simple, easy to read and short , that can take you step by step in learning the basics of python in a few hours then you may like the book I have created for …

Software Development open-source python
Member Avatar for thekilon
2
401
Member Avatar for hughesadam_87

This code was inspired after several discussions on the forum, and I'm especially indebted to PyTony for all of his help with these aspects. The motivation behind this code is quite simple. I wanted a robust, light and general way of storing CSV data that could be used over and …

Software Development python sqlite storage user-interface
Member Avatar for TrustyTony
2
537
Member Avatar for Nathan Campos

Hello, I'm starting on Assembly and i want to know how i can clear the screen in Assembly, because of my OS. When i run it in Bochs, that boot messages are there and i want to clear they, for a better visual of my OS. Thanks, Nathan Paulino Campos

Software Development assembly
Member Avatar for jrandom
2
6K
Member Avatar for vegaseat

You have to mildly trick Windows, but it is possible to put a bitmap image on your console. Uses a flock of WinApi calls. Works well with the free PellesC compiler and Dev-C++. This is a Windows Console Application. Drop me a comment, if you have luck with another compiler.

Software Development c image
Member Avatar for I_m_rude
2
10K
Member Avatar for chriswelborn

I started using Python a few weeks ago, something finally clicked and I started writing tools for my personal use. I started writing something with a GUI using GTK and the code lines started multiplying rapidly, so I thought to myself "Am I commenting my source to death? How many …

Software Development gui python
Member Avatar for chriswelborn
2
368
Member Avatar for HTMLperson5

Hi, all. I am trying to clear the console window without using the "os" library. This seems like the only way to do it: from os import system import time print "I will clear the screen in 2 seconds" time.sleep(2) system("cls") print "*Cleared Screen*" SystemExit() But the problem is, this …

Software Development operating-system python
Member Avatar for 3e0jUn
2
4K
Member Avatar for Dave Sinkula

While not terribly difficult, first timers may not know the functions to look up and use. Here is some basic code for reading a file one line at a time. The contents of the file are printed to the stdout.

Software Development c
Member Avatar for 'CoffeeLike
2
61K
Member Avatar for vegaseat

This code snippet allows you to list the files in a folder sorted by "last modified date". The tuple returned by the os.stat() function contains amongst other things the last modified date, which is then converted by the time.localtime() function to a tuple that is ideal for sorting. You can …

Software Development file-system python
Member Avatar for leong87
2
8K
Member Avatar for srinivasdama

please answer the code for string to double and string to long in c bye

Software Development c
Member Avatar for nullptr
2
365
Member Avatar for Rutu3

Actually im creatg a website as a project so how to create database ,and connect asp page to C# code, hw to change template plzz help

Software Development asp c#
Member Avatar for Zorrro
2
359
Member Avatar for ddanbe

Start a new console application and fill in the about 70 lines of code in the Program.cs file. Run and enjoy!

Software Development
Member Avatar for ddanbe
2
408
Member Avatar for riahc3

Hey I wanted to make a thread for not only myself but for others to give a "thank you" to anyone who has helped them. In my case, without some suggestions here, I would have been stuck for days on a single thing and not be able to advance further. …

Software Development java
Member Avatar for stultuske
2
85
Member Avatar for Comatose

One of the most important things to understand when automating office, is that it's heavily [search]OOP[/search], and therefore you are forced to work with objects. In order to create an object that is external to your application (for example an office application, whereas a button or textbox would be internal …

Member Avatar for DJ-DOO
2
1K
Member Avatar for CppBuilder2006

this program contains a template function that can calculate determinant of any n by n matrix using permutations. it can be run in Visual C++ 2010 Express.

Software Development c++
Member Avatar for aruldave
2
461
Member Avatar for lxXTaCoXxl

I used a label inside my snippet just to test it; but this will simply increment and decrement a float value by 0.2f between the values specified in the conditionals. I have it updating between 8f and 15f. Must be run on a timer (make sure the interval is low …

Software Development
Member Avatar for lxXTaCoXxl
2
176
Member Avatar for vegaseat

Take a look at a typical Windows GUI frame (form) with a menubar, statusbar, panel, label and buttons. Set the font and size of text, click the buttons to create some events. All of this and much more is in the free wxPython package.

Software Development gui python
Member Avatar for pyphil
2
284
Member Avatar for PdotWang

I want to create 100 buttons in a Form. This is what I just tested. When you finish the following steps, you will see it is very nice. Enjoy. Step 1, Create a Form called Form1. Step 2, Add a TableLayoutPanel called TableLayoutPanel1. Step 3, Make it 10 X 10 …

Software Development vb.net
Member Avatar for jaimin4829
2
975
Member Avatar for khizer03

in a form i have a listbox which has many items and one button,when we execute the project and while execution when i click a items from the listbox it will display the clicked item on the button but the problem i have is how to display the same clicked …

Software Development gui vb.net
Member Avatar for codeorder
2
270
Member Avatar for Gribouillis

This snippet defines a function walk() which generically performs a depth-first traversal of a tree, using preorder, inorder or postorder rules. Here, genericity means here that there are no hypotheses on what the tree nodes are or the implementation of the tree. Walk() only needs an arbitrary object used as …

Member Avatar for Gribouillis
2
1K
Member Avatar for Gribouillis

This snippet defines a simple decorator to post-process a function's return value through a sequence of filters. As a first application, the decorator can transform a generator function into a function returning a sequence type (list, tuple, dict).

Software Development first-post python
Member Avatar for Gribouillis
2
573
Member Avatar for ariffin246

Hi Everyone. I am totally new here and this is my first post.. I have tried many place, since i could get any solution. I have no choice then posting here. basically, i have one delete form, where i will load the firstname from a table in access(hardcode) to listbox. …

Member Avatar for jhade
2
124
Member Avatar for TrustyTony

This is similar to earlier posts in DaniWeb by vegaseat, but it demonstrates getkey with withdrawn tkinter, restart inside object by re-calling it's __init__ method.

Software Development python tkinter
Member Avatar for TrustyTony
2
2K
Member Avatar for Gribouillis

Any sequence of python strings can be disguised to look like a file opened for reading, which can then be passed on the fly to functions expecting such an input file. This code snippet defines the necessary adapter class. The obtained file-like objects store only one string of the sequence …

Software Development file-system python
Member Avatar for Gribouillis
2
1K
Member Avatar for Tom Gunn

CSV is more than just comma delimited fields. There are quoting and white space rules too. This is a short function as an example of a complete way to read CSV records line by line.

Software Development c++
Member Avatar for moonlight01
2
370
Member Avatar for mameemonster

i'm new to this c programming. all i wanna do is to make the user to enter the number of student, then input the name and address of the student. later i want it to print the name and the address. the program crashes after i input all the name …

Software Development c
Member Avatar for WaltP
2
440
Member Avatar for ddanbe

The VS designer is a wonderful tool to use and saves you lots of time. One drawback though. If you have a lot of the same controls and you want to change some properties of it at runtime, you got some coding to do. Say you want to change the …

Software Development
Member Avatar for Teme64
2
945
Member Avatar for peter_budo

Sometimes one line of tool tip is not enough. You may want to try and play around with JToolTip, but if you in hurry this "little hack" can be handy. With little of HTML plus CSS code you can work out various formats (font, colour, alignment, size etc.).

Software Development html-css java
Member Avatar for peter_budo
2
508
Member Avatar for TrustyTony

Picked up from old thread but currently applicable (the IBAN number became more widely required actually this year in Finland). The style was quite alien for modern Python coders, so I massaged the code to my own liking. I removed many temporary variables, as for my opinion they did not …

Software Development python
Member Avatar for TrustyTony
2
416
Member Avatar for TrustyTony

Here is example how data can be summed to dictionary or you can use numpy.histogram to sum the data as weights of the categorized data.

Software Development python
Member Avatar for Stackheuw
2
2K
Member Avatar for ddanbe

What polar coordinates are is explained [url=http://en.wikipedia.org/wiki/Polar_coordinate_system]here[/url]. I wanted to draw some polar functions myself, so I changed my [url=http://www.daniweb.com/software-development/csharp/code/217204]plotting class [/url] a bit and added a polar struct to a new project.. Just posted code for the Plot class and the polar point structure here. You can find an …

Software Development c# mathematics
2
1K
Member Avatar for alwaysLearning0

Hi, I was thinking of writing this post as a reply of [URL="http://www.daniweb.com/software-development/cpp/threads/375854"]Need small example for compile time polymorphism and runtime polymorphism in c++.[/URL] But later decided to open this new thread as some expert may want to give some expert opinion on this. On the above mentioned thread, mike_2000_17 …

Software Development c++
2
203
Member Avatar for Gribouillis

A functor, or function object is sometimes a convenient way to encapsulate helper functions and data needed to achieve a small task, and also to share data between calls to the same function. This snippet defines a base class [b]functor[/b] which permits an easy functor creation for python 2.

Software Development python
Member Avatar for TrustyTony
2
724
Member Avatar for Momerath

As a companion article to my [URL="http://www.daniweb.com/code/snippet349081.html"]Permutation Generation[/URL], I now present Combination generation. This snippet will do a lazy generation of the combinations of a set of objects. Each combination has a grouping size (number of items in each combination). If you need a different grouping size, you'll have to …

Software Development
Member Avatar for codeholic
2
1K
Member Avatar for chubakueno

I've been attempting to do a basic XOR encoder but I got this problem: Everytime the result of the XOR operation is 10, the app writes 0xA 0xD, and I can't avoid this. Code: [CODE] #include <iostream> #include <fstream> #include <stdio.h> using namespace std; char* readfile(char * filename,int* size){ int …

Software Development c++ ios
Member Avatar for chubakueno
2
177
Member Avatar for 44shooter

Hello everyone. I have been struggling with my programming class from day one. I still can't seem to grasp the complete logic on how to write code. Anyhow, I have an assignment due that I am stuck on. Here is the assignment: In this exercise, you code an application that …

Software Development vb.net
Member Avatar for TheClan
2
2K
Member Avatar for peter_budo

For these whom may be interested in new stuff about Java 7 here is web broadcast from few days back [URL="http://www.oracle.com/us/corporate/events/java7/index.html"]Java 7 Celebration Webcats[/URL] PS: Didn't watch it yet so have no idea if any good :D

Software Development java oracle
Member Avatar for jwenting
2
164
Member Avatar for ddanbe

Short piece of code to add a "menu" to your Console application.

Software Development
2
5K
Member Avatar for dx135

You can use a decorator to modify the function object once, by assigning initial values to some new attributes. Then use these attributes as you would use static variables in other languages. Here is the result: (1, 1, [1]) (3, 2, [1, 2]) (6, 6, [1, 2, 3]) (10, 24, …

Software Development python
2
511
Member Avatar for vegaseat

Hello, I am vegaseat, the goofy moderator from the Python forum of DaniWeb. I wanted to know if anyone in the Java forum has played around with Java based Python, also known as Jython. Jython uses easy to learn Python syntax and can use the Java libraries. To make a …

Software Development java java-swing python
Member Avatar for bumsfeld
2
494
Member Avatar for blackrusader

Basically, it is an open source software creation application that revolves around databases (similar to Microsoft Visual studio in some aspects but with python as the language). The user will be able to create forms with a drag and drop GUI builder, create an SQLite database and add functionality to …

Software Development microsoft-office python sql
Member Avatar for blackrusader
2
324
Member Avatar for sngapoonage

Hi everyone, I use the ADO.Net SqlConnection, SqlCommand and SqlDataReader for all of my database interaction within my DAL. When I do a SELECT statement I cycle through my reader in a while loop and store each row in custom objects I have created. It seems to me like nobody …

Software Development
Member Avatar for pitic
2
136
Member Avatar for Xcelled194

One of the things that always irked me about C# is its lack of an InputBox function. In VB, You can simply do [CODE=VBNET]response = InputBox("Enter your name")[/CODE] Unfortunately, there is no C# equivalent. Sure, you can call the VB one, but doesn't that kind of defeat the purpose of …

Software Development c#
2
1K
Member Avatar for ddanbe

I mostly use Console or Forms applications in VS for my projects. Did anyone among you ever use an Empty Project when starting a new one? Well, it is as clean as you can get with Visual Studio! The world is at your feet! I use it mainly to test …

Software Development visual-studio
Member Avatar for ddanbe
2
969
Member Avatar for abelLazm

This is the simple code to read an image from the database.

Software Development image
Member Avatar for bahed121
2
251

The End.