Questions

PHP function to make slug (URL string)

I want to have a function to create slugs from Unicode strings, e.g. `gen_slug('Andrés Cortez')` should return `andres-cortez`. How should I do that?

10 Jun at 09:42

HTTP Request in Swift with POST method

I'm trying to run a HTTP Request in Swift, to POST 2 parameters to a URL. Example: Link: `www.thisismylink.com/postName.php` Params: ``` id = 13 name = Jack ``` What is the simplest way to do th...

Getting visitors country from their IP

I want to get visitors country via their IP... Right now I'm using this ([http://api.hostip.info/country.php?ip=](http://api.hostip.info/country.php?ip=)...... ) Here is my code: ``` <?php if (isse...

15 Oct at 09:41

How to use an array list in Java?

I need to know if I store my data in an ArrayList and I need to get the value that I've stored in it. For example : if I have an array list like this ``` ArrayList A = new ArrayList(); A = {"...

30 May at 09:37

Compiler error: "class, interface, or enum expected"

I have been troubleshooting this program for hours, trying several configurations, and have had no luck. It has been written in java, and has 33 errors (lowered from 50 before) Source Code: ``` /*Th...

9 Oct at 15:49

Iterating over result of getElementsByClassName using Array.forEach

I want to iterate over some DOM elements, I'm doing this: ``` document.getElementsByClassName( "myclass" ).forEach( function(element, index, array) { //do stuff }); ``` but I get an error: > doc...

Detect the Internet connection is offline?

How to detect the Internet connection is offline in JavaScript?

Set today's date as default date in jQuery UI datepicker

I just want today's date to be the default value in the input that is using jQuery UI's `datepicker`: ``` <input id="mydate" type="text" /> ``` I tried the below code but it didn't work: ``` var ...

Android Log.v(), Log.d(), Log.i(), Log.w(), Log.e() - When to use each one?

The different `LogCat` methods are: ``` Log.v(); // Verbose Log.d(); // Debug Log.i(); // Info Log.w(); // Warning Log.e(); // Error ``` What are the appropriate situations to use each type of Logg...

21 May at 14:41

Is there a JavaScript / jQuery DOM change listener?

Essentially I want to have a script execute when the contents of a `DIV` change. Since the scripts are separate (content script in the Chrome extension & webpage script), I need a way simply observe c...

How do I run Visual Studio as an administrator by default?

I recently discovered that even while logged into my personal laptop as an administrator, Visual Studio does not run in administrator mode and you need to explicitly use . Is there a way to make it r...

How to fix Hibernate LazyInitializationException: failed to lazily initialize a collection of roles, could not initialize proxy - no Session

In the custom AuthenticationProvider from my spring project, I am trying read the list of authorities of the logged user, but I am facing the following error: ``` org.hibernate.LazyInitializationExce...

Keyboard shortcut to paste clipboard content into command prompt window (Win XP)

Is there a keyboard shortcut for pasting the content of the clipboard into a command prompt window on Windows XP (instead of using the right mouse button)? The typical + does not seem to work here.

6 Feb at 07:14

Echo off but messages are displayed

I turned off echo in bat file. ``` @echo off ``` then I do something like this ``` ... echo %INSTALL_PATH% if exist %INSTALL_PATH%( echo 222 ... ) ``` and I get: > The system cannot find the pa...

19 Sep at 16:57

Fetch: reject promise and catch the error if status is not OK?

Here's what I have going: ``` import 'whatwg-fetch'; function fetchVehicle(id) { return dispatch => { return dispatch({ type: 'FETCH_VEHICLE', payload: fetch(`htt...

7 Jul at 01:16

How to declare Return Types for Functions in TypeScript

I checked here [https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md) which is the [TypeScript Language Specifications](http...

29 Sep at 10:0

How to convert string to byte array in Python

Say that I have a 4 character string, and I want to convert this string into a byte array where each character in the string is translated into its hex equivalent. e.g. ``` str = "ABCD" ``` I'm try...

13 Mar at 09:21

Messagebox with input field

Is it possible to show (pop-up) a message box with an input field in it, possibly a text box? Is somewhere in the language or the framework?

1 Apr at 19:30

Adding IN clause List to a JPA Query

I have built a NamedQuery that looks like this: ``` @NamedQuery(name = "EventLog.viewDatesInclude", query = "SELECT el FROM EventLog el WHERE el.timeMark >= :dateFrom AND " + "el.time...

7 Nov at 13:4

Concatenate a list of pandas dataframes together

I have a list of Pandas dataframes that I would like to combine into one Pandas dataframe. I am using Python 2.7.10 and Pandas 0.16.2 I created the list of dataframes from: ``` import pandas as pd ...

Int to Char in C#

What is the best way to convert an Int value to the corresponding Char in Utf16, given that the Int is in the range of valid values?

22 Feb at 06:13

Animate an element's width from 0 to 100%, with it and it's wrapper being only as wide as they need to be, without a pre-set width, in CSS3 or jQuery

[http://jsfiddle.net/nicktheandroid/tVHYg/](http://jsfiddle.net/nicktheandroid/tVHYg/) When hovering `.wrapper`, it's child element `.contents` should animate from `0px` to it's natural width. Then w...

30 May at 12:6

Converting a sentence string to a string array of words in Java

I need my Java program to take a string like: ``` "This is a sample sentence." ``` and turn it into a string array like: ``` {"this","is","a","sample","sentence"} ``` No periods, or punctuation ...

10 Dec at 15:18

In C++, what is a virtual base class?

I want to know what a "" is and what it means. Let me show an example: ``` class Foo { public: void DoSomething() { /* ... */ } }; class Bar : public virtual Foo { public: void DoSpecific()...

1 Mar at 13:37

Image comparison - fast algorithm

I'm looking to create a base table of images and then compare any new images against that to determine if the new image is an exact (or close) duplicate of the base. For example: if you want to reduc...