Search Results

Search found 3380 results on 136 pages for 'tim b james'.

Page 96/136 | < Previous Page | 92 93 94 95 96 97 98 99 100 101 102 103  | Next Page >

  • How do I put all types implementing a certain generic interface in a dictionary?

    - by James Wenday
    Given a particular interface ITarget<T> and a particular type myType, here's how you would determine T if myType implements ITarget<T>. (This code snippet is taken from the answer to an earlier question.) foreach (var i in myType.GetInterfaces ()) if (i.IsGenericType && i.GetGenericTypeDefinition() == typeof(ITarget<>)) return i.GetGenericArguments ()[0] ; However, this only checks a single type, myType. How would I create a dictionary of all such type parameters, where the key is T and the value is myType? I think it would look something like this: var searchTarget = typeof(ITarget<>); var dict = Assembly.GetExecutingAssembly().[???] .Where(t => t.IsGenericType && t.GetGenericTypeDefinition() == searchTarget) .[???]; What goes in the blanks?

    Read the article

  • Have you dealt with space hardening?

    - by Tim Post
    I am very eager to study best practices when it comes to space hardening. For instance, I've read (though I can't find the article any longer) that some core parts of the Mars rovers did not use dynamic memory allocation, in fact it was forbidden. I've also read that old fashioned core memory may be preferable in space. I was looking at some of the projects associated with the Google Lunar Challenge and wondering what it would feel like to get code on the moon, or even just into space. I know that space hardened boards offer some sanity in such a harsh environment, however I'm wondering (as a C programmer) how I would need to adjust my thinking and code if I was writing something that would run in space? I think the next few years might show more growth in private space companies, I'd really like to at least be somewhat knowledgeable regarding best practices. Can anyone recommend some books, offer links to papers on the topic or (gasp) even a simulator that shows you what happens to a program if radiation, cold or heat bombards a board that sustained damage to its insulation? I think the goal is keeping humans inside of a space craft (as far as fixing or swapping stuff) and avoiding missions to fix things. Furthermore, if the board maintains some critical system, early warnings seem paramount.

    Read the article

  • Extracting a given number of the highest values in a List

    - by James P.
    I'm seeking to display a fixed number of items on a web page according to their respective weight (represented by an Integer). The List where these items are found can be of virtually any size. The first solution that comes to mind is to do a Collections.sort() and to get the items one by one by going through the List. Is there a more elegant solution though that could be used to prepare, say, the top eight items?

    Read the article

  • Installing Mercurial on Windows Apache XAMPP Tutorial

    - by Tim Dellas
    After asking this question (http://stackoverflow.com/questions/2675764/xampp-mercurial-installation-on-windows-apache-hgwebdir-cgi-script-error) and reading though the whole internet including this question (http://stackoverflow.com/questions/644322/how-do-i-get-mercurials-hgwebdir-working-on-windows) and all its links for about 10 hours, I seem to not be able to find a solution. I begun with this tutorial http://mercurial.selenic.com/wiki/HgWebDirStepByStep ... and I really don't want to install ancient versions of Mercurial. I got my windows-apache to run Python scripts, CGI-Scripts, publish them in the wild, but hgwebdir just won't work. Question 1: Can someone please enrich his personal blog with a tutorial on how to install MERCURIAL on a WINDOWS XAMPP installation and make it visible to the world? I guarantee a lot of pageviews, as this is not a trivial problem. And this would sincerely help a lot of other people I guess. Question 2: For example, even after browsing half a day through everywhere, I just cannot find out, which version of python I need to pair with the freshest version of mercurial, and I get the "magic number is wrong"-error. This would be my question, if noone has time to make up a nice blogpost. Sorry for being a bit frustrated.

    Read the article

  • using C# how to convert iso8859-1 encoded text files that contain Latin-1 accented characters to utf

    - by Tim
    I am being sent text files saved in iso88591-1 format that contain accented characters from the Latin-1 range (as well as normal ASCII a-z etc). How to convert these files to utf-8 using C# so that the single-byte accented characters in iso8859-1 become valid utf-8 characters? I have tried to use a StreamReader with ASCIIEncoding, and then converting the ascii string to UTF-8 by instantiating an ascii encoding and a utf8 encoding and then using Encoding.Convert(ascii, utf8, ascii.GetBytes( asciiString) ) — but the accented characters are being rendered as question marks. What step am I missing? Thanks

    Read the article

  • URL equals and checking Internet access

    - by James P.
    On http://java.sun.com/j2se/1.5.0/docs/api/java/net/URL.html it states that: Compares this URL for equality with another object. If the given object is not a URL then this method immediately returns false. Two URL objects are equal if they have the same protocol, reference equivalent hosts, have the same port number on the host, and the same file and fragment of the file. Two hosts are considered equivalent if both host names can be resolved into the same IP addresses; else if either host name can't be resolved, the host names must be equal without regard to case; or both host names equal to null. Since hosts comparison requires name resolution, this operation is a blocking operation. Note: The defined behavior for equals is known to be inconsistent with virtual hosting in HTTP. According to this, equals will only work if name resolution is possible. Since I can't be sure that a computer has internet access at a given time, should I just use Strings to store addresses instead? Also, how do I go about testing if access is available when requested?

    Read the article

  • Find and replace numbers in string with regex

    - by James
    What I'm trying to achieve is to replace the numbers in the string with a new values calculated from the (match * int). So the string input looks like: 500g Flour 14g Salt 7g Dry yeast 45ml Olive oil 309ml Water And the result should look like this: 1000g Flour 14g Salt 14g Dry yeast 90ml Olive oil 618 ml Water row["ingredients"] is a DataRow. This is where I'm at: System.Text.RegularExpressions. Regex.Replace(row["ingredients"].ToString(), @"[^/d]", Delegate(Match match) { return match * 2; }, RegexOptions.Multiline); Any solution is greatly appreciated.

    Read the article

  • Callback for When jqGrid Finishes Reloading?

    - by James
    Hi, I am using the jqGrid plug-in and at one point I need to refresh the grid and set the selected row to match the record that I am showing in detail on another section of the page. I have the following code but it does not work: $("#AllActions").trigger("reloadGrid").setSelection(selectedRow); The selectedRow parameter comes from an event handler that gets called when the data is changed and the grid needs to be updated. I'm pretty sure that the problem is that the grid is not loaded when the selection is being set, because if I put a call to alert() between the calls to trigger() and setSelection(), it works. I would be grateful for any advice. [Edit]Looks like http://stackoverflow.com/questions/2529581/jqgrids-setselect-does-not-work-after-reloadgrid is related but did not get resolved.[/Edit]

    Read the article

  • Anyone run recurring payments in their website? Preferably; Paypal API

    - by James
    I'm wrapping up my startup and will need to implement Paypal API into my sign up page. Does anyone use recurring payments via Paypal API integrated into their billing? Better yet, guide me to a trustable developer with experience or will I have to use Elance? I need it to go to a welcome/get started screen in their logged in account once they hit the 'create account' button after filling out billing info. I was also wondering, can you leave the CSC (3 digit security code) field out with integration, because it makes things very hard for recurring payments. I'd like to stick with Paypal, as I have been very satisfied with them for a few years now; I already checked out Chargify, authorize.net, etc. I'd love to see someone with something like this set up already to take a look at and ask a few questions.

    Read the article

  • Adapting methods which return true/false

    - by James P.
    What's the best practise when adapting C-style functions which return a true/false to Java? Here's a simple method to illustrate where the problem lies. public static boolean fileNameEndsWithExtension( String filename, String fileExtension) { return filename.endsWith( fileExtension ); } Note that there's probably a more elegant way of filtering files (feel free to comment on this). Anyway, if filename is a null value, does one: Return a false if filename is null? If so, how does one go about distinguishing between the case where filename is null and the case where the String or file name doesn't end with a given file extension? Change the return type to the wrapper class Boolean which allows a null value. Throw an Exception and force the programmer to make sure that a null value is never passed to the method? Use another solution?

    Read the article

  • image format in html and latex

    - by Tim
    Hi, I want to choose an image formate for including images in both html and latex. I found that jpeg and png formates are not always working well in latex. Is eps format the best for latex. It seems eps is not supported in html? What other format is good too? Thanks and regards!

    Read the article

  • How to tell the MinGW linker not to export all symbols?

    - by James R.
    Hello, I'm building a Windows dynamic library using the MinGW toolchain. To build this library I'm statically linking to other 2 which offer an API and I have a .def file where I wrote the only symbol I want to be exported in my library. The problem is that GCC is exporting all of the symbols including the ones from the libraries I'm linking to. Is there anyway to tell the linker just to export the symbols in the def file? I know there is the option --export-all-symbols but there seems not to be the opposite to it. Right now the last line of the build script has this structure: g++ -shared CXXFLAGS DEFINES INCLUDES -o library.dll library.cpp DEF_FILE \ OBJECT_FILES LIBS -Wl,--enable-stdcall-fixup EDIT: In the docs about the linker it says that --export-all-symbols is the default behavior and that it's disabled when you don't use that option explicitly if you provide a def file, except when it doesn't; the symbols in 3rd party libs are being exported anyway. EDIT: Adding the option --exclude-libs LIBS doesn't keep their symbols from being exported either.

    Read the article

  • Monitoring .NET ASP.NET Applications

    - by James Hollingworth
    I have a number of applications running on top of ASP.NET I want to monitor. The main things I care about are: Exceptions: We currently some custom code which will email us when an exception occurs. If the application is failing hard it will crash our outlook... I know (and use) elmah which partly solves the problem however it is still just a big table of exceptions with a pretty(ish) UI. I want something that makes sense of all of these exceptions (e.g. groups exceptions, alerts when new ones occur, tells me what the common ones are that I should fix, etc) Logging: We currently log to files which are then accessible via a shared folder which dev's grep & tail. Does anyone know of better ways of presenting this information. In an ideal world I want to associate it with exceptions. Performance: Request times, memory usage, cpu, etc. whatever stats I can get I'm guessing this is probably going to be solved by a number of tools, has anyone got any suggestions?

    Read the article

  • Validating parameters according to a fixed reference

    - by James P.
    The following method is for setting the transfer type of an FTP connection. Basically, I'd like to validate the character input (see comments). Is this going overboard? Is there a more elegant approach? How do you approach parameter validation in general? Any comments are welcome. public void setTransferType(Character typeCharacter, Character optionalSecondCharacter) throws NumberFormatException, IOException { // http://www.nsftools.com/tips/RawFTP.htm#TYPE // Syntax: TYPE type-character [second-type-character] // // Sets the type of file to be transferred. type-character can be any // of: // // * A - ASCII text // * E - EBCDIC text // * I - image (binary data) // * L - local format // // For A and E, the second-type-character specifies how the text should // be interpreted. It can be: // // * N - Non-print (not destined for printing). This is the default if // second-type-character is omitted. // * T - Telnet format control (<CR>, <FF>, etc.) // * C - ASA Carriage Control // // For L, the second-type-character specifies the number of bits per // byte on the local system, and may not be omitted. final Set<Character> acceptedTypeCharacters = new HashSet<Character>(Arrays.asList( new Character[] {'A','E','I','L'} )); final Set<Character> acceptedOptionalSecondCharacters = new HashSet<Character>(Arrays.asList( new Character[] {'N','T','C'} )); if( acceptedTypeCharacters.contains(typeCharacter) ) { if( new Character('A').equals( typeCharacter ) || new Character('E').equals( typeCharacter ) ){ if( acceptedOptionalSecondCharacters.contains(optionalSecondCharacter) ) { executeCommand("TYPE " + typeCharacter + " " + optionalSecondCharacter ); } } else { executeCommand("TYPE " + typeCharacter ); } } }

    Read the article

  • Must parameter of assignment operator be reference?

    - by Tim
    When overloading assignment operator of a class in C++, must its parameter be reference? For example, class MyClass { public: ... MyClass & operator=(const MyClass &rhs); ... } Can it be class MyClass { public: ... MyClass & operator=(const MyClass rhs); ... } ? Thanks!

    Read the article

  • Force VS to use System.[Type] in Code Completion

    - by James
    Is it possible to have Visual Studio code completion use the System.[Type] instead of the keyword. Example: Autocomplete of List<String> myList = completes as: List<String> myList = new List<string>(); whereas, I want: List<String> myList = new List<String>(): This isn't the only example, but hopefully shows what I'm looking for.

    Read the article

  • Dynamically Rendering in a Scrollable Area

    - by James
    What is the generic algorithm or process that is commonly used to dynamically render portions of a scrolling area? For example, in Google Maps, when the user scrolls past the bounds of the currently rendered area, a grey checkerboard pattern is displayed within the not-yet-rendered portions while the application loads and renders those areas. I'm looking specifically for the approach, or the mathematics, related to filling a graphics area in chunks based on what has just come into view. If possible, I'm looking for anything relevant to the GDI+ process of doing so.

    Read the article

  • regex not working "within" javascript string

    - by Tim
    I'm trying to replace all mentions of [b] in a text string and replace it with <b>. The problem with what I'm using below this that it's replace every [b] on the page, and I only want it to change the [b]'s within the text string ("text") that I'm sending in. Taking out the 'g' for global in the regex doesn't work very well because it then doesn't replace them all... text = text.replace(new RegExp('(^|\\s|>)\\[b](\\S.*?\\S)\\[/b]($|\\s|<)', 'gim') , '$1<strong>$2</strong>$3'); any ideas? Thanks

    Read the article

  • How do I Convert ARGB value from string to color?

    - by James
    I am trying to use the MakeColor method in the GDIAPI unit but the conversion from int to byte is not returning me the correct value. Example var argbStr: string; A, R, G, B: Byte; begin argbStr := 'ffffcc88'; A := StrToInt('$' + Copy(AValue, 0, 2)); R := StrToInt('$' + Copy(AValue, 3, 2)); G := StrToInt('$' + Copy(AValue, 5, 2)); B := StrToInt('$' + Copy(AValue, 7, 2)); Result := MakeColor(A, R, G, B); end; What am I doing wrong?

    Read the article

< Previous Page | 92 93 94 95 96 97 98 99 100 101 102 103  | Next Page >