Search Results

Search found 4116 results on 165 pages for 'baron throw'.

Page 7/165 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Fake ISAPI Handler to serve static files with extention that are rewritted by url rewriter

    - by developerit
    Introduction I often map html extention to the asp.net dll in order to use url rewritter with .html extentions. Recently, in the new version of www.nouvelair.ca, we renamed all urls to end with .html. This works great, but failed when we used FCK Editor. Static html files would not get serve because we mapped the html extension to the .NET Framework. We can we do to to use .html extension with our rewritter but still want to use IIS behavior with static html files. Analysis I thought that this could be resolve with a simple HTTP handler. We would map urls of static files in our rewriter to this handler that would read the static file and serve it, just as IIS would do. Implementation This is how I coded the class. Note that this may not be bullet proof. I only tested it once and I am sure that the logic behind IIS is more complicated that this. If you find errors or think of possible improvements, let me know. Imports System.Web Imports System.Web.Services ' Author: Nicolas Brassard ' For: Solutions Nitriques inc. http://www.nitriques.com ' Date Created: April 18, 2009 ' Last Modified: April 18, 2009 ' License: CPOL (http://www.codeproject.com/info/cpol10.aspx) ' Files: ISAPIDotNetHandler.ashx ' ISAPIDotNetHandler.ashx.vb ' Class: ISAPIDotNetHandler ' Description: Fake ISAPI handler to serve static files. ' Usefull when you want to serve static file that has a rewrited extention. ' Example: It often map html extention to the asp.net dll in order to use url rewritter with .html. ' If you want to still serve static html file, add a rewritter rule to redirect html files to this handler Public Class ISAPIDotNetHandler Implements System.Web.IHttpHandler Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest ' Since we are doing the job IIS normally does with html files, ' we set the content type to match html. ' You may want to customize this with your own logic, if you want to serve ' txt or xml or any other text file context.Response.ContentType = "text/html" ' We begin a try here. Any error that occurs will result in a 404 Page Not Found error. ' We replicate the behavior of IIS when it doesn't find the correspoding file. Try ' Declare a local variable containing the value of the query string Dim uri As String = context.Request("fileUri") ' If the value in the query string is null, ' throw an error to generate a 404 If String.IsNullOrEmpty(uri) Then Throw New ApplicationException("No fileUri") End If ' If the value in the query string doesn't end with .html, then block the acces ' This is a HUGE security hole since it could permit full read access to .aspx, .config, etc. If Not uri.ToLower.EndsWith(".html") Then ' throw an error to generate a 404 Throw New ApplicationException("Extention not allowed") End If ' Map the file on the server. ' If the file doesn't exists on the server, it will throw an exception and generate a 404. Dim fullPath As String = context.Server.MapPath(uri) ' Read the actual file Dim stream As IO.StreamReader = FileIO.FileSystem.OpenTextFileReader(fullPath) ' Write the file into the response context.Response.Output.Write(stream.ReadToEnd) ' Close and Dipose the stream stream.Close() stream.Dispose() stream = Nothing Catch ex As Exception ' Set the Status Code of the response context.Response.StatusCode = 404 'Page not found ' For testing and bebugging only ! This may cause a security leak ' context.Response.Output.Write(ex.Message) Finally ' In all cases, flush and end the response context.Response.Flush() context.Response.End() End Try End Sub ' Automaticly generated by Visual Studio ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable Get Return False End Get End Property End Class Conclusion As you see, with our static files map to this handler using query string (ex.: /ISAPIDotNetHandler.ashx?fileUri=index.html) you will have the same behavior as if you ask for the uri /index.html. Finally, test this only in IIS with the html extension map to aspnet_isapi.dll. Url rewritting will work in Casini (Internal Web Server shipped with Visual Studio) but it’s not the same as with IIS since EVERY request is handle by .NET. Versions First release

    Read the article

  • What does msvc 6 throw when an integer divide by zero occurs?

    - by EvilTeach
    I have been doing a bit of experimenting, and have discovered that an exception is being thrown, when an integer divide by zero occurs. #include <iostream> #include <stdexcept> using namespace std; int main ( void ) { try { int x = 3; int y = 0; int z = x / y; cout << "Didn't throw or signal" << endl; } catch (std::exception &e) { cout << "Caught exception " << e.what() << endl; } return 0; } Clearly it is not throwing a std::exception. What else might it be throwing?

    Read the article

  • Will client JVM for a web service(https) throw an SSL Exception when the server is having a valid ce

    - by ring bearer
    I have a web service deployed on tomcat hosted on a remote server. I have set it up such that it can be accessed only via HTTPS. For this, I generated a Certificate Signing Request (CSR) and used it to get a temporary certificate from VeriSign. My web service client is on my local machine. If I try to access the service it will throw a javax.net.ssl.SSLHandshakeException:unable to find valid certification path to requested target If I install the certificate in to local Java's keystore, the issue will be resolved. My question is if I install a valid SSL certificate from a CA in to my tomcat server, will I get this client-side error even if I do not import the certificate to local key store?

    Read the article

  • Why in Ruby, a || 1 will throw an error when `a` is undefined, but a = a || 1 will not?

    - by Jian Lin
    When a is undefined, then a || 1 will throw an error, but a = a || 1 will not. Isn't that a little bit inconsistent? irb(main):001:0> a NameError: undefined local variable or method `a' for main:Object from (irb):1 from c:/ruby/bin/irb:12:in `<main>' irb(main):002:0> a || 1 NameError: undefined local variable or method `a' for main:Object from (irb):2 from c:/ruby/bin/irb:12:in `<main>' irb(main):003:0> a = a || 1 => 1

    Read the article

  • Why would this line throw exception for type initializer failed?

    - by Jaggu
    I had a class: public class Constant { public static string ConnString = ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString; } which would throw exception on LIVE: Type initialize failed for Constant ctor If I change the class to: public class Constant { public static string ConnString { get { return ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString; } } } it works. I wasted 2 hours behind this but I still don't know why would this happen. Any ideas? Note: The 1st class used to work on DEV environment but not on LIVE. The 2nd class works on DEV and also on Production. I am using VS2010 on production and Asp.Net 4.0 Website project. I am totally amazed by this inconsistency to say the least! Edit: This class was in App_Code folder.

    Read the article

  • Is it ever OK to throw a java.lang.Error?

    - by Abhijeet Kashnia
    I have a plugin module that goes into a web application. If the module does not load correctly, it does not make sense for the web application to go on, and the web application should probably not load at all, we would prefer this module to initialize correctly always. If I were to throw a runtime exception, it would get into the logs, and just get ignored since the application will continue anyway, and the end users would never know... I know that errors are meant to be thrown only under exceptional conditions, and they generally have to do with situations that the system cannot recover from, but what would you do in such a situation?

    Read the article

  • What's a good way to throw and handle events in PHP?

    - by techexpert
    Hi everyone, I am just trying to get a general idea about the event prcessing mechanism in PHP5 in as neat way as possible. First of all I understand that a PHP application is not exactly a persistent type, so the events may not make a lot of sense, but from the OO perspective it might be a very elegant way to "communicate" between the objects. So I am thinking that it would make sense to separate the events on the external events, such as $_POST & $_GET and the internal ones, i.e. function callbacks. As far as the external ones, is it a good idea to process the $_GETs and $_POSTs directly, or is it better to wrap them into an event of some sort? Also, in order to process the internal events, do you have to pass the reference to the event handler/dispatcher to each class so they know how to throw them? I was thinking to use the PEAR EventDispatcher to do the work, but I am open to other suggestions. Thank you!

    Read the article

  • Which .NET exception to throw for invalid database state?

    - by jslatts
    I am writing some data access code and I want to check for potentially "invalid" data states in the database. For instance, I am returning a widget out of the database and I only expect one. If I get two, I want to throw an exception. Even though referential integrity should prevent this from occurring, I do not want to depend on the DBAs never changing the schema. I would like to use the System.IO.InvalidDataException, except that I am not dealing with a file stream so it would be misleading. I ended up going with a generic applicationexception. Anyone have a better idea?

    Read the article

  • [C++] which is better, throw an exception or return nonzero value?

    - by xis19
    While you are doing C++ programming, you have two choices of reporting an error. I suppose many teachers would suggest you throw an exception, which is derived from std::exception. Another way, which might be more "C" style, is to return a non-zero value, as zero is "ERROR_SUCCESS". Definitively, return an exception can provide much more information of the error and recovery; while the code will bloat a little bit, and making exception-safe in your mind is a little difficult for me, at least. Other way like returning something else, will make reporting an error much easier; the defect is that managing recovery will be a possibly big problem. So folks, as good programmers, which would be your preference, not considering your boss' opinion? For me, I would like to return some nonzero values.

    Read the article

  • what happens with memory when I throw an exception?

    - by Vincenzo
    This is the code (just a simplification of a real problem): <?php echo memory_get_usage() . "\n"; function f() { throw new Exception(); } function foo() { try { f(); } catch (Exception $e) { } } foo(); echo memory_get_usage() . "\n"; This is the output (PHP 5.3): 630680 630848 What happened with memory (168 bytes lost)? The exception object is not destroyed? Please, help! Thanks

    Read the article

  • Can I automatically throw descriptive exceptions with parameter values and class feild information?

    - by Robert H.
    I honestly don't throw exceptions often. I catch them even less, ironically. I currently work in shop where we let them bubble up to avicode. For whatever reason, however, avicode isn't configured to capture some of the critical bits I need when these exceptions come bouncing back to my attention. Specifically, I'd like to see the parameter values and the class’s field data at the time of the exception. I’d guess with the large suite of .Net services that I could create a static method to crawl up the stack, gather these bits and store them in a string that I could stick in my exception message. I really don't are how long such a method would take to execute as performance is no longer a concern when I hit one of these scenarios. If it's possible, I'm sure someone has done it. If that's the case, I'm having a hard time finding it. I think any search containing "exception" brings back too many resutls. Anyway, can this be done? If so, some examples or links would be great. Thanks in advance for your time, Robert

    Read the article

  • What's the deal with the hidden Throw when catching a ThreadAbortException?

    - by priehl
    I'm going through a book of general c# development, and I've come to the thread abort section. The book says something along the lines that when you call Thread.Abort() on another thread, that thread will throw a ThreadAbortException, and even if you tried to supress it it would automatically rethrow it, unless you did some bs that's generally frowned upon. Here's the simple example offered. using System; using System.Threading; public class EntryPoint { private static void ThreadFunc() { ulong counter = 0; while (true) { try { Console.WriteLine("{0}", counter++); } catch (ThreadAbortException) { // Attempt to swallow the exception and continue. Console.WriteLine("Abort!"); } } } static void Main() { try { Thread newThread = new Thread(new ThreadStart(EntryPoint.ThreadFunc)); newThread.Start(); Thread.Sleep(2000); // Abort the thread. newThread.Abort(); // Wait for thread to finish. newThread.Join(); } catch (Exception e) { Console.WriteLine(e.ToString()); } } } The book says: When your thread finishes processing the abort exception, the runtime implicitly rethrows it at the end of your exception handler. It’s the same as if you had rethrown the exception yourself. Therefore, any outer exception handlers or finally blocks will still execute normally. In the example, the call to Join won’t be waiting forever as initially expected. So i wrapped a try catch around the Thread.Abort() call and set a break point, expecting it to hit this, considering the text says "any outer exception handlers or finally blocks will still execute normally". BUT IT DOES NOT. I'm racking my brain to figure out why. Anyone have any thoughts on why this isn't the case? Is the book wrong? Thanks in advance.

    Read the article

  • How to structure code with 2 methods, one after another, which throw the same two exceptions?

    - by dotnetdev
    Hi, I have two methods, one called straight after another, which both throw the exact same 2 exceptions (IF an erroneous condition occurs, not stating that I'm getting exceptions). For this, should I write seperate try and catch blocks with the one statement in each try block and catch both exceptions (Both of which I can handle as I checked MSDN class library reference and there is something I can do, eg, re-open SqlConnection or run a query and not a stored proc which does not exist). So code like this: try { obj.Open(); } catch (SqlException) { // Take action here. } catch (InvalidOperationException) { // Take action here. } And likewise for the other method I call straight after. This seems like a very messy way of coding. The other way is to code with the exception variable (that is ommited as I am using AOP to log the exception details, using a class-level attribute). Doing this, this could aid me in finding out which method caused an exception and then taking action accordingly. Is this the best approach or is there another best practise altogether? I also assume that, as only these two methods are thrown, I do not need to catch Exception as that would be for an exception I cannot handle (causes way out of my control). Thanks

    Read the article

  • Exception Handling Frequency/Log Detail

    - by Cyborgx37
    I am working on a fairly complex .NET application that interacts with another application. Many single-line statements are possible culprits for throwing an Exception and there is often nothing I can do to check the state before executing them to prevent these Exceptions. The question is, based on best practices and seasoned experience, how frequently should I lace my code with try/catch blocks? I've listed three examples below, but I'm open to any advice. I'm really hoping to get some pros/cons of various approaches. I can certainly come up with some of my own (greater log granularity for the O-C approach, better performance for the Monolithic approach), so I'm looking for experience over opinion. EDIT: I should add that this application is a batch program. The only "recovery" necessary in most cases is to log the error, clean up gracefully, and quit. So this could be seen to be as much a question of log granularity as exception handling. In my mind's eye I can imagine good reasons for both, so I'm looking for some general advice to help me find an appropriate balance. Monolitich Approach class Program{ public static void Main(){ try{ Step1(); Step2(); Step3(); } catch (Exception e) { Log(e); } finally { CleanUp(); } } public static void Step1(){ ExternalApp.Dangerous1(); ExternalApp.Dangerous2(); } public static void Step2(){ ExternalApp.Dangerous3(); ExternalApp.Dangerous4(); } public static void Step3(){ ExternalApp.Dangerous5(); ExternalApp.Dangerous6(); } } Delegated Approach class Program{ public static void Main(){ try{ Step1(); Step2(); Step3(); } finally { CleanUp(); } } public static void Step1(){ try{ ExternalApp.Dangerous1(); ExternalApp.Dangerous2(); } catch (Exception e) { Log(e); throw; } } public static void Step2(){ try{ ExternalApp.Dangerous3(); ExternalApp.Dangerous4(); } catch (Exception e) { Log(e); throw; } } public static void Step3(){ try{ ExternalApp.Dangerous5(); ExternalApp.Dangerous6(); } catch (Exception e) { Log(e); throw; } } } Obsessive-Compulsive Approach class Program{ public static void Main(){ try{ Step1(); Step2(); Step3(); } finally { CleanUp(); } } public static void Step1(){ try{ ExternalApp.Dangerous1(); } catch (Exception e) { Log(e); throw; } try{ ExternalApp.Dangerous2(); } catch (Exception e) { Log(e); throw; } } public static void Step2(){ try{ ExternalApp.Dangerous3(); } catch (Exception e) { Log(e); throw; } try{ ExternalApp.Dangerous4(); } catch (Exception e) { Log(e); throw; } } public static void Step3(){ try{ ExternalApp.Dangerous5(); } catch (Exception e) { Log(e); throw; } try{ ExternalApp.Dangerous6(); } catch (Exception e) { Log(e); throw; } } } Other approaches welcomed and encouraged. Above are examples only.

    Read the article

  • Why does Sitecore throw a NullReferenceException exception when I redirect to one of its pages?

    - by Abs
    I'm running Sitecore 6.1 on Windows 2008, IIS7, and I'm trying to use the URL Rewrite Module to do a redirect. When I enable the rule and hit the URL that triggers it, I get a YSOD. The same rule works perfectly on a non-sitecore site on the same machine. According to the Failed Request Trace, the rewrite module does its thing just fine, but then Sitecore throws an exception, even if the redirect points to another server. This is probably a result of something I have misconfigured, but I just can't understand why it doesn't work. The details from the YSOD are below. [NullReferenceException: Object reference not set to an instance of an object.] Sitecore.Nexus.Web.HttpModule.(Object sender, EventArgs e) +273 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

    Read the article

  • Why does Visual Studio 2010 throw this error with Boost 1.42.0?

    - by ra170
    I'm trying to recompile application, that compiles fine with warning level 4 in visual studio 2005 and visual studio 2008. Since the errors (look below) are coming from std:tr1, I'm thinking there's some conflict, but not sure how to fix. My first thought was to remove all references to boost, such as but then I get an error that it can't find format method. So here's one of the errors: (not sure what it means) Any ideas, suggestions, solutions? Thanks! > c:\program files (x86)\microsoft > visual studio > 10.0\vc\include\type_traits(197): error C2752: > 'std::tr1::_Remove_reference<_Ty>' : > more than one partial specialization > matches the template argument list 1> > with 1> [ 1> > _Ty=bool (__cdecl &)(const BlahBlah &) 1> ] 1> c:\program > files (x86)\microsoft visual studio > 10.0\vc\include\xtr1common(356): could be > 'std::tr1::_Remove_reference<_Ty&&>' > 1> c:\program files > (x86)\microsoft visual studio > 10.0\vc\include\xtr1common(350): or 'std::tr1::_Remove_reference<_Ty&>' 1> > c:\program files (x86)\microsoft > visual studio > 10.0\vc\include\type_traits(962) : see reference to class template > instantiation > 'std::tr1::remove_reference<_Ty>' > being compiled 1> with

    Read the article

  • Why does a newly created EF-entity throw an ID is null exception when trying to save?

    - by Richard
    I´m trying out entity framework included in VS2010 but ´ve hit a problem with my database/model generated from the graphical interface. When I do: user = dataset.UserSet.CreateObject(); user.Id = Guid.NewGuid(); dataset.UserSet.AddObject(user); dataset.SaveChanges(); {"Cannot insert the value NULL into column 'Id', table 'BarSoc2.dbo.UserSet'; column does not allow nulls. INSERT fails.\r\nThe statement has been terminated."} The table i´m inserting into looks like so: -- Creating table 'UserSet' CREATE TABLE [dbo].[UserSet] ( [Id] uniqueidentifier NOT NULL, [Name] nvarchar(max) NOT NULL, [Username] nvarchar(max) NOT NULL, [Password] nvarchar(max) NOT NULL ); GO -- Creating primary key on [Id] in table 'UserSet' ALTER TABLE [dbo].[UserSet] ADD CONSTRAINT [PK_UserSet] PRIMARY KEY CLUSTERED ([Id] ASC); GO Am I creating the object in the wrong way or doing something else basic wrong?

    Read the article

  • Why does Font.registerFont throw an error the second time a swf is loaded?

    - by Al Brown
    I've found an issue (in flash cs5) when using TLFTextfields and fonts shared at runtime, and I wondered if anyone has a solution. Here's the scenario. Fonts.swf: library for fonts (runtime shared DF4) Popup.swf: popup with a TLFTextfield (with text in it) using a font from Fonts.swf Main.swf : the main swf with a button that loads and unloads Popup.swf (using Loader or SafeLoader give the same results) Nice and simple, Run main.swf, click button and the popup appears with the text. Click the button again to remove the popup. All well and good now click the button again and I get the following error. ArgumentError: Error #1508: The value specified for argument font is invalid. at flash.text::Font$/registerFont() at Popup_fla::MainTimeline()[Popup_fla.MainTimeline::MainTimeline:12] I'm presuming it's happening because the font is already registered (checked when clicking before the load). Does anyone know how to get past this? If you are wondering here's my Main.as package { import fl.controls.Button; import flash.display.Loader; import flash.display.Sprite; import flash.events.Event; import flash.events.IOErrorEvent; import flash.events.MouseEvent; import flash.events.UncaughtErrorEvent; import flash.net.URLRequest; import flash.text.Font; public class Main extends Sprite { public var testPopupBtn:Button; protected var loader:Loader; public function Main() { trace("Main.Main()"); testPopupBtn.label = "open"; testPopupBtn.addEventListener(MouseEvent.CLICK, testClickHandler); } protected function testClickHandler(event:MouseEvent):void { trace("Main.testClickHandler(event)"); if(loader) { testPopupBtn.label = "open"; this.removeChild(loader); //loader.unloadAndStop(); loader = null; }else{ testPopupBtn.label = "close"; trace("Registered Fonts -->"); var fonts:Array = Font.enumerateFonts(false); for each (var font:Font in fonts) { trace("\t",font.fontName, font.fontStyle, font.fontType); } trace("<--"); loader = new Loader(); loader.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorHandler); this.addChild(loader); try{ loader.load(new URLRequest("Popup.swf")); }catch(e:*){ trace(e); } } } private function uncaughtErrorHandler(event:UncaughtErrorEvent):void { trace("Main.uncaughtErrorHandler(event)", event); } } }

    Read the article

  • Why does adding a Flex DateChooser component throw an index out of bounds error?

    - by Lo'
    I'm facing an issue with the flex Application I'm currently working on. When I open a pop-up using the 'createPopUp' method, I've got this index out of bounds error message : RangeError: The supplied index is out of bounds. at mx.core::FTETextField/getLineMetrics()[E:\dev\4.y\frameworks\projects\spark\src\mx\core\FTETextField.as:2169] at mx.core::UIFTETextField/get baselinePosition()[E:\dev\4.y\frameworks\projects\spark\src\mx\core\UIFTETextField.as:784] at mx.controls::DateChooser/get baselinePosition()[E:\dev\4.y\frameworks\projects\mx\src\mx\controls\DateChooser.as:994] at spark.components::Group/get baselinePosition()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:282] at spark.layouts::ConstraintLayout/parseElementConstraints()[E:\dev\4.y\frameworks\projects\spark\src\spark\layouts\ConstraintLayout.as:1818] at spark.layouts::ConstraintLayout/parseConstraints()[E:\dev\4.y\frameworks\projects\spark\src\spark\layouts\ConstraintLayout.as:1632] at spark.layouts::ConstraintLayout/measure()[E:\dev\4.y\frameworks\projects\spark\src\spark\layouts\ConstraintLayout.as:414] at spark.components.supportClasses::GroupBase/measure()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\GroupBase.as:1148] at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::measureSizes()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8506] at mx.core::UIComponent/validateSize()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8430] at spark.components::Group/validateSize()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1012] at mx.managers::LayoutManager/validateClient()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:987] at mx.managers::PopUpManagerImpl/addPopUp()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:382] at mx.managers::PopUpManagerImpl/createPopUp()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:232] at mx.managers::PopUpManager$/createPopUp()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\PopUpManager.as:139] at views::AddProjects/loadAddProjectPopUp()[C:\Users\Laura\Web\spidermak\spidermak\src\views\AddProjects.mxml:184] at views::AddProjects/___AddProjects_Button1_click()[C:\Users\Laura\Web\spidermak\spidermak\src\views\AddProjects.mxml:838] It seems that this error is caused by a "dateChooser" component in my popup : <mx:DateChooser id="endDate"/> When I comment this line, the error is no longer thrown and the popup loads correctly. It's really weird because I didn't have this issue until this morning. All I did in the meantime was changing some layout-related stuff, but I don't see what is would have to do with this problem. I don't get it... Does anyone have a clue about how to fix this ? I need my DateChooser ! Thanks ! Laura EDIT - It seems that the problem is not caused by the DateChooser itself, but by the FormItem around it. Here's what my code looks like : <Form width="100%"> [...] <s:HGroup width="100%"> <s:FormItem label="Date de début"> <mx:DateChooser id="startDate" firstDayOfWeek="1"/> </s:FormItem> <s:FormItem label="Date de fin"> <mx:DateChooser id="endDate" firstDayOfWeek="1"/> </s:FormItem> </s:HGroup> </Form> If I remove the two FormItems, it works. Could anyone explain me why? Thanks !

    Read the article

  • Why the double.Parse throw error in live server and how to track?

    - by Kovu
    Hi, I build a website, that: reads data from a website by HttpWebRequest Sort all Data Parse values of the data and give out newly On local server it works perfect, but when I push it to my live server, the double.Parse fails with an error. So: - how to track what the double.parse is trying to parse? - how to debug live server? Lang is ASP.Net / C#.net 2.0

    Read the article

  • Using JavaScript in WordPress: throw all jQuery plugins in, or is there a way to conditionally load?

    - by ineedtosleep
    I'm relatively new with WordPress theming and JavaScript, though not incompetent with either. I'm looking to have a maximum of 10 jQuery plugins to go on the blog, but I'm wondering if there's a way to have them load only when needed, as I don't want any unnecessary loading for the users. Something similar in something I know a little bit more of would be the conditional comments in IE <!--[IF IE]> @import ie.css <![endif]-->.

    Read the article

  • Why does this extension method throw a NullReferenceException in VB.NET?

    - by Dan
    From previous experience I had been under the impression that it's perfectly legal (though perhaps not advisable) to call extension methods on a null instance. So in C#, this code compiles and runs: // code in static class static bool IsNull(this object obj) { return obj == null; } // code elsewhere object x = null; bool exists = !x.IsNull(); However, I was just putting together a little suite of example code for the other members of my development team (we just upgraded to .NET 3.5 and I've been assigned the task of getting the team up to speed on some of the new features available to us), and I wrote what I thought was the VB.NET equivalent of the above code, only to discover that it actually throws a NullReferenceException. The code I wrote was this: ' code in module ' <Extension()> _ Function IsNull(ByVal obj As Object) As Boolean Return obj Is Nothing End Function ' code elsewhere ' Dim exampleObject As Object = Nothing Dim exists As Boolean = Not exampleObject.IsNull() The debugger stops right there, as if I'd called an instance method. Am I doing something wrong (e.g., is there some subtle difference in the way I defined the extension method between C# and VB.NET)? Is it actually not legal to call an extension method on a null instance in VB.NET, though it's legal in C#? (I would have thought this was a .NET thing as opposed to a language-specific thing, but perhaps I was wrong.) Can anybody explain this one to me?

    Read the article

  • Is it against best practice to throw Exception on most JUnit tests?

    - by Chris Knight
    Almost all of my JUnit tests are written with the following signature: public void testSomething() throws Exception My reasoning is that I can focus on what I'm testing rather than exception handling which JUnit appears to give me for free. But am I missing anything by doing this? Is it against best practice? Would I gain anything by explicitly catching specific exceptions in my test and then fail()'ing on them?

    Read the article

  • XNA: What can cause SpriteBatch.End() to throw a NRE?

    - by Rosarch
    I don't understand what I'm doing wrong here: public void Draw(GameTime gameTime) // in ScreenManager { SpriteBatch.Begin(SpriteBlendMode.AlphaBlend); for (int i = 0; i < Screens.Count; i++) { if (Screens[i].State == Screen.ScreenState.HIDDEN) continue; Screens[i].Draw(gameTime); } SpriteBatch.End(); // null ref exception } SpriteBatch itself is not null. Some more context: public class MasterEngine : Microsoft.Xna.Framework.Game { public MasterEngine() { graphicsDeviceManager = new GraphicsDeviceManager(this); Components.Add(new GamerServicesComponent(this)); // ... spriteBatch = new SpriteBatch(graphicsDeviceManager.GraphicsDevice); screenManager = new ScreenManager(assets, gameEngine, graphicsDeviceManager.GraphicsDevice, spriteBatch); } //... protected override void Draw(GameTime gameTime) { screenManager.Draw(gameTime); // calls the problematic method base.Draw(gameTime); } } Am I failing to initialize something properly? UPDATE: As an experiment, I tried this to the constructor of MasterEngine: spriteBatch = new SpriteBatch(graphicsDeviceManager.GraphicsDevice); spriteBatch.Begin(); spriteBatch.DrawString(assets.GetAsset<SpriteFont>("calibri"), "ftw", new Vector2(), Color.White); spriteBatch.End(); This does not cause a NRE. hmm.... UPDATE 2: This does cause an NRE: protected override void Draw(GameTime gameTime) { spriteBatch.Begin(); spriteBatch.End(); // boned here //screenManager.Draw(gameTime); base.Draw(gameTime); }

    Read the article

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