Search Results

Search found 1695 results on 68 pages for 'andrew shepherd'.

Page 4/68 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Probability algorithm: Finding probable correct item in a list (e.g John, John, Jon)

    - by Andrew White
    Hi, Take for example the list (L): John, John, John, John, Jon We are to presume one item is to be correct (e.g. John in this case), and give a probability it is correct. First (and good!) attempt: MostFrequentItem(L).Count / L.Count (e.g. 4/5 or 80% likelihood) But consider the cases: John, John, Jon, Jonny John, John, Jon, Jon I want to consider the likelihood of the correct item being John to be higher in the first list! I know I have to count the SecondMostFrequent Item and compare them. Any ideas? This is really busting my brain! Thx, Andrew

    Read the article

  • System.Uri can't parse when password field contains a "#"

    - by Andrew
    The following code throws System.UriFormatException: var uri = new UriBuilder("ftp://user:pass#[email protected]:21/fu/bar.zip"); System.UriFormatException: Invalid URI: A port was expected because of there is a colon (':') present but the port could not be parsed. Removing the # symbol from the password field solves the issue. Is a # symbol a valid character to have in the password field? Is there a way to escape this? Is this a known bug in the parsing routine of the Uri class? How does one get around this - assuming you can't change the password? ;-) Thanks, Andrew

    Read the article

  • How to avoid OLEDB converting "."s into "#"s in column names?

    - by Andrew Miner
    I'm using the ACE OLEDB driver to read from an Excel 2007 spreadsheet, and I'm finding that any '.' character in column names get converted to a '#' character. For example, if I have the following in a spreadsheet: Name Amt. Due Due Date Andrew 12.50 4/1/2010 Brian 20.00 4/12/2010 Charlie 1000.00 6/30/2010 the name of the second column would be reported as "Amt# Due" when read with the following code: OleDbConnection connection = new OleDbConnection( "Provider=Microsoft.ACE.OLEDB.12.0; Data Source={0}; " + "Extended Properties=\"Excel 12.0 Xml;HDR=YES;FMT=Delimited;IMEX=1\""); OldDbCommand command = new OleDbCommand("SELECT * FROM MyTable", connection); OleDbReader dataReader = command.ExecuteReader(); System.Console.WriteLine(dataReader.GetName(1)); I've read through all the documentation I can find and I haven't found anything which even mentions that this will happen. Has anyone run into this before? Is there a way to fix this behavior?

    Read the article

  • Extracting a specific value from command-line output using powershell

    - by Andrew Shepherd
    I've just started learning PowerShell this morning, and I'm grappling with the basics. Here's the problem: I want to query subversion for the revision number of a repository, and then create a new directory with this revision number. The command svn_info outputs a number of label\value pairs, delimited by colons. For example Path: c# URL: file:///%5Copdy-doo/Archive%20(H)/Development/CodeRepositories/datmedia/Development/c%23 Repository UUID: b1d03fca-1949-a747-a1a0-046c2429f46a Revision: 58 Last Changed Rev: 58 Last Changed Date: 2011-01-12 11:36:12 +1000 (Wed, 12 Jan 2011) Here is my current code which solves the problem. Is there a way to do this with less code? I'm thinking that with the use of piping you could do this with one or two lines. I certainly shouldn't have to use a temporary file. $RepositoryRoot = "file:///%5Cdat-ftp/Archive%20(H)/Development/CodeRepositories/datmedia" $BuildBase="/Development/c%23" $RepositoryPath=$RepositoryRoot + $BuildBase # Outputing the info into a file svn info $RepositoryPath | Out-File -FilePath svn_info.txt $regex = [regex] '^Revision: (\d{1,4})' foreach($info_line in get-content "svn_info.txt") { $match = $regex.Match($info_line); if($match.Success) { $revisionNumber = $match.Groups[1]; break; } } "Revision number = " + $revisionNumber;

    Read the article

  • Android TelephonyManager.getNetworkType() returned constant values in bearer speed order?

    - by Rob Shepherd
    TelephonyManager.getNetworkType() returns one of the constant values. It appears that the constant values have an integer order, by possible bearer link speed. I know using constant values used in the following manner is generally bad, however could one use this to determine a basic cutoff for application functionality and have it work between API levels? (in API-v1 there was nothing above 0x03) if( telephonyManager.getNetworkType() > TelephonyManager.NETWORK_TYPE_EDGE ) { return "3G! party on!"; } else if( telephonyManager.getNetworkType() > TelephonyManager.NETWORK_TYPE_UNKNOWN ) { return "2G, OK. just don't go nuts!"; } else { return "No data sorry" }

    Read the article

  • Invoking ADO.NET from MATLAB

    - by Andrew Shepherd
    It's possible to call .NET from MATLAB, so I thought I would try to use ADO.NET to connect to a database. I seem to have hit a blocking problem - anytime you try and create a Command object, it throws an error. You can try this yourself: >> NET.addAssembly('System.Data'); >> sqlconn = System.Data.SqlClient.SqlConnection(); >> sqlconn.State ans = Closed >> % So far, so good >> sqlcmd = System.Data.SqlClient.SqlCommand(); ??? Error using ==> System.Data.SqlClient.SqlCommand 'Connection' is already defined as a property. >> Does anyone have some insight into this? It seems like a pure and simple bug on MATLAB's part - maybe it happens with every .NET class that happens to have a property called "Connection". Should I just throw in the towel and give up on using MATLAB to talk to a database using .NET?

    Read the article

  • Focus In An ItemsControl

    - by Andrew
    I have an ItemsControl that uses a DataTemplate. The DataTemplate contains a TextBox, which can receive keyboard focus. I need to be able to move the keyboard focus from the currently focused TextBox in the DataTemplate to the next TextBox, as if the Tab key has been pressed. I've noticed that there is a UIElement.MoveFocus() method, but this begs the question as to which UIElement should be used to call the method. This is probably the reason why I haven't gotten this method to work for me... Any help would be really appreciated! Thanks, Andrew

    Read the article

  • Finding specific pixel colors of a BitmapImage

    - by Andrew Shepherd
    I have a WPF BitmapImage which I loaded from a .JPG file, as follows: this.m_image1.Source = new BitmapImage(new Uri(path)); I want to query as to what the colour is at specific points. For example, what is the RGB value at pixel (65,32)? How do I go about this? I was taking this approach: ImageSource ims = m_image1.Source; BitmapImage bitmapImage = (BitmapImage)ims; int height = bitmapImage.PixelHeight; int width = bitmapImage.PixelWidth; int nStride = (bitmapImage.PixelWidth * bitmapImage.Format.BitsPerPixel + 7) / 8; byte[] pixelByteArray = new byte[bitmapImage.PixelHeight * nStride]; bitmapImage.CopyPixels(pixelByteArray, nStride, 0); Though I will confess there's a bit of monkey-see, monkey do going on with this code. Anyway, is there a straightforward way to process this array of bytes to convert to RGB values?

    Read the article

  • IE9 syntax on jquery crossbrowser with jsonp and FF, Chrome

    - by Andrew Walker
    I have the following code and i have a problem in ensuring part of it is used when a IE browser is used, and remove it when any other browser is used: $.ajax({ url: 'http://mapit.mysociety.org/areas/'+ulo, type: 'GET', cache: false, crossDomain: true, dataType: 'jsonp', success: function(response) { This works fine in IE9 because I have put the dataType as jsonp. But this will not work on Chrome or FF. So I need to remove the dataType. I tried this: <!--[IF IE]> dataType: 'jsonp', <![endif]--> But it did not work. It's worth noting, it does not need the dataType set when in FF or Chrome as it's json. Whats the correct syntax to have this work ? Thanks Andrew

    Read the article

  • Reusable socket

    - by Andrew
    I tryed to create a socket in php and reuse it from other process. I know this can be done with a daemon script but I want to do this without. I created a socket and binded it to a specific port. $sock = socket_create (AF_INET, SOCK_STREAM, SOL_TCP); socket_set_option ($sock, SOL_SOCKET, SO_REUSEADDR, 1); socket_bind ($sock, 'xx.xx.xx.xx', 10000); socket_connect ($sock, $host, $port); And from another php file I did the same thing. But the packets that I send from the 2 file are not "validated" by host. I sniffed all ports and I see that it uses same local and destination port. I don't understand where is the problem. Can you help me with this? It's ok in any other programming language, or any other solution for this. Andrew

    Read the article

  • FancyURLOpener failing since moving to python 3.1.2

    - by Andrew Shepherd
    I had an application that was downloading a .CSV file from a password-protected website then processing it futher. I was using FancyURLOpener, and simply hardcoding the username and password. (Obviously, security is not a high priority in this particular instance). Since downloading Python 3.1.2, this code has stopped working. Does anyone know of the changes that have happened to the implementation? Here is a cut down version of the code: import urllib.request; class TracOpener (urllib.request.FancyURLopener) : def prompt_user_passwd(self, host, realm) : return ('andrew_ee', '_my_unenctryped_password') csvUrl='http://mysite/report/19?format=csv@USER=fred_nukre' opener = TracOpener(); f = opener.open(csvUrl); s = f.read(); f.close(); s; For the sake of completeness, here's the entire call stack: Traceback (most recent call last): File "C:\reporting\download_csv_file.py", line 12, in <module> f = opener.open(csvUrl); File "C:\Program Files\Python31\lib\urllib\request.py", line 1454, in open return getattr(self, name)(url) File "C:\Program Files\Python31\lib\urllib\request.py", line 1628, in open_http return self._open_generic_http(http.client.HTTPConnection, url, data) File "C:\Program Files\Python31\lib\urllib\request.py", line 1624, in _open_generic_http response.status, response.reason, response.msg, data) File "C:\Program Files\Python31\lib\urllib\request.py", line 1640, in http_error result = method(url, fp, errcode, errmsg, headers) File "C:\Program Files\Python31\lib\urllib\request.py", line 1878, in http_error_401 return getattr(self,name)(url, realm) File "C:\Program Files\Python31\lib\urllib\request.py", line 1950, in retry_http_basic_auth return self.open(newurl) File "C:\Program Files\Python31\lib\urllib\request.py", line 1454, in open return getattr(self, name)(url) File "C:\Program Files\Python31\lib\urllib\request.py", line 1628, in open_http return self._open_generic_http(http.client.HTTPConnection, url, data) File "C:\Program Files\Python31\lib\urllib\request.py", line 1590, in _open_generic_http auth = base64.b64encode(user_passwd).strip() File "C:\Program Files\Python31\lib\base64.py", line 56, in b64encode raise TypeError("expected bytes, not %s" % s.__class__.__name__) TypeError: expected bytes, not str

    Read the article

  • Draw a column graph with no space between columns

    - by Andrew Shepherd
    I am using the WPF toolkit, and am trying to render a graph that looks like a histogram. In particular, I want each column to be right up against each other column. There should be no gaps between columns. There are a number of components that you apply when creating a column graph. (See example XAML below). Does anybody know if there is a property you can set on one of the elements which refers to the width of the white space between columns? <charting:Chart Height="600" Width="Auto" HorizontalAlignment="Stretch" Name="MyChart" Title="Column Graph" LegendTitle="Legend"> <charting:ColumnSeries Name="theColumnSeries" Title="Series A" IndependentValueBinding="{Binding Path=Name}" DependentValueBinding="{Binding Path=Population}" Margin="0" > </charting:ColumnSeries> <charting:Chart.Axes> <charting:LinearAxis Orientation="Y" Minimum="200000" Maximum="2500000" ShowGridLines="True" /> <charting:CategoryAxis Name="chartCategoryAxis" /> </charting:Chart.Axes> </charting:Chart>

    Read the article

  • Get Contact Profile Information from Office Communicator (OCS) SDK in C#?

    - by Andrew
    Hi, My company uses MS Office Communicator Server (OCS) 2007 R2, and I am accessing with C# with the SDK. If I right click on a contact in OCS, I get the option to 'View Contact Card'. I want access to this via the API! Unfortunately I can find nothing in the SDK documentation to get at this. There is a method called 'ViewProfile' which is unsupported, and I can find nothing out there about it. I could of course go directly to the Active Directory account of the contact, but that would require my machine to connect to the organization via VPN. Since most of us work 'offline' I would prefer not to do this. (The data I need is anyway in OCS!) Thanks in advance, Andrew

    Read the article

  • Pop-up Window was moved but its image still left behind.

    - by andrew
    Hi, I'm using VS 2005 and .NET framework 2.0 SP2 to build an application with a datagridview in it. I'm using Microsoft Word 11.0 Object Library to do the spelling checker on one of the field in datagridview. When it detected a spelling and grammar window would pop-up open on top of the datagridview. The problem I got was when I moved the pop-up window to the new location, there's still an image of the pop-up window left behind the previous location. The more I moved the more of those copied image would be created on screen. How I can overcome this problem? Thanks in advance, Andrew

    Read the article

  • Java dropping half of UDP packets

    - by Andrew Klofas
    Greetings, I have a simple client/server setup. The server is in C and the client that is querying the server is Java. My problem is that, when I send bandwidth-intensive data over the connection, such as Video frames, it drops up to half the packets. I make sure that I properly fragment the udp packets on the server side (udp has a max payload length of 2^16). I verified that the server is sending the packets (printf the result of sendto()). But java doesn't seem to be getting half the data. Furthermore, when I switch to TCP, all the video frames get through but the latency starts to build up, adding several seconds delay after a few seconds of runtime. Is there anything obvious that I'm missing? I just can't seem to figure this out. Thanks, Andrew

    Read the article

  • NHibernate's automatic (dirty checking) update behaviour - turning it off

    - by Andrew Bullock
    I've just discovered that if I get an object from an NHibernate session and change a property on object, NHibernate will automatically update the object on commit without me calling Session.Update(myObj)! I can see how this could be helpful, but as default behaviour it seems crazy! How can I stop this happening? Is this default NHib behaviour or something coming from Fluent NHibs AutoPersistenceModel? If there's no way to stop this, what do I do? Unless I'm missing the point this behaviour seems to create a right mess, violating my UoW. Im using NHibernate 2.0.1.4 and a Fluent NHib build from 18/3/2009 Edit, is this guy right with his answer? Edit: I've also read that overriding an Event Listener could be a solution to this. However, IDirtyCheckEventListener.OnDirtyCheck isn't called in this situation. Does anyone know which listener I need to override? Thanks Andrew

    Read the article

  • wheel of fortune collision detection

    - by Andrew
    Hey, I have a wheel segmented into 8 pie pieces, and a picker that is pointing at the currently selected segment (think wheel of fortune). I want to highlight the currently selected segment, and so have started to use Chipmunk to construct the 8 segments, attached to a rotating body, and then the picker that is put in a position to collide with each of the segments. The trick is, how do you allow the picker to pass over top of the segments, while still getting the collision, but not actually colliding and slowing down the wheel? I haven't started down this path yet, but thought this may solve the problem: removing the colliding segment and then putting it back after the picker has started colliding with another segment a bit away (like two segments away). There may be a much simpler solution not even involving Chipmunk that I haven't thought of. Thanks, Andrew

    Read the article

  • Excel Automation From .NET - creating a new worksheet

    - by Andrew Shepherd
    I am attempting what seems like a simple task: using C# to create a new Excel document containing new worksheets. For some reason, I am getting a strange COM error (0x800A03EC) Has anyone managed to get this to work? Does anyone have suggestions as to how to troubleshoot this? I've isolated this into the minimum amount of code: using Microsoft.Office.Interop.Excel; using System.Diagnostics; namespace ExcelAutomation { public static class ExcelTests { public static void CreateWorksheet() { try { var app = new Microsoft.Office.Interop.Excel.Application(); app.Visible = true; var workBooks = app.Workbooks; var newWorkbook = app.Workbooks.Add(XlWBATemplate.xlWBATWorksheet); Worksheet existingWorksheet = (Worksheet)newWorkbook.Sheets[1]; Worksheet workSheet = (Worksheet)newWorkbook.Sheets.Add ( null, // before existingWorksheet, null, // 1, null //XlSheetType.xlWorksheet ); } catch (System.Runtime.InteropServices.COMException ex) { Trace.WriteLine(string.Format("Caught COMException. Message: \"{0}\"", ex.Message)); } } } } The output window now says: Caught COMException. Message: "Exception from HRESULT: 0x800A03EC"

    Read the article

  • Tips on debugging copy and paste into powerpoint 2010

    - by Andrew S.
    I have a custom application in C++ that has been used to successfully copy-and-paste an object from the application into MS Office 2003 and 2007 (Word, Excel and PowerPoint). The object opens in our own custom activeX control. Now with windows XP and PowerPoint 2010, nothing happens on the cut-and-paste. I have tried turning off the smart copy/paste to no avail. Copy/paste works with Word and Excel 2010. Do you have tips on how to debug this? Thanks Andrew

    Read the article

  • WPF Standard Commands - Where's Exit?

    - by Andrew Shepherd
    I'm creating a standard menu in my WPF application. I know that I can create custom commands, but I know there are also a bunch of standard commands to bind to. For example, to open a file I should bind to ApplicationCommands.Open, to close a file I should bind to ApplicationCommands.Close. There's also a large number of EditCommands, ComponentCommands or NavigationCommands. There doesn't seem to be an "Exit" command. I would have expected there to be ApplicationCommands.Exit. What should I bind to the "Exit" menu item? To create a custom command for something this generic just seems wrong.

    Read the article

  • filtering for multiple values on one column. All values must exist, else - return zero

    - by Andrew
    Hello All, I would like to filter one column in a table for couple values and show results only if all those values are there. If one or more is missing, then return zero results. example table +----+--------+----------+ | id | Fruit | Color | +----+--------+----------+ | 1 | apple | red | | 2 | mango | yellow | | 3 | banana | yellow | +----+--------+----------+ example "wrong" code: (this must return 3 rows) select Fruit FROM table WHERE Color = red AND Color = yellow but select Fruit FROM table WHERE Color = red AND Color = green must return 0 rows. (If i use select Fruit FROM table WHERE Color = red OR Color = green i get 1 row which is not what i need) I am using PHP with form where user checks different checkboxes that represent different values of the same column. So when he selects multiple checkboxes, all those values should be in the result set, otherwise no result should be given. Thank you, Andrew

    Read the article

  • Excel Automation - creating a new worksheet

    - by Andrew Shepherd
    I am attempting what seems like a simple task: using C# to create a new Excel document containing new worksheets. For some reason, I am getting a strange COM error (0x800A03EC) Has anyone managed to get this to work? Does anyone have suggestions as to how to troubleshoot this? I've isolated this into the minimum amount of code: using Microsoft.Office.Interop.Excel; using System.Diagnostics; namespace ExcelAutomation { public static class ExcelTests { public static void CreateWorksheet() { try { var app = new Microsoft.Office.Interop.Excel.Application(); app.Visible = true; var workBooks = app.Workbooks; var newWorkbook = app.Workbooks.Add(XlWBATemplate.xlWBATWorksheet); Worksheet existingWorksheet = (Worksheet)newWorkbook.Sheets[1]; Worksheet workSheet = (Worksheet)newWorkbook.Sheets.Add ( null, // before existingWorksheet, null, // 1, null //XlSheetType.xlWorksheet ); } catch (System.Runtime.InteropServices.COMException ex) { Trace.WriteLine(string.Format("Caught COMException. Message: \"{0}\"", ex.Message)); } } } } The output window now says: Caught COMException. Message: "Exception from HRESULT: 0x800A03EC"

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >