Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Check mobile device using JavaScript

Sometimes developers want to know whether the user is using a mobile browser or a desktop browser so that they can build corresponding user experience. Although in many cases responsive web design would help solve component alignment issues, there are performance related considerations in some cases where some code should not be ran or some feature should not be available if user is on mobile browser. or vice versa This post will summarize a few ways which are commonly used to check whether a user is on mobile device or not.navigator.userAgentThe straightforward approach is to parse the user a...

3,475 0       JAVASCRIPT MOBILE DEVICE MOBILE BROWSER CHECK


  How to check whether a struct implements an interface in GoLang

Unlike other programming languages like Java, when implementing an interface in GoLang, there is no syntax like below to explicit tell the relationship:type I interface {}type A struct implements I {}When looking at the code or running the code in GoLang, it might lead to a case one doesn't know whether a struct implements interface before trying to use it as some interface.According to GoLang spec, as long as a struct implements all functions of an interface, it is considered as having implemented that interface and can be used wherever that interface is expected.To check whether a struct imp...

19,054 0       IMPLEMENTATION CHECK INTERFACE GOLANG


  Check file readability in Java

File operation is quite platform dependent. Although Java is a cross platform programming language, the file operation in Java is also platform dependent. The obvious evidence is the file permission check. In Java, we can call canRead(), canWrite() and canExecutable() to check whether the program can read, write or execute the file specified. However, on Windows, when we call canRead() on a File object, we may get unexpected result.Actually, on Windows, when we call canRead() on a File object, we will always get the true returned even if we have denied the read access to the file. There is als...

38,046 0       JAVA READABLE CHECK FILES


  Check if query string variable exists ASP.NET C#/VB

One of the problems I encountered when I started programming ASP.NET websites was to do with the Request.QueryString function. The first projects I was worked on were built with VB.NET and I used the following code to check the existence of a query string variable:VB.NET Codeview plaincopy to clipboardprint?If Request.QueryString("[VARIABLE]") <> Nothing Then        'CODE HERE  End If  This code checked if the variable existed and if it was populated.Moving to C# I automatically assumed that the&nbs...

26,026 0       ASP.NET QUERY STRING REQUEST EMPTY NULL CHECK