How to make HTTP Post request with JSON body in Swift?
I'm trying to make an HTTP post request with a JSON body : How to be able to add an NSdictionnary to the HTTP request body. Here is my code, it doesn't seem to work properly. ``` var entry1 = Response...
Prime number check acts strange
I have been trying to write a program that will take an imputed number, and check and see if it is a prime number. The code that I have made so far works perfectly if the number is in fact a prime nu...
retrieve data from db and display it in table in php .. see this code whats wrong with it?
``` $db = mysql_connect("localhost", "root", ""); $er = mysql_select_db("ram"); $query = "insert into names values('$name','$add1','$add2','$mail')"; $result = mysql_query($query); print "<p> ...
What is the OR operator in an IF statement
In C#, how do I specify OR: ``` if(this OR that) {do the other thing} ``` I couldn't find it in the help. My code is: ``` if (title == "User greeting" || "User name") {do stuff} ``` and my er...
- Modified
- 2 Feb at 17:5
Best implementation for hashCode method for a collection
How do we decide on the best implementation of `hashCode()` method for a collection (assuming that equals method has been overridden correctly) ?
Create text file and fill it using bash
I need to create a text file (unless it already exists) and write a new line to the file all using bash. I'm sure it's simple, but could anyone explain this to me?
Table overflowing outside of div
I'm trying to stop a table that has width explicitly declared from overflowing outside of its parent `div`. I presume I can do this in some way using `max-width`, but I can't seem to get this working....
- Modified
- 9 Jul at 19:17
Print debugging info from stored procedure in MySQL
Is there a way in MySQL to print debugging messages to stdout, temptable or logfile? Something like: - `print`- `DBMS_OUTPUT.PUT_LINE`
How to get resources directory path programmatically
I have the following directory layout: > - - - - - - - Within a ServletContextListener class, I want to access the files under the SQL directory and list them. Basically my problem is with the pa...
Asyncio.gather vs asyncio.wait
[asyncio.gather](https://docs.python.org/3/library/asyncio-task.html#asyncio.gather) and [asyncio.wait](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait) seem to have similar uses: I h...
- Modified
- 1 Aug at 15:48
Fetch API request timeout?
I have a `fetch-api` `POST` request: ``` fetch(url, { method: 'POST', body: formData, credentials: 'include' }) ``` I want to know what is the default timeout for this? and how can we set it to...
- Modified
- 9 Jul at 11:39
How to implement a binary tree?
Which is the best data structure that can be used to implement a binary tree in Python?
- Modified
- 11 Aug at 06:50
How do I represent a time only value in .NET?
Is there a way one can represent a time only value in .NET without the date? For example, indicating the opening time of a shop? `TimeSpan` indicates a range, whereas I only want to store a time valu...
multiple packages in context:component-scan, spring config
How can I add multiple packages in spring-servlet.xml file in `context:component-scan` element? I have tried ``` <context:component-scan base-package="z.y.z.service" base-package="x.y.z.controller" ...
- Modified
- 14 Jun at 08:38
Failed to authenticate on SMTP server error using gmail
I'm trying to set up email for my first laravel project, and was thrilled that there's a laracast for it: [https://laracasts.com/lessons/mailers](https://laracasts.com/lessons/mailers) I've followed...
- Modified
- 26 Nov at 13:9
Where does Anaconda Python install on Windows?
I installed Anaconda for Python 2.7 on my Windows machine and wanted to add the Anaconda interpreter to PyDev, but quick googling couldn't find the default place where Anaconda installed, and searchin...
How to delete cookies on an ASP.NET website
In my website when the user clicks on the "Logout" button, the Logout.aspx page loads with code `Session.Clear()`. In ASP.NET/C#, does this clear all cookies? Or is there any other code that needs to...
- Modified
- 12 Jan at 23:50
Java Array, Finding Duplicates
I have an array, and am looking for duplicates. ``` duplicates = false; for(j = 0; j < zipcodeList.length; j++){ for(k = 0; k < zipcodeList.length; k++){ if (zipcodeList[k] == zipcodeList...
Simple proof that GUID is not unique
I'd like to prove that a GUID is not unique in a simple test program. I expected the following code to run for hours, but it's not working. How can I make it work? ``` BigInteger begin = new BigInteg...
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...
- Modified
- 4 Jul at 15:43
How to use NSURLConnection to connect with SSL for an untrusted cert?
I have the following simple code to connect to a SSL webpage ``` NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:url]; [ NSURLConnection sendSynchronousRequest: urlRequest returni...
- Modified
- 12 Sep at 15:53
Is it possible to declare a public variable in vba and assign a default value?
I want to do this but it won't compile: ``` Public MyVariable as Integer = 123 ``` What's the best way of achieving this?
- Modified
- 2 Apr at 18:9
Fatal error: unexpectedly found nil while unwrapping an Optional values
I was using an `UICollectionView` in Swift but I get when I try to change the text of the cell's label. ``` func collectionView(collectionView: UICollectionView!, numberOfItemsInSection section: In...
- Modified
- 23 Jan at 07:43
How to list all the files in android phone by using adb shell?
I just try to write a bash shell for my Android Phone. When I want list all the files in my Android Phone. I found that the Android shell terminal doesn't support `find` command. So I just want to kno...