Questions

Best way to test if a row exists in a MySQL table

I'm trying to find out if a row exists in a table. Using MySQL, is it better to do a query like this: ``` SELECT COUNT(*) AS total FROM table1 WHERE ... ``` and check to see if the total is non-zer...

4 Nov at 21:9

How to empty input field with jQuery

I am in a mobile app and I use an input field in order user submit a number. When I go back and return to the page that input field present the latest number input displayed at the input field. Is t...

7 Dec at 19:38

Installing Java 7 on Ubuntu

> This question was asked before Oracle made the OpenJDK the free version of the Oracle JDK, and the historic answers reflect that. As of 2022 you should not use Java 7 unless you must for projects ...

4 Nov at 15:35

Upload files with HTTPWebrequest (multipart/form-data)

Is there any class, library or some piece of code which will help me to upload files with ? I do not want to upload to a WebDAV folder or something like that. I want to simulate a browser, so just...

19 Feb at 18:55

Convert special characters to HTML in JavaScript

How can I convert special characters to HTML in JavaScript? Example: - `&``&amp`- `"``&quot``ENT_NOQUOTES`- `'``&#039``ENT_QUOTES`- `<``&lt`- `>``&gt`

31 Jan at 17:4

window.onload vs <body onload=""/>

What exactly is the difference between the `window.onload` event and the `onload` event of the `body` tag? when do I use which and how should it be done correctly?

17 Aug at 22:6

Using find to locate files that match one of multiple patterns

I was trying to get a list of all python and html files in a directory with the command `find Documents -name "*.{py,html}"`. Then along came the man page: > Braces within the pattern (‘{}’) are not...

30 Dec at 11:42

How do I use LINQ Contains(string[]) instead of Contains(string)

I got one big question. I got a linq query to put it simply looks like this: ``` from xx in table where xx.uid.ToString().Contains(string[]) select xx ``` The values of the `string[]` array would ...

2 Dec at 18:46

How do you get the current project directory from C# code when creating a custom MSBuild task?

Instead of running an external program with its path hardcoded, I would like to get the current Project Dir. I'm calling an external program using a process in the custom task. How would I do that? A...

3 May at 08:14

How to select rows with one or more nulls from a pandas DataFrame without listing columns explicitly?

I have a dataframe with ~300K rows and ~40 columns. I want to find out if any rows contain null values - and put these 'null'-rows into a separate dataframe so that I could explore them easily. I can...

25 Nov at 15:0

Break a previous commit into multiple commits

Without creating a branch and doing a bunch of funky work on a new branch, is it possible to break a single commit into a few different commits after it's been committed to the local repository?

9 Sep at 15:35

Reflection: How to Invoke Method with parameters

I am trying to invoke a method via reflection with parameters and I get: > object does not match target type If I invoke a method without parameters, it works fine. Based on the following code if I ...

MySQL Multiple Joins in one query?

I have the following query: ``` SELECT dashboard_data.headline, dashboard_data.message, dashboard_messages.image_id FROM dashboard_data INNER JOIN dashboard_messages ON dashboard_message_id ...

23 Jan at 15:52

How do I compare two strings in Perl?

How do I compare two strings in Perl? I am learning Perl, I had this basic question looked it up here on StackOverflow and found no good answer so I thought I would ask.

24 Jul at 01:36

Error 415 Unsupported Media Type: POST not reaching REST if JSON, but it does if XML

I am actually new to REST WS but really I don't get this `415 Unsupported Media Type`. I am testing my REST with Poster on Firefox and the `GET` works fine for me, also the `POST` (when it's a `appl...

14 Oct at 07:22

What is the difference between `throw new Error` and `throw someObject`?

I want to write a common error handler which will catch custom errors thrown on purpose at any instance of the code. When I did `throw new Error('sample')` like in the following code ``` try { t...

What is the difference between a symbolic link and a hard link?

Recently I was asked this during a job interview. I was honest and said I knew how a symbolic link behaves and how to create one, but do not understand the use of a hard link and how it differs from a...

9 Oct at 14:35

How to try convert a string to a Guid

I did not find the TryParse method for the Guid. I’m wondering how others handle converting a guid in string format into a guid type. ``` Guid Id; try { Id = new Guid(Request.QueryString["id"]);...

28 Sep at 23:21

React "after render" code?

I have an app where I need to set the height of an element (lets say "app-content") dynamically. It takes the height of the "chrome" of the app and subtracts it and then sets the height of the "app-co...

24 Oct at 21:41

Decode UTF-8 with Javascript

I have Javascript in an XHTML web page that is passing UTF-8 encoded strings. It needs to continue to pass the UTF-8 version, as well as decode it. How is it possible to decode a UTF-8 string for disp...

Can I apply a CSS style to an element name?

I'm currently working on a project where I have no control over the HTML that I am applying CSS styles to. And the HTML is not very well labelled, in the sense that there are not enough id and class d...

9 Apr at 17:21

How do I read a large csv file with pandas?

I am trying to read a large csv file (aprox. 6 GB) in pandas and i am getting a memory error: ``` MemoryError Traceback (most recent call last) <ipython-input-58-67a7268...

10 Apr at 14:23

Reading an Excel file in PHP

I'm trying to read an Excel file (Office 2003). There is an Excel file that needs to be uploaded and its contents parsed. Via Google, I can only find answers to these related (and insufficient topics...

24 Feb at 06:18

Adjusting and image size to fit a div with Bootstrap

I'm trying to get an image to fit within a specific size div. Unfortunately, the image isn't conforming to it and is instead proportionally shrinking to a size that isn't big enough. I'm not sure what...

27 Jun at 20:11

How can I find all matches to a regular expression in Python?

In a program I'm writing I have Python use the `re.search()` function to find matches in a block of text and print the results. However, the program exits once it finds the first match in the block of...

13 Nov at 23:56