Questions

What is a mutex?

A mutex is a programming concept that is frequently used to solve multi-threading problems. My question to the community: What is a mutex and how do you use it?

29 Aug at 15:59

Error: Jump to case label in switch statement

I wrote a program which involves use of switch statements, however on compilation it shows: > Error: Jump to case label. Why does it do that? ``` #include <iostream> int main() { int choice; ...

3 Oct at 21:27

How to list active connections on PostgreSQL?

Is there a command in PostgreSQL to select active connections to a given database? `psql` states that I can't drop one of my databases because there are , so I would like to see what the connections ...

How to ALTER multiple columns at once in SQL Server

I need to `ALTER` the data types of several columns in a table. For a single column, the following works fine: ``` ALTER TABLE tblcommodityOHLC ALTER COLUMN CC_CommodityContractID NUMERIC(18,0) ...

13 Jan at 10:35

In jQuery how can I set "top,left" properties of an element with position values relative to the parent and not the document?

`.offset([coordinates])` method set the coordinates of an element but only relative to the document. Then how can I set coordinates of an element but relative to the parent? I found that `.position()...

Bootstrap 3 breakpoints and media queries

On the [Bootstrap 3 media queries documentation](https://getbootstrap.com/docs/3.4/css/#grid-media-queries) it says: > We use the following media queries in our Less files to create the key breakpoin...

How to capitalize the first letter of word in a string using Java?

Example strings ``` one thousand only two hundred twenty seven ``` How do I change the first character of a string in capital letter and not change the case of any of the other letters? After the ...

11 Jul at 16:53

SET versus SELECT when assigning variables?

What are the differences between the `SET` and `SELECT` statements when assigning variables in T-SQL?

Referring to a table in LaTeX

How can you refer to a table number such that you get `Table 7` for instance? Sample data ``` Table \ref{table:questions} lorem lorem ipsun. \begin{table} \label{table:questions} \begin{tabular}{| ...

24 Oct at 15:33

Is it more efficient to copy a vector by reserving and copying, or by creating and swapping?

I am trying to efficiently make a copy of a vector. I see two possible approaches: ``` std::vector<int> copyVecFast1(const std::vector<int>& original) { std::vector<int> newVec; newVec.reserve(ori...

1 Aug at 03:16

Enter key press in C#

I tried this code: ``` private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (Convert.ToInt32(e.KeyChar) == 13) { MessageBox.Show(" Enter pressed "); } } ``` ...

14 Nov at 22:8

Error after upgrading pip: cannot import name 'main'

Whenever I am trying to install any package using pip, I am getting this import error: ``` guru@guru-notebook:~$ pip3 install numpy Traceback (most recent call last): File "/usr/bin/pip3", line 9, ...

11 Jul at 18:40

Git credential helper - update password

I'm currently using GitHub over HTTPS and have the latest version of Git installed (1.9.0) along with the Git credential helper on Windows 7. On setting up my environment, I told git-credentials to p...

How to calculate a logistic sigmoid function in Python?

This is a logistic sigmoid function: ![enter image description here](https://i.stack.imgur.com/SUuRi.png) I know x. How can I calculate F(x) in Python now? Let's say x = 0.458. F(x) = ?

31 Jan at 13:24

How to convert SQLAlchemy row object to a Python dict?

Is there a simple way to iterate over column name and value pairs? My version of SQLAlchemy is 0.5.6 Here is the sample code where I tried using `dict(row)`: ``` import sqlalchemy from sqlalchemy impo...

20 Nov at 14:34

Sorting by date & time in descending order?

all I want to display last 5 entered data for specific id. My sql query is, ``` SELECT id, name, form_id, DATE(updated_at) as date FROM wp_frm_items WHERE user_id = 11 && form_id=9 ORD...

9 May at 10:11

segmentation fault : 11

I'm having a problem with some program, I have searched about segmentation faults, by I don't understand them quite well, the only thing I know is that presumably I am trying to access some memory I s...

6 Oct at 19:9

Read/Parse text file line by line in VBA

I'm trying to parse a text document using VBA and return the path given in the text file. For example, the text file would look like: ``` *Blah blah instructions *Blah blah instructions on line 2 G:\...

9 May at 02:26

No Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator

I am trying to consume an API using Retrofit and Jackson to deserialize. I am getting the onFailure error `No Creators, like default construct, exist): cannot deserialize from Object value (no delegat...

31 Oct at 05:24

Test if an element is present using Selenium WebDriver

Is there a way how to test if an element is present? Any method would end in an exception, but that is not what I want, because it can be that an element is not present and that is okay. That is not ...

13 Nov at 20:46

Adding and removing style attribute from div with jquery

I've inherited a project I'm working on and I'm updating some jquery animations (very little practice with jquery). I have a div I need to add and remove the style attribute from. Here is the div: `...

28 Aug at 22:27

The permissions granted to user ' are insufficient for performing this operation. (rsAccessDenied)"}

I created a report model using SSRS (2005) and published to the local server. But when I tried to run the report for the model I published using report builder I get the following error. > Report ex...

How to use passive FTP mode in Windows command prompt?

In Ubuntu `ftp -p` for passive mode works fine. How do I do the same in Windows? I tried with `quote pasv` but I am getting following error: ``` 230 OK. Current restricted directory is / ftp> quo...

3 Mar at 13:54

SQL Server Case Statement when IS NULL

I'm trying to do an IF statement type function in SQL server. Where there is a NULL in the field, I want it to take a field from one of the tables and add 10 days to it. And if possible create anoth...

25 Jul at 21:43

Quick unix command to display specific lines in the middle of a file?

Trying to debug an issue with a server and my only log file is a 20GB log file (with no timestamps even! Why do people use `System.out.println()` as logging? In production?!) Using grep, I've found a...

27 Apr at 09:11