Questions

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

Requests -- how to tell if you're getting a 404

I'm using the Requests library and accessing a website to gather data from it with the following code: ``` r = requests.get(url) ``` I want to add error testing for when an improper URL is entered...

29 Dec at 09:5

Do Git tags only apply to the current branch?

I'm currently working with a repository that has multiple branches. When I create a tag, does that tag refer to the then-current branch? In other words: Whenever I create a tag, do I need to switch ...

19 Apr at 22:57

npm install from Git in a specific version

Assumed that I have written a module for Node.js which I would like to keep private. I know that I can (should) add the line: ``` "private": "true" ``` to the `package.json` file, and I also know t...

24 Mar at 08:2

Node.js create folder or use existing

I already have read the documentation of Node.js and, unless if I missed something, it does not tell what the parameters contain in certain operations, in particular [fs.mkdir()](http://nodejs.org/api...

4 Dec at 04:34

Check substring exists in a string in C

I'm trying to check whether a string contains a substring in C like: ``` char *sent = "this is my sample example"; char *word = "sample"; if (/* sentence contains word */) { /* .. */ } ``` What...

2 Jun at 17:46

Why use @Scripts.Render("~/bundles/jquery")

How does ``` @Scripts.Render("~/bundles/jquery") ``` differ from just referencing the script from html like this ``` <script src="~/bundles/jquery.js" type="text/javascript"></script> ``` Are...

5 Sep at 15:10

Difference between two dates in Python

I have two different dates and I want to know the difference in days between them. The format of the date is YYYY-MM-DD. I have a function that can ADD or SUBTRACT a given number to a date: ``` def ...

21 Dec at 18:57

How do I perform an insert and return inserted identity with Dapper?

How do I perform an insert to database and return inserted identity with Dapper? I've tried something like this: ``` string sql = "DECLARE @ID int; " + "INSERT INTO [MyTable] ([Stuff]) ...

4 Feb at 22:50

How can prepared statements protect from SQL injection attacks?

How do [prepared statements](http://en.wikipedia.org/wiki/Prepared_statement) help us prevent [SQL injection](http://en.wikipedia.org/wiki/SQL_injection) attacks? Wikipedia says: > Prepared statements...

Is there a way to detect if an image is blurry?

I was wondering if there is a way to determine if an image is blurry or not by analyzing the image data.

14 Oct at 09:41

Java GUI frameworks. What to choose? Swing, SWT, AWT, SwingX, JGoodies, JavaFX, Apache Pivot?

There is quite a lot of gui frameworks out there for java, but what is recognized as today's framework of choice? The following is my understanding of the different frameworks, please correct me if i...

10 Oct at 21:52

What does the 'L' in front a string mean in C++?

``` this->textBox1->Name = L"textBox1"; ``` Although it seems to work without the `L`, what is the purpose of the prefix? The way it is used doesn't even make sense to a hardcore C programmer.

17 Jun at 09:59

Remove substring from the string

I am just wondering if there is any method to remove string from another string? Something like this: ``` class String def remove(s) self[s.length, self.length - s.length] end end ```

20 Mar at 06:57

How to select an element with 2 classes

i have this elements ``` <div class="a b"></div> <div class="b"></div> <div class="a"></div> ``` I want apply to element with class a and b the color #666. How can I do this with CSS?

10 Mar at 08:14

Literal notation for Dictionary in C#?

I currently have a WebSocket between JavaScript and a server programmed in C#. In JavaScript, I can pass data easily using an associative array: ``` var data = {'test': 'val', 'test2': 'v...

4 Aug at 09:26

How to concatenate strings in django templates?

I want to concatenate a string in a Django template tag, like: ``` {% extend shop/shop_name/base.html %} ``` Here `shop_name` is my variable and I want to concatenate this with rest of path. Suppo...

4 Jun at 05:54

Remove all files except some from a directory

When using `sudo rm -r`, how can I delete all files, with the exception of the following: ``` textfile.txt backup.tar.gz script.php database.sql info.txt ```

19 Jan at 18:42

CSS @media print issues with background-color;

I'm attempting to make a printable stylesheet for our app but I'm having issues with `background-color` in `@media print`. ``` @media print { #header{display:none;} #adwrapper{display:none...

29 Dec at 01:18

Are there best practices for (Java) package organization?

A little while ago, I saw a question answered here regarding the fine-grained organization of Java packages. For example, `my.project.util`, `my.project.factory`, `my.project.service`, etc. Are there...

5 Feb at 21:22

How to animate the change of image in an UIImageView?

I have an `UIImageView` with an image. Now I have a completely new image (graphic file), and want to display that in this `UIImageView`. If I just set ``` myImageView.image = newImage; ``` the new...

Escaping single quote in PHP when inserting into MySQL

I have a perplexing issue that I can't seem to comprehend... I have two SQL statements: - - The problem is that it appears that a single quote is triggering a MySQL error on the second entry only!...

15 Jul at 15:3

What's the difference between xsd:include and xsd:import?

What's the difference between `xsd:include` and `xsd:import`? When would you use one instead of the other, and when might it not matter?

18 Jun at 00:27

Disable all gcc warnings

I'm working on a project that will read compiler error messages of a particular variety and do useful things with them. The sample codebase I'm testing this on (a random open-source application), and ...

21 Sep at 03:6

How do I change the title of the "back" button on a Navigation Bar

Currently the left bar button default value is the title of the view that loaded the current one, in other words the view to be shown when the button is pressed (back button). I want to change the te...