Search Results

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

Page 39/42 | < Previous Page | 35 36 37 38 39 40 41 42  | Next Page >

  • Event Handling for MFC Dialog

    - by Maksud
    This is my second question of the day, pardon me. I am writing a wrapper library to communicate with a scanner device. The source code was in C++ MFC. I am converting it to a plain Dll which will be invoked from C#. So, I am using DllImport in C# to call the wrapper library. Now I am provided with MFC code and the library is a ActiveX Object, at least I think so. class CDpocx : public CWnd { } So in my wrapper library I will have an instance of CDpocx and will call it via C# P/Invoke. But the problem is CDpocx also throws some events which I need to catch. In traditional app, I would just attach an function with it. But How would I attach the events on non MFC class. I have seen something like: BEGIN_EVENTSINK_MAP(CVC60Dlg, CDialog) //{{AFX_EVENTSINK_MAP(CVC60Dlg) ON_EVENT(CVC60Dlg, IDC_DPOCXCTRL1, 1 , OnReadyDpocxctrl1, VTS_NONE) //}}AFX_EVENTSINK_MAP END_EVENTSINK_MAP() OnReadyDpocxctrl1 is the function that handles 1 (Ready) event. How can I gain simmilar function in non MFC class. Regards, Maksud

    Read the article

  • Better why of looping to detect change.

    - by Dremation
    As of now I'm using a while(true) method to detect changes in memory. The problem with this is it's kill the applications performance. I have a list of 30 pointers that need checked as rapidly as possible for changes, without sacrificing a huge performance loss. Anyone have ideas on this? memScan = new Thread(ScanMem); public static void ScanMem() { int i = addy.Length; while (true) { Thread.Sleep(30000); //I do this to cut down on cpu usage for (int j = 0; j < i; j++) { string[] values = addy[j].Split(new char[] { Convert.ToChar(",") }); //MessageBox.Show(values[2]); try { if (Memory.Scanner.getIntFromMem(hwnd, (IntPtr)Convert.ToInt32(values[0], 16), 32).ToString() != values[1].ToString()) { //Ok, it changed lets do our work //work if (Globals.Working) return; SomeFunction("Results: " + values[2].ToString(), "Memory"); Globals.Working = true; }//end if }//end try catch { } }//end for }//end while }//end void

    Read the article

  • Using HttpClient with SSL and certificates

    - by ChrisCM
    While I've been familiar with HTTPS and the concept of SSL, I have recently begun some development and found I am a little confused. The requirement was that I write a small Java application that runs on a machine attached to a scanner. When a document is scanned this is picked up and the file (usually PDF) sent over the internet to our application server that will then process it. I've written the application using Apache Commons libraries and HTTPClient. The second requirement was to connect over SSL, requiring a certificate. Following guidance on the HTTPclient page I am using AuthSSLProtocolSocketFactory from the contributions page. The constructor can take a keystore, keystore password, truststore and truststore password. As an initial test our DBA enabled SSL on one of our development webservers and provided me with a .p12 file which when I imported into IE allows me to connect successfully. I am a bit confused between keystores and truststores and what steps I need to take using the keytool. I tried importing the p12 into a keystore file but get the error: keytool error: java.lang.Exception: Input not an X.509 certificate I followed a suggestion of importing the p12 into Internet Explorer and exporting as a .cer which I can then successfully import into a keystore. When I supply this as a keystore argument of the AuthSSLProtocolSocketFactory I get a meaningless errror, but if I try it as a truststore it seems like it reads it fine but ultimately I get Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: bad_certificate I am unsure if I have missed some steps, I am misunderstanding SSL and mutual authentication altogether or this is mis-configuration on the server side. Can anyone provide suggestions or point me towards resources that might help me figure this out please?

    Read the article

  • What does stdole.dll do?

    - by rc1
    We have a large C# (.net 2.0) app which uses our own C++ COM component and a 3rd party fingerprint scanner library also accessed via COM. We ran into an issue where in production some events from the fingerprint library do not get fired into the C# app, although events from our own C++ COM component fired and were received just fine. Using MSINFO32 to compare the loaded modules on a working system to those on a failing system we determined that this was caused by STDOLE.DLL not being in the GAC and hence not loaded into the faulty process. Dragging this file into the GAC caused events to come back fine from the fingerprint COM library. So what does stdole.dll do? It's 16k in size so it can't be much... is it some sort of link to another library like STDOLE32? How come its absence causes such odd behavior? How do we distribute stdole.dll? This is an XCOPY deploy app and we don't use the GAC. Should we package it as a resource and use the System.EnterpriseServices.Internal.Publish.GacInstall to ensure it's in the GAC?

    Read the article

  • Parsing Lisp S-Expressions with known schema in C#

    - by Drew Noakes
    I'm working with a service that provides data as a Lisp-like S-Expression string. This data is arriving thick and fast, and I want to churn through it as quickly as possible, ideally directly on the byte stream (it's only single-byte characters) without any backtracking. These strings can be quite lengthy and I don't want the GC churn of allocating a string for the whole message. My current implementation uses CoCo/R with a grammar, but it has a few problems. Due to the backtracking, it assigns the whole stream to a string. It's also a bit fiddly for users of my code to change if they have to. I'd rather have a pure C# solution. CoCo/R also does not allow for the reuse of parser/scanner objects, so I have to recreate them for each message. Conceptually the data stream can be thought of as a sequence of S-Expressions: (item 1 apple)(item 2 banana)(item 3 chainsaw) Parsing this sequence would create three objects. The type of each object can be determined by the first value in the list, in the above case "item". The schema/grammar of the incoming stream is well known. Before I start coding I'd like to know if there are libraries out there that do this already. I'm sure I'm not the first person to have this problem.

    Read the article

  • Serialization Performance and Google Android

    - by Jomanscool2
    I'm looking for advice to speed up serialization performance, specifically when using the Google Android. For a project I am working on, I am trying to relay a couple hundred objects from a server to the Android app, and am going through various stages to get the performance I need. First I tried a terrible XML parser that I hacked together using Scanner specifically for this project, and that caused unbelievably slow performance when loading the objects (~5 minutes for a 300KB file). I then moved away from that and made my classes implement Serializable and wrote the ArrayList of objects I had to a file. Reading that file into the objects the Android, with the file already downloaded mind you, was taking ~15-30 seconds for the ~100KB serialized file. I still find this completely unacceptable for an Android app, as my app requires loading the data when starting the application. I have read briefly about Externalizable and how it can increase performance, but I am not sure as to how one implements it with nested classes. Right now, I am trying to store an ArrayList of the following class, with the nested classes below it. public class MealMenu implements Serializable{ private String commonsName; private long startMillis, endMillis, modMillis; private ArrayList<Venue> venues; private String mealName; } And the Venue class: public class Venue implements Serializable{ private String name; private ArrayList<FoodItem> foodItems; } And the FoodItem class: public class FoodItem implements Serializable{ private String name; private boolean vegan; private boolean vegetarian; } IF Externalizable is the way to go to increase performance, is there any information as to how java calls the methods in the objects when you try to write it out? I am not sure if I need to implement it in the parent class, nor how I would go about serializing the nested objects within each object.

    Read the article

  • Why isn't module_filters filtering Mail::IspMailGate in CPAN::Mini?

    - by user304122
    Edited - Ummm - now have a module in schwigon giving same problem !! I am on a corporate PC that forces mcshield on everything that moves. I get blocked when trying to mirror on ... authors/id/J/JV/JV/EekBoek-2.00.01.tar.gz ... updated authors/id/J/JV/JV/CHECKSUMS ... updated Could not stat tmpfile '/cygdrive/t/cpan_mirror/authors/id/J/JW/JWIED/Mail-IspMailGate-1.1013.tar.gz-4712': No such file or directory at /usr/lib/perl5/site_perl/5.10/LWP/UserAgent.pm line 851. authors/id/J/JW/JWIED/Mail-IspMailGate-1.1013.tar.gz At this point, I get the Virus scanner mcshield sticking its Awr in. To maintain my mirror I execute:- #!/usr/bin/perl CPAN::Mini->update_mirror( remote => "http://mirror.eunet.fi/CPAN", local => "/cygdrive/t/cpan_mirror/", trace => 1, errors => 1, module_filters => [ qr/kjkjhkjhkjkj/i, qr/clamav/i, qr/ispmailgate/i, qr/IspMailGate/, qr/Mail-IspMailGate/, qr/mail-ispmailgate/i, ], path_filters => [ qr/ZZYYZZ/, #qr/WIED/, #qr/RJBS/, ] ); It skips OK if I enable the path_filter WIED. Just cannot get it to skip the module failing module to complete other WIED modules. Any ideas?

    Read the article

  • Why isn't module_filters filetering Mail::IspMailGate in CPAN::Mini?

    - by user304122
    Edited - Ummm - now have a module in schwigon giving same problem !! I am on a corporate PC that forces mcshield on everything that moves. I get blocked when trying to mirror on ... authors/id/J/JV/JV/EekBoek-2.00.01.tar.gz ... updated authors/id/J/JV/JV/CHECKSUMS ... updated Could not stat tmpfile '/cygdrive/t/cpan_mirror/authors/id/J/JW/JWIED/Mail-IspMailGate-1.1013.tar.gz-4712': No such file or directory at /usr/lib/perl5/site_perl/5.10/LWP/UserAgent.pm line 851. authors/id/J/JW/JWIED/Mail-IspMailGate-1.1013.tar.gz At this point, I get the Virus scanner mcshield sticking its Awr in. To maintain my mirror I execute:- #!/usr/bin/perl CPAN::Mini->update_mirror( remote => "http://mirror.eunet.fi/CPAN", local => "/cygdrive/t/cpan_mirror/", trace => 1, errors => 1, module_filters => [ qr/kjkjhkjhkjkj/i, qr/clamav/i, qr/ispmailgate/i, qr/IspMailGate/, qr/Mail-IspMailGate/, qr/mail-ispmailgate/i, ], path_filters => [ qr/ZZYYZZ/, #qr/WIED/, #qr/RJBS/, ] ); It skips OK if I enable the path_filter WIED. Just cannot get it to skip the module failing module to complete other WIED modules. Any ideas?

    Read the article

  • Form Based Authentication problem?

    - by programmerist
    i have 2 pages : Login.aspx and Satis.aspx. i redirected from Login.aspx to Satis.aspx if authentication is correct . if i signout from satis i redirected to Login.aspx. But if i write satis.aspx' url on web scanner i entered satis.aspx. But i am not sign in Satis.aspx. i should't enter Satis.aspx directly. my web config: <authentication mode="Forms"> <forms loginUrl="Login.aspx" name=".ASPXFORMSAUTH" path="/" protection="All"> <credentials> <user name="a" password="a"></user> </credentials> </forms> </authentication> <authorization> <allow users="*"/> </authorization> </system.web> <location path="~/ContentPages/Satis/Satis.aspx"> <system.web> <authorization> <deny users="?"/> </authorization> </system.web> </location> Login.aspx.cs: protected void lnkSubmit_Click(object sender, EventArgs e) { if(FormsAuthentication.Authenticate(UserEmail.Value,UserPass.Value)) { FormsAuthentication.RedirectFromLoginPage (UserEmail.Value, PersistForms.Checked); } else Msg.Text = "Invalid Credentials: Please try again"; } Satis.aspx protected void LogoutSystem_Click(object sender, EventArgs e) { FormsAuthentication.SignOut(); Response.Redirect("~/Login/Login.aspx"); }

    Read the article

  • al32utf8 in oracle and SQL Server and DB2 pulling data

    - by Bob
    I have a non-utf8 oracle database running on 11.1.0.7. We need to support greek characters. So we have two options: use nvarchar, nclob fields for those fields that need greek (it is not all fields). We have tested this and gotten it to work with java coding. convert Oracle to AL32UTF8 database. I am not asking how to do this. I got this from the Oracle Site/Oracle Support. I know what is involved, lossy data, etc, increasing the size of the database. My question is we have users to our system that connect to our database with database links but work on SQL Server and IBM DB2 databases. I do not have access to those databases and I do not have experience with them. If they are not in UTF-8 databases what happens when they pull UTF8 data? I would assume that English/Ascii characters are fine and the greek will end up as junk data. I also ran Oracle Character set scanner (oracle command line utility you use to get info about the affects of a character set conversion). It says that my database will crease in sizez by about 20%. Does this have an affect on users with 3rd party databases? These are customers of our data and there is a limit to how much access I can have to them to run tests. Any information you have would be welcome.

    Read the article

  • How can a program be detected as running?

    - by ryeguy
    I have written a program that is sort of an unofficial, standalone plugin for an application. It allows customers to get a service that is a lower priced alternative then the vendor-owned one. My program is not illegal, against any kind of TOS, and is certainly not a virus, adware, or anything like that. That being said, the vendor of course is not happy about me taking his competition, and is trying to block my application from running. He has already tried some tactics to stop people from running my app alongside his. He makes it so if it is detected, his app throws a fake error. First, he checked to see if my program was running by looking for an open window with the right title. I countered this by randomizing the program title at startup. Next, he looked for the running process name. I countered this by making the app copy itself when it is started as [random string].exe and then running that. Anyways, my question is this: what else can he do to detect if my program running? I know that you can read window text (ie status bar, labels). I'm prepared to counter this by replacing the labels with images (ugh, any other way?). But what else is there? Can you detect what .dlls a program has loaded? If so, could this be solved by randomizing the dll names before loading them? I know that it's possible to get a program's signature in memory and track it that way (like a virus scanner), but the chances of him doing that probably aren't good because that sounds pretty advanced. Even though this is kinda crappy of him to be doing, its kind of fun. It's like a nerdy fist fight. EDIT: When I said it's a plugin, that is just the (incorrect) term I used. It's a standalone EXE. The "API" between my program and the other is mine is simply entering data into the controls (like textboxes, etc).

    Read the article

  • How to scan an array for certain information

    - by Andrew Martin
    I've been doing an MSc Software Development conversion course, the main language of which is Java, since the end of September. We have our first assessed practical coming and I was hoping for some guidance. We have to create an array that will store 100 integers (all of which are between 1 and 10), which are generated by a random number generator, and then print out ten numbers of this array per line. For the second part, we need to scan these integers, count up how often each number appears and store the results in a second array. I've done the first bit okay, but I'm confused about how to do the second. I have been looking through the scanner class to see if it has any methods which I could use, but I don't see any. Could anyone point me in the right direction - not the answer, but perhaps which library it comes from? Code so far: import java.util.Random; public class Practical4_Assessed { public static void main(String[] args) { Random numberGenerator = new Random (); int[] arrayOfGenerator = new int[100]; for (int countOfGenerator = 0; countOfGenerator < 100; countOfGenerator++) arrayOfGenerator[countOfGenerator] = numberGenerator.nextInt(10); int countOfNumbersOnLine = 0; for (int countOfOutput = 0; countOfOutput < 100; countOfOutput++) { if (countOfNumbersOnLine == 10) { System.out.println(""); countOfNumbersOnLine = 0; countOfOutput--; } else { System.out.print(arrayOfGenerator[countOfOutput] + " "); countOfNumbersOnLine++; } } } } Thanks, Andrew

    Read the article

  • Better way of looping to detect change.

    - by Dremation
    As of now I'm using a while(true) method to detect changes in memory. The problem with this is it's kill the applications performance. I have a list of 30 pointers that need checked as rapidly as possible for changes, without sacrificing a huge performance loss. Anyone have ideas on this? memScan = new Thread(ScanMem); public static void ScanMem() { int i = addy.Length; while (true) { Thread.Sleep(30000); //I do this to cut down on cpu usage for (int j = 0; j < i; j++) { string[] values = addy[j].Split(new char[] { Convert.ToChar(",") }); //MessageBox.Show(values[2]); try { if (Memory.Scanner.getIntFromMem(hwnd, (IntPtr)Convert.ToInt32(values[0], 16), 32).ToString() != values[1].ToString()) { //Ok, it changed lets do our work //work if (Globals.Working) return; SomeFunction("Results: " + values[2].ToString(), "Memory"); Globals.Working = true; }//end if }//end try catch { } }//end for }//end while }//end void

    Read the article

  • unistd.h related problem when compiling bison & flex program under vc++

    - by Eric
    I'm using bison & flex (downloaded via cygwin) with vc++. When I compile the program I got an error: ...: fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory The corresponding code in the flex-generated file is: #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ /* %if-c-only */ #include <unistd.h> /* %endif */ /* %if-c++-only */ /* %endif */ #endif If I define YY_NO_UNISTD_H in the flex file(.l) this error will disappear, but I get several other errors: ...: error C2447: '{' : missing function header (old-style formal list?) ...: warning C4018: '<' : signed/unsigned mismatch ...: error C3861: 'isatty': identifier not found How can I fix this problem? All these errors occur in the flex-generated scanner. I know it's because unistd.h doesn't exist in windows. Do I have to write my own unistd.h? If so how to write it in order to eliminate those errors?

    Read the article

  • PHP: What is an efficient way to parse a text file containing very long lines?

    - by Shaun
    I'm working on a parser in php which is designed to extract MySQL records out of a text file. A particular line might begin with a string corresponding to which table the records (rows) need to be inserted into, followed by the records themselves. The records are delimited by a backslash and the fields (columns) are separated by commas. For the sake of simplicity, let's assume that we have a table representing people in our database, with fields being First Name, Last Name, and Occupation. Thus, one line of the file might be as follows [People] = "\Han,Solo,Smuggler\Luke,Skywalker,Jedi..." Where the ellipses (...) could be additional people. One straightforward approach might be to use fgets() to extract a line from the file, and use preg_match() to extract the table name, records, and fields from that line. However, let's suppose that we have an awful lot of Star Wars characters to track. So many, in fact, that this line ends up being 200,000+ characters/bytes long. In such a case, taking the above approach to extract the database information seems a bit inefficient. You have to first read hundreds of thousands of characters into memory, then read back over those same characters to find regex matches. Is there a way, similar to the Java String next(String pattern) method of the Scanner class constructed using a file, that allows you to match patterns in-line while scanning through the file? The idea is that you don't have to scan through the same text twice (to read it from the file into a string, and then to match patterns) or store the text redundantly in memory (in both the file line string and the matched patterns). Would this even yield a significant increase in performance? It's hard to tell exactly what PHP or Java are doing behind the scenes.

    Read the article

  • Recursive Maze in Java

    - by Api
    I have written a short Java code for solving a simple maze problem to go from S to G. I do not understand where the problem is going wrong. import java.util.Scanner; public class tester { static char [][] grid={ {'.','.'}, {'.','.'}, {'S','G'}, }; static int a=2; static int b=2; static boolean findpath(int x, int y) { if((x > grid.length-1) || (y > grid[0].length-1) || (x < 0 || y < 0)) { return false; } else if(x==a && y==b){ return true; } else if (findpath(x,y-1) == true){ return true; } else if (findpath(x+1,y) == true){ return true; } else if (findpath(x,y+1) == true) { return true; } else if (findpath(x-1,y) == true){ return true; } return false; } public static void main(String[] args){ boolean result=findpath(2,0); System.out.print(result); } } I am giving the starting position directly and goal is defined in a & b. Do help.

    Read the article

  • How can I check if a user has written his username and password correctly?

    - by Sergio Tapia
    I'm using a Linq-to-SQL class called Scans.dbml. In that class I've dragged a table called Users (username, password, role) onto the graphic area and now I can access User object via a UserRepository class: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Scanner.Classes { public class UserRepository { private ScansDataContext db = new ScansDataContext(); public User getUser(string username) { return db.Users.SingleOrDefault(x => x.username == username); } public bool exists(string username) { } } } Now in my Login form, I want to use this Linq-to-SQL goodness to do all the data related activities. UserRepository users = new UserRepository(); private void btnLogin_Click(object sender, EventArgs e) { loginToSystem(); } private void loginToSystem() { if (users.getUser(txtUsername.Text)) { } //If txtUsername exists && User.password == Salt(txtPassword) //then Show.MainForm() with User.accountType in constructor to set permissions. } I need help with verifying that a user exists && that that users.password is equal to SALT(txtpassword.text). Any guidance please?

    Read the article

  • Memeory Leak in Windows Page file when calling a shell command

    - by Arno
    I have an issue on our Windows 2003 x64 Build Server when invoking shell commands from a script. Each call causes a "memory leak" in the page file so it grows quite rapidly until it reaches the maximum and the machine stops working. I can reproduce the problem very nicely by running a perl script like for ($count=1; $count<5000; $count++) { system "echo huhu"; } It is independent of he scripting language as the same happens with lua: for i=1,5000 do os.execute("echo huhu") end I found somebody describing the same issue with php at http://www.issociate.de/board/post/454835/Memory_leak_occurs_when_exec%28%29_function_is_used_on_Windows_platform.html His solution: Firewall/Virus Scanner does not apply, neither are running on the machine. We can also reproduce the issue on other Developer Machines running XP 64, but not on XP 32 Bit. I also found an article describing a leak situation in page file at http://www.programfragment.com/ The guilty guy for the allocation is C:\WINDOWS\System32\svchost.exe -k netsvcs which runs all the basic Windows services. Does anybody know the issue and how to resolve it ?

    Read the article

  • get Random in ArrayList has error of java.lang.IllegalArgumentException: n must be positive

    - by gabrielle fregil
    In my ArrayList, i have get a random Item from my ArrayList for the equip method. Whenever i use my tester, the terminal window prints java.lang.IllegalArgumentException: n must be positive when I try to call random for the size. I tried to change the value of totalElements to the integer size of the elements, then the error would be an OutOfBoundsExeption import java.util.*; import java.util.Scanner; import java.util.Random; public class GameMaster { private int turn, totalElements; private boolean winner; private Avatar x1; private Avatar x2; private ArrayList<Item> inventory; public GameMaster(Avatar a1, Avatar a2) { x2 = a1; x1 = a2; turn = 1; winner = false; inventory = new ArrayList<Item>(); totalElements = 0; } private void fillInventory() { inventory.add( new Item( "Zealot Blades", true, 8 ) ); inventory.add( new Item( "BFG", true, 13 ) ); inventory.add( new Item( "Synthetic Cloth", false, 7 ) ); // more items inventory.add( new Item( "Gauss Rifle", true, 9 ) ); inventory.add( new Item( "Flight Unit", false, 6 ) ); totalElements = inventory.size(); } public String equip() { Avatar w; String a; if (turn%2==1) w=x2; else w=x1; if (w.beltIsFull()) { a = w.getName() + "'s belt is full. \n"; } else { turn++; Random generator = new Random(); Item rand = inventory.get(generator.nextInt(totalElements)); //terminal window in blueJ: java.lang.IllegalArgumentException: n must be positive a = w.getName()+" is equiped with "+rand.getName()+"."; } return a; }

    Read the article

  • How can change my code to can user insert numbers of year and days ?

    - by MANAL
    I make code to calculate the date of today and the date for two years ago before the day of today and also calculate day before 5 days. I want user insert the numbers of years and days to make compare between date of today . import java.util.Date; import java.util.Calendar; import java.text.SimpleDateFormat; import java.util.Scanner; public class Calendar1 { private static void doCalendarTime() { System.out.print("*************************************************"); Date now = Calendar.getInstance().getTime(); System.out.print(" \n Calendar.getInstance().getTime() : " + now); System.out.println(); } private static void doSimpleDateFormat() { System.out.print("*************************************************"); System.out.print("\n\nSIMPLE DATE FORMAT\n"); System.out.print("*************************************************"); // Get today's date Calendar now = Calendar.getInstance(); SimpleDateFormat formatter = new SimpleDateFormat("E yyyy.MM.dd 'at' hh:mm:ss a zzz"); System.out.print(" \n It is now : " + formatter.format(now.getTime())); System.out.println(); } private static void doAdd() { System.out.println("ADD / SUBTRACT CALENDAR / DATEs"); System.out.println("================================================================="); // Get today's date Calendar now = Calendar.getInstance(); Calendar working; SimpleDateFormat formatter = new SimpleDateFormat("E yyyy.MM.dd 'at' hh:mm:ss a zzz"); working = (Calendar) now.clone(); working.add(Calendar.DAY_OF_YEAR, - (365 * 2)); System.out.println (" Two years ago it was: " + formatter.format(working.getTime())); working = (Calendar) now.clone(); working.add(Calendar.DAY_OF_YEAR, + 5); System.out.println(" In five days it will be: " + formatter.format(working.getTime())); System.out.println(); } public static void main(String[] args) { System.out.println(); doCalendarTime(); doSimpleDateFormat(); doAdd(); } } help me .

    Read the article

  • Can i change the view without changing the controller?

    - by Ian Boyd
    Pretend1 there is a place to type in a name:     Name: __________________ When the text box changes, the value is absorbed into the controller, who stores it in data model. Business rules require that a name be entered: if there is no text entered the TextBox should be colored something in the view to indicate baddness; otherwise it can be whatever color the view likes. The TextBox contains a String, the controller handles a String, and the model stores a String. Now lets say i want to improve the view. There is a new kind of text box2 that can be fed not only string-based keyboard input, but also an image. The view (currently) knows how to determine if the image is in the proper format to perform the processing required to extract text out of it. If there is text, then that text can be fed to the controller, who feeds it to the data model. But if the image is invalid, e.g.3 wrong file format invalid dimensions invalid bit depth unhandled or unknown encoding format missing or incorrectly located registration marks contents not recognizable the view can show something to the user that the image is bad. But the telling the user that something is bad is supposed to be the job of the controller. i'm, of course, not going to re-write the controller to handle Image based text-input (e.g. image based names). a. the code is binary locked inside a GUI widget4 b. there other views besides this one, i'm not going to impose a particular view onto the controller c. i just don't wanna. If i have to change things outside of this UI improvement, then i'll just leave the UI unimproved5 So what's the thinking on having different views for the same Model and Controller? Nitpicker's Corner 1 contrived hypothetical example 2 e.g. bar code, g-mask, ocr 3 contrived hypothetical reasons 4 or hardware of a USB bar-code scanner 5 forcing the user to continue to use a DateTimePicker rather than a TextBox

    Read the article

  • C# Step by Step Execution

    - by Sheldon
    Hi. I'm building an app that uses and scanner API and a image to other format converter. I have a method (actually a click event) that do this: private void ButtonScan&Parse_Click(object sender, EventArgs e) { short scan_result = scanner_api.Scan(); if (scan_result == 1) parse_api.Parse(); // This will check for a saved image the scanner_api stores on disk, and then convert it. } The problem is that the if condition (scan_result == 1) is evaluated inmediatly, so it just don't work. How can I force the CLR to wait until the API return the convenient result. NOTE Just by doing something like: private void ButtonScan&Parse_Click(object sender, EventArgs e) { short scan_result = scanner_api.Scan(); MessageBox.Show("Result = " + scan_result); if (scan_result == 1) parse_api.Parse(); // This will check for a saved image the scanner_api stores on disk, and then convert it. } It works and display the results. Is there a way to do this, how? Thank you very much!

    Read the article

  • Organizing a String based on maxlength of each field

    - by pringlesinn
    I've made a program that makes my life easier by reading a class and creating methods like these below: //Ferramentas Parâmetros acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Pesquisa", "ppaParametrosList", null, TipoAcessoBean.TELA)); acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Gravar", "ppaParametrosHome", "persist", TipoAcessoBean.ACAO)); acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Atualizar Dados", "ppaParametrosHome", "update", TipoAcessoBean.ACAO)); acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Leitura", "ppaParametrosHome", "find", TipoAcessoBean.ACAO)); acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Excluir", "ppaParametrosHome", "remove", TipoAcessoBean.ACAO)); Don't worry about the language. It won't make it harder to understand what I need to make. I want to organize it to be shown like this: //Ferramentas Parâmetros acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Pesquisa" , "ppaParametrosList", null , TipoAcessoBean.TELA)); acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Gravar" , "ppaParametrosHome", "persist", TipoAcessoBean.ACAO)); acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Atualizar Dados", "ppaParametrosHome", "update" , TipoAcessoBean.ACAO)); acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Leitura" , "ppaParametrosHome", "find" , TipoAcessoBean.ACAO)); acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Excluir" , "ppaParametrosHome", "remove" , TipoAcessoBean.ACAO)); I'm reading the whole class with Scanner, but once I read, I save only the things I want in a Collection containing this things above. How can I make a method to complete with blank to make it organized?

    Read the article

  • user enter data to different arrays

    - by user2900469
    This is fragment of my code (arrays as you can see): double[] Price; String[] names; int[] Quantity; Price = new double[5]; names = new String[5]; Quantity = new int[5]; Price[1] = 3.10; Price[2] = 7.80; Price[3] = 0.20; names[1] = "Ballpen"; names[2] = "Notebook"; names[3] = "Envelope"; Quantity[1] = 20; Quantity[2] = 5; Quantity[3] = 140; I enter data to arrays by myself in this case. Now i want to change my code so that my program asks user for names, price and quantity (using the Scanner class). After user enter data, program keep this in three different arrays. I dont know how to transfer data from user to arrays. I would be grateful for some example code or any help.

    Read the article

  • PHP - file uploads and ways to prevent viruses from being uploaded in zip/rar archives

    - by Joe
    I am trying to provide a service on my website to allow users to upload files so others can download them. The issue is, since some of these files I will allow to upload will be .zip/.rar files, I am curious as to what ideas exist to help prevent the uploading of archives with Viruses/trojans etc. included. Some .zip files will include legitimate .exe files,though I am not sure what options I have. I thought about it and I don't have a method for verifying with a virus scanner on the server, since I am on shared hosting w/o the option to run a service like that... nor do I have the knowledge on how to do that. I am also aware there is no php class or database to scan the files for viruses. This means, my only options are to rely on: a). manual approval <-- not an acceptable option for me as it might become a busy site with thousands of uploads b). get the users to somehow point out it if has viruses through voting or "flagging", etc.... anyway, regarding "b" - what ideas would you suggest?

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42  | Next Page >