Search Results

Search found 21356 results on 855 pages for 'check digit'.

Page 54/855 | < Previous Page | 50 51 52 53 54 55 56 57 58 59 60 61  | Next Page >

  • I have to select the checkbox two times to check/uncheck in jTable

    - by 117526709403775781607
    I have a jTable code i intend to use, but the problem with it is that when i click on the checkbox once it doesn't select/deselect it, instead i have to click twice. But if i select any other cell in the row except the one containing the checkbox the purpose is solved. HERE IS MY CODE : public class TableSelectionTest extends JFrame implements ListSelectionListener { private final int COLUMN_COUNT = 5; private TblModel model; public TableSelectionTest() { initialize(); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); } private void initialize() { List data = new ArrayList(); for (int i = 0; i < 10; i++) { Object record[] = new Object[COLUMN_COUNT]; record[0] = Boolean.FALSE; for (int j = 1; j < COLUMN_COUNT; j++) { record[j] = new Integer(j); } data.add(record); } model = new TblModel(data); JTable table = new JTable(model); table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.getSelectionModel().addListSelectionListener (this); JScrollPane scroll = new JScrollPane(table); getContentPane().add(scroll, BorderLayout.CENTER); } public static void main(String[] args) { TableSelectionTest f = new TableSelectionTest(); f.show(); } class TblModel extends AbstractTableModel { private List data; public TblModel(List data) { this.data = data; } public int getColumnCount() { return COLUMN_COUNT; } public int getRowCount() { return data == null ? 0 : data.size(); } public void setValueAt(Object value, int rowIndex, int columnIndex) { getRecord(rowIndex)[columnIndex] = value; super.fireTableCellUpdated(rowIndex, columnIndex); } public Object getValueAt(int rowIndex, int columnIndex) { return getRecord(rowIndex)[columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { if(columnIndex == 0) return true; else return false; } public Class getColumnClass(int columnIndex) { if (data == null || data.size() == 0) { return Object.class; } Object o = getValueAt(0, columnIndex); return o == null ? Object.class : o.getClass(); } private Object[] getRecord(int rowIndex) { return (Object[]) data.get(rowIndex); } } public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { ListSelectionModel lsm = (ListSelectionModel) e.getSource(); int index = lsm.getMinSelectionIndex(); if(model.getRecord(index)[0] == Boolean.FALSE) model.setValueAt(Boolean.TRUE, index, 0); else if(model.getRecord(index)[0] == Boolean.TRUE) model.setValueAt(Boolean.FALSE, index, 0); } } } Please reply soon as it is bugging me a lot Thank you in advance :)

    Read the article

  • How to get a template tag to auto-check a checkbox in Django

    - by Daniel Quinn
    I'm using a ModelForm class to generate a bunch of checkboxes for a ManyToManyField but I've run into one problem: while the default behaviour automatically checks the appropriate boxes (when I'm editing an object), I can't figure out how to get that information in my own custom templatetag. Here's what I've got in my model: ... from django.forms import CheckboxSelectMultiple, ModelMultipleChoiceField interests = ModelMultipleChoiceField(widget=CheckboxSelectMultiple(), queryset=Interest.objects.all(), required=False) ... And here's my templatetag: @register.filter def alignboxes(boxes, cls): """ Details on how this works can be found here: http://docs.djangoproject.com/en/1.1/howto/custom-template-tags/ """ r = "" i = 0 for box in boxes.field.choices.queryset: r += "<label for=\"id_%s_%d\" class=\"%s\"><input type=\"checkbox\" name=\"%s\" value=\"%s\" id=\"id_%s_%d\" /> %s</label>\n" % ( boxes.name, i, cls, boxes.name, box.id, boxes.name, i, box.name ) i = i + 1 return mark_safe(r) The thing is, I'm only doing this so I can wrap some simpler markup around these boxes, so if someone knows how to make that happen in an easier way, I'm all ears. I'd be happy with knowing a way to access whether or not a box should be checked though.

    Read the article

  • Android - overlay small check icon over specific image in gridview or change border

    - by oscar
    I've just asked a question about an hour ago, while waiting for replies, I've thought maybe I can achieve what I want differently. I was thinking of changing the image but it would be better if I could perhaps overlay something over the top of complete levels in the gridview i.e a small tick icon At the moment, when a level has been completed I am storing that with sharedpreferences So I have a gridView layout to display images that represent levels. Let's just say for this example I have 20 levels. When one level is complete is it possible to overlay the tick icon or somehow highlight the level image. Maybe change the border of the image?? Here are the image arrays I use int[] imageIDs = { R.drawable.one, R.drawable.two, R.drawable.three, R.drawable.four, R.drawable.five, R.drawable.six etc....... and then I have my code to set the images in gridView. Obviously there is more code in between. public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView; if (convertView == null) { imageView = new ImageView(context); imageView.setLayoutParams(new GridView.LayoutParams(140, 140)); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setPadding(5, 5, 5, 5); } else { imageView = (ImageView) convertView; } imageView.setImageResource(imageIDs[position]); return imageView; would it be possible to do any of the above, even the border method would be fine. Thanks for any help

    Read the article

  • jquery validate check at least one checkbox

    - by Omu
    I have something like this: <form> <input id='roles' name='roles' type='checkbox' value='1' /> <input id='roles' name='roles' type='checkbox' value='2' /> <input id='roles' name='roles' type='checkbox' value='3' /> <input id='roles' name='roles' type='checkbox' value='4' /> <input id='roles' name='roles' type='checkbox' value='5' /> <input type='submit' value='submit' /> <form> I would like to validate that at least one checkbox (roles) should be checked, is it possible with jquery.validate ?

    Read the article

  • Check wether Excel file is Password protected

    - by Torben Klein
    I am trying to open an Excel (xlsm) file via VBA. It may or may not be protected with a (known) password. I am using this code: On Error Resume Next Workbooks.Open filename, Password:=user_entered_pw opened = (Err.Number=0) On Error Goto 0 Now, this works fine if the workbook has a password. But if it is unprotected, it can NOT be opened. Apparently this is a bug in XL2007 if there is also workbook structure protection active. (http://vbaadventures.blogspot.com/2009/01/possible-error-in-excel-2007.html). On old XL2003, supplying a password would open both unprotected and password protected file. I tried: Workbooks.Open filename, Password:=user_entered_pw If (Err.Number <> 0) Then workbooks.open filename This works for unprotected and protected file. However if the user enters a wrong password it runs into the second line and pops up the "enter password" prompt, which I do not want. How to get around this?

    Read the article

  • asp classic and javascript to check for session status

    - by StealthRT
    Hey all, i am in need of some help with trying to figure out how to go about checking the users session and seeing if they are still logged in or not. The problem being is because i have a static page that pretty much loads everything into "tabs" using jquery. So when they use navigates the page, it really never leaves that same page they started out on. Hints my problem in trying to determine if they are still logged in or not when they click on update their information on their profile or whatnot. Any suggestions/help would be great! :o) David

    Read the article

  • iphone table view check mark accessory problem

    - by Pankaj Kainthla
    I have a table with 50 rows. I want to select particular rows with checkmark accessory but when i select some rows and scroll down the table then i see pre checked rows. I know that table cell are reused but i want to emit this problem what can i do about this? - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // return [array count]; return 50; } // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; TableViewCell *cell = (TableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[TableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } cell.textLabel.text=[NSString stringWithFormat:@"%i",[indexPath row]]; return cell; } // Override to support row selection in the table view. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; if (cell.accessoryType == UITableViewCellAccessoryNone) { cell.accessoryType = UITableViewCellAccessoryCheckmark; } else { cell.accessoryType = UITableViewCellAccessoryNone; }

    Read the article

  • quick check on use of map api (android)

    - by Peter vdL
    When you use the Google map api, it is not part of the Android SDK, and you have to mention it in your manifest xml file. Do you have to do anything to access the jar file containing the map api code? Or is that automatically present on the device or emulator, the way the SDK code is? Do you need put the map api jar file in your class path, either when compiling or when executing? Or is it kept somewhere where it is already visible, and the requirement of an XML mention is merely to remind you of the licensing issue? Thanks, Peter

    Read the article

  • Just need someone familiar with HTTPClient to check over a piece of code

    - by jax
    here are two little helper methods I have made for downloading files. I have had to mix and match different tutorials of the web to get what I have here. Now is there anything that I have done blatantly wrong here? public static InputStream simplePostRequest(URL url, List<NameValuePair> postData) throws ClientProtocolException, IOException { DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost postMethod=new HttpPost(url.toExternalForm()); postMethod.setEntity(new UrlEncodedFormEntity(postData, HTTP.UTF_8)); HttpResponse response = httpclient.execute(postMethod); HttpEntity entity = response.getEntity(); return entity.getContent(); } public static InputStream simpleGetRequest(URL url, List<NameValuePair> queryString) throws ClientProtocolException, IOException { Uri.Builder uri = new Uri.Builder(); uri.path(url.getPath()); for(NameValuePair nvp: queryString) { uri.appendQueryParameter(nvp.getName(), nvp.getValue()); } DefaultHttpClient httpClient = new DefaultHttpClient(); HttpHost host = new HttpHost(url.getHost()); HttpResponse response = httpClient.execute(host, new HttpGet(uri.build().toString())); HttpEntity entity = response.getEntity(); return entity.getContent(); }

    Read the article

  • JQuery - Check when image is loaded?

    - by JasonS
    Hi, I am having a bit of trouble working out when an image has been loaded. I have been told that the following function will work but it isn't doing anything. $("#photos img:first").load(function (){ alert("Image loaded!"); }); There are no error's in my code. Everything else in my script works great. My HTML looks like this. <div id="photos"> <img src="../sample1.jpg" style="background-color:#000033" width="1" height="1" alt="Frog!"/> <img src="../sample2.jpg" style="background-color:#999999" width="1" height="1" alt="Zooey!"/> </div> Do I have the wrong JQuery function? It should also be noted that the visibility is set to hidden. However even when visible there is no alert. Any ideas?

    Read the article

  • Elegant check for null and exit in C#

    - by aip.cd.aish
    What is an elegant way of writing this? if (lastSelection != null) { lastSelection.changeColor(); } else { MessageBox.Show("No Selection Made"); return; } changeColor() is a void function and the function that is running the above code is a void function as well.

    Read the article

  • alternative to check, whether a value is in a set

    - by stanleyxu2005
    Hi All, I have the following code. It looks ugly, if the value equals to one of the following value then do something. var Value: Word; begin Value := 30000; if (Value = 30000) or (Value = 40000) or (Value = 1) then do_something; end; I want to refactor the code as follows: var Value: Word; begin Value := 30000; if (Value in [1, 30000, 40000]) then // Does not work do_something; end; However, the refactored code does not work. I assume that a valid set in Delphi accepts only elements with type byte. If there any good alternative to refactor my original code (besides using case)?

    Read the article

  • Using hash to check if page with $_POST values was refreshed

    - by Dieseltime
    When posting a form to the same PHP page, what is the correct method to find if the page was accidentally refreshed instead of submitted again? Here's what I'm using right now: $tmp = implode('',$_POST); $myHash = md5($tmp); if(isset($_SESSION["myHash"]) && $_SESSION["myHash"] == $myHash) { header("Location: index.php"); // page refreshed, send user somewhere else die(); } else { $_SESSION["myHash"] = $myHash; } // continue processing... Is there anything wrong with this solution?

    Read the article

  • php tree view with check box

    - by Anup Prakash
    hi friends, I am in great trouble. Actually few months before I made a project in which i used tree view structure for providing page accicibility to different user according to their level in the organisation. But now it is not working and my boss is very angry on me. Now their is some problem in code or you can say that was the demo version. So, can any one help me to find the tree structure in php. Its urgent. Thanx to read this message.

    Read the article

  • Check if there are any repeated elements in an array recursively

    - by devoured elysium
    I have to find recursively if there is any repeated element in an integer array v. The method must have the following signature: boolean hasRepeatedElements(int[] v) I can't see any way of doing that recursively without having to define another method or at least another overload to this method (one that takes for example the element to go after or something). At first I thought about checking for the current v if there is some element equal to the first element, then creating a new array with L-1 elements etc but that seems rather inefficient. Is it the only way? Am I missing here something?

    Read the article

  • .NET security: how to check if a method is allowed to execute under current user's perrmissions

    - by Gart
    Given an ASP.NET MVC Controller class declaration: public class ItemController : Controller { public ActionResult Index() { // ... } public ActionResult Details() { // ... } [Authorize(Roles="Admin, Editor")] public ActionResult Edit() { // ... } [Authorized(Roles="Admin")] public ActionResult Delete() { // .. } } I need to reflect a list of methods in this class which may be invoked with the current user's permissions. The [Authorized] attribute is specific to ASP.NET MVC, and this is only an example. I would prefer a universal solution for this problem which works for any .NET class. Please share some ideas of what could be done in this case.

    Read the article

  • Check if Database raises a particular exception

    - by mcabral
    using Nhibernate; I'm trying to insert several values a on table which has an unique index on some columns. I'd like to know if a particular insert raises an exception for having violated the unique constraint. So, which particular exception type should i catch? I only want to catch this particular one and let all others go up. Thanks a lot!

    Read the article

  • jQuery check on wordchange rather than "change" trigger

    - by benhowdle89
    I have a input that the user types a search parameter into, at the moment i have it on keyup to do a POST ajax request to a PHP script that returns search results. however its firing off 50 billion (not literally) post requests in about 10 seconds (as the user types) which slows the whole experience down. Can i use jQuery to detect a "wordup" rather than "keyup" by detecting the use of the space bar? Does this make sense?

    Read the article

  • Empty object check

    - by developer
    Is there a way to know if all the properties in an object are empty. My object represents fields from database and I want to know if a particular record is present or not. NULL doesnt seem to work.

    Read the article

  • Java Constructor Style (Check parameters aren't null)

    - by Peter
    What are the best practices if you have a class which accepts some parameters but none of them are allowed to be null? The following is obvious but the exception is a little unspecific: public class SomeClass { public SomeClass(Object one, Object two) { if (one == null || two == null) { throw new IllegalArgumentException("Parameters can't be null"); } //... } } Here the exceptions let you know which parameter is null, but the constructor is now pretty ugly: public class SomeClass { public SomeClass(Object one, Object two) { if (one == null) { throw new IllegalArgumentException("one can't be null"); } if (two == null) { throw new IllegalArgumentException("two can't be null"); } //... } Here the constructor is neater, but now the constructor code isn't really in the constructor: public class SomeClass { public SomeClass(Object one, Object two) { setOne(one); setTwo(two); } public void setOne(Object one) { if (one == null) { throw new IllegalArgumentException("one can't be null"); } //... } public void setTwo(Object two) { if (two == null) { throw new IllegalArgumentException("two can't be null"); } //... } } Which of these styles is best? Or is there an alternative which is more widely accepted? Cheers, Pete

    Read the article

  • Check if server exists

    - by buhtla
    Here is the problem. User can enter server name and connection string for database. If server is not accessible (wrong address, firewalls or any other issue), I want to be aware of this as quickly as possible. If I'm using sqlConnection and try to connect to a non-accessible server this takes very long (I think more than 1 minute!). This has nothing to do with connection timeout btw so setting this property won't help. My idea is to first try to ping server and if I get response (which means server is accessible from the point of application), than proceed with sqlConnection. If there is no response from ping, operation is aborted and user is properly notified. Is there any better way of doing this? Any idea would be welcome.

    Read the article

  • submit the value of check box in database

    - by ritu
    <?php $dates = $day1 ; echo "<p>"; for($i=0;$i<count($dates);$i++) { if($i>0 && ($i%3==0)) { echo "</p><p>"; } echo "<input type='checkbox' name='dates[".$dates."]' /><label>".$dates[$i]."</label>"; } echo "</p>"; ?> whan i use this output will be desire Ex 1 2 3 4 5 6 but i want send his data in the databse but only a array will be send into the database $_post[dates so can any on telll me how can i send the data in the database

    Read the article

  • Check result of AX_PYTHON_MODULE in configure.ac

    - by tmatth
    In using the m4_ax_python_module.m4 macro in configure.ac (AX_PYTHON_MODULE), one can know at configure time if a given module is installed. It takes two arguments, the module name, and second argument which if not empty, will lead to an exit, useful when the module is a must-have. In the case where you don't want a fatal exit, how do you test in configure.ac which modules were found or not? They output "yes" or "no" when configure is run, but that's all I've found so far. Basically If I have these lines in configure.ac: AX_PYTHON_MODULE(json,[]) AX_PYTHON_MODULE(simplejson,[]) How do I test which of the two modules were found? See http://www.gnu.org/software/autoconf-archive/ax_python_module.html#ax_python_module for documentation about this macro.

    Read the article

  • Flex SDK 3.5 - Check file mimetype

    - by Fernando
    Is there a way to get a file's mimetype in Flex SDK 3.5 without using its extension? I need to validate if an uploaded file is of a certain kind. This is for images, or documents (PDF, ODT, etc.) All the solutions I've found are by checking its extension. What if I rename a .odt file as a .jpg? Then I can upload it as an image... I should add, we are using an AIR desktop client and a Java EE server. File checking is solved on the Java side, but the idea is not to go to the server, validate the file so if it's not valid, there's no network traffic at all.

    Read the article

< Previous Page | 50 51 52 53 54 55 56 57 58 59 60 61  | Next Page >