Loop inside React JSX
I'm trying to do something like the following in React JSX (where ObjectRow is a separate component): ``` <tbody> for (var i=0; i < numrows; i++) { <ObjectRow/> } </tbody> ``` I real...
- Modified
- 14 Feb at 15:36
onClick to get the ID of the clicked button
How do find the id of the button which is being clicked? ``` <button id="1" onClick="reply_click()"></button> <button id="2" onClick="reply_click()"></button> <button id="3" onClick="reply_click()"><...
- Modified
- 9 Apr at 09:45
How to reset AUTO_INCREMENT in MySQL
How can I the `AUTO_INCREMENT` of a field? I want it to start counting from `1` again.
- Modified
- 5 Aug at 18:28
How to change the href attribute for a hyperlink using jQuery
How can you change the `href` attribute (link target) for a hyperlink using jQuery?
- Modified
- 7 Jul at 14:4
How to join (merge) data frames (inner, outer, left, right)
Given two data frames: ``` df1 = data.frame(CustomerId = c(1:6), Product = c(rep("Toaster", 3), rep("Radio", 3))) df2 = data.frame(CustomerId = c(2, 4, 6), State = c(rep("Alabama", 2), rep("Ohio", 1)...
Check if table exists in SQL Server
I would like this to be the ultimate discussion on how to check if a table exists in SQL Server 2000/2005 using SQL Statements. Here are two possible ways of doing it. Which one is the standard/best w...
- Modified
- 8 Aug at 10:56
PHP random string generator
I'm trying to create a randomized string in PHP, and I get absolutely no output with this: ``` <?php function RandomString() { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDE...
How to emulate a do-while loop?
I need to emulate a do-while loop in a Python program. Unfortunately, the following straightforward code does not work: ``` list_of_ints = [ 1, 2, 3 ] iterator = list_of_ints.__iter__() element = Non...
- Modified
- 13 Mar at 18:11
How do I display an alert dialog on Android?
I want to display a dialog/popup window with a message to the user that shows "Are you sure you want to delete this entry?" with one button that says 'Delete'. When `Delete` is touched, it should dele...
- Modified
- 3 Apr at 19:22
Sleep for milliseconds
I know the POSIX `sleep(x)` function makes the program sleep for x seconds. Is there a function to make the program sleep for x in C++?
How to Sort a List<T> by a property in the object
I have a class called `Order` which has properties such as `OrderId`, `OrderDate`, `Quantity`, and `Total`. I have a list of this `Order` class: ``` List<Order> objListOrder = new List<Order>(); G...
How to compare arrays in JavaScript?
I'd like to compare two arrays... ideally, efficiently. Nothing fancy, just `true` if they are identical, and `false` if not. Not surprisingly, the comparison operator doesn't seem to work. ``` var a...
- Modified
- 4 Oct at 22:21
List all environment variables from the command line
Is it possible to list environment variables from a Windows' command prompt? Something equivalent to PowerShell's `gci env:` (or `ls env:` or `dir env:`).
- Modified
- 27 Apr at 12:11
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
I have been following a manual to install a software suite on Ubuntu. I have no knowledge of MySQL at all. I have done the following installations on my Ubuntu. ``` sudo apt-get update sudo apt-get in...
How do I convert all strings in a list of lists to integers?
I have a tuple of tuples containing strings: ``` T1 = (('13', '17', '18', '21', '32'), ('07', '11', '13', '14', '28'), ('01', '05', '06', '08', '15', '16')) ``` I want to convert all the ...
How to get parameter value from query string?
How can I define a route in my routes.jsx file to capture the `__firebase_request_key` parameter value from a URL generated by Twitter's single sign on process after the redirect from their servers? ...
- Modified
- 27 Nov at 20:31
How do I print an exception in Python?
How do I print the error/exception in the `except:` block? ``` try: ... except: print(exception) ```
- Modified
- 20 Jun at 06:52
How to get client's IP address using JavaScript?
I need to somehow retrieve the client's IP address using JavaScript; no server side code, not even SSI. However, I'm not against using a free 3rd party script/service.
- Modified
- 16 Jun at 01:51
What IDE to use for Python?
What IDEs ("GUIs/editors") do others use for Python coding?
Short circuit Array.forEach like calling break
``` [1,2,3].forEach(function(el) { if(el === 1) break; }); ``` How can I do this using the new `forEach` method in JavaScript? I've tried `return;`, `return false;` and `break`. `break` crashes ...
- Modified
- 28 Oct at 09:21
How to fully delete a git repository created with init?
I created a git repository with `git init`. I'd like to delete it entirely and init a new one.
Styling an input type="file" button
How do you style an input `type="file"` button? ``` <input type="file" /> ```
Trigger a button click with JavaScript on the Enter key in a text box
I have one text input and one button (see below). How can I use JavaScript to when the key is pressed inside the text box? There is already a different submit button on my current page, so I can't ...
- Modified
- 22 Jun at 15:15
How do I get a list of locally installed Python modules?
How do I get a list of Python modules installed on my computer?