I'm trying to get my JPanel (JFrame?) to resize itself to fit randomly drawn shapes. I have a shape superclass and right now I'm working with my line subclass. Everything is working fine except I can't figure out how to make the shapes fit the size of the JPanel. Should I limit the size of the shapes or could someone suggest a way to dynamically set the size of the Jpanel based on the maximum size of the shapes? (I'll eventually want to do this with several shape types in the same panel). I'm thinking a for loop grabbing the …

Member Avatar
Member Avatar
+0 forum 4

Hi I have python code that can list all drive letters but now I need also list the name of drive letter (Label) and the size of hard drive like below! Ltr Label Size ---- ------ --------- C Windows 800 GB E Local Disk 200 GB F My Passport 500 GB Y Secret 1 GB import string from ctypes import windll def get_drives(): drives = [] bitmask = windll.kernel32.GetLogicalDrives() for letter in string.ascii_uppercase: if bitmask & 1: drives.append(letter) bitmask >>= 1 return drives if __name__ == '__main__': print (get_drives()) # On my PC, this prints ['A', 'C', 'D', 'F', 'H'] …

Member Avatar
Member Avatar
+1 forum 1

Hey, I don't know if this is the right place, but my issue is taking an output from a software SPI and using it in another function for temperature. The code below is marked with my issue, however it's not the full code. The full code is for a lab assignment to display temperature and a clock on an LCD, and the clock is another problem on its own. Thanks in advance for any help. unsigned int SW_SPI(unsigned int Output) { bitClear(PORTC, CS_Bit); for (int i = 15; i >= 0; i--) { bitSet(PORTB, SClk_Bit); if ( PINB & 0x01){ …

Member Avatar
Member Avatar
+0 forum 1

How much day's require to learn C++ ?

Member Avatar
Member Avatar
+0 forum 5

I've been studying TDD for a few years and read quite a few books but none that good to be honest. Can anyone recomend any good ones. I'm not interested in BDD but am keen on anything that tackles the many problems of mocking intrinsic MVC objects.

Member Avatar
Member Avatar
+1 forum 1

I'm trying to setup mongoos server in a Winndows app. The server code needs to be in an infinite loop, so does the windows main loop. I put the server code and win loop on 2 threads, the problem is, the program hangs when executed. Is there a way to make this work Main Windows loop int mainLoop(MSG &messages) { while (GetMessage(&messages, NULL, 0, 0)) { TranslateMessage(&messages); DispatchMessage(&messages); } return 1; } Server loop int serverLoop() { struct mg_mgr mgr; struct mg_connection *c; static const char *s_http_port = "80"; mg_mgr_init(&mgr, NULL); c = mg_bind(&mgr, s_http_port, ev_handler); mg_set_protocol_http_websocket(c); for (;;) { …

Member Avatar
Member Avatar
+0 forum 4

I have some problems when working with Win32 api. 1. Changing the text and background color of a button doesn't take effect. My code: case WM_CTLCOLORBTN: COLORREF colorref; colorref = RGB(0,0,255); HBRUSH hBrushBtn; hBrushBtn = CreateSolidBrush(colorref); return ((LRESULT)hBrushBtn); break; 2. How do I create selectable text. My code: text = CreateWindow("STATIC","text",WS_VISIBLE | WS_CHILD , 0,0,100,60, hwnd , NULL, NULL, NULL); 3. How do I create a filled rectangle?

Member Avatar
Member Avatar
+0 forum 2

Question: I have to do a program on alternating sums using vectors. I am not sure how to start this program. I thought about using an array and every even index add the value and every odd index subtract the value. Does that sound right? Any ideas?

Member Avatar
Member Avatar
+0 forum 16

I am using PySide2 for GUI. I have a "Rename Project" QAction. The function must be like this: 1. set enable to false if tab name is "*Untitled" or file is unsaved. 2. set enable to True if file is loaded. How to do this? 3. Whenever switching to tab, these functions should be observed.

Member Avatar
Member Avatar
+1 forum 5

Hi all I have a script to update the value from datagridview to database I do use a button insert ToolStripButton but not working hope people to help thank ! Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load conn = New SqlConnection("") conn.Open() Dim query As [String] = "SELECT * FROM dtaEmployees" da = New SqlDataAdapter(query, conn) Dim cb As New SqlCommandBuilder(da) dt = New DataTable() da.Fill(dt) C1FlexGrid1.DataSource = dt conn.Close() End Sub Private Sub ToolStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles ToolStrip1.ItemClicked Select Case e.ClickedItem.Name Case "ToolStripButton1" '---> button insert da.Update(dt) End Select …

Member Avatar
Member Avatar
+0 forum 7

How can I make this to continue until the user presses N? I've tried using while(1), while( option == 'y' || option == 'Y') but it kept giving an error for that, and if/else statements but no luck. So I decided to try a do while statement and same results, it seems it is working, but I don't know what I'm doing wrong. I even tried moving all the statements to different areas and still nothing. #include <stdio.h> #include <time.h> #include <stdlib.h> enum meme {YEE, KNUCKLES, DOGE, HARAMBE, BUTKUS}; int dankestmemes(void); // function prototype int main(void) { srand(time(NULL)); // randomize …

Member Avatar
Member Avatar
+0 forum 10

I have 30 functions like this void func1(int *var1, int *var2) { func2(var1, var2); } void func2(int *var1, int *var2) { func3(var1, var2); } void func3(int *var1, int *var2) { func4(var1, var2); } I do not need var3 until func15. Is there a way to fix this mistake without having to change all the function calls and headings? var3 needs to be remembered every time I get to func15. I only use var3 in func15 though so I really do not want to have to change all of my function calls and headings. It obviously can't be a local variable …

Member Avatar
Member Avatar
+0 forum 4

I need a form that accepts two operands and an operator from the user and then performs the requested operation. Specifications Before performing the calculation, the application should check that both operands are numeric and that the operator is one of the following: + add - subtract * multiply / divide It should also check that both operands are between 0 and 1,000,000 (non-inclusive). To perform this data validation, code IsPresent, IsDecimal, and IsValidData methods as described in chapter 7 of the book. In addition, code an IsOperator method that checks for a valid operator. Code a private method named …

Member Avatar
Member Avatar
+0 forum 10

Hello, I created html file with Checkbox and i use python when i check one box and submit i have problem with list when i check 2 box or more and submit i see the result list like ['120', '104', '12'] i can use "for" to loop the list and do action but when i check one box i see the result withour list like 120 not ['120'] whe i use for it the loop will be 1 , 2, 0 how can i fix this Thanks

Member Avatar
Member Avatar
+0 forum 4

I've seen the following code for binding the Escape Key to a Tkinter GUI: import Tkinter as tk def exit(): root.destroy() root = tk.Tk() root.bind("<Escape>", exit) root.mainloop() However, when I add this to my GUI program, I don't get a response when Esc key is pressed. It does nothing. Any suggestions?

Member Avatar
+0 forum 0

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 8

Hi All, In this program I have these 2 matrices . It will compare each element in each row of matrix[4][4] to 3 . If that value <= 3 then store the characters in the first row of matrix m_c[25][32] in an 2D char array (char clusters[40][40]). For example 3 numbers (0,2,3) of the first row of matrix[4][4] less or equal 3 therefore 3 characters (A,B,D) of first row of matrix m_c[25][32] will be store in the clusters. Similarly 3 numbers (0,3,3) in second row of matrix[4][4] less or equal 3 therefore 3 characters (B,D,F) of first row of matrix …

Member Avatar
Member Avatar
+0 forum 1

I have a file that contains flow statistics from a switch. This is a big file with alot of values I would like to print out the statistics based on user input. I'm having a hard time to figure out which way is the most efficient, using a dictionary or a list. I'm looking for a way to split my keys and values element ={"cookie": " ","duration": " ","table": " ","n_packets": " ","n_bytes": " ", "idle_timeout": " ","idle_age": " ","priority": " ","arp": " ","in_port": " ","vlan_tci": " ","dl_src": " ","dl_dst": " ","arp_spat": " ",",arp_tpa": " ",",arp_op": " ",",actions": " ",} …

Member Avatar
Member Avatar
+0 forum 2

Howdy All - I am just wondering if anyone has successfully converted a *massive* (subjectivity implied) COBOL application to another language. If so, into which language was your system converted and when was this done? What were the potholes you, no doubt, hit? Was the conversion far more expensive than anticipated? What hidden costs were exposed? Was there a performance gain/loss in the new language? Did anyone convert from COBOL to PL/SQL? to T-SQL? to Java? to C#.NET? Thanks, and have a great day!

Member Avatar
Member Avatar
+0 forum 10

This may sound wierd, or easy, I just don't have a statistics background. How do I alter the statistical value of an array of emmitted random numbers? I am completely capable of using ranges, or creating an algorithim, I just need pseudo code or a brief description to guide me through the process. This is not homework. This would mean I essentially generate randoms, and the final result has a statistical probability. Thanks!

Member Avatar
Member Avatar
+0 forum 3

How to save image from computer client to server using java?? Give me the source code..

Member Avatar
Member Avatar
-1 forum 1

showing Error "Failure sending mail." please help me i used port 587 because maximum example 587 used this port how i can know the my mail port or it is right error in this line SMTP.Send(Mail) massage is:- Just "Failure sending mail." ------------------ Imports System.Net.Mail Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Mail As New MailMessage Mail.Subject = "test email" Mail.To.Add("abcd@gmail.com") Mail.From = New MailAddress("abcd@gmail.com") Mail.Body = "test mail test mail 123456789 hi" Dim SMTP As New SmtpClient("smtp.gmail.com") SMTP.EnableSsl = True SMTP.Credentials = New System.Net.NetworkCredential("abcd@gmail.com", "***********************") SMTP.Port = 587 SMTP.Send(Mail) End …

Member Avatar
Member Avatar
+0 forum 1

I have a program that is meant to display the total, average, student name and letter grade for a student. I'm almost done writing it but I have no idea how to make it loop so it goes back to step 1 from step 4. Everything I've read on using "while" loops hasn't really been helpful to me with this particular application. import java.util.Scanner; public class Averages5 { public static void main(String[] args) { // variable declaration String name; int mark1, mark2, mark3 ; int grade = 0; int A, B, C, F; double average; // input Scanner input = …

Member Avatar
Member Avatar
+0 forum 2

I am using Cell 2 and cell 3 of Column A Column B and Column C Column B is the Profit % and Column C is the Selling Price cell 2 of column A is my **search box** where I want to enter Selling Price. Presently, with the help of lookup formula, When I entered the Cost Price in search box, the relevant cell which matches the value in column C is highlited in Red Text. which is OK. Now I want the excel formula with the help of which the value in Column B, (corresponding to the highlighted text …

Member Avatar
Member Avatar
+0 forum 1

I have made the changes to the Apache http.conf file AllowOverride All Require all granted And added the Listen: 192.168.1.20:80 Save the conf file and restarted Apache But when I try to start http://192.168.1.22/wodpress I get the following error message This site can’t be reached 192.168.1.22 took too long to respond. Search Google for wordpress ERR_CONNECTION_TIMED_OUT My Windows 7 machine is 192.168.1.20 My Windows 10 WAMP64 server is at 192.168.1.22 I can net use back and forth between the systems. Sounds like a networking situation, just not sure on which machine.

Member Avatar
Member Avatar
+0 forum 1

I have a table that contains some cubes with servers and active status (see attached image): note: CUBE1 is repeated intentionally. The idea is the same cube is getting synced from the same server 1 as a data source (process_server) onto different target servers (query_server; say server2 is in region A and server 3 is in region B). The way the environment is set up is both servers have to be active/active status (meaning TRUE) except for some additional test cases, i am setting to false sometimes one or the other. I have the following script now calling the cube …

Member Avatar
Member Avatar
+0 forum 1

I have a Database named "Store" and tables are orders and firm. The firm table fields are firmname, firmcode. The fields orderno, orderdate orderqty, qtyrcvd and balqty are stroed in another table. When selecting three ComboBox values (fetched from another(invoice) table) ie firm name, orderno and orderdate respectively when clicking a button check that it matches with the current value (current row values) in the order table. If so fetch the result. 1.add the records in another table result will be present qtyrcvd is qtyrcvd balqty is orderqty-qtyrcvd Please help me writing the code. I am new in VB.NET. Imports …

Member Avatar
Member Avatar
+0 forum 1

Hello! Good Day to All, I am working on Visual Studio 2015. I have two workstation computer systems, in both same operating system and Visual Studio is installed. When i Build the main project it succeeded, and no any problem and my project runs normally on both systems. Then i made a Setup And Deployment project to the solution using the Category... Other Projects => Visual Studio Installer => Setup Project The Setup project made successfully and i am able to install my application from this setup project any other computer system. But problem is that when i needed to …

Member Avatar
Member Avatar
+0 forum 1

Hello, here is my code: import tkinter as tk import tkinter.font as tkFont from tkinter import ttk from tkinter import * root = tk.Tk() pressed = False class Example(tk.Frame): def _create_circle(self, x, y, r, **kwargs): return self.create_oval(x-r, y-r, x+r, y+r, **kwargs) tk.Canvas.create_circle = _create_circle def __init__(self, root): tk.Frame.__init__(self, root) self.customFont = tkFont.Font(family="Helvetica", size=20) root.title("Test") self.canvas = Canvas(self, width=400, height=400, background="white") self.xsb = tk.Scrollbar(self, orient="horizontal", command=self.canvas.xview) self.ysb = tk.Scrollbar(self, orient="vertical", command=self.canvas.yview) self.canvas.configure(yscrollcommand=self.ysb.set, xscrollcommand=self.xsb.set) self.canvas.configure(scrollregion=(0,0,1000,1000)) self.xsb.grid(row=1, column=0, sticky="ew") self.ysb.grid(row=0, column=1, sticky="ns") self.canvas.grid(row=0, column=0, sticky="nsew") self.grid_rowconfigure(0, weight=1) self.grid_columnconfigure(0, weight=1) self.canvas.create_line(300,160,1200,160, width = 10, fill= 'black') self.canvas.create_line(300,200,1200,200, width = 10, fill= 'black') self.canvas.create_circle(278, 180, …

Member Avatar
Member Avatar
+0 forum 3

If you have a counter that gets incremented through multiple functions, is it better to use a global counter or pointer counter? They both work just curious which is better and why.

Member Avatar
Member Avatar
+0 forum 3

The End.