Questions

How can I check if an element exists in the visible DOM?

How do you test an element for existence without the use of the `getElementById` method? I have set up a [live demo](http://jsbin.com/apawi5/3) for reference. I will also print the code on here as we...

Sort ArrayList of custom Objects by property

I read about sorting ArrayLists using a Comparator but in all of the examples people used `compareTo` which according to some research is a method for Strings. I wanted to sort an ArrayList of custom...

27 Jan at 17:18

SyntaxError: Cannot use import statement outside a module

I've got an project that's giving me trouble, so I thought I might update it and ran into issues when using the latest Babel. My "index.js" is: ``` require('dotenv').config() import {startServer} fro...

UnicodeDecodeError, invalid continuation byte

Why is the below item failing? Why does it succeed with "latin-1" codec? ``` o = "a test of \xe9 char" #I want this to remain a string as this is what I am receiving v = o.decode("utf-8") ``` Which r...

24 Jul at 20:9

How to make a class JSON serializable

How to make a Python class serializable? ``` class FileItem: def __init__(self, fname): self.fname = fname ``` Attempt to serialize to JSON: ``` >>> import json >>> x = FileItem('/foo/bar...

9 Apr at 10:18

How do I create an Excel (.XLS and .XLSX) file in C# without installing Microsoft Office?

How can I create an Excel spreadsheet with C# without requiring Excel to be installed on the machine that's running the code?

7 Oct at 13:30

How To Auto-Format / Indent XML/HTML in Notepad++

Is there a way to re-indent a block of code? I'm looking for something similar to ++ in Eclipse (Auto-Format/Indent). To be clear, - - - I already know about NppAutoIndent - it won't work, as I'm...

performing HTTP requests with cURL (using PROXY)

I have this proxy address: `125.119.175.48:8909` How can I perform a HTTP request using cURL like `curl http://www.example.com`, but specifying the proxy address of my network?

22 Aug at 20:27

How to get the URL of the current page in C#

Can anyone help out me in getting the URL of the current working page of ASP.NET in C#?

3 Nov at 21:40

How to filter object array based on attributes?

I have the following JavaScript array of real estate home objects: ``` var json = { 'homes': [{ "home_id": "1", "price": "925", "sqft": "1100", "nu...

21 Apr at 14:50

How do I programmatically set the value of a select box element using JavaScript?

I have the following HTML `<select>` element: ``` <select id="leaveCode" name="leaveCode"> <option value="10">Annual Leave</option> <option value="11">Medical Leave</option> <option value="14">...

23 Jul at 11:41

Refresh a page using PHP

How can I refresh a page using PHP periodically? If I can not do it by PHP, what is the best recommended scenario?

16 Jul at 04:36

Split string with multiple delimiters in Python

I found some answers online, but I have no experience with regular expressions, which I believe is what is needed here. I have a string that needs to be split by either a ';' or ', ' That is, it has ...

31 Dec at 05:54

Node.js version on the command line? (not the REPL)

I want to get the version of Node.js on the command line. I'm expecting to run a command like: ``` node -version ``` but that doesn't work. Does anybody know what the command line would be? (i.e. n...

28 Feb at 11:57

Bat file to run a .exe at the command prompt

I want to create a .bat file so I can just click on it so it can run: ``` svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config http://localhost:8000/ServiceModelSamples/service ``` Ca...

8 Mar at 20:22

Finding and replacing elements in a list

I have to search through a list and replace all occurrences of one element with another. So far my attempts in code are getting me nowhere, what is the best way to do this? For example, suppose my li...

19 Aug at 23:8

How do I wait for a pressed key?

How do I make my python script wait until the user presses any key?

17 Jul at 06:41

Random string generation with upper case letters and digits

How do I generate a string of size N, made of numbers and uppercase English letters such as: - - -

13 Jun at 01:39

"Unicode Error "unicodeescape" codec can't decode bytes... Cannot open text files in Python 3

I am using Python 3.1 on a Windows 7 machine. Russian is the default system language, and utf-8 is the default encoding. Looking at the answer to a [previous question](https://stackoverflow.com/questi...

27 Dec at 17:48

$(document).ready equivalent without jQuery

I have a script that uses `$(document).ready`, but it doesn't use anything else from jQuery. I'd like to lighten it up by removing the jQuery dependency. How can I implement my own `$(document).ready...

20 Aug at 20:39

How to check if type of a variable is string?

Is there a way to check if the type of a variable in python is a `string`, like: ``` isinstance(x,int); ``` for integer values?

19 Apr at 17:47

How do I register a DLL file on Windows 7 64-bit?

I have tried to use the following code: ``` cd c:\windows\system32 regsvr32.exe dllname.ax ``` But this is not working for me. How can I register a DLL file on Windows 7 with a 64-bit processor?

Access Denied for User 'root'@'localhost' (using password: YES) - No Privileges?

I am continuously receiving this error. I am using mySQL Workbench and from what I am finding is that root's schema privileges are null. There are no privileges at all. I am having troubles across p...

23 Jul at 09:40

Responsive font size in CSS

I've created a site using the grid. Each page has a large `h1`: ``` body { font-size: 100% } /* Headers */ h1 { font-size: 6.2em; font-weight: 500; } ``` ``` <div class="row"> <div class="...

Get difference between 2 dates in JavaScript?

How do I get the difference between 2 dates in full days (I don't want any fractions of a day) ``` var date1 = new Date('7/11/2010'); var date2 = new Date('12/12/2010'); var diffDays = date2.getDate(...

23 Jul at 11:54