Search Results

Search found 988 results on 40 pages for 'andy simpson'.

Page 23/40 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • Choosing circle radius to fully fill a rectangle

    - by Andy
    Hi, the pixman image library can draw radial color gradients between two circles. I'd like the radial gradient to fill a rectangular area defined by "width" and "height" completely. Now my question, how should I choose the radius of the outer circle? My current parameters are the following: A) inner circle (start of gradient) center pointer of inner circle: (width*0.5|height*0.5) radius of inner circle: 1 color: black B) outer circle (end of gradient) center pointer of outer circle: (width*0.5|height*0.5) radius of outer circle: ??? color: white How should I choose the radius of the outer circle to make sure that the outer circle will entirely fill my bounding rectangle defined by width*height. There shall be no empty areas in the corners, the area shall be completely covered by the circle. In other words, the bounding rectangle width,height must fit entirely into the outer circle. Choosing outer_radius = max(width, height) * 0.5 as the radius for the outer circle is obviously not enough. It must be bigger, but how much bigger? Thanks!

    Read the article

  • XmlDataProvider and XPath bindings don't allow default namespace of XML data?

    - by Andy Dent
    I am struggling to work out how to use default namespaces with XmlDataProvider and XPath bindings. There's an ugly answer using local-name <Binding XPath="*[local-name()='Name']" /> but that is not acceptable to the client who wants this XAML to be highly maintainable. The fallback is to force them to use non-default namespaces in the report XML but that is an undesirable solution. The XML report file looks like the following. It will only work if I remove xmlns="http://www.acme.com/xml/schemas/report so there is no default namespace. <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type='text/xsl' href='PreviewReportImages.xsl'?> <Report xsl:schemaLocation="http://www.acme.com/xml/schemas/report BlahReport.xsd" xmlns:xsl="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.acme.com/xml/schemas/report"> <Service>Muncher</Service> <Analysis> <Date>27 Apr 2010</Date> <Time>0:09</Time> <Authoriser>Service Centre Manager</Authoriser> Which I am presenting in a window with XAML: <Window x:Class="AcmeTest.ReportPreview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="ReportPreview" Height="300" Width="300" > <Window.Resources> <XmlDataProvider x:Key="Data"/> </Window.Resources> <StackPanel Orientation="Vertical" DataContext="{Binding Source={StaticResource Data}, XPath=Report}"> <TextBlock Text="{Binding XPath=Service}"/> </StackPanel> </Window> with code-behind used to load an XmlDocument into the XmlDataProvider (seems the only way to have loading from a file or object varying at runtime). public partial class ReportPreview : Window { private void InitXmlProvider(XmlDocument doc) { XmlDataProvider xd = (XmlDataProvider)Resources["Data"]; xd.Document = doc; } public ReportPreview(XmlDocument doc) { InitializeComponent(); InitXmlProvider(doc); } public ReportPreview(String reportPath) { InitializeComponent(); var doc = new XmlDocument(); doc.Load(reportPath); InitXmlProvider(doc); } }

    Read the article

  • How can I make these images download on a separate thread?

    - by Andy Barlow
    I have the following code running on my Android device. It works great and displays my list items wonderfully. It's also clever in the fact it only downloads the data when it's needed by the ArrayAdapter. However, whilst the download of the thumbnail is occurring, the entire list stalls and you cannot scroll until it's finished downloading. Is there any way of threading this so it'll still scroll happily, maybe show a place holder for the downloading image, finish the download, and then show? Any help with this would be really appreciated. private class CatalogAdapter extends ArrayAdapter<SingleQueueResult> { private ArrayList<SingleQueueResult> items; //Must research what this actually does! public CatalogAdapter(Context context, int textViewResourceId, ArrayList<SingleQueueResult> items) { super(context, textViewResourceId, items); this.items = items; } /** This overrides the getview of the ArrayAdapter. It should send back our new custom rows for the list */ @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.mylists_rows, null); } final SingleQueueResult result = items.get(position); // Sets the text inside the rows as they are scrolled by! if (result != null) { TextView title = (TextView)v.findViewById(R.id.mylist_title); TextView format = (TextView)v.findViewById(R.id.mylist_format); title.setText(result.getTitle()); format.setText(result.getThumbnail()); // Download Images ImageView myImageView = (ImageView)v.findViewById(R.id.mylist_thumbnail); downloadImage(result.getThumbnail(), myImageView); } return v; } } // This should run in a seperate thread public void downloadImage(String imageUrl, ImageView myImageView) { try { url = new URL(imageUrl); URLConnection conn = url.openConnection(); conn.connect(); InputStream is = conn.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); Bitmap bm = BitmapFactory.decodeStream(bis); bis.close(); is.close(); myImageView.setImageBitmap(bm); } catch (IOException e) { /* Reset to Default image on any error. */ //this.myImageView.setImageDrawable(getResources().getDrawable(R.drawable.default)); } }

    Read the article

  • Defining < for STL sort algorithm - operator overload, functor or standalone function?

    - by Andy
    I have a stl::list containing Widget class objects. They need to be sorted according to two members in the Widget class. For the sorting to work, I need to define a less-than comparator comparing two Widget objects. There seems to be a myriad of ways to do it. From what I can gather, one can either: a. Define a comparison operator overload in the class: bool Widget::operator< (const Widget &rhs) const b. Define a standalone function taking two Widgets: bool operator<(const Widget& lhs, const Widget& rhs); And then make the Widget class a friend of it: class Widget { // Various class definitions ... friend bool operator<(const Widget& lhs, const Widget& rhs); }; c. Define a functor and then include it as a parameter when calling the sort function: class Widget_Less : public binary_function<Widget, Widget, bool> { bool operator()(const Widget &lhs, const Widget& rhs) const; }; Does anybody know which method is better? In particular I am interested to know if I should do 1 or 2. I searched the book Effective STL by Scott Meyer but unfortunately it does not have anything to say about this. Thank you for your reply.

    Read the article

  • Why does my Windows Form app timeout when repeatedly hitting IIS 7 externally?

    - by andy
    hey guys, I've got a very simple Windows Form app that hits an IIS 7 site about 2000 times in the space of a few seconds (using threads). When I run that app on the server itself, using either localhost or the ip address, everything is totally fine. However, when I run the app on my dev box, using the ip address, I get an error from the "GetResponse" method: The operation has timed out The App can definitely connect to the site, because it consistently either starts throwing the timeout error after 10 or so hits (no more than 11), or it throws the timeout error immediately. What's going on? It's hitting IIS 7 on a Windows Server 2008 VM (external box), Windows Firewall is OFF. My App is running locally on my dev box as the admin. cheers

    Read the article

  • .NET SettingsProvider/ApplicationSettingsBase caching

    - by Andy White
    I'm looking at some code that uses the .NET System.Configuration.SettingsProvider and ApplicationSettingsBase to handle configuration. We have a class that derives from SettingsProvider that uses a database as the data store, and then we have other settings classes that inherit from ApplicationSettingsBase, and have the [SettingsProvider(typeof(MySettingsProvider))] attribute. The problem is that we're using these settings classes in multiple applications, but they seem to permanently cache the configuration values, the first time they are loaded. The issue is that if a setting is changed in one application, the other applications will not get the setting until the next restart, because they are cached everywhere. My question is: is there a way to force the SettingsProvider implementation, or the classes derived from ApplicationSettingsBase to not cache values, and re-query the datastore every time the setting is accessed? A valid answer might be that these classes were not intended to be used in multi-application environments...

    Read the article

  • customize Help Center Live HLC

    - by Andy
    Hi, I just installed Help Center Live which works fine, but I would like to make just one minor adjustment and after looking almost everywhere I couldn't find the file where the text was listen in. At the end of each chat the user can request a copy of the transcript. I tested it and it got into the spam folder of my email client. Why, I don't know, but the point here is I would lik to add some text. After a user finishes a chat session, he or she gets a page hcl/live/chat/end.php with the following text displayed somewhere: "To e-mail yourself a copy of the transcript, please enter your e-mail address below." After entering the address and pressing submit there is a confirmation message: "A copy of the transcript has been sent to your e-mail address." And I would like to add: "Please check your spam folder if you haven't received your transcript" How can this be done? Thanks.

    Read the article

  • Why doesn't an octal literal as a string cast to a number?

    - by Andy E
    In JavaScript, why does an octal number string cast as a decimal number? I can cast a hex literal string using Number() or +, why not an octal? For instance: 1000 === +"1000" // -> true 0xFF === +"0xFF" // -> true 0100 === +"0100" // -> false - +"0100" gives 100, not 64 I know I can parse with parseInt("0100" [, 8]), but I'd like to know why casting doesn't work like it does with hex and dec numbers. Also, does anyone know why octal literals are dropped from ECMAScript 5th Edition in strict mode?

    Read the article

  • comparing strings from two different sources in javascript

    - by andy-score
    This is a bit of a specific request unfortunately. I have a CMS that allows a user to input text into a tinymce editor for various posts they have made. The editor is loaded via ajax to allow multiple posts to be edited from one page. I want to be able to check if there were edits made to the main text if cancel is clicked. Currently I get the value of the text from the database during the ajax call, json_encode it, then store it in a javascript variable during the callback, to be checked against later. When cancel is clicked the current value of the hidden textarea (used by tinymce to store the data for submission) is grabbed using jquery.val() and checked against the stored value from the previous ajax call like this: if(stored_value!=textarea.val()) { return true } It currently always returns true, even if no changes have been made. The issue seems to be that the textarea.val() uses html entities, whereas the ajax jsoned version doesn't. the response from ajax in firebug looks like this: <p>some text<\/p>\r\n<p>some more text<\/p> the textarea source code looks like this: &lt;p&gt;some text&lt;/p&gt; &lt;p&gt;some more text&lt;/p&gt; these are obviously different, but how can I get them to be treated as the same when evaluated? Is there a function that compares the final output of a string or a way to convert one string to the other using javascript? I tried using html entities in the ajax page, but this returned the string with html entities intact when alerted, I assume because json_encoding it turned them into characters. Any help would be greatly appreciated.

    Read the article

  • google maps not showing actual map and postcode

    - by Andy
    Im trying to pass a dynamically generated postode to a page. But currently its not showing the map correctly. Any ideas? Heres my head tag <script src="http://www.google.com/jsapi?key=ABQIAAAANQzcZVPOkiHWMZO3zxREGRSlIja3KBL7jZ08tky_uJrV3vVYdxTCwTHJPA2Vn06DLdnCWvRW_w7VYQ" type="text/javascript"></script> <script language="Javascript" type="text/javascript"> var localSearch; var map; var icon; var addressMarkerOptions; google.load("search", "1"); google.load("maps", "2"); google.setOnLoadCallback(initialize); function initialize() { localSearch = new GlocalSearch(); icon = new GIcon(G_DEFAULT_ICON); addressMarkerOptions = { icon:icon , draggable: false}; map = new GMap2(document.getElementById("map")); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); plotAddress("OX4 1FJ"); } /** * This takes either a postcode or an address string * */ function plotAddress(address) { localSearch.setSearchCompleteCallback(null, function() { if (localSearch.results[0]) { var resultLat = localSearch.results[0].lat; var resultLng = localSearch.results[0].lng; var point = new GLatLng(resultLat,resultLng); var marker = new GMarker(point, addressMarkerOptions); map.addOverlay(marker); map.setCenter(point, 5, G_NORMAL_MAP); } else { alert('address not found'); } }); localSearch.execute(address + ", UK"); } </script> It slots into the code below: <div id="map">Loading...</div>

    Read the article

  • would like to create a .php file that reads an .xml file and delivers xml output from the .xml file

    - by Andy
    I know it sounds weird but I need it for a workaround. So some link in an ActionScript links for a .php file. As I am unable to edit this link in the AS I need some workaround. I have the xml and the .php file needs to output that exact xml code. How can this be done. Ultimately I would like to create a .php script that outputs xml. Where can I find instructions on how to do this? thanks!

    Read the article

  • In MVC2, how do I validate fields that aren't in my data model?

    - by Andy Evans
    I am playing with MVC2 in VS 2010 and am really getting to like it. In a sandbox application that I've started from scratch, my database is represented in an ADO.NET entity data model and have done much of the validation for fields in my data model using Scott Guthrie's "buddy class" approach which has worked very well. However, in a user registration form that I have designed and am experimenting with, I'd like to add a 'confirm email address' or a 'confirm password' field. Since these fields obviously wouldn't exist in my data model, how would I validate these fields client side and server side? I would like to implement something like 'Html.ValidationMessageFor', but these fields don't exist in the data model. Any help would be greatly appreciated.

    Read the article

  • C# - NetworkChangeEventHandler

    - by Andy
    I have small application which catches Network Availability change and its working very fine in client Desktop m/c (which is having XP) But when I tested the same in Vista by disabling the network and enabling it again..the event is not getting triggered. NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(NetworkChange_NetworkAvailabilityChanged); private void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e) {.....} Does .Net framework 3.5 got any new solution introduced ...

    Read the article

  • Netbeans-esque retrospective auto-comment/phpDocumentor tool (for Eclipse or standalone)

    - by Andy
    Is there anything similar to netbean's Javadoc auto comment tool for PHP/phpDocumentor/Eclipse? In the netbeans implementation: A dialog pops up and allows you to run through all the members of your class and enter comments, which are added to the source file. It even verifies that there are no parameters you have not accounted for, so you can be sure that your comments are complete. Ideally this would be standalone software, but plugins are OK too :) p.s. netbeans 6+ auto comment was moved/renamed. Now in "Tool-Options", Tab: "Java Code", Javadoc: "Hints" edit: screengrab of the original Netbeans tool:

    Read the article

  • Custom certificate as proof of transaction

    - by Andy
    I'm developing a site where a user conducts a given transaction and once completed, the user is issued with a 'secure certificate'. The certificate serves as proof of the transaction and the user is able to upload the certificate at a later stage, to view the details of the transaction. At the moment I'm using a custom XML document with encrypted fields. It works perfect, but I would like a standardized approach, such as an X.509 certificate. I'm no encryption expert, but from what I gather, X.509 is more geared towards SSL issued by a CA. Is it possible to create your own valid valid CRT file? As a test, I created a CRT file with the example provided on WikiPedia. However, when I open the file in Windows I get this warning: Invalid Public Key Security Object File - This file is invalid as the following: Security Certificate. Not having much luck here, so time to ask the experts. What direction should I be heading in? Any guidance would be greatly appreciated.

    Read the article

  • MySQL Query Help

    - by Andy
    I need to find the category id in the products table below. However the cms_ecom_categories.id is wrapped with the & character like &12&. Is there some kind of wild card i could use to wrap around? like %cms_ecom_categories.id% ? $sql = "SELECT * FROM cms_ecom_products, cms_ecom_categories WHERE cms_ecom_products.pCategories = cms_ecom_categories.id AND cms_ecom_categories.slug = ".$page.""; Thanks to all in advance who can help.

    Read the article

  • How can I capture the keystroke that triggers "CellEndEdit" on a DataGridView in C#?

    - by Andy Stampor
    I have a DataGridView that is set to EditOnF2. I do some special processing of data in the CellEndEdit eventhandler that sets the value of the cell. I still want the functionality of the EditOnKeystrokeOrF2 of reverting to the original value when the Esc key is pressed. Unfortunately, at the CellEndEdit eventhandler, I don't see a way to tell what caused the CellEndEdit event to be fired. I only want to change the value of the cell if the Esc key is not pressed. How can I tell if it was or not? Edit: It is worth noting that the KeyDown event does not get fired when the cell is being edited, nor for the final ending keystroke. Edit2: I have tried the KeyPreview suggestion, but the form still does not capture the Escape key being pressed. Edit3: I've been experimenting with trying to get this working. I originally posted some of the following as a separate post, but feel it might be more relevant to include it here. I have a cell in a DataGridView that is now set to EditProgrammatically. To capture the keystroke that starts an edit, I am setting the cell.Value equal to the keystroke. However, this ruins the "Escape" functionality of the cell - when you press escape, instead of reverting to the original value, it reverts to the keystroke that I programmatically inserted into the cell. I believe that if I could set the "EditedFormattedValue" on a cell, this would be where I want to put my keystroke value, however this appears to be read only. How can I accomplish what I am attempting? An example to clarify: If the cell has a value of "54.3" in it, and I press the "9" key, it begins editing the cell and places a "9" there. If I hit Escape, instead of reverting to "54.3" it reverts to "9". What I want is for it to return to its original value of "54.3". So, I am trying to tackle this issue from both the beginning and the end. I think the real problem is that I am overwriting the original value and have no way to determine if I should revert it or not. Edit4: It looks like CellValidating might be worth using, but I am seeing strange behavior when I experiment with it. In a new project, I create the DataGridView and register for the various events and see that CellValidating is fired before the CellEndEdit. However, in my project where I am trying to get this to work, CellEndEdit is firing BEFORE CellValidating. Any ideas on what the difference might be?

    Read the article

  • wpf error template - red box still visible on collapse of an expander

    - by Andy Clarke
    Hi, I'm doing some validation on the DataSource of TextBox that's within an Expander and have found that once a validation error has been triggered, if I collapse the Expander, the red box stays where the TextBox would have been. <Expander Header="Blah Blah Blah"> <TextBox Name="TextBox" Validation.ErrorTemplate="{DynamicResource TextBoxErrorTemplate}" Text="{Binding Path=Blah, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" /> </Expander> I've tried to get round this by binding the visibility of the Error Template to the Expander, however I think there's something wrong with the binding. <local:NotVisibleConverter x:Key="NotVisibleConverter" /> <ControlTemplate x:Key="TextBoxErrorTemplate"> <DockPanel> <Border BorderBrush="Red" BorderThickness="2" Visibility="{Binding Path=IsExpanded, Converter={StaticResource NotVisibleConverter}, RelativeSource={RelativeSource AncestorType=Expander}}" > <AdornedElementPlaceholder Name="MyAdorner" /> </Border> </DockPanel> <ControlTemplate.Triggers> <Trigger Property="Validation.HasError" Value="true"> <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> I guess I've gone wrong with my binding, can someone put me back on track please? Alternatively does anyone know another solution to the ErrorTemplate still being visible on the collapse of an Expander?

    Read the article

  • Network Authentication when running exe from WMI

    - by Andy
    Hi, I have a C# exe that needs to be run using WMI and access a network share. However, when I access the share I get an UnauthorizedAccessException. If I run the exe directly the share is accessible. I am using the same user account in both cases. There are two parts to my application, a GUI client that runs on a local PC and a backend process that runs on a remote PC. When the client needs to connect to the backend it first launches the remote process using WMI (code reproduced below). The remote process does a number of things including accessing a network share using Directory.GetDirectories() and reports back to the client. When the remote process is launched automatically by the client using WMI, it cannot access the network share. However, if I connect to the remote machine using Remote Desktop and manually launch the backend process, access to the network share succeeds. The user specifed in the WMI call and the user logged in for the Remote Desktop session are the same, so the permissions should be the same, shouldn't they? I see in the MSDN entry for Directory.Exists() it states "The Exists method does not perform network authentication. If you query an existing network share without being pre-authenticated, the Exists method will return false." I assume this is related? How can I ensure the user is authenticated correctly in a WMI session? ConnectionOptions opts = new ConnectionOptions(); opts.Username = username; opts.Password = password; ManagementPath path = new ManagementPath(string.Format("\\\\{0}\\root\\cimv2:Win32_Process", remoteHost)); ManagementScope scope = new ManagementScope(path, opts); scope.Connect(); ObjectGetOptions getOpts = new ObjectGetOptions(); using (ManagementClass mngClass = new ManagementClass(scope, path, getOpts)) { ManagementBaseObject inParams = mngClass.GetMethodParameters("Create"); inParams["CommandLine"] = commandLine; ManagementBaseObject outParams = mngClass.InvokeMethod("Create", inParams, null); }

    Read the article

  • How do I shift items in an array in C#?

    - by Andy Evans
    Let's say that I have an array of strings like this: 1, 2, 3, 4, 5, 6, 7, 8 and I want to shift the elements of the array such that The first element always remains fixed Only the remaining elements get shifted like so ... The last element in the array becomes the 2nd element and is shifted through the array with each pass. Pass #1: 1, 2, 3, 4, 5, 6, 7, 8 Pass #2: 1, 8, 2, 3, 4, 5, 6, 7 Pass #3: 1, 7, 8, 2, 3, 4, 5, 6 Pass #4: 1, 6, 7, 8, 2, 3, 4, 5 Any assistance would be greatly appreciated.

    Read the article

  • Jquery Slide to position on click

    - by Andy
    Here's a scenario... I have a column. In the column i have multiple divs with text inside each one. A bit like a list of categories. Which ever one is SELECTED gains a different background colour. What i would like to be able to do is use jquery so that when a different div is clicked on the background colour appears to slide behind the rest of the items until it reaches the one you selected. Does anyone have any idea if this can be done? And if so any idea on Markup? Any help is greatly appreciated.

    Read the article

  • Launching desired version of XCode from Finder

    - by Andy J Buchanan
    My google-fu has failed me, and I guess this may be basic OS X/Xcode knowledge but.... When I double click .xcodeproj files, I'm getting the Beta I have installed launching instead of the stable release - which is the one I actually want. I have tried changing the launch program in the finder info window, but it always displays as "Xcode" and doesn't seem to accept that there are different versions - even though it offers them to me in the drop down list. Is there an xcode setting for this? Thanks.

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >