Search Results

Search found 18677 results on 748 pages for 'current'.

Page 27/748 | < Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >

  • Swing: Scroll to bottom of JScrollPane, conditionally on current viewport location

    - by I82Much
    Hi all, I am attempting to mimic the functionality of Adium and most other chat clients I've seen, wherein the scrollbars advance to the bottom when new messages come in, but only if you're already there. In other words, if you've scrolled a few lines up and are reading, when a new message comes in it won't jump your position to the bottom of the screen; that would be annoying. But if you're scrolled to the bottom, the program rightly assumes that you want to see the most recent messages at all times, and so auto-scrolls accordingly. I have had a bear of a time trying to mimic this; the platform seems to fight this behavior at all costs. The best I can do is as follows: In constructor: JTextArea chatArea = new JTextArea(); JScrollPane chatAreaScrollPane = new JScrollPane(chatArea); // We will manually handle advancing chat window DefaultCaret caret = (DefaultCaret) chatArea.getCaret(); caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); In method that handles new text coming in: boolean atBottom = isViewAtBottom(); // Append the text using styles etc to the chatArea if (atBottom) { scrollViewportToBottom(); } public boolean isAtBottom() { // Is the last line of text the last line of text visible? Adjustable sb = chatAreaScrollPane.getVerticalScrollBar(); int val = sb.getValue(); int lowest = val + sb.getVisibleAmount(); int maxVal = sb.getMaximum(); boolean atBottom = maxVal == lowest; return atBottom; } private void scrollToBottom() { chatArea.setCaretPosition(chatArea.getDocument().getLength()); } Now, this works, but it's janky and not ideal for two reasons. By setting the caret position, whatever selection the user may have in the chat area is erased. I can imagine this would be very irritating if he's attempting to copy/paste. Since the advancement of the scroll pane occurs after the text is inserted, there is a split second where the scrollbar is in the wrong position, and then it visually jumps towards the end. This is not ideal. Before you ask, yes I've read this blog post on Text Area Scrolling, but the default scroll to bottom behavior is not what I want. Other related (but to my mind, not completely helpful in this regard) questions: Setting scroll bar on a jscrollpane Making a JScrollPane automatically scroll all the way down. Any help in this regard would be very much appreciated.

    Read the article

  • Python file-io code listing current folder path instead of the specified

    - by Tom Brito
    I have the code: import os import sys fileList = os.listdir(sys.argv[1]) for file in fileList: if os.path.isfile(file): print "File >> " + os.path.abspath(file) else: print "Dir >> " + os.path.abspath(file) Located in my music folder ("/home/tom/Music") When I call it with: python test.py "/tmp" I expected it to list my "/tmp" files and folders with the full path. But it printed lines like: Dir >> /home/tom/Music/seahorse-gw2jNn Dir >> /home/tom/Music/FlashXX9kV847 Dir >> /home/tom/Music/pulse-DcIEoxW5h2gz This is, the correct file names, but the wrong path (and this files are not either in my Music folder).. What's wrong with this code?

    Read the article

  • How to set the pointer to the current row in the Datagridview in C Sharp

    - by user286546
    I have a datagridview on the Windows Form in c#. I am updating and filling the table adapter on the cell event. The problem is that When I go to lower half of the datagrid which is not visible until I scroll down, as I click any cell, the table adapter is filled and updated and the pointerpoints to the very first row. Any suggestion on how to fix it. I have a ideas to record the top row of the datagridview that is visible and set the pointer to that row. But how to do it?

    Read the article

  • Retrieve Table Row Index of Current Row

    - by Jon
    Hi Everyone, I am trying to validate a text input when it loses focus. I would like to know which row of the table it is in. This is what I have so far and it keeps coming back as undefined. Any ideas? $("div#step-2 fieldset table tbody tr td input").blur(function() { var tableRow = $(this).parent().parent(); if ($.trim($(this).val()) == "") { $(this).addClass("invalid"); alert(tableRow.rowIndex); $(this).val(""); } else { $(this).removeClass("invalid"); checkTextChanges(); } });

    Read the article

  • Current state of client-side XSLT

    - by Casey
    Last I heard, Blizzard was one of the few companies to put client-side XSLT into practice (2008). Is this still the case in 2011, or are more people now exploring this technique in production?  It seems that modern browsers (IE9, FF4, Chrome) and client processing power are primed to exploit this standard for tangible savings in server CPU power and bandwidth on large scale properties. Am I missing something? The negative aspects I'm aware of include * additional rendering time * additional assets required on uncached page load * additional layer of complexity * noticably less developer experience than server-side template techniques The benefits I perceive include * distributed template composition (offloaded on the client) * caching of common template fragments offloaded on the client * logical separation of document structure and data * well-documented web standard supported by all modern browsers Finally, although I know it's impossible to predict the future, I am curious to know opinions on whether or not client-side XSLT's day will come. With interest in HTML5 driving users to upgrade their browsers and developers to explore new techniques, I would say yes. How about you? Thanks in advance, Casey

    Read the article

  • Swing: Scroll to bottom of JScrollPane, conditional on current viewport location

    - by I82Much
    Hi all, I am attempting to mimic the functionality of Adium and most other chat clients I've seen, wherein the scrollbars advance to the bottom when new messages come in, but only if you're already there. In other words, if you've scrolled a few lines up and are reading, when a new message comes in it won't jump your position to the bottom of the screen; that would be annoying. But if you're scrolled to the bottom, the program rightly assumes that you want to see the most recent messages at all times, and so auto-scrolls accordingly. I have had a bear of a time trying to mimic this; the platform seems to fight this behavior at all costs. The best I can do is as follows: In constructor: JTextArea chatArea = new JTextArea(); JScrollPane chatAreaScrollPane = new JScrollPane(chatArea); // We will manually handle advancing chat window DefaultCaret caret = (DefaultCaret) chatArea.getCaret(); caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); In method that handles new text coming in: boolean atBottom = isViewAtBottom(); // Append the text using styles etc to the chatArea if (atBottom) { scrollViewportToBottom(); } public boolean isAtBottom() { // Is the last line of text the last line of text visible? Adjustable sb = chatAreaScrollPane.getVerticalScrollBar(); int val = sb.getValue(); int lowest = val + sb.getVisibleAmount(); int maxVal = sb.getMaximum(); boolean atBottom = maxVal == lowest; return atBottom; } private void scrollToBottom() { chatArea.setCaretPosition(chatArea.getDocument().getLength()); } Now, this works, but it's janky and not ideal for two reasons. By setting the caret position, whatever selection the user may have in the chat area is erased. I can imagine this would be very irritating if he's attempting to copy/paste. Since the advancement of the scroll pane occurs after the text is inserted, there is a split second where the scrollbar is in the wrong position, and then it visually jumps towards the end. This is not ideal. Before you ask, yes I've read this blog post on Text Area Scrolling, but the default scroll to bottom behavior is not what I want. Other related (but to my mind, not completely helpful in this regard) questions: Setting scroll bar on a jscrollpane Making a JScrollPane automatically scroll all the way down. Any help in this regard would be very much appreciated.

    Read the article

  • MDX Current Month Problem

    - by schone
    Hi all, I have the following MDX query: WITH MEMBER [Measures].[TY Sales] AS 'SUM([Measures].[Sales])' MEMBER [Measures].[YTD Sales] AS 'SUM(PERIODSTODATE([Time.Fiscals].[2009], [Time.Fiscals].CurrentMember), [Measures].[Sales])' MEMBER [Measures].[LY Sales] AS 'SUM(PARALLELPERIOD([Time.Fiscals].[2009].[8], 1, [Time.Fiscals].CurrentMember),[Measures].[Sales])' MEMBER [Measures].[LYTD Sales] AS 'SUM(PERIODSTODATE([Time.Fiscals].[2009], PARALLELPERIOD([Time.Fiscals].[2009].[8], 1, [Time.Fiscals].CurrentMember)), [Measures].[Sales])' SELECT {[Measures].[TY Sales],[Measures].[YTD Sales],[Measures].[LY Sales],[Measures].[LYTD Sales]} ON COLUMNS, [Time.Fiscals].[2009].[8] ON ROWS FROM [Sales] The above query displays sales for fiscal year 2009 and fiscal month 8 (Feb), I would like the fiscal year and fiscal month dynamic but I'm unsure on how to do this? I'm using Mondrian. Thanks!

    Read the article

  • Get current PHP executable from within script?

    - by benizi
    I want to run a PHP cli program from within PHP cli. On some machines where this will run, both php4 and php5 are installed. If I run the outer program as php5 outer.php I want the inner script to be run with the same php version. In Perl, I would use $^X to get the perl executable. It appears there's no such variable in PHP? Right now, I'm using $_SERVER['_'], because bash (and zsh) set the environment variable $_ to the last-run program. But, I'd rather not rely on a shell-specific idiom. UPDATE: Version differences are but one problem. If PHP isn't in PATH, for example, or isn't the first version found in PATH, the suggestions to find the version information won't help. Additionally, csh and variants appear to not set the $_ environment variable for their processes, so the workaround isn't applicable there. UPDATE 2: I was using $_SERVER['_'], until I discovered that it doesn't do the right thing under xargs (which makes sense... zsh sets it to the command it ran, which is xargs, not php5, and xargs doesn't change the variable). Falling back to using: $version = explode('.', phpversion()); $phpcli = "php{$version[0]}";

    Read the article

  • Liferay hook: filter url giving filterstart error and current url generates exception null

    - by jack
    I'm trying to make an autologinfilter in Eclipse using a liferay hook. Now I've added the: <filter> <filter-name>myautologinfilter</filter-name> <filter-class>bla.bla.xyz</filter-class> </filter> <filter-mapping> <filter-name>myautologinfilter</filter-name> <url-pattern>/c/login/myurl</url-pattern> </filter-mapping> To the liferay hook's web.xml. In the liferay-hook.xml I added: portal.properties And in that hook.xml I added: auto.login.hooks=bla.bla.xyz bla.bla.xyz implements AutoLogin, but for now it's pretty gutted: @Override public String[] login(HttpServletRequest request, HttpServletResponse response) throws AutoLoginException { Object parameters = request.getAttribute("javax.servlet.forward.query_string"); Map<String, String> x = parserClass.parsing(parameters.toString()); System.out.println("voornaam: " + geparsdeParameters.get("tokenvalue1")); try { return null; } catch (Exception e) { throw new AutoLoginException(e); } } Since the hook doesn't start when I add the filtering I removed it and just tried: http://localhost:8080/c/portal/login?tokenvalue1=55 but when I check my tomcat I see: Error XYZ Url: url myUsedUrl exception null Also I tried adding some util classes but I got: classnotfoundexceptions. Is there anything specific I have to do when I add extra classes in a hook? Any advice/input would be appreciated. Or someone's ear I could lend so I could mail them a little bit so I could pick their brain a bit would be really appreciated since I don't know anyone who programs for liferay.

    Read the article

  • Why does multiplying a double by -1 not give the negative of the current answer

    - by Ankur
    I am trying to multiply a double value by -1 to get the negative value. It continues to give me a positive value double man = Double.parseDouble(mantissa); double exp; if(sign.equals("plus")){ exp = Double.parseDouble(exponent); } else { exp = Double.parseDouble(exponent); exp = exp*-1; } System.out.println(man+" - "+sign+" - "+exp); The printed result is 13.93 - minus - 2.0 which is correct except that 2.0 should be -2.0

    Read the article

  • How to get Current Owner name ?

    - by user325739
    Hi My question is i have 4 Text Box 1) Prepared By 2) Checked By 3) Approved BY 4) Created BY First i will login as Smitha then in " Preapred by " - Smitha name should come automatically n all other text box should be blank, then i will submit the form it goes to our respective HOD now , Nagaraj sir will login as Nagaraj.S then in "Checked by" - Nagara.S name should appear automatically n Approved by and Created by should be blank then he submits the form, then it goes to level 1 person now , Jagadish is in Level 1 , he will login by his user name then in "Approved By" text box his name should appear automatically here Prepared by value and Checked by value which is taken previously should not be altered , and Created by should be blank now he submits the form to level 2 person ie Karthick , then his name should appear in "Created By" by not altering any values can u help me on this ?

    Read the article

  • Magento Set Grid to Filter Automatically by Current Day using Existing Datetime Column in Grid

    - by Tegan Snyder
    In Magento I'm creating a custom module and would love to be able to filter automatically by the datetime column so that the intial grid listing shows only entities related to "todays" date. Here is my datetime column: $this->addColumn('ts', array( 'header' => $hlp->__('Activated'), 'align' => 'left', 'index' => 'ts', 'type' => 'datetime', 'width' => '160px', )); I'm think there should be a way for me to just add a filter to the collection like so: $now = Mage::getModel('core/date')->timestamp(time()); $dateTime = date('m/d/y h:i:s', $now); $collection = Mage::getModel('mymodule/items')->getCollection() ->addFieldToFilter('ts', $dateTime); But this doesn't work? Am I using the wrong filter? My "ts" field in the database is a "datetime" field, but the default magento "From: " - "To:" date range selectors don't use hours, minutes, seconds. Any ideas? Thanks, Tegan

    Read the article

  • DatagridView loses current edit on Background update

    - by yoni.s
    Here's my problem : I have a DataGridView bound to a BindingList of custom objects. A background thread is constantly updating a value of these objects. The udpates are showing correctly, and everything is fine except for one thing - If you try to edit a different field while the background-updated field is being updated, it loses the entered value. Here is a code sample that demonstrates this behavior: (for new form, drop a new DataGridView on:) using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Threading; namespace WindowsFormsApplication2 { public partial class Form1 : Form { private BindingList<foo> flist; private Thread thrd; private BindingSource b; public Form1() { InitializeComponent(); flist = new BindingList<foo> { new foo(){a =1,b = 1, c=1}, new foo(){a =1,b = 1, c=1}, new foo(){a =1,b = 1, c=1}, new foo(){a =1,b = 1, c=1} }; b = new BindingSource(); b.DataSource = flist; dataGridView1.DataSource = b; thrd = new Thread(new ThreadStart(updPRoc)); thrd.Start(); } private void upd() { flist.ToList().ForEach(f=>f.c++); } private void updPRoc() { while (true) { this.BeginInvoke(new MethodInvoker(upd)); Thread.Sleep(1000); } } } public class foo:INotifyPropertyChanged { private int _c; public int a { get; set; } public int b { get; set; } public int c { get {return _c;} set { _c = value; if (PropertyChanged!= null) PropertyChanged(this,new PropertyChangedEventArgs("c")); } } #region INotifyPropertyChanged Members public event PropertyChangedEventHandler PropertyChanged; #endregion } } So, you edit column a or b, you will see that the column c update causes you to lose your entry. Any thoughts appreciated.

    Read the article

  • Building Current Selenium?

    - by user296241
    Hi guys, On the official Selenium blog (http://seleniumhq.wordpress.com/) it mentions that Maven is no longer used to build the Selenium project. Can anyone provide me some guidance on the new preferred method for building the selenium project? Everything I've found online is really out of date, referencing the old SVN repos and Maven. Thanks in advance! -Dan

    Read the article

  • Deserializing a type at the current stream position with protobuf-net

    - by Arne Claassen
    I'm serializing several objects into a single stream, but when i try to read them back, i can't seem to get anything but the last object: ProtoBuf.Serializer.Serialize(stream, postA1); ProtoBuf.Serializer.Serialize(stream, postB2); stream.Position = 0; var postA2 = ProtoBuf.Serializer.Deserialize<Post>(stream); var postB2 = ProtoBuf.Serializer.Deserialize<Post>(stream); The first deserialize moves the stream to the end and postA2 contains the value of postB2, while postB2 is just an uninitialized instance. Is this expected behavior, and if so, how do you deserialize an object from a random position in a stream?

    Read the article

  • How to implement menuitems that depend on current selection in WPF MVVM explorer-like application

    - by Doug
    I am new to WPF and MVVM, and I am working on an application utilizing both. The application is similar to windows explorer, so consider an app with a main window with menu (ShellViewModel), a tree control (TreeViewModel), and a list control (ListViewModel). I want to implement menu items such as Edit - Delete, which deletes the currently selected item (which may be in the tree or in the list). I am using Josh Smith's RelayCommand, and binding the menuitem to a DeleteItemCommand in the ShellViewModel is easy. It seems like implementing the DeleteItemCommand, however, requires some fairly tight coupling between the ShellViewModel and the two child view models (TreeViewModel and ListViewModel) to keep track of the focus/selection and direct the action to the proper child for implementation. That seems wrong to me, and makes me think I'm missing something. Writing a focus manager and/or selection manager to do the bookkeeping does not seem too hard, and could be done without coupling the classes together. The windowing system is already keeping track of which view has the focus, and it seems like I'd be duplicating code. What I'm not sure about is how I would route the command from the ShellViewModel down to either the ListViewModel or the TreeViewModel to do the actual work without making a mess of the code. Some day, the application will be extended to include more than two children, and I want the shell to be as ignorant of the children as possible to make that extension as painless as possible. Looking at some sample WPF/MVVM applications (Karl Shifflett's CipherText, Josh Smith's MVVM Demo, etc.), I haven't seen any code that does this (or I didn't understand it). Regardless of whether you think my approach is way off base or I'm just missing a small nuance, please share your thoughts and help me get back on track. Thanks!

    Read the article

  • current location too slow for view

    - by Christian
    Hi, I make an App with a Map in the App and a button to change to the google.Map-App. The code for my position is: -(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { float avgAccuracy = (newLocation.verticalAccuracy + newLocation.horizontalAccuracy)/2.0; if (avgAccuracy < 500) { [locationManager stopUpdatingLocation]; locationManager.delegate = nil; } storedLocation = [newLocation coordinate]; The code for the view is: - (void)viewDidLoad { [super viewDidLoad]; UIImage *image = [UIImage imageNamed: @"LogoNavBar.png"]; UIImageView *imageview = [[UIImageView alloc] initWithImage: image]; UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithCustomView: imageview]; self.navigationItem.rightBarButtonItem = button; [imageview release]; [button release]; locationManager=[[CLLocationManager alloc] init]; locationManager.delegate = self; locationManager.desiredAccuracy = kCLLocationAccuracyBest; locationManager.distanceFilter = kCLDistanceFilterNone; [locationManager startUpdatingLocation]; mapView.showsUserLocation = YES; NSLog(@"storedLocation-latitude für MKregion: %f", storedLocation.latitude); MKCoordinateRegion region; region.center.latitude = (storedLocation.latitude + 45.58058)/2.0; region.center.longitude = (storedLocation.longitude - 0.546835)/2.0; region.span.latitudeDelta = ABS(storedLocation.latitude - 45.58058); region.span.longitudeDelta = ABS(storedLocation.longitude + 0.546835); [mapView setRegion:region animated:TRUE]; MKCoordinateRegion hotel; hotel.center.latitude = 45.58058; hotel.center.longitude = -0.546835; HotelPositionMarker* marker = [[HotelPositionMarker alloc] initWithCoordinate:hotel.center]; [mapView addAnnotation:marker]; [marker release]; } My problem: when the "viewDidLoad" start, the "storedLocation" is still 0.0000 it takes a bit longer to get the own position than to start the view. The Log for the "storedLocation" in the "viewDidLoad"-section is 0 while the Log of the "storedLocation" in the "-(IBAction)" when the map is visible contains the right values. How can I manage it to have my coordinates before the view load? I need them to center the view concerning the own position and the position given by me. MKCoordinateRegion region; region.center.latitude = (storedLocation.latitude + 45.58058)/2.0; region.center.longitude = (storedLocation.longitude - 0.546835)/2.0; region.span.latitudeDelta = ABS(storedLocation.latitude - 45.58058); region.span.longitudeDelta = ABS(storedLocation.longitude + 0.546835); [mapView setRegion:region animated:TRUE];

    Read the article

  • Get current Windows user name within Silverlight

    - by huseyint
    Is it possible to get the currently logged in user's username with Silverlight? You can assume that user has Windows OS and the Silverlight application is hosted in Internet Explorer. Getting the identity from server side with ASP.NET is not an option, this SL application will be hosted on a static HTML file.

    Read the article

< Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >