Questions Tagged with #Sql

Structured Query Language (SQL) is a language for querying databases. Questions should include code examples, table structure, sample data, and a tag for the DBMS implementation (e.g. MySQL, PostgreSQL, Oracle, MS SQL Server, IBM DB2, etc.) being used. If your question relates solely to a specific DBMS (uses specific extensions/features), use that DBMS's tag instead. Answers to questions tagged with SQL should use ISO/IEC standard SQL.

oracle - what statements need to be committed?

What are the list of statements that need to be committed before further action on the table in order to avoid a lock? I am not talking about full transactions with multiple statements and transaction..

PostgreSQL Crosstab Query

Does any one know how to create crosstab queries in PostgreSQL? For example I have the following table: Section Status Count A Active 1 A Inactive 2 B Active 4..

From a Sybase Database, how I can get table description ( field names and types)?

I have access to command line isql and I like to get Meta-Data of all the tables of a given database, possibly in a formatted file. How I can achieve that? Thanks...

Why does using an Underscore character in a LIKE filter give me all the results?

I wrote the below SQL query with a LIKE condition: SELECT * FROM Manager WHERE managerid LIKE '_%' AND managername LIKE '%_%' In the LIKE I want to search for any underscores %_%, but I know that m..

How to Ignore "Duplicate Key" error in T-SQL (SQL Server)

I have a transaction that contains multiple SQL Statements (INSERT, UPDATE and/or DELETES). When executing, I want to ignore Duplicate Error statements and continue onto the next statement. What's the..

SQL: sum 3 columns when one column has a null value?

SELECT sum(TotalHoursM) + (TotalHoursT) + (TotalHoursW) + (TotalHoursTH) + (TotalHoursF) AS TOTAL FROM LeaveRequest ..

How can I join on a stored procedure?

I have a stored procedure that takes no parameters, and it returns two fields. The stored procedure sums up all transactions that are applied to a tenant, and it returns the balance and the id of the ..

Query to get only numbers from a string

I have data like this: string 1: 003Preliminary Examination Plan string 2: Coordination005 string 3: Balance1000sheet The output I expect is string 1: 003 string 2: 005 string 3: 1000 And ..

Oracle - Best SELECT statement for getting the difference in minutes between two DateTime columns?

I'm attempting to fulfill a rather difficult reporting request from a client, and I need to find away to get the difference between two DateTime columns in minutes. I've attempted to use trunc and ro..

What's the best practice for primary keys in tables?

When designing tables, I've developed a habit of having one column that is unique and that I make the primary key. This is achieved in three ways depending on requirements: Identity integer column t..

How to do select from where x is equal to multiple values?

I am debugging some code and have encountered the following SQL query (simplified version): SELECT ads.*, location.county FROM ads LEFT JOIN location ON location.county = ads.county_id WHERE

Removing duplicate rows from table in Oracle

I'm testing something in Oracle and populated a table with some sample data, but in the process I accidentally loaded duplicate records, so now I can't create a primary key using some of the columns. ..

PostgreSQL DISTINCT ON with different ORDER BY

I want to run this query: SELECT DISTINCT ON (address_id) purchases.address_id, purchases.* FROM purchases WHERE purchases.product_id = 1 ORDER BY purchases.purchased_at DESC But I get this error: ..

When doing a MERGE in Oracle SQL, how can I update rows that aren't matched in the SOURCE?

I have a main database and a report database, and I need to sync a table from main into report. However, when an item gets deleted in the main database, I only want to set an IsDeleted flag in the re..


Using the command: CREATE TABLE IF NOT EXISTS `test`.`t1` ( `col` VARCHAR(16) NOT NULL ) ENGINE=MEMORY; Running this twice in the MySQL Query Browser results in: Table 't1' already exists E..

Currently running queries in SQL Server

Is there a program or a sql query that I can find which SQL queries are being run on an SQL Server 2012? I think there was a tool in earlier version of SQL Server where the actual query content gets d..

Time part of a DateTime Field in SQL

How would I be able to extract the time part of a DateTime field in SQL? For my project I have to return data that has a timestamp of 5pm of a DateTime field no matter what the date is..

How to delete from select in MySQL?

This code doesn't work for MySQL 5.0, how to re-write it to make it work DELETE FROM posts where id=(SELECT id FROM posts GROUP BY id HAVING ( COUNT(id) > 1 )) I want to delete columns that don..

How to get the top 10 values in postgresql?

I have simple question: I have a postgresql database: Scores(score integer). How would I get the highest 10 scores the fastest? UPDATE: I will be doing this query multiple times and am aiming f..

The SQL OVER() clause - when and why is it useful?

USE AdventureWorks2008R2; GO SELECT SalesOrderID, ProductID, OrderQty ,SUM(OrderQty) OVER(PARTITION BY SalesOrderID) AS 'Total' ,AVG(OrderQty) OVER(PARTITION BY SalesOrderID) AS 'Avg' ..

Foreign key constraints: When to use ON UPDATE and ON DELETE

I'm designing my database schema using MySQL Workbench, which is pretty cool because you can do diagrams and it converts them :P Anyways, I've decided to use InnoDB because of it's Foreign Key suppor..

Postgres: SQL to list table foreign keys

Is there a way using SQL to list all foreign keys for a given table? I know the table name / schema and I can plug that in...

Calculate a Running Total in SQL Server

Imagine the following table (called TestTable): id somedate somevalue -- -------- --------- 45 01/Jan/09 3 23 08/Jan/09 5 12 02/Feb/09 0 77 14/Feb/09 7 39 20..

SQLite select where empty?

In SQLite, how can I select records where some_column is empty? Empty counts as both NULL and ""...

python list in sql query as parameter

I have a python list, say l l = [1,5,8] I want to write a sql query to get the data for all the elements of the list, say select name from students where id = |IN THE LIST l| How do I accomplish..

SQL order string as number

I have numbers saved as VARCHAR to a MySQL database. I can not make them INT due to some other depending circumstances. It is taking them as character not as number while sorting. In database I hav..

dbms_lob.getlength() vs. length() to find blob size in oracle

I'm getting the same results from select length(column_name) from table as select dbms_lob.getlength(column_name) from table However, the answers to this question seem to favor using dbms_lob.g..

Concatenate multiple result rows of one column into one, group by another column

I'm having a table like this Movie Actor A 1 A 2 A 3 B 4 I want to get the name of a movie and all actors in that movie, and I want the result to be in a format..

insert datetime value in sql database with c#

How do I insert a datetime value into a SQL database table where the type of the column is datetime?..

Convert NVARCHAR to DATETIME in SQL Server 2008

In my table LoginDate 2013-08-29 13:55:48 The loginDate column's datatype is nvarchar(150) I want to convert the logindate column into date time format using SQL command Expected result. ..

MySQL DELETE FROM with subquery as condition

I am trying to do a query like this: DELETE FROM term_hierarchy AS th WHERE th.parent = 1015 AND th.tid IN ( SELECT DISTINCT(th1.tid) FROM term_hierarchy AS th1 INNER JOIN term_hierarchy ..

List names of all tables in a SQL Server 2012 schema

I have a schema in SQL Server 2012. Is there a command that I can run in SQL to get the names of all the tables in that schema that were populated by user? I know a similar query for MySQL SHOW TABL..

What is the difference between SQL and MySQL?

I am new to databases and I was wondering: What is the difference between SQL and MySQL?..

Multiple left joins on multiple tables in one query

I've got one master table, which has items stored in multiple levels, parents and childs, and there is a second table which may or may not have additional data. I need to query two levels from my mast..

How to return string value from the stored procedure

Alter procedure S_Comp(@str1 varchar(20),@r varchar(100) out) as declare @str2 varchar(100) set @str2 ='welcome to sql server. Sql server is a product of Microsoft' if(PATINDEX('%'+@str1 +'%',@str2)..

Create a SQL query to retrieve most recent records

I am creating a status board module for my project team. The status board allows the user to to set their status as in or out and they can also provide a note. I was planning on storing all the inform..

Is there a workaround for ORA-01795: maximum number of expressions in a list is 1000 error?

Is there a workaround for 'ORA-01795: maximum number of expressions in a list is 1000 error' I have a query and it is selecting fields based on the value of one field. I am using the in clause and ..

Insert entire DataTable into database at once instead of row by row?

I have a DataTable and need the entire thing pushed to a Database table. I can get it all in there with a foreach and inserting each row at a time. This goes very slow though since there are a few th..

Can I add a UNIQUE constraint to a PostgreSQL table, after it's already created?

I have the following table: tickername | tickerbbname | tickertype ------------+---------------+------------ USDZAR | USDZAR Curncy | C EURCZK | EURCZK Curncy | C EURPLN | EURPLN Cur..

SQL Sum Multiple rows into one

I need some help with the SUM feature. I am trying to SUM the bill amounts for the same account into one grand total, but the results I am getting show my SUM column just multiples my first column by..

Can I use multiple "with"?

Just for example: With DependencedIncidents AS ( SELECT INC.[RecTime],INC.[SQL] AS [str] FROM ( SELECT A.[RecTime] As [RecTime],X.[SQL] As [SQL] FROM [EventView] AS A CROSS J..

Different CURRENT_TIMESTAMP and SYSDATE in oracle

After executing this SQL in oracle 10g: SELECT SYSDATE, CURRENT_TIMESTAMP FROM DUAL I receive this strange output: What is cause of the difference in time? The server time is equal of SYSDATE v..

ORA-00904: invalid identifier

I tried to write the following inner join query using an Oracle database: SELECT Employee.EMPLID as EmpID, Employee.FIRST_NAME AS Name, Team.DEPARTMENT_CODE AS TeamID, Team..

SQL UPDATE all values in a field with appended string CONCAT not working

Here is what I want to do: current table: +----+-------------+ | id | data | +----+-------------+ | 1 | max | | 2 | linda | | 3 | sam | | 4 | henry ..

fastest way to export blobs from table into individual files

What is the fastest way to export files (blobs) stored in a SQL Server table into a file on the hard drive? I have over 2.5 TB of files (90 kb avg) stored as varbinary and I need to extract each one ..


Ok, so my schema is this: Table: Timesheet_Hours Columns: Timesheet_Id (PK, int) Staff_Id (int) BookedHours (int) Posted_Flag (boolean) This is an extremely simplified version of the table, but it w..

sql - insert into multiple tables in one query

assuming that i have two tables, names and phones and i want to insert data from some input to the tables, in one query- How can it be done? Please, if it can be done, explain the syntax...

A table name as a variable

I am trying to execute this query: declare @tablename varchar(50) set @tablename = 'test' select * from @tablename This produces the following error: Msg 1087, Level 16, State 1, Line 5 Must declare..

SQL query for getting data for last 3 months

How can you get today's date and convert it to 01/mm /yyyy format and get data from the table with delivery month 3 months ago? Table already contains delivery month as 01/mm/yyyy...

How to generate and manually insert a uniqueidentifier in sql server?

I'm trying to manually create a new user in my table but impossible to generate a "UniqueIdentifier" type without threw an exception ... Here is my example: DECLARE @id uniqueidentifier SET @id = NE..

How to do a batch insert in MySQL

I have 1-many number of records that need to be entered into a table. What is the best way to do this in a query? Should I just make a loop and insert one record per iteration? Or is there a better..

Check for a substring in a string in Oracle without LIKE

How can I check for a substring in a string in Oracle without using LIKE? Let's say I want to select all users from a table that have the letter "z" in their last name: SELECT * FROM users WHERE last..

Increasing the Command Timeout for SQL command

I have a little problem and hoping someone can give me some advice. I am running a SQL command, but it appears it takes this command about 2 mins to return the data as there is a lot of data. But the ..

Codeigniter LIKE with wildcard(%)

I have simple database query in codeigniter, however I cannot get search to work with wildcard. This is my code: $this->db->like('film.title',"%$query%"); $this->db->escape_like_str($quer..

SQL query to select distinct row with minimum value

I want an SQL statement to get the row with a minimum value. Consider this table: id game point 1 x 5 1 z 4 2 y 6 3 x 2 3 y 5 3 z 8 How do I sel..

The multi-part identifier could not be bound

I've seen similar errors on SO, but I don't find a solution for my problem. I have a SQL query like: SELECT DISTINCT a.maxa , b.mahuyen , a.tenxa , b.tenhuyen , ..

How do I change db schema to dbo

I imported a bunch of tables from an old sql server (2000) to my 2008 database. All the imported tables are prefixed with my username, for example: jonathan.MovieData. In the table properties it lis..

SQL query to find third highest salary in company

I need to write a query that will return the third highest salaried employee in the company. I was trying to accomplish this with subqueries, but could not get the answer. My attempts are below: se..

SQL Server: How to check if CLR is enabled?

SQL Server 2008 - What is an easy way to check if clr is enabled?..

Fastest way to update 120 Million records

I need to initialize a new field with the value -1 in a 120 Million record table. Update table set int_field = -1; I let it run for 5 hours before canceling it. I tried running it with tran..

Case statement in MySQL

I have a database table called 'tbl_transaction' with the following definition: id INT(11) Primary Key action_type ENUM('Expense', 'Income') action_heading VARCHAR (255) action_amount FLOAT I would..

How do I UPDATE from a SELECT in SQL Server?

In SQL Server, it is possible to insert rows into a table with an INSERT.. SELECT statement: INSERT INTO Table (col1, col2, col3) SELECT col1, col2, col3 FROM other_table WHERE sql = 'cool' Is it a..

Save PL/pgSQL output from PostgreSQL to a CSV file

What is the easiest way to save PL/pgSQL output from a PostgreSQL database to a CSV file? I'm using PostgreSQL 8.4 with pgAdmin III and PSQL plugin where I run queries from...

Multiple conditions with CASE statements

I need to query some data. here is the query that i have constructed but which isn't workig fine for me. For this example I am using AdventureWorks database. SELECT * FROM [Purchasing].[Vendor] WHERE..

how to pass variable from shell script to sqlplus

I have a shell script that calls file.sql I am looking for a way to pass some parameters to my file.sql. If I don't pass a variable with some value to the sql script, I will have to create multiple ..

How do I view the Explain Plan in Oracle Sql developer?

I have few SQL queries which has very low query running performance and I want to check the query execution plan for this query. I am trying to execute the below query but its not showing any query ex..

Combine two columns and add into one new column

In PostgreSQL, I want to use an SQL statement to combine two columns and create a new column from them. I'm thinking about using concat(...), but is there a better way? What's the best way to do this..

MySQL: Error Code: 1118 Row size too large (> 8126). Changing some columns to TEXT or BLOB

I want to create a table of 325 column: CREATE TABLE NAMESCHEMA.NAMETABLE ( ROW_ID TEXT NOT NULL , //this is the primary key 324 column of these types: CHAR(1), DATE, ..

In MySQL, how to copy the content of one table to another table within the same database?

I am new to MySQL. I would like to copy the content of one table to another table within the same database. Basically, I would like to insert to a table from another table. Is there easy way of doing ..

SQL QUERY replace NULL value in a row with a value from the previous known value

I have 2 columns date number ---- ------ 1 3 2 NULL 3 5 4 NULL 5 NULL 6 2 ....... I need to replace ..

SQL Server convert select a column and convert it to a string

Is it possible to write a statement that selects a column from a table and converts the results to a string? Ideally I would want to have comma separated values. For example, say that the SELECT sta..

SQL Bulk Insert with FIRSTROW parameter skips the following line

I can't seem to figure out how this is happening. Here's an example of the file that I'm attempting to bulk insert into SQL server 2005: ***A NICE HEADER HERE*** 0000001234|SSNV|00013893-03JUN09 00..

How can I see CakePHP's SQL dump in the controller?

Is there a way that one can cause CakePHP to dump its SQL log on demand? I'd like to execute code up until a point in my controller and see what SQL has been run...

How do I use select with date condition?

In sqlserver, how do I compare dates? For example: Select * from Users where RegistrationDate >= '1/20/2009' (RegistrationDate is datetime type) Thanks..

Give all permissions to a user on a PostgreSQL database

I would like to give an user all the permissions on a database without making it an admin. The reason why I want to do that is that at the moment DEV and PROD are different DBs on the same cluster so ..

Generic XSLT Search and Replace template

I am trying to find (before re-inventing) a "simple" XSLT template that will take ANY xml document, find ALL text elements within that XML and replace all ' with ''. I'm doing a "SELECT ... FOR XML" ..

PostgreSQL: insert from another table

I'm trying to insert data to a table from another table and the tables have only one column in common. The problem is, that the TABLE1 has columns that won't accept null values so I can't leave them e..

Do we need to execute Commit statement after Update in SQL Server

I have done some update to my record through SQL Server Manager. As Update statement is not having explicit commit, I am trying to write it manually. Update mytable set status=0; Commit; I am gett..

Copy data from one existing row to another existing row in SQL?

I have a table full of tracking data for as specific course, course number 6. Now I have added new tracking data for course number 11. Each row of data is for one user for one course, so for users a..

Alter Table Add Column Syntax

I'm trying to programmatically add an identity column to a table Employees. Not sure what I'm doing wrong with my syntax. ALTER TABLE Employees ADD COLUMN EmployeeID int NOT NULL IDENTITY (1, 1) A..

Oracle - How to create a materialized view with FAST REFRESH and JOINS

So I'm pretty sure Oracle supports this, so I have no idea what I'm doing wrong. This code works: CREATE MATERIALIZED VIEW MV_Test NOLOGGING CACHE BUILD IMMEDIATE REFRESH FAST ON COMMIT ..

Insert Multiple Rows Into Temp Table With SQL Server 2012

These StackOverflow questions here, here, and here all say the same thing, but I can't get it to run in SSMS or SQLFiddle CREATE TABLE #Names ( Name1 VARCHAR(100), Name2 VARCHAR(100) ) ..

SQL: Combine Select count(*) from multiple tables

How do you combine multiple select count(*) from different table into one return? I have a similar sitiuation as this post but I want one return. I tried Union all but it spit back 3 separate rows ..

How to pass multiple values to single parameter in stored procedure

I'm using SSRS for reporting and executing a stored procedure to generate the data for my reports DECLARE @return_value int EXEC @return_value = [dbo].[MYREPORT] @ComparePeriod = 'Daily',..

Convert timestamp to date in Oracle SQL

How can we convert timestamp to date? The table has a field, start_ts which is of the timestamp format: '05/13/2016 4:58:11.123456 PM' I need to query the table and find the maximum and min timest..

sql query distinct with Row_Number

I am fighting with the distinct keyword in sql. I just want to display all row numbers of unique (distinct) values in a column & so I tried: SELECT distinct id, ROW_NUMBER() OVER (ORDER BY id) A..

How to get difference between two rows for a column field?

I have a table like this: rowInt Value 2 23 3 45 17 10 9 0 .... The column rowInt values are integer but not in a sequence with same increament. I can use the following sql ..

How do I set a column value to NULL in SQL Server Management Studio?

How do I clear the value from a cell and make it NULL?..

How can prepared statements protect from SQL injection attacks?

How do prepared statements help us prevent SQL injection attacks? Wikipedia says: Prepared statements are resilient against SQL injection, because parameter values, which are transmitted later using ..

How to create Temp table with SELECT * INTO tempTable FROM CTE Query

I have a MS SQL CTE query from which I want to create a temporary table. I am not sure how to do it as it gives an Invalid Object name error. Below is the whole query for reference SELECT * INTO TEM..

SQL LEFT JOIN Subquery Alias

I'm running this SQL query: SELECT wp_woocommerce_order_items.order_id As No_Commande FROM wp_woocommerce_order_items LEFT JOIN ( SELECT meta_value As Prenom FROM wp_postmeta ..

MySQL: Invalid use of group function

I am using MySQL. Here is my schema: Suppliers(sid: integer, sname: string, address string) Parts(pid: integer, pname: string, color: string) Catalog(sid: integer, pid: integer, cost: real) (prima..

What's the purpose of SQL keyword "AS"?

You can set table aliases in SQL typing the identifier right after the table name. SELECT * FROM table t1; You can even use the keyword AS to indicate the alias. SELECT * FROM table AS t1; What'..


I have been given a specification that requires the ISO 8601 date format, does any one know the conversion codes or a way of getting these 2 examples: ISO 8601 Extended Date 2000-01-14T13:42Z ISO 86..

ORACLE: Updating multiple columns at once

I am trying to update two columns using the same update statement can it be done? IF V_COUNT = 9 THEN UPDATE INVOICE SET INV_DISCOUNT = DISC3 * INV_SUBTOTAL , INV_TOTA..

How to find the number of days between two dates

I have a basic query: SELECT dtCreated , bActive , dtLastPaymentAttempt , dtLastUpdated , dtLastVisit FROM Customers WHERE (bActive = 'true') AND (dtLastUpdated > CONVERT(DATE..

What is the difference between a hash join and a merge join (Oracle RDBMS )?

What are the performance gains/losses between hash joins and merge joins, specifically in Oracle RDBMS?..

Case in Select Statement

I have an SQL statement that has a CASE from SELECT and I just can't get it right. Can you guys show me an example of CASE where the cases are the conditions and the results are from the cases. For ex..

Move SQL Server 2008 database files to a new folder location

Logical Name my_Data my_Log Path: C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA FileName: my.MDF m..

SQL Server Operating system error 5: "5(Access is denied.)"

I am starting to learn SQL and I have a book that provides a database to work on. These files below are in the directory but the problem is that when I run the query, it gives me this error: Msg 5..

Why is Python running my module when I import it, and how do I stop it?

I have a Python program I'm building that can be run in either of 2 ways: the first is to call "python" which prompts the user for input in a friendly manner and then runs the user input throu..

Create numpy matrix filled with NaNs

I have the following code: r = numpy.zeros(shape = (width, height, 9)) It creates a width x height x 9 matrix filled with zeros. Instead, I'd like to know if there's a function or way to initialize..

How to configure port for a Spring Boot application

How do I configure the TCP/IP port listened on by a Spring Boot application, so it does not use the default port of 8080...

Web Service vs WCF Service

What is the difference between them? When would I opt for one over the other?..

JAVA_HOME directory in Linux

Is there any linux command I could use to find out JAVA_HOME directory? I've tried print out the environment variables ("env") but I can't find the directory...

Python Matplotlib figure title overlaps axes label when using twiny

I am trying to plot two separate quantities on the same graph using twiny as follows: fig = figure() ax = fig.add_subplot(111) ax.plot(T, r, 'b-', T, R, 'r-', T, r_geo, 'g-') ax.set_yscale('log') ax...

Copy or rsync command

The following command is working as expected... cp -ur /home/abc/* /mnt/windowsabc/ Does rsync has any advantage over it? Is there a better way to keep to backup folder in sync every 24 hours?..

Access-Control-Allow-Origin and Angular.js $http

Whenever I make a webapp and I get a CORS problem, I start making coffee. After screwing with it for a while I manage to get it working but this time it's not and I need help. Here is the client side..

Render HTML in React Native

In my React Native app, I am pulling in JSON data that has raw HTML elements like this: <p>This is some text. Let&#8217;s figure out...</p> I've added the data to a view in my app lik..

Move seaborn plot legend to a different position?

I'm using factorplot(kind="bar") with seaborn. The plot is fine except the legend is misplaced: too much to the right, text goes out of the plot's shaded area. How do I make seaborn place the legend..

How to read all files in a folder from Java?

How to read all the files in a folder through Java?..

Why Would I Ever Need to Use C# Nested Classes

I'm trying to understand about nested classes in C#. I understand that a nested class is a class that is defined within another class, what I don't get is why I would ever need to do this...

Fastest way to flatten / un-flatten nested JSON objects

I threw some code together to flatten and un-flatten complex/nested JSON objects. It works, but it's a bit slow (triggers the 'long script' warning). For the flattened names I want "." as the delimit..

Resize height with Highcharts

I have a Highchart which resizes the width beatuifully when the window change size. But not the height. I tried this set chart size but it's not working proberly. Is there any other way to automatical..

Is there a way to pass optional parameters to a function?

Is there a way in Python to pass optional parameters to a function while calling it and in the function definition have some code based on "only if the optional parameter is passed"..

How to get ID of the last updated row in MySQL?

How do I get the ID of the last updated row in MySQL using PHP?..

How can I find the length of a number?

I'm looking to get the length of a number in JavaScript or jQuery? I've tried value.length without any success, do I need to convert this to a string first?..

On select change, get data attribute value

The following code returns 'undefined'... $('select').change(function(){ alert($(this).data('id')); }); <select> <option data-id="1">one</option> <option data-id="2"..

window.close() doesn't work - Scripts may close only the windows that were opened by it

I'm having a problem always when I'm trying to close a window through the window.close() method of the Javascript, while the browser displays the below message on the console: "Scripts may close only..

check if directory exists and delete in one command unix

Is it possible to check if a directory exists and delete if it does,in Unix using a single command? I have situation where I use ANT 'sshexec' task where I can run only a single command in the remote ..

Disable vertical sync for glxgears

Sometimes you need to check whether you Linux 3D acceleration is really working (besides the glxinfo output). This can be quickly done by the glxgears tool. However, the FPS are often limited to the d..

Passing multiple parameters to function in Python

I need some way to use a function within that accepts more than one parameter. As per my understanding, the target function of can only have one iterable as a parameter but is th..

How to use an existing database with an Android application

I have already created an SQLite database. I want to use this database file with my Android project. I want to bundle this database with my application. Instead of creating a new database, how can t..

How to disable a particular checkstyle rule for a particular line of code?

I have a checkstyle validation rule configured in my project, that prohibits to define class methods with more than 3 input parameters. The rule works fine for my classes, but sometimes I have to exte..

Maximum length of HTTP GET request

What's the maximum length of an HTTP GET request? Is there a response error defined that the server can/should return if it receives a GET request that exceeds this length? This is in the context of..

Chart.js canvas resize

In (Android WebView HTML5 canvas error) i posted a question regarding plotting graphs using Graph.js library. The problem i have now is that if i call the function to plot the graph multiple times, th..

Bootstrap with jQuery Validation Plugin

I am trying to add validation to my form with jQuery Validation Plugin, but I'm having a problem where the plugin puts the error messages when I'm using input groups. $('form').validate({ rules..

Uncaught (in promise): Error: StaticInjectorError(AppModule)[options]

I have a strange error. Usually (I did my googling), in this case of errors Angular specifies in square brackets which exactly module/service/provider/etc caused the problem. However here, it says onl..

How do I set the background color of my main screen in Flutter?

I'm learning Flutter, and I'm starting from the very basics. I'm not using MaterialApp. What's a good way to set the background color of the whole screen? Here's what I have so far: import 'package:..

Get commit list between tags in git

If I've a git repository with tags representing the versions of the releases. How can I get the list of the commits between two tags (with a pretty format if is possible) ?..

What are the special dollar sign shell variables?

In Bash, there appear to be several variables which hold special, consistently-meaning values. For instance, ./myprogram &; echo $! will return the PID of the process which backgrounded myprogr..

How do I remove objects from an array in Java?

Given an array of n Objects, let's say it is an array of strings, and it has the following values: foo[0] = "a"; foo[1] = "cc"; foo[2] = "a"; foo[3] = "dd"; What do I have to do to delete/remove al..

Get mouse wheel events in jQuery?

Is there a way to get the mouse wheel events (not talking about scroll events) in jQuery?..

How to disable Google Chrome auto update?

Does anyone know how to disable Google Chrome for being automatic update itself, it cause my web application always change? I have tried these methods: Use the Google Update ADM templates provided..

Jinja2 template variable if None Object set a default value

How to make a variable in jijna2 default to "" if object is None instead of doing something like this? {% if p %} {{ p.User['first_name']}} {% else %} NONE {%endi..

htaccess "order" Deny, Allow, Deny

I would like to allow only one country access, but exclude proxies within this country. This is what I have (shortened version for convenience) <Limit GET POST> order deny,allow deny from all ..

How to use regex in file find

I was trying to find all files dated and all files 3 days or more ago. find /home/test -name 'test.log.\d{4}-d{2}-d{2}.zip' -mtime 3 It is not listing anything. What is wrong with it?..

How to have image and text side by side

I'm trying to have the [as shown in picture] , facebook icon and text side by side. I cannot able to get that clearly. My tried code CSS .iconDetails { margin-left:2%; float:left; height:40px;..

Why maven? What are the benefits?

What are the main benefits of using maven compared to let's say ant ? It seems to be more of a annoyance than a helpful tool. I use maven 2, with plain Eclipse Java EE (no m2eclipse), and tomcat. Sup..

Export multiple classes in ES6 modules

I'm trying to create a module that exports multiple ES6 classes. Let's say I have the following directory structure: my/ +-- module/ +-- Foo.js +-- Bar.js +-- index.js Foo.js and Bar.js..

JavaScript moving element in the DOM

Let's say I have three <div> elements on a page. How can I swap positions of the first and third <div>? jQuery is fine...

How can I switch my git repository to a particular commit

In my git repository, I made 5 commits, like below in my git log: commit 4f8b120cdafecc5144d7cdae472c36ec80315fdc Author: Michael Date: Fri Feb 4 15:26:38 2011 -0800 commit b688d46f55db1bc304f7f6..

How to show the Project Explorer window in Eclipse

Suddenly my project explorer window has disappeared from Eclipse. I try selecting Windows > Show View > Project Explorer, but nothing happens. What can I do?..

List and kill at jobs on UNIX

I have created a job with the at command on Solaris 10. It's working now but I want to kill it but I don't know how I can find the job number and how to kill that job or process...

remove first element from array and return the array minus the first element

_x000D_ _x000D_ var myarray = ["item 1", "item 2", "item 3", "item 4"];_x000D_ _x000D_ //removes the first element of the array, and returns that element._x000D_ alert(myarray.shift());_x000D_ //alert..

How can I make a JUnit test wait?

I have a JUnit test that I want to wait for a period of time synchronously. My JUnit test looks like this: @Test public void testExipres(){ SomeCacheObject sco = new SomeCacheObject(); sco.put..

Is there a combination of "LIKE" and "IN" in SQL?

In SQL I (sadly) often have to use "LIKE" conditions due to databases that violate nearly every rule of normalization. I can't change that right now. But that's irrelevant to the question. Further, I..

Ant if else condition?

Is there an if/else condition that I can use for an Ant task? This is what i have written so far: <target name="prepare-copy" description="copy file based on condition"> <echo>Ge..

How to set IntelliJ IDEA Project SDK

I just installed IntelliJ IDEA and when I try to create my first Project it asks for me to set up the Project SDK. When I click on "JDK" it asks for me to select the home directory of the JDK as shown..

How do I display a MySQL error in PHP for a long query that depends on the user input?

In PHP, I am trying to execute a long MySQL query that depends on the user input. However, my query fails with the following message, "Query Failed". Actually I have printed this message whenever t..

When to use <span> instead <p>?

As the question indicates, if I have some text that I want to add in the HTML then when should I use <p> and when should I use <span>?..

LDAP server which is my base dn

Hello I'm trying to use my ldap test server in order to authenticate users in openca. I'm currently connecting through phpldapadmin with : Login DN : cn=admin,dc=example,dc=com Password : mypas..

JSLint is suddenly reporting: Use the function form of "use strict"

I include the statement: "use strict"; at the beginning of most of my Javascript files. JSLint has never before warned about this. But now it is, saying: Use the function form of "use strict"...

What is the difference between 'SAME' and 'VALID' padding in tf.nn.max_pool of tensorflow?

What is the difference between 'SAME' and 'VALID' padding in tf.nn.max_pool of tensorflow? In my opinion, 'VALID' means there will be no zero padding outside the edges when we do max pool. Accordin..

Fastest JSON reader/writer for C++

I need a C++ JSON parser & writer. Speed and reliability are very critical, I don't care if the interface is nice or not, if it's Boost-based or not, even a C parser is fine (if it's considerably ..

How to print a specific row of a pandas DataFrame?

I have a massive dataframe, and I'm getting the error: TypeError: ("Empty 'DataFrame': no numeric data to plot", 'occurred at index 159220') I've already dropped nulls, and checked dtypes for the Da..

sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 74 supplied

def insert(array): connection=sqlite3.connect('images.db') cursor=connection.cursor() cnt=0 while cnt != len(array): img = array[cnt] print(array[cnt]) ..

IntelliJ - show where errors are

Is there a way to make IntelliJ mark error locations continuously for the files you are working on in the similar manner as Eclipse does? At the moment I need to make the project which lists all the e..

Load view from an external xib file in storyboard

I want to use a view throughout multiple viewcontrollers in a storyboard. Thus, I thought about designing the view in an external xib so changes are reflected in every viewcontroller. But how can one ..

Check if a string matches a regex in Bash script

One of the arguments that my script receives is a date in the following format: yyyymmdd. I want to check if I get a valid date as an input. How can I do this? I am trying to use a regex like: [0-9]..

Get the size of the screen, current web page and browser window

How can I get windowWidth, windowHeight, pageWidth, pageHeight, screenWidth, screenHeight, pageX, pageY, screenX, screenY which will work in all major browsers? ..

How to remove the arrows from input[type="number"] in Opera

Just looking to remove these arrows, convenient in certain situations. I would like to preserve the browser's awareness of the content being purely numeric however. So changing it to input[type="text..

CSS styling in Django forms

I would like to style the following: from django import forms class ContactForm(forms.Form): subject = forms.CharField(max_length=100) email = forms.EmailField(required=False) ..

Compilation error - missing zlib.h

I am trying to compile software on Blue Gene Q using IBM XL compilers and I got this error message: "iostreams/zlib.cpp", line 19.10: 1540-0836 (S) The #include file "zlib.h" is not found. make[3]: *..

Bootstrap row class contains margin-left and margin-right which creates problems

I am using Bootstrap 'row' class to align divs one on top of another, which works fine but .row { margin-left: -15px; margin-right: -15px; } What I noticed is that it specifies margin-left ..

Where does one get the "sys/socket.h" header/source file?

I've been trying to write a server in C++ Unix style, but I'm stuck on a Windows machine. I started with MinGW, but it didn't compile right and told me that it couldn't find the "sys/socket.h" file. W..

How to trigger a file download when clicking an HTML button or JavaScript

This is crazy but I don't know how to do this, and because of how common the words are, it's hard to find what I need on search engines. I'm thinking this should be an easy one to answer. I want a si..

Pandas concat: ValueError: Shape of passed values is blah, indices imply blah2

I'm trying to merge a (Pandas 14.1) dataframe and a series. The series should form a new column, with some NAs (since the index values of the series are a subset of the index values of the dataframe)...

Laravel Eloquent - Get one Row

This might be a simple question, but I cannot figure this out. I am trying to get a user by email using: $user = User::whereEmail($email)->get(); But this is returning an array (of dimension 1) ..

How do you display a Toast from a background thread on Android?

How can I display Toast messages from a thread? ..

Count(*) vs Count(1) - SQL Server

Just wondering if any of you people use Count(1) over Count(*) and if there is a noticeable difference in performance or if this is just a legacy habit that has been brought forward from days gone pas..

Overlaying histograms with ggplot2 in R

I am new to R and am trying to plot 3 histograms onto the same graph. Everything worked fine, but my problem is that you don't see where 2 histograms overlap - they look rather cut off. When I make de..

jQuery pass more parameters into callback

Is there a way to pass more data into a callback function in jQuery? I have two functions and I want the callback to the $.post, for example, to pass in both the resulting data of the AJAX call, as w..

How do I POST an array of objects with $.ajax (jQuery or Zepto)

I'd like to POST an array of objects with $.ajax in Zepto or Jquery. Both exhibit the same odd error, but I can't find what I'm doing wrong. The data saves to the server when sent using a test client..

New Intent() starts new instance with Android: launchMode="singleTop"

I have Activity A with android:launchMode="singleTop" in the manifest. If I go to Activity B, C, and D there I have menu shortcuts to return to my applications root activity (A). The code looks like..

What does "commercial use" exactly mean?

There is a lot of open source engines and software with different licences conditions. Most of them are non-free for commercial use. The question is what does "commercial use" exactly mean? Example..

Outline effect to text

Are there any ways in CSS to give outlines to text with different colors ? I want to highlight some parts of my text to make it more intuitive - like the names, links, etc. Changing the link colors et..

How to write a function that takes a positive integer N and returns a list of the first N natural numbers

I'm taking this online Python course and trying to solve the following problem called Coding Exercise: It's Natural: Write a function naturalNumbers which takes a positive integer n as input, and ..

Get and Set a Single Cookie with Node.js HTTP Server

I want to be able to set a single cookie, and read that single cookie with each request made to the nodejs server instance. Can it be done in a few lines of code, without the need to pull in a third p..

How to check if one DateTime is greater than the other in C#

I have two DateTime objects: StartDate and EndDate. I want to make sure StartDate is before EndDate. How is this done in C#?..

Is it possible for UIStackView to scroll?

Let's say I have added more views in UIStackView which can be displayed, how I can make the UIStackView scroll?..

How to position the div popup dialog to the center of browser screen?

I need to position div popup to the center of browser screen ( no matter what size the screen is). And I want to keep the position as absolute as I don't want to move the popup down when I scroll down..

Android Studio: Default project directory

Whenever I create a new project in Android Studio it wants to put it in a generic default folder at a location something similar to (dependent on OS - Ubuntu here): /home/USER/AndroidStudioProjects/ ..

How do I install Python packages on Windows?

I'm having a hard time setting up python packages. EasyInstall from SetupTools is supposed to help that, but they don't have an executable for Python 2.6. For instance to install Mechanize, I'm just ..

How to list branches that contain a given commit?

How can I query git to find out which branches contain a given commit? gitk will usually list the branches, unless there are too many, in which case it just says "many (38)" or something like that. I ..

equivalent of vbCrLf in c#

I have a to do this: AccountList.Split(vbCrLf) In c# AccountList is a string. How can i do? thanks..

Regex to check whether a string contains only numbers

hash = window.location.hash.substr(1); var reg = new RegExp('^[0-9]$'); console.log(reg.test(hash)); I get false on both "123" and "123f". I would like to check if the hash only contains numbers. Di..

What's the best way to determine which version of Oracle client I'm running?

The subject says it all: What is the best way to determine the exact version of the oracle client I'm running? Our clients are all running Windows. I found one suggestion to run the tnsping utility..

How to run docker-compose up -d at system start up?

To let the containers autostart at startup point, I tried to add the command: cd directory_has_docker-compose.yml && docker-compose up -d in /etc/rc.local. but then after I reboot the..

How to stop console from closing on exit?

I'm using Visual Studio 2010 and Windows 7 x64 The command prompt closes after exit, even though I used "Start without debug". Is there a setting somewhere that I can use?..

Using the slash character in Git branch name

I'm pretty sure I saw somewhere in a popular Git project the branches had a pattern like "feature/xyz". However when I try to create a branch with the slash character, I get an error: $ git branch l..

How to detect if a browser is Chrome using jQuery?

I have a bit of an issue with a function running in chrome that works properly in Safari, both webkit browsers... I need to customize a variable in a function for Chrome, but not for Safari. Sadly, ..

How to replace a character with a newline in Emacs?

I am trying to replace a character - say ; - with a new line using replace-string and/or replace-regexp in Emacs. I have tried the following commands: M-x replace-string RET ; RET \n This will ..

Powershell Execute remote exe with command line arguments on remote computer

I've searched all over and tried different variations of commands, but I am still not there yet. My goal is to run an exe that already resides on a remote machine and pass in command line arguments. ..

TypeError: Router.use() requires middleware function but got a Object

There have been some middleware changes on the new version of express and I have made some changes in my code around some of the other posts on this issue but I can't get anything to stick. We had it..

How to use execvp()

The user will read a line and i will retain the first word as a command for execvp. Lets say he will type "cat file.txt" ... command will be cat . But i am not sure how to use this execvp(), i read ..

:before and background-image... should it work?

I've got a div and apply :before and :after an image as content. That works perfectly. Now I would need to apply a background image so it does repeat as the div resizes, but it does not seem to work. ..

Map and filter an array at the same time

I have an array of objects that I want to iterate over to produce a new filtered array. But also, I need to filter out some of the objects from the new array depending of a parameter. I'm trying this:..

js 'types' can only be used in a .ts file - Visual Studio Code using @ts-check

I am starting to use TypeScript in a Node project I am working on in Visual Studio Code. I wanted to follow the "opt-in" strategy, similar to Flow. Therefore I put // @ts-check at the top of my .js fi..

cURL not working (Error #77) for SSL connections on CentOS for non-root users

Just recently my server has stopped working for curl requests to https:// addresses for my web server. Having dug around a little it appears that it's a problem with the user the webserver is running..

Copy all values from fields in one class to another through reflection

I have a class which is basically a copy of another class. public class A { int a; String b; } public class CopyA { int a; String b; } What I am doing is putting values from class A into C..

How to copy and paste code without rich text formatting?

I used to often find myself coping a piece of code from a website/Word document etc only to discover that when doing Paste I would end up with the desired code plus some extra HTML tags/text, basicall..

Cannot declare instance members in a static class in C#

I have a public static class and I am trying to access appSettings from my app.config file in C# and I get the error described in the title. public static class employee { NameValueCollection app..

how to read a long multiline string line by line in python

I have a wallop of a string with many lines. How do I read the lines one by one with a for clause? Here is what I am trying to do and I get an error on the textData var referenced in the for line in..

Displaying Windows command prompt output and redirecting it to a file

How can I run a command-line application in the Windows command prompt and have the output both displayed and redirected to a file at the same time? If, for example, I were to run the command dir >..

Python write line by line to a text file

I am trying to output the result from a Python script to a text file where each output should be saved to a line. f1=open('./output.txt', 'a') f1.write(content + "\n") When I open output.txt with t..

python replace single backslash with double backslash

In python, I am trying to replace a single backslash ("\") with a double backslash("\"). I have the following code: directory = string.replace("C:\Users\Josh\Desktop\20130216", "\", "\\") However, ..

Check if property has attribute

Given a property in a class, with attributes - what is the fastest way to determine if it contains a given attribute? For example: [IsNotNullable] [IsPK] [IsIdentity] [SequenceNameAtt..

How can I prevent java.lang.NumberFormatException: For input string: "N/A"?

While running my code I am getting a NumberFormatException: java.lang.NumberFormatException: For input string: "N/A" at java.lang.NumberFormatException.forInputString(Unknown Source) at java...

Instantiate and Present a viewController in Swift

Issue I started taking a look of the new Swift on Xcode 6, and I tried some demo projects and tutorials. Now I am stuck at: Instantiating and then presenting a viewController from a specific storyboar..

Test class with a new() call in it with Mockito

I have a legacy class that contains a new() call to instantiate a LoginContext(): public class TestedClass { public LoginContext login(String user, String password) { LoginContext lc = new Logi..

How to create a laravel hashed password

I am trying to create an hashed password for Laravel. Now someone told me to use Laravel hash helper but I can't seem to find it or I'm looking in the wrong direction. How do I create a laravel hash..

Get current cursor position

I want to get the current mouse position of the window, and assign it to 2 variables x and y (co-ordinates relative to the window, not to the screen as a whole). I'm using Win32 and C++. And a quick..

How do I release memory used by a pandas dataframe?

I have a really large csv file that I opened in pandas as follows.... import pandas df = pandas.read_csv('large_txt_file.txt') Once I do this my memory usage increases by 2GB, which is expected bec..

TSQL select into Temp table from dynamic sql

This seems relatively simple, but apparently it's not. I need to create a temp table based on an existing table via the select into syntax: SELECT * INTO #TEMPTABLE FROM EXISTING_TABLE The problem..

jQuery move to anchor location on page load

I have a simple page setup such as: <div id="aboutUs"> About us content... </div> <div id="header"> Header content... </div> When the page loads, I need the page to auto..

ImportError: No module named - Python

I have a python application with the following directory structure: src | +---- main | +---- util | +---- gen_py | +---- lib In the package main, I have a python module name..

linq query to return distinct field values from a list of objects

class obj { int typeId; //10 types 0-9 string uniqueString; //this is unique } Assume there is list with 100 elements of obj, but only 10 unique typeIDs. Is it possible to do write a LINQ q..

Play a Sound with Python

What's the easiest way to play a sound file (.wav) in Python? By easiest I mean both most platform independent and requiring the least dependencies. pygame is certainly an option, but it seems overkil..

Is it safe to delete the "InetPub" folder?

Does anyone know if deleting the InetPub folder will hurt IIS or anything related? I am using IIS 7...

How to uninstall downloaded Xcode simulator?

How to uninstall one of the downloaded Xcode simulators? My iOS 7 Simulator won't boot (Unable to boot the iOS Simulator). I want to completely reinstall it. I tried: Deleting ~/Library/Caches/c..

How to remove index.php from URLs?

All of my URLs on my Magento installation require index.php in them, like: The problem is that the system by..

find index of an int in a list

Is there a way to get the index of an int from a list? Looking for something like list1.FindIndex(5) where I want to find the position of 5 in the list...

How to pad a string with leading zeros in Python 3

I'm trying to make length = 001 in Python 3 but whenever I try to print it out it truncates the value without the leading zeros (length = 1). How would I stop this happening without having to cast len..

How to make g++ search for header files in a specific directory?

I have a project (a library) that is subdivided into a few directories with code in them. I'd like to to have g++ search for header files in the project's root directory, so I can avoid different incl..

How to use requirements.txt to install all dependencies in a python project

I am new to python. Recently I got a project written by python and it requires some installation. I run below command to install but got an error. # pip install requirements.txt Collecting requireme..

jquery function val() is not equivalent to "$(this).value="?

When I try to set a text input to blank (when clicked) using $(this).value="", this does not work. I have to use $(this).val(''). Why? What is the difference? What is the mechanism behind the val fun..

format statement in a string resource file

I have strings defined in the usual strings.xml Resource file like this: <string name="hello_world"> HELLO</string> Is it possible to define format strings such as the one below resul..

how to get yesterday's date in C#

I want to retrieve yesterday's date in my ASP.NET web application using C#. I already digged about the topic but I guess I m not able to understand it. Code i m using is just giving me todays date ..

git: patch does not apply

I have a certain patch called my_pcc_branch.patch. When I try to apply it, I get following message: $ git apply --check my_pcc_branch.patch warning: src/main/java/.../ has type 1..

What is the difference between putting a property on application.yml or bootstrap.yml in spring boot?

What is the difference between putting a property on application.yml or bootstrap.yml in spring boot? In logging.config case, the application works different...

Cannot create PoolableConnectionFactory (Io exception: The Network Adapter could not establish the connection)

Hi I have having the exception above from a spring application, I am trying to connect to a clustered Oracle DB, but even if I try to connect to a single instance still have the same exception. The b..

How to add dll in c# project

I am trying to add a [Science.dll] in my project which should be staright forward. But I am getting a problem. Can someone tell me why? My C# project which I just copied from internet. using System;..

html 5 audio tag width

I was wondering if it's possible to set the width of the audio tag. It is not a supported feature by default, so "hacks" will be happily accepted. I already tried putting them in small div's and table..

Creating SVG graphics using Javascript?

How can I create SVG graphics using JavaScript? Do all browsers support SVG?..

SQL Delete Records within a specific Range

This is probably a very simple question for somebody with experience, but I just wanted to know the safest way to delete a couple of hundred records in an SQL table that fall between a specific range...

Register comdlg32.dll gets Regsvr32: DllRegisterServer entry point was not found

I have Windows 7, 64-bit. I'm trying to register a .dll (comdlg32.dll) using regsvr32. But I get an error that says the dll is read but the DLLRegistryServer entry point is not found. I have run the..

How to avoid installing "Unlimited Strength" JCE policy files when deploying an application?

I have an app that uses 256-bit AES encryption which is not supported by Java out of the box. I know to get this to function correctly I install the JCE unlimited strength jars in the security folder...

List file names based on a filename pattern and file content?

How can I use Grep command to search file name based on a wild card "LMN2011*" listing all files with this as beginning? I want to add another check on those file content. If file content has som..

How can I change the app display name build with Flutter?

I have created the app using Flutter create testapp. Now, I want to change the app name from "testapp" to "My Trips Tracker". How can I do that? I have tried changing from the Andr..

What is the equivalent of 'describe table' in SQL Server?

I have a SQL Server database and I want to know what columns and types it has. I'd prefer to do this through a query rather than using a GUI like Enterprise Manager. Is there a way to do this?..

What does HTTP/1.1 302 mean exactly?

Some article I read once said that it means jumping (from one URI to another), but I detected this "302" even when there was actually no jumping at all!..

Replace Fragment inside a ViewPager

I'm trying to use Fragment with a ViewPager using the FragmentPagerAdapter. What I'm looking for to achieve is to replace a fragment, positioned on the first page of the ViewPager, with another one. ..

Declaring abstract method in TypeScript

I am trying to figure out how to correctly define abstract methods in TypeScript: Using the original inheritance example: class Animal { constructor(public name) { } makeSound(input : string..

How do I tell CMake to link in a static library in the source directory?

I have a small project with a Makefile which I'm trying to convert to CMake, mostly just to get experience with CMake. For purposes of this example, the project contains a source file (C++, though I d..

How best to include other scripts?

The way you would normally include a script is with "source" eg: #!/bin/bash source echo "The main script" echo "The included script" The output of executing "./mai..

How to convert a full date to a short date in javascript?

I have a date like this Monday, January 9, 2010 I now want to convert it to 1/9/2010 mm/dd/yyyy I tried to do this var startDate = "Monday, January 9, 2010"; var convertedStartDate = new..

JAVA_HOME does not point to the JDK

I am trying to follow a tutorial about how to use ant to build and run your application. I've followed all the steps and have created the build file, but when I try to run ant it gives me this error. ..

How to create/read/write JSON files in Qt5

Qt5 has a new JSON parser and I want to use it. The problem is that it isn't too clear about what the functions do in layman's terms and how to write code with it. That or I could be reading it wrong...

JavaScript: Difference between .forEach() and .map()

I know that there were a lot of topics like this. And I know the basics: .forEach() operates on original array and .map() on the new one. In my case: function practice (i){ return i+1; }; var a..

When should I use git pull --rebase?

I know of some people who use git pull --rebase by default and others who insist never to use it. I believe I understand the difference between merging and rebasing, but I'm trying to put this in the..

RegEx to exclude a specific string constant

Can regular expression be utilized to match any string except a specific string constant let us say "ABC" ? Is this possible to exclude just one specific string constant? Thanks your help in advance...

convert php date to mysql format

I have a date field in php which is using this code: $date = mysql_real_escape_string($_POST['intake_date']); How do I convert this to MySql format 0000-00-00 for inclusion in db. Is it along the ..

Best way to get child nodes

I was wondering, JavaScript offers a variety of methods to get the first child element from any element, but which is the best? By best, I mean: most cross-browser compatible, fastest, most comprehens..

is it possible to evenly distribute buttons across the width of an android linearlayout

I have a linear layout (oriented horizontally) that contains 3 buttons. I want the 3 buttons to have a fixed width and be evenly distributed across the width of the linear layout. I can manage this ..

How to implement zoom effect for image view in android?

I have to implement image zooming, I have tried with so many codes.But i didnt get full idea of gesture events. I want to implement when we apply double tap, image will be zooming according to the tou..

How to retrieve the LoaderException property?

I get a error message while updating my service reference: Custom tool warning: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. How ca..

How do you do exponentiation in C?

I tried "x = y ** e", but that didn't work...

Apache SSL Configuration Error (SSL Connection Error)

I'm trying to configure Apache on my server to work with ssl, but everytime I visit my site, I get the following message in my browser: SSL connection error. Unable to make a secure connection to the..

Fill formula down till last row in column

I'm trying to draw down the formula that's in cell M3 to the end of the data set. I'm using column L as my base to determine the last cell with data. My formula is a concatenation of two cells with a..

Convert HTML5 into standalone Android App

I have a dynamic HTML5 document that does not contain any external resources (no images, css and scripts are coded inside of document). This HTML5 application is working fine with internet browser. I ..

Is there a native jQuery function to switch elements?

Can I easily swap two elements with jQuery? I'm looking to do this with one line if possible. I have a select element and I have two buttons to move up or down the options, and I already have the se..

How to pause javascript code execution for 2 seconds

I want to stop execution for 2 seconds. So is this, but now follows a code block: <html> <head> <title> HW 10.12 </title> <script type="text/javascript"> ..

C++ Convert string (or char*) to wstring (or wchar_t*)

string s = "????"; wstring ws = FUNCTION(s, ws); How would i assign the contents of s to ws? Searched google and used some techniques but they can't assign the exact content. The content is distort..

Correct way to synchronize ArrayList in java

I'm not sure if this is the correct way to synchronize my ArrayList. I have an ArrayList in_queue which is passed in from the registerInQueue function. ArrayList<Record> in_queue = null; publ..

Please add a @Pipe/@Directive/@Component annotation. Error

I am stuck in a situation here. I am getting an error like this. compiler.es5.js:1694 Uncaught Error: Unexpected value 'LoginComponent' declared by the module 'AppModule'. Please add a @Pipe/@Direc..

Can I set a TTL for @Cacheable

I am trying out the @Cacheable annotation support for Spring 3.1 and wondering if there is any way to make the cached data clear out after a time by setting a TTL? Right now from what I can see I need..

How to get JavaScript caller function line number? How to get JavaScript caller source URL?

I am using the following for getting the JavaScript caller function name: var callerFunc = arguments.callee.caller.toString(); callerFuncName = (callerFunc.substring(callerFunc.indexOf("function") + ..

Proper use of the IDisposable interface

I know from reading the Microsoft documentation that the "primary" use of the IDisposable interface is to clean up unmanaged resources. To me, "unmanaged" means things like database connections, sock..

Query an object array using linq

I would like to know how can I query an array of objects. For example I have an array object like CarList. So CarList[0] would return me the object Car. Car has properties Model and Make. Now, I want ..

How to sum all column values in multi-dimensional array?

How can I add all the columnar values by associative key? Note that key sets are dynamic. Input array: Array ( [0] => Array ( [gozhi] => 2 [uzorong] =>..

Prevent double curly brace notation from displaying momentarily before angular.js compiles/interpolates document

It seems to be primarily an issue in IE when there is a number of images/scripts to load, there can be a good amount of time where the literal {{stringExpression}} in the markup are displayed, then di..

How to turn IDENTITY_INSERT on and off using SQL Server 2008?

Why am I getting an error doing an insert when IDENTITY_INSERT is set to OFF? How do I turn it on properly in SQL Server 2008? Is it by using SQL Server Management Studio? I have run this query: ..

The Use of Multiple JFrames: Good or Bad Practice?

I'm developing an application which displays images, and plays sounds from a database. I'm trying to decide whether or not to use a separate JFrame to add images to the database from the GUI. I'm ju..

multiple prints on the same line in Python

I want to run a script, which basically shows an output like this: Installing XXX... [DONE] Currently, I print Installing XXX... first and then I print [DONE]. However, I now want to..

Pandas df.to_csv("file.csv" encode="utf-8") still gives trash characters for minus sign

I've read something about a Python 2 limitation with respect to Pandas' to_csv( ... etc ...). Have I hit it? I'm on Python 2.7.3 This turns out trash characters for = and - when they appear in strin..

lexers vs parsers

Are lexers and parsers really that different in theory? It seems fashionable to hate regular expressions: coding horror, another blog post. However, popular lexing based tools: pygments, geshi, or..

How to set the matplotlib figure default size in ipython notebook?

I use "$ipython notebook --pylab inline" to start the ipython notebook. The display matplotlib figure size is too big for me, and I have to adjust it manually. How to set the default size for the fi..

Syntax error: Illegal return statement in JavaScript

I am getting a really weird JavaScript error when I run this code: <script type = 'text/javascript'> var ask = confirm('".$message."'); if (ask == false) { return false; } else { ..

How to apply specific CSS rules to Chrome only?

Is there a way to apply the following CSS to a specific div only in Google Chrome? position:relative; top:-2px; ..

Execute Shell Script after post build in Jenkins

I am trying to execute a shell script if either the build pass or fails after post-build in Jenkins. I cannot see this option in post build to execute some shell script except for running a target...

Scroll to bottom of div?

I am creating a chat using Ajax requests and I'm trying to get messages div to scroll to the bottom without much luck. I am wrapping everything in this div: #scroll { height:400px; overflow:sc..

How do I set the icon for my application in visual studio 2008?

How do I set the executable icon for my C++ application in visual studio 2008?..

Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0

I opened an existing iOS project with Xcode6 beta6, and Xcode lists the following warning for both Storyboard and Xib files: Automatic Preferred Max Layout Width is not available on iOS versions ..

Set up git to pull and push all branches

I'd like to push and pull all the branches by default, including the newly created ones. Is there a setting that I can define for it? Otherwise, when I add a new branch, locally and I want to pull i..

Hide div if screen is smaller than a certain width

I want to hide a floating div if the user screen is < 1024px as it will overlay with my blog content area. I found this jQuery on the net but I am not sure how to use it. $(document).ready(functio..

Print Currency Number Format in PHP

I have some price values to display in my page. I am writing a function which takes the float price and returns the formatted currency val with currency code too.. For example, fnPrice(1001.01) shou..

Windows command to get service status?

I need to know the status of a service at the end of my batch script which restarts services using "net stop thingie" and "net start thingie". In my most favorite ideal world, I would like to e-mail ..

Is there a concurrent List in Java's JDK?

How can I create a concurrent List instance, where I can access elements by index? Does the JDK have any classes or factory methods I can use?..

Remove characters from NSString?

NSString *myString = @"A B C D E F G"; I want to remove the spaces, so the new string would be "ABCDEFG"...

Spring Boot application can't resolve the org.springframework.boot package

I have set up a spring boot project using the Spring Initializer, I tried several times to create a new project or play with the dependencies, everything seems to be in place. I am using STS(Spring T..

How to check for an undefined or null variable in JavaScript?

We are frequently using the following code pattern in our JavaScript code if (typeof(some_variable) != 'undefined' && some_variable != null) { // Do something with some_variable } Is th..

Get Today's date in Java at midnight time

I need to create two date objects. If the current date and time is March 9th 2012 11:30 AM then date object d1 should be 9th March 2012 12:00 AM date object d2 should contain the current dat..

Remove .php extension with .htaccess

Yes, I've read the Apache manual and searched here. For some reason I simply cannot get this to work. The closest I've come is having it remove the extension, but it points back to the root directory...

Serializing an object as UTF-8 XML in .NET

Proper object disposal removed for brevity but I'm shocked if this is the simplest way to encode an object as UTF-8 in memory. There has to be an easier way doesn't there? var serializer = new XmlSer..

Debugging with Android Studio stuck at "Waiting For Debugger" forever

UPDATE The supposed duplicate is a question on being stucking in "Waiting For Debugger" when executing Run, while this question is on being stucking in "Waiting For Debugger" when executing Debug, the..

Get fragment (value after hash '#') from a URL in php

How can i select the fragment after the '#' symbol in my URL using PHP? The result that i want is "photo45". This is an example URL:

Multidimensional arrays in Swift

Edit: As Adam Washington points out, as from Beta 6, this code works as is, so the question is no longer relevant. I am trying to create and iterate through a two dimensional array: var array = Arr..

Generate ER Diagram from existing MySQL database, created for CakePHP

For CakePHP application, I created MySQL database. Which tool to be used to create ER Diagram of database? Fields and relations between tables are created in a way cakePHP likes. thank you in advan..

Pip freeze vs. pip list

A comparison of outputs reveals differences: user@user-VirtualBox:~$ pip list feedparser (5.1.3) pip (1.4.1) setuptools (1.1.5) wsgiref (0.1.2) user@user-VirtualBox:~$ pip freeze feedparser==5.1.3 ws..