How to get the current directory in a C program?
I'm making a C program where I need to get the directory that the program is started from. This program is written for UNIX computers. I've been looking at `opendir()` and `telldir()`, but `telldir()...
- Modified
- 28 Nov at 13:28
JavaScript implementation of Gzip
I'm writing a Web application that needs to store JSON data in a small, fixed-size server-side cache via AJAX (think: [Opensocial quotas](http://code.google.com/apis/opensocial/articles/persistence-0....
- Modified
- 27 Oct at 18:49
Add spaces before Capital Letters
Given the string "ThisStringHasNoSpacesButItDoesHaveCapitals" what is the best way to add spaces before the capital letters. So the end string would be "This String Has No Spaces But It Does Have Capi...
Initializing C# auto-properties
I'm used to writing classes like this: ``` public class foo { private string mBar = "bar"; public string Bar { get { return mBar; } set { mBar = value; } } //... other methods, no con...
- Modified
- 3 Oct at 23:50
Has an event handler already been added?
Is there a way to tell if an event handler has been added to an object? I'm serializing a list of objects into/out of session state so we can use SQL based session state... When an object in the list...
How can I mock the JavaScript 'window' object using Jest?
I need to test a function which opens a new tab in the browser ``` openStatementsReport(contactIds) { window.open(`a_url_${contactIds}`); } ``` I would like to mock 's `open` function, so I can ver...
- Modified
- 4 Aug at 21:6
Nuget connection attempt failed "Unable to load the service index for source"
While trying to connect to Nuget, I'm getting the error below, and then I am unable to connect: > [nuget.org] Unable to load the service index for source [https://api.nuget.org/v3/index.json](https://...
- Modified
- 24 Jun at 14:54
How can I prevent event bubbling in nested React components on click?
Here's a basic component. Both the `<ul>` and `<li>` have onClick functions. I want only the onClick on the `<li>` to fire, not the `<ul>`. How can I achieve this? I've played around with e.preventDe...
- Modified
- 11 Mar at 17:43
Convert string to date in Swift
How can I convert this string `"2016-04-14T10:44:00+0000"` into an `NSDate` and keep only the year, month, day, hour? The `T` in the middle of it really throws off what I am used to when working with...
- Modified
- 29 Dec at 07:48
How can I capitalize the first letter of each word in a string using JavaScript?
I'm trying to write a function that capitalizes the first letter of every word in a string (converting the string to title case). For instance, when the input is `"I'm a little tea pot"`, I expect `"I...
- Modified
- 29 Jul at 00:33
What does "The code generator has deoptimised the styling of [some file] as it exceeds the max of "100KB"" mean?
I added a new npm package to my project and require it in one of my modules. Now I get this message from webpack, `build modulesNote: The code generator has deoptimised the styling of "D:/path/to/pr...
How to delete a record by id in Flask-SQLAlchemy
I have `users` table in my MySql database. This table has `id`, `name` and `age` fields. How can I delete some record by `id`? Now I use the following code: ``` user = User.query.get(id) db.session...
- Modified
- 27 Aug at 12:5
How to get a unique device ID in Swift?
How can I get a device's unique ID in Swift? I need an ID to use in the database and as the API-key for my web service in my social app. Something to keep track of this devices daily use and limit its...
- Modified
- 25 Mar at 20:44
Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?
I am getting an interesting error while trying to use `Unpickler.load()`, here is the source code: ``` open(target, 'a').close() scores = {}; with open(target, "rb") as file: unpickler = pickle.U...
Resource interpreted as stylesheet but transferred with MIME type text/html (seems not related with web server)
I have this problem. Chrome continues to return this error > Resource interpreted as stylesheet but transferred with MIME type text/html The files affected by this error are just the Style, chosen ...
- Modified
- 20 Apr at 21:41
Setting PATH environment variable in OSX permanently
I have read several answers on how to set environment variables on OSX permanently. First, I tried this, [How to permanently set $PATH on Linux/Unix](https://stackoverflow.com/questions/14637979/how-t...
- Modified
- 3 Jul at 16:57
NodeJS - Error installing with NPM
``` Microsoft Windows [Version 6.3.9600] (c) 2013 Microsoft Corporation. All rights reserved. C:\Windows\system32>npm install caress-server npm http GET https://registry.npmjs.org/caress-server npm h...
How do I use installed packages in PyCharm?
In , I've added the Python environment `/usr/bin/python`. However, ``` from gnuradio import gr ``` fails as an . However, it works fine in the Python interpreter from the command line. GNURadio w...
Laravel Redirect Back with() Message
I am trying to redirect to the previous page with a message when there is a fatal error. ``` App::fatal(function($exception) { return Redirect::back()->with('msg', 'The Message'); } ``` In the ...
How to specify an element after which to wrap in css flexbox?
I don't think this is part of the flexbox standard yet, but is there maybe a trick to suggest or force wrapping after a certain element? I'd like to respond to different page sizes and wrap a list dif...
Java Regex Capturing Groups
I am trying to understand this code block. In the first one, what is it we are looking for in the expression? My understanding is that it is any character (0 or more times *) followed by any number b...
How to join two sets in one line without using "|"
Assume that `S` and `T` are assigned sets. Without using the join operator `|`, how can I find the union of the two sets? This, for example, finds the intersection: ``` S = {1, 2, 3, 4} T = {3, 4, 5...
Concatenate multiple result rows of one column into one, group by another column
I'm having a table like this ``` Movie Actor A 1 A 2 A 3 B 4 ``` I want to get the name of a movie and all actors in that movie, and I want the result to be in ...
- Modified
- 25 Nov at 09:24
Sort a list from another list IDs
I have a list with some identifiers like this: ``` List<long> docIds = new List<long>() { 6, 1, 4, 7, 2 }; ``` Morover, I have another list of `<T>` items, which are represented by the ids describe...
- Modified
- 24 Jan at 14:58
Rails: How to reference images in CSS within Rails 4
There's a strange issue with Rails 4 on Heroku. When images are compiled they have hashes added to them, yet the reference to those files from within CSS don't have the proper name adjusted. Here's ...
- Modified
- 13 Aug at 21:26