Questions

How do you use variables in a simple PostgreSQL script?

For example, in MS-SQL, you can open up a query window and run the following: ``` DECLARE @List AS VARCHAR(8) SELECT @List = 'foobar' SELECT * FROM dbo.PubLists WHERE Name = @List ``` How is t...

20 Apr at 02:28

PreparedStatement IN clause alternatives?

What are the best workarounds for using a SQL `IN` clause with instances of `java.sql.PreparedStatement`, which is not supported for multiple values due to SQL injection attack security issues: One `?...

Disabling of EditText in Android

In my application, I have an EditText that the user only has Read access not Write access. In code I set `android:enabled="false"`. Although the background of EditText changed to dark, when I click...

23 Jan at 15:38

How to check if a number is a power of 2

Today I needed a simple algorithm for checking if a number is a power of 2. The algorithm needs to be: 1. Simple 2. Correct for any ulong value. I came up with this simple algorithm: ``` private bo...

9 Jan at 17:21

converting Java bitmap to byte array

``` Bitmap bmp = intent.getExtras().get("data"); int size = bmp.getRowBytes() * bmp.getHeight(); ByteBuffer b = ByteBuffer.allocate(size); bmp.copyPixelsToBuffer(b); byte[] bytes = new...

varbinary to string on SQL Server

How to convert a column value from `varbinary(max)` to `varchar` in human-readable form?

12 Dec at 17:6

res.sendFile absolute path

If I do a ``` res.sendfile('public/index1.html'); ``` then I get a server console warning > express deprecated `res.sendfile`: Use `res.sendFile` instead but it works fine on the client side. ...

6 Nov at 01:40

How can I find last row that contains data in a specific column?

How can I find the last row that contains data in a specific column and on a specific sheet?

9 May at 05:3

"Parameter" vs "Argument"

I got and kind of mixed up and did not really pay attention to when to use one and when to use the other. Can you please tell me?

How can I find an element by class and get the value?

I am trying to get the value of an input text field. the HTML is: ``` <div id="start"> <p> <input type="text" class="myClass" value="my value" name="mytext"/> </p> </div> ``` The jque...

24 May at 13:8

Vue.js toggle class on click

How does toggle a class in vue.js? I have the following: ``` <th class="initial " v-on="click: myFilter"> <span class="wkday">M</span> </th> new Vue({ el: '#my-container', data: {}, methods...

8 Dec at 02:42

Is it possible to set a number to NaN or infinity?

Is it possible to set an element of an array to `NaN` in Python? Additionally, is it possible to set a variable to +/- infinity? If so, is there any function to check whether a number is infinity or ...

2 Apr at 23:6

Webpack build failing with ERR_OSSL_EVP_UNSUPPORTED

I'm having an issue with a Webpack build process that suddenly broke, resulting in the following error... ``` <s> [webpack.Progress] 10% building 0/1 entries 0/0 dependencies 0/0 modules node:internal...

18 Aug at 02:28

How to see an HTML page on Github as a normal rendered HTML page to see preview in browser, without downloading?

On [http://github.com](http://github.com) developer keep the HTML, CSS, JavaScript and images files of the project. How can I see the HTML output in browser? For example this: [https://github.com/nec...

16 Dec at 12:38

VBA Count cells in column containing specified value

I need to write a macro that searches a specified column and counts all the cells that contain a specified string, such as `"19/12/11" or "Green"` then associate this number with a variable, Does any...

9 Jul at 19:34

psql - save results of command to a file

I'm using psql's `\dt` to list all tables in a database and I need to save the results. What is the syntax to export the results of a psql command to a file?

8 Jun at 23:50

Make a link use POST instead of GET

I'm not sure if this is even possible. But I was wondering if anyone knows how to make a hyperlink pass some variables and use POST (like a form) as opposed to GET.

14 Jul at 02:18

How can I show dots ("...") in a span with hidden overflow?

``` #content_right_head span { display:inline-block; width:180px; overflow:hidden !important; } ``` Now it's showing But I want to show like I need to show dots after contents. Contents...

16 Jan at 06:47

When should we call System.exit in Java

In Java, What is the difference with or without `System.exit(0)` in following code? ``` public class TestExit { public static void main(String[] args) { System.out.println("he...

13 Dec at 09:27

What is class="mb-0" in Bootstrap 4?

The [latest documention](https://v4-alpha.getbootstrap.com/content/typography/#blockquotes) has: ``` <p class="mb-0">Lorem ipsum</p> ``` What is `mb-0`?

1 Jul at 14:16

How do I drop a foreign key in SQL Server?

I have created a foreign key (in SQL Server) by: ``` alter table company add CountryID varchar(3); alter table company add constraint Company_CountryID_FK foreign key(CountryID) references Country; ...

4 Dec at 22:6

Declaring static constants in ES6 classes?

I want to implement constants in a `class`, because that's where it makes sense to locate them in the code. So far, I have been implementing the following workaround with static methods: ``` class M...

How to check if a character in a string is a digit or letter

I have the user entering a single character into the program and it is stored as a string. I would like to know how I could check to see if the character that was entered is a letter or a digit. I hav...

3 Oct at 19:14

matplotlib does not show my plot although I call pyplot.show()

Help required on `matplotlib`. Yes, I did not forget calling the `pyplot.show()`. ### $ ipython --pylab ``` import matplotlib.pyplot as p p.plot(range(20), range(20)) ``` It returns `matplotlib.l...

10 Oct at 16:23

Shortest way to print current year in a website

I need to update a few hundred static HTML pages that have the copyright date hard coded in the footer. I want to replace it with some JavaScript that will automatically update each year. Currently I...

7 Sep at 12:51