Search the Community
Showing results for tags 'programming'.
-
So the jist of it its, i have a User object that contains a username and a password. The there is a linked list that contains a list of users, i'm trying to compare the user object which holds the entered username and password with the ones in the list. If any of the user's in the list match then it should return true, currently i have a comparison but it doesn't work due to the equals needing an override method. Which i'm stuck on, any ideas? thanks. Current comparison: public boolean logOnSeller() { Seller tempSeller = new Seller(username, password); for (int i = 0; i < userList.size(); i++) { if(userList.equals(tempSeller)) { return true; } } return false; } The problem being i think that the User object is being compared to the memory address of userlist rather than the individual elements in it? Thanks for any help.
-
Laptop purely for remoting in to Desktop?
SNReloaded posted a topic in Laptops and Pre-Built Systems
As a programmer at University currently, I'm looking to have a small portable laptop with decent battery life that I can remote into my desktop using either Bash or TeamViewer (or the likes). I'm curious as to what would be good potential laptops to do this with. I was considering the Lenovo Yoga Book, but I'm not sure if the "Halo Keyboard" would be the best for doing programming, especially as somebody who uses the Dvorak keyboard layout. What would be a better cheap laptop to purchase? -
cn.ConnectionString = @"Data Source=user3;Initial Catalog=office_db;Integrated Security=True"; cmd.Connection = cn; cn.Open(); string s = "select date from salary where Emp_ID ='3'"; SqlCommand query = new SqlCommand(s, cn); SqlDataReader reader = query.ExecuteReader(); reader.Read(); String db = reader["date"].ToString(); reader.Close(); cn.Close(); label2.Text= db; so this is my code and im able to get the date and time both in my output when i display it in the label. i want only my date to be there and only in this format: dd/mm/yyyy. and then i want to get the date (dd) convert it to a int for doing some calculations.any ideas how this can be done?
-
i need to get the date using date time picker and save it in database table column that has the data type date. i tried this way but it didnt work: string finaldate = dateTimePicker1.Text; cn.ConnectionString = @"Data Source=user-PC\SQLEXPRESS;Initial Catalog=employee_db;Integrated Security=True"; cmd.Connection = cn; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@Date", finaldate); cmd.CommandText = "insert into employee(Date)values(@Date)"; cn.Open(); cmd.ExecuteNonQuery(); cn.Close();
-
Hey guys, I am looking at laptops for a dual boot. I need a laptop for college mainly. I have up to a max of 1500 USD, but I don't want to spend it if i don't have to. I am taking classes in software development and i need something that can handle that kind of work load. As well as video editing and some light gaming. The thing i am having troubles with it finding something that will last 4 years of college and that I can dual boot without a ton of issues. I was looking at the xps15 but i found that installing linux kills the warranty not that they would know after putting windows back but also added a 2 ed hard drive does as well. Still really like the computer tho. other systems i have looked are are gaming laptops but i am scared of not being able to get gpu to work(my desktop i had to take out 970 out then install drives then put 970 back in to get drivers to work nosetmode did't seem to help) any suggestions for laptops. it will mostly run linux but windows is must for some things i do with school. and a vm just wont cut it in my case. Edit: i thought about warranty i understand anything to a laptop will kill warranty.
-
so i have a table in the database with a column named finish that is declared with the datatype time.i want to call this stored time to my c# program.i have tried the following code and i have tried to display the variable value in a label to see what is the value in it but it seems that no value has been assigned to the label.it just displays label 3.i also want to separately extract the hours,minutes and seconds from the time in the database and put it to different int variables such as H,M and S for doing calculations. any ideas how this can be done? cn.ConnectionString = @"......."; cmd.Connection = cn; cn.Open(); string query5 = "select finish from activities where act_ID ='2'"; SqlCommand query5 = new SqlCommand(query5, cn); SqlDataReader reader5 = query5.ExecuteReader(); reader5.Read(); String ftime = reader5["finish"].ToString(); reader5.Close(); cn.Close(); label3.Text = ftime;
-
Hello, I've been looking for a laptop recently. I need it for work/uni (Office, Programming, light CAD work), but still need the portability. I have a few points on which I'm unsure of what to do. First of all, I get recommended to buy a 15" model instead of 13". Should I go for a 15"? Also, I do not really know what computers to look at. I've seen the Dell XPS (way too expensive), the HP Spectre x360 (Reviews are only 4/5), and the Asus Zenbook 501VW . I'm also hesitating on storage. Should I go for 256GB or 512GB? I know that I will be thankful for the extra space, but at the same time I plan on having a large hard drive next to it (It would stay in my dorm all the time). Anyhow, do any of you have any suggestions on what I should do? Cheers, Sneling
-
brief overview of what I want my app to do, it takes in the previous configured wifi information and saves them to a table. I have everything working apart from these two problems: Problem 1: So whenever I try and check if the wifi is enabled on the device, the app will crash. Here is the code for the Wifi problem: public void checkWifiState() { if(!wifi.isWifiEnabled()) { Toast.makeText(getApplicationContext(), "Wifi is disabled, please enable it", Toast.LENGTH_SHORT).show(); wifi.setWifiEnabled(true); } } EDIT: found out that wifi.setWifiEnabled(true); is what is breaking the app for Problem 1. Problem 2: I want to drop my table and recreate it, whenever the user trys to press the button to check previous connections. The reason for this is becuase I don't want duplicate data in the database. here is the code for the SQLite problem: this is in a seperate java file called DatabaseHelper that extends SQLiteOpenHelper public void dropTableAndCreateNew() { SQLiteDatabase db = this.getWritableDatabase(); db.delete(TABLE_NAME,null,null); onCreate(db); } I have tried setting the whereClause to "1" on the delete method. It still crashed when I tried to run it on my phone.
- 2 replies
-
- programming
- java
-
(and 3 more)
Tagged with:
-
Hi, I'm trying to increment the following code to line 2 on file2.log, as I would like it to automatically print each line from file1.log, one at a time: #!/bin/bash let "LINE++" ( head -1 file2.log head -${LINE} file1.log | tail -1 tail --lines=+2 file2.log ) > file2.new mv file2.log file2.old mv file2.new file2.log How could this be done? Thank you
- 15 replies
-
- bash script
- linux
-
(and 2 more)
Tagged with:
-
Hi, With the below code, I'm trying to echo "line" onto the same output but all i get is: #!/bin/bash LINE=3 ( head -1 file2.log head -${LINE} file1.log | tail -1 echo "line" tail --lines=+2 file2.log ) > file2.new The echo "line" is printed under the output from file1.log which is '3'. 1 3 line 2 3 4 5 6 7 8 9 10 How can I echo "line" onto the same line as the output? Thank you
- 1 reply
-
- bash script
- linux
-
(and 2 more)
Tagged with:
-
i want to insert some data to a table in my mysql db.firstly i got a null pointer exception error and after changing rs= st.executeQuery(query); to rs= st.executeUpdate(query); i get no errors but no values are being sent to the db.i have correctly setup the db drivers and connection and i have checked my insert statement.all these look correct.please help me
-
So first of all what I am asking is if I can have help with this. My Arduino code: #include <SPI.h> #include <Ethernet2.h> int led = 13; String POST = ""; String SET = ""; // Enter a MAC address and IP address for your controller below. // The IP address will be dependent on your local network: byte mac[] = { 0x90, 0xA2, 0xDA, 0x10, 0x8B, 0xBF }; IPAddress ip(192,168,1,179); // Initialize the Ethernet server library // with the IP address and port you want to use // (port 80 is default for HTTP): EthernetServer server(80); void setup() { // Open serial communications and wait for port to open: Serial.begin(9600); // start the Ethernet connection and the server: Ethernet.begin(mac, ip); server.begin(); Serial.print("server is at "); Serial.println(Ethernet.localIP()); pinMode(led, OUTPUT); } void loop() { // listen for incoming clients EthernetClient client = server.available(); if (client) { Serial.println("new client"); // an http request ends with a blank line boolean currentLineIsBlank = true; while (client.connected()) { if (client.available()) { char c = client.read(); Serial.write(c); // if you've gotten to the end of the line (received a newline // character) and the line is blank, the http request has ended, // so you can send a reply if (c == '\n' && currentLineIsBlank) { // send a standard http response header client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println("Connnection: close"); client.println(); client.println(""); client.println("Jack's Arudino"); client.println(""); client.println(""); client.println(""); client.println("<h1>Control Jack's LED</h1>"); client.print("<form method=get>"); client.print("<input type='radio' value='0'> Off<br>"); client.print("<input type='radio' value='1'> On<br>"); client.print("<input type=submit value=submit></form>"); client.print("</form>"); client.println(""); break; } if (c == '\n') { // you're starting a new line currentLineIsBlank = true; } else if (c != '\r') { // you've gotten a character on the current line currentLineIsBlank = false; } } } // give the web browser time to receive the data delay(1); } if(SET == "on"){ digitalWrite(led, HIGH); } else{ digitalWrite(led, LOW); } } So when I run this code, I can connect to the web page 192.168.1.179 and it all works, but when I click, lets say the off box the LED switches off for a second and then comes back on. Like what is this magic? So I am asking for help to sort this out so the LED will actually turn off, and also my next step after this will be to make it so when I type say '192.168.1.179/?0' it turns the LED off and when I type '192.168.1.179/?1' it turns the LED on. This will then lead me to making my own Android app. Thanks
- 10 replies
-
- arduino
- programming
-
(and 3 more)
Tagged with:
-
Hello to all #LinusTechTips! I have a desktop PC at home, back from 2012, and my GPU card got sort of an irreversible physical damage, which I can't repair. So I gotta buy a new one! My config, however, is not one of the most actual ones, and I wanna make the right choice. Therefore, to sum it up, I want to share the components I use and the purpose of my PC and I'll ask anyone who can share an opinion to point me to the right direction. My PC has the following components: - CPU: i5-2500k @3.3GHz - RAM: 12GB DDR3 - MotherBoard: ASRock P67 Pro3 - Power Source: InterTech Energon 650W - Hard Disk: Western Digital Caviar Blue 500GB - an older graphics card to replace the crashed GTX 560 from NVidia (which simply stopped rendering the image properly one day, by displaying pixels and "advancing" to complete image disappearance, after 4 years and a half of usage ) The purpose of this "monster" () is gaming (World of Warcraft mainly, but also wanna try names like Watch Dogs), computer programming (such as visual studio, android studio etc.) and video rendering (rarely, but happens). My thoughts have been going around the latest affordable technologies released by NVidia and AMD, and, since the budget is tight and I wanna solve the GPU issue, I wanna know if I can do that and what choice should I make. My attention has been going around the GTX 1060 from NVidia, and the RX 480 from AMD respectively. But, if I am going to choose either of those, can I go for the 3GB, or I can aim for the 6 GB version from NVidia, or the 4GB or even the 8GB from AMD ? Also, right now I am using a SyncMaster 740N monitor from Samsung, running on VGA, but I can make an effort and change it if needed (would not rather right now tho, but can do). Thank you in advance and have fun to whatever you're doing!
-
i have a jframe and a class.the class has some equations.i have called the class by creating a object in the jframe.in the class i have to to write a code to close the jframe and go to a another jframe.How can i do this?
- 2 replies
-
- c++
- programming
-
(and 1 more)
Tagged with:
-
i have a private class called balance.in that class i have a public variable named b1. i need to access this variable from another class.how can i do this?
- 3 replies
-
- netbeans
- programming
-
(and 2 more)
Tagged with:
-
i have tried going to the properties of the jframe and changing it to my preferred size but it didnt work.i then typed this code and it didnt work either.is there any other way to do this. JFrame jframe = new JFrame(); jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // set the jframe size and location, and make it visible jframe.setPreferredSize(new Dimension(400, 300)); jframe.pack();
- 2 replies
-
- netbeans
- programming
-
(and 1 more)
Tagged with:
-
Hi, I'm going to preface this by saying that I'm absolute noob to servos, PWM controls, and Raspberry Pi in general. I'm currently using Adafruit's 16 channel PWM Servo/LED HAT soldered to my Rasp Pi to connect two servos. The servos move but I can't seem to understand the commands and functions of the library they included in the guide: pwm.setPWM(channel, on, off) I've gotten them to move and then stop by putting the following in: pwm = PWM(0x40) pwm.setPWMFreq(60) pwm.setPWM(0,100,500) The frequency I'm assuming is the speed at which the servo moves. I understand what channel is, obviously sending the PWM signals to whichever channel the servo is connected to. However I cannot quite grasp what the on/off commands mean. All I know is that when they are set equal to each other (e.g. pwm.setPWM(0,500,500) the motor does not move. The on and off signals in that function don't seem to do anything at all and I'm confused on how to change pulse widths. Essentially, I want the first servo (a continuous rotation servo) to move a certain number of degrees (from what I understand this correlates to the ms the servo is running for), then the second servo (normal micro-servo) to move a certain number of degrees then back to its starting position, then I want the first servo to return back to its original position as well, completely sequentially. I was hoping somebody would explain the basics behind these functions, maybe how to write programs in order to complete the above, or show me another directory on Github (or something else) where a different directory and set of commands will work. It's import to note that the HAT is a form of the Adafruit PCA9685 chip. Here are some links to the stuff I mentioned above: Servo HAT: https://www.adafruit.com/product/2327 Tutorial: https://learn.adafruit.com/adafruit-16-channel-pwm-servo-hat-for-raspberry-pi/library-reference Continuous Rotation Servo: http://www.jameco.com/z/900-00008-Parallax-Continuous-Rotation-Servo_283039.html?CID=GOOG&gclid=CjwKEAiAn7HEBRDHwNqitoWqsQcSJAADWmI2dkPnipA2xvHFcIFgWEmdttSDgWUO_fXIvI3ryYRWNRoCcCDw_wcB Micro Servo: https://www.amazon.com/TowerPro-SG90-Micro-Servo-2pk/dp/B01608II3Q/ref=pd_lpo_21_bs_t_2/163-6850172-8295626?_encoding=UTF8&psc=1&refRID=WNWCW831X3V0AXMKDCM9
- 1 reply
-
- raspberry pi
- servo
-
(and 2 more)
Tagged with:
-
i need to display a error message if the user tries to input numbers to a text box,is it possible to do this?
- 2 replies
-
- programming
- html
-
(and 3 more)
Tagged with:
-
Hello all I'm looking for a laptop for programming, virtualization and some engineering graphics editing. Currently my system has i5 4210m, 8GB, 1TB hdd. I've gone through some systems from lenovo and dell. All of them are coming with i7 6500u or i7 7500u, 16GB, 1TB had. Now my question is how good is i7 6500u or 7500u for Virtualization and engineering graphics editing?Pre installed Windows is not mandatory for me as most of the time I use Linux. My budget is around $1000
- 19 replies
-
i need to write a program in java and i want to go to another jframe from my current frame after 10 seconds.How can i do this?
- 3 replies
-
- netbeans
- programming
-
(and 2 more)
Tagged with:
-
if anyone could tell me a way to get date from DB and convert it to date/month/year format in ASP.NET it would be very helpful. The data type of the date column in the db is date, so when i retrieve it and display it in a textbox i get the time as well.i found a code to convert in the internet but i get a error saying: String was not recognized as a valid DateTime. This is my code cn.Open(); string supdate = "SELECT Date FROM Payroll WHERE EmpID='" + empid + "'"; SqlCommand query2 = new SqlCommand(subdate, cn); SqlDataReader reader2 = query2.ExecuteReader(); reader2.Read(); String sdate = reader2["Date"].ToString(); reader2.Close(); cn.Close(); String conv = sdate; // get value from text field DateTime suDateTime = new DateTime(); suDateTime = DateTime.ParseExact(conv, "MM-dd-yyyy", null); String converted_date = suDateTime.ToString("dd-MM-yyyy"); TextBox4.Text = converted_date;
- 5 replies
-
- programming
- database
-
(and 2 more)
Tagged with:
-
I am attempting to learn how to use Python for penetration testing? Where can I learn this? Edit: Thanks for all the answers guys! I was pretty vague with my question so let me try to narrow it down. I want to learn how to use python to create pen-testing programs, as vorticalbox said, I don't want to be a "script kiddie" I want to be able to use my python skills to try to make some pen-testing skills. I am not trying to start a company or anything, just want to have some fun and have a hobby. Thanks!
- 11 replies
-
- python
- penetration testing
-
(and 2 more)
Tagged with:
-
so im using netbeans 8.2 IDE and mysql database. when i made a web application and tried to run my jsp i got 2 errors saying : C:\Users\hp\Desktop\fashionsite\nbproject\build-impl.xml:874: The following error occurred while executing this line: C:\Users\hp\Desktop\fashionsite\nbproject\build-impl.xml:296: my servlet has a red exclamation mark near its icon but there is no error in it. there were solutions from other sites saying to delete the build.xml and restart netbeans so that it will create a new build .xml file. but this did not work. i havent found any solution for what is causing this error.it would be very helpful if someone could suggest a solution.thanks