Search Results

Search found 88 results on 4 pages for 'byron whitlock'.

Page 2/4 | < Previous Page | 1 2 3 4  | Next Page >

  • How do I open a web browser from a .NET Program? Process.Start() isn't working?

    - by Scott Whitlock
    I have a URL and I want to launch it in the default browser. I've tried two methods: Process.Start("http://stackoverflow.com"); ... and the one detailed in this other question using ShellExecute. In both cases I get the error: Windows cannot find 'http://stackoverflow.com'. Make sure you typed the name correctly, and then try again. It shouldn't be trying to open it as a file though... from what I understand, it should recognize it as a URL and open it in the default browser. What am I missing? By the way: OS = Vista, and .NET = 3.5 EDIT: According to this MS KB article, since Process.Start sets the UseShellExecute by default, it should launch the default browser.

    Read the article

  • How can I force a ListView with a custom panel to re-measure when the ListView width goes below the

    - by Scott Whitlock
    Sorry for the long winded question (I'm including background here). If you just want the question, go to the end. I have a ListView with a custom Panel implementation that I'm using to implement something similar to a WrapPanel, but not quite. I'm overriding the MeasureOverride and ArrangeOverride methods in the custom panel. If I do the naive implementation of a WrapPanel in the MeasureOverride method it doesn't work when the ListView is resized. Let's say the custom panel does a measure and the constraint is a width of 100 and let's say I have 3 items that are 40 wide each. The naive approach is to return a size of 80,80 but when I resize the window that the ListView is in, down to say 75, it just turns on the horizontal scrollbar and never calls measure or arrange again (it does keep measuring and arranging if the width is greater than 80). To get around this, I hard coded the measurement to only have a width of the widest item. Then in the arrange, it gives me more space than I asked for and I use as much horizontal space as I can before wrapping. If I resize the window smaller than the smallest item in the ListView, then it turns on the scrollbar, which is great. Unfortunately this is causing a big problem when I have one of these ListViews with a custom panel nested inside of another one. The outside one works ok, but I can't get the inside one to "take as much as it needs". It always sizes to the smallest item, and the only way around it is to set the MinWidth to be something greater than zero. Anyway, stepping back for a second, I think the real way to fix this is to go back to the Naive implementation of the WrapPanel but force it to re-measure when the ListView width goes below the Size I previously returned as a measurement. That should solve my problem with the nested one. So, that's my question: I have a ListView with a custom panel If I return a measurement width on the panel and the ListView is resized to less than that width, it stops calling MeasureOverride How can I get it to continue calling MeasureOverride?

    Read the article

  • Why doesn't MySQL support millisecond precision?

    - by Byron Whitlock
    So I just found the most frustrating bug ever in MySQL. Apparently the TIMESTAMP field, and supporting functions do not support any greater precision than seconds!? So I am using PHP and Doctrine, and I really need those microseconds (I am using the actAs: [Timestampable] property). I found a that I can use a BIGINT field to store the values. But will doctrine add the milliseconds? I think it just assigns NOW() to the field. I am also worried the date manipulation functions (in SQL) sprinkled through the code will break. I also saw something about compiling a UDF extension. This is not an acceptable workaround because I or a future maintainer will upgrade and poof, change gone. Has anyone found a suitable workaround?

    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

  • Is there a web site where I can paste a SQL Insert statement and have it break it out by column?

    - by Scott Whitlock
    I've been working on an application that has no discernable data access layer, so all the SQL statements are just built up as strings and executed. I'm constantly confronted by very long INSERT statements where I'm trying to figure out what value in the VALUES list matches up with what column in the column name list. I was about to create a little helper application where I could paste in an INSERT statement and have it show me a list of values matched up with the column names, just for debugging, and I thought, "someone else has probably done this already." Does anyone know of a web site where I can just paste in an INSERT statement and have it show me a two column table with column names in the first column and values in the second column?

    Read the article

  • How does a cryptographically secure random number generator work?

    - by Byron Whitlock
    I understand how standard random number generators work. But when working with crytpography, the random numbers really have to be random. I know there are instruments that read cosmic white noise to help generate secure hashes, but your standard PC doesn't have this. How does a cryptographically secure random number generator get its values with no repeatable patterns?

    Read the article

  • Performance with timestamp conditions

    - by Tim Whitlock
    Which of the following is faster, or are they equivalent? (grabbing recent most records from a TIMESTAMP COLUMN) SELECT UNIX_TIMESTAMP(`modified`) stamp FROM `some_table` HAVING stamp > 127068799 ORDER BY stamp DESC or SELECT UNIX_TIMESTAMP(`modified`) stamp FROM `some_table` WHERE UNIX_TIMESTAMP(`modified`) > 127068799 ORDER BY `modified` DESC or even another combination?

    Read the article

  • Why doesn't MySQL support millisecond / microsecond precision?

    - by Byron Whitlock
    So I just found the most frustrating bug ever in MySQL. Apparently the TIMESTAMP field, and supporting functions do not support any greater precision than seconds!? So I am using PHP and Doctrine, and I really need those microseconds (I am using the actAs: [Timestampable] property). I found a that I can use a BIGINT field to store the values. But will doctrine add the milliseconds? I think it just assigns NOW() to the field. I am also worried the date manipulation functions (in SQL) sprinkled through the code will break. I also saw something about compiling a UDF extension. This is not an acceptable because I or a future maintainer will upgrade and poof, change gone. Has anyone found a suitable workaround?

    Read the article

  • How do I measure the size of a TextBlock in WPF before it is rendered?

    - by Scott Whitlock
    I have a WPF DataTemplate with two TextBlock controls (stacked) and then some other elements underneath. Due to some complicated layout code, I need to know the height of the two TextBlock elements so that I can draw some fancy connector lines, and line up other controls, etc. If I know the text that's going into the TextBlocks, and I know the font, etc., is there some way I can compute or measure the height of these TextBlocks without actually rendering them?

    Read the article

  • messages stuck permanently in session

    - by Tim Whitlock
    I am getting Drupal messages stuck permanently in session, so that after being displayed they are not cleared. The unsetting code in function drupal_get_messages in bootstrap.inc is firing - It's as if the session is sleeping (i.e. serializing to disk) before the messages array is cleared. Have you witnessed such a thing? UPDATE The call that commits the session starts from drupal_page_footer at the bottom of index.php - for some reason this is executing twice per request! once with the emptied messages and then again with the messages back in the array.

    Read the article

  • WPF layout calls MeasureOverride repeatedly in increments of 2?

    - by Scott Whitlock
    I've run into a case where I have a custom Panel (inherits from Panel) and I'm using it as an ItemsPanel in a ListView. When I resize the container that it's in, if I resize it smaller, my panel's MeasureOverride function gets called once, but if I resize it larger (let's say from 100 to 300), it calls MeasureOverride and ArrangeOverride for every value between 100 and 300, in increments of 2 (so 102, 104, etc.). The weird thing is that the container resizes right away (its size gets to 300 immediately). It doesn't seem to matter what I return from MeasureOverride - it just does this. I wish I could make it happen in a really small application and post it here, but I haven't been able to reproduce it like that yet. I can reproduce it all day in my app though. Does anyone know what could cause this?

    Read the article

  • JavaScript pack("d") - binary strings

    - by Tim Whitlock
    I'm trying to replicate the Perl and PHP style pack and unpack functions in JavaScript. Unsigned integers were easy enough, so my pack('n') and pack('N') are ok. But my lack of a computer science background is a hurdle now and I don't know where to start with pack('d') for packing JavaScript's standard floating point. Is there a JavaScript library for this out there? If not, is there a good resource where I can learn how to do this? I am fine with bitwise and binary level operations in JS, I just don't know where to start with the logic. Thanks.

    Read the article

  • How do I open a web browser from C#? Process.Start() isn't working?

    - by Scott Whitlock
    I have a URL and I want to launch it in the default browser. I've tried two methods: Process.Start("http://stackoverflow.com"); ... and the one detailed in this other question using ShellExecute. In both cases I get the error: Windows cannot find 'http://stackoverflow.com'. Make sure you typed the name correctly, and then try again. It shouldn't be trying to open it as a file though... from what I understand, it should recognize it as a URL and open it in the default browser. What am I missing? By the way: OS = Vista, and .NET = 3.5

    Read the article

  • Creating a System.Windows.Controls.Image throws an exception - how do I use the dispatcher to instan

    - by Scott Whitlock
    I'm running my unit tests on a piece of code that does the following in the test: Assert.IsNotNull(target.Icon); Inside the getter for the Icon property, I'm doing this: System.Windows.Controls.Image img = new System.Windows.Controls.Image(); That's throwing this exception: System.InvalidOperationException : The calling thread must be STA, because many UI components require this. I understand what that means, and I understand that I need to use the Dispatcher, but I'm a bit confused about how or why... this is a property of my ViewModel and I don't get any of these exceptions when running the application. Other info: this only started failing when I upgraded to .NET 4.

    Read the article

  • How to handle payment types with varying properties in the most elegant way.

    - by Byron Sommardahl
    I'm using ASP.NET MVC 2. Keeping it simple, I have three payment types: credit card, e-check, or "bill me later". I want to: choose one payment type display some fields for one payment type in my view run some logic using those fields (specific to the type) display a confirmation view run some more logic using those fields (specific to the type) display a receipt view Each payment type has fields specific to the type... maybe 2 fields, maybe more. For now, I know how many and what fields, but more could be added. I believe the best thing for my views is to have a partial view per payment type to handle the different fields and let the controller decide which partial to render (if you have a better option, I'm open). My real problem comes from the logic that happens in the controller between views. Each payment type has a variable number of fields. I'd like to keep everything strongly typed, but it feels like some sort of dictionary is the only option. Add to that specific logic that runs depending on the payment type. In an effort to keep things strongly typed, I've created a class for each payment type. No interface or inherited type since the fields are different per payment type. Then, I've got a Submit() method for each payment type. Then, while the controller is deciding which partial view to display, it also assigns the target of the submit action. This is not elegant solution and feels very wrong. I'm reaching out for a hand. How would you do this?

    Read the article

  • "The name 'WithTable' does not exist in the current context" using Fluent NHibernate

    - by Byron Sommardahl
    Might be a really easy problem to fix, but it the solution is eluding me! I'm using Fluent NHibernate 1.0 RTM (and using NHibernate bins that ships with it). I'm trying to map my entities and cannot use the WithTable() method. It's not available in Intelligence and VS doesn't suggest any namespaces to reference. Here's my code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using GeoCodeThe.Net.Domain.Entities; using FluentNHibernate.Mapping; namespace GeoCodeThe.Net.Domain.Mappings { class CategoryMap: ClassMap<ICategory> { public CategoryMap() { WithTable("Categories"); // <----- Compile error: The name 'WithTable' does not exist in the current context Id(x => x.Id); Map(x => x.Name); Map(x => x.Tags); } } My bin folder has: Antlr3.Runtime.dll Castle.Core.dll Castle.DynamicProxy2.dll FluentNHibernate.dll Iesi.Collections.dll log4net.dll NHibernate.ByteCode.Castle.dll NHibernate.dll FluentNHibernate.pdb Castle.Core.xml Castle.DynamicProxy2.xml FluentNHibernate.xml Iesi.Collections.xml log4net.xml NHibernate.ByteCode.Castle.xml NHibernate.xml Any clue what I'm missing? Let me know if you need any more clarification.

    Read the article

  • Accessing Request object from custom JSP tags

    - by Byron
    I'm trying to make a set of custom tags that encapsulate form elements (markup and validation). There's a method given to retrieve the "Out" object easily: JspWriter out = getJspContext().getOut(); However I can't figure out how to get the request object. I want to be able to directly access the submitted form values from within the Tag class so that I can validate each field. The documentation is quite sparse, so I thought maybe I could use the JspContext object to somehow get the request attributes. But I don't understand the different scopes. System.out.println(getJspContext().findAttribute("field1")); always prints "null". Enumeration e = getJspContext().getAttributeNamesInScope(1); Looping through and printing out the enumeration just gives me a list of classes that don't exist: javax.servlet.jsp.jspOut javax.servlet.jsp.jspPage javax.servlet.jsp.jspSession javax.servlet.jsp.jspApplication javax.servlet.jsp.jspPageContext javax.servlet.jsp.jspConfig javax.servlet.jsp.jspResponse javax.servlet.jsp.jspRequest So is this even possible? If not, could anyone point me to a tag library that deals with form display and validation? I searched the internet for a couple hours and it seemed every single one was discontinued and I couldn't download them. Either that or suggest a better alternative for handling forms.

    Read the article

  • Always handle the PreviewKeyDown event in a base form

    - by Byron Ross
    We need to handle this event in the base form, regardless of which controls currently have focus. We have a couple of global key commands that need to work regardless of control focus. This works by handling the PreviewKeyDown event in the form normally. When we add a user control to the form, the event no longer fires. Am I missing something trivial here? Or do we need to handle the event in the user control first? Thanks for your help! Thanks Factor. When I get more time :) I'll get it working 'properley'!

    Read the article

  • PDO::fetchAll vs. PDO::fetch in a loop

    - by Byron
    Just a quick question. Is there any performance difference between using PDO::fetchAll() and PDO::fetch() in a loop (for large result sets)? I'm fetching into objects of a user-defined class, if that makes any difference. My initial uneducated assumption was that fetchAll might be faster because PDO can perform multiple operations in one statement while mysql_query can only execute one. However I have little knowledge of PDO's inner workings and the documentation doesn't say anything about this, and whether or not fetchAll() is simply a PHP-side loop dumped into an array. Any help?

    Read the article

  • How can I assign more than one ValueProvider to ModelBindingContext when testing a custom model bind

    - by Byron Sommardahl
    I have a custom model binder that uses data from session, tempdata, and form collection (hypothetically, of course!). When testing my model binder, need to create a ModelBindingContext with a ValueProvider. Trouble is, I can't see how I can have one ValueProvider that serves multiple value provider types. Any words of wisdom? ValidModelBindingContext = new ModelBindingContext { ModelName = "SomeModel", ValueProvider = ValidFormValueCollection };

    Read the article

  • Is mspec better with or without nunit?

    - by Byron Sommardahl
    I've seen mspec used with nunit on some blogs and discussions. In fact, most of the examples on the web that I've seen demonstrate mspec with some kind of nunit dependancy or integration. My team is attempting to use mspec without nunit on a new ASP.NET MVC2 project. We're not at the spec-writing stage yet, so I can't tell what is better. What it your experience with this? Are there benefits to using mspec with nunit? Without?

    Read the article

  • What does `const` do when combined with `readonly`?

    - by Byron Sommardahl
    The difference between const and readonly is well covered. A const can't be changed and a read only can only be changed in a constructor. But, what happens when you combine the two: public readonly const string how_does_this_behave = "I don't know"; The compiler allows it. But I'm not sure how it behaves from this point on. Thoughts?

    Read the article

< Previous Page | 1 2 3 4  | Next Page >