Posts

c# - How to validate string can be convert to specific type? -

I have a string that can be int, date time, boolean, byte, etc. How do I validate that the string can be converted into those types without using TryParse of each type? public class generics manager {public static change chang type gt;)) {value = (T) Convert.changetap (data, Nullable.GetUnderlyingType (typeof t))); } And {if (data! = Null) {value = (t) convert.change type (data, typef (t)); } } return value; }} is not useful at large here, but I think you can use it, and can validate that the result is not equal to the default for that type . However, Tryparse is much better and you're trying to do.

wpf - How can I define and use a variable in XAML to define a color? -

I have a number of elements in the XAML that defines Foreground = "# 555" Color of fade text in a readable text box for & Lt; Text boxes Text = "{Binding SingularModelClassFileName}" HorizontalAlignment = "left" IsReadOnly = "True" foreground = "# 555" width = "500" / & gt; & Lt; Textbox VerticalScrollBarVisibility = "visible" AcceptsReturn = "true" width = "500" height = "100" IsReadOnly = "True" foreground = "# 555" Text = "{SingularModelClassContent Binding}" HorizontalAlignment = "left" margin = "0 20" /> How can I assume I can put in a XAML variable and I can refer to each attribute so I'll have to change it in one place? I'm thinking you can do something like this : & lt; Sys: string x: main = "ReadOnlyTextColor" & gt; # 555 & lt; / Sys: string & gt; ... & lt; ...

java - Secure XML Parsers -

In typical Java applications, XML Parsers are XALAN / XERCES but they were not written with the security in order to find out I'm curious about whether there is a stronger parser in terms of security. What do you mean by 'brain in security'? Would you consider a secure xml parser? In this there is a great deal about XML threats. You can give some hints and concepts. Edit: To answer your question: Hardware solutions that can analyze the communication and filters for virus attachments in your incoming HTTP, SOAP, etc. Dangerous XML with soap, deliberately large / infinite unit recursive etc.

latex - Parts in pdflatex Table of Contents -

I have a thesis in which I want to use some lessons together \ part command. What do I have to do: Chapter 1 Part I Chapter 2 Chapter 4 > Then the last chapter should be at the same level again. In the Table of Contents, you can not actually detect it, because the parts are at the same level anyway. The problem is that in PDF, Chapter 6 is added under Part II. Does anyone know any way to change it? This package can do quite well with other things. This PDF uses the embedded PDF bookmark only one pass. \ part {...} \ chapters {...} \ bookmarksetup {startatroot} \ chapters {...}

url rewriting - How to redirect a request to a non existant PHP file to a existing DIR in a clean way? -

About my client asked me to create a web app in PHP, I ended up using Symphony. On distribution, he told me that he has pointed out a software to the hardcod URL with an embedded web view: www.domain.com/dir/tools.php Now she wants to show the web app in the web view, but the software is used by about 400 consumers, we can not expect to change the hard coded URL. How do you feel that I can clear it by: Create www.domain.com/dir/tools.php and use redirection? Which one else? Use the URL rewrite? Any snippet is appreciated, I have no idea to do this. Apache: RewriteRule ^ dir / tools \ .php $ new_page.php [R = 301] Edit: As stated, it goes into your .htaccess file. I have more information in the linked mod_rewrite document. Fixed.

java - Why should wait() always be called inside a loop -

I have read that we should always call a wait () from within a loop: while (! Condition) {obj.wait (); } It works well without a loop, why is it so? You not only need a loop but check your position in the loop. Java does not guarantee that your thread will only be informed by informing () / informing () the call or the correct information () / notify (). Due to this property loop-less version can work on your development environment and may fail unexpectedly in the production environment. For example, you are waiting for something: synchronize (TheObjectYouAreWaitingOn) {while (! Carrien) {theObjectYouAreWaitingOn.wait (); }} Comes with a bad thread and: theObjectYouAreWaitingOn.notifyAll (); If the bad thread can not mess with carryOn then you are waiting for the right client. Edit: Add some more samples. Waiting can be interrupted, it throws a blocked exposure, and you may have to try to wait-based depending on the needs of your business, you can le...

asp.net - Control.ClientID with CSS -

Can CSS be used with control that generates client IDs and not regular IDs? Now I can use the CSS class, but I want to know whether it is possible to use the ID: # DIVERSION ID #Label Control ID {Padding: 100px; Red color; } There is no good way to do this. Many developers use something like this: & lt; Style & gt; # & Lt;% = MyControl.ClientID% & gt; {Padding: 100px; } & Lt; / Style & gt; But obviously I'm not a big fan of it. It is very tagsy and fragile, starting with ASP.NET 4.0, you will be able to control the client ID of an element in the code, so that you can specify the ID for the elements that you know you will be using CSS or JS With the goal will be required. In the meantime, I recommend using classes that the system I work on, we require classes and restrictions ID for client-side code (CSS or JS) because it Additional overhead is not worth it. Classes can work as well as ID - nothing is preventing you from having some uni...