43,549 Solved Topics
Remove Filter ![]() | |
Hi, I am trying to write strings to a file line by line and trying to format the output so that the alignment is proper. output should be it should appear in the output file as david 10 15 16 sam 11 15 16 but appears as david 10 15 … | |
What is the difference between following declarations: [CODE=C#] WebUserService.Service.IUserService userService = new WebUserService.Service.UserService(); WebUserService.Service.UserService userService = new WebUserService.Service.UserService(); [/CODE] I want to know the difference in usage and the the one that is most efficient in terms of programming in C#. Software Development c# user-interface | |
What is wrong with my code? [code] String[] movieString = {"movie1", "movie2", "movie3", "movie4"}; JComboBox movieList = new JComboBox(movieString); movieList.addActionListener( new ActionListener(){ public void actionPerformed(ActionEvent e) { JComboBox a = (JComboBox) e.getSource(); //String movies = (String)a.getSelectedItem(); if (e.isSelected()); return subpanel; } }); }[/code] Software Development java | |
Hey guys, I justs started this code to make a diamond with stars (*), but I get confused how to print the spaces that I need, I don't know if you understant what I'm trying to say. It is something like this: Prompt the user to enter (odd) height (of … Software Development c++ | |
First of all, I'M reading the book "Microsoft XNA Game Studio 2.0". I understand the error I'M getting but I don't know what to do about it. The error says I can't use backgroundColor before it has been declared. I'M following along with the book so I don't see why … | |
I have a problem with alignment of the child form in a parent form. I would like to have this Form3 in the upper right corner of the Form1 - always - even when user changes the size of the form1. Form3 it has to be located there. The location … Software Development | |
Hello everyone, I need help with this code, which does not work properly. It prints fine at the first instant and when I convert it into a double it prints some unknown value. I am trying to get the maximum of all the values in the row. First: I cant … Software Development c++ | |
I've noticed there is at least 1 thread regarding to artificial intelligence. I assume most people new and old to python would be interested in artificial intelligence and the even greater goal of artificial life. I personally do not know anything about them. If you have ever had any experience … Software Development python | |
Hey. I'm importing an array in a text file via [icode]array=numpy.loadtxt("testdata.txt")[/icode]. Is there an easy way to count the number of rows and columns? Maybe something like [icode]x=numpy.countrow(array)[/icode]? I've had a look around and couldn't find anything suitable. Thanks, Alex Software Development python | |
I get this gcc warning with [I]-Wwrite-strings[/I] flag. I want to return a string of chars correctly but I also do not want to use [I]malloc[/I]. I've read other posts but can somebody explain how to acheive this in layman wording? [QUOTE]a.c:14: warning: passing argument 1 of ‘VAR1’ discards qualifiers … Software Development c | |
I am trying to get two numbers to overflow and print an error message stating this. it works for some numbers, but other numbers for example adding the numbers 1073741824 and 1073741825 results in a negative number -2147483647 which is clearly overflow. However, I cannot get these negative numbers to … Software Development java | |
This is graphics.py from the zelle book. The following code seemed to be working but when i added the parameters to the function def drawEye(win, centre, radius): i get an error when i try to execute it Traceback (most recent call last): File "C:\Documents and Settings\Compaq_Owner\Desktop\t.py", line 22, in <module> … Software Development python | |
I am having problems with my reverse polish calculator code. The code is as follows: [CODE]import operator OPERATORS = { '+': operator.add, '-': operator.sub, '*': operator.mul, '/': operator.div, } class Stack(object): "Creates a stack to enter numbers or operators into" def __init__(self): self.storage = [0,0,0,0] self.sptn = -1 def push(self, … | |
Assume I have a file of the following format: a,1 b,2 c,3 d,4 Here is my code: [CODE]def junk(f): d1 = {} d2 = {} for line in f: columns = line.split(",") letters = columns[0] numbers = columns[1] d1[letters] = numbers d2[numbers] = letters return (d1, d2) def something(): print … Software Development python | |
I am new to c programming. I am trying to write a parking garage program that uses arrays to find the charge for each car and the total charge. Here is what I have so far. Please help me in any way that you can. [code=c]#include <stdio.h> #include <math.h> float … Software Development c | |
I need to only allow integers and the letters "d" and "r" from raw input otherwise I need to run an exception. For example: [I]You entered 's' this is invalid[/I] I have tried to use try/except statements but can't work it out. Is this the best way? Can someone help? … Software Development python | |
Assume I have a file of the following format: a,1 b,2 c,3 d,4 Here is my code: [CODE] def junk(f): d1 = {} d2 = {} for line in f: columns = line.split(":") letters = columns[1] numbers = columns[2] d1[letters] = numbers d2[numbers] = letters return (d1, d2) def something(): … Software Development python | |
I have to get pthagaros to get the distance between 2 points. so the function distanceBetweenPoints(Point(1, 2), Point(4, 6)) should result in 5.0. the parameters are supposed to be P1, P2, which i think i have done?. The get an error when i try to execute this?.. help please def … Software Development python | |
Hello everyone, I'm currently having some problems with this code. I am getting many compiling errors and i was wondering if you guys could help get rid of them. [CODE]#pragma once #define CAPACITY 128; typedef int QueueElement; class Queue { public: Queue(); int empty(); void enqueue(const QueueElement & value); void … Software Development c++ queue visual-studio | |
Hi! I'm really new to C++ and posting to forums so please excuse any mistakes I may make. I have to write a program that simulates throwing 2 die and printing their sum 25 times, seven sums per line. I'm stuck on the "seven sums per line." Do I need … Software Development c++ | |
Hi, I have made a small program to check if character arrays are the same(similar to string compare).This is my code so far: [CODE] // string Compare () #include <iostream> using namespace std; main(){ char a[10] = {'a','b','c','d','e','f','g','h','i','j'}; char b[10] = {'a','b','c','d','e','f','g','h','i','j'}; for(int i = 0; i < 10; i++) … Software Development c++ | |
Hi, Let's say I have a form full of objects and want to make all of them (or half of them, whatever) invisible. Is there a short way to do that without a need of setting visible to false individually to each object? Software Development visual-basic | |
Hey, one simple question: how to call Image1_click event form module? Software Development visual-basic | |
I really need help from you guys... my Insert statement doesn't work in C# but the Update statement was just fine. Possible to guide me on the delete statement as well? Here is my code: [CODE] string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\\Inetpub\\wwwroot\\H1N1\\TTH H1N1\\TTH H1N1\\bin\\Debug\\H1N1.mdb"; OleDbConnection conn = new OleDbConnection(ConnectionString); OleDbCommand … Software Development open-source | |
i am trying to make sure that one record is not entered twice into the same database but the code i am using is giving me an error [CODE]Set ri = deSub.conn.Execute("SELECT* FROM individualsubs WHERE firstname = '" & txtfname.Text & "' AND surname = '" & txtsurname.Text & "'") … Software Development open-source visual-basic | |
Putting it out there that this is a school assignment. I have nearly all of the code figured out, but the instructions make getting the output and variables to match up. If anyone can assist in seeing what the instructor intends for us to do, I would greatly appreciate it. … Software Development java user-interface | |
Hey everyone, I am trying to write a code which would read a file and print the number of words and sentences in each of them. I want to take everything step by step; so I am making sure that all my methods work perfectly before proceeding. In the code … Software Development java | |
[CODE=C] #include<stdio.h> #include<conio.h> #include<string.h> //typedef int BOOL; //#define TRUE 1 //#define FALSE 0 int a[3][4]; int Prime(int *x); void input(); void printOut(); void checkPrime(); int Prime(int *x) { int i; for( i=2; i< (int)sqrt(*x); i++ ) { if( *x%i == 0 ) return 0; } return 1; } void input() … Software Development c | |
[CODE =C] #include "conio.h" #include "stdio.h" #include "math.h" int isPrime(int n) { int i,isTrue=1; for(i=2; i<(int)sqrt(n); i++) if(n%i==0) return 0; else return 1; } int main() { int N; printf("Enter n: "); scanf("%d",&N); if(isPrime(N)) printf("prime"); else printf("Not prime\n"); getch(); return 0; } [/CODE] here is my source code, but when … Software Development c | |
Hi, I have a program that I am using to convert a string into binary. My current code is as follows: [CODE]int main(void) { string userInput; cout << "Enter a string to be converted:" << endl; cin >> userInput; for (int index = 0; index <= userInput.length(); index++) { cout … | |
Hi everyone, I'm trying to write some code for this question. I believe I have the right answer but it says it isn't. Anyways here is the question. 1) Given that dict1 refers to a dictionary, change the value mapped to by the key 'Boo' to 'Hoo' . My code … Software Development python | |
Hi guys, The following program works the way I want it to but there's one small problem; when it loads, it doesn't give a blank frame. It want it to show the output after I click on the blank area. Help me please. [CODE] import java.awt.*; import javax.swing.*; import java.awt.event.MouseAdapter; … Software Development java java-swing | |
Dear All I would be very happy if you could help me! I need to create a main() program which is be able to; * reads in a list of words and their associated meanings from the given test file(file.txt)(This file contains 10 lines) * provide an interactive menu interface … Software Development c++ | |
How do I make something like [code] x = 5 while 0 < x b = raw_input("something: ") [/code] However each time it loops, I want it to change, like: first loop - b = raw_input("something: ") second loops - c = raw_input("something: ") third loop - d = raw_input("something: … Software Development python | |
Is this the proper way to zero the first 12 bits of an address? [CODE] void *ans = (void*)((unsigned long)addr & ((0UL - 1) ^ 0xfff)); [/CODE] Where addr is any user process memory address.. Note this method works...I just want to know if there is a better way Software Development c | |
I know Remembering secure passwords is difficult. So I made this. [code] import random, os a= ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9','{',':','>','?','}','|','!','@','#','$','%','^','&','*','(',')','-','+'] z = int(raw_input("How many words in your password?: ")) os.system("clear") List = [] for x in xrange(z): List.append(random.choice(a)) print "".join(List) print "1) Yes" print "2) No" b = int(raw_input("Would you like to save … | |
Hi all, For a combobox I was trying to imitate the behaviour of this code example:[url]http://msdn.microsoft.com/en-us/library/system.windows.forms.listcontrol.valuemember.aspx[/url] So I have this class: [CODE=c#]class Planet { private string myName; private double myGravitationalAcceleration; public Planet(string strName, double Acceleration) { this.myName = strName; this.myGravitationalAcceleration = Acceleration; } public string Name { get { return … Software Development display | |
Hi friends !! I'm neophite about python, my target is to create a programa that find a specific string in text file. How can do it? Thanks fel Software Development python | |
HI I'm trying to use a menu on a datagridview, I have put a Contextmenutrip on the form. When I right click in a cell I would like a menu to pop up. but nothing happens. This is the code I have tried. [CODE] Private Sub CustomerPopMenu_ItemClicked(ByVal sender As Object, … Software Development vb.net | |
1. I need to make a program that creates a list that contains the first n perfect squares. All I know is that it starts with n = int(raw_input("How many squares? ")) and ends with print squares An example of how this program should work is: How many squares? 5 … Software Development python | |
Newbie Here Edit: This is not homework, I am a chemical engineering student and a math minor. I'm doing programming on the side to help me automate certain calculations later in my career. Also always had a healthy interest in programming. I just read the not doing homework for people … Software Development career engineering python | |
------------------------------------ ----------- --------- ------------------------------------ ----------------------------- ------- PRODUCT KIT TYPE STATE MAINTENANCE REFERENCED BY ------------------------------------ ----------- --------- ------------------------------------ ----------------------------- ------- HP I64VMS ACUXE V6.40-11P09A Full LP Installed HP I64VMS AVAIL_MAN_BASE V8.3-1H1 Full LP Installed HP I64VMS OPENVMS V8.3-1H1 HP I64VMS CDSA V2.3-306 Full LP Installed HP I64VMS OPENVMS V8.3-1H1 HP I64VMS … Software Development python | |
Hi there, I'm assuming the answer to this problem is really easy, but I just can't work out where the problem is. It's driving me insane and I'd really appreciate some help. I'm new to C++. My problem is this: I'm trying to pass a char array to a function, … | |
I understood that a string in VB .Net maximum length was quite large (could be way over 1000 characters) but do not know for sure. I keep having a problem when I concatenate one string to another and the result is the second string. Example: Str1 = “this is the … Software Development vb.net | |
Hi guys, I need to display "Java Mug" (in red) inside the mug I created in the following code. I spent hours working on it but couldn't get anywhere. Can you guys help me please? [CODE] import java.awt.*; import javax.swing.*; import java.awt.geom.*; public class DrawJavaMugTest { public static void main(String[] … Software Development java java-swing | |
Hi, I am reading data from a file. The data is mostly text, but has a small bit of binary in it, as well as a linefeed at the end of every block of text. Can Python read all of it and write it to another file, while not changing … Software Development python | |
I am trying to find a code to clear all text boxes in a form. I am using VB8 Here is the code I found but I get an error telling me I need a comma between two arguments [COde]Private Sub btnclearall_Click Dim ctl As New Control For Each ctl … Software Development vb.net | |
I swear, those things are like shurikens in these masses... I'm trying to make a loan calculator in python, as part of an assignment. I'm basing it off of two things. 1: [URL="http://www.efunda.com/formulae/finance/loan_calculator.cfm"]This website, which contains 3 different calculators.[/URL] 2: [URL="http://www.efunda.com/math/num_rootfinding/num_rootfinding.cfm#Newton_Raphson"]The link from the second calculator (my current pain)[/URL] I'm … | |
Hi, I have an assignment where i have to write a C and assembly mixed-mode program. [LIST=1] [*]The c program takes in two characters which stand for two hex characters. [*]The assembly procedure then passes each character in turn to a C function which determines if the character is a … | |
I am new to message queues and IPC in general. I am trying to have a process establish the queue and send a message. Then I fork and the child will read the message. The goal is to measure the execution time for different sized messages. The msgsnd is returning … |
The End.