Questions

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...

How can I remove an SSH key?

I currently have an old SSH key uploaded on a server. The problem is I lost my `~/.ssh` directory (with the original `id_rsa` and `id_rsa.pub` files). Consequently, I want to remove the old SSH key di...

23 Aug at 17:13

How can I use Guzzle to send a POST request in JSON?

Does anybody know the correct way to `post` JSON using `Guzzle`? ``` $request = $this->client->post(self::URL_REGISTER,array( 'content-type' => 'application/json' ),array(json...

6 Sep at 12:17

How can I make a clickable link in an NSAttributedString?

It's trivial to make hyperlinks clickable in a `UITextView`. You just set the "detect links" checkbox on the view in IB, and it detects HTTP links and turns them into hyperlinks. However, that still...

Download JSON object as a file from browser

I have the following code to let users download data strings in csv file. ``` exportData = 'data:text/csv;charset=utf-8,'; exportData += 'some csv strings'; encodedUri = encodeURI(exportData); newWin...

23 May at 11:47

How to hide iOS status bar

In my iOS video app status bar is hidden in some view controllers. I have done this using following code. ``` [[UIApplication sharedApplication] setStatusBarHidden:YES]; ``` - It works for iOS 5 an...

24 Mar at 09:42

Video auto play is not working in Safari and Chrome desktop browser

I spent quite a lot of time trying to figure out why video embedded like here: ``` <video height="256" loop autoplay muted controls id="vid"> <source type="video/mp4" src="video_file.mp4"></...

how to change directory using Windows command line

I'm using `cmd.exe` (C:\WINDOWS\System32\cmd.exe) and I have to change my current directory to "D:\temp" i.e. temp folder in the D drive. When I try to `cd` nothing happens. ``` C:\> cd D:\temp C:\...

'Java' is not recognized as an internal or external command

When trying to check the current version of Java in which I am running, I received the error "java is not recognized as an internal or external command, operable program or batch file.". I am running ...

29 Sep at 16:28

angular ng-repeat in reverse

How can i get a reversed array in angular? i'm trying to use orderBy filter, but it needs a predicate(e.g. 'name') to sort: ``` <tr ng-repeat="friend in friends | orderBy:'name':true"> <td>{{fr...

PostgreSQL ERROR: canceling statement due to conflict with recovery

I'm getting the following error when running a query on a PostgreSQL db in standby mode. The query that causes the error works fine for 1 month but when you query for more than 1 month an error result...

11 Nov at 16:11

Why use HttpClient for Synchronous Connection

I am building a class library to interact with an API. I need to call the API and process the XML response. I can see the benefits of using `HttpClient` for Asynchronous connectivity, but what I am do...

7 Nov at 09:11

How to 'bulk update' with Django?

I'd like to update a table with Django - something like this in raw SQL: ``` update tbl_name set name = 'foo' where name = 'bar' ``` My first result is something like this - but that's nasty, isn't...

30 Sep at 12:30

Count the number of occurrences of a string in a VARCHAR field?

I have a table like this: | TITLE | DESCRIPTION | | ----- | ----------- | | test1 | value blah blah value | | test2 | value test | | test3 | test test test | | test4 | valuevaluevaluevaluevalue ...

2 Mar at 15:5

Python Flask, how to set content type

I am using Flask and I return an XML file from a get request. How do I set the content type to xml ? e.g. ``` @app.route('/ajax_ddl') def ajax_ddl(): xml = 'foo' header("Content-type: text/x...

3 Sep at 14:2

Angularjs - ng-cloak/ng-show elements blink

I have an issue in angular.js with directive/class `ng-cloak` or `ng-show`. Chrome works fine, but Firefox is causing blink of elements with `ng-cloak` or `ng-show`. IMHO it's caused by the convertin...

24 Dec at 04:1

Find which commit is currently checked out in Git

I'm in the middle of a `git bisect` session. What's the command to find out which commit (SHA1 hash) I am currently on? `git status` does not provide this. Edit: I guess calling `git log` and look...

17 Jan at 04:44

How do I force git pull to overwrite everything on every pull?

I have a CENTRAL bare repository that has three developer repositories pulling and pushing to it normally. I also have two other repositories that pull from the CENTRAL bare repo: one is the live ser...

31 May at 09:28

Separating class code into a header and cpp file

I am confused on how to separate implementation and declarations code of a simple class into a new header and cpp file. For example, how would I separate the code for the following class? ``` class A...

27 Jan at 20:0

How to install python modules without root access?

I'm taking some university classes and have been given an 'instructional account', which is a school account I can ssh into to do work. I want to run my computationally intensive Numpy, matplotlib, sc...

19 Sep at 00:44

SVG: text inside rect

I want to display some text SVG `rect`. Is it possible? I tried ``` <svg xmlns="http://www.w3.org/2000/svg"> <g> <rect x="0" y="0" width="100" height="100" fill="red"> <text x="0" y="1...

16 Mar at 17:28

reducing number of plot ticks

I have too many ticks on my graph and they are running into each other. How can I reduce the number of ticks? For example, I have ticks: ``` 1E-6, 1E-5, 1E-4, ... 1E6, 1E7 ``` And I only want: ...

13 Feb at 00:3

RegEx to extract all matches from string using RegExp.exec

I'm trying to parse the following kind of string: ``` [key:"val" key2:"val2"] ``` where there are arbitrary key:"val" pairs inside. I want to grab the key name and the value. For those curious I'm...

Testing whether a value is odd or even

I decided to create simple and function with a very simple algorithm: ``` function isEven(n) { n = Number(n); return n === 0 || !!(n && !(n%2)); } function isOdd(n) { return isEven(Number(n)...

13 Aug at 09:7

What does upstream mean in nginx?

``` upstream app_front_static { server 192.168.206.105:80; } ``` Never seen it before, anyone knows, what it means?

17 Feb at 16:1