Questions

urlencode vs rawurlencode?

If I want to create a URL using a variable I have two choices to encode the string. `urlencode()` and `rawurlencode()`. What exactly are the differences and which is preferred?

30 Nov at 14:26

Best way to format integer as string with leading zeros?

I need to add leading zeros to integer to make a string with defined quantity of digits ($cnt). What the best way to translate this simple function from PHP to Python: ``` function add_nulls($int, $c...

9 Apr at 11:58

How to convert an ArrayList containing Integers to primitive int array?

I'm trying to convert an ArrayList containing Integer objects to primitive int[] with the following piece of code, but it is throwing compile time error. Is it possible to convert in Java? ``` List<I...

28 Jul at 13:57

CSS Display an Image Resized and Cropped

I want to show an image from an URL with a certain width and height even if it has a different size ratio. So I want to resize (maintaining the ratio) and then cut the image to the size I want. I ca...

7 Jun at 15:3

Real differences between "java -server" and "java -client"?

Is there any real practical difference between "java -server" and "java -client"? All I can find on Sun's site is a vague > "-server starts slower but should run faster". What are the real dif...

23 Mar at 07:38

What's the effect of adding 'return false' to a click event listener?

Many times I've seen links like these in HTML pages: ``` <a href='#' onclick='someFunc(3.1415926); return false;'>Click here !</a> ``` What's the effect of the `return false` in there? Also, I don...

28 Nov at 22:55

How to read AppSettings values from a .json file in ASP.NET Core

I have set up my AppSettings data in file appsettings/Config .json like this: ``` { "AppSettings": { "token": "1234" } } ``` I have searched online on how to read AppSettings values f...

Get class name of object as string in Swift

Getting the classname of an object as `String` using: ``` object_getClassName(myViewController) ``` returns something like this: ``` _TtC5AppName22CalendarViewController ``` I am looking for the...

8 Jun at 19:47

ASP.NET Identity - HttpContext has no extension method for GetOwinContext

I have downloaded, and successfully ran the ASP.NET Identity sample from here: [https://github.com/rustd/AspnetIdentitySample](https://github.com/rustd/AspnetIdentitySample) I am now in the middle of...

When correctly use Task.Run and when just async-await

I would like to ask you on your opinion about the correct architecture when to use `Task.Run`. I am experiencing laggy UI in our WPF .NET 4.5 application (with Caliburn Micro framework). Basically I ...

20 Jul at 18:35

Python 3: ImportError "No Module named Setuptools"

I'm having troubles with installing packages in Python 3. I have always installed packages with `setup.py install`. But now, when I try to install the ansicolors package I get: ``` importerror "No Mod...

How to style icon color, size, and shadow of FontAwesome Icons

How could I style the color, size and shadow of icons from [FontAwesome's Icons](http://fortawesome.github.com/Font-Awesome/#overview)? For example, [FontAwesome's site](http://fortawesome.github.com/...

What's the difference between process.cwd() vs __dirname?

What's the difference between ``` console.log(process.cwd()) ``` and ``` console.log(__dirname); ``` I've seen both used in similar contexts.

27 Jun at 09:0

How to call getClass() from a static method in Java?

I have a class that must have some static methods. Inside these static methods I need to call the method getClass() to make the following call: ``` public static void startMusic() { URL songPath = ...

1 Aug at 16:51

How do I rename a repository on GitHub?

I wanted to rename one of my repositories on GitHub, but I got scared when a big red warning said: > 1. We will not set up any redirects from the old location 2. You will need to update your local r...

3 Mar at 23:40

Calculate the date yesterday in JavaScript

How can I calculate as a date in JavaScript?

22 Dec at 02:48

CSS :not(:last-child):after selector

I have a list of elements, which are styled like this: ``` ul { list-style-type: none; text-align: center; } li { display: inline; } li:not(:last-child):after { content:' |'; } ``` ...

20 Jan at 22:7

How to retrieve GET parameters from JavaScript

Consider: ``` http://example.com/page.html?returnurl=%2Fadmin ``` For `js` within `page.html`, how can it retrieve `GET` parameters? For the above simple example, `func('returnurl')` should be `/admi...

8 Oct at 21:2

Test iOS app on device without apple developer program or jailbreak

How can I test an iOS application on my iPod Touch without registering for the Apple Developer Program or jailbreaking my iPod? Neither is a viable option at the moment. I'd like to test on the devi...

24 Apr at 14:48

When to use AtomicReference in Java?

When do we use [AtomicReference](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/concurrent/atomic/AtomicReference.html)? Is it needed to create objects in all multithreaded pr...

12 May at 15:54

How can I get the latest JRE / JDK as a zip file rather than EXE or MSI installer?

I like to be sure that everything will work just by copying the contents of the Java folder and setting the environment variables. I usually run the installer in a virtual machine, zip the \java folde...

20 Jun at 09:12

How to remove the hash from window.location (URL) with JavaScript without page refresh?

I have URL like: `http://example.com#something`, how do I remove `#something`, without causing the page to refresh? I attempted the following solution: ``` window.location.hash = ''; ``` `#`

Convert Linq Query Result to Dictionary

I want to add some rows to a database using Linq to SQL, but I want to make a "custom check" before adding the rows to know if I must add, replace or ignore the incomming rows. I'd like to keep the tr...

4 Jan at 09:38

Total number of items defined in an enum

How can I get the number of items defined in an enum?

26 Nov at 01:4

UITableView - scroll to the top

In my table view I have to scroll to the top. But I cannot guarantee that the first object is going to be section 0, row 0. May be that my table view will start from section number 5. So I get an exc...

3 Aug at 05:43