How to check if a float value is a whole number
I am trying to find the largest cube root that is a whole number, that is less than 12,000. ``` processing = True n = 12000 while processing: n -= 1 if n ** (1/3) == #checks to see if this h...
- Modified
- 5 Feb at 17:21
What is NODE_ENV and how to use it in Express?
This is my app that I'm currently running on production. ``` var app = express(); app.set('views',settings.c.WEB_PATH + '/public/templates'); app.set('view engine','ejs'); app.configure(function(){ ...
- Modified
- 18 Nov at 17:44
Send JavaScript variable to PHP variable
First I thought that I had to convert JavaScript to PHP, but then I found out that I cannot because of server and client side executions. So now I simply want to send ONE variable ``` <script type="t...
- Modified
- 2 Feb at 13:31
Job for mysqld.service failed See "systemctl status mysqld.service"
Console says ``` [root@ip-172-31-18-2 mysql]# service mysqld start Starting mysqld (via systemctl): Job for mysqld.service failed because the control process exited with an error code. See "systemctl...
- Modified
- 8 Jan at 07:34
How to copy a file to a remote server in Python using SCP or SSH?
I have a text file on my local machine that is generated by a daily Python script run in cron. I would like to add a bit of code to have that file sent securely to my server over SSH.
- Modified
- 7 Aug at 09:5
Plot multiple columns of pandas DataFrame on the bar chart
I am using the following code to plot a bar-chart: ``` import matplotlib.pyplot as pls my_df.plot(x='my_timestampe', y='col_A', kind='bar') plt.show() ``` The plot works fine. However, I want to ...
- Modified
- 14 Nov at 18:9
Error: unexpected symbol/input/string constant/numeric constant/SPECIAL in my code
I received one of these errors. ``` Error: unexpected symbol in "<my code>" Error: unexpected input in "<my code>" Error: unexpected string constant in "<my code>" Error: unexpected numeric c...
Count number of records returned by group by
How do I count the number of records returned by a group by query, For eg: ``` select count(*) from temptable group by column_1, column_2, column_3, column_4 ``` Gives me, ``` 1 1 2 ``` I nee...
- Modified
- 1 Sep at 13:31
Boto3 Error: botocore.exceptions.NoCredentialsError: Unable to locate credentials
When I simply run the following code, I always gets this error. ``` s3 = boto3.resource('s3') bucket_name = "python-sdk-sample-%s" % uuid.uuid4() print("Creating new bucket with name:", bucket_name) s...
Case Function Equivalent in Excel
I have an interesting challenge - I need to run a check on the following data in Excel: ``` | A - B - C - D | |------|------|------|------| | 36 | 0 | 0 | x | | 0 | 600 | ...
- Modified
- 12 May at 20:48
How do you connect to multiple MySQL databases on a single webpage?
I have information spread out across a few databases and want to put all the information onto one webpage using PHP. I was wondering how I can connect to multiple databases on a single PHP webpage. ...
How to remove all white space from the beginning or end of a string?
How can I remove all white space from the beginning and end of a string? Like so: `"hello"` returns `"hello"` `"hello "` returns `"hello"` `" hello "` returns `"hello"` `" hello world "` returns `"h...
- Modified
- 27 Jun at 14:30
Where is the <conio.h> header file on Linux? Why can't I find <conio.h>?
> [How to implement getch() function of C in Linux?](https://stackoverflow.com/questions/3276546/how-to-implement-getch-function-of-c-in-linux) What is the equivalent `Linux` version of the `c...
- Modified
- 29 May at 16:35
Dictionary: Get list of values for list of keys
Is there a built-in/quick way to use a list of keys to a dictionary to get a list of corresponding items? For instance I have: ``` >>> mydict = {'one': 1, 'two': 2, 'three': 3} >>> mykeys = ['three'...
- Modified
- 17 Dec at 16:5
Excel VBA calling sub from another sub with multiple inputs, outputs of different sizes
I would like to call a sub from another sub inside in the same module. The first sub would be my main code and there I would call the second subroutine. Second subroutine receives multiple inputs as i...
- Modified
- 21 Jul at 19:6
How to calculate rolling / moving average using python + NumPy / SciPy?
There seems to be no function that simply calculates the moving average on numpy/scipy, leading to [convoluted solutions](https://stackoverflow.com/questions/12816011/weighted-moving-average-with-nump...
- Modified
- 7 Sep at 04:24
Installing PHP Zip Extension
I'm attempting to install the PHP Zip extension. My server does not have external internet access, so I downloaded it myself from PECL: [http://pecl.php.net/package/zip](http://pecl.php.net/package...
- Modified
- 9 Jun at 06:50
How to create an array from a CSV file using PHP and the fgetcsv function
Can someone kindly provide a code to create an array from a CSV file using fgetcsv? I've used the following code to create an array from a simple CSV file, but it doesn't work right when one of my fi...
what does the __file__ variable mean/do?
``` import os A = os.path.join(os.path.dirname(__file__), '..') B = os.path.dirname(os.path.realpath(__file__)) C = os.path.abspath(os.path.dirname(__file__)) ``` I usually just hard-wire these wi...
- Modified
- 21 Oct at 18:40
How to pipe list of files returned by find command to cat to view all the files
I am doing a [find](https://www.man7.org/linux/man-pages/man1/find.1.html) to get a list of files. How do I pipe it to another utility like [cat](https://www.man7.org/linux/man-pages/man1/cat.1.html) ...
How to get client IP address in Laravel 5+
I am trying to get the client's IP address in Laravel. It is easy to get a client's IP in PHP by using `$_SERVER["REMOTE_ADDR"]`. It is working fine in core PHP, but when I use the same thing in Lar...
- Modified
- 31 Dec at 03:43
Android how to convert int to String?
I have an int and I want to convert it to a string. Should be simple, right? But the compiler complains it can't find the symbol when I do: ``` int tmpInt = 10; String tmpStr10 = String.valueOf(tmp...
- Modified
- 28 Dec at 18:58
Margin while printing html page
I am using a separate style-sheet for printing. Is it possible to set right and left margins in the style-sheet which set the print margin? (i.e. margin on paper)
Scripting Language vs Programming Language
Can anyone explain the difference between Scripting Language and Programming Language please? Also can you state some examples for each. I have Googled a lot but I always find the best answers from St...
- Modified
- 21 Mar at 09:6