How can I convert an int to a string in C?
How do you convert an `int` (integer) to a string? I'm trying to make a function that converts the data of a `struct` into a string to save it in a file.
How to open a file for both reading and writing?
Is there a way to open a file for both reading and writing? As a workaround, I open the file for writing, close it, then open it again for reading. But is there a way to open a file for reading and ...
What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it?
What does `ArrayIndexOutOfBoundsException` mean and how do I get rid of it? Here is a code sample that triggers the exception: ``` String[] names = { "tom", "bob", "harry" }; for (int i = 0; i <= n...
- Modified
- 7 May at 11:54
How do I use valgrind to find memory leaks?
How do I use valgrind to find the memory leaks in a program? Please someone help me and describe the steps to carryout the procedure? I am using Ubuntu 10.04 and I have a program `a.c`, please help ...
Formatting Decimal places in R
I have a number, for example 1.128347132904321674821 that I would like to show as only two decimal places when output to screen (or written to a file). How does one do that? ``` x <- 1.1283471329043...
- Modified
- 17 Sep at 19:23
Best way to replace multiple characters in a string?
I need to replace some characters as follows: `&` ➔ `\&`, `#` ➔ `\#`, ... I coded as follows, but I guess there should be some better way. Any hints? ``` strs = strs.replace('&', '\&') strs = strs.r...
How do I increase the capacity of the Eclipse output console?
Even with the "scroll lock" option enabled for the Eclipse console, eventually it overfills and starts auto-scrolling on me. Is there some way of increasing the capacity of the console so that it st...
How do I get formatted JSON in .NET using C#?
I am using .NET JSON parser and would like to serialize my config file so it is readable. So instead of: ``` {"blah":"v", "blah2":"v2"} ``` I would like something nicer like: ``` { "blah":"v", ...
- Modified
- 10 May at 10:0
How good is Java's UUID.randomUUID?
I know that randomized [UUIDs](https://en.wikipedia.org/wiki/Universally_unique_identifier) have a very, very, very low probability for collision in theory, but I am wondering, in practice, how good J...
How to resize an Image C#
As `Size`, `Width` and `Height` are `Get()` properties of `System.Drawing.Image`; How can I resize an Image object at run-time in C#? Right now, I am just creating a new `Image` using: ``` // objIma...
convert a char* to std::string
I need to use an `std::string` to store data retrieved by `fgets()`. To do this I need to convert the `char*` return value from `fgets()` into an `std::string` to store in an array. How can this be do...
Best way to convert an ArrayList to a string
I have an `ArrayList` that I want to output completely as a String. Essentially I want to output it in order using the `toString` of each element separated by tabs. Is there any fast way to do this? Y...
Setting up foreign keys in phpMyAdmin?
I'm setting up a database using phpMyAdmin. I have two tables (`foo` and `bar`), . I am trying to create a relational table (`foo_bar`) between them, using their primary keys as foreign keys. I create...
- Modified
- 20 Jun at 09:12
How to use unicode characters in Windows command line?
We have a project in Team Foundation Server (TFS) that has a non-English character (š) in it. When trying to script a few build-related things we've stumbled upon a problem - we can't pass the letter...
- Modified
- 22 Dec at 09:6
How to allow access outside localhost
How can I allow access outside the localhost at Angular2? I can navigate at `localhost:3030/panel` easily but I can not navigate when I write my IP such as `10.123.14.12:3030/panel/`. Could you plea...
- Modified
- 30 Jan at 13:23
convert:not authorized `aaaa` @ error/constitute.c/ReadImage/453
I want to create a captcha pic by use `convert` from ImageMagick. And I follow [this](http://www.grant-trebbin.com/2014/02/generating-captcha-from-linux-command.html), but there are some problem . I...
- Modified
- 11 Oct at 11:33
How to add icons to React Native app
I am making a React Native app. I would like to customize the app icon (meaning the icon that you click on to start the app). I have Googled this, but I keep finding different types of icons that refe...
- Modified
- 6 Oct at 15:37
Is it possible to import modules from all files in a directory, using a wildcard?
With ES6, I can import several exports from a file like this: ``` import {ThingA, ThingB, ThingC} from 'lib/things'; ``` However, I like the organization of having one module per file. I end up wit...
- Modified
- 23 Aug at 02:22
How can I switch my signed in user in Visual Studio 2013?
A new feature of Visual Studio 2013 is the ability to sign in with a Microsoft Account and have your settings be persisted across all of your instances of Visual Studio, amongst other things. When I ...
- Modified
- 23 Oct at 13:12
Parse a URI String into Name-Value Collection
I've got the URI like this: ``` https://google.com.ua/oauth/authorize?client_id=SS&response_type=code&scope=N_FULL&access_type=offline&redirect_uri=http://localhost/Callback ``` I need a collection w...
- Modified
- 8 Dec at 11:54
How to get a string after a specific substring?
How can I get a string after a specific substring? For example, I want to get the string after `"world"` in ``` my_string="hello python world, I'm a beginner" ``` ...which in this case is: `", I'm a ...
How to check whether a string is a valid HTTP URL?
There are the [Uri.IsWellFormedUriString](https://msdn.microsoft.com/en-us/library/system.uri.iswellformeduristring(v=vs.110).aspx) and [Uri.TryCreate](http://msdn.microsoft.com/en-us/library/ms131572...
- Modified
- 16 Oct at 13:37
Get a random boolean in python?
I am looking for the best way (fast and elegant) to get a random boolean in python (flip a coin). For the moment I am using `random.randint(0, 1)` or `random.getrandbits(1)`. Are there better choice...
How to find the width of a div using vanilla JavaScript?
How do you find the current width of a `<div>` in a cross-browser compatible way using a library like jQuery?
- Modified
- 24 May at 17:34
Mockito. Verify method arguments
I've googled about this, but didn't find anything relevant. I've got something like this: ``` Object obj = getObject(); Mockeable mock= Mockito.mock(Mockeable.class); Mockito.when(mock.mymethod(obj )...
- Modified
- 1 Jul at 16:12