Format XML string to print friendly XML string
I have an XML string as such: ``` <?xml version='1.0'?><response><error code='1'> Success</error></response> ``` There are no lines between one element and another, and thus is very difficult to re...
- Modified
- 27 Jun at 03:3
What size do you use for varchar(MAX) in your parameter declaration?
I normally set my column size when creating a parameter in ADO.NET. But what size do I use if the column is of type `VARCHAR(MAX)`? ``` cmd.Parameters.Add("@blah", SqlDbType.VarChar, ?????).Value = bl...
- Modified
- 22 Jun at 09:33
Static method in a generic class?
In Java, I'd like to have something as: ``` class Clazz<T> { static void doIt(T object) { // ... } } ``` But I get I don't understand generics beyond the basic uses and thus can't make m...
- Modified
- 3 Apr at 18:30
How to limit the maximum value of a numeric field in a Django model?
Django has various numeric fields available for use in models, e.g. [DecimalField](http://docs.djangoproject.com/en/dev/ref/models/fields/#decimalfield) and [PositiveIntegerField](http://docs.djangopr...
- Modified
- 24 Apr at 17:8
Creating an empty file in C#
What's the simplest/canonical way to create an empty file in C#/.NET? The simplest way I could find so far is: ``` System.IO.File.WriteAllLines(filename, new string[0]); ```
What is the maximum length of a table name in Oracle?
What are the maximum length of a table name and column name in Oracle?
- Modified
- 8 Apr at 11:26
How can I get System variable value in Java?
How can I get the System Variable value which is present in ``` MyComputer -> Properties -> Advanced -> Environment Variables -> System Variables ``` in Java? I have used `System.getenv()` meth...
- Modified
- 7 Mar at 10:31
Strings as Primary Keys in MYSQL Database
I am not very familiar with databases and the theories behind how they work. Is it any slower from a performance standpoint (inserting/updating/querying) to use Strings for Primary Keys than integers...
- Modified
- 16 Feb at 11:0
How do I convert a PDF document to a preview image in PHP?
What libraries, extensions etc. would be required to render a portion of a PDF document to an image file? Most PHP PDF libraries that I have found center around creating PDF documents, but is there a...
Why use deflate instead of gzip for text files served by Apache?
What advantages do either method offer for html, css and javascript files served by a LAMP server. Are there better alternatives? The server provides information to a map application using Json, so a...
- Modified
- 23 May at 12:18
How to try convert a string to a Guid
I did not find the TryParse method for the Guid. I’m wondering how others handle converting a guid in string format into a guid type. ``` Guid Id; try { Id = new Guid(Request.QueryString["id"]);...
- Modified
- 28 Sep at 23:21
Pass An Instantiated System.Type as a Type Parameter for a Generic Class
The title is kind of obscure. What I want to know is if this is possible: ``` string typeName = <read type name from somwhere>; Type myType = Type.GetType(typeName); MyGenericClass<myType> myGeneric...
Get the generated SQL statement from a SqlCommand object?
I have the following code: ``` Using cmd As SqlCommand = Connection.CreateCommand cmd.CommandText = "UPDATE someTable SET Value = @Value" cmd.CommandText &= " WHERE Id = @Id" cmd.Paramete...
How to copy a file to multiple directories using the gnu cp command
Is it possible to copy a single file to multiple directories using the cp command ? I tried the following , which did not work: ``` cp file1 /foo/ /bar/ cp file1 {/foo/,/bar} ``` I know it's pos...
Best way to compare 2 XML documents in Java
I'm trying to write an automated test of an application that basically translates a custom message format into an XML message and sends it out the other end. I've got a good set of input/output messa...
- Modified
- 26 Sep at 21:10
Most efficient T-SQL way to pad a varchar on the left to a certain length?
As compared to say: ``` REPLICATE(@padchar, @len - LEN(@str)) + @str ```
- Modified
- 19 Mar at 01:29
Converting an integer to a hexadecimal string in Ruby
Is there a built in way to convert an integer in Ruby into its hexadecimal equivalent? Something like the opposite of [String#to_i](http://ruby-doc.org/core-2.0.0/String.html#method-i-to_i): ``` "0A...
- Modified
- 26 Oct at 04:5
What is the use of the square brackets [] in sql statements?
I've noticed that Visual Studio 2008 is placing square brackets around column names in sql. Do the brackets offer any advantage? When I hand code T-SQL I've never bothered with them. Example: Visual...
- Modified
- 12 Jul at 16:52
PHP with MySQL 8.0+ error: The server requested authentication method unknown to the client
I'm running MySQL version 8 on PHP 7.0. I'm getting the following error when I try to connect to my database from PHP: > Connect Error: SQLSTATE[HY000] [2054] The server requested authentication met...
Better way to disable console inside unit tests
I wonder if there is a better way to disable console errors inside a Jest test (i.e. restore the original console before/after each test). Here is my current approach: ``` describe("Some description"...
- Modified
- 25 Sep at 18:18
GitHub Clone with OAuth Access Token
Inside a script I am trying to clone a GitHub repository with an OAuth token. According to this tutorial: [https://github.com/blog/1270-easier-builds-and-deployments-using-git-over-https-and-oauth](ht...
How can I debug "ImagePullBackOff"?
All of a sudden, I cannot deploy some images which could be deployed before. I got the following pod status: ``` [root@webdev2 origin]# oc get pods NAME READY STATUS ...
- Modified
- 25 Oct at 12:44
Android: ScrollView vs NestedScrollView
What is the difference between `ScrollView` and `NestedScrollView`? Both of them, extend `FrameLayout`. I want to know in depth pros and cons of both of them.
- Modified
- 22 Mar at 10:12
Docker-Compose can't connect to Docker Daemon
I am getting an error message saying I can't connect to the docker daemon. I have looked into other people's answers who have had similar issues but it hasn't helped. I am running the version of Ubu...
- Modified
- 8 Aug at 15:8
How to load external scripts dynamically in Angular?
I have this module which componentize the external library together with additional logic without adding the `<script>` tag directly into the index.html: ``` import 'http://external.com/path/file.js'...
- Modified
- 9 Feb at 11:13