|
What "Hello World" is to the console, the "Bouncing Ball" is to the Graphical User Interface. Nothing fancy, the ball is created via a call to the API function ellipse() and then bounced within the confines of the windows form. For the DEV C++ crowd: Let me know if you find these snippets somewhat helpful in your learning process in the comments section at the end. |
1
21,322
|
||
|
The printer seems to be a much ignored computer peripheral when it comes to programming. This little code snippet explores one way to send text to the default printer. It actually draws the text into an imaginary box on the paper. You can specify the upper left and lower right corners of this box. |
2
2,588
|
||
|
Hi everybody, I'm having a little problem with finding sum of nested list in Prolog. So far what I have is [ICODE] totalSum([],0). totalSum([H|T],S):- totalSum(T,Sum), S is Sum + H. totalSum([H|T],S):- totalSum(H,Sum1), totalSum(T,Sum2), S is Sum1+Sum2. [/ICODE] With first two predicates, I have no problems getting sum of not-nested list. Anybody with a tip as to how I can modify the third predicate so that it can handle nested list? I've tried passing off [H] instead of just H and many other but it hasn't worked so far. Any comment would be deeply appreciated. |
0
542
|
||
|
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 |
0
43,836
|
||
|
So, basically what I'm trying to do is a Tic Tac Toe game for a project. I started with making 3 1-D Char Arrays to represent the game's bord. the code below compares the Arrays data to try and figure out if any of the winning possibilites were achieved by option x or y. There is a variable set to 0, this variable will change to 1 if player1 won and will change to 2 if player2 won, if it remains 0 then it's a draw. Now, there's 16 errors of Error C2446 '==': no conversion from 'const char [2]' … |
0
128
|
||
|
What's the best cloud accounting software for small businesses that handle multiple sales tax rates? Or is there an affordable web-based small business accounting software? |
1
98
|
||
|
Hi I'm trying to create a script in powershell that finds a string in a file and then modifies it but I'm having issues matching the string I want. So, I'm trying to make sure that I can find this type of string |d where d is is any digit, the string must not be in single or double quotes. SO I'd like to match |1 or |12 or |333 So far this is what I have: `\|[0-9]+` is returning strings with or without single quotes around it, so |1 and also '|5'; `'\|[0-9]'+` returns only strings with single quotes … |
0
162
|
||
|
I just started using python a couple of days ago, so I am a complete beginner. Basically what I am trying to do is the following. Imagine that I have a string variable such as: food = 'bread' I want to create another variable (integer or another type) so that its name is 'bread', in other words the new variable name should be the value of the string variable "food". How can I do such an assignment? My guess is that it should not take more than two or three lines. I read up and am thinking that I need … |
1
82,559
|
||
|
Hello all I have a form with two datagridviews. Grid A is polulated with orders from DB, grib B has an empty table with the same column name as grid A. Im currently draging orders from Grid A onto grid B. My isue is that since grid B has only one empty row, it only alows to drag one item. What I want to accomplish is to add an empty row in grid B In index 0 (the firsst row) In the dragdrop event I tried to add an empty row, but this code inserts an empty row before the … |
0
85
|
||
|
Hi When I run main.py I got this error how can I fix it? I'm using https://github.com/PicciMario/iPhone-Backup-Analyzer-2 / Traceback (most recent call last): File "./main.py", line 44, in <module> from PySide import QtCore, QtGui ImportError: No module named PySide I appreciate your help |
0
11,868
|
||
|
I have written the following Tkinter script: When I run it, the first thing that happens is the File Dialog box opens without it being called. I am expecting the file dialog box only to open when the "Open Document" button is pressed. import tkinter as tk from tkinter import * from tkinter import filedialog as fd class Application(tk.Frame): def __init__(self, master=None): super().__init__(master) self.master = master self.pack() self.do = PhotoImage(file="do.png") # Document Open self.ea = PhotoImage(file="ea.png") # Exit self.create_widgets() def create_widgets(self): self.opendoc = tk.Button(self, text="Open Document", image=self.do, command=self.openfd()).pack(side="left") self.quit = tk.Button(self, text="Quit", image=self.ea, command=self.master.destroy) self.quit.pack(side="left") def openfd(self): fd.askopenfilenames() if __name__ … |
0
132
|
||
|
I 'm building an application to store and retrieve books, but I have an issue with retrieving data from the db. I'm using REST and testing with postman. Everything works OK. Currently I have a series of methods written in Java at the backend like so @Override @POST @Path("/add") //@Produces("application/json") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Response addBook(Book book) { dbAccess.connectToDb(); return dbAccess.addBook(book); } @Override @DELETE @Path("/{id}/delete") @Produces("application/json") public Response deleteBook(@PathParam("id") int id) { dbAccess.connectToDb(); return dbAccess.deleteBook(id); } @Override @GET @Path("/{id}/get") @Produces("application/json") public Book getBook(@PathParam("id") int id) { dbAccess.connectToDb(); return dbAccess.getBook(id); } So in postman I have a request like http://localhost:8080/book-storage-REST/book/15/get to retrieve … |
0
321
|
||
|
[ATTACH=RIGHT]20145[/ATTACH][B]Building your first DYNAMIC Database application. This is Part One of a four part tutorial on how to install and use your database, Part Two will teach you how to build successful connections and Part Three will teach you how to build database interaction and management of your databases.[/B] There are tons of questions here on VB6 on how to connect to a database, how to add, delete, edit, search data within your database tables etc. This tutorial has been created to serve as a learning curve or to add more knowledge to your current code writing skills. This tutorial … |
1
1,169
|
||
|
I would like to know what is the difference betn getchar(),getch(), and getche() functions and which should be used in which conditions. Thanks, comwizz. :confused: |
1
4,308
|
||
|
|
Hey guys, I want to make a simple program which calculates speed, distance and time. This is the code I used: [CODE] a=input("1)Find speed\n2)Find distance\n3)Find time\n4)Quit\n") while a!=4: if a==1: d=input("\nEnter distance: ") t=input("Enter time: ") print ("Speed: "+str(d/t)+"\n") elif a==2: s=input("\nEnter speed: ") t=input("Enter time: ") print ("Distance :"+str(s*t)+"\n") elif a==3: s=input("\nEnter Speed: ") d=input("Enter distance: ") print ("Time :"+str(d/s)+"\n") a=input("1)Find speed\n2)Find distance\n3)Find time\n4)Quit\n")[/CODE] But, my question is, can't it be done like this: [CODE] s=input("Speed: ") d=input("Distance: ") t=input("Time: ") #Considering 1- is the symbol for 'find' s=d/t if(s==1-): print (s) elif(d==1-): print (d) elif(t==1-): print (t)[/CODE] Won't … |
1
6,747
|
|
|
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 … |
0
5,969
|
||
|
I am having a problem in Delphi with the use of multiple monitors. My application consists of a main form, with several different kinds of child forms. If I started running my application (not from Delphi – the executable), and I then enable a second monitor, and then move from one type of child form to another, my application would immediately crash. The same thing happens if I have started my application with two monitors enabled, and then disable the secondary monitor. I don’t get this behavior if I enable or disable the secondary monitor before starting my application – … |
1
644
|
||
|
Hi everyone, Today i have a question about how can i write one code for all shapes like, ****** ***** **** *** ** * or other shapes like square or tringle. I want to know the difference in every code. Thanks alot. |
0
6,368
|
||
|
I am new at python. How can i translate this pseudocode to python? Thanks...  |
0
219
|
||
|
Hello, I'm trying to write data to an INI file, I've got some code to read it: [http://pastebin.com/Jpwf8XJM](http://pastebin.com/Jpwf8XJM). I've tried to modify this code to get it to be able to write to INI files, but I haven't had much success. I know there are DLL's designed for this, but I would like to have my application so it can be distributed as a single EXE. Also, I know there is My.Settings, but I cannot use this, as this INI file is used by another application, that I have not developed. So, I was wondering if anyone could help me … |
0
1,593
|
||
|
Trying to get the last row inserted from a Excel sheet. The sheet is called clientes. I have id, name, description Since ID is auto incremental, I can sort by ID: My idea is: oledbcmd = "Select top (1) * From [CLIENTES$] ORDER BY id desc"; but it does not work. Any tips? |
0
958
|
||
|
Hello, I'm having trouble getting a part of this program to work... the update student part is supposed to update/edit student's scores. When i run the program i cant get the bttnUpdate to work in the frmMaintStudentScores.cs. can someone help me fix it? the other parts of the program are working. frmUpdateStudentScores.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication4 { public partial class frmUpdateStudentScores : Form { public static Dictionary<string, List<int>> tmpStudents; BindingSource bs = new BindingSource(); public static int selected; public frmUpdateStudentScores() { InitializeComponent(); } private … |
1
1,082
|
||
|
Hi been working on this final piece of the puzzle and it seems like the last step is the hardest. So far been able to stop it from adding multiple items per button click (number of rows + 1) Update QTY count for first item only. Trying to have it so all rows are checked and QTY updated, rather than adding new row per click for same item. void UpdateProductList(object sender, EventArgs e) { Button button = (Button)sender; if (DGV_cart.RowCount == 1) { string[] newRow = new string[] { button.Text.ToString(), button.Tag.ToString(), "1" }; DGV_cart.Rows.Add(newRow); UpdateTotal(); return; } else { Boolean … |
0
81
|
||
|
I created a crystal report in vb.net 2003 that generates invoices. I need to be able to print this report to a Canon copy machine(with four paper drawers), but I can't select the paper drawer to print from at runtime, it has to print to the fourth drawer. I am using a ReportDocument object with the report source being Invoice.rpt within .NET. Here is my current code for printing: Public Sub PrintForm(ByVal s As String) rdInvoice.RecordSelectionFormula = "trim({SOP10100.BACHNUMB}) = '" & s & "' and {SOP10100.SOPTYPE} in [4, 3]" rdInvoice.Refresh() rdInvoice.PrintOptions.PrinterName = "\\RAPCONT1\Canon iR3300 PS3" rdInvoice.PrintOptions.PaperSource = PaperSource.Lower rdInvoice.PrintToPrinter(1, False, … |
0
1,221
|
||
|
Hi dear forum members, I am brand new in C programming and have to program an "X" as homework (see attached picture). The edge length of the "X's" should be entered by the user, ie the "X" should be arbitrarily large or small. Can someone help me with the task? So far I have the following code: include <stdio.h> int main () { int edge length, i; printf ("Please enter the edge length of the pattern: \ n"); scanf ("% d", & edge length); char sign; character = ''; for (i = 0; i <edge length; i ++) { printf … |
0
118
|
||
|
Write a C++ program that inputs a wavelength and then displays the associated light color. If the wavelength is shorter than 400 nm or longer than 700 nm, display the message “Wavelength outside visual range”. Classify boundary wavelengths as the lower-wavelength color. For example, label a wavelength of 424 nm as violet. |
0
334
|
||
|
I need help in filling array in Pascal with random number. I have 9 empty array ( A: array[1..10] of integer ), and i want to fill the array with integer for 1 to 9 randomly, but one number can only be choosen one time. So when a number (eg. 5) was choosen for A[1], then the number should not be choosen again for A[2]..A[9]. Any one can help please! Thnk you. |
0
3,600
|
||
|
I want to add a try catch block in the CalculateAverageRate method where I want the user to enter grades 1,2,3,4,5 and for other numbers to throw an exception... I would also like to make a constructor with three parameters (string name, string surname, string date_birth) in which string attributes are set to the values sent through the parameters and numeric attributes to 0. I made a constructor without parameters (at least I think I did if anyone can to tell me if it's true) but now I want to make this constructor as well #include <iostream> #include <stdio.h> using … |
0
28
|
||
|
i was on the site pyschools working through the exercises, but i dont understand why it wont accept the code i input. [url]http://www.pyschools.com/quiz/view_question/s4-q2[/url] Create a function generateNumbers(start, end, step) that takes in three numbers as arguments and returns a list of numbers ranging from start to the end number (inclusive)and skipping numbers based on the step specified in the arguments. Note: The function range(x, y, z) can takes in 3 arguments. For example, range(1, 11, 2) will return a list of numbers [1,3,5,7,9]. Examples [CODE] >>> generateNumber(2, 10, 2) [2, 4, 6, 8, 10] >>> generateNumber(10, 10, 1) [10] >>> … |
1
961
|
||
|
Hello guys, It my frist topic in this forum so i hopeI hope you like it🙂🙂 In this topic we w'll learn how to check internet connection using a simple code. frist make a new project And add a label and timer . second Double click on timer to type code . bool con = Networkinterface.GetIsNetworkAvailable(); if (con == true( { lable1.text="your are connect"; } else { label1.text="you are not connected"; } You can watch the explanation from here[Click Here](https://youtu.be/hL5vrTB1uTQ) |
1
111
|
The End.