Validering Radiobuttons

A step-by-step tutorial on how to set up basic jQuery form validation in just a few minutes, demonstrated through validation on a registration form. W3C CSS Validation service enables you to check your CSS code for validity, and warns you if you are using browser specific code. The HTML form we will be working at in these chapters, contains various input fields: required and optional text fields, radio buttons, and a submit button: The validation rules for the form above are as follows: Radio buttons (checka för ditt val) Knappar (tryck på ditt val) Se flera bra tips på hur du undviker dropdowns här. ... 8 Positiv validering. Att motivera användaren att fortsätta fylla i ert formulär med positiv förstärkning vid avklarat fält, är en effektiv metod. This informs the (HTML5-aware) web browser that the field is to be considered mandatory. Different browsers may mark the input box in some way (Firefox 4 Beta adds a red box-shadow by default), display a warning (Opera) or even prevent the form from being submitted if this field has no value. The plugin was initially written and maintained by Jörn Zaefferer, a member of the jQuery team, lead developer on the jQuery UI team and maintainer of QUnit.It was started back in the early days of jQuery in 2006, and updated and improved since then. Validering af HTML-formularer. I et HTML input-element kan man skrive hvad som helst. Hvis der kræves en e-mail-adresse eller en dato, så kan ikke alle tekster accepteres.Det sparer tid, for både bruger og server, hvis teksten afvises inden formularen sendes til serveren.. Form-validering i browseren sparer denne tid på den mest hensigtsmæssige måde hvis den køres lige før formularen ... This validator checks the markup validity of Web documents in HTML, XHTML, SMIL, MathML, etc. If you wish to validate specific content such as RSS/Atom feeds or CSS stylesheets, MobileOK content, or to find broken links, there are other validators and tools available. As an alternative you can also try our non-DTD-based validator. Field types include: dropdown, radio button, checkboxes, text box, note box, calculated field, file upload, and section header. Categorical field types (dropdown, radio buttons, checkboxes) must also have response options (choices) defined in Column F. Terms used in Column D to define these field types are: dropdown, radio, checkboxes. Before submitting data to the server, it is important to ensure all required form controls are filled out, in the correct format. This is called client-side form validation, and helps ensure data submitted matches the requirements set forth in the various form controls.This article leads you through basic concepts and examples of client-side form validation.

Duplicate tables...

2020.07.06 01:54 Tidachura3 Duplicate tables...

Hi, I am working to fix my issues which is duplicate screens after I click specific buttons. I want to be able to switch between those tables using buttons (save and cancel buttons). However, the second screen's save and cancel buttons will create duplicate screen (create another main screen so I will have two main screen) after I click save and cancel buttons instead of switching back and forth to the Main screen and the second screen
Can anyone suggest me how can I try to fix this duplicate screen issues please?
https://user-images.githubusercontent.com/31402838/86545041-9762ae80-bee0-11ea-809c-7a534833134d.PNG
This is my code that create duplicate tables. I have 5 screens in total. I would like to go back and forth after I click the save and cancel buttons but it create duplicate table instead.
ModifypartController.java
package ViewController; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.stage.Stage; import model.InHouse; import model.Inventory; import model.Outsourced; import model.Part; import java.awt.event.ActionEvent; import java.io.IOException; import java.net.URL; import java.util.Optional; import java.util.ResourceBundle; public class ModifypartController implements Initializable { Part part; private boolean isOutsourced = true; private int index = 0; @Override public void initialize(URL location, ResourceBundle resources) { } public ModifypartController(){ } Stage stage; Parent scene; @FXML private RadioButton inHouseRBtn; @FXML private ToggleGroup toggleGroup; @FXML private RadioButton outsourcedRBtn; @FXML private TextField modifyPartMinTxt; @FXML private TextField modifyPartPriceTxt; @FXML private TextField modifyPartDynamicTxt; @FXML private TextField modifyPartMaxTxt; @FXML private TextField modifyPartInvTxt; @FXML private TextField modifyPartNameTxt; @FXML private TextField modifyPartIdTxt; @FXML private Button saveBtn; @FXML private Button cancelBtn; @FXML public Label modifyPartCnameLbl; public void setPart(Part part){ this.part = part; modifyPartIdTxt.setText(Integer.toString(part.getId())); modifyPartNameTxt.setText(part.getName()); modifyPartInvTxt.setText(Integer.toString(part.getInv())); modifyPartPriceTxt.setText(Double.toString(part.getPrice())); modifyPartMaxTxt.setText(Integer.toString(part.getMax())); modifyPartMinTxt.setText(Integer.toString(part.getMin())); if(part instanceof InHouse){ inHouseRBtn.fire(); modifyPartDynamicTxt.setText(String.valueOf(((InHouse)part).getMachineId())); }else{ outsourcedRBtn.fire(); modifyPartDynamicTxt.setText(String.valueOf(((Outsourced)part).getCompanyName())); } } @FXML void modifyPartSave(javafx.event.ActionEvent event) throws IOException{ InHouse newInHouse = new InHouse(0, "", 0, 0, 0, 0, 0); index = Inventory.getAllParts().indexOf(part); if (!isOutsourced) { if (isValid(modifyPartNameTxt.getText(), modifyPartPriceTxt.getText(), modifyPartInvTxt.getText(), modifyPartMinTxt.getText(), modifyPartMaxTxt.getText(), modifyPartDynamicTxt.getText())) { table(newInHouse, modifyPartNameTxt, modifyPartPriceTxt, modifyPartInvTxt, modifyPartMinTxt, modifyPartMaxTxt, modifyPartDynamicTxt); Inventory.updatePart(index, newInHouse); System.out.println("Part modified"); Stage stage; Parent root; stage = (Stage) saveBtn.getScene().getWindow(); FXMLLoader loader = new FXMLLoader(getClass().getResource("/ViewControlleMainScreen.fxml")); root = loader.load(); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); } }else { Outsourced newOutsourced = new Outsourced(0, "", 0, 0, 0, 0, ""); if (isValid(modifyPartNameTxt.getText(), modifyPartPriceTxt.getText(), modifyPartInvTxt.getText(), modifyPartMinTxt.getText(), modifyPartMaxTxt.getText(), modifyPartDynamicTxt.getText())) { table(newOutsourced, modifyPartNameTxt, modifyPartPriceTxt, modifyPartInvTxt, modifyPartMinTxt, modifyPartMaxTxt, modifyPartDynamicTxt); Inventory.updatePart(index, newOutsourced); System.out.println("Part modified"); // Paret tableViewParet loader = new FXMLLoader(getClass().getResource("/ViewControlleMainScreen.fxml")); // Stage window = (Stage)((Node).eventgetSource()).getScene.getWindow(); // // window.setScene(tableViewScene); // window.show(); Stage stage; Parent root; stage = (Stage) saveBtn.getScene().getWindow(); FXMLLoader loader = new FXMLLoader(getClass().getResource("/ViewControlleMainScreen.fxml")); root = loader.load(); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); } } } static void table(InHouse newInHouse, TextField modifyPartNameTxt, TextField modifyPartPriceTxt, TextField modifyPartInvTxt, TextField modifyPartMinTxt, TextField modifyPartMaxTxt, TextField modifyPartDynamicTxt) { if (!modifyPartNameTxt.getText().isEmpty()) { newInHouse.setName(modifyPartNameTxt.getText()); } if (!modifyPartPriceTxt.getText().isEmpty()) { newInHouse.setPrice(Double.parseDouble(modifyPartPriceTxt.getText())); } if (!modifyPartInvTxt.getText().isEmpty()) { newInHouse.setInv(Integer.parseInt(modifyPartInvTxt.getText())); } if (!modifyPartMinTxt.getText().isEmpty()) { newInHouse.setMin(Integer.parseInt(modifyPartMinTxt.getText())); } if (!modifyPartMaxTxt.getText().isEmpty()) { newInHouse.setMax(Integer.parseInt(modifyPartMaxTxt.getText())); } if (!modifyPartDynamicTxt.getText().isEmpty()) { newInHouse.setMachineId(Integer.parseInt(modifyPartDynamicTxt.getText())); } } static void table(Outsourced newOutsourced, TextField modifyPartNameTxt, TextField modifyPartPriceTxt, TextField modifyPartInvTxt, TextField modifyPartMinTxt, TextField modifyPartMaxTxt, TextField modifyPartDynamicTxt) { if (!modifyPartNameTxt.getText().isEmpty()) { newOutsourced.setName(modifyPartNameTxt.getText()); } if (!modifyPartPriceTxt.getText().isEmpty()) { newOutsourced.setPrice(Double.parseDouble(modifyPartPriceTxt.getText())); } if (!modifyPartInvTxt.getText().isEmpty()) { newOutsourced.setInv(Integer.parseInt(modifyPartInvTxt.getText())); } if (!modifyPartMinTxt.getText().isEmpty()) { newOutsourced.setMin(Integer.parseInt(modifyPartMinTxt.getText())); } if (!modifyPartMaxTxt.getText().isEmpty()) { newOutsourced.setMax(Integer.parseInt(modifyPartMaxTxt.getText())); } if (!modifyPartDynamicTxt.getText().isEmpty()) { newOutsourced.setCompanyName(modifyPartDynamicTxt.getText()); } } private boolean isValid(String partName, String partPrice, String partInv, String partMin, String partMax, String toggleGroup ) { String errorMessage = ""; Integer intMin = null, intMax = null; boolean isValid; if (partName == null partName.isEmpty()) { errorMessage += ("Need to input part name\n"); } try { intMin = Integer.parseInt(partMin); } catch (NumberFormatException e) { errorMessage += ("Min must a number\n"); } try { intMax = Integer.parseInt(partMax); } catch (NumberFormatException e) { errorMessage += ("Maximum must be a number\n"); } try { if (intMin > intMax) { errorMessage += ("Minimum must be less than maximum \n"); } if (intMin < 0 intMax < 0) { errorMessage += ("Quantity cannot be less than zero\n"); } } catch (NullPointerException e) { errorMessage += ("Min and Max cannot be less than zero \n"); } try { int intInv = Integer.parseInt(partInv); if (intMax != null && intMin != null) { if (intInv < intMin intInv > intMax) { errorMessage += ("Inventory must be between minimum and maximum \n"); } } else { errorMessage += ("Inventory cannot be blank \n"); } } catch (NumberFormatException e) { errorMessage += ("Inventory cannot be blank and must be a number\n"); } try { double price = Double.parseDouble(partPrice); if (price < 0) { errorMessage += ("Price cannot be less than zero\n"); } } catch (NumberFormatException e) { errorMessage += ("Price cannot be blank and must be a number\n"); } if (!isOutsourced) { if (!toggleGroup.isEmpty()) { try { Integer.parseInt(toggleGroup); } catch (NumberFormatException e) { errorMessage += ("MachineId must be a number"); } } else { errorMessage += ("MachineId cannot be black\n"); } } else { if (toggleGroup.isEmpty()) { errorMessage += ("Company name cannot be blank \n"); } } if (errorMessage.isEmpty() == true) { isValid = true; } else { isValid = false; Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Part Validation error"); alert.setHeaderText("Error"); alert.setContentText(errorMessage); alert.showAndWait(); } return isValid; } @FXML void inHouseRBtnS(javafx.event.ActionEvent event) { isOutsourced = false; modifyPartCnameLbl.setText("Machine ID"); } @FXML void outsourcedRBtnS(javafx.event.ActionEvent event) { isOutsourced = true; modifyPartCnameLbl.setText("Company Name"); } @FXML void modifyPartCompanyTxt(ActionEvent event) { } @FXML void modifyPartCostTxt(ActionEvent event) { } @FXML void modifyPartInvTxt(ActionEvent event) { } @FXML void modifyPartMaxTxt(ActionEvent event) { } @FXML void modifyPartMinTxt(ActionEvent event) { } @FXML void modifyPartNameTxt(ActionEvent event) { } public void modifyPartMinTxt(javafx.event.ActionEvent actionEvent) { } public void modifyPartCostTxt(javafx.event.ActionEvent actionEvent) { } public void modifyPartCompanyTxt(javafx.event.ActionEvent actionEvent) { } public void modifyPartMaxTxt(javafx.event.ActionEvent actionEvent) { } private void ReturnToMainScreen(javafx.event.ActionEvent event) throws IOException { Alert alert = new Alert(Alert.AlertType.CONFIRMATION, "This will clear all text field values, do you want to continue?"); Optional results = alert.showAndWait(); if(results.isPresent() && results.get() == ButtonType.OK) { stage = (Stage) ((Button) event.getSource()).getScene().getWindow(); scene = FXMLLoader.load(getClass().getResource("MainScreen.fxml")); stage.setScene(new Scene(scene)); stage.show(); } } public void modifyPartCancel(javafx.event.ActionEvent event) throws IOException { ReturnToMainScreen(event); } public void modifyProductIdTxt(javafx.event.ActionEvent actionEvent) { } public void modifyProductSearch(javafx.event.ActionEvent actionEvent) { } public void modifyProductSave(javafx.event.ActionEvent actionEvent) { System.out.println("test"); } public void modifyProductCancel(javafx.event.ActionEvent actionEvent) { } public void modifyProductDelete(javafx.event.ActionEvent actionEvent) { } public void modifyProductAdd(javafx.event.ActionEvent actionEvent) { } public void modifyPartInvOnAction(javafx.event.ActionEvent actionEvent) { } public void modifyPartNameOnAction(javafx.event.ActionEvent actionEvent) { } } 
submitted by Tidachura3 to javahelp [link] [comments]


2020.01.24 14:07 currentinfo Newest solved Question Can I learn python for building android applications? - currentinfo.net

Which technicque would NOT be useful to share common attributes and behaviors between two ActiveRecord Models? node: managing SQL files with variable replacement Search one value of dataframe and replace with reference value in another dataframe if it greater than reference value Does Android SNEP server support fragmentation? Facebook comment moderation tool What are the benefits of resource(.resx) files? Running meta: refresh_inventory in a loop? Parse Json with Unirest and Java and Selenium WebDriver MySQL use leftjoin with select Angular App Deployed to Github Pages Not Initializing? wordpress quiz creator responsive problem When we should use db_index=True in Django? Java method reference selection narrow type Failed prop type: Invalid prop 'value' of type 'object' supplied to 'TextInput' Cannot convert type 'System.Drawing.Image' to 'System.Drawing.Icon' Time and date validation in asp.net Enumerable class missing XML Documentation Comments in .net 4.6 project How to click on a pictorial button in web browser page using python with selenium Parsing with boost spirit. Cannot parse a rule Creating a Test to Run Specific Tests Within a Test Suite (Selenium Python Pytest) How can you git pull only the current branch? How to create pairs of polygons Only in a specific (bigger) polygon and count all that points that are included in that pairs? count without group How to add Shadow Over TextureView around focusArea App close event in Ionic Windows 8.1 App? The best way to create docker image "offline installer" Get (web) url for help documentation in R? Handling big complex spanish project CakePHP route redirect with parameters Full word cursor movement in DBVisualizer script editor Don't allow grandchildren of abstract classes to override their parent c# Indexing excluded directories in PyCharm 3 When using python os.rmdir, get PermissionError: [WinError 5] Access is denied How can you export your .bashrc to .zshrc? Get ValueError when calling tf.image.non_max_suppression Mutating webhook doc reference Difference between setOf and hashSetOf in Kotlin Not able to write and read from serial port using pyserial python script Remove trailing space in a cell AWS Image for Kubernetes Component is not part of any NgModule or the module has not been imported into your module How to remove entire sentence if it contains string? PHP Mysql - Get records where column value is everything but a specific value exclude switches in firefox webdriver options Date mapping not working in Kibana and ES How to create an Button with JS and use the OnClick Attribute NestJs - TypeORM configuration works but not with ConfigService Exported XML file from Database and get clean format without any attributes before actual columns How can I pass JSON data into a Nunjucks template? How to authenticate android app and web application with single firebase application Strange distinct working with JSON, for various version of PostgreSQL TF2.0: Translation model: Error when restoring the saved model: Unresolved object in checkpoint (root).optimizer.iter: attributes Get data from database in array php How do I call the default deserializer from a custom deserializer in Jackson Filter content with Regex only for outer brackets Regex with ng-if Any shortcut to initialize all array elements to zero? Proper way to store values array-like in Firebase Node forever says program is running, but evidence suggests not Precompiling assets failing when including boostrap Redemption.dll 800401fa Wrong OS or OS version Injecting service VS Injecting mongoose model in nestjs Swift 5 - Issues With Passing Data From Class To Class How to set additional options for Chart.js BarCharts using React-Chartkick How to conditionally add widgets to a list? Press TAB and then ENTER key in Selenium WebDriver Clean way to convert from big big endian to little endian with not-word aligned data How to verify domain ownership using DNS verification? Handling Kotlin Serialization MissingFieldException with Retrofit C# connect to System ODBC datasource Can fix only be typed in non-strict evaluated languages? Multi select html and javascript value send from POST , GET Executing events from both page and directive in angularjs How to select columns based upon column value? Having trouble with objects and classes in C++ Connect an ALB to a Nginx Ingress controller Creating a Python 3/Pygame "Press Any Key to Continue" Start Page paypal payment without checkout flow Creating Organization on Azure Dev Ops with existing name npm start fails after npm install How to access zip central directory with c++ Java 8 + JavaFX on macOS: "ERROR: JavaFX runtime components are missing, and are required to run this application." Cannot read a an object in Component, React How to show directories in vba's immediate window? OneNote Graph API doesn't return new pages expected assignment or function call: no-unused-expressions ReactJS How to wait for flowable onComplete? Add multiple properties at once, to object which already has some properties defined Uninstall istio (all components) completely from kubernetes cluster Get the numerical / integer value of any Weekday using JavaScript react native firebase push notification issues only on iOS Configuration System Failed to Initialize False warning about name can be not defined in PyCharm radiobutton get does not work inside a function Replace a specific cell value based on what another cell starts with Delphi issues with GUI in a Callback reading tar file contents without untarring it, in python script Simple question about declaring an empty string in C setState() doesn't execute until the enclosing function returns Convert a byte into a boolean array of length 4 in Java
submitted by currentinfo to u/currentinfo [link] [comments]


2019.10.10 10:16 lululock [Python 3.7 - Tkinter] How to get data from a radiobutton ???

Hi !
I've got issues again, but with another part of my program...
I have a language selection window, which displays the available languages as radiobuttons...
The languages files are .lang (text) files stored in the lang folder. A script already checks if the files are valid (if they contain the right number of text lines). The available_languages variable is a dictionary where is stored the relative path to a .lang file and which language it contains (the first line of the file indicates which language is in it).
The language variable is a dictionary where is stored the text lines of the selected language (from the lang.conf file, which sets the default language on startup, or forced by the user).
Then, when I click on apply, the tgui_language_load function should launch the lang_lang_load function, which creates a new language dictionary, containing text strings for the new selected language, for later use. It then destroy the lang_window and the main_window to load it again, but with the new language setting.
The issue I've encountered is that I'm unable to get the content of the variable which is set by the radiobuttons (selection), which results in a empty language dictionary and an error when the program wants to recreate the main window.
I've tried to set that variable as a IntVar() and a StringVar() with the same issues... The .get() method gives me always 0 or an empty string, whatever the button I selected before clicking on apply...

The documentation is unclear, it says to use the .get() method and it should work. It obviously don't work for me or I missed something...

Here's bits of my code :
# Creates and loads the language selection window. # language (dict), available_languages (dict), line_number (int), software_version (str) def tgui_generate_language(language, available_languages, line_number, software_version): global lang_window lang_window = Tk() title = language["language"] lang_window.title(title) Label(lang_window, text=" ").grid(column=0, row=1, rowspan=10) Label(lang_window, text=" ").grid(column=0, row=0, columnspan=10) avail = language["available_languages"] + " :" Label(lang_window, text=avail).grid(column=1, row=1) Label(lang_window, text=" ").grid(column=0, row=2, columnspan=10) global selection selection = StringVar() value = 0 Radiobutton(lang_window, text='english', variable=selection, value='english').grid(column=1, row=4, columnspan=1, sticky="N") for file_path, lang in available_languages.items(): Radiobutton(lang_window, text=lang, variable=selection, value=lang).grid(column=1, row=value + 5, columnspan=1, sticky="N") value = value + 1 Label(lang_window, text=" ").grid(column=0, row=value + 5, columnspan=10) Label(lang_window, text=" ").grid(column=2, row=0, rowspan=10) Label(lang_window, text=language["desired_language_missing"]).grid(column=1, row=value + 6) Label(lang_window, text=" ").grid(column=0, row=value + 7, columnspan=10) Button(lang_window, text=language["apply"], command=partial(tgui_language_load, available_languages, line_number, software_version)).grid(column=1, row=value + 8) Label(lang_window, text=" ").grid(column=0, row=value + 9, columnspan=10) lang_window.mainloop() 
And here's the tgui_language_load function called by the apply button :
# Loads the new language and change the GUI language. # available_languages (dict), line_number (int), software_version (str) def tgui_language_load(available_languages, line_number, software_version): global main_window global lang_window global selection selected_language = selection.get() language = dict() for path, lang_name in available_languages.items(): if lang_name == selected_language: path = str(sys.path[-1]) + "/" + path language = lang_lang_load(path) else: break lang_window.destroy() main_window.destroy() tgui_generate_main(language, software_version, available_languages, line_number) 
The lang_lang_load function already works since it successfully loads the right language and sets the text-strings in the right place.
submitted by lululock to learnpython [link] [comments]


2019.08.05 07:35 shwetashivankar17 Asp Dot Net Training Tutorial For Beginners

Asp .net is the major part in Dot Net Training ASP.NET could be a framework for developing dynamic net applications. It supports languages like VB.Net, C#, Jscript.Net, etc. The programming logic and content may be developed one by one in Microsoft Asp.Net. This course covers some important aspect of ASP.NET like reusable code, deploying the .net application on the server,testing web application, debugging and so on.
What is Asp.net?
ASP.Net could be a net development platform provided by Microsoft. It is used for creating web-based applications. ASP.Net was first released in the year 2002. The first version of ASP.Net deployed was 1.0. The most recent version of ASP.Net is version four.6. ASP.Net is designed to work with the HTTP protocol. This is the quality protocol used across all net applications.
ASP.Net applications can even be written in an exceedingly form of .Net languages.
These include C#, VB.Net, and J#. In this chapter, you'll see some basic basic of the .Net framework.
The full form of ASP is Active Server Pages, and .NET is Network Enabled Technologies.
ASP.NET Tutorial provides basic and advanced ideas of ASP.NET. Our ASP.NET Tutorial is intended for beginners and professionals each.
https://www.exltech.in/dot-net-training.html
Our ASP.NET Tutorial includes all topics of ASP.NET Tutorial like ASP.Net introduction, features, project, example, server controls, labels, textbox, button, hyperlink, radiobutton, calender, checkbox, fileupload, events handling, authentication, webforms model binding, html server control, compare validdator, range validator, validation summary, mvc introduction, mvc project, view, validation, entity framework, authentication etc..
Components of Asp.net
1.Language – A variety of languages exists for .net framework. They are VB.net and C#. These can be used to develop web applications.
2.Library - The .NET Framework includes a collection of normal category libraries.
The most common library used for net applications in .net is that the net library.
The web library has all the mandatory parts accustomed develop.Net web-based applications.
3.Common Language Runtime - The Common Language Infrastructure or CLI is a platform. .Net programs are executed on this platform. The CLR is used for performing key activities. Activities include Exception handling and Garbage collection.
Characteristics of asp.net
1.Code Behind Mode – This is the concept of separation of design and code.
By creating this separation, it becomes easier to maintain the ASP.Net application.
2.State Management –ASP.Net has the facility to control state management.
HTTP is known as a stateless protocol. Let's take an example of a shopping cart application.
3.Caching – ASP.Net will implement the idea of Caching. This improve's the performance of the application
https://www.exltech.in
submitted by shwetashivankar17 to u/shwetashivankar17 [link] [comments]


2019.07.12 19:06 Xebarsis Disabling Validators Using JQuery

I have 3 radiobuttons; two have a corresponding textbox, and the last one has a fileupload. The two textboxes and fileupload have a total of 3 separate validators. When a radiobutton is selected, the other two textboxes/fileupload hide, so only one is shown at a time depending on what radiobutton is selected.
I've coded this so if you click a submit button, the only validator that matters is the one that's associated with the selected radiobutton, since I don't want the hidden forms to count. The issue I have is when you select a radio button, the validator error message immediately appears. I only want the error message to appear if the user clicks the submit button without filling out the textbox/fileupload that has been selected. Any suggestions are appreciated.

https://preview.redd.it/ubvqukcemw931.png?width=1677&format=png&auto=webp&s=7f7d6b5904f44651e3c07f802ae4ba285fa3ad09
    

Required.
Required.
submitted by Xebarsis to jquery [link] [comments]


2019.05.08 13:40 Atticus_of_Finch Need help, please.

I have been tasked with updating a script, and I have never worked with AutoIT. The original author is out on sick leave, and cannot be reached.

The script below was designed to update timeouts on an application. It runs fine in Windows 7 and will allow us to remotely set these Registry settings. Under Windows 10, it does not change the Registry settings at all. I have tried right-click and Run as Administrator, but still no luck in getting it to work. I am a full PC admin on all devices in our AD container, and cannot manually edit the Registry either locally or remotely with no issues.

#Region #AutoIt3Wrapper_Icon=..\..\Logo\Logo icon.ico #AutoIt3Wrapper_OutFile=HealthCast_Timeoutsv3.Exe #AutoIt3Wrapper_Res_Fileversion=1.0.0.4 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y #AutoIt3Wrapper_Res_LegalCopyright=MyCompany #EndRegion Global Const $bs_groupbox = 7 Global Const $bs_bottom = 2048 Global Const $bs_center = 768 Global Const $bs_defpushbutton = 1 Global Const $bs_left = 256 Global Const $bs_multiline = 8192 Global Const $bs_pushbox = 10 Global Const $bs_pushlike = 4096 Global Const $bs_right = 512 Global Const $bs_rightbutton = 32 Global Const $bs_top = 1024 Global Const $bs_vcenter = 3072 Global Const $bs_flat = 32768 Global Const $bs_icon = 64 Global Const $bs_bitmap = 128 Global Const $bs_notify = 16384 Global Const $bs_splitbutton = 12 Global Const $bs_defsplitbutton = 13 Global Const $bs_commandlink = 14 Global Const $bs_defcommandlink = 15 Global Const $bcsif_glyph = 1 Global Const $bcsif_image = 2 Global Const $bcsif_style = 4 Global Const $bcsif_size = 8 Global Const $bcss_nosplit = 1 Global Const $bcss_stretch = 2 Global Const $bcss_alignleft = 4 Global Const $bcss_image = 8 Global Const $button_imagelist_align_left = 0 Global Const $button_imagelist_align_right = 1 Global Const $button_imagelist_align_top = 2 Global Const $button_imagelist_align_bottom = 3 Global Const $button_imagelist_align_center = 4 Global Const $bs_3state = 5 Global Const $bs_auto3state = 6 Global Const $bs_autocheckbox = 3 Global Const $bs_checkbox = 2 Global Const $bs_radiobutton = 4 Global Const $bs_autoradiobutton = 9 Global Const $bs_ownerdraw = 11 Global Const $gui_ss_default_button = 0 Global Const $gui_ss_default_checkbox = 0 Global Const $gui_ss_default_group = 0 Global Const $gui_ss_default_radio = 0 Global Const $bcm_first = 5632 Global Const $bcm_getidealsize = ($bcm_first + 1) Global Const $bcm_getimagelist = ($bcm_first + 3) Global Const $bcm_getnote = ($bcm_first + 10) Global Const $bcm_getnotelength = ($bcm_first + 11) Global Const $bcm_getsplitinfo = ($bcm_first + 8) Global Const $bcm_gettextmargin = ($bcm_first + 5) Global Const $bcm_setdropdownstate = ($bcm_first + 6) Global Const $bcm_setimagelist = ($bcm_first + 2) Global Const $bcm_setnote = ($bcm_first + 9) Global Const $bcm_setshield = ($bcm_first + 12) Global Const $bcm_setsplitinfo = ($bcm_first + 7) Global Const $bcm_settextmargin = ($bcm_first + 4) Global Const $bm_click = 245 Global Const $bm_getcheck = 240 Global Const $bm_getimage = 246 Global Const $bm_getstate = 242 Global Const $bm_setcheck = 241 Global Const $bm_setdontclick = 248 Global Const $bm_setimage = 247 Global Const $bm_setstate = 243 Global Const $bm_setstyle = 244 Global Const $bcn_first = -1250 Global Const $bcn_dropdown = ($bcn_first + 2) Global Const $bcn_hotitemchange = ($bcn_first + 1) Global Const $bn_clicked = 0 Global Const $bn_paint = 1 Global Const $bn_hilite = 2 Global Const $bn_unhilite = 3 Global Const $bn_disable = 4 Global Const $bn_doubleclicked = 5 Global Const $bn_setfocus = 6 Global Const $bn_killfocus = 7 Global Const $bn_pushed = $bn_hilite Global Const $bn_unpushed = $bn_unhilite Global Const $bn_dblclk = $bn_doubleclicked Global Const $bst_checked = 1 Global Const $bst_indeterminate = 2 Global Const $bst_unchecked = 0 Global Const $bst_focus = 8 Global Const $bst_pushed = 4 Global Const $bst_dontclick = 128 Global Const $es_left = 0 Global Const $es_center = 1 Global Const $es_right = 2 Global Const $es_multiline = 4 Global Const $es_uppercase = 8 Global Const $es_lowercase = 16 Global Const $es_password = 32 Global Const $es_autovscroll = 64 Global Const $es_autohscroll = 128 Global Const $es_nohidesel = 256 Global Const $es_oemconvert = 1024 Global Const $es_readonly = 2048 Global Const $es_wantreturn = 4096 Global Const $es_number = 8192 Global Const $ec_err = -1 Global Const $ecm_first = 5376 Global Const $em_canundo = 198 Global Const $em_charfrompos = 215 Global Const $em_emptyundobuffer = 205 Global Const $em_fmtlines = 200 Global Const $em_getcuebanner = ($ecm_first + 2) Global Const $em_getfirstvisibleline = 206 Global Const $em_gethandle = 189 Global Const $em_getimestatus = 217 Global Const $em_getlimittext = 213 Global Const $em_getline = 196 Global Const $em_getlinecount = 186 Global Const $em_getmargins = 212 Global Const $em_getmodify = 184 Global Const $em_getpasswordchar = 210 Global Const $em_getrect = 178 Global Const $em_getsel = 176 Global Const $em_getthumb = 190 Global Const $em_getwordbreakproc = 209 Global Const $em_hideballoontip = ($ecm_first + 4) Global Const $em_limittext = 197 Global Const $em_linefromchar = 201 Global Const $em_lineindex = 187 Global Const $em_linelength = 193 Global Const $em_linescroll = 182 Global Const $em_posfromchar = 214 Global Const $em_replacesel = 194 Global Const $em_scroll = 181 Global Const $em_scrollcaret = 183 Global Const $em_setcuebanner = ($ecm_first + 1) Global Const $em_sethandle = 188 Global Const $em_setimestatus = 216 Global Const $em_setlimittext = $em_limittext Global Const $em_setmargins = 211 Global Const $em_setmodify = 185 Global Const $em_setpasswordchar = 204 Global Const $em_setreadonly = 207 Global Const $em_setrect = 179 Global Const $em_setrectnp = 180 Global Const $em_setsel = 177 Global Const $em_settabstops = 203 Global Const $em_setwordbreakproc = 208 Global Const $em_showballoontip = ($ecm_first + 3) Global Const $em_undo = 199 Global Const $ec_leftmargin = 1 Global Const $ec_rightmargin = 2 Global Const $ec_usefontinfo = 65535 Global Const $emsis_compositionstring = 1 Global Const $eimes_getcompstratonce = 1 Global Const $eimes_cancelcompstrinfocus = 2 Global Const $eimes_completecompstrkillfocus = 4 Global Const $en_align_ltr_ec = 1792 Global Const $en_align_rtl_ec = 1793 Global Const $en_change = 768 Global Const $en_errspace = 1280 Global Const $en_hscroll = 1537 Global Const $en_killfocus = 512 Global Const $en_maxtext = 1281 Global Const $en_setfocus = 256 Global Const $en_update = 1024 Global Const $en_vscroll = 1538 Global Const $tti_none = 0 Global Const $tti_info = 1 Global Const $tti_warning = 2 Global Const $tti_error = 3 Global Const $tti_info_large = 4 Global Const $tti_warning_large = 5 Global Const $tti_error_large = 6 Global Const $__editconstant_ws_vscroll = 2097152 Global Const $__editconstant_ws_hscroll = 1048576 Global Const $gui_ss_default_edit = BitOR($es_wantreturn, $__editconstant_ws_vscroll, $__editconstant_ws_hscroll, $es_autovscroll, $es_autohscroll) Global Const $gui_ss_default_input = BitOR($es_left, $es_autohscroll) Global Const $gui_event_close = -3 Global Const $gui_event_minimize = -4 Global Const $gui_event_restore = -5 Global Const $gui_event_maximize = -6 Global Const $gui_event_primarydown = -7 Global Const $gui_event_primaryup = -8 Global Const $gui_event_secondarydown = -9 Global Const $gui_event_secondaryup = -10 Global Const $gui_event_mousemove = -11 Global Const $gui_event_resized = -12 Global Const $gui_event_dropped = -13 Global Const $gui_rundefmsg = "GUI_RUNDEFMSG" Global Const $gui_avistop = 0 Global Const $gui_avistart = 1 Global Const $gui_aviclose = 2 Global Const $gui_checked = 1 Global Const $gui_indeterminate = 2 Global Const $gui_unchecked = 4 Global Const $gui_dropaccepted = 8 Global Const $gui_nodropaccepted = 4096 Global Const $gui_acceptfiles = $gui_dropaccepted Global Const $gui_show = 16 Global Const $gui_hide = 32 Global Const $gui_enable = 64 Global Const $gui_disable = 128 Global Const $gui_focus = 256 Global Const $gui_nofocus = 8192 Global Const $gui_defbutton = 512 Global Const $gui_expand = 1024 Global Const $gui_ontop = 2048 Global Const $gui_fontitalic = 2 Global Const $gui_fontunder = 4 Global Const $gui_fontstrike = 8 Global Const $gui_dockauto = 1 Global Const $gui_dockleft = 2 Global Const $gui_dockright = 4 Global Const $gui_dockhcenter = 8 Global Const $gui_docktop = 32 Global Const $gui_dockbottom = 64 Global Const $gui_dockvcenter = 128 Global Const $gui_dockwidth = 256 Global Const $gui_dockheight = 512 Global Const $gui_docksize = 768 Global Const $gui_dockmenubar = 544 Global Const $gui_dockstatebar = 576 Global Const $gui_dockall = 802 Global Const $gui_dockborders = 102 Global Const $gui_gr_close = 1 Global Const $gui_gr_line = 2 Global Const $gui_gr_bezier = 4 Global Const $gui_gr_move = 6 Global Const $gui_gr_color = 8 Global Const $gui_gr_rect = 10 Global Const $gui_gr_ellipse = 12 Global Const $gui_gr_pie = 14 Global Const $gui_gr_dot = 16 Global Const $gui_gr_pixel = 18 Global Const $gui_gr_hint = 20 Global Const $gui_gr_refresh = 22 Global Const $gui_gr_pensize = 24 Global Const $gui_gr_nobkcolor = -2 Global Const $gui_bkcolor_default = -1 Global Const $gui_bkcolor_transparent = -2 Global Const $gui_bkcolor_lv_alternate = -33554432 Global Const $gui_ws_ex_parentdrag = 1048576 Global Const $ss_left = 0 Global Const $ss_center = 1 Global Const $ss_right = 2 Global Const $ss_icon = 3 Global Const $ss_blackrect = 4 Global Const $ss_grayrect = 5 Global Const $ss_whiterect = 6 Global Const $ss_blackframe = 7 Global Const $ss_grayframe = 8 Global Const $ss_whiteframe = 9 Global Const $ss_simple = 11 Global Const $ss_leftnowordwrap = 12 Global Const $ss_bitmap = 14 Global Const $ss_etchedhorz = 16 Global Const $ss_etchedvert = 17 Global Const $ss_etchedframe = 18 Global Const $ss_noprefix = 128 Global Const $ss_notify = 256 Global Const $ss_centerimage = 512 Global Const $ss_rightjust = 1024 Global Const $ss_sunken = 4096 Global Const $gui_ss_default_label = 0 Global Const $gui_ss_default_graphic = 0 Global Const $gui_ss_default_icon = $ss_notify Global Const $gui_ss_default_pic = $ss_notify Global Const $ws_tiled = 0 Global Const $ws_overlapped = 0 Global Const $ws_maximizebox = 65536 Global Const $ws_minimizebox = 131072 Global Const $ws_tabstop = 65536 Global Const $ws_group = 131072 Global Const $ws_sizebox = 262144 Global Const $ws_thickframe = 262144 Global Const $ws_sysmenu = 524288 Global Const $ws_hscroll = 1048576 Global Const $ws_vscroll = 2097152 Global Const $ws_dlgframe = 4194304 Global Const $ws_border = 8388608 Global Const $ws_caption = 12582912 Global Const $ws_overlappedwindow = 13565952 Global Const $ws_tiledwindow = 13565952 Global Const $ws_maximize = 16777216 Global Const $ws_clipchildren = 33554432 Global Const $ws_clipsiblings = 67108864 Global Const $ws_disabled = 134217728 Global Const $ws_visible = 268435456 Global Const $ws_minimize = 536870912 Global Const $ws_child = 1073741824 Global Const $ws_popup = -2147483648 Global Const $ws_popupwindow = -2138570752 Global Const $ds_modalframe = 128 Global Const $ds_setforeground = 512 Global Const $ds_contexthelp = 8192 Global Const $ws_ex_acceptfiles = 16 Global Const $ws_ex_mdichild = 64 Global Const $ws_ex_appwindow = 262144 Global Const $ws_ex_composited = 33554432 Global Const $ws_ex_clientedge = 512 Global Const $ws_ex_contexthelp = 1024 Global Const $ws_ex_dlgmodalframe = 1 Global Const $ws_ex_leftscrollbar = 16384 Global Const $ws_ex_overlappedwindow = 768 Global Const $ws_ex_right = 4096 Global Const $ws_ex_staticedge = 131072 Global Const $ws_ex_toolwindow = 128 Global Const $ws_ex_topmost = 8 Global Const $ws_ex_transparent = 32 Global Const $ws_ex_windowedge = 256 Global Const $ws_ex_layered = 524288 Global Const $ws_ex_controlparent = 65536 Global Const $ws_ex_layoutrtl = 4194304 Global Const $ws_ex_rtlreading = 8192 Global Const $wm_gettextlength = 14 Global Const $wm_gettext = 13 Global Const $wm_size = 5 Global Const $wm_sizing = 532 Global Const $wm_user = 1024 Global Const $wm_create = 1 Global Const $wm_destroy = 2 Global Const $wm_move = 3 Global Const $wm_activate = 6 Global Const $wm_setfocus = 7 Global Const $wm_killfocus = 8 Global Const $wm_enable = 10 Global Const $wm_setredraw = 11 Global Const $wm_settext = 12 Global Const $wm_paint = 15 Global Const $wm_close = 16 Global Const $wm_queryendsession = 17 Global Const $wm_quit = 18 Global Const $wm_erasebkgnd = 20 Global Const $wm_queryopen = 19 Global Const $wm_syscolorchange = 21 Global Const $wm_endsession = 22 Global Const $wm_showwindow = 24 Global Const $wm_settingchange = 26 Global Const $wm_wininichange = 26 Global Const $wm_devmodechange = 27 Global Const $wm_activateapp = 28 Global Const $wm_fontchange = 29 Global Const $wm_timechange = 30 Global Const $wm_cancelmode = 31 Global Const $wm_ime_startcomposition = 269 Global Const $wm_ime_endcomposition = 270 Global Const $wm_ime_composition = 271 Global Const $wm_ime_keylast = 271 Global Const $wm_setcursor = 32 Global Const $wm_mouseactivate = 33 Global Const $wm_childactivate = 34 Global Const $wm_queuesync = 35 Global Const $wm_getminmaxinfo = 36 Global Const $wm_painticon = 38 Global Const $wm_iconerasebkgnd = 39 Global Const $wm_nextdlgctl = 40 Global Const $wm_spoolerstatus = 42 Global Const $wm_drawitem = 43 Global Const $wm_measureitem = 44 Global Const $wm_deleteitem = 45 Global Const $wm_vkeytoitem = 46 Global Const $wm_chartoitem = 47 Global Const $wm_setfont = 48 Global Const $wm_getfont = 49 Global Const $wm_sethotkey = 50 Global Const $wm_gethotkey = 51 Global Const $wm_querydragicon = 55 Global Const $wm_compareitem = 57 Global Const $wm_getobject = 61 Global Const $wm_compacting = 65 Global Const $wm_commnotify = 68 Global Const $wm_windowposchanging = 70 Global Const $wm_windowposchanged = 71 Global Const $wm_power = 72 Global Const $wm_notify = 78 Global Const $wm_copydata = 74 Global Const $wm_canceljournal = 75 Global Const $wm_inputlangchangerequest = 80 Global Const $wm_inputlangchange = 81 Global Const $wm_tcard = 82 Global Const $wm_help = 83 Global Const $wm_userchanged = 84 Global Const $wm_notifyformat = 85 Global Const $wm_parentnotify = 528 Global Const $wm_entermenuloop = 529 Global Const $wm_exitmenuloop = 530 Global Const $wm_nextmenu = 531 Global Const $wm_capturechanged = 533 Global Const $wm_moving = 534 Global Const $wm_powerbroadcast = 536 Global Const $wm_devicechange = 537 Global Const $wm_mdicreate = 544 Global Const $wm_mdidestroy = 545 Global Const $wm_mdiactivate = 546 Global Const $wm_mdirestore = 547 Global Const $wm_mdinext = 548 Global Const $wm_mdimaximize = 549 Global Const $wm_mditile = 550 Global Const $wm_mdicascade = 551 Global Const $wm_mdiiconarrange = 552 Global Const $wm_mdigetactive = 553 Global Const $wm_mdisetmenu = 560 Global Const $wm_entersizemove = 561 Global Const $wm_exitsizemove = 562 Global Const $wm_dropfiles = 563 Global Const $wm_mdirefreshmenu = 564 Global Const $wm_ime_setcontext = 641 Global Const $wm_ime_notify = 642 Global Const $wm_ime_control = 643 Global Const $wm_ime_compositionfull = 644 Global Const $wm_ime_select = 645 Global Const $wm_ime_char = 646 Global Const $wm_ime_request = 648 Global Const $wm_ime_keydown = 656 Global Const $wm_ime_keyup = 657 Global Const $wm_ncmousehover = 672 Global Const $wm_mousehover = 673 Global Const $wm_ncmouseleave = 674 Global Const $wm_mouseleave = 675 Global Const $wm_wtssession_change = 689 Global Const $wm_tablet_first = 704 Global Const $wm_tablet_last = 735 Global Const $wm_cut = 768 Global Const $wm_copy = 769 Global Const $wm_paste = 770 Global Const $wm_clear = 771 Global Const $wm_undo = 772 Global Const $wm_paletteischanging = 784 Global Const $wm_hotkey = 786 Global Const $wm_palettechanged = 785 Global Const $wm_print = 791 Global Const $wm_printclient = 792 Global Const $wm_appcommand = 793 Global Const $wm_querynewpalette = 783 Global Const $wm_themechanged = 794 Global Const $wm_handheldfirst = 856 Global Const $wm_handheldlast = 863 Global Const $wm_afxfirst = 864 Global Const $wm_afxlast = 895 Global Const $wm_penwinfirst = 896 Global Const $wm_penwinlast = 911 Global Const $wm_contextmenu = 123 Global Const $wm_stylechanging = 124 Global Const $wm_stylechanged = 125 Global Const $wm_displaychange = 126 Global Const $wm_geticon = 127 Global Const $wm_seticon = 128 Global Const $wm_nccreate = 129 Global Const $wm_ncdestroy = 130 Global Const $wm_nccalcsize = 131 Global Const $wm_nchittest = 132 Global Const $wm_ncpaint = 133 Global Const $wm_ncactivate = 134 Global Const $wm_getdlgcode = 135 Global Const $wm_syncpaint = 136 Global Const $wm_ncmousemove = 160 Global Const $wm_nclbuttondown = 161 Global Const $wm_nclbuttonup = 162 Global Const $wm_nclbuttondblclk = 163 Global Const $wm_ncrbuttondown = 164 Global Const $wm_ncrbuttonup = 165 Global Const $wm_ncrbuttondblclk = 166 Global Const $wm_ncmbuttondown = 167 Global Const $wm_ncmbuttonup = 168 Global Const $wm_ncmbuttondblclk = 169 Global Const $wm_ncxbuttondown = 171 Global Const $wm_ncxbuttonup = 172 Global Const $wm_ncxbuttondblclk = 173 Global Const $wm_keydown = 256 Global Const $wm_keyfirst = 256 Global Const $wm_keyup = 257 Global Const $wm_char = 258 Global Const $wm_deadchar = 259 Global Const $wm_syskeydown = 260 Global Const $wm_syskeyup = 261 Global Const $wm_syschar = 262 Global Const $wm_sysdeadchar = 263 Global Const $wm_keylast = 265 Global Const $wm_unichar = 265 Global Const $wm_initdialog = 272 Global Const $wm_command = 273 Global Const $wm_syscommand = 274 Global Const $wm_timer = 275 Global Const $wm_hscroll = 276 Global Const $wm_vscroll = 277 Global Const $wm_initmenu = 278 Global Const $wm_initmenupopup = 279 Global Const $wm_menuselect = 287 Global Const $wm_menuchar = 288 Global Const $wm_enteridle = 289 Global Const $wm_menurbuttonup = 290 Global Const $wm_menudrag = 291 Global Const $wm_menugetobject = 292 Global Const $wm_uninitmenupopup = 293 Global Const $wm_menucommand = 294 Global Const $wm_changeuistate = 295 Global Const $wm_updateuistate = 296 Global Const $wm_queryuistate = 297 Global Const $wm_ctlcolormsgbox = 306 Global Const $wm_ctlcoloredit = 307 Global Const $wm_ctlcolorlistbox = 308 Global Const $wm_ctlcolorbtn = 309 Global Const $wm_ctlcolordlg = 310 Global Const $wm_ctlcolorscrollbar = 311 Global Const $wm_ctlcolorstatic = 312 Global Const $wm_ctlcolor = 25 Global Const $mn_gethmenu = 481 Global Const $wm_app = 32768 Global Const $nm_first = 0 Global Const $nm_outofmemory = $nm_first - 1 Global Const $nm_click = $nm_first - 2 Global Const $nm_dblclk = $nm_first - 3 Global Const $nm_return = $nm_first - 4 Global Const $nm_rclick = $nm_first - 5 Global Const $nm_rdblclk = $nm_first - 6 Global Const $nm_setfocus = $nm_first - 7 Global Const $nm_killfocus = $nm_first - 8 Global Const $nm_customdraw = $nm_first - 12 Global Const $nm_hover = $nm_first - 13 Global Const $nm_nchittest = $nm_first - 14 Global Const $nm_keydown = $nm_first - 15 Global Const $nm_releasedcapture = $nm_first - 16 Global Const $nm_setcursor = $nm_first - 17 Global Const $nm_char = $nm_first - 18 Global Const $nm_tooltipscreated = $nm_first - 19 Global Const $nm_ldown = $nm_first - 20 Global Const $nm_rdown = $nm_first - 21 Global Const $nm_themechanged = $nm_first - 22 Global Const $wm_mousefirst = 512 Global Const $wm_mousemove = 512 Global Const $wm_lbuttondown = 513 Global Const $wm_lbuttonup = 514 Global Const $wm_lbuttondblclk = 515 Global Const $wm_rbuttondown = 516 Global Const $wm_rbuttonup = 517 Global Const $wm_rbuttondblclk = 518 Global Const $wm_mbuttondown = 519 Global Const $wm_mbuttonup = 520 Global Const $wm_mbuttondblclk = 521 Global Const $wm_mousewheel = 522 Global Const $wm_xbuttondown = 523 Global Const $wm_xbuttonup = 524 Global Const $wm_xbuttondblclk = 525 Global Const $wm_mousehwheel = 526 Global Const $ps_solid = 0 Global Const $ps_dash = 1 Global Const $ps_dot = 2 Global Const $ps_dashdot = 3 Global Const $ps_dashdotdot = 4 Global Const $ps_null = 5 Global Const $ps_insideframe = 6 Global Const $lwa_alpha = 2 Global Const $lwa_colorkey = 1 Global Const $rgn_and = 1 Global Const $rgn_or = 2 Global Const $rgn_xor = 3 Global Const $rgn_diff = 4 Global Const $rgn_copy = 5 Global Const $errorregion = 0 Global Const $nullregion = 1 Global Const $simpleregion = 2 Global Const $complexregion = 3 Global Const $transparent = 1 Global Const $opaque = 2 Global Const $ccm_first = 8192 Global Const $ccm_getunicodeformat = ($ccm_first + 6) Global Const $ccm_setunicodeformat = ($ccm_first + 5) Global Const $ccm_setbkcolor = $ccm_first + 1 Global Const $ccm_setcolorscheme = $ccm_first + 2 Global Const $ccm_getcolorscheme = $ccm_first + 3 Global Const $ccm_getdroptarget = $ccm_first + 4 Global Const $ccm_setwindowtheme = $ccm_first + 11 Global Const $ga_parent = 1 Global Const $ga_root = 2 Global Const $ga_rootowner = 3 Global Const $sm_cxscreen = 0 Global Const $sm_cyscreen = 1 Global Const $sm_cxvscroll = 2 Global Const $sm_cyhscroll = 3 Global Const $sm_cycaption = 4 Global Const $sm_cxborder = 5 Global Const $sm_cyborder = 6 Global Const $sm_cxdlgframe = 7 Global Const $sm_cydlgframe = 8 Global Const $sm_cyvthumb = 9 Global Const $sm_cxhthumb = 10 Global Const $sm_cxicon = 11 Global Const $sm_cyicon = 12 Global Const $sm_cxcursor = 13 Global Const $sm_cycursor = 14 Global Const $sm_cymenu = 15 Global Const $sm_cxfullscreen = 16 Global Const $sm_cyfullscreen = 17 Global Const $sm_cykanjiwindow = 18 Global Const $sm_mousepresent = 19 Global Const $sm_cyvscroll = 20 Global Const $sm_cxhscroll = 21 Global Const $sm_debug = 22 Global Const $sm_swapbutton = 23 Global Const $sm_reserved1 = 24 Global Const $sm_reserved2 = 25 Global Const $sm_reserved3 = 26 Global Const $sm_reserved4 = 27 Global Const $sm_cxmin = 28 Global Const $sm_cymin = 29 Global Const $sm_cxsize = 30 Global Const $sm_cysize = 31 Global Const $sm_cxframe = 32 Global Const $sm_cyframe = 33 Global Const $sm_cxmintrack = 34 Global Const $sm_cymintrack = 35 Global Const $sm_cxdoubleclk = 36 Global Const $sm_cydoubleclk = 37 Global Const $sm_cxiconspacing = 38 Global Const $sm_cyiconspacing = 39 Global Const $sm_menudropalignment = 40 Global Const $sm_penwindows = 41 Global Const $sm_dbcsenabled = 42 Global Const $sm_cmousebuttons = 43 Global Const $sm_secure = 44 Global Const $sm_cxedge = 45 Global Const $sm_cyedge = 46 Global Const $sm_cxminspacing = 47 Global Const $sm_cyminspacing = 48 Global Const $sm_cxsmicon = 49 Global Const $sm_cysmicon = 50 Global Const $sm_cysmcaption = 51 Global Const $sm_cxsmsize = 52 Global Const $sm_cysmsize = 53 Global Const $sm_cxmenusize = 54 Global Const $sm_cymenusize = 55 Global Const $sm_arrange = 56 Global Const $sm_cxminimized = 57 Global Const $sm_cyminimized = 58 Global Const $sm_cxmaxtrack = 59 Global Const $sm_cymaxtrack = 60 Global Const $sm_cxmaximized = 61 Global Const $sm_cymaximized = 62 Global Const $sm_network = 63 Global Const $sm_cleanboot = 67 Global Const $sm_cxdrag = 68 Global Const $sm_cydrag = 69 Global Const $sm_showsounds = 70 Global Const $sm_cxmenucheck = 71 Global Const $sm_cymenucheck = 72 Global Const $sm_slowmachine = 73 Global Const $sm_mideastenabled = 74 Global Const $sm_mousewheelpresent = 75 Global Const $sm_xvirtualscreen = 76 Global Const $sm_yvirtualscreen = 77 Global Const $sm_cxvirtualscreen = 78 Global Const $sm_cyvirtualscreen = 79 Global Const $sm_cmonitors = 80 Global Const $sm_samedisplayformat = 81 Global Const $sm_immenabled = 82 Global Const $sm_cxfocusborder = 83 Global Const $sm_cyfocusborder = 84 Global Const $sm_tabletpc = 86 Global Const $sm_mediacenter = 87 Global Const $sm_starter = 88 Global Const $sm_serverr2 = 89 Global Const $sm_cmetrics = 90 Global Const $sm_remotesession = 4096 Global Const $sm_shuttingdown = 8192 Global Const $sm_remotecontrol = 8193 Global Const $sm_caretblinkingenabled = 8194 Global Const $blackness = 66 Global Const $captureblt = 1073741824 Global Const $dstinvert = 5570569 Global Const $mergecopy = 12583114 Global Const $mergepaint = 12255782 Global Const $nomirrorbitmap = -2147483648 Global Const $notsrccopy = 3342344 Global Const $notsrcerase = 1114278 Global Const $patcopy = 15728673 Global Const $patinvert = 5898313 Global Const $patpaint = 16452105 Global Const $srcand = 8913094 Global Const $srccopy = 13369376 Global Const $srcerase = 4457256 Global Const $srcinvert = 6684742 Global Const $srcpaint = 15597702 Global Const $whiteness = 16711778 Global Const $dt_bottom = 8 Global Const $dt_calcrect = 1024 Global Const $dt_center = 1 Global Const $dt_editcontrol = 8192 Global Const $dt_end_ellipsis = 32768 Global Const $dt_expandtabs = 64 Global Const $dt_externalleading = 512 Global Const $dt_hideprefix = 1048576 Global Const $dt_internal = 4096 Global Const $dt_left = 0 Global Const $dt_modifystring = 65536 Global Const $dt_noclip = 256 Global Const $dt_nofullwidthcharbreak = 524288 Global Const $dt_noprefix = 2048 Global Const $dt_path_ellipsis = 16384 Global Const $dt_prefixonly = 2097152 Global Const $dt_right = 2 Global Const $dt_rtlreading = 131072 Global Const $dt_singleline = 32 Global Const $dt_tabstop = 128 Global Const $dt_top = 0 Global Const $dt_vcenter = 4 Global Const $dt_wordbreak = 16 Global Const $dt_word_ellipsis = 262144 Global Const $rdw_erase = 4 Global Const $rdw_frame = 1024 Global Const $rdw_internalpaint = 2 Global Const $rdw_invalidate = 1 Global Const $rdw_noerase = 32 Global Const $rdw_noframe = 2048 Global Const $rdw_nointernalpaint = 16 Global Const $rdw_validate = 8 Global Const $rdw_erasenow = 512 Global Const $rdw_updatenow = 256 Global Const $rdw_allchildren = 128 Global Const $rdw_nochildren = 64 Global Const $wm_renderformat = 773 Global Const $wm_renderallformats = 774 Global Const $wm_destroyclipboard = 775 Global Const $wm_drawclipboard = 776 Global Const $wm_paintclipboard = 777 Global Const $wm_vscrollclipboard = 778 Global Const $wm_sizeclipboard = 779 Global Const $wm_askcbformatname = 780 Global Const $wm_changecbchain = 781 Global Const $wm_hscrollclipboard = 782 Global Const $hterror = -2 Global Const $httransparent = -1 Global Const $htnowhere = 0 Global Const $htclient = 1 Global Const $htcaption = 2 Global Const $htsysmenu = 3 Global Const $htgrowbox = 4 Global Const $htsize = $htgrowbox Global Const $htmenu = 5 Global Const $hthscroll = 6 Global Const $htvscroll = 7 Global Const $htminbutton = 8 Global Const $htmaxbutton = 9 Global Const $htleft = 10 Global Const $htright = 11 Global Const $httop = 12 Global Const $httopleft = 13 Global Const $httopright = 14 Global Const $htbottom = 15 Global Const $htbottomleft = 16 Global Const $htbottomright = 17 Global Const $htborder = 18 Global Const $htreduce = $htminbutton Global Const $htzoom = $htmaxbutton Global Const $htsizefirst = $htleft Global Const $htsizelast = $htbottomright Global Const $htobject = 19 Global Const $htclose = 20 Global Const $hthelp = 21 Global Const $color_scrollbar = 0 Global Const $color_background = 1 Global Const $color_activecaption = 2 Global Const $color_inactivecaption = 3 Global Const $color_menu = 4 Global Const $color_window = 5 Global Const $color_windowframe = 6 Global Const $color_menutext = 7 Global Const $color_windowtext = 8 Global Const $color_captiontext = 9 Global Const $color_activeborder = 10 Global Const $color_inactiveborder = 11 Global Const $color_appworkspace = 12 Global Const $color_highlight = 13 Global Const $color_highlighttext = 14 Global Const $color_btnface = 15 Global Const $color_btnshadow = 16 Global Const $color_graytext = 17 Global Const $color_btntext = 18 Global Const $color_inactivecaptiontext = 19 Global Const $color_btnhighlight = 20 Global Const $color_3ddkshadow = 21 Global Const $color_3dlight = 22 Global Const $color_infotext = 23 Global Const $color_infobk = 24 Global Const $color_hotlight = 26 Global Const $color_gradientactivecaption = 27 Global Const $color_gradientinactivecaption = 28 Global Const $color_menuhilight = 29 Global Const $color_menubar = 30 Global Const $color_desktop = 1 Global Const $color_3dface = 15 Global Const $color_3dshadow = 16 Global Const $color_3dhighlight = 20 Global Const $color_3dhilight = 20 Global Const $color_btnhilight = 20 Global Const $hinst_commctrl = -1 Global Const $idb_std_small_color = 0 Global Const $idb_std_large_color = 1 Global Const $idb_view_small_color = 4 Global Const $idb_view_large_color = 5 Global Const $idb_hist_small_color = 8 Global Const $idb_hist_large_color = 9 Global Const $startf_forceofffeedback = 128 Global Const $startf_forceonfeedback = 64 Global Const $startf_runfullscreen = 32 Global Const $startf_usecountchars = 8 Global Const $startf_usefillattribute = 16 Global Const $startf_usehotkey = 512 Global Const $startf_useposition = 4 Global Const $startf_useshowwindow = 1 Global Const $startf_usesize = 2 Global Const $startf_usestdhandles = 256 Global Const $cdds_prepaint = 1 Global Const $cdds_postpaint = 2 Global Const $cdds_preerase = 3 Global Const $cdds_posterase = 4 Global Const $cdds_item = 65536 Global Const $cdds_itemprepaint = 65537 Global Const $cdds_itempostpaint = 65538 Global Const $cdds_itempreerase = 65539 Global Const $cdds_itemposterase = 65540 Global Const $cdds_subitem = 131072 Global Const $cdis_selected = 1 Global Const $cdis_grayed = 2 Global Const $cdis_disabled = 4 Global Const $cdis_checked = 8 Global Const $cdis_focus = 16 Global Const $cdis_default = 32 Global Const $cdis_hot = 64 Global Const $cdis_marked = 128 Global Const $cdis_indeterminate = 256 Global Const $cdis_showkeyboardcues = 512 Global Const $cdis_nearhot = 1024 Global Const $cdis_othersidehot = 2048 Global Const $cdis_drophilited = 4096 Global Const $cdrf_dodefault = 0 Global Const $cdrf_newfont = 2 Global Const $cdrf_skipdefault = 4 Global Const $cdrf_notifypostpaint = 16 Global Const $cdrf_notifyitemdraw = 32 Global Const $cdrf_notifysubitemdraw = 32 Global Const $cdrf_notifyposterase = 64 Global Const $cdrf_doerase = 8 Global Const $cdrf_skippostpaint = 256 Global Const $gui_ss_default_gui = BitOR($ws_minimizebox, $ws_caption, $ws_popup, $ws_sysmenu) Global $iguiwidth = 336 Global $iguiheight = 311 Global $iguixpos = (@DesktopWidth / 2) - $iguiwidth / 2 Global $iguiypos = (@DesktopHeight / 2) - $iguiheight / 2 #Region ### START Koda GUI section ### Form=F:\Learn_AutoIT\Healthcast Timeouts\HealthCast.kxf Global $form1 = GUICreate("Update Healthcast Timeouts", $iguiwidth, $iguiheight, $iguixpos, $iguiypos) GUISetBkColor(16777215) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") Global $group1 = GUICtrlCreateGroup("Healthcast Lock Timeouts", 40, 120, 257, 121) Global $tenhourraido = GUICtrlCreateRadio("10hr Lock Timeout - Surgery", 56, 144, 169, 17) Global $sumradio = GUICtrlCreateRadio("SUM Default Lock Timeout", 56, 192, 169, 17) Global $dragontimeradio = GUICtrlCreateRadio("Dragon Kiosk Default Lock Timeout", 56, 216, 193, 17) Global $thirtyoneradiobutton = GUICtrlCreateRadio("31 Min Lock Timeout - ED MD Computers", 56, 168, 209, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) Global $label1 = GUICtrlCreateLabel("Computer Name:", 40, 80, 138, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") Global $compnameinput = GUICtrlCreateInput("", 184, 80, 121, 21) Global $updateregbutton = GUICtrlCreateButton("Update Registry", 48, 256, 155, 41) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") Global $pic1 = GUICtrlCreatePic("\\pathtofile\Color_Logo Horizontal.jpg", 32, 8, 263, 52) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $computername Global $msgone Global $msgtwo $msgone = "The registry settings have been updated on " $msgtwo = "Please reboot for settings to take effect, would you like to reboot now?" While 1 $nmsg = GUIGetMsg() Switch $nmsg Case $gui_event_close Exit Case $updateregbutton $computername = GUICtrlRead($compnameinput) If GUICtrlRead($tenhourraido) = 1 Then RegWrite("\\" & $computername & "\HKEY_LOCAL_MACHINE\SOFTWARE\HealthCast\eXactACCESS", "LockTimeLimit", "REG_DWORD", 35700) _reboot() ElseIf GUICtrlRead($sumradio) = 1 Then RegWrite("\\" & $computername & "\HKEY_LOCAL_MACHINE\SOFTWARE\HealthCast\eXactACCESS", "LockTimeLimit", "REG_DWORD", 600) _reboot() ElseIf GUICtrlRead($dragontimeradio) = 1 Then RegWrite("\\" & $computername & "\HKEY_LOCAL_MACHINE\SOFTWARE\HealthCast\eXactACCESS", "LockTimeLimit", "REG_DWORD", 300) _reboot() ElseIf GUICtrlRead($thirtyoneradiobutton) = 1 Then RegWrite("\\" & $computername & "\HKEY_LOCAL_MACHINE\SOFTWARE\HealthCast\eXactACCESS", "LockTimeLimit", "REG_DWORD", 1860) _reboot() EndIf Exit EndSwitch WEnd Func _reboot() Sleep(3000) $t = MsgBox(4, "Registry Updated", $msgone & $computername & @CRLF & $msgtwo) If $t = 6 Then Run("Shutdown -r -m \\" & $computername) ElseIf $t = 2 Then Exit EndIf EndFunc 
Any help would be appreciated.
submitted by Atticus_of_Finch to autoit [link] [comments]


2019.02.14 17:46 slyvester12 How to add image in every question using this code ?

import javax.swing.*; import javax.swing.border.EmptyBorder;
import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class test2 extends JFrame {
private JPanel contentPane; JLabel labelQuestion; Question q1; Question q2; Question q3; Question q4; Question q5; Question q6; Question q7; Question q8; Question q9; Question q10; Question q11; JRadioButton rbchoice1; JRadioButton rbchoice2; JRadioButton rbchoice3; JRadioButton rbchoice4; int questionNum = 1; int score = 0; int selected; // Question q1 = new Question(); /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { test2 frame = new test2(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public void initializeQuestions() { q1 = new Question(); q1.setQuestion(1, "Which statement generates a random number between 1 and 100?"); q1.setChoice(1, "number = Math.random() * 100 + 1;"); q1.setChoice(2, "number = Math.random() * 100 - 1;"); q1.setChoice(3, "number = Math.random() * 99 + 1;"); q1.setChoice(4, "number = Math.random(100);"); q1.setAnswer(1); q2 = new Question(); q2.setQuestion(1, "Which of the following variable names is NOT valid?"); q2.setChoice(1, "pShape"); q2.setChoice(2, "ThirdClass"); q2.setChoice(3, "3rdClass"); q2.setChoice(4, "discount"); q2.setAnswer(3); q3 = new Question(); q3.setQuestion(1, "Which of the following is one of the Java primitive types?"); q3.setChoice(1, "boolean"); q3.setChoice(2, "double"); q3.setChoice(3, "int"); q3.setChoice(4, "all of the above"); q3.setAnswer(4); q4 = new Question(); q4.setQuestion(1, "Which of the following is not a primitive data type?"); q4.setChoice(1, "float"); q4.setChoice(2, "double"); q4.setChoice(3, "char"); q4.setChoice(4, "String"); q4.setAnswer(4); q5 = new Question(); q5.setQuestion(1, "Which statement must be included to use Math.PI in your program?"); q5.setChoice(1, "import java.lang.*;"); q5.setChoice(2, "import java.util.*;"); q5.setChoice(3, "public class Math"); q5.setChoice(4, "public static void main()"); q5.setAnswer(1); q6 = new Question(); q6.setQuestion(1, "Which statement will increment total by 1?"); q6.setChoice(1, "total = 1;"); q6.setChoice(2, "total++;"); q6.setChoice(3, "total--;"); q6.setChoice(4, "total += total;"); q6.setAnswer(2); q7 = new Question(); q7.setQuestion(1, "The statement x += 2; is equivalent to?"); q7.setChoice(1, "x = x + 2;"); q7.setChoice(2, "x = x + 1 = x + 1;"); q7.setChoice(3, "++x;"); q7.setChoice(4, "x++;"); q7.setAnswer(1); q8 = new Question(); q8.setQuestion(1, "In a switch statement what must come after every case?"); q8.setChoice(1, "switch"); q8.setChoice(2, "break"); q8.setChoice(3, "default"); q8.setChoice(4, "cout"); q8.setAnswer(2); q9 = new Question(); q9.setQuestion(1, "Which of the following for headers is not valid?"); q9.setChoice(1, "for ( int i = 0; i < 10; i++ )"); q9.setChoice(2, "int i = 0; for ( ; i < 10; i++ )"); q9.setChoice(3, "for ( int i = 0; int j = 5; ; i++ )"); q9.setChoice(4, "All of the above"); q9.setAnswer(3); q10 = new Question(); q10.setQuestion(1, "An array is not:"); q10.setChoice(1, "a consecutive group of memory locations."); q10.setChoice(2, "subscripted by integers."); q10.setChoice(3, "declared using braces, []."); q10.setChoice(4, "made up of different data types."); q10.setAnswer(4); q11 = new Question(); q11.setQuestion(1, "Your score is: " + score + "/10"); q11.setChoice(1, ""); q11.setChoice(2, ""); q11.setChoice(3, ""); q11.setChoice(4, ""); q11.setAnswer(4); } /** * place the question data in the JLabel and RadioButtons */ /** * Create the frame. */ public test2() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblJavaQuestionsMultiple = new JLabel(" Java Multiple Choice Test!"); lblJavaQuestionsMultiple.setBounds(138, 11, 192, 14); contentPane.add(lblJavaQuestionsMultiple); labelQuestion = new JLabel(""); labelQuestion.setBounds(10, 57, 419, 14); contentPane.add(labelQuestion); rbchoice1 = new JRadioButton(""); rbchoice1.setBounds(111, 77, 275, 21); contentPane.add(rbchoice1); rbchoice2 = new JRadioButton(""); rbchoice2.setBounds(111, 104, 275, 21); contentPane.add(rbchoice2); rbchoice3 = new JRadioButton(""); rbchoice3.setBounds(111, 131, 275, 21); contentPane.add(rbchoice3); rbchoice4 = new JRadioButton(""); rbchoice4.setBounds(111, 158, 275, 21); contentPane.add(rbchoice4); // rbchoiceD.isSelected() ButtonGroup group = new ButtonGroup(); group.add(rbchoice1); group.add(rbchoice2); group.add(rbchoice3); group.add(rbchoice4); JButton btnNext = new JButton("Next"); btnNext.setBounds(336, 235, 93, 23); btnNext.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { // nextQuestion( ??? ); if (rbchoice1.isSelected()) { selected = 1; } else if (rbchoice2.isSelected()) { selected = 2; } else if (rbchoice3.isSelected()) { selected = 3; } else if (rbchoice4.isSelected()) { selected = 5; } if (questionNum == 1 && selected == 1) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else if (questionNum == 2 && selected == 3) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else if (questionNum == 3 && selected == 4) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else if (questionNum == 4 && selected == 4) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else if (questionNum == 5 && selected == 1) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else if (questionNum == 6 && selected == 2) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else if (questionNum == 7 && selected == 1) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else if (questionNum == 8 && selected == 2) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else if (questionNum == 9 && selected == 3) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else if (questionNum == 10 && selected == 4) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else { JOptionPane.showMessageDialog(null, "Incorrect"); } if (questionNum == 1) { nextQuestion(q2); group.clearSelection(); questionNum++; } else if (questionNum == 2) { nextQuestion(q3); group.clearSelection(); questionNum++; } else if (questionNum == 3) { nextQuestion(q4); group.clearSelection(); questionNum++; } else if (questionNum == 4) { nextQuestion(q5); group.clearSelection(); questionNum++; } else if (questionNum == 5) { nextQuestion(q6); group.clearSelection(); questionNum++; } else if (questionNum == 6) { nextQuestion(q7); group.clearSelection(); questionNum++; } else if (questionNum == 7) { nextQuestion(q8); group.clearSelection(); questionNum++; } else if (questionNum == 8) { nextQuestion(q9); group.clearSelection(); questionNum++; } else if (questionNum == 9) { nextQuestion(q10); group.clearSelection(); questionNum++; } else if (questionNum == 10) { nextQuestion(q11); group.clearSelection(); }else if (questionNum == 10) { System.out.println(score); initializeQuestions(); nextQuestion(q11); } }}); contentPane.add(btnNext); JLabel scoreLabel = new JLabel(""); scoreLabel.setBounds(201, 208, 46, 14); contentPane.add(scoreLabel); initializeQuestions(); nextQuestion(q1); } public void nextQuestion(Question q) { // labelQuestion.setText( q.getQuestion() ); rbchoice1.setText(q.getChoice(1)); rbchoice2.setText(q.getChoice(2)); rbchoice3.setText(q.getChoice(3)); rbchoice4.setText(q.getChoice(4)); } } 
submitted by slyvester12 to CodingHelp [link] [comments]


2019.02.14 17:24 slyvester12 how do i add picture for each question using this code ?

import javax.swing.*; import javax.swing.border.EmptyBorder;
import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class test2 extends JFrame {
private JPanel contentPane; JLabel labelQuestion; Question q1; Question q2; Question q3; Question q4; Question q5; Question q6; Question q7; Question q8; Question q9; Question q10; Question q11; JRadioButton rbchoice1; JRadioButton rbchoice2; JRadioButton rbchoice3; JRadioButton rbchoice4; int questionNum = 1; int score = 0; int selected; // Question q1 = new Question(); /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { test2 frame = new test2(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public void initializeQuestions() { q1 = new Question(); q1.setQuestion(1, "Which statement generates a random number between 1 and 100?"); q1.setChoice(1, "number = Math.random() * 100 + 1;"); q1.setChoice(2, "number = Math.random() * 100 - 1;"); q1.setChoice(3, "number = Math.random() * 99 + 1;"); q1.setChoice(4, "number = Math.random(100);"); q1.setAnswer(1); q2 = new Question(); q2.setQuestion(1, "Which of the following variable names is NOT valid?"); q2.setChoice(1, "pShape"); q2.setChoice(2, "ThirdClass"); q2.setChoice(3, "3rdClass"); q2.setChoice(4, "discount"); q2.setAnswer(3); q3 = new Question(); q3.setQuestion(1, "Which of the following is one of the Java primitive types?"); q3.setChoice(1, "boolean"); q3.setChoice(2, "double"); q3.setChoice(3, "int"); q3.setChoice(4, "all of the above"); q3.setAnswer(4); q4 = new Question(); q4.setQuestion(1, "Which of the following is not a primitive data type?"); q4.setChoice(1, "float"); q4.setChoice(2, "double"); q4.setChoice(3, "char"); q4.setChoice(4, "String"); q4.setAnswer(4); q5 = new Question(); q5.setQuestion(1, "Which statement must be included to use Math.PI in your program?"); q5.setChoice(1, "import java.lang.*;"); q5.setChoice(2, "import java.util.*;"); q5.setChoice(3, "public class Math"); q5.setChoice(4, "public static void main()"); q5.setAnswer(1); q6 = new Question(); q6.setQuestion(1, "Which statement will increment total by 1?"); q6.setChoice(1, "total = 1;"); q6.setChoice(2, "total++;"); q6.setChoice(3, "total--;"); q6.setChoice(4, "total += total;"); q6.setAnswer(2); q7 = new Question(); q7.setQuestion(1, "The statement x += 2; is equivalent to?"); q7.setChoice(1, "x = x + 2;"); q7.setChoice(2, "x = x + 1 = x + 1;"); q7.setChoice(3, "++x;"); q7.setChoice(4, "x++;"); q7.setAnswer(1); q8 = new Question(); q8.setQuestion(1, "In a switch statement what must come after every case?"); q8.setChoice(1, "switch"); q8.setChoice(2, "break"); q8.setChoice(3, "default"); q8.setChoice(4, "cout"); q8.setAnswer(2); q9 = new Question(); q9.setQuestion(1, "Which of the following for headers is not valid?"); q9.setChoice(1, "for ( int i = 0; i < 10; i++ )"); q9.setChoice(2, "int i = 0; for ( ; i < 10; i++ )"); q9.setChoice(3, "for ( int i = 0; int j = 5; ; i++ )"); q9.setChoice(4, "All of the above"); q9.setAnswer(3); q10 = new Question(); q10.setQuestion(1, "An array is not:"); q10.setChoice(1, "a consecutive group of memory locations."); q10.setChoice(2, "subscripted by integers."); q10.setChoice(3, "declared using braces, []."); q10.setChoice(4, "made up of different data types."); q10.setAnswer(4); q11 = new Question(); q11.setQuestion(1, "Your score is: " + score + "/10"); q11.setChoice(1, ""); q11.setChoice(2, ""); q11.setChoice(3, ""); q11.setChoice(4, ""); q11.setAnswer(4); } /** * place the question data in the JLabel and RadioButtons */ /** * Create the frame. */ public test2() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblJavaQuestionsMultiple = new JLabel(" Java Multiple Choice Test!"); lblJavaQuestionsMultiple.setBounds(138, 11, 192, 14); contentPane.add(lblJavaQuestionsMultiple); labelQuestion = new JLabel(""); labelQuestion.setToolTipText("question"); labelQuestion.setBounds(10, 57, 419, 14); contentPane.add(labelQuestion); rbchoice1 = new JRadioButton(""); rbchoice1.setBounds(111, 77, 275, 21); contentPane.add(rbchoice1); rbchoice2 = new JRadioButton(""); rbchoice2.setBounds(111, 104, 275, 21); contentPane.add(rbchoice2); rbchoice3 = new JRadioButton(""); rbchoice3.setBounds(111, 131, 275, 21); contentPane.add(rbchoice3); rbchoice4 = new JRadioButton(""); rbchoice4.setBounds(111, 158, 275, 21); contentPane.add(rbchoice4); // rbchoiceD.isSelected() ButtonGroup group = new ButtonGroup(); group.add(rbchoice1); group.add(rbchoice2); group.add(rbchoice3); group.add(rbchoice4); JButton btnNext = new JButton("Next"); btnNext.setBounds(336, 235, 93, 23); btnNext.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { // nextQuestion( ??? ); if (rbchoice1.isSelected()) { selected = 1; } else if (rbchoice2.isSelected()) { selected = 2; } else if (rbchoice3.isSelected()) { selected = 3; } else if (rbchoice4.isSelected()) { selected = 5; } if (questionNum == 1 && selected == 1) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else if (questionNum == 2 && selected == 3) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else if (questionNum == 3 && selected == 4) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else if (questionNum == 4 && selected == 4) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else if (questionNum == 5 && selected == 1) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else if (questionNum == 6 && selected == 2) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else if (questionNum == 7 && selected == 1) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else if (questionNum == 8 && selected == 2) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else if (questionNum == 9 && selected == 3) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else if (questionNum == 10 && selected == 4) { JOptionPane.showMessageDialog(null, "Correct"); score++; } else { JOptionPane.showMessageDialog(null, "Incorrect"); } if (questionNum == 1) { nextQuestion(q2); group.clearSelection(); questionNum++; } else if (questionNum == 2) { nextQuestion(q3); group.clearSelection(); questionNum++; } else if (questionNum == 3) { nextQuestion(q4); group.clearSelection(); questionNum++; } else if (questionNum == 4) { nextQuestion(q5); group.clearSelection(); questionNum++; } else if (questionNum == 5) { nextQuestion(q6); group.clearSelection(); questionNum++; } else if (questionNum == 6) { nextQuestion(q7); group.clearSelection(); questionNum++; } else if (questionNum == 7) { nextQuestion(q8); group.clearSelection(); questionNum++; } else if (questionNum == 8) { nextQuestion(q9); group.clearSelection(); questionNum++; } else if (questionNum == 9) { nextQuestion(q10); group.clearSelection(); questionNum++; } else if (questionNum == 10) { nextQuestion(q11); group.clearSelection(); }else if (questionNum == 10) { System.out.println(score); initializeQuestions(); nextQuestion(q11); } }}); contentPane.add(btnNext); JLabel scoreLabel = new JLabel(""); scoreLabel.setBounds(201, 208, 46, 14); contentPane.add(scoreLabel); initializeQuestions(); nextQuestion(q1); } public void nextQuestion(Question q) { // labelQuestion.setText( q.getQuestion() ); labelQuestion.setText(q.getQuestion(1)); rbchoice1.setText(q.getChoice(1)); rbchoice2.setText(q.getChoice(2)); rbchoice3.setText(q.getChoice(3)); rbchoice4.setText(q.getChoice(4)); } } 
submitted by slyvester12 to javahelp [link] [comments]


2018.12.03 19:32 eonbre Tkinter exercise

I was wondering what is wrong with my code.
I am trying to create window in tkinter that has menu.In that menu there should be 1 label called Glavno Meni.When i click on that label it opens sub menu and it has label hey.When i click on that label it opens new window like i want.In that window i have 1 label and 2 radiobuttons.What i want is to get values from those radiobuttons,and see if user selected TRUE to give him +point,if he selected False to take point away from him.But my program is always just printing
An option must be selected
You have 0 poeni


from tkinter import * import webbrowser def donothing(): filewin=Toplevel(root) button=Button(filewin,text="you have not defined anything!") button.pack() class Window(Frame): def __init__(self,master=NONE): Frame.__init__(self,master) self.master=master self.init_window() root.geometry("900x700") def init_window(self): self.master.title("hey") self.pack(fill=BOTH,expand=1) self.menubar=Menu(self.master) self.glavnomeni=Menu(self.menubar) self.menubar.add_cascade(label="Glavno Meni",menu=self.glavnomeni) self.top=Toplevel(menu=self.menubar,width=1000,relief=RAISED,borderwidth=2) self.glavnomeni.choices=Menu(self.glavnomeni) self.glavnomeni.choices.list=Menu(self.glavnomeni.choices) self.glavnomeni.choices.list.add_command(label='hey') self.glavnomeni.add_cascade(label='hey',command=new_winF) def new_winF(): # new window definition buttonstr=StringVar() newwin = Toplevel(root) display = Label(newwin, text="Dali e messi podobar od Ronaldo?") display.pack() R1=Radiobutton(newwin,text="TRUE",value=1,variable=buttonstr,command=validate) R1.pack() R2=Radiobutton(newwin,text="FALSE",value=2,variable=buttonstr,command=validate) R2.pack() b=Button(newwin,text="submit",command=validate) b.pack() root.geometry("900x700") def validate(): buttonstr=StringVar() value = buttonstr.get() pluspoeni=0; if value == 1: print("You are wrong.Ronaldo is better than Messi") pluspoeni=pluspoeni+1; elif value == 2: print("You are right.Ronaldo is better than Messi") pluspoeni=pluspoeni-1; else: print("An option must be selected") print("You have",pluspoeni,"poeni") root = Tk() root.withdraw() app = Window(root) root.mainloop() if __name__ == '__main__': main() main() 
"SOLUTION" Here is the solution
from Tkinter import * import webbrowser
def donothing(): filewin=Toplevel(root) button=Button(filewin,text="you have not defined anything!") button.pack()
class Window(Frame): def init(self,master=NONE): Frame.init(self,master) self.master=master self.init_window() root.geometry("900x700") self.pluspoeni=0;
def init_window(self): self.master.title("hey") self.pack(fill=BOTH,expand=1) self.menubar=Menu(self.master) self.glavnomeni=Menu(self.menubar) self.menubar.add_cascade(label="Glavno Meni",menu=self.glavnomeni) self.top=Toplevel(menu=self.menubar,width=1000,relief=RAISED,borderwidth=2) self.glavnomeni.choices=Menu(self.glavnomeni) self.glavnomeni.choices.list=Menu(self.glavnomeni.choices) self.glavnomeni.choices.list.add_command(label='hey') self.glavnomeni.add_cascade(label='hey',command=self.new_winF) def new_winF(self): # new window definition self.buttonstr=IntVar() newwin = Toplevel(root) display = Label(newwin, text="Dali e messi podobar od Ronaldo?") display.pack() R1=Radiobutton(newwin,text="TRUE",value=1,variable=self.buttonstr,command=self.validate) R1.pack() R2=Radiobutton(newwin,text="FALSE",value=2,variable=self.buttonstr,command=self.validate) R2.pack() b=Button(newwin,text="submit",command=self.validate) b.pack() root.geometry("900x700") def validate(self): value = self.buttonstr.get() if value == 1: print("You are wrong.Ronaldo is better than Messi") self.pluspoeni += 1; print("You have points",self.pluspoeni) elif value == 2: print("You are right.Ronaldo is better than Messi") self.pluspoeni -= 1; print("You have points",self.pluspoeni) else: print("An option must be selected") print("You have",self.pluspoeni,"poeni") 
root = Tk() root.withdraw() app = Window(root) root.mainloop()
I just put counter variable pluspoeni at init_window function and also used self as argument in validate,and new_winF so everything can be accessed by everyone in that class.
It's also good to remove command=self.validate from R1 and R2 variables and just keep it to variable b,so it only checks the value after you clicked submit button.
submitted by eonbre to learnpython [link] [comments]


2018.06.08 14:06 pyrovoice [Asp.net MVC] CheckBoxFor and RadioButtonFor in same view, using same Model

For a quizz website, I want to display a list of questions, some with multiple possible answers and some with only one possible answer, using accordingly CheckBoxFor and RadioButtonFor.
Currently, the Model I use is Question containing a list of Answer, each answer containing its text. Then, depending on the solution, I either have a list of SelectedAnswersId in Question, or a IsSelected property in every Answer.
CheckBoxFor expect a BooleanProperty to set to true or false while RadioButtonFor expect the Model property to set to a given value when selected, and uses that property to set the "name" attribute in HTML to create the groups : CheckBofFor(BooleanProperty), RadioButtonFor(ModelProperty, Value)
So to remember the selected Answers, I can either make a list of selected answer's ID in my Question Model, so that RadioButtons for a single question will all point to the same Property, and thus work as a group, but CheckBoxFor won't work since the information is not a boolean value
OR I can register in the Answer itself if it is selected or not with a IsSelected boolean property, so that it will work with CheckBoxFor, but then RadioButtons won't work as a group since they will all point ot a different property.
How can I solve one or the other problem ?
edit: Here are the models, page and view edit: Here are the models, page and view
The Question Model
public enum QuestionField { Chaser, Beater, Seeker, Contact, Process, Other }; public enum QuestionDifficulty { Basic, Advanced }; public enum AnswerType { SingleAnswer, MultipleAnswer } public class Question { public int Id { get; set; } [Required(ErrorMessage = "Question name not valid")] public string Name { get; set; } [Required] public QuestionField Field { get; set; } [Required] public QuestionDifficulty Difficulty { get; set; } [Required] public bool IsVideo { get; set; } public string VideoURL { get; set; } [Required] public string QuestionText { get; set; } [Required] public AnswerType AnswerType { get; set; } [Required] public List Answers { get; set; } [Required] public String AnswerExplanation { get; set; } //...// 
The Answer Model
public class Answer { public int Id { get; set; } public String Answertext { get; set; } public Boolean IsTrue { get; set; } public Boolean IsSelected { get; set; } } 
The Quizz cshtml
@model QRefTrain3.ViewModel.QuizzViewModel //...// @if (@Model.DisplayedQuestions[i].AnswerType == QRefTrain3.Models.AnswerType.SingleAnswer) { 
@for (int j = 0; j < Model.DisplayedQuestions[i].Answers.Count; j++) { @Model.DisplayedQuestions[i].Answers[j].Answertext @Html.RadioButtonFor(m => m.DisplayedQuestions[i].Answers[j].IsSelected, true) @Html.HiddenFor(m => Model.DisplayedQuestions[i].Answers[j].Id) @Html.HiddenFor(m => Model.DisplayedQuestions[i].Answers[j].IsTrue) }
} else if (@Model.DisplayedQuestions[i].AnswerType == QRefTrain3.Models.AnswerType.MultipleAnswer) {
@for (int j = 0; j < Model.DisplayedQuestions[i].Answers.Count; j++) { @Html.HiddenFor(m => Model.DisplayedQuestions[i].Answers[j].Id) @Html.HiddenFor(m => Model.DisplayedQuestions[i].Answers[j].IsTrue) }
}
The ModelView
public class QuizzViewModel { public List DisplayedQuestions { get; set; } public ResultType ResultType { get; set; } } 
submitted by pyrovoice to learnprogramming [link] [comments]


2017.11.30 21:08 TonyHxC Radio buttons are not defaulting as expected. Please help :)

So I am running into an issue where The checkboxes I Want to be default checked are not doing so.
However I am not sure if these check boxes are set up properly. This code existed before me and the radio button groups seem to be accurate.
As an example choosing
Attendee Type O Regular Attendee O Faculty 
I can only Select one as it should work. however I don't know why these groupings are working.
However my biggest issue is that I can not get the FullAttendanceY_ checkbox to be the default one checked. for some reason it always defaults to FullAttendanceN_
There is not any javascript running that is over riding this.
Here is the JSP page
Session Name Session ID Date Start Time Duration
min
And here is the javascript
var validator; $(document).ready(function(event){ $('#submitAffidavit').click(function(){ submitAffidavit(); }); $('#saveAffidavit').click(function(){ saveAffidavit(); }); function saveAffidavit(){ document.getElementById('submitType').value = 'Save'; document.getElementById("jpFormInput").submit(); } function submitAffidavit(){ document.getElementById('submitType').value = 'Submit'; document.getElementById("jpFormInput").submit(); } $("input[id*='checkbox_']").each(function() { if ($(this).is(':checked')) { var dataid = $(this).attr("data-id"); var divId = "fullAttendence_" + dataid; var divIdAttendee = "attendeeType_" + dataid; $('#' + divId).toggle(this.checked); $('#' + divIdAttendee).toggle(this.checked); } }); $("input[id*='faculty_']").each(function() { if ($(this).is(':checked')) { var dataid = $(this).attr('id').split('_')[1]; $('#' + "facultyDetail_" + dataid).show(); $('#' +"fullAttendence_" + dataid).hide(); } }); $("input[id*='fullAttendenceN_']").each(function () { if ($(this).is(':checked')) { var dataid = $(this).attr('id').split('_')[1]; var divId = "partialAtt_" + dataid; $('#' + divId).show(); } }); $("#add_email_form").validate(); $("#jpFormInput").validate(); function submit(event) { javascript:document.forms[0].submit(); } $( "#accordion" ).accordion({collapsible: true,header: "tr.title"}); $(function() { }); $("input[id*='checkbox_']").each(function () { $(this).click(function(){ var dataid = $(this).attr("data-id"); var divId = "fullAttendence_" + dataid; var divIdAttendee = "attendeeType_" + dataid; $('#' + divId).toggle(this.checked); $('#' + divIdAttendee).toggle(this.checked); }); }); $("input[id*='faculty_']").each(function () { $(this).click(function(){ var dataid = $(this).attr('id').split('_')[1]; $('#' + "facultyDetail_" + dataid).show(); $('#' +"fullAttendence_" + dataid).hide(); }); }); $("input[id*='regularAttendee_']").each(function () { $(this).click(function(){ var dataid = $(this).attr('id').split('_')[1];; $('#' + "facultyDetail_" + dataid).hide(); $('#' +"fullAttendence_" + dataid).show(); }); }); $("input[id*='fullAttendenceN_']").each(function () { $(this).click(function(){ var dataid = $(this).attr('id').split('_')[1]; var divId = "partialAtt_" + dataid; $('#' + divId).show(); }); }); $("input[id*='fullAttendenceY_']").each(function () { $(this).click(function(){ var dataid = $(this).attr('id').split('_')[1]; var divId = "partialAtt_" + dataid; $('#' + divId).hide(); }); }); $.validator.addClassRules({ time: { digits: true, }, prepTime: { digits: true, min: 1, max:6000, }, panelists: { digits: true, min: 1, max: 50, } }); $( "#jpFormInput").validate(); $("#cancel_btn").click(function(evt){ evt.preventDefault(); window.location.href = CTX_PATH + "/home"; }); $("#cancel_btn_bottom").click(function(evt){ evt.preventDefault(); window.location.href = CTX_PATH + "/home"; }); $("#next_btn").click(function(event){ $("#returnString").val('next'); submit(); }); $("#next_btn_bottom").click(function(event){ $("#returnString").val('next'); submit(); }); $("#back_btn_bottom").click(function(event){ $("#returnString").val('back'); submit(); }); $("#back_btn").click(function(event){ $("#returnString").val('back'); submit(); }); $("#cancelEmail").click(function(evt){ setTimeout(function closeModal(){ evt.preventDefault(); parent.$.modal.close(); }, 50) }); $('#certOnlyCheckbox').change(function() { if ($(this).is(":checked")) { document.getElementById('certOnly').value = 'Y'; } else if ($(this).is(":unchecked")){ document.getElementById('certOnly').value = 'N'; } }); }); function addEmail() { $.modal($("#add_email_modal")); } function addStateBar(){ var table = document.getElementById("stateBarList"); var row = table.insertRow(0); var cell1 = row.insertCell(0); var e = document.getElementById("addStateBar"); var strStateBar = e.options[e.selectedIndex].value; cell1.innerHTML = ""; $.modal.close(); } function saveEmail() { var table = document.getElementById("certEmailList"); var row = table.insertRow(0); var cell1 = row.insertCell(0); cell1.innerHTML = "" $('#add_email_form').validate().resetForm(); $.modal.close(); } function cancelEmail() { $.modal.close(); } 
submitted by TonyHxC to learnprogramming [link] [comments]


2017.10.17 19:02 pyrovoice ASP.NET MVC RadioButtonFor Helper not working

Hello, thank you for your help.
I'm currently building a website in which you can answer a quiz. I built it so that the question is loaded, the user check the radiobuttons and when finished, validate the form.
I'm using "For" helpers to store the information directly without having to retrieve it, I did some changes and now it's not working and I don't know why. I tried everything but I cannot find the reason.
Here is the code, I added some explanation for each screenshot, please let me know if I should clarify anything :
https://imgur.com/a/L3tDA
As you can see in the third picture, I do a classic RadioButtonFor trying to store the information in the current Question -> Current answer -> IsSelected.
Thank you again !
submitted by pyrovoice to learnprogramming [link] [comments]


2017.08.07 20:15 myotcworld ASP.NET MVC Data Annotation – Server Side Validation of Controls – Textbox, Dropdownlist, Checkbox, Radiobutton

ASP.NET MVC Data Annotation – Server Side Validation of Controls – Textbox, Dropdownlist, Checkbox, Radiobutton submitted by myotcworld to Code4U [link] [comments]


2017.08.06 20:39 myotcworld ASP.NET MVC Data Annotation - Client Side Validation of Controls - Textbox, Dropdownlist, Checkbox, Radiobutton

ASP.NET MVC Data Annotation - Client Side Validation of Controls - Textbox, Dropdownlist, Checkbox, Radiobutton submitted by myotcworld to Code4U [link] [comments]


2017.07.26 13:32 pyrovoice ASP.Net MVC getting answers from quiz using model

Summary : I currently have a cshtml page in which I write my questions in a foreach loop, with radiobuttons for the user to check, created from a questionViewModel list, that redirect me to a quizResult method. I want to update the model using RadioButtonFor but don't know how to use them with a list that complicated, nor how to get my modelViews in the method once the form is submitted.
Code :
public class QuestionViewModel { public Question Question { get; set; } public List Answers { get; set; } } 
The view :
@model List ... 
@using(Html.BeginForm("QuizzResult", "Home")) { foreach(QRefTrain.ViewModel.QuestionViewModel questionViewModel in Model) {
@questionViewModel.Question.Name @questionViewModel.Question.Id @questionViewModel.Question.QuestionText
@if(@questionViewModel.Question.IsVideo) { }
@if(@questionViewModel.Question.AnswerType == QRefTrain.Models.AnswerType.SingleAnswer) { foreach(String answerText in questionViewModel.Question.PossibleAnswers) { @answerText @Html.RadioButtonFor(m => m.Find(x => x.Question.Id == questionViewModel.Question.Id).Answers, answerText) } }


} }
And the controller :
///  /// Load questions according to parameters, then load a quizz page with those questions ///  ///  public ActionResult MovetoQuizz() { Random rnd = new Random(); List allQuestions = Dal.Instance.getAllQuestions(); List displayedQuestions = new List(); // In case we don't have enough questions if(allQuestions.Count < 10) { displayedQuestions = allQuestions; } else { while(displayedQuestions.Count < 10) { Question question = allQuestions[rnd.Next(allQuestions.Count - 1)]; if(!displayedQuestions.Contains(question)) { displayedQuestions.Add(allQuestions[rnd.Next(allQuestions.Count - 1)]); } } } List questionViewModels = new List(); foreach(Question q in displayedQuestions) { questionViewModels.Add(new QuestionViewModel { Question = q, Answers = new List() }); } return View("Quizz", questionViewModels); } [HttpPost] public ActionResult QuizzResult(List viewModels) { // Do stuff here return View(); } 
At the moment I have a null value in the QuizzResult method, I don't understand why; Shouldn't the View("Quizz", questionViewModels); line indicate that I uses those objects ?
Please tell me if you want clarification, I'm really lost here.
submitted by pyrovoice to learnprogramming [link] [comments]


2017.05.12 01:15 KoopaTheTurtle Why frame no color?

Yeah... why it no color? http://imgur.com/gallery/1MbGi
from tkinter import * from tkinter.scrolledtext import * class FrameTest(): def __init__(self, parent): #GUI set up self.rating_var = StringVar() self.rating_var.set("No Rating") # initial setting rating radiobuttons self.search_var = StringVar() self.search_var.set("*") # initial setting search radiobuttons : no valid value, so none set self.rating_frame = Frame(parent, width = 350, height = 320, bg = "chartreuse") self.rating_frame.grid_propagate(0) # to reserve space required for frame self.summary_frame = Frame(parent, width = 350, height = 320, bg = "orchid") self.summary_frame.grid_propagate(0) #main routine if __name__ == "__main__": root = Tk() root.title("Movie Ratings") rater = FrameTest(root) root.mainloop() 
submitted by KoopaTheTurtle to learnpython [link] [comments]


2016.11.17 07:58 WizardNo7 Attempting to submit form and execute PHP function depending on which button was clicked. [PHP, HTML, JS] Trying to avoid Ajax.

Good day all.
I am re-writing a previously one-page solution that was a mixture of HMTL, CSS, PHP and JS all over, and turning it into a proper separate OOP project as best I can.
I have been able to figure out most issues that I've had without too much hassle, but now I'm stuck and have been for quite a while so it's time to turn to the pro's!
I have my main web page that lists users as radiobuttons from a DB via an external PHP script. At the bottom of the page I have buttons for [Add], [Edit], [Delete] etc.
I have succeeded in passing data needed for validation to JS as I use the "prompt" function to get data from the user when adding/editing, and that has lead me to assign the output to a hidden input back on the HTML side.
My problem now is to submit directly after the JS has run and then in the backend do an INSERT if the [Add] button was clicked or an UPDATE if [Edit] was clicked.
I have tried numerous things but am not getting anywhere.
Any info will be appreciated, and if you need anything from me, please feel free to get on my case for letting it out.
Dropbox link to example project.
submitted by WizardNo7 to PHPhelp [link] [comments]


2016.11.14 14:42 WizardNo7 Trying to get form submitted data in PHP to create entry into DB. (HTML, PHP, JS)

Good day all.
I am re-writing a previously one-page solution that was a mixture of HMTL, CSS, PHP and JS all over, and turning it into a proper separate OOP project as best I can.
I have been able to figure out most issues that I've had without too much hassle, but now I'm stuck and have been for quite a while so it's time to turn to the pro's!
I have my main web page that lists users as radiobuttons from a DB via an external PHP script. At the bottom of the page I have buttons for [Add], [Edit], [Delete] etc.
I have succeeded in passing data needed for validation to JS as I use the "prompt" function to get data from the user when adding/editing, and that has lead me to assign the output to a hidden input back on the HTML side.
My problem now is to submit directly after the JS has run and then in the backend do an INSERT if the [Add] button was clicked or an UPDATE if [Edit] was clicked.
I have tried numerous things but am not getting anywhere.
Any info will be appreciated, and if you need anything from me, please feel free to get on my case for letting it out.
Dropbox link to example project.
Edit: Added link to an example project folder on Dropbox
submitted by WizardNo7 to PHPhelp [link] [comments]


2016.08.01 04:14 pancak3d Radiobuttons for several hundred questions?

Hi Excel,
I have a client asking for an Excel survey with 400+ questions. He'd like Yes, No, N/A radiobuttons for each survey question.
I can't think of a way to do this quickly/conveniently. 1200+ individual radiobuttons seems like a lot for Excel to handle and a pain to manage. I'm thinking of just suggesting he skip the radiobuttons and have columns for Yes, No, and N/A where the user just fills an "X" in the appropriate column. Perhaps use data validation to ensure only one X is entered per row.
Is this more reasonable? Is there a better solution?
submitted by pancak3d to excel [link] [comments]


2014.08.19 10:08 rainingdx Help with a simple temperature conversion code

I'm doing the classic F to C and C to F calculation in order to learn more about Android programming but I'm getting stuck at the calculation part, which should not be hard at all.
When I calculate 100F to C I get 0.0. And when I calculate 100C to F I get 132.0. There doesn't seem to be a pattern that I can tell what's going wrong. Any help would be great.
package com.example.converttemp;
import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.RadioButton; import android.widget.Toast; import com.example.converttemp.R;
public class MainActivity extends Activity { private EditText text;
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_main); text = (EditText) findViewById(R.id.editText1); } public void myClickHandler(View view){ switch (view.getId()){ case R.id.button1: RadioButton celsiusButton = (RadioButton) findViewById(R.id.radio0); RadioButton fahrenheitButton = (RadioButton) findViewById(R.id.radio1); if (text.getText().length()== 0){ Toast.makeText(this, "Please enter a valid number", Toast.LENGTH_LONG).show(); return; } float inputValue = Float.parseFloat(text.getText().toString()); if(celsiusButton.isChecked()){ text.setText(String.valueOf(convertFahrenheitToCelsius(inputValue))); //celsiusButton.setChecked(false); //fahrenheitButton.setChecked(true); } if(fahrenheitButton.isChecked()){ text.setText(String.valueOf(convertCelsiusToFahrenheit(inputValue))); //fahrenheitButton.setChecked(false); //celsiusButton.setChecked(true); } break; } } private float convertFahrenheitToCelsius(float fahrenheit) { return ((fahrenheit - 32) * (5/9)); } private float convertCelsiusToFahrenheit(float celsius) { return (celsius * (9 / 5) + 32); } 
}
God damnit why doesn't the top part show correctly
submitted by rainingdx to androiddev [link] [comments]


2014.04.06 01:20 pembo210 How-to: Add 5 new Doge wallet options in Piper paper wallet printer

Here's the final product: http://i.imgur.com/4RUzs8U.jpg
First off let me just say how much I love this community and how proud I am to be a part of it. Second, I am totally new at python raspi coding, so please make a backup copy of your "home/pi/Printer" folder and an extra copy of your keys on a flash drive. If something crashes or fails to work, you can copy/paste the contents of the backup "Printer-backup" folder back to the main "Printer" directory and everything will be just as it was before. I'm using a Piper A model and this is for software version 1.05. Since this is the only version I have right now.
After you've backed up your Printer folder, copy this page to a text file on a flash drive to load to your Piper. I've tried opening the files outside of the pi then overwriting them, but it didn't work. I had to edit the files locally in Leafpad. Go to the Printer folder and open "gui.py" "genkeys.py" and "piper.py" using Leafpad. I'm going to mark new code with ++ so you can see where it fits with the rest of the code. Do not leave the ++ in the code. (In leafpad, go to the options menu and enable Line Numbers, many helpful). We're basically adding 5 copies of the sames piece of code in each case. Also the bulk wallet feature didn't work to well, I would suggest staying with printing one at a time.
Here are the bmp backgrounds that you need to add to "home/pi/PrinteImages" folder. You can create any bmp and rename/replace the image and the printer will now print that one for that number selection.
Close the gui Piper Wallet program. Open "gui.py" using Leafpad add the following code at line 549. This adds the additional 5 buttons on the Settings tab in the Piper gui. We are also changing the "padx" value to 5 so everything fits.
 tk.Label(coinTypeFrame, text="Coin type:").pack(side=tk.LEFT, padx=10, pady=10) self.coinType = tk.StringVar() tk.Radiobutton(coinTypeFrame, text="Bitcoin", variable=self.coinType, value="bitcoin").pack(side=tk.LEFT, padx=5, pady=10) tk.Radiobutton(coinTypeFrame, text="Litecoin", variable=self.coinType, value="litecoin").pack(side=tk.LEFT, padx=5, pady=10) ++ tk.Radiobutton(coinTypeFrame, text="Dogecoin", variable=self.coinType, value="dogecoin").pack(side=tk.LEFT, padx=5, pady=10) ++ tk.Radiobutton(coinTypeFrame, text="Doge1", variable=self.coinType, value="doge1").pack(side=tk.LEFT, padx=5, pady=10) ++ tk.Radiobutton(coinTypeFrame, text="Doge2", variable=self.coinType, value="doge2").pack(side=tk.LEFT, padx=5, pady=10) ++ tk.Radiobutton(coinTypeFrame, text="Doge3", variable=self.coinType, value="doge3").pack(side=tk.LEFT, padx=5, pady=10) ++ tk.Radiobutton(coinTypeFrame, text="Doge4", variable=self.coinType, value="doge4").pack(side=tk.LEFT, padx=5, pady=10) coinTypeFrame.pack() 
On line 568 - change the displayed information about address prefixes, this does not effect how it works
 tk.Label(self, text="Address prefix - 1 for bitcoin - L for litecoin - D for Doge - or key generation will fail.").pack(padx=10) 
Next is line 611 in the same file. This adds a check to make sure AES is selected
 #first, check that BIP0038 and litecoin are not both set if(self.coinType.get() == "litecoin" and self.encType.get() == "bip0038"): self.showMessage("Error!!","BIP0038 is not compatible with litecoin. Settings not saved.") self.encType.set("aes") ++ if(self.coinType.get() == "dogecoin" and self.encType.get() == "bip0038"): ++ self.showMessage("Error!!","BIP0038 is not compatible with dogecoin. Settings not saved.") ++ self.encType.set("aes") ++ ++ if(self.coinType.get() == "doge1" and self.encType.get() == "bip0038"): ++ self.showMessage("Error!!","BIP0038 is not compatible with dogecoin. Settings not saved.") ++ self.encType.set("aes") ++ ++ if(self.coinType.get() == "doge2" and self.encType.get() == "bip0038"): ++ self.showMessage("Error!!","BIP0038 is not compatible with dogecoin. Settings not saved.") ++ self.encType.set("aes") ++ ++ if(self.coinType.get() == "doge3" and self.encType.get() == "bip0038"): ++ self.showMessage("Error!!","BIP0038 is not compatible with dogecoin. Settings not saved.") ++ self.encType.set("aes") ++ ++ if(self.coinType.get() == "doge4" and self.encType.get() == "bip0038"): ++ self.showMessage("Error!!","BIP0038 is not compatible with dogecoin. Settings not saved.") ++ self.encType.set("aes") return #second, check that prefix is valid 
Just below this code in the same file we need to add the vanitygen info and check for the "D" suffix
 if(self.coinType.get() == "litecoin"): if(len(self.addrPrefix.get()) == 0 or self.addrPrefix.get()[0] != "L"): self.showMessage("Error!!","Invalid address prefix. Litecoin addresses must begin with L.") return process = Popen(["./vanitygen-litecoin", "-q", "-n", "-L", "-t","1","-s", "/dev/random", self.addrPrefix.get()], stderr=PIPE) ++ elif(self.coinType.get() == "dogecoin"): ++ if(len(self.addrPrefix.get()) == 0 or self.addrPrefix.get()[0] != "D"): ++ self.showMessage("Error!!","Invalid address prefix. Dogecoin must begin with D.") ++ return ++ process = Popen(["./vanitygen-litecoin", "-q", "-n", "-X30", "-t","1","-s", "/dev/random", self.addrPrefix.get()], stderr=PIPE) ++ elif(self.coinType.get() == "doge1"): ++ if(len(self.addrPrefix.get()) == 0 or self.addrPrefix.get()[0] != "D"): ++ self.showMessage("Error!!","Invalid address prefix. Dogecoin must begin with D.") ++ return ++ process = Popen(["./vanitygen-litecoin", "-q", "-n", "-X30", "-t","1","-s", "/dev/random", self.addrPrefix.get()], stderr=PIPE) ++ elif(self.coinType.get() == "doge2"): ++ if(len(self.addrPrefix.get()) == 0 or self.addrPrefix.get()[0] != "D"): ++ self.showMessage("Error!!","Invalid address prefix. Dogecoin must begin with D.") ++ return ++ process = Popen(["./vanitygen-litecoin", "-q", "-n", "-X30", "-t","1","-s", "/dev/random", self.addrPrefix.get()], stderr=PIPE) ++ elif(self.coinType.get() == "doge3"): ++ if(len(self.addrPrefix.get()) == 0 or self.addrPrefix.get()[0] != "D"): ++ self.showMessage("Error!!","Invalid address prefix. Dogecoin must begin with D.") ++ return ++ process = Popen(["./vanitygen-litecoin", "-q", "-n", "-X30", "-t","1","-s", "/dev/random", self.addrPrefix.get()], stderr=PIPE) ++ elif(self.coinType.get() == "doge4"): ++ if(len(self.addrPrefix.get()) == 0 or self.addrPrefix.get()[0] != "D"): ++ self.showMessage("Error!!","Invalid address prefix. Dogecoin must begin with D.") ++ return ++ process = Popen(["./vanitygen-litecoin", "-q", "-n", "-X30", "-t","1","-s", "/dev/random", self.addrPrefix.get()], stderr=PIPE) else: if(len(self.addrPrefix.get()) == 0 or self.addrPrefix.get()[0] != "1"): self.showMessage("Error!!","Invalid address prefix. Bitcoin addresses must begin with 1.") return process = Popen(["./vanitygen", "-q","-n", "-t","1","-s", "/dev/random", self.addrPrefix.get()], stderr=PIPE) 
Save and Close
------In the Next file "genkeys.py" and go to line 48, adding vanitygen info
if(coinType == "litecoin"): process = Popen(["./vanitygen-litecoin", "-q", "-L", "-t","1","-s", "/dev/random", addrPrefix], stdout=PIPE) ++ elif(coinType == "dogecoin"): ++ process = Popen(["./vanitygen-litecoin", "-q", "-X30", "-t","1","-s", "/dev/random", addrPrefix], stdout=PIPE) ++ elif(coinType == "doge1"): ++ process = Popen(["./vanitygen-litecoin", "-q", "-X30", "-t","1","-s", "/dev/random", addrPrefix], stdout=PIPE) ++ elif(coinType == "doge2"): ++ process = Popen(["./vanitygen-litecoin", "-q", "-X30", "-t","1","-s", "/dev/random", addrPrefix], stdout=PIPE) ++ elif(coinType == "doge3"): ++ process = Popen(["./vanitygen-litecoin", "-q", "-X30", "-t","1","-s", "/dev/random", addrPrefix], stdout=PIPE) ++ elif(coinType == "doge4"): ++ process = Popen(["./vanitygen-litecoin", "-q", "-X30", "-t","1","-s", "/dev/random", addrPrefix], stdout=PIPE) else: process = Popen(["./vanitygen", "-q", "-t","1","-s", "/dev/random", addrPrefix], stdout=PIPE) 
Save and close.
----------------Open "pyper.py" and go line 64. This is how it knows what background picture goes with each radio button on the Settings tab
if(coinType == "litecoin"): finalImgName="ltc-wallet" ++ elif(coinType == "dogecoin"): ++ finalImgName="doge-wallet" ++ elif(coinType == "doge1"): ++ finalImgName="1doge-wallet" ++ elif(coinType == "doge2"): ++ finalImgName="2doge-wallet" ++ elif(coinType == "doge3"): ++ finalImgName="3doge-wallet" ++ elif(coinType == "doge4"): ++ finalImgName="4doge-wallet" else: finalImgName="btc-wallet" 
Save and close. That should be it.
Double click the Piper shortcut on the desktop and launch the new gui. From the setting tab, select one of the Doges, put a "D" in the prefix box, and Apply changes. Now when you print from the first tab or press the button on the outside, it will print that corresponding background.
edit2: Github
submitted by pembo210 to dogecoin [link] [comments]


2014.03.19 02:12 ijustwantthejohnikno Where to implement a server in java program?

In this code I have to implement a server (16789) in this code, and I am not sure where.
Thank you very much!!!!
 public class CaesarClient extends JFrame { private JTextArea jtaSendText; private JTextArea jtaRecvText; private JPanel jpTextPanel; private JButton jbSend; private JButton jbExit; private JPanel jpButtonPanel; private JPanel jpRadioPanel; private ButtonGroup bgCmds; private JRadioButton jrbEncrypt; private JRadioButton jrbDecrypt; private JRadioButton jrbError; /** Validate command line argument and call create GUI constructor */ public static void main(String [] args) { // test the arguments - need a host to talk to if(args.length <= 0) { System.out.println("You must specify a host."); System.exit(1); } // create the client CaesarClient cc = new CaesarClient(args[0]); } /* Constructor sets up the GUI */ public CaesarClient(String host) { // setup the frame for the display setTitle("Caesar Cipher Client"); setSize(400,400); // setup the frame components // Text areas first jtaSendText = new JTextArea("Send text",10,50); jtaSendText.setBorder(new EtchedBorder()); jtaRecvText = new JTextArea("Recv text",10,50); jtaRecvText.setBorder(new EtchedBorder()); jpTextPanel = new JPanel(); jpTextPanel.setLayout(new GridLayout(2,1)); // place the text areas in JScrollPanes JScrollPane jbSendPane = new JScrollPane(jtaSendText); JScrollPane recvPane = new JScrollPane(jtaRecvText); jpTextPanel.add(jbSendPane); jpTextPanel.add(recvPane); // Buttons send & next jbSend = new JButton("Send"); jbExit = new JButton("Exit"); jpButtonPanel = new JPanel(); jpButtonPanel.add(jbSend); jpButtonPanel.add(jbExit); // handle the jbExit button jbExit.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae) { System.exit(0); } }); // [X] close handler addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent we){ System.exit(0); } }); // Radiobuttons last jrbEncrypt = new JRadioButton("Encrypt"); jrbDecrypt = new JRadioButton("Decrypt"); jrbError = new JRadioButton("Error"); bgCmds = new ButtonGroup(); bgCmds.add(jrbEncrypt); bgCmds.add(jrbDecrypt); bgCmds.add(jrbError); jpRadioPanel = new JPanel(); jpRadioPanel.add(jrbEncrypt); jpRadioPanel.add(jrbDecrypt); jpRadioPanel.add(jrbError); // handle the jbSend button SendHandler sh = new SendHandler(host,jtaSendText,jtaRecvText, jrbEncrypt,jrbDecrypt,jrbError); jbSend.addActionListener(sh); // now add the components to the frame add(jpRadioPanel,BorderLayout.NORTH); add(jpButtonPanel,BorderLayout.SOUTH); add(jpTextPanel,BorderLayout.CENTER); setLocationRelativeTo(null); setVisible(true); } 
}
submitted by ijustwantthejohnikno to javahelp [link] [comments]


How to Set Up Basic jQuery Form Validation in Two Minutes