Skip to content

Latest commit

 

History

History
97 lines (43 loc) · 4.92 KB

2017-11-12.md

File metadata and controls

97 lines (43 loc) · 4.92 KB

Trending in Stackoverflow

See what the Stackoverflow community is most excited about today.

Date: 2017-11-12

  1. Why is this C++ code faster than my hand-written assembly for testing the Collatz conjecture?

    tags: c++, performance, assembly, optimization, x86

    671 votes, 11 answers and 114488 views

    \r\n I wrote these two solutions for Project Euler Q14, in assembly and in C++. They are the same identical brute force approach for testing the Collatz conjecture. The assembly solution was assembled with\n...\r\n

  2. How do I delete (unset) an exported environment variable?

    tags: linux, environment-variables, unset

    967 votes, 3 answers and 547486 views

    \r\n Before installing gnuplot I set the environment variable GNUPLOT_DRIVER_DIR = /home/gnuplot/build/src.\n\nDuring the installation something went wrong; now I want to remove the GNUPLOT_DRIVER_DIR ...\r\n

  3. postgres: upgrade a user to be a superuser?

    tags: sql, postgresql

    462 votes, 5 answers and 200111 views

    \r\n In postgres, how do I change an existing user to be a superuser? I don't want to delete the existing user, for various reasons. \n\n# alter user myuser ...?\r\n

  4. What is the difference between <%, <%=, <%# and -%> in ERB in Rails?

    tags: ruby-on-rails, ruby, templates, erb

    266 votes, 5 answers and 65659 views

    \r\n Can some one please describe the usage of the following characters which is used in ERB file:\n\n<% %>\n<%= %>\n<% -%>\n<%# %>\r\nwhat's the usage of each one ?\r\n

  5. Check number of arguments passed to a Bash script

    tags: bash, parameter-passing

    427 votes, 7 answers and 426921 views

    \r\n I would like my Bash script to print an error message if the required argument count is not met.\n\nI tried the following code:\n\n#!/bin/bash\necho Script name: $0\necho $# arguments \nif [$# -ne 1]; \n ...\r\n

  6. How to increase timeout for a single test case in mocha

    tags: mocha

    284 votes, 8 answers and 88436 views

    \r\n I'm submitting a network request in a test case, but this sometimes takes longer than 2 seconds (the default timeout).\n\nHow do I increase the timeout for a single test case?\r\n

  7. Why does Stream not implement Iterable?

    tags: java, java-8, java-stream, iterable

    181 votes, 7 answers and 23068 views

    \r\n In Java 8 we have the class Stream, which curiously have a method\n\nIterator iterator()\r\nSo you would expect it to implement interface Iterable, which requires exactly this method, ...\r\n

  8. Switching between GCC and Clang/LLVM using CMake

    tags: cmake, llvm, clang

    195 votes, 8 answers and 142625 views

    \r\n I have a number of projects built using CMake and I'd like to be able to easily switch between using GCC or Clang/LLVM to compile them. I believe (please correct me if I'm mistaken!) that to use Clang ...\r\n

  9. How to find if directory exists in Python

    tags: python, directory

    639 votes, 9 answers and 536475 views

    \r\n In the os module in Python, is there a way to find if a directory exists, something like:\n\n>>> os.direxists(os.path.join(os.getcwd()), 'new_folder')) # in pseudocode\nTrue/False\r\n

  10. How to iterate over a JSONObject?

    tags: java, json

    208 votes, 9 answers and 286311 views

    \r\n I use a JSON library called JSONObject (I don't mind switching if I need to). \n\nI know how to iterate over JSONArrays, but when I parse JSON data from Facebook I don't get an array, only a JSONObject, ...\r\n