Search Results

Search found 1039 results on 42 pages for 'barcode scanner'.

Page 34/42 | < Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >

  • Compiling/executing Java on Sublime Text 2 works fine except that it cannot read user input

    - by meiryo
    I am a student learning Java and I want to compile and run some simple Java on ST2. Also Eclipse is very slow on my laptop. Here is my JavaC.sublime-build file so far: { "cmd": ["sublimejavaexec.bat", "$file"], "file_regex": "^(...*?):([0-9]*):?([0-9]*)", "selector": "source.java" } So far it can run code that does not require user input. However when I have something that uses the Java input scanner it either skips through or generates an error. Can anyone suggest a solution such as a plug-in or if ST2 actually has this kind of feature on its console? Thanks.

    Read the article

  • Using Credentials with network scanners

    - by grossmae
    I'm testing out both Tenable's Nessus scanner as well as eEye's Retina for scanning network devices. I am trying to supply credentials to get deeper, more accurate results, however there seems to be no difference in the results whether I supply the credentials or not. I've read the documentation and it seems like I've tried all the logical settings in the Credential options. I've submit along with usernames and passwords for many different accounts and types of accounts (both SSH Credentials and Web Application Credentials) on the devices as well as their respective domain names (when applicable). Is there possibly a good test for either (or both) scanners to tell where these credentials are being provided (if at all) and if any of them are successfully getting authentication?

    Read the article

  • anonymous access to ftpd

    - by gcb
    I need FTP on my local LAN so my scanner can send me scans. I am on Debian sid. I installed ftpd and created the user anonymous. I removed anonymous from /etc/ftpusers When I try to login as anonymous it says: login failed. I can't seem to find any log file. I'm using FTP server (Version 6.4/OpenBSD/Linux-ftpd-0.17) update:I needed that so my printer had one place to store my scanned documents on the LAN. solved that buying a dedicated USB pen drive (thankfully I bought a printer one with plenty of options) but in the past this was a very simple task. Install ftpd, specify the directory for anonymous access, and be done with it. now every ftp daemon has several layers of security and chroot in it's core... this is just crazy when all you need a place for a printer to dump files in a secured network.

    Read the article

  • USB MFP print server that works with Windows x64?

    - by hangy
    Right now, we are using the Longshine LCS-MFP101-2 to connect to our MFP device (printer/scanner combo) over LAN. However, the required driver (RMVUSB, Remote Virtual USB) cannot be installed on 64 bit Windows operating systems such as Windows XP x64 or Windows 7 x64. Since the distributor lists the product as "phased out", I do not expect any updated 64 bit drivers any time soon. :/ Because of that, I am searching for a relatively cheap SOHO MFP print server (1 USB port should be enough) which can be used with 32 bit and 64 bit versions of Windows. Do you have any ideas or recommendations? Thanks!

    Read the article

  • UBUNTU's Network Connection Manger can't detect Huawei ETS2051 Modem device!

    - by Doctoa
    I have a modem device called Huawei ETS2051 and the Network Connection Manger can't detect it, but when I use Gnome-PPP it work fine but the problem is when I use Gnome-PPP; apps like Ubuntu software Center Can't reconice that's Iam connecting to the Internet so the app is just act like it's offline while other apps like web browsers and IM's work good under Gnome-PPP. any way what I want is to have a Full Ubuntu experince by making The Network Connection Manger detect my ETS2051. I have another 3G USB modem and The Network Connection Manger detect it and it's work just fine but the internet price for this one is high and I can't effort it so am count on that ETS2051 modem as you can see for it's low price and stable internet speed that satesfy my needs. More information: Gnome-PPP is a GUI for wvdial. the ETS2051 modem use a serial USB port. I have a Windows driver CD for the device. I have also find This qustion about the software Center acting like it's offline around wvdial and there's this launchpad bug. and am really insest to use Ubuntu Software Center so please no other software manger apps recomendation... I've also this Genius ColorPage HR6X Slim scanner that's Ubuntu can't detect it, so if you interset you can check and answer the qustion from here...

    Read the article

  • Acrobat Reader, and indeed all Adobe products are freezing and crashing on print

    - by 5tratus
    Everything was working fine, right up till I had to do some driver work to get my scanner to work - now I can't seem to print from any Adobe product. I click print and the program freezes, it stops responding, and in the case of Acrobat Reader, it crashes. In the case of In-design CS4, I have to stop the process in task manager, in the case of Fireworks CS3 - I think it just crashes. Printing a PDF hangs and crashes inside of Firefox and IE browsers too. My printer works and I can print from MS Word, Excel and directly by right clicking on a non-Adobe file and choosing print. But when I try it in an Adobe product. I'm running Windows 7 64-bit, my version of Adobe Reader is: 10.1.11, Windows is updated, and I don't have any unusual extensions.

    Read the article

  • Change Scan-to-PC list names on Brother MFC-8890DW Printer

    - by dralezero
    I have two Brother MFC-8890DW. When scanning over the network, it shows a list of PCs (on the scanner display) to save to that have the software/drivers installed. Each PC is listed as the name of the employee for that computer. I have setup a third MFC-8890DW and installed on these computers. The list, however, is the computer name. Somehow it is possible to customize the name. Brother support did not know. I couldn't find anything in manuals. I thought I remember setting up those names before.

    Read the article

  • Converting massive images to PDF, without crashing applications

    - by BloodyIron
    I'm trying to work with a large-format scanner, and we are scanning very long documents. Example, one of our documents we cut into two pieces, and one of those pieces is 3633x82486 in resolution. My application, Scanning Master 21+, which comes with the device (Graphtec CSX300-09) can output PDF, however when I try to save to PDF it complains about file being too large. I can successfully output to BMP however. GIMP can even open this BMP, after taking a while to load it. The resulting files range from 200MB - 1.2GB in size. Acrobat refuses to open the BMP format, saying it isn't supported or is damaged (which I know is not true). As I mentioned, the PDF plugin for GIMP crashes when I try to export to PDF. I'm really not sure what is the best tool for this job. So what is the best tool to produce PDF documents of very large images?

    Read the article

  • where can i get cables for the canon Mx310

    - by Tarrasch
    Hey there, a friend of mine gave me a printer/scanner because he could not print with it anymore. the point is this thing has been lying in the cellar for quite some time now and the cables are missing. that is the power cable for my power plug ( there are foreign ones included) and more importantly the connection to the computer. I have googled around for a bit and tried to get to a hotline,but my problem is : Where can i get those cables from? Can anyne help me get a clue where to find those, where to ask for something like this? cheers

    Read the article

  • Batch print, reprint and scan

    - by Nikita K. Tsarov
    I am using ubuntu 13.10 with Epson wireless scanner/printer/fax WF 2540(It has an automatic document feeder- ADF). What I am trying to achieve is to be able to print with confidence over already populated A4 pages(hand drawn or otherwise). The idea is to get a batch of A4 pages grouped in a particular order and have them batch printed on specific parts of each page ,viewed on screen and edit/processed page by page. My idea was to batch scan the documents in order and display each scanned page to use that to judge/fit on-screen the coordinates for the output of each pages image... The easiest way to explain this is to look at these slide : https://drive.google.com/file/d/0B0Kuhf6iBidTNUl3U1NtT0pGbnc/edit?usp=sharing I would like to have this automated as much as possible using this printer but I am open to other suggestions. Are there any other better printers that can automatically scan and print at the document that is being scanned...with an accurate positioning in relation to elements already printed on the page?? Are there any other forums I should be asking and looking for answer/suggestions on my case/dilema??

    Read the article

  • Windows 7 100% Memory Usage (without any process listed as using that much memory)

    - by Paul Tarjan
    When I plug my external USB 2TB hard drive into my windows 7 box, my RAM usage climbs up to all 4 Gigs (but in task manager it shows that all process are small) and the hard drive is churning like crazy. My CPU is only about 20% utilized All I can think of is there is a Virus scanner or an indexer running like crazy. I've tried to kill all virus scanners (AVG and Windows Security Essentials) and it still keeps going. My computer is completely unusable as everything is constantly swapping. I've tried leaving it on for 2 days now and it still hasn't finished whatever it was doing. Any ideas?

    Read the article

  • All created VPNs result in Error 720

    - by campo
    I have a few different VPNs I need to connect to. I'm using windows 8 and standard ptpp VPN. Every VPN I have created though results in the same error: Error 720: A connection to the remote computer could not be established You might need to change the network settings for this connection The VPN works in Windows 7 and XP. I'm not sure if this has something to do with my new laptop or if its something with Windows 8 itself. Any help would be greatly appreciated and if there is any extra info I can provide please let me know. Edit: I've tried with virus scanner turned off and windows firewall turned off as well and I still receive the same error message.

    Read the article

  • SQLAlchemy session management in long-running process

    - by codeape
    Scenario: A .NET-based application server (Wonderware IAS/System Platform) hosts automation objects that communicate with various equipment on the factory floor. CPython is hosted inside this application server (using Python for .NET). The automation objects have scripting functionality built-in (using a custom, .NET-based language). These scripts call Python functions. The Python functions are part of a system to track Work-In-Progress on the factory floor. The purpose of the system is to track the produced widgets along the process, ensure that the widgets go through the process in the correct order, and check that certain conditions are met along the process. The widget production history and widget state is stored in a relational database, this is where SQLAlchemy plays its part. For example, when a widget passes a scanner, the automation software triggers the following script (written in the application server's custom scripting language): ' wiget_id and scanner_id provided by automation object ' ExecFunction() takes care of calling a CPython function retval = ExecFunction("WidgetScanned", widget_id, scanner_id); ' if the python function raises an Exception, ErrorOccured will be true ' in this case, any errors should cause the production line to stop. if (retval.ErrorOccured) then ProductionLine.Running = False; InformationBoard.DisplayText = "ERROR: " + retval.Exception.Message; InformationBoard.SoundAlarm = True end if; The script calls the WidgetScanned python function: # pywip/functions.py from pywip.database import session from pywip.model import Widget, WidgetHistoryItem from pywip import validation, StatusMessage from datetime import datetime def WidgetScanned(widget_id, scanner_id): widget = session.query(Widget).get(widget_id) validation.validate_widget_passed_scanner(widget, scanner) # raises exception on error widget.history.append(WidgetHistoryItem(timestamp=datetime.now(), action=u"SCANNED", scanner_id=scanner_id)) widget.last_scanner = scanner_id widget.last_update = datetime.now() return StatusMessage("OK") # ... there are a dozen similar functions My question is: How do I best manage SQLAlchemy sessions in this scenario? The application server is a long-running process, typically running months between restarts. The application server is single-threaded. Currently, I do it the following way: I apply a decorator to the functions I make avaliable to the application server: # pywip/iasfunctions.py from pywip import functions def ias_session_handling(func): def _ias_session_handling(*args, **kwargs): try: retval = func(*args, **kwargs) session.commit() return retval except: session.rollback() raise return _ias_session_handling # ... actually I populate this module with decorated versions of all the functions in pywip.functions dynamically WidgetScanned = ias_session_handling(functions.WidgetScanned) Question: Is the decorator above suitable for handling sessions in a long-running process? Should I call session.remove()? The SQLAlchemy session object is a scoped session: # pywip/database.py from sqlalchemy.orm import scoped_session, sessionmaker session = scoped_session(sessionmaker()) I want to keep the session management out of the basic functions. For two reasons: There is another family of functions, sequence functions. The sequence functions call several of the basic functions. One sequence function should equal one database transaction. I need to be able to use the library from other environments. a) From a TurboGears web application. In that case, session management is done by TurboGears. b) From an IPython shell. In that case, commit/rollback will be explicit. (I am truly sorry for the long question. But I felt I needed to explain the scenario. Perhaps not necessary?)

    Read the article

  • Parsing a Directory of files - Check for a String

    - by i.h4d35
    This is my first post here so kindly pardon any mistakes that I have. I'm still learning to find my way around Stack Exchange. I am trying to write a Java program that tries to scan a Directory full of either .txt,.rtf or.doc files(and none other). The aim is to search all the files in the directory, and find out if a particular string exists in the file. If it does, it returns the string and the filename that it found the string in. The aim of this program is, it is a project for school wherein the program scans the personal folders of call center employees to check if they have stored any CC/DC nos and if yes, report the folder name - to reduce CC fraud. The search function was fairly straight forward and works when I individually specify the filename. However, the searching the directory and passing the files to the search function has me stumped. I've posted my code so far, if you guys could look thru it and give me some feedback/suggestions, I'd really appreciate it. Thanks in advance import java.io.*; import java.util.*; public class parse2{ void traverse(String directory) throws FileNotFoundException { File dir = new File(directory); if (dir.isDirectory()) { String[] children = dir.list(); for (int i=0; i<children.length; i++) { //System.out.println("\n" + children[i]); reader(children[i]); } } } void reader(String loc) throws FileNotFoundException { FileReader fr = new FileReader(loc); BufferedReader br = new BufferedReader(fr); Scanner sc = new Scanner(br); char[] chkArray; int chk=1; char ch; while(sc.hasNext()) { String chkStr = sc.next(); chkArray = chkStr.toCharArray(); if ((chkArray[0]=='4')&&(chkStr.length()>13)) { for(int i=0;i<chkArray.length;i++) { ch=chkArray[i]; if((ch=='0')||(ch=='1')||(ch=='2')||(ch=='3')||(ch=='4')||(ch=='5')||(ch=='6')||(ch=='7')||(ch=='8')||(ch=='9')) { chk=0; continue; } else { chk=1; break; } } if(chk==0) System.out.println("\n"+ chkStr); } else if((chkArray[0]=='5')&&(chkStr.length()>13)) { for(int i=0;i<chkArray.length;i++) { ch=chkArray[i]; if((ch=='0')||(ch=='1')||(ch=='2')||(ch=='3')||(ch=='4')||(ch=='5')||(ch=='6')||(ch=='7')||(ch=='8')||(ch=='9')) { chk=0; continue; } else { chk=1; break; } } if(chk==0) System.out.println("\n"+ chkStr); } else if((chkArray[0]=='6')&&(chkStr.length()>13)) { for(int i=0;i<chkArray.length;i++) { ch=chkArray[i]; if((ch=='0')||(ch=='1')||(ch=='2')||(ch=='3')||(ch=='4')||(ch=='5')||(ch=='6')||(ch=='7')||(ch=='8')||(ch=='9')) { chk=0; continue; } else { chk=1; break; } } if(chk==0) System.out.println("\n"+ chkStr); } } } public static void main(String args[]) throws FileNotFoundException { parse2 P = new parse2(); P.traverse("C:/Documents and Settings/h4d35/Desktop/javatest/chk"); } }

    Read the article

  • Array not showing in Jlist but filled in console

    - by OVERTONE
    Hey there. been a busy debugger today. ill give ths short version. ive made an array list that takes names from a database. then i put the contents of the arraylist into an array of strings. now i want too display the arrays contents in a JList. the weird thing is it was working earlier. and ive two methods. ones just a little practice too make sure i was adding to the Jlist correctly. so heres the key codes. this is the layout of my code. variables constructor methods in my variables i have these 3 defined String[] contactListNames = new String[5]; ArrayList<String> rowNames = new ArrayList<String>(); JList contactList = new JList(contactListNames); simple enough. in my constructor i have them again. contactListNames = new String[5]; contactList = new JList(contactListNames); //i dont have the array list defined though. printSqlDetails(); // the prinSqldetails was too make sure that the connectionw as alright. and its working fine. fillContactList(); // this is the one thats causing me grief. its where all the work happens. // fillContactListTest(); // this was the tester that makes sure its adding to the list alright. heres the code for fillContactListTest() public void fillContactListTest() { for(int i = 0;i<3;i++) { try { String contact; System.out.println(" please fill the list at index "+ i); Scanner in = new Scanner(System.in); contact = in.next(); contactListNames[i] = contact; in.nextLine(); } catch(Exception e) { e.printStackTrace(); } } } heres the main one thats supposed too work. public void fillContactList() { int i =0; createConnection(); ArrayList<String> rowNames = new ArrayList<String>(); try { Statement stmt = conn.createStatement(); ResultSet namesList = stmt.executeQuery("SELECT name FROM Users"); try { while (namesList.next()) { rowNames.add(namesList.getString(1)); contactListNames =(String[])rowNames.toArray(new String[rowNames.size()]); // this used to print out contents of array list // System.out.println("" + rowNames); while(i<contactListNames.length) { System.out.println(" " + contactListNames[i]); i++; } } } catch(SQLException q) { q.printStackTrace(); } conn.commit(); stmt.close(); conn.close(); } catch(SQLException e) { e.printStackTrace(); } } i really need help here. im at my wits end. i just cant see why the first method would add to the JList no problem. but the second one wont. both the contactListNames array and array list can print fine and have the names in them. but i must be transfering them too the jlist wrong. please help p.s im aware this is long. but trust me its the short version.

    Read the article

  • GUI Freezes and Output to JTextField from user input

    - by user2929005
    I am having I hope only two issues currently. I have had help on this on a previous question that I have asked but now I am running into different issues. My current issues now is that I need to print out into a JTextField a sorted array. I do not have questions about how to sort the array I just would like help on how to get the array to print to the JTextField when the Bubble Sort button is pressed. Currently when I press the button it freezes. It freezes at this line. list.add(Integer.valueOf(input.nextInt())); please help Thank you. import java.awt.EventQueue; import javax.swing.*; import java.awt.event.*; import java.util.*; public class Sorting { private JFrame frame; private JTextArea inputArea; private JTextField outputArea; ArrayList<Integer> list = new ArrayList<Integer>(); Scanner input = new Scanner(System.in); /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Sorting window = new Sorting(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public Sorting() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Sorting"); frame.getContentPane().setLayout(null); JButton bubbleButton = new JButton("Bubble Sort"); bubbleButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { list.add(Integer.valueOf(input.nextInt())); // for(int i = 0; i < list.size(); i++){ // // } } }); bubbleButton.setBounds(10, 211, 114, 23); frame.getContentPane().add(bubbleButton); JButton mergeButton = new JButton("Merge Sort"); mergeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); mergeButton.setBounds(305, 211, 114, 23); frame.getContentPane().add(mergeButton); JButton quickButton = new JButton("Quick Sort"); quickButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); quickButton.setBounds(163, 211, 114, 23); frame.getContentPane().add(quickButton); inputArea = new JTextArea(); inputArea.setBounds(10, 36, 414, 51); frame.getContentPane().add(inputArea); outputArea = new JTextField(); outputArea.setEditable(false); outputArea.setBounds(10, 98, 414, 59); frame.getContentPane().add(outputArea); outputArea.setColumns(10); JLabel label = new JLabel("Please Enter 5 Numbers"); label.setHorizontalAlignment(SwingConstants.CENTER); label.setBounds(10, 11, 414, 14); frame.getContentPane().add(label); } }

    Read the article

  • Problems with instantiating in JAVA

    - by PUPIALEX
    When running, below programme cannot reach the end of the main function.. I am new to JAVA, and cannot find its defections.. I need your help. Thanks. import java.util.*; class Schedule { public String day; private int startTime, endTime; public Schedule(String input_day, int input_start, int input_end) { day = input_day; startTime = input_start; endTime = input_end; } /* clashWith: to check whether this schedule clash with a Schedule called otherSchedule * PRE-Condition : input must be of Schedule type * POST-Condition : return true if two Schedule clash, return false if not. */ public boolean clashWith(Schedule otherSchedule) { if(this.day != otherSchedule.day || this.endTime <= otherSchedule.startTime || this.startTime >= otherSchedule.endTime) return false; return true; } } class Module { String code; Schedule lecture, tutorial, lab; public Module(String input_code, Schedule input_lecture, Schedule input_tutorial, Schedule input_lab) { code = input_code; lecture = input_lecture; tutorial = input_tutorial; lab = input_lab; } /* count: to count number of classes(lecture, tutorial, and lab of only this Module) on day. * For example: when day = "Monday", lecture is on Monday, tutorial is on Monday * but lab is on Tuesday, then return 2. (lecture and tutorial are on Monday). * PRE-Condition : * POST-Condition : */ public int count(String day) { int num = 0; if(lecture.day == day) num++; if(tutorial.day == day) num++; if(lab.day == day) num++; return num; } /* clashWith: to check whether this module clash with a Module called otherModule * PRE-Condition : * POST-Condition : */ public boolean clashWith(Module otherModule) { if(lecture.clashWith(otherModule.lecture) || lecture.clashWith(otherModule.tutorial) || lecture.clashWith(otherModule.lab) ) return true; if(tutorial.clashWith(otherModule.lecture) || tutorial.clashWith(otherModule.tutorial) || tutorial.clashWith(otherModule.lab)) return true; if(lab.clashWith(otherModule.lecture) || lab.clashWith(otherModule.tutorial) || lab.clashWith(otherModule.lab)) return true; return false; } } class Timetable { Vector<Module> listOfModule; public Timetable() { } /* checkClash: to check whether otherModule clash with one of * the modules in our timetable list. * PRE-Condition : * POST-Condition : */ public boolean checkClash(Module otherModule) { for(Module c: listOfModule) if(c.clashWith(otherModule)) return true; return false; } /* add: to add a new module to the timetable list. * PRE-Condition : * POST-Condition : */ public void add(Module module) { listOfModule.add(module); } /* count: to count number of classes on day. * PRE-Condition : * POST-Condition : */ public int count(String day) { int count_day=0; for(Module c: listOfModule) count_day += c.count(day); return count_day; } } public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int num_operation; String code ; Timetable userTimetable = new Timetable(); num_operation = input.nextInt(); for(int i=0;i<num_operation;i++) { if(input.next() == "MODULE") { code = input.next(); String day; int start, end; Schedule getLecSche = new Schedule(input.next(),input.nextInt(),input.nextInt()); Schedule getTutSche = new Schedule(input.next(),input.nextInt(),input.nextInt()); Schedule getLabSche = new Schedule(input.next(),input.nextInt(),input.nextInt()); Module userModule = new Module(code, getLecSche, getTutSche, getLabSche); System.out.println("Reached line 162"); if(!userTimetable.checkClash(userModule)) { userTimetable.add(userModule); System.out.println("Added"); } else System.out.println("Clashed"); } else if(input.next() == "COUNT"){ code = input.next(); System.out.println(userTimetable.count(code)); } } } }

    Read the article

  • When I try to redefine a variable, I get an index out of bounds error

    - by user2770254
    I'm building a program to act as a calculator with memory, so you can give variables and their values. Whenever I'm trying to redefine a variable, a = 5, to a = 6, I get an index out of bounds error. public static void main(String args[]) { LinkedHashMap<String,Integer> map = new LinkedHashMap<String,Integer>(); Scanner scan = new Scanner(System.in); ArrayList<Integer> values = new ArrayList<>(); ArrayList<String> variables = new ArrayList<>(); while(scan.hasNextLine()) { String line = scan.nextLine(); String[] tokens = line.split(" "); if(!Character.isDigit(tokens[0].charAt(0)) && !line.equals("clear") && !line.equals("var")) { int value = 0; for(int i=0; i<tokens.length; i++) { if(tokens.length==3) { value = Integer.parseInt(tokens[2]); System.out.printf("%5d\n",value); if(map.containsKey(tokens[0])) { values.set(values.indexOf(tokens[0]), value); variables.set(variables.indexOf(tokens[0]), tokens[0]); } else { values.add(value); } break; } else if(tokens[i].charAt(0) == '+') { value = addition(tokens, value); System.out.printf("%5d\n",value); variables.add(tokens[0]); if(map.containsKey(tokens[0])) { values.set(values.indexOf(tokens[0]), value); variables.set(variables.indexOf(tokens[0]), tokens[0]); } else { values.add(value); } break; } else if(i==tokens.length-1 && tokens.length != 3) { System.out.println("No operation"); break; } } map.put(tokens[0], value); } if(Character.isDigit(tokens[0].charAt(0))) { int value = 0; if(tokens.length==1) { System.out.printf("%5s\n", tokens[0]); } else { value = addition(tokens, value); System.out.printf("%5d\n", value); } } if(line.equals("clear")) { clear(map); } if(line.equals("var")) { variableList(variables, values); } } } public static int addition(String[] a, int b) { for(String item : a) { if(Character.isDigit(item.charAt(0))) { int add = Integer.parseInt(item); b = b + add; } } return b; } public static void clear(LinkedHashMap<String,Integer> b) { b.clear(); } public static void variableList(ArrayList<String> a, ArrayList<Integer> b) { for(int i=0; i<a.size(); i++) { System.out.printf("%5s: %d\n", a.get(i), b.get(i)); } } I included the whole code because I'm not sure where the error is arising from.

    Read the article

  • reading a random access file

    - by user1067332
    The file I create has text in it, but when i try to read it, the output is null. here is the file the creates the text file, it creates the file and puts it in the right postion import java.util.*; import java.io.*; public class CreateCustomerFile { public static void main(String[] args) throws IOException { int pos; RandomAccessFile it = new RandomAccessFile("CustomerFile.txt", "rw"); Scanner input = new Scanner(System.in); int id; String name; int zip; final int RECORDSIZE = 100; final int NUMRECORDS = 1000; final int STOP = 99; try { for(int x = 0; x < NUMRECORDS; ++x) { it.writeInt(0); it.writeUTF(""); it.writeInt(0); } } catch(IOException e) { System.out.println("Error: " + e.getMessage()); } finally { it.close(); } it = new RandomAccessFile("CustomerFile.txt","rw"); try { System.out.print("Enter ID number" + " or " + STOP + " to quit "); id = input.nextInt(); while(id != STOP) { input.nextLine(); System.out.print("Enter last name"); name = input.nextLine(); System.out.print("Enter zipcode "); zip = input.nextInt(); pos = id - 1; it.seek(pos * RECORDSIZE); it.writeInt(id); it.writeUTF(name); it.writeInt(zip); System.out.print("Enter ID number" + " or " + STOP + " to quit "); id = input.nextInt(); } } catch(IOException e) { System.out.println("Error: " + e.getMessage()); } finally { it.close(); } } } Here is the file to read, the pos is correct but ouput always goes to the error: null. import javax.swing.*; import java.io.*; public class CustomerItemOrder { public static void main(String[] args) throws IOException { int pos; RandomAccessFile it = new RandomAccessFile("CustomerFile.txt","rw"); String inputString; int id, zip; String name; final int RECORDSIZE = 100; final int STOP = 99; inputString = JOptionPane.showInputDialog(null, "Enter id or "+ STOP + " to quit"); id = Integer.parseInt(inputString); try { while(id != STOP) { pos = id -1 ; it.seek(pos * RECORDSIZE ); id = it.readInt(); name = it.readLine(); zip = it.readInt(); JOptionPane.showMessageDialog(null, "ID:" + id + " last name is " + name + " and zipcode is " + zip); inputString = JOptionPane.showInputDialog(null, "Enter id or " + STOP + " to quit"); id = Integer.parseInt(inputString); } } catch(IOException e) { System.out.println("Error: " + e.getMessage()); } finally { it.close(); } } }

    Read the article

  • Need help in creating test application in Java and passing parameters into a new designed Java API.

    - by Christophe
    Need help, Please!!! By following the protocol, the Request should be built in 5 byte length, including 1 byte for changing Braud rate (Speed), and send request to a RS-232 port. Protocol: Request for the command processing, with optional extra byte for changing Baud Rate: LGT : length message ( LGT = 5 ) TYPE : 0x06 TO(time out): 0x0000 CMD : (1 byte) 0x02 application update Baud Rate : (1 byte) 0xNN (optional parameter to change baud rate of the Mnt App) where NN can be: 0x00 = No Baud Rate Change (similar to 4-byte command above) 0x09 = Change to 9600 Baud for Application Update speed 0x0A = Change to 19200 Baud for Application Update speed 0x0E = Change to 115200 Baud for Application Update speed All other bytes are not accepted and will result in a status of 0x01. I'm trying to test if my code works or not by creating another class (TestApplication.java) and pass the "3 differenr Baut rate" to this CPXAppliaction. the 3 Baud Rate is supposed to input by reading a file.txt. Question: How do you think these code (first half)? please don't warry about the details about the "sending part". I mean, do I need setter/getter for the "speed" parameter pass? I created the demo test class DemoApp.java (input speed by reading a txt file, and pass into CPXAppliaction). how do you think about that code? Many thanks to you guys!! public class CPXApplication extends CPXCommand { private int speed; . public CPXApplication() { speed = 9600; } public CPXApplication(int speedinit) { speed = speedinit; // TODO: where to get the speed? } protected void buildRequest() throws ElitePortException { String trans = ""; // build the full-qualified message following the protocol trans = addToRequest(trans, (char) 0); trans = addToRequest(trans, (char) 5); trans = addToRequest(trans, (char) 6); trans = addToRequest(trans, (char) 0); trans = addToRequest(trans, (char) 0); trans = addToRequest(trans, (char) 2); switch (speed) { case 9600: trans = addToRequest(trans, (char) 0x09); break; case 19200: trans = addToRequest(trans, (char) 0x0A); break; case 115200: trans = addToRequest(trans, (char) 0x0E); break; default: // TODO: unexpected baud rate. throw(); break; } trans = EncryptBinary(trans); trans = "F0." + trans; wrapRequest(trans); } protected String addToRequest(String req, char c) { return req + c; } protected String addToRequest(String req, String s) { return req + s; } protected String addToRequest(String req) { return req; } public void analyzeResponse() { //.............. } } Here is the demo test code: class Run { public static void run() { CPXAppliaction input = new CpXApplication(); int lineno = 0; try { FileReader fr = new FileReader("baudRateSpeed.txt"); BufferedReader reader = new BufferedReader(fr); String line = reader.readLine(); Scanner scan = null; while (line != null) { scan = new Scanner(line); String speed; speed = scan.next(); if (lineno == 0) { input.speed = speed; lineno++; } else { input = cpxapplication(speed, input); } line = reader.readLine(); } reader.close(); } catch (FileNotFoundException e) { System.out.println("Could not find the file"); } catch (IOException e) { System.out.println("Had a problem reading from file"); } } } public class DemoApp{ public void main(String args[]) { run(); }

    Read the article

  • Why does this program stop running?

    - by designloper
    Hi everyone....I am developing a card making system...nothing fancy. Right got this far but program now stops running with no error when running after the first card sample i.e. " Enter 'OK' if this card is OK, otherwise enter an alternative border character: + ". Any suggestions Java Masters? //Ask user for input //makes use of print line method System.out.println("Enter name: "); //took the variables //called the object of the scanner 'cardOrder' //and use the Scanner objects method '.nextLine' //to read the next line of the input firstName = cardOrder.nextLine(); mInitial = cardOrder.nextLine(); lastName = cardOrder.nextLine(); //Print out the "Here is a sample card" + the first name, middle initial and last name System.out.println("Here is a sample card: \n\n" + firstName + mInitial + lastName + "**************" + "**************" + firstName + mInitial + lastName + "\n* *" + "\n*" + " " + firstName + mInitial + lastName + " *" + "\n* *\n" + firstName + mInitial + lastName +"**************" + "**************" + firstName + mInitial + lastName + "\n"); //Ask user is the card is OK to proceed to order query or if they want an alternative border character: + System.out.println("Enter 'OK' if this card is OK, otherwise enter an alternative border character: + "); //Check if user entered "OK" and store it in var optionA optionA = cardOrder.nextLine(); //test if (a == optionA){ System.out.println("\nHow many cards would you like? "); cardsOrdered = cardOrder.nextInt(); equals = (int) (cardPriceA * cardsOrdered); System.out.println("The price of " + cardsOrdered + " cards"+ " is £" + equals + ".\n"); System.out.println("No Discount given."); } else if(b == optionA) { //Print out the "Here is a sample card" + the first name, middle initial and last name System.out.println("Here is a sample card: \n\n" + firstName + mInitial + lastName + "++++++++++++++" + "++++++++++++++" + firstName + mInitial + lastName + "\n+ +" + "\n+" + " " + firstName + mInitial + lastName + " +" + "\n+ +\n" + firstName + mInitial + lastName +"++++++++++++++" + "++++++++++++++" + firstName + mInitial + lastName + "\n"); //Ask user is the card is OK to proceed to order query or if they want an alternative border character: + System.out.println("Enter 'OK' if this card is OK, otherwise enter an alternative border character: OK "); //Check if user entered "OK" and store it in var optionA optionA = cardOrder.nextLine(); if (a == optionA){ System.out.println("\nHow many cards would you like? "); cardsOrdered = cardOrder.nextInt(); equals = (int) (cardPriceA * cardsOrdered); System.out.println("The price of " + cardsOrdered + " cards"+ " is £" + equals + ".\n"); System.out.println("No Discount given."); } } else if (c == optionA) {//Print out the "Here is a sample card" + the first name, middle initial and last name System.out.println("Here is a sample card: \n\n" + firstName + mInitial + lastName + "**************" + "**************" + firstName + mInitial + lastName + "\n* *" + "\n*" + " " + firstName + mInitial + lastName + " *" + "\n* *\n" + firstName + mInitial + lastName +"**************" + "**************" + firstName + mInitial + lastName + "\n"); //Ask user is the card is OK to proceed to order query or if they want an alternative border character: + System.out.println("Enter 'OK' if this card is OK, otherwise enter an alternative border character: + "); //Check if user entered "OK" and store it in var optionA optionA = cardOrder.nextLine(); if (a == optionA){ System.out.println("\nHow many cards would you like? "); cardsOrdered = cardOrder.nextInt(); equals = (int) (cardPriceA * cardsOrdered); System.out.println("The price of " + cardsOrdered + " cards"+ " is £" + equals + ".\n"); System.out.println("No Discount given."); } }

    Read the article

  • my Search method is coming up with all nulls

    - by Epic.Distortion
    Let me give a quick explanation. I took a 5 week course through a company on Java in July. They covered basic stuff, like console app, crud operations, mysql, and n-tier architecture. Since the course ended I didn't use it much because I went back to work, and other medical reasons surfaced....blah blah. I was told by the company to make a simple program to reflect what I learned. Turns out I retained very little. I decided to make a video game starage program. It would be used to stare your video games so you wouldn't have to search your bookcase(or how ever you store your games.) It is a basic console app using the crud operations with MYSQL. I can't get my search function to actually work. I have 2 layers a Presentation layer and a Logic layer. The search method allows them to search for a game by the title. when i bring run the program and use Search it only displays the title and the rest is null. here is my Presentation layer: private static Games SearchForGame() { Logic aref = new Logic(); Games g = new Games(); Scanner scanline = new Scanner(System.in); System.out.println("Please enter the name of the game you wish to find:"); g.setTitle(scanline.nextLine()); aref.SearchGame(); System.out.println(); System.out.println("Game Id: " + g.getGameId()); System.out.println("Title: " + g.getTitle()); System.out.println("Rating: " + g.getRating()); System.out.println("Platform: "+ g.getPlatform()); System.out.println("Developer: "+ g.getDeveloper()); return g; } and here is my logic layer public Games SearchGame() { Games g = new Games(); try { Class.forName(driver).newInstance(); Connection conn = DriverManager.getConnection(url+dbName,userName,password); java.sql.PreparedStatement statement = conn.prepareStatement("SELECT GameId,Title,Rating,Platform,Developer FROM games WHERE Title=?"); statement.setString(1, g.getTitle()); ResultSet rs = statement.executeQuery(); while(rs.next()){ g.setGameId(rs.getInt("GameId")); g.setTitle(rs.getString("Title")); g.setRating(rs.getString("Rating")); g.setPlatform(rs.getString("Platform")); g.setDeveloper(rs.getString("Developer")); statement.executeUpdate(); } } catch (Exception e) { e.printStackTrace(); } return g; } here is also my last results Please enter the name of the game you wish to find: Skyrim Game Id: 0 Title: Skyrim Rating: null Platform: null Developer: null any help would be greatly appreciated and thanks in advance EDIT: here is my code for my games class public class Games { public int GameId; public String Title; public String Rating; public String Platform; public String Developer; public int getGameId() { return GameId; } public int setGameId(int gameId) { return GameId = gameId; } public String getTitle() { return Title; } public String setTitle(String title) { return Title = title; } public String getRating() { return Rating; } public void setRating(String rating) { Rating = rating; } public String getPlatform() { return Platform; } public void setPlatform(String platform) { Platform = platform; } public String getDeveloper() { return Developer; } public void setDeveloper(String developer) { Developer = developer; } }

    Read the article

  • Entity Framework: How to bind related products

    - by Waheed
    I am using the following Linq query from p in Product.Include("ProductDetails.Colors") where p.ProductID.Equals(18) select p; And then using the result of this query to bind the GridView. The productDetails are bind to the grid fine, but the Colors are not bind. To bind colors i am using <%# Eval("Colors.CategoryName") %. Error is " Field or property with the name 'Colors.CategoryName' was not found on the selected data source." But in a loop i am getting this fine. foreach (ProductDetails proDet in pd.ProductDetails) { string bar = proDet.BarCode; string color = proDet.Colors.CategoryName; }

    Read the article

  • USB to Serial cables with CDC support

    - by Harsha
    Hi all, Are there are USB to Serial cables with CDC support? I recently bought these below mentioned cables which claims that they are CDC 1.1 complaint. However, when we received the cables on our verification we found that they were reporting vendor specific device descriptors. Manufacturer Barcode Part Number Quantity Link CABLEMAX 45643276422244 USB-1S1PQ 4 http://www.usbgear.com/USB-1S1PQ.html CABLEMAX USBG-US-232 USBG-US-232 4 linkhttp://www.usbgear.com/USBG-US-232.html linkhttp://www.made-in-china.com/showroom/trankoo/product-detailebsQoMuKExrj/China-USB-To-RS232-Cable.html Has anyone used USB to Serial cables with CDC support? Please advise! Thanks for your help.

    Read the article

  • How do I trap the ENTER key in WM 6.1 using C++

    - by Rob King
    Hi,Our barcode scanner application is written in C++ eMbedded V 4.00 and works well on the Motorola MC50 WM5 where the ENTER key is interpreted as an IDOK. We are moving the app to the MC55 with WM6.1 and the ENTER key does not translate to an IDOK. I'm of the impression we will have to programatically trap the key entry (or the value passed on via DataWedge). I have made several attempts to implement either a HOTKEY or something via an Accelerator Table but have been unable to interpret the Microsoft on-line descriptions. If there is a simpler answer that would be good news. If not, a more specific example than the MS samples would be greatly appreciated. Thanks in advance.

    Read the article

< Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >