Search Results

Search found 2056 results on 83 pages for 'james wood'.

Page 56/83 | < Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • Why does TrimStart trims a char more when asked to trim "PRN.NUL" ?

    - by James
    Here is the code: namespace TrimTest { class Program { static void Main(string[] args) { string ToTrim = "PRN.NUL"; Console.WriteLine(ToTrim); string Trimmed = ToTrim.TrimStart("PRN.".ToCharArray()); Console.WriteLine(Trimmed); ToTrim = "PRN.AUX"; Console.WriteLine(ToTrim); Trimmed = ToTrim.TrimStart("PRN.".ToCharArray()); Console.WriteLine(Trimmed); ToTrim = "AUX.NUL"; Console.WriteLine(ToTrim); Trimmed = ToTrim.TrimStart("AUX.".ToCharArray()); Console.WriteLine(Trimmed); } } } The output is like this: PRN.NUL UL PRN.AUX AUX AUX.NUL NUL As you can see, the TrimStart took out the N from NUL. But it doesn't do that for other strings even if it started with PRN. I tried with .NET Framework 3.5 and 4.0 and the results are same. Are there any explanation on what causes this behavior?

    Read the article

  • AJAX calls randomly timing out in IE6/7?

    - by James Skidmore
    Some of my AJAX calls in IE6 and IE7 seem to randomly time out. It doesn't happen in any of the other browsers. Posting code won't be of much help, because it literally happens in three or four different places where the functions and code are completely different. Has anyone else experienced this issue before?

    Read the article

  • Incorrect string encodings

    - by James
    Note: I have read all of the related PHP, UTF-8, character encoding articles that are usually suggested, but my question relates to data inserted before I applied such techniques. I am wishing to retrospectively fix all character encoding problems. Now all connections are set as utf8 using PDO. PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8' Unfortunately, a large amount of data was inserted that is of questionable encoding before I had implemented correct character encoding practices. As displayed by: $sql = "SELECT name FROM data LIMIT 3"; foreach ($pdo->query($sql) as $row) { $name = $row['name']; echo $name . "\n"; echo utf8_encode($name) . "\n"; echo utf8_decode($name) . "\n"; echo htmlspecialchars($name, ENT_QUOTES, 'UTF-8') . "\n"; echo htmlspecialchars(utf8_encode($name), ENT_QUOTES, 'UTF-8') . "\n"; echo htmlspecialchars(utf8_decode($name), ENT_QUOTES, 'UTF-8') . "\n"; echo '<hr/>'; } Which produces: Antonín Dvořák AntonÃÆín DvoÃâ¦Ãâ¢ÃÆák Anton??­n Dvo??????¡k Antonín Dvořák AntonÃÆín DvoÃâ¦Ãâ¢ÃÆák ---------- Ô±Ö€Õ¡Õ´ Ô½Õ¡Õ¹Õ¡Õ¿Ö€ÕµÕ¡Õ¶ ñÃâ¬Ã¡Ã´ ýáùáÿÃâ¬ÃµÃ¡Ã¶ ????? ?????????? Ô±Ö€Õ¡Õ´ Ô½Õ¡Õ¹Õ¡Õ¿Ö€ÕµÕ¡Õ¶ ñÃâ¬Ã¡Ã´ ýáùáÿÃâ¬ÃµÃ¡Ã¶ ---------- Tiësto Tiësto Tiësto Tiësto Tiësto Tiësto ---------- When removing 'SET NAMES utf8' with PDO it produces the data: Antonín DvoÅák Antonín DvoÃÂák Antonín Dvorák Antonín DvoÅák Antonín DvoÃÂák Antonín Dvorák ---------- ???? ????????? Ô±ÖÕ¡Õ´ Ô½Õ¡Õ¹Õ¡Õ¿ÖÕµÕ¡Õ¶ ???? ????????? ???? ????????? Ô±ÖÕ¡Õ´ Ô½Õ¡Õ¹Õ¡Õ¿ÖÕµÕ¡Õ¶ ???? ????????? ---------- Tiësto Tiësto Ti?sto Tiësto Tiësto ---------- And here is a dump of the database rows concerned: DROP TABLE IF EXISTS `data`; CREATE TABLE IF NOT EXISTS `data` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(80) NOT NULL, PRIMARY KEY (`id`), KEY `name` (`name`(10)), ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=0; INSERT INTO `data` (`id`, `name`) VALUES (0, 'Antonín Dvořák'), (1, 'Ô±Ö€Õ¡Õ´ Ô½Õ¡Õ¹Õ¡Õ¿Ö€ÕµÕ¡Õ¶'), (2, 'Tiësto'); The 3rd and 6th lines of the 3rd row "Tiësto" are then correctly echoed. I'm just unsure what is the best way to correct encodings/detect the encodings of bad strings and correct, etc.

    Read the article

  • Resolving "require"s when executing IronRuby from C#

    - by James Sulak
    I'm attempting to run an IronRuby script from C#: var runtime = IronRuby.Ruby.CreateRuntime(); runtime.ExecuteFile("ruby/foo.rb"); foo.rb starts with a "require:" #!/usr/bin/env ruby require 'bar' When I try this, I get an exception stating "no such file to load -- bar." The file "bar.rb" and the directory "bar" are both present in the "ruby" directory. So, how do I execute a ruby script that requires other ruby files? I'm targeting .Net 3.5.

    Read the article

  • Implementing default constructors

    - by James
    Implement the default constructor, the constructors with one and two int parameters. The one-parameter constructor should initialize the first member of the pair, the second member of the pair is to be 0. Overload binary operator + to add the pairs as follows: (a, b) + (c, d) = (a + c, b + d); Overload the - analogously. Overload the * on pairs ant int as follows: (a, b) * c = (a * c, b * c). Write a program to test all the member functions and overloaded operators in your class definition. You will also need to write accessor (get) functions for each member. The definition of the class Pairs: class Pairs { public: Pairs(); Pairs(int first, int second); Pairs(int first); // other members and friends friend istream& operator>> (istream&, Pair&); friend ostream& operator<< (ostream&, const Pair&); private: int f; int s; }; Self-Test Exercise #17: istream& operator (istream& ins, Pair& second) { char ch; ins ch; // discard init '(' ins second.f; ins ch; // discard comma ',' ins second.s; ins ch; // discard final '(' return ins; } ostream& operator<< (ostream& outs, const Pair& second) { outs << '('; outs << second.f; outs << ", " ;// I followed the Author's suggestion here. outs << second.s; outs << ")"; return outs; }

    Read the article

  • How do you check to see if a variable has changed every second or less in objective c?

    - by James
    I am using an if statement to check the value of a BOOLEAN when i click on a button. When the button is clicked if the value is false i want to display a UIActivityIndicator and if the value is true i want to push the new view. I can do this fine but i want the view to change automatically when the BOOLEAN Becomes true if the user has already clicked the button. So my question is how do you check to see if a value has changed everysecond or less?

    Read the article

  • Can I use encrypt web.config with a custom protection provider who's assembly is not in the GAC?

    - by James
    I have written a custom protected configuration provider for my web.config. When I try to encrypt my web.config with it I get the following error from aspnet_iisreg aspnet_regiis.exe -pef appSettings . -prov CustomProvider (This is running in my MSBuild) Could not load file or assembly 'MyCustomProviderNamespace' or one of its dependencies. The system cannot find the file specified. After checking with the Fusion log, I confirm it is checking both the GAC, and 'C:/WINNT/Microsoft.NET/Framework/v2.0.50727/' (the location of aspnet_iisreg). But it cannot find the provider. I do not want to move my component into the GAC, I want to leave the custom assembly in my ApplicationBase to copy around to various servers without having to pull/push from the GAC. Here is my provider configuration in the web.config. <configProtectedData> <providers> <add name="CustomProvider" type="MyCustomProviderNamespace.MyCustomProviderClass, MyCustomProviderNamespace" /> </providers> </configProtectedData> Has anyone got any ideas?

    Read the article

  • Structure map and generics (in XML config)

    - by James D
    Hi I'm using the latest StructureMap (2.5.4.264), and I need to define some instances in the xml configuration for StructureMap using generics. However I get the following 103 error: Unhandled Exception: StructureMap.Exceptions.StructureMapConfigurationException: StructureMap configuration failures: Error: 103 Source: Requested PluginType MyTest.ITest`1[[MyTest.Test,MyTest]] configured in Xml cannot be found Could not create a Type for 'MyTest.ITest`1[[MyTest.Test,MyTest]]' System.ApplicationException: Could not create a Type for 'MyTest.ITest`1[[MyTest.Test,MyTest]]' ---> System.TypeLoadException: Could not loa d type 'MyTest.ITest`1' from assembly 'StructureMap, Version=2.5.4.264, Culture=neutral, PublicKeyToken=e60ad81abae3c223'. at System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName) at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) at System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& s tackMark) at System.Type.GetType(String typeName, Boolean throwOnError) at StructureMap.Graph.TypePath.FindType() --- End of inner exception stack trace --- at StructureMap.Graph.TypePath.FindType() at StructureMap.Configuration.GraphBuilder.ConfigureFamily(TypePath pluginTypePath, Action`1 action) A simply replication of the code is as follows: public interface ITest<T> { } public class Test { } public class Concrete : ITest<Test> { } Which I then wish to define in the XML configuration something as follows: <DefaultInstance PluginType="MyTest.ITest`1[[MyTest.Test,MyTest]],MyTest" PluggedType="MyTest.Concrete,MyTest" Scope="Singleton" /> I've been racking my brain, however I can't see what I'm doing wrong - I've used Type.GetType to verify the type actually is valid which it is. Anyone have any ideas? Thanks !

    Read the article

  • The one true domain model - a fallacy?

    - by James L
    I've just finished working for a client which has burnt millions on a project to come up with the 'one true domain model' for their business. This was the project's sole deliverable. What are your thoughts on this? Is a single version of the truth realistic?

    Read the article

  • How do I return a variable from $.post() in jQuery? Closure variable?

    - by James Bao
    I am having trouble passing data retrieved from a $.post() function to use in other places in my code. I want to save the data as a variable and use it outside of the post() function. This is my code: var last_update = function() { $.post('/--/feed', {func:'latest', who:$.defaults.login}, function($j){ _j = JSON.parse($j); alert(_j.text); // This one works }); } alert(_j.text); // This one doesn't }; last_update(); //run the function Please help!

    Read the article

  • Can anyone recommend a .Net XML Serialization library?

    - by James
    Can anyone recommend a .Net XML Serialization library (ideally open source). I am looking for a robust XML serialization library that I can throw any object at, which will produce a human readable XML representation of the public properties for logging purposes. I never need to be able to deserialize. XmlSerializer's requirement of an object having a parameter constructor is too restrictive for what I want. DataContractSerializer does not give enough control over the output (which is not particularly human-readable). Any recommendations appreciated! Thanks

    Read the article

  • Centering fonts in VB6

    - by James Musser
    How do you determine the length of a string of text in Arial Bold font, and then center it in VB6? If not here, can you point me in a direction where I might be able to find this information? We're not using a "label" or "picture box" do print the text to the screen. We are sizing the text on the fly, and allowing the user to scale the size of our application to their liking. We write the text to screen using code.

    Read the article

  • Problem finding the difference in days between two dates

    - by James
    I have been using a tidy little routine that I found here to calculate the difference in days between two dates in AS3. I am getting some strange results and I am wondering if any of you inter-codal-mega-lords can shed some light? Why is Q1 of 2010 coming up one day short, when in all other cases the routine is performing fine? Many thanks in advance to anyone who can help! function countDays( startDate:Date, endDate:Date ):int { var oneDay:int = 24*60*60*1000; // hours*minutes*seconds*milliseconds var diffDays:int = Math.abs((startDate.getTime() - endDate.getTime())/(oneDay)); return diffDays; } countDays( new Date( 2010, 00, 01 ), new Date( 2011, 00, 01 ) ); // returns 365, which is correct countDays( new Date( 2010, 00, 01 ), new Date( 2010, 03, 01 ) ); // returns 89, which is 1 day short countDays( new Date( 2010, 03, 01 ), new Date( 2010, 06, 01 ) ); // returns 91, which is correct countDays( new Date( 2010, 06, 01 ), new Date( 2010, 09, 01 ) ); // returns 92, which is correct countDays( new Date( 2010, 09, 01 ), new Date( 2011, 00, 01 ) ); // returns 92, which is correct

    Read the article

  • Dynamically Set Control Adaptor

    - by James
    In ASP.Net is there a way to dynamically set a control adapter? The standard way to apply a contol adapter is via the ".browser" files. However, I have a situation where I would like to use the control adapter in some circumstances, but not in others - and i can not find a way to achieve this. Any help appreciated.

    Read the article

< Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >