**Task** Your task is to write a program that will draw graphs and output them as coloured image in the .ppm file format and display them using a suitable external image viewer (IrfanView). The program will use code generated sine waves, and harmonics of these, to calculate and display the harmonic components of a square wave. All sine wave harmonic should be displayed, each in a different colour – and the square wave that results from summing all the sine waves should also be displayed. The resultant waveforms should be output as a single file in the .ppm format. Initially, …

Member Avatar
Member Avatar
+0 forum 26

hello, i'm newbie here and also in programming world. so I would to request help from pros here. my question is, how to print out number entered in random in ascending order WITHOUT USING ARRAY AND FUNCTION? let say the user key in 4, 56, 31, 90, 11 and the output would be 4, 11, 31, 56, 90. hope anyone would help me. thank you.

Member Avatar
Member Avatar
+0 forum 27

hi there i have some python coding which i need to convert to java can ne1 help me please email me back if you can help then i will show you the coding much appriciated

Member Avatar
Member Avatar
+0 forum 9

Well I guess it is my turn to ask a question, since most of the time I spend answering questions on DaniWeb. The Problem: DataViewGrid throws a "System.ArgumentException parameter is not valid..." when the dataset contains an SQL 2005 TimeStamp type column. The error occurs in System.Drawing.FromStream... da da da It is because a TimeStamp is a Byte[8] unique value that my grid thinks is an image. I am creating a type of Query Analyzer form. A simple select * from mytable is given to an adapter... [code] QueryDataSet.Tables.Clear(); SqlDataAdapter adapter = new SqlDataAdapter(Query, conn); adapter.Fill(QueryDataSet,"Table"); DataResultsGrid.DataSource = QueryDataSet.Tables[0]; QueryBindingSource …

Member Avatar
Member Avatar
+0 forum 4

Hello, I am new to Python. I am learning boxsizer. I want to put two buttons on my panel. One at top right corner and one at bottom right corner. How do I achieve this? Thanks

Member Avatar
Member Avatar
+0 forum 4

I have scoured Stack over flow and the Pandas documentation for a solution to this issue. I am attempting to recursively move through a directory and concatenate all of the headers and their respective row values. Below is what I have so far after much experimentation with other libraries: import pandas as pd import csv import glob import os path = '.' files_in_dir = [f for f in os.listdir(path) if f.endswith('csv')] for filenames in files_in_dir: df = pd.read_csv(filenames) df.to_csv('out.csv', mode='a') However all of the headers and their corresponding values are stacked upon each other. In addition, the files' headers and …

Member Avatar
Member Avatar
+0 forum 3

Here is the code for [B][COLOR="Red"]Insertion Sort, Bubble Sort and Selection Sort[/COLOR][/B] [B]Insertion Sort[/B] [CODE] #include <stdio.h> main() { int i,j,key; int a[5]={5,2,3,4,1}; for(i=1;i<5;i++) { key=a[i]; while(i>0 && a[i-1]>key) { j=a[i]; a[i]=a[i-1]; a[i-1]=j; --i; } } int k; for(k=0;k<5;k++) {printf("%d ", a[k]);} printf("\n"); } [/CODE] [B]Bubble Sort[/B] [CODE] #include <stdio.h> main() { int i,j,x; int a[5]={5,2,3,4,1}; for(i=0;i<5;i++) { for(j=i+1;j<5;j++) { if(a[i]>a[j]) { x=a[i]; a[i]=a[j]; a[j]=x; } } } int k; for(k=0;k<5;k++) {printf("%d ",a[k]);} printf("\n"); }[/CODE] [B]Selection Sort[/B] [CODE] #include <stdio.h> main() { int i,j,x,min,k; int a[5]={5,3,2,4,1}; for(i=0;i<5;i++) { min=i; for(j=i+1;j<5;j++) { if(a[min]>a[j]) { min=j; } x=a[min]; a[min]=a[j]; a[j]=x; } } …

Member Avatar
Member Avatar
+0 forum 19

I have to convert a piece of C++ code to Python. Except I can't understand what it's doing. This is the code: [CODE]#include <iostream> using namespace std; int calculate(int values[], int size) { int answer = 0; for (int 1 =0; i< size; i +=1) } answer += values[1]; } return answer; } int main() { int myArray[5] = {0, 2, 4, 8, 16}; count << "The answer is " << calculate(myArray, 5); }[/CODE] This is my attempt at converting it to Python: [CODE]def main(): myArray[5] = (0, 2, 4, 8, 16) print "The answer is ", calculate(myArray, 5) def …

Member Avatar
Member Avatar
+0 forum 16

first of all, I wanna say hi to u all as I'm new to daniweb. I'm a freshman in a college so I don't know much of c yet. So please be understanding in case that I will ask some n00b question later on :) So this is my problem...first one I was using this code to get input from player to move the pad right and left [code=c] while(i<10) {i++; clrscr(); mov='s'; //supposed to be null, need more knowledge about \0 y=10; gotoxy(x,y);puts(pad);/*supposed to remove the cursor if it's possible. Ended up using puts to make the cursor less …

Member Avatar
Member Avatar
+0 forum 7

Hi! We are a 4 member group for our thesis and we already have submitted 5 topic proposals yet nothing was accepted...and here are the topics: enrollment system, gadgets on track, employment resource system, subdivision technical entry pass Now, I need a help for new ideas that can be developed through visual studio and it can be a web-based or window-based projects. Hope you can help me Thanks in advance!

Member Avatar
Member Avatar
+0 forum 38

Hi, I am getting an error while making a vector. frame.h #include <wx/wx.h> class Frame : public wxPanel { public: Frame(wxPanel* parent, int xx, int yy); ~Frame(); private: int x; int y; } frame.cpp #include "frame.h" Frame::Frame(wxPanel* parent, int xx, int yy) :wxPanel(parent) { x = xx; y = yy; } Frame::~Frame() { } in another wxPanel , I am creating a vector- std::vector<Frame> vFrames; And using it in a function- FinalFrame::addFrame() { vFrames.push_back(Frame(this, 20, 40)); } And I am getting this error- `error: use of deleted function 'Frame::Frame(const Frame&)' ` Is this related to wx or I am coding …

Member Avatar
+0 forum 0

Hi, I hv vb.net applivcation. I have following CODE1 to save data & to prevent duplicate data entry into table. The following code I put in button save event. However I want to put this CODE2 in perticluar textbox e.g. here SpecimenNoTextBox. so that when the user enter duplicate SpecimenNo.it says "Specimen No. already exist". How can i do this? **CODE1** If SpecimenNoTextBox.Text = "" Then MsgBox("Enter") Else Dim cmd As New OleDbCommand Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\data\Histopathology New.accdb") con.Open() Dim cmdlogin As New OleDbCommand(("SELECT SpecimenNo FROM HPReport"), con) Dim dalogin As New OleDbDataAdapter Dim dslogin As New DataSet …

Member Avatar
Member Avatar
+0 forum 11

Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 'TextBox1.Text = Token() If Button1.Enabled = True Then Label1.Text = Label1.Text + " A1 " If Button1.BackColor = Color.Yellow Then Button1.BackColor = Color.Red Else Button1.BackColor = Color.Yellow End If Else Label2.Text = "" Label2.Text = True End If Button1.BackColor = Color.Yellow End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click If Button2.Enabled = True Then Label1.Text = Label1.Text + " b1 " If Button1.BackColor = Color.Yellow Then Button1.BackColor = Color.Red Else Button1.BackColor = Color.Yellow End If Else Label2.Text = "" Label2.Text = True End …

Member Avatar
Member Avatar
+0 forum 3

Hi! I want to learn programming. I'm 14 years old and very fond of computing. The only problem I face is *Which programming language should I learn?* or should I learn *Programming* i.e I learn the basics of programming so that I will be capable of learning any programming language. Also, when you recommend me one of the choice I stated above then please give me resources for learning e.g book names or some websites which will start me learning from scratch. Furthermore, I want to state that I want to create cool games, softwares or even Operating Systems from …

Member Avatar
Member Avatar
+2 forum 10

HI everyone, _SBLOCK *allocateMemBlock(size_t size) [ _SBLOCK *block = (_SBLOCK*)sbrk(0); void *memadr = (void*)sbrk(0); void *allocate_mem = (void*)sbrk(BLOCK_SIZE + size); if(allocate_mem == (void*)-1) [ return NULL; ] else [ block->next = NULL; block->isfree = false; block->size = size; block->memoryAddress = memadr+BLOCK_SIZE; return block; ]

Member Avatar
Member Avatar
+0 forum 8

how to select an item in the combobox and then put item quantity in the textbox. and how to price the combobox items. Really need help .. Next week is my system defense.. Thank you

Member Avatar
Member Avatar
+0 forum 1

Listed below is the original word jumble python program. According to the exercise i'm supposed to add hints see next thread on my modified program however it doesn't work correctly. [code=python] # Word Jumble # # The computer picks a random word then "jumbles" it # The player has to guess the original word # import random # create a sequence of words to choose from WORDS = ("python", "jumble", "easy", "difficult", "answer", "xylophone") # pick one word randomly from the sequence word = random.choice(WORDS) # create a variable to use later to see if the guess is correct correct …

Member Avatar
Member Avatar
+1 forum 5

I dont understand the appearent discrepency in the treatment of the variabe x, y, and z. Why y isn't treated as x and z? #include <stdio.h> #include <string.h> int main() { char result[100] = "Philippe Dupont 30"; char x[50]; char y[50]; int z; /*We use sscanf to give a value to the three variables x, y and z. the two first are strings and don't need &.*/ sscanf(result, "%s%s%d", x, y, &z); /*Printing the value of the variables works fine.*/ printf("%s\n", x); printf("%s\n", y); printf("%d\n", z); /*But when I want to print a string in which the variables are, the …

Member Avatar
Member Avatar
+0 forum 2

Hi! I have made a POS Sotware. I have used only one JFrame as Main/Home Screen of the software and used JDialogs for all other screens. In this post I have concern with the 2 screens; Home Screen(which is a Jframe) and Sales Screen(which is a JDialog). As Home Screen appears I instantiate an instance of the Sales Screen in the constructor of Home Screen as : Sale sale = new Sale(); And on Pressing a Button on Home Screen I called : sale.visible(true); In the WindowOpened Event of the "Sale" Screen I load the products data from database and …

Member Avatar
Member Avatar
+0 forum 14

Hello, I am learning Tkinter. As a part of the learning process I am building a Notepad clone in order to become familiar with Tkinter widgets. I am pretty close to completing it - I added about 90% functionality to the application - but I face two problems: 1) The text widget has a default fixed size (80x25 chars I believe). If I resize the root window at a greater size, the text widget stays at the initial size. This is an undesirable behavior - I expect/want the text to resize along with the root. Now, I came with something …

Member Avatar
Member Avatar
+0 forum 4

Hi guys, I'm a little stuck with something here. Basically I have a a method which, given a List of Students will have to filter out those who are younger than 60yrs old and should return a List of Students who are over 60yrs old but I want this to be a list of Optionals rather than just a List of Students. THe difficulty is that I can't find a way to return a list of optionals like List<Optional<Student>>. I can return an optional if I use things like findFirst() or findAny() `return studentList.stream().filter(x -> x.getAge() > 60).findAny();` or i …

Member Avatar
Member Avatar
+0 forum 4

Hi guys, I am having an issue finding duplicates in an arrayList. Here is some code studentRecords.add(new Student("Jo", "Pip", "JP000", LocalDate.of(1999,9,23), Sex.FEMALE)); studentRecords.add(new Student("Tara", "Bot", "TB345", LocalDate.of(1991,9,1), Sex.FEMALE)); studentRecords.add(new Student("Mara", "Lewart", "ML456", LocalDate.of(1988,5,23), Sex.FEMALE)); studentRecords.add(new Student("Anna", "Clarke", "AC010", LocalDate.of(1999,1,1), Sex.FEMALE)); studentRecords.add(new Student("Frank", "Boia", "FB300", LocalDate.of(2001,8,13), Sex.MALE)); studentRecords.add(new Student("Anna", "Clarke", "AC010", LocalDate.of(1999,1,1), Sex.FEMALE)); studentRecords.add(new Student("Jo", "Pip", "JP000", LocalDate.of(1999,9,23), Sex.FEMALE)); This is the list of student records stored in an ArrayList. I have to make sure that I identify the duplicates and store the duplicates in another arrayList, duplicateRecords for the sake of argument. Now, the first thing I tried was to …

Member Avatar
Member Avatar
+1 forum 4

I am currently creating a product lookup system for a project of mine, however from reading around it has come to my attention that an OLEDB connection will not handle the SQL query below as it will not handle more than a simple "SELECT, FROM". Table: tbl_ProductInformation Field: Product_Name CurrentEntry = Variable storing the users entry [CODE] "SELECT Product_Name FROM tbl_ProductInformation WHERE Product_Name LIKE '*" & CurrentEntry & "*'" [/CODE] The outcome of this query is then put into a listbox. Is there anyway to make the OLEDB SQL query work so that the returned entries will correctly narrow down …

Member Avatar
Member Avatar
+0 forum 16

Anybody who knows how to change word or character in kanji to katakana or vice-versa. I'm using 2 textbox to do this, the first textbox is for katakana and the second textbox is for kanji. What i wanted to do is, whatever i typed in the kanji textbox it will be converted to its corresponding katakana value in the first textbox or vice-versa. Is this possible in vb.net or do i need to use third party software / dll / activeX to be able to do this, anyone please give me a good idea how to deal with this problem. …

Member Avatar
Member Avatar
+0 forum 14

[CODE]#include <iostream> using namespace std; int main() { int a,b,c, ope; cout<<"enter a value" << endl; cin >> a; cout<<"enter b value" <<endl; cin >> b; cout<<"enter operation (+ - * / and %)"; cin>> ope; if (ope == +) { c=a+b; cout<< c; break; } if (ope == -) { c=a-b; cout<< c; break; } else if (ope == *) { c=a*b; cout<< c; break; } else if (ope == /) { c= a/b; cout<< c; break; } else if (ope == %) { c=a%b; cout<< c; } else cout<<"entered wrong input"; return 0; } [/CODE] whats wrong with …

Member Avatar
Member Avatar
+0 forum 10

Is there a library that has a function that will take (theta,phi) and return (x,y,z)? Thanks, Dave

Member Avatar
Member Avatar
+0 forum 13

For this particular sub I type the customer id in a text box and then click the button, then I'm trying to get the relative information pertaining to that id. Not sure what I am doing wrong. Comes back with an error message of system.data.sqlclient.sqlexception Recursive common table expression '[customers]' does not contain a top-level UNION ALL operator. Private Sub FillByCustomerIDToolStripButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles FillByCustomerIDToolStripButton.Click Try Dim customerID As Integer = CInt(CustomerIDToolStripTxtBox.Text) ' LOAD THE CUSTOMERS TABLE WITH THE SELECTED CUSTOMER. Dim id = Me.CustomersTableAdapter.FillByCustomerID(Me.DatabaseDataSet.customers, customerID) If Me.DatabaseDataSet.customers.Count > 0 Then For Each row As …

Member Avatar
Member Avatar
+0 forum 2

Hi All, i would need some advice from you guys from this forum to solve the reading of the CSV file that i had. for example, i have a file which consist of about 2000 records (below are the example of the records) 10/10/2013 10:25:09 AM,5.89,45,264.83,PTTTT 10/10/2013 10:25:13 AM,5.89,2000,11780.00, Some of the records are with the "PTTTT" and some dont. So how do i read the records for the part until 4th column and elimiate the PTTTT column ? Thanks

Member Avatar
Member Avatar
+0 forum 5

Are there any differencies between these two code ? if (!a.equals("")) { editDate.setText(a) } and if (a!="") { editDate.setText(a) }

Member Avatar
Member Avatar
+1 forum 3

Because Microsoft will be removing vbScript in the next version of Windows, I have been busy converting my utility vbScripts into Python. Part of this is a library of functions that I keep in `D:\include`. I'd like to maintain this system in Python, but the import process is rather clumsy. I have to import sys sys.path.insert(0,r'D:\include') Only after that can I import a file. The documentation is somewhat obtuse but I gather my best option is to add the file `D:\include__init__.py`. As long as that folder is known to Python I could then do from include import myfile1 to include …

Member Avatar
Member Avatar
+0 forum 6

The End.