Search Results

Search found 1555 results on 63 pages for 'scott'.

Page 30/63 | < Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >

  • Selecting the contents of an ASP.NET TextBox in an UpdatePanel after a partial page postback

    - by Scott Mitchell
    I am having problems selecting the text within a TextBox in an UpdatePanel. Consider a very simple page that contains a single UpdatePanel. Within that UpdatePanel there are two Web controls: A DropDownList with three statically-defined list items, whose AutoPostBack property is set to True, and A TextBox Web control The DropDownList has a server-side event handler for its SelectedIndexChanged event, and in that event handler there's two lines of code: TextBox1.Text = "Whatever"; ScriptManager.RegisterStartupScript(this, this.GetType(), "Select-" + TextBox1.ClientID, string.Format("document.getElementById('{0}').select();", TextBox1.ClientID), true); The idea is that whenever a user chooses and item from the DropDownList there is a partial page postback, at which point the TextBox's Text property is set and selected (via the injected JavaScript). Unfortunately, this doesn't work as-is. (I have also tried putting the script in the pageLoad function with no luck, as in: ScriptManager.RegisterStartupScript(..., "function pageLoad() { ... my script ... }");) What happens is the code runs, but something else on the page receives focus at the conclusion of the partial page postback, causing the TextBox's text to be unselected. I can "fix" this by using JavaScript's setTimeout to delay the execution of my JavaScript code. For instance, if I update the emitted JavaScript to the following: setTimeout("document.getElementById('{0}').select();", 111); It "works." I put works in quotes because it works for this simple page on my computer. In a more complex page on a slower computer with more markup getting passed between the client and server on the partial page postback, I have to up the timeout to over a second to get it to work. I would hope that there is a more foolproof way to achieve this. Rather than saying, "Delay for X milliseconds," it would be ideal to say, "Run this when you're not going to steal the focus." What's perplexing is that the .Focus() method works beautifully. That is, if I scrap my JavaScript and replace it with a call to TextBox1.Focus(); then the TextBox receives focus (although the text is not selected). I've examined the contents of MicrosoftAjaxWebForms.js and see that the focus is set after the registered scripts run, but I'm my JavaScript skills are not strong enough to decode what all is happening here and why the selected text is unselected between the time it is selected and the end of the partial page postback. I've also tried using Firebug's JavaScript debugger and see that when my script runs the TextBox's text is selected. As I continue to step through it the text remains selected, but then after stepping off the last line of script (apparently) it all of the sudden gets unselected. Any ideas? I am pulling my hair out. Thanks in advance...

    Read the article

  • How can I get contentWindow for an Object element in IE7

    - by Scott Leis
    I have a HTML object element like this: <object title="Search results as XML" standby="Loading XML document..." type="text/xml" data="/__CA25761100195585.nsf/WebPrintListingXML?OpenAgent&date1=01/06/2009" width="100%" height="100%" border="0" name="resultIFrame" id="resultIFrame" Error: could not embed search results. </object I also have this javascript function (alert() calls added for debugging): function getFrameByName(fParent,fName) { var fArray=fParent.frames; if (!fName) return; if (fArray) { if (fArray.length) { for (var i=0; i<fArray.length; i++) { alert('loop '+i); if (fArray[i]) { if (fArray[i].name==fName) return fArray[i]; } } } } var tmp=document.getElementsByName(fName); if (tmp[0]) { alert('returning '+tmp[0]); if (!(tmp[0].contentWindow)) alert('contentWindow is null'); return tmp[0].contentWindow; } } And finally, this button is meant to print the content of the Object element: <input type="button" value="Print" name="printBtn" onclick="getFrameByName(window,'resultIFrame').print();" The button works perfectly in Firefox. Opera is good enough, though it prints the main document instead of just the object. IE7 gives the following error details: Line: 57 Char: 1 Error: 'undefined' is null or not an object Line 57 is where the button's "input" tag starts in the HTML source. Thanks to the alert('contentWindow is null') call in the JS function, I know that the object I'm getting in IE has no contentWindow property. I have tried changing the object tag to an iframe tag. This changes the JS behaviour, but causes other issues such as the height attribute being ignored and the content not displaying. Sticking with an object tag, how can I get this Object's window in IE7?

    Read the article

  • Better algorithm for estimating download time

    - by Scott Smith
    We've all seen the download time running estimate that initially says something like "7 days", but keeps dropping wildly (e.g. "23 hours", "45 minutes", "1 min. 50 sec", etc) with each successive estimation as the chunks are downloaded. To avoid these initial (alarming) estimates, there are techniques one could try like suppressing display of the first n estimates, or waiting for the delta between estimates to drop below some threshold before you start displaying them, but these don't seem like a general, robust solution. There are corner cases involving too few samples, or samples that actually are wildly varying... I think I recall a general solution for this kind of thing in mathematics (statistics?) that reduced or eliminated these wild values. Does anyone know?

    Read the article

  • How should platform specific lib files be named?

    - by Scott Langham
    Hello, I'm working on a C++ project that produces a lib that other teams use. It's being produced in a few different flavours: Win32 Debug Win32 Debug Static Win32 Release Win32 Release Static x64 Debug x64 Debug Static x64 Release x64 Release Static I'm wondering what the best wisdom is on how to name the dlls and what arguments are for different naming conventions. Do I output the libs into different directories, or do I append some letters on the end of the lib to differentiate them, or something else? One concern is that if I use directories, but don't give all the libs different names, users of the library will have problems where they accidentally use the wrong lib. Are these concerns valid? Thanks very much.

    Read the article

  • jQuery jPicker path issues when used in WordPress Theme Options

    - by Scott B
    Anyone with experience using jPicker colorpicker in a WordPress Custom Theme options panel. I believe that the default path for the jPicker resources is /jPicker/ relative to the location the js file appears, however, I'm not seeing the picker.gif icon, so I tried changing the path in the js file like so... images:{clientPath:"../wp-content/themes/myTheme/images/" Everything else appears to be working at first load. My bound input field's background color is the same as the currently selected color. However, the picker.gif icon is missing. Where it should appear, I've just got a 2px wide by 20px tall color element (looks like a div perhaps).

    Read the article

  • Linq to sql Incorrect varchar length

    - by scott
    I have a table with a nullable varchar(50) column in it. When I am updating the value through linq to sql and trace the call in profiler it is defining the parameter as varchar(36). This is obviously causing some minor issues when we are trying to insert data that is between 37 and 50 characters long. I have tried removing the table and re-adding it to the design surface but the same thing happens. I also tried removing that property and adding it manually, same issue. When I look at the designer.cs code it shows the attribute properly: [Column(Storage="_Name", DbType="VarChar(50)")] I am out of ideas, anybody seen this before? Every other column is correct.

    Read the article

  • JCarousel scroll method does not always fire

    - by Scott Faisal
    var carousel = jQuery('#mycarousel').data('jcarousel'); var index = carousel.size() + 1; carousel.size(index); var html = '<li> some html </li>'; carousel.add(index, html); carousel.scroll(index, 1); The very last scroll method fires but not always. Is this a bug in JCarousel? The following is the code for the scroll method in JCarousel: /** * Scrolls the carousel to a certain position. * * @method scroll * @return undefined * @param i {Number} The index of the element to scoll to. * @param a {Boolean} Flag indicating whether to perform animation. */ scroll: function(i, a) { if (this.locked || this.animating) return; this.animate(this.pos(i), a); }

    Read the article

  • Sort directory listing using RecursiveDirectoryIterator

    - by Scott Saunders
    I'm using RecursiveDirectoryIterator and RecursiveIteratorIterator to build a file listing tree using code like below. I need to the list to be sorted - either directories then files alphabetically, or just alphabetically. Can anyone tell me how to sort the file list? $dir_iterator = new RecursiveDirectoryIterator($groupDirectory); $iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $file) { // do stuff with $file }

    Read the article

  • Javascript get Function Name?

    - by Scott
    How can I access a function name from inside that function? var my.namespace.myFunc = function() { this.getFn = function() { // access fully qualified name (ie "my.namespace.myFunc") } } var obj = new my.namespace.myFunc(); console.info(obj.getFn());

    Read the article

  • jQuery weirdness. Div becomes attached to chained element markup?

    - by Scott B
    I've got a div in my app that is displayed each time my theme options panel is "saved". The markup is... <form method="post"> <?php if ( $_REQUEST['saved']) { ?> <div id="message" class="updated fade"><p>Sweet! The settings were saved :)</p></div> <script type="text/javascript"> $('#message').delay(3000).fadeOut(3000);</script> <?php }?> This has the effect of showing the div (which is absolutely positioned to overlay the interface). I'm also using jQuery to fade the message offscreen after 3 seconds. This works fine, however, when I add a bit of script to my jQuery chain (see the commented out block below), the message div is only visible when the jPicker popup appears. $(function() { $("#carousel").jCarouselLite ( { btnNext: ".next", btnPrev: ".prev", visible: 6, speed: 700 } ); $('#carousel').show(); $('#myTheme').change ( function() { var myImage = $('#myTheme :selected').text(); $('.selectedImage img').attr('src','../wp-content/themes/myTheme/styles/'+myImage+'/screenshot.jpg'); } ); $('#carousel ul li').click ( function(e) { var myOption = $(this).children('img').attr('title'); $("#myTheme option[value='"+myOption+"']").attr('selected', 'selected'); $("#myTheme").css('backgroundColor', '#A9A9A9').animate({backgroundColor: "#ffffff"}, 'slow'); } ); $('#carousel ul li').hover ( function(e) { var img_src = $(this).children('img').attr('src'); $('.selectedImage img').attr('src',img_src); } ,function() { $('.selectedImage img').attr('src', '<?php echo $selectedThumb; ?>'); } ); /* $('#myTheme_sidebar_color').jPicker ( {}, function(color) { $(this).val(color.get_Hex()); }, function(color) { $(this).val(color.get_Hex()); } ); */ });

    Read the article

  • iphone dylibs and frameworks are already in the device?

    - by Scott Pendleton
    Are dylibs and frameworks already in an iPhone, or does my app actually incorporate them? Also, in Xcode I see dylibs with identical names. Sometimes the subsequent names are incremented, as in libz.dylib, libz.1.dylib, libz.1.1.3.dylib, and libz.1.2.3.dylib. If I have to include libz, should I use the one with the highest rev number, assuming that that's what that is?

    Read the article

  • Bypassing Windows Copy design

    - by Scott S
    I have been trying to figure out a way to streamline copying files from one drive (network or external in my case) to my main system drives. Short of creating a program that I will have to activate each time then choosing all the info in it, I have no really good design to bypass it. I have been wondering if there was a way to intercept a straight-forward windows copy with a program to do it my way. The basic design would be that upon grabbing the copy (actually for this to be efficient, a group of different copies), the program would organize all the separate copies into a single stream of copies. I've been wanting to do this as recently I have been needing to make backups of a lot of data and move it a lot as all my drives seem to be failing the past few months.

    Read the article

  • Do Hibernate table classes need to be Serializable?

    - by Scott Leis
    I have inherited a Websphere Portal project that uses Hibernate 3.0 to connect to a SQL Server database. There are about 130 Hibernate table classes in this project. They all implement Serializable. None of them declare a serialVersionUID field, so the Eclipse IDE shows a warning for all of these classes. Is there any actual need for these classes to implement Serializable? If so, is there any tool to add a generated serialVersionUID field to a large number of classes at once (just to make the warnings go away) ?

    Read the article

  • How to make JCarousel Vertical Scroller reverse scroll?

    - by Scott Faisal
    I was able to instantiate a working scroller using jQuery Jcarousel however I need it to reverse scroll. For example right now I have: jQuery(document).ready(function() { jQuery('#mycarousel').jcarousel({ auto: 1, vertical: true, scroll: 1, animation: "slow", wrap: 'last', initCallback: mycarousel_initCallback }); }); What do I need to do to make the items scroll upwards instead of downwards? Thank You in advance

    Read the article

  • Catching specific vs. generic exceptions in c#

    - by Scott Vercuski
    This question comes from a code analysis run against an object I've created. The analysis says that I should catch a more specific exception type than just the basic Exception. Do you find yourself using just catching the generic Exception or attempting to catch a specific Exception and defaulting to a generic Exception using multiple catch blocks? One of the code chunks in question is below: internal static bool ClearFlags(string connectionString, Guid ID) { bool returnValue = false; SqlConnection dbEngine = new SqlConnection(connectionString); SqlCommand dbCmd = new SqlCommand("ClearFlags", dbEngine); SqlDataAdapter dataAdapter = new SqlDataAdapter(dbCmd); dbCmd.CommandType = CommandType.StoredProcedure; try { dbCmd.Parameters.AddWithValue("@ID", ID.ToString()); dbEngine.Open(); dbCmd.ExecuteNonQuery(); dbEngine.Close(); returnValue = true; } catch (Exception ex) { ErrorHandler(ex); } return returnValue; } Thank you for your advice EDIT: Here is the warning from the code analysis Warning 351 CA1031 : Microsoft.Design : Modify 'ClearFlags(string, Guid)' to catch a more specific exception than 'Exception' or rethrow the exception

    Read the article

  • wxPthon problems with Wrapping StaticText

    - by Scott B
    Hello. I am having an issue with wxPython. A simplified version of the code is posted below (white space, comments, etc removed to reduce size - but the general format to my program is kept roughly the same). When I run the script, the static text correctly wraps as it should, but the other items in the panel do not move down (they act as if the statictext is only one line and thus not everything is visible). If I manually resize the window/frame, even just a tiny amount, everything gets corrected and displays as it is should. I took screen shots to show this behavior, but I just created this account and thus don't have the required 10 reputation points to be allowed to post pictures. Why does it not display correctly to begin with? I've tried all sorts of combination's of GetParent().Refresh() or Update() and GetTopLevelParent().Update() or Refresh(). I've tried everything I can think of but cannot get it to display correctly without manually resizing the frame/window. Once re-sized, it works exactly as I want it to. Information: Windows XP Python 2.5.2 wxPython 2.8.11.0 (msw-unicode) Any suggestions? Thanks! Code: #! /usr/bin/python import wx class StaticWrapText(wx.PyControl): def __init__(self, parent, id=wx.ID_ANY, label='', pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER, validator=wx.DefaultValidator, name='StaticWrapText'): wx.PyControl.__init__(self, parent, id, pos, size, style, validator, name) self.statictext = wx.StaticText(self, wx.ID_ANY, label, style=style) self.wraplabel = label #self.wrap() def wrap(self): self.Freeze() self.statictext.SetLabel(self.wraplabel) self.statictext.Wrap(self.GetSize().width) self.Thaw() def DoGetBestSize(self): self.wrap() #print self.statictext.GetSize() self.SetSize(self.statictext.GetSize()) return self.GetSize() class TestPanel(wx.Panel): def __init__(self, *args, **kwargs): # Init the base class wx.Panel.__init__(self, *args, **kwargs) self.createControls() def createControls(self): # --- Panel2 ------------------------------------------------------------- self.Panel2 = wx.Panel(self, -1) msg1 = 'Below is a List of Files to be Processed' staticBox = wx.StaticBox(self.Panel2, label=msg1) Panel2_box1_v1 = wx.StaticBoxSizer(staticBox, wx.VERTICAL) Panel2_box2_h1 = wx.BoxSizer(wx.HORIZONTAL) Panel2_box3_v1 = wx.BoxSizer(wx.VERTICAL) self.wxL_Inputs = wx.ListBox(self.Panel2, wx.ID_ANY, style=wx.LB_EXTENDED) sz = dict(size=(120,-1)) wxB_AddFile = wx.Button(self.Panel2, label='Add File', **sz) wxB_DeleteFile = wx.Button(self.Panel2, label='Delete Selected', **sz) wxB_ClearFiles = wx.Button(self.Panel2, label='Clear All', **sz) Panel2_box3_v1.Add(wxB_AddFile, 0, wx.TOP, 0) Panel2_box3_v1.Add(wxB_DeleteFile, 0, wx.TOP, 0) Panel2_box3_v1.Add(wxB_ClearFiles, 0, wx.TOP, 0) Panel2_box2_h1.Add(self.wxL_Inputs, 1, wx.ALL|wx.EXPAND, 2) Panel2_box2_h1.Add(Panel2_box3_v1, 0, wx.ALL|wx.EXPAND, 2) msg = 'This is a long line of text used to test the autowrapping ' msg += 'static text message. ' msg += 'This is a long line of text used to test the autowrapping ' msg += 'static text message. ' msg += 'This is a long line of text used to test the autowrapping ' msg += 'static text message. ' msg += 'This is a long line of text used to test the autowrapping ' msg += 'static text message. ' staticMsg = StaticWrapText(self.Panel2, label=msg) Panel2_box1_v1.Add(staticMsg, 0, wx.ALL|wx.EXPAND, 2) Panel2_box1_v1.Add(Panel2_box2_h1, 1, wx.ALL|wx.EXPAND, 0) self.Panel2.SetSizer(Panel2_box1_v1) # --- Combine Everything ------------------------------------------------- final_vbox = wx.BoxSizer(wx.VERTICAL) final_vbox.Add(self.Panel2, 1, wx.ALL|wx.EXPAND, 2) self.SetSizerAndFit(final_vbox) class TestFrame(wx.Frame): def __init__(self, *args, **kwargs): # Init the base class wx.Frame.__init__(self, *args, **kwargs) panel = TestPanel(self) self.SetClientSize(wx.Size(500,500)) self.Center() class wxFileCleanupApp(wx.App): def __init__(self, *args, **kwargs): # Init the base class wx.App.__init__(self, *args, **kwargs) def OnInit(self): # Create the frame, center it, and show it frame = TestFrame(None, title='Test Frame') frame.Show() return True if __name__ == '__main__': app = wxFileCleanupApp() app.MainLoop() EDIT: See my post below for a solution that works!

    Read the article

  • PHP - Cannot modify header information...

    - by Scott W.
    Hi, I am going crazy with this error: Cannot modify header information - headers already sent by... Please note that I know about the gazillion results on google and on stack overflow. My problem is the way I've constructed my pages. To keep html separate from php, I use include files. So, for example, my pages look something like this: <?php require_once('web.config.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Login</title> <link rel="shortcut icon" href="images/favicon.gif"/> <link rel="shortcut icon" href="images/favicon.ico"/> <link rel="stylesheet" type="text/css" href="<?php echo SITE_STYLE; ?>"/> </head> <body> <div id="page_effect" style="display:none;"> <?php require_once('./controls/login/login.control.php'); ?> </div> </body> </html> So, by the time my php file is included, the header is already sent. Part of the include file looks like this: // redirect to destination if($user_redirect != 'default') { $destination_url = $row['DestinationUrl']; header('Location:'.$user_redirect); } elseif($user_redirect == 'default' && isset($_GET['ReturnURL'])) { $destination_url = $_GET['ReturnURL']; header('Location:'.$destination_url); } else { header('Location:'.SITE_URL.'login.php'); } But I can't figure out how to work around this. I can't have the header redirect before the output so having output buffering on is the only thing I can do. Naturally it works fine that way - but having to rely on that just stinks. It would be nice if PHP had an alternative way to redirect or had additional parameters to tell it to clear the buffer.

    Read the article

  • Custom permalinks switching function. Please check this logic...

    - by Scott B
    I've got a setting in my theme options panel to allow the user to switch the permalinks setting to support friendly URLs. I'm only allowing /%postname%/ and /%postname%.html as options. I don't want to be triggering an htaccess rewrite everytime someone accesses a page on the site or views theme options, so I'm trying to code this to avoid that. I've got an input field in theme options that's called $myTheme_permalinks. The default value for this is "/%postname%/" but the user can also change it to "/%postname%.html" Here's the code at the top of theme options to handle this setting. Does this look sound? if(get_option('myTheme_permalinks') =="/%postname%/" && get_option('permalink_structure') !== "/%postname%/" || !get_option('myTheme_permalinks')) { require_once(ABSPATH . '/wp-admin/includes/misc.php'); require_once(ABSPATH . '/wp-admin/includes/file.php'); global $wp_rewrite; $wp_rewrite->set_permalink_structure('/%postname%/'); $wp_rewrite->flush_rules(); update_option('permalink_structure','/%postname%/'); update_option('myTheme_permalinks','/%postname%/'); } else if (get_option('myTheme_permalinks') =="/%postname%.html" && get_option('permalink_structure') !== "/%postname%.html" && ) { require_once(ABSPATH . '/wp-admin/includes/misc.php'); require_once(ABSPATH . '/wp-admin/includes/file.php'); global $wp_rewrite; $wp_rewrite->set_permalink_structure('/%postname%.html'); $wp_rewrite->flush_rules(); update_option('permalink_structure','/%postname%.html'); }

    Read the article

  • Do I need to include the 'this' when using a property name in a closure?

    - by Scott Whitlock
    I'm using a list of Actions to store an undo history for an object. Let's say I have a property of my object called myChildObject and it's being changed, so I want to store the undo action where I would set it back to it's current value: public class Class1 { public Class1() { } private readonly List<Action> m_undoActions = new List<Action>(); private SomeObject myChildObject { get; set; } public void ChangeState(SomeObject newChildObject) { // copies the reference SomeObject existingObject = myChildObject; m_undoActions.Add(() => myChildObject = existingObject); myChildObject = newChildObject; } } Looking at the lambda expression, existingObject is a local variable, so it's using a closure to pass a reference to that variable, but what about the property myChildObject? Do I need to use 'this' to preface it? Do I need to make a copy of the 'this' reference to a local variable first? Thanks for helping me understand this closure stuff.

    Read the article

  • Complicated MySQL query?

    - by Scott
    I have two tables: RatingsTable that contains a ratingname and a bit whether it is a positive or negative rating: Good 1 Bad 0 Fun 1 Boring 0 FeedbackTable that contains feedback on things...the person rating, the rating and the thing rated. The feedback can be determined if it's a positive or negative rating based on RatingsTable. Jim Chicken Good Jim Steak Bad Ted Waterskiing Fun Ted Hiking Fun Nancy Hiking Boring I am trying to write an efficient MySQL query for the following: On a page, I want to display the the top 'things' that have the highest proportional positive ratings. I want to be sure that the items from the feedback table are unique...meaning, that if Jim has rated Chicken Good 20 times...it should only be counted once. At some point I will want to require a minimum number of ratings (at least 10) to be counted for this page as well. I'll want to to do the same for highest proportional negative ratings, but I am sure I can tweak the one for positive accordingly.

    Read the article

  • Having all Views in the Shared folder - works but is throwing "caught exceptions". Performance conc

    - by Scott
    Hi everyone, I have a simple but heavily used app done in VS2010/MVC2. I didn't like having separate folders for each view/controller and so have all the views in the Shared folder. It's working fine but while debugging in VS, I noticed that it's throwing IO "caught exceptions" since it seems to be looking in the [FolderName]/[ViewName] folder before going down to the Shared folder. Again, the app runs fine but I'm concerned that all these "caught exceptions" will have a minor performance impact since they do have a cost in via the CLR. Is there any way I can configure the Routing so that it will only look in the Shared folder? Thanks.

    Read the article

  • Multiple WPFPreviewHandlers in One Window? Can it be done?

    - by Scott
    Here is the scenario. I am building a part of my desktop app up and I have a need to create a preview handler. I found plenty of examples on the web of a WPF Preview handler, but I wanted to go one step more than just that. Lets say we have multiple documents and I wished to compare them. So the ideal scenario would be able to see documents side by side in a collection. Sort of how BING does their image search. But the more documents I select in a list box, the more documents I can compare all at once. The second Ideal solution would be a tabbed interface. One tab for each document. Sort of like how internet browsers are doing it now. Understand? So here is the question that I have been struggling with. I can get one preview to work in a window, but can’t get the second one to show up. This is all WPF code so maybe im doing something wrong, but can you preview more than one document in a window at a time? My thought is no, because the previewhandler needs a window handler to lock onto. I would love small code sample since COM and handlers aren’t my sort of thing, but I can manage if you are just able to point me down the right track. Here is the code I found for the WPF Handler. http://blogs.microsoft.co.il/blogs/tamir/archive/2008/04/18/using-vista-preview-handlers-in-wpf-application.aspx

    Read the article

< Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >