Code Snippet Index

from where to i start software projects

hi, i have just started programming.i have very good knowledge of c&c++.so,i have to do some software projects.but,atually which projects? please give me just simple topics for my project.thanks (Read More)

can any one tell me how to open image of .CAL extension or .TIFF extension in vb6

Type BITMAPFILEHEADER bfType As Integer bfsize As Long bfReserved1 As Integer bfReserved2 As Integer bfoffbits As Long End Type Type BMPInfoHeader (Read More)

hdd physial id

i run vb6.0 code in xp for getting hdd physical id and it run ok. but when i run same programme in vista it does not display any hdd physical id. please solve the problem (Read More)

Select Printer From List

Let you choose between all printers available on your pc or network. Download zip and enjoy. Royal free. (Read More)

Scanner :Scanning image of a Picture control to a Rich Text Box

Hello friends i made a small program like a scanner it will scan an image file to a Rich Text Box. My friend helped me in providing the code to access the pixels of an image.Hope you will like the code. Try it .... This need : Reference files : (Read More)
C++
1

fstream not working

Hi, I tried to direct the output from a thread into a log file using fstream, but it dosent seem to work. If I use ostream then it works fine. Can you please let me know why fstream is not working. Thanks in advance (Read More)

Conversion to any base, with a fixed number of digits

Here's a function that manually converts an integer to any base between 2 and 36, the parameter list is: void toBase( int value, // Integer value to convert char *target, // Pointer to a large enough buffer int base, // Base (from 2 to 36) int fixedDigitCount // The minimum... (Read More)

Text - Based RPG V2

I accidentally posted a lower version of the game that had more flaws, and a few less features. This one has a few more minor bugs fixed, and a power attack instead of a normal attack. (Read More)

Neat Text-Based RPG C++ Console

Pretty neat text-based RPG that I made. Currently my first game. (Read More)

Dynamic 2D array - user input

This program asks for integers from the user and stores them into a multidimensional array that adjusts its size. (Read More)

Stack Intersection C++

Stack Intersection by Fraz Jamshed (Read More)
1

Byte to KILOBYTE conversion in c++

HEy:) Buddies in early morning i want to calculate that exchange during download & you very well known that it is shown in byte so just i am g with c++ and play a game for writing this. thanks enjoy it. It's very easy and handy with simple logic. (Read More)
C
-1

help with c program

HI the prgram below request a user to enter 3 character id number and interger age. a function must be used that tells the user how many years to retirement. i must pass the age and print a message in the function. retirement age is 65 for persons over 45 and 70 for all other persons. the... (Read More)

need help with a simple C program

The programming assignment is to read a text file, extract the words from it, and save them in a 2D array that contains the word and the number of occurrences of that word. For example, if a text file contains the words "first" "second" "third" "second", the array should contain - first 1 second... (Read More)
-1

Linked list coding for CPU scheduling algorithms help with pointers

struct PCB* handleProcessArrival_PP(struct PCB *processhead,struct PCB *processtail,struct PCB *currProcess,struct PCB *newProcess,int currTime){ if(currProcess==NULL){ newProcess->executionStartTime = currTime; newProcess->executionEndTime =... (Read More)

Palindrome Check, Dynamic Memory

Just another way to check if a word is palindromic or not. In my country (Greece) if a word is palindromic we say it is "καρκινική" that's why i named the fuction in the code kark(). -What it does? If we would say that word has n letters,then this compares the first with the n letter, next... (Read More)

finding nth last element with 0(n) complexity

I am very poor in calculating complexities. Please some one let me know what is the complexity of the below program. I actually want to write a program for finding the nth last element with 0(n) complexity. but unable write, please give me some idea. the below code works perfectly and i... (Read More)

A question about signal

This code is just handling the SIGCHLD signal, but as you can see, the parent process should ignore this SIGCHLD signal according to the signal function. But in fact, the parent process will omit the signal function, and handling the child process using "wait". I wonder why the parent do not ignore... (Read More)

Rudimentary Partition Information Display

Displays which partitions are on which physical hard drives and shows partition starting offset and length. Developed and tested under XP using a Borland C++ compiler. Code is not provided for the private includes, but changes to make to code work are trival. References to werrtxt() and... (Read More)

Determine if a string is a directory name, file name or trash.

Code written and tested using the Borland C++ compiler. Code uses access() to determine if an input string exists either as a directory name or as a file name. If access() fails, the string is neither a file or directory and the function terminates. If it does exist, the name is used as input to... (Read More)
1

illustration of %i specifier

/* difference between %i ad %d %i reads the value and it recognizes the value as what base it is when we read the value as 023 (base 8) it is 19 (base 10) and 0xa(base 16) it is 10 in (base 10). */ OUTPUT: (Read More)

Need help writing a perl script to parse multiple files

I'm new to perl and I'm writing a script to parse multiple Gaussian03 output files and extract certain pieces of data from them. Ideally the script needs to print out the name of each file, look for (the last) SCF Energy, the Zero-point Energy and check if the job has converged (i.e. in the... (Read More)

Need Additional Code

The program will give the following output 55 45 36 28 21 15 10 6 (Read More)

Problem in working with images in swing

I am using this code for displaying images on JPanel, in which i succeeded, but the images are volatile. When i maximize or minimize the frame, it vanishes. (Read More)

Day of the week GUI

This is my first GUI program in Java. If finds the day of the week for any given date which is after 1 January 1900. (Read More)

naval battle game

Hello... This is my naval battle game so far.. Just search i t if you're unfamiliar with the game it is only player vs computer.. can you adjust/fix my code so that: -the player is able to place his ships by means of dragging the JLabel ships at the left to the playing area... (Read More)
1

Generating a basic Fractal.

This is a very basic implementation of a Julia Set Fractal Generator. All of the variables are coded in, so feel free to change them to experiment with different results. I give an explanation of Complex Numbers and the Complex Plane, but you should look it up for your self, as I only go a little... (Read More)

ToolTip box

from Tkinter import * root = Tk() tipwindow = None # Creates a tooptip box for a widget. def createToolTip( widget, text ): def enter( event ): global tipwindow x = y = 0 (Read More)

Building argv from command line

Some time ago, I was writing a small command line interpreter, with the help of the standard module cmd which offers minimal support for such tasks, and I had the problem that this module doesn't have a function to parse a command line to produce a list argv which can be passed to optparse for... (Read More)

Clear the terminal window.

Printing a convenient ansi escape sequence clears the terminal (if you're running python from a terminal). Similar techniques could be used to print in colors. (Read More)
2

string formatting specifications

The syntax of the str.format() method described in the python 2.6 documentation looks both powerful and complex. The idea of this thread is to start a collection of nice formatting examples which will ease the task of mastering this function. Please post useful examples, and document them :) (Read More)

Binary-to-Decimal and vice-versa

Simple functions for binary-to-decimal and decimal-to-binary conversion :) (Read More)
1

Letter frequency function using lists

A simple function to return the number of occurances of a letter in a text. An easier way to implement this would be by using a dictionary :) P.S sorry if there already is a code snipped like that somewhere. (Read More)

Get the mouse position on the screen on Linux.

This snippet defines a function mousepos() which gets the mouse position on the screen. The package python-xlib is required. (Read More)

Snake III Game

this is my version of the popular snake game. The snake is controlled by the mouse so be careful when you start :) it grows infinitely long...you should download the apple.jpg file for the game, or graw one of your own just name it apple.jpg and place it in the same directory as the code itself :)... (Read More)
C#

Simple .NET Remoting Demonstration - Part II - Broadcasting

Demonstrates using .NET Remoting to broadcast to client subscribers. There are three parts: 1) Server.cs - for console app responsible for broadcasting messages (date/time stamp currently) 2) Client.cs - for console app that registers with server to subscribe to broadcasts 3) Agent.cs - class... (Read More)

check if a Yahoo! IM user is online

This simple static class contains a static method called sOnline that accepts a username as a string param. it make a call to an old yahoo api that will determine if a Y! user is online. This only returns true if the user is not using stealth, this will return false if a user is online but... (Read More)
4

Chasing lights, running ants.

Ever wanted to know how to implement running lights? well here is your chance to find out. Open a new Forms application enlarge the Form a bit and drop a Panel and a Timer on it. Add the class ChasingLights to the solution, see code. Implement a form Load, panel Paint and Timer Tick event. See... (Read More)

asp.net login some part coding

hey buddies:) here is login page for begining purpose in asp.net i hope you will enjoy it and it is expected there is some mistakes also so please feedback it. Thanks (Read More)


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC