Questions

How to insert data to MySQL with auto-incremented column(field)?

I've created a table with a primary key and enabled `AUTO_INCREMENT`: ``` CREATE TABLE IF NOT EXISTS test.authors ( hostcheck_id INT PRIMARY KEY AUTO_INCREMENT, instance_id INT, host_objec...

Converting DateTime format using razor

What is wrong with the following? ``` @Convert.ToDateTime((@item.Date.ToShortDateString())," dd - M - yy") ``` @item.Date is showing 20/11/2005 12:00 a.m and I want to display 20 Nov 2011

13 Jan at 11:6

Jquery .on('scroll') not firing the event while scrolling

Scroll event is not firing while scrolling the `ul`. I'm using jQuery version 1.10.2. As I'm loading the `ul` from an ajax page, I couldn't use `$('ulId').on('scroll', function() {});` or other live m...

24 Nov at 10:36

Website screenshots

Is there any way of taking a screenshot of a website in PHP, then saving it to a file?

9 Aug at 13:46

How can I use Guzzle to send a POST request in JSON?

Does anybody know the correct way to `post` JSON using `Guzzle`? ``` $request = $this->client->post(self::URL_REGISTER,array( 'content-type' => 'application/json' ),array(json...

6 Sep at 12:17

How to open a new window on form submit

I have a submit form and want it to open a new window when users submits the form so i can track it on analytics. Here is the code I'm using: ``` <form action="http://URL at mailchimp subscriber URL...

7 Sep at 02:55

How to parse XML in Bash?

Ideally, what I would like to be able to do is: ``` cat xhtmlfile.xhtml | getElementViaXPath --path='/html/head/title' | sed -e 's%(^<title>|</title>$)%%g' > titleOfXHTMLPage.txt ```

29 May at 03:30

Checking if form has been submitted - PHP

What is the best way of checking whether or not a form has been submitted to determine whether I should pass the form's variables to my validation class? First I thought maybe: ``` isset($_POST) ```...

10 Oct at 10:28

Simulate a button click in Jest

Simulating a button click seems like a very easy/standard operation. Yet, I can't get it to work in Jest.js tests. This is what I tried (and also doing it using jQuery), but it didn't seem to trigger ...

Read a file in Node.js

I'm quite puzzled with reading files in Node.js. ``` fs.open('./start.html', 'r', function(err, fileToRead){ if (!err){ fs.readFile(fileToRead, {encoding: 'utf-8'}, function(err,data){ ...

30 Jul at 13:41

Trim last character from a string

I have a string say ``` "Hello! world!" ``` I want to do a trim or a remove to take out the ! off world but not off Hello.

26 Aug at 08:36

How do I export a project in the Android studio?

How do I export project in the Android Studio? I mean, like I used to do in Eclipse by `File|Export`..

10 Apr at 15:24

What is the 'new' keyword in JavaScript?

The `new` keyword in JavaScript can be quite confusing when it is first encountered, as people tend to think that JavaScript is not an object-oriented programming language. - - -

25 Jul at 13:42

The character encoding of the HTML document was not declared

When I click on my form's submit button the following error message appears: > The character encoding of the HTML document was not declared. The document will render with garbled text in some browser ...

28 Jul at 01:17

What are the practical factors to consider when choosing between Depth-First Search (DFS) and Breadth-First Search (BFS)?

I understand the differences between DFS and BFS, but I'm interested to know what factors to consider when choosing DFS vs BFS. Things like avoiding DFS for very deep trees, etc.

What is Parse/parsing?

In Java, What exactly is Parsing? Why are they used? For example: `Integer.parseInt(...)`, and parsing a string?

16 Feb at 22:40

Elasticsearch: Failed to connect to localhost port 9200 - Connection refused

When I tried connecting to Elasticsearch using the `curl http://localhost:9200` it is working fine. But when I run the `curl http://IpAddress:9200` it is throwing an error saying > Failed to conne...

11 Oct at 08:59

How to make a JSON call to an URL?

I'm looking at the following API: [http://wiki.github.com/soundcloud/api/oembed-api](http://wiki.github.com/soundcloud/api/oembed-api) The example they give is Call: ``` http://soundcloud.com/oembed?u...

2 Apr at 06:31

How to copy a file from one directory to another using PHP?

Say I've got a file `test.php` in `foo` directory as well as `bar`. How can I replace `bar/test.php` with `foo/test.php` using `PHP`? I'm on Windows XP, a cross platform solution would be great but wi...

31 Mar at 05:54

Sending data from HTML form to a Python script in Flask

I have the code below in my Python script: ``` def cmd_wui(argv, path_to_tx): """Run a web UI.""" from flask import Flask, flash, jsonify, render_template, request import webbrowser a...

31 Mar at 19:33

Select query to get data from SQL Server

I am trying to run the SQL Select query in my C# code. But I always get the -1 output on ``` int result = command.ExecuteNonQuery(); ``` However, the same table if I use for `delete` or `insert` w...

16 Sep at 09:21

When do we need curly braces around shell variables?

In shell scripts, when do we use `{}` when expanding variables? For example, I have seen the following: ``` var=10 # Declare variable echo "${var}" # One use of the variable echo "$var" # ...

Turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server

I have a WCF service that has been working perfectly, and something has changed and I don't know what. I get this exception: > System.ServiceModel.FaultException: The server was unable to process th...

1 Aug at 08:27

right align an image using CSS HTML

How can I right-align an image using CSS. I want the text to `wrap-around` the image. I want the right aligned image to be on a line by itself.

7 Mar at 01:32

Clear text from textarea with selenium

I've got some tests where I'm checking that the proper error message appears when text in certain fields are invalid. One check for validity is that a certain textarea element is not empty. If this ...