Search Results

Search found 47079 results on 1884 pages for 'input method kit'.

Page 16/1884 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Does this factory method pattern example violate open-close?

    - by William
    In Head-First Design Patterns, they use a pizza shop example to demonstrate the factory method pattern. public abstract class PizzaStore { public Pizza orderPizza(String type) { Pizza pizza; pizza = createPizza(type); pizza.prepare(); pizza.bake(); pizza.cut(); pizza.box(); return pizza; } abstract Pizza createPizza(String type) } public class NYPizzaStore extends PizzaStore { Pizza createPizza(String item) { if (item.equals("cheese") { return new NYStyleCheesePizza(); } else if (item.equals("veggie")) { return new NYStyleVeggiePizza(); } else if (item.equals("clam")) { return new NYStyleClamPizza(); } else if (item.equals("pepperoni")) { return new NYStylePepperioniPizza(); } else return null; } } I don't understand how this pattern is not violating open-close. What if we require a beef Pizza, then we must edit the if statement in the NYPizzaStore class.

    Read the article

  • Do input template languages exist?

    - by marczellm
    When I have to create some textual representation of data, I can use a template language, so that my code does not have to worry about the structure of the output file - I can sometimes even write code that's independent of whether the output is XML, LaTeX or any other plain text. A simple example: Template (in separate file): <someXmlTag> $variableName </someXmlTag> Code: Template(temstring).substitute(variableName="value") Result (written to output file): <someXmlTag> value </someXmlTag> I want to do the same, but in the opposite direction. I have XML or plain text or whatever files to input. I want to describe the input structure in a separate file that looks like the input but has these variable declarations in it, and I want to handle it with code that's independent of the structure. Is there a library for this concept? (We usually handle XML input by using an XML parser library to describe the input structure in program code, handle plaintext input by writing regexes in code, and don't handle LaTeX input because LaTeX can't really be parsed.)

    Read the article

  • php form-input validation

    - by fusion
    i have a html page in which i enter data which then submits and inserts in a database on a php page. how would i validate in php that the data received is not a duplicate of the data in the database? any help appreciated.

    Read the article

  • Limit user input to allowable comma delimited words with regular expression using javascript

    - by Marc
    I want to force the user to enter any combination of the following words. the words need to be comma delimited and no comma at the beginning or end of the string the user should only be able to enter one of each word. Examples admin basic,ectech admin,ectech,advanced basic,advanced,admin,ectech my attempt ^((basic|advanced)|admin|ectech)((,basic|,advanced)|,admin|,ectech){0,2}$ Thanks Marc

    Read the article

  • MacOS Virtual Input Devices

    - by computergeek6
    How can I create a virtual HID device in code? I'm trying to avoid writing a kernel extension to accomplish this, but it seems to be the only way. I need to be able to create virtual HID devices of all types, and have an app running in the background feed them events. Is there a way to do this in user-space, or must I venture into kernel land?

    Read the article

  • Drupal filter_form form input

    - by ernie
    This drupal form snippet will give me a textarea with user able to change filter to full html/wysiwyg mode. My Questions: How can I default to to full html mode? function MY_MODULE_admin() { $form = array(); $form['format'] = filter_form($form->format); // MY_MODULE - ** Image 1 ** $form['MY_MODULE_image_1'] = array( '#type' => 'textarea', '#title' => t('Image 1'), '#default_value' => variable_get('setup_image_1', 'image_1.jpg'), '#description' => "Current value =" .variable_get('setup_image_1', 'image_1.jpg'), '#required' => TRUE, );

    Read the article

  • Removing input background colour for Chrome autocomplete?

    - by DisgruntledGoat
    On a form I'm working on, Chrome is auto-filling the email and password fields. This is fine, however, Chrome changes the background colour to a pale yellow colour. The design I'm working on is using light text on a dark background, so this really messes up the look of the form - I have stark yellow boxes and near-invisible white text. Once the field is focused, the fields return to normal. Is it possible to stop Chrome changing the colour of these fields?

    Read the article

  • Safari Textbox input with xcode

    - by Tim
    Hi, I am new to Xcode and would like to make a simple plug-in so that the plug-in can set the value to safari text box and get the id of the text box. Could someone please point me to the right direction? Thanks in advance.

    Read the article

  • Formatted input in c++

    - by julz666
    hey, i'm a noob to c++ (and coding in general) i'm looking for an easy way to take two doubles (at once) from the keyboard and store them in a struct i've created called "Point" and then ultimately store the Point into a vector of Points that's a member of a class (called "Polygon"). i know i could do it with a scanf but need to know how to do it with cin. hope that makes sense. thanks in advance julz

    Read the article

  • Clearing input text feilds when clicked on in Flash (AS 2.0)

    - by rickstyphilis
    I have a problem where I want a text field that by default has the word NAME in it, to become empty when a user clicks on it. The text field has the instance name 'nam' and is inside a movie with the instance name 'input_text'. I've searched around and found samples of code where everyone keeps suggesting this: textboxinstancename.onSetFocus = function() { textboxinstancename.text = ""; }; should work. It seems to work for everyone else but me. I've tried using the following on the first frame of the 'input_text' movie with no luck: this.input_text.nam.onSetFocus = function() { this.input_text.nam.text = "" } I've tried putting this on the first frame of the scene, again with no result: _root.input_text.nam.onSetFocus = function() { _root.input_text.nam.text = "" } I've tried this in the same manner as the last respectively with both 'this' on the instance and '_root' on the scene (denoted by x): x.input_text.nam.onSetFocus = function() { if (x.input_text.nam.text == "NAME") { x.input_text.nam.text = ""; } }; Still no luck. Can anyone tell me what I might be doing wrong?

    Read the article

  • How to provide Input to Dialogs designed by Qt Designer

    - by GG
    Hello, I am a Qt beginner and working with Qt Designer to develop some small UI elements. I read http://doc.trolltech.com/4.5/designer-using-a-ui-file.html to use these GUI elements in my code and using multiple inheritance approach. I am introducing bookmark feature which somewhat look like http://img293.imageshack.us/img293/3041/screenshotyb.png. Now the problem I am facing is How can I show all existing bookmark folders in the drop down(say folders are in a QVector). So my main problem is how can I pass some inputs to the UI element. I think I'm clear, please let me know if further explanation is required. Sorry for adding links directly, rich formatting in my browser is not working. Thanks in advance,

    Read the article

  • Ruby on Rails solution for scrubbing data of WYSIWYG editor user input

    - by Jimmy
    Hey everyone, I am working on a simple blogging type ruby on rails application and I have everything working through tinyMCE for a nice WYSIWYG editor so the user can add some simple things like images/youtube videos and lists. What I am looking for is a nice solution for blacklisting certain elements to be filtered out of the data when it is displayed. So is there a solution for this available as a gem or available to download anywhere? Thanks!

    Read the article

  • JAVA: storing input into array

    - by Jann
    I need to write a program where the program would generate random letter and i would need to store this random character into an array char[] arrayRandom = new char[10]; for (int i = 0; i < 8; i++) { randomNumLet = (generator.nextInt(20) + 1); System.out.print(arrayRandomLetter[randomNumLet] + " "); arrayRandomLetter[randomNumLet] = arrayRandom[i]; } is there anything wrong with my code? because when i run this and printed the array i get boxes for all the values in the array and there are some letter that this line of code cannot print System.out.print(arrayRandomLetter[randomNumLet] + " "); Thanks

    Read the article

  • How are components properly instantiated and used in XNA 4.0?

    - by Christopher Horenstein
    I am creating a simple input component to hold on to actions and key states, and a short history of the last ten or so states. The idea is that everything that is interested in input will ask this component for the latest input, and I am wondering where I should create it. I am also wondering how I should create components that are specific to my game objects - I envision them as variables, but then how do their Update/Draw methods get called? What I'm trying to ask is, what are the best practices for adding components to the proper collections? Right now I've added my input component in the main Game class that XNA creates when everything is first initialized, saying something along the lines of this.Components.Add(new InputComponent(this)), which looks a little odd to me, and I'd still want to hang onto that reference so I can ask it things. An answer to my input component's dilemma is great, but also I'm guessing there is a right way to do this in general in XNA.

    Read the article

  • Android Reading from an Input stream efficiently

    - by RenegadeAndy
    Hey, I am making an HTTP get request to a website for an android application I am making. I am using a DefaultHttpClient and using HttpGet to issue the request. I get the entity response and from this obtain an InputStream object for getting the html of the page. I then cycle through the reply doing as follows: BufferedReader r = new BufferedReader(new InputStreamReader(inputStream)); String x = ""; x = r.readLine(); String total = ""; while(x!= null){ total += x; x = r.readLine(); } However this is horrendously slow. Is this inefficient? I'm not loading a big web page - www.cokezone.co.uk so the file size is not big. Is there a better way to do this? Thanks Andy

    Read the article

  • Handling Input with Zend Framework outside MVC

    - by Pekka
    In a classic Zend Framework MVC setup, there seems to be access to a generic _request object from within the model/view/controller instance as outlined here: $this->_request->getPost('variablename'); is this request object somehow available in a non-MVC setup as well? If yes: how would I initialize and access it?

    Read the article

  • How to stop input in Perl?

    - by user1472747
    First time poster and part time perl noobie. I'm making a reflex game. Here's the output - __________________________________________________________________________ Reflex game initiated. Press ENTER to begin the game, and then press ENTER after the asterisks are printed to measure your reflexes!. ************************* Your result: 0.285606 seconds. logout [Process completed] __________________________________________________________________________ There's one small problem though - There's 0-10 seconds (based on a random variable) after you press enter to start the game and before the stars are printed. During that time, if the player presses ENTER, it's logged as their reflex time. So I need a way to stop my code from reading their ENTER button before the stars are printed. The code - #!/usr/bin/perl use Time::HiRes qw(sleep); use Time::HiRes qw(gettimeofday); #random delay variable $random_number = rand(); print "Reflex game initiated. Press ENTER to begin the game, and then press ENTER after the asterisks are printed to measure your reflexes!.\n"; #begin button $begin = <>; #waits x milliseconds sleep(10*$random_number); #pre-game $start = [ Time::HiRes::gettimeofday() ]; print "\n****************************\n"; #user presses enter $stop = <>; #post game $elapsed = Time::HiRes::tv_interval($start); #delay time print print "Your result: ".$elapsed." seconds.\n";

    Read the article

  • How to use Scanner to accept only valid int as input

    - by John
    I'm trying to make a small program more robust and I need some help with that. Scanner kb = new Scanner(System.in); int num1; int num2 = 0; System.out.print("Enter number 1: "); num1 = kb.nextInt(); while(num2<num1) { System.out.print("Enter number 2: "); num2 = kb.nextInt(); } Number 2 has to be greater than number 1 Also I want the program to automatically check and ignore if the user enters a character instead of a number. Because right now when a user enters for example r instead of a number the program just exits.

    Read the article

  • Struts logic:iterate input field

    - by camilos
    I currently have the following code and the data is displayed fine. <logic:iterate name="myList" id="product" indexId="iteration" type="com.mycompany.MyBean"> <tr> <td> <bean:write name="product" property="weight"/> </td> <td> <bean:write name="product" property="sku"/> </td> <td> <bean:write name="product" property="quantity"/> </td> </tr> </logic:iterate> But now I need to make the "quantity" part modifiable. The user should be able to update that field, press submit and when its sent to the server, "myList" should automatically update with the new quantities. I've tried searching for help on this but all I keep finding is examples on how to display data only, not modify it. Any help would be appreciated.

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >