Questions Tagged with #Respond with

Change a column type from Date to DateTime during ROR migration

I need to change my column type from date to datetime for an app I am making. I don't care about the data as its still being developed. How can I do this? ..

How to find the size of integer array

How to find the size of an integer array in C. Any method available without traversing the whole array once, to find out the size of the array...

How to vertically align text with icon font?

I have a very basic HTML which mix plain text and icon fonts. The problem is that icons are not exactly rendered at the same height than the text: _x000D_ _x000D_ <div class="ui menu">_x000D_ ..

How do I get elapsed time in milliseconds in Ruby?

If I have a Time object got from : and later I instantiate another object with that same line, how can I see how many milliseconds have passed? The second object may be created that same m..

Split string into array

In JS if you would like to split user entry into an array what is the best way of going about it? For example: entry = prompt("Enter your name") for (i=0; i<entry.length; i++) { entryArray[i] =..

changing source on html5 video tag

i'm trying to build a video player, that works everywhere. so far i'd be going with: <video> <source src="video.mp4"></source> <source src="video.ogv"></source> ..

Best way to convert an ArrayList to a string

I have an ArrayList that I want to output completely as a String. Essentially I want to output it in order using the toString of each element separated by tabs. Is there any fast way to do this? You c..

Sorting string array in C#

Maybe it sounds weird, but after a long time programming, I just got on array sorting. Everything was as I expected, until I tried to sort an array of strings containing two identical strings inside. ..

Match two strings in one line with grep

I am trying to use grep to match lines that contain two different strings. I have tried the following but this matches lines that contain either string1 or string2 which not what I want. grep 'string..

How to use sed to remove the last n lines of a file

I want to remove some n lines from the end of a file. Can this be done using sed? For example, to remove lines from 2 to 4, I can use $ sed '2,4d' file But I don't know the line numbers. I can de..

Remove space above and below <p> tag HTML

Take this ul for example: _x000D_ _x000D_ <ul>_x000D_ <li>HI THERE</li>_x000D_ <br>_x000D_ <li>_x000D_ <p>ME</p>_x000D_ </li>_x..

Android: upgrading DB version and adding new table

I've already created sqlite tables for my app, but now I want to add a new table to the database. I changed the DB version as below private static final int DATABASE_VERSION = 2; and Added string ..

How to set UICollectionViewCell Width and Height programmatically

I am trying to implement a CollectionView. When I am using Autolayout, my cells won't change the size, but their alignment. Now I would rather want to change their sizes to e.g. //var size = CGSize(..

Filename too long in Git for Windows

I'm using Git-1.9.0-preview20140217 for Windows. As I know, this release should fix the issue with too long filenames. But not for me. Surely I'm doing something wrong: I did git config core.longpath..

Save PHP array to MySQL?

What is a good way to save an array of data to a single mysql field? Also once I query for that array in the mysql table, what is a good way to get it back into array form? Is serialize and unseri..

C# difference between == and Equals()

I have a condition in a silverlight application that compares 2 strings, for some reason when I use == it returns false while .Equals() returns true. Here is the code: if (((ListBoxItem)lstBaseMenu...

Error ITMS-90717: "Invalid App Store Icon"

When I tried to submit an App to Itunes Connect I got the following error. iTunes Store Operation Failed Error ITMS-90717: "Invalid App Store Icon. The App Store Icon in the asset catalog in 'YourAp..

Determine which MySQL configuration file is being used

Is there a command to determine which configuration file MySQL 5.0 is currently using?..

How can I view the source code for a function?

I want to look at the source code for a function to see how it works. I know I can print a function by typing its name at the prompt: > t function (x) UseMethod("t") <bytecode: 0x2332948> &..

MySQL - sum column value(s) based on row from the same table

I'm trying to get 'Cash', 'Check' and 'Credit Card' totals in new columns based on ProductID from the same table. Table - Payments +-----------+------------+---------------+--------+ | ProductID | ..

Cannot read property 'style' of undefined -- Uncaught Type Error

I would like to change the color, fontsize and font weight of the text in a span element of the html page. I am using the following code: if(window.location.href.indexOf("test") > -1){ var se..

HTML5 Audio Looping

I've been playing with HTML5 audio recently, and though I can get it to play the sound it only ever will play once. No matter what I try (setting the properties, event handlers, etc) I can't seem to g..

Multiple actions were found that match the request in Web Api

I keep getting this error when I try to have 2 "Get" methods Multiple actions were found that match the request: webapi I been looking around at the other similar questions about this on stack ..

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...

What is the difference between conversion specifiers %i and %d in formatted IO functions (*printf / *scanf)

What is the difference between %d and %i when used as format specifiers in printf and scanf?..

Mac install and open mysql using terminal

I downloaded the mysql dmg file and went through the wizard to run. Done. I have also started mysql server under system preferences. The purpose of me doing this is to work through the exercises of m..

Pandas: Creating DataFrame from Series

My current code is shown below - I'm importing a MAT file and trying to create a DataFrame from variables within it: mat = loadmat(file_path) # load mat-file Variables = mat.keys() # identify var..

What does "async: false" do in jQuery.ajax()?

Specifically, how does it differ from the default ( async: true ) ? In what circumstances would I want to explicit set async to false, and does it have something to do with preventing other events o..

Is there any way to configure multiple registries in a single npmrc file

Here is my problem. We have a private NPM registry which only works in VPN. I would like to have a fallback registry so that when I am out of VPN it works seamlessly. P.S. ..

Android Use Done button on Keyboard to click button

Ok in my app I have a field for the user to input a number. I have the field set to only accept numbers. When the user clicks on the field it brings up the keyboard. On the keyboard (on ICS) there is ..

How to use <sec:authorize access="hasRole('ROLES)"> for checking multiple Roles?

I want to display some content conditionally based on Roles using Spring Security JSP taglibs. But in Spring Security 3.1.x is checking for only one role. I can use but ifAllGranted is deprecated. ..

The filename, directory name, or volume label syntax is incorrect inside batch

When I am running the following inside batch.... set PATH='C:\Users\DEB\Downloads\' cd !PATH! I get error "The filename, directory name, or volume label syntax is incorrect" Update: The..

Remove and Replace Printed items

I was wondering if it was possible to remove items you have printed in Python - not from the Python GUI, but from the command prompt. e.g. a = 0 for x in range (0,3): a = a + 1 b = ("Lo..

Comparing two .jar files

How do I compare two .jar files? Both of them have compiled .class files. I want the difference in terms of method changes, etc...

How do you add an in-app purchase to an iOS application?

How do you add an in-app purchase to an iOS app? What are all the details and is there any sample code? This is meant to be a catch-all of sorts for how to add in-app purchases to iOS apps..

How to make flexbox items the same size?

I want to use flexbox that has some number of items that are all the same width. I've noticed that flexbox distributes the space around evenly, rather than the space itself. For example: _x000D_ _x0..

How to use a class object in C++ as a function parameter

I am not sure how to have a function that receives a class object as a parameter. Any help? Here is an example below. #include<iostream> void function(class object); //prototype void function..

How to create an on/off switch with Javascript/CSS?

I want to have a sliding switch. On the left would be Off and on the right would be On. When the user toggles the switch, I want the 'slider' portion to slide to the other side and indicate it is off...

use regular expression in if-condition in bash

I wonder the general rule to use regular expression in if clause in bash? Here is an example $ gg=svm-grid-ch $ if [[ $gg == *grid* ]] ; then echo $gg; fi svm-grid-ch $ if [[ $gg == ^....grid..

git pull error :error: remote ref is at but expected

Full message: error: Ref refs/remotes/origin/user is at 3636498c2ea7735fdcedc9af5ab3c8689e6abe77 but expected a21359c6cc2097c85775cde6a40105f4bd7100ec From{github project url} ! a21359c...

How is AngularJS different from jQuery

I only know one js library and that is jQuery. But my other coders in the group are changing AngularJS as their default library in new project. I don't know anything about it. How is it different fro..

Stretch Image to Fit 100% of Div Height and Width

I have a div with the following CSS #mydiv{ top: 50px; left: 50px; width: 200px; height: 200px; } and my HTML looks like this <div id = "mydiv"> <img src = "folder/fil..

Display a jpg image on a JPanel

What would be the most appropriate image type to display a jpg image (loaded from a local folder) on a JPanel? Cheers...

How do I list / export private keys from a keystore?

How do I list and export a private key from a keystore?..

How to install latest version of git on CentOS 7.x/6.x

I used the usual: yum install git It did not install the latest version of git on my CentOS 6. How can I update to the latest version of git for CentOS 6? The solution can be applicable to newer v..

find files by extension, *.html under a folder in nodejs

I'd like to find all *.html files in src folder and all its sub folders using nodejs. What is the best way to do it? var folder = '/project1/src'; var extension = 'html'; var cb = function(err, resu..

Specify the from user when sending email using the mail command

Does anyone know how to change the from user when sending email using the mail command? I have looked through the man page and can not see how to do this. We are running Redhat Linux 5...

Good Hash Function for Strings

I'm trying to think up a good hash function for strings. And I was thinking it might be a good idea to sum up the unicode values for the first five characters in the string (assuming it has five, oth..

Using LIKE in an Oracle IN clause

I know I can write a query that will return all rows that contain any number of values in a given column, like so: Select * from tbl where my_col in (val1, val2, val3,... valn) but if val1, for exa..

What does IFormatProvider do?

I was playing around with the Datetime.ParseExact method, and it wants an IFormatProvider... It works inputting null, but what exactly does it do?..

Javascript Uncaught Reference error Function is not defined

Check the Fiddle to see the failure occurring. When I add Data (Even if I leave it empty) to the text box and try to click "Add" it doesn't do anything. Opening the Chrome and Firefox console both g..

How to use php serialize() and unserialize()

My problem is very basic. I did not find any example to meet my needs as to what exactly serialize() and unserialize() mean in php? They just give an example - serialize an array and show an output i..

Get the Year/Month/Day from a datetime in php?

I used date('w', timestamp) and date('w', timestamp) to know the day, date('n', timestamp) for months, etc. Now I'm using datetime and I'd like to know what are the equivalent functions to get a day,..

Object of custom type as dictionary key

What must I do to use my objects of a custom type as keys in a Python dictionary (where I don't want the "object id" to act as the key) , e.g. class MyThing: def __init__(self,name,location,leng..

S3 Static Website Hosting Route All Paths to Index.html

I am using S3 to host a javascript app that will use HTML5 pushStates. The problem is if the user bookmarks any of the URLs, it will not resolve to anything. What I need is the ability to take all url..

How to get the jQuery $.ajax error response text?

I am sending an error response to my jQuery. However, I can not get the response text (in the example below this would be Gone to the beach) The only thing jQuery says is 'error'. See this example f..

How to change the date format of a DateTimePicker in

How can I change the date format of a DateTimePicker in so that the date is shown in the format dd/mm/1990, without any time value? I have tried changing the format to "short", and while this p..

Changing font size and direction of axes text in ggplot2

I am plotting a graph with a categorical variable on the x axis and a numerical variable on the y axis. For the x axis, given that there are many data points, the default text formatting causes the l..

jQuery: Adding two attributes via the .attr(); method

EDIT: I learned that using other value than _blank, DOES NOT work on mobile browsers to open new windows/tabs. For example, if you need to open a new window/tab: This works on all browsers, even m..

Javascript to export html table to Excel

I need to export the html table in my page to an Excel when user clicks 'Export' button. Now, I found a solution here on stack overflow that works in Firefox. Export dynamic html table to excel in ja..

Any way to make plot points in scatterplot more transparent in R?

I have a 3 column matrix; plots are made by points based on column 1 and column 2 values, but colored based on column 2 (6 different groups). I can successfully plot all points, however, the last plot..

Delete all rows in a table based on another table

I can't seem to ever remember this query! I want to delete all rows in table1 whose ID's are the same as in Table2. So: DELETE table1 t1 WHERE t1.ID = t2.ID I know I can do a WHERE ID IN (SELECT..

Add line break within tooltips

How can line breaks be added within a HTML tooltip? I tried using <br/> and \n within the tooltip as follows: <a href="#" title="Some long text <br/> Second line text \n Third line t..

How to go to a specific element on page?

On my HTML page, I want to be able to 'go to' / 'scroll to' / 'focus on' an element on the page. Normally, I'd use an anchor tag with a href="#something", but I'm already using the hashchange event ..

insert data into database with codeigniter

Trying to insert a row into my database with CodeIgniter. My database table is Customer_Orders and the fields are CustomerName and OrderLines. The variables are being submitted correctly. My Control..

Basic Apache commands for a local Windows machine

I have installed XAMPP on my Windows 7 machine and created a number of virtual servers. This part is straightforward enough. Each time I add a new virtual server I am having to reboot my computer in ..

Can I use CASE statement in a JOIN condition?

The following image is a part of Microsoft SQL Server 2008 R2 System Views. From the image we can see that the relationship between sys.partitions and sys.allocation_units depends on the value of sys...

CSS/HTML: Create a glowing border around an Input Field

I want to create some decent inputs for my form, and I would really like to know how TWITTER does their glowing border around their inputs. Example/Picture of the Twitter border: I also don't qui..

How does one set up the Visual Studio Code compiler/debugger to GCC?

I am programming in C in Visual Studio Code, but I can't compile, as VSC only offers three compilers built in - Node.js, C# Mono, and Extension development. After a little bit of digging I came across..

Differences between contentType and dataType in jQuery ajax function

I have the following Jquery callback function and I have a litle doubt about it (I don't know very well Jquery): $("form.readXmlForm").submit(function() { // Riferimento all'elemento form che ha ..

How can I round a number in JavaScript? .toFixed() returns a string?

Am I missing something here? var someNumber = 123.456; someNumber = someNumber.toFixed(2); alert(typeof(someNumber)); //alerts string Why does .toFixed() return a string? I want to round the numbe..

MVC [HttpPost/HttpGet] for Action

I am using MVC C#. Can somebody give an example on why one would use [HttpPost/HttpGet] for an Action. How can an active have both - what is the practical use? ..

Get current time in hours and minutes

I'm trying to collect information from a system and I need to get the current time in hours and minutes. Currently I have: date | awk '{print $4}' which outputs something like: 16:18:54 How do ..

Can I map a hostname *and* a port with /etc/hosts?

Can I map an IP address like to a domain name and a port? For example, I would like to map to

Create Directory if it doesn't exist with Ruby

I am trying to create a directory with the following code: Dir.mkdir("/Users/Luigi/Desktop/Survey_Final/Archived/Survey/test") unless File.exists?("/Users/Luigi/Desktop/Survey_Final/Archived/Surv..

Convert array into csv

How to convert an array into a CSV file? This is my array: stdClass Object ( [OrderList_RetrieveByContactResult] => stdClass Object ( [OrderDetails] => stdClass Object..

Connecting to Postgresql in a docker container from outside

I have Postgresql on a server in a docker container. How can I connect to it from the outside, that is, from my local computer? What setting should I apply to allow that?..

java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory

I am getting the error as mentioned below, while running the feed utility. I am trying to load an image "logo.png". The slf4j jar file is also available in the runtime classpath. But still I am gettin..

Parse v. TryParse

What is the difference between Parse() and TryParse()? int number = int.Parse(textBoxNumber.Text); // The Try-Parse Method int.TryParse(textBoxNumber.Text, out number); Is there some form of error..

How to revert a merge commit that's already pushed to remote branch?

git revert <commit_hash> alone won't work. -m must be specified, and I'm pretty confused about it. Anyone experienced this before?..

Call to undefined function mysql_query() with Login

When i execute my PHP code below i get a Fatal error and i'm not sure how to resolve it. Thank you for your help The Error PHP Fatal error: Uncaught Error: Call to undefined function mysql_quer..

Base64: java.lang.IllegalArgumentException: Illegal character

I'm trying to send a confirmation email after user registration. I'm using the JavaMail library for this purpose and the Java 8 Base64 util class. I'm encoding user emails in the following way: byte..

Set cellpadding and cellspacing in CSS?

In an HTML table, the cellpadding and cellspacing can be set like this: <table cellspacing="1" cellpadding="1"> How can the same be accomplished using CSS?..

Set background image on grid in WPF using C#

I have a problem: I want to set the image of my grid through code behind. Can anybody tell me how to do this?..

How to create a jQuery function (a new jQuery method or plugin)?

I know that in JavaScript the syntax is as follows: function myfunction(param){ //some code } Is there a way to declare a function in jQuery that can be added to an element? For example: $('#my_..

Java heap terminology: young, old and permanent generations?

I'm trying to understand What the concepts of young, old and permanent generations are in the Java heap terminology, and more specifically the interactions between the three generations. My questions..

Temporary tables in stored procedures

I have been wondering about temp tables in sp's and how all that can effect concurrency. SP made on a MSSQL 08 server. If I have a SP where I create a temp table and drop it again like this: BEGIN ..

Difference between Arrays.asList(array) and new ArrayList<Integer>(Arrays.asList(array))

What is the difference between 1.List<Integer> list1 = new ArrayList<Integer>(Arrays.asList(ia)); //copy 2.List<Integer> list2 = Arrays.asList(ia); where ia is array of integers..

How to programmatically set the layout_align_parent_right attribute of a Button in Relative Layout?

I have a relative layout which I am creating programmatically: RelativeLayout layout = new RelativeLayout( this ); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutPara..

Where can I find the default timeout settings for all browsers?

I'm looking for some kind of documentation that specifies how much time each browser (IE6/IE7/FF2/FF3, etc) will wait on a request before it just gives up and times out. I haven't had any luck trying..

How to fix .pch file missing on build?

When I build my c++ solution in Visual Studio it complains that the xxxxx.pch file is missing. Is there a setting I am missing to get the pre-compiled headers back? here is the exact error for comple..

How to avoid 'cannot read property of undefined' errors?

In my code, I deal with an array that has some entries with many objects nested inside one another, where as some do not. It looks something like the following: // where this array is hundreds of ent..

How to restart Activity in Android

How do I restart an Android Activity? I tried the following, but the Activity simply quits. public static void restartActivity(Activity act){ Intent intent=new Intent(); intent.setC..

How to get current language code with Swift?

I want get the language code of the device (en, es...) in my app written with Swift. How can get this? I'm trying this: var preferredLanguages : NSLocale! let pre = preferredLanguages.displayNameFor..

How to install the Six module in Python2.7

I am using Python 2.7 and trying to use dateutil as follows: from dateutil import parser as _date_parser However, I get the following error: Traceback (most recent call last): File "<pyshell#..

How to solve ERR_CONNECTION_REFUSED when trying to connect to localhost running IISExpress - Error 502 (Cannot debug from Visual Studio)?

This is running on Windows Server 2008 and used to work several months ago. I am just now using this server again for some dev work with VS. This is live web server used to serve up a few test sites..

Retrieve last 100 lines logs

I need to retrieve last 100 lines of logs from the log file. I tried the sed command sed -n -e '100,$p' logfilename Please let me know how can I change this command to specifically retrieve the las..

Retrieving a random item from ArrayList

I'm learning Java and I'm having a problem with ArrayList and Random. I have an object called catalogue which has an array list of objects created from another class called item. I need a method in ..

What's the difference between UTF-8 and UTF-8 without BOM?

What's different between UTF-8 and UTF-8 without a BOM? Which is better? ..

Binding arrow keys in JS/jQuery

How do I go about binding a function to left and right arrow keys in Javascript and/or jQuery? I looked at the js-hotkey plugin for jQuery (wraps the built-in bind function to add an argument to recog..

When to use static classes in C#

Here's what MSDN has to say under When to Use Static Classes: static class CompanyInfo { public static string GetCompanyName() { return "CompanyName"; } public static string GetCompanyAddres..

How to load CSS Asynchronously

I'm trying to eliminate 2 CSS files that are render blocking on my site - they appear on Google Page Speed Insights. I have followed different methods, none of which were a success. But, recently, I f..

Getting Gradle dependencies in IntelliJ IDEA using Gradle build

Grade build, even from inside IntelliJ IDEA does not put the dependencies into the "External Libraries" folder, so these classes don't show up as suggestions in the editor and when I manually add them..

Laravel Eloquent "WHERE NOT IN"

I'm having trouble to write query in laravel eloquent ORM. my query is SELECT book_name,dt_of_pub,pub_lang,no_page,book_price FROM book_mast WHERE book_price NOT IN (100,200); Now I wa..

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined raised when starting react app

I'm working on a project in React and ran into a problem that has me stumped. Whenever I run yarn start I get this error: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type ..

Opening a folder in explorer and selecting a file

I'm trying to open a folder in explorer with a file selected. The following code produces a file not found exception: System.Diagnostics.Process.Start( "explorer.exe /select," + listView1...

Wrapping text inside input type="text" element HTML/CSS

The HTML shown below, <input type="text"/> is displayed in a browser like so: When I add the following text, The quick brown fox jumped over the lazy dog. Using the HTML below, <..

Subdomain on different host

I'm trying to host a subdomain for my site with a different hosting company and I'm running into issues on how to set it up. Here are the specifics: - Domain is registered with GoDaddy. - Nameserver..

Detect HTTP or HTTPS then force HTTPS in JavaScript

Is there any way to detect HTTP or HTTPS and then force usage of HTTPS with JavaScript? I have some codes for detecting the HTTP or HTTPS but I can't force it to use https: . I'm using the window.lo..

How to read/process command line arguments?

I am originally a C programmer. I have seen numerous tricks and "hacks" to read many different arguments. What are some of the ways Python programmers can do this? Related What’s the best way t..

MySQL parameterized queries

I am having a hard time using the MySQLdb module to insert information into my database. I need to insert 6 variables into the table. cursor.execute (""" INSERT INTO Songs (SongName, SongArtis..

How to read a file without newlines?

In Python, calling temp = open(filename,'r').readlines() results in a list in which each element is a line in the file. It's a little stupid but still: readlines() also writes newline character to ..

Managing large binary files with Git

I am looking for opinions of how to handle large binary files on which my source code (web application) is dependent. We are currently discussing several alternatives: Copy the binary files by hand...

android: stretch image in imageview to fit screen

I have an imageview that has its height and width set to fill_parent with a linearlayout that has the same values set. So I suppose this should set my images to fit the screen. But it only fits like 8..

how to get date of yesterday using php?

I want to get the yesterday date using specific date format in php this is the format: $today = date("d.m.Y"); //15.04.2013 Is it possible? Take consideration of month and years if they should be ..

Get paragraph text inside an element

I want to have the text value from a <p> inside a <li> element. html: <ul> <li onclick="myfunction()"> <span></span> <p>This Text</p>..

How do I get a UTC Timestamp in JavaScript?

While writing a web application, it makes sense to store (server side) all datetimes in the DB as UTC timestamps. I was astonished when I noticed that you couldn't natively do much in terms of Timezo..

Save each sheet in a workbook to separate CSV files

How do I save each sheet in an Excel workbook to separate CSV files with a macro? I have an excel with multiple sheets and I was looking for a macro that will save each sheet to a separate CSV (comma..

How to set the id attribute of a HTML element dynamically with angularjs (1.x)?

Provided an HTML element of type div, how to set the value of its id attribute, which is the concatenation of a scope variable and a string ? ..

What is the maximum length of a URL in different browsers?

What is the maximum length of a URL in different browsers? Does it differ among browsers? Is a maximum URL length part of the HTTP specification?..

Shell script variable not empty (-z option)

How to make sure a variable is not empty with the -z option ? errorstatus="notnull" if [ !-z $errorstatus ] then echo "string is not null" fi It returns the error : ./test: line 2: [: !-z: unar..

SQL Server: Database stuck in "Restoring" state

I backed up a database: BACKUP DATABASE MyDatabase TO DISK = 'MyDatabase.bak' WITH INIT --overwrite existing And then tried to restore it: RESTORE DATABASE MyDatabase FROM DISK = '

Groovy String to Date

I am coding this with Groovy I am currently trying to convert a string that I have to a date without having to do anything too tedious. String theDate = "28/09/2010 16:02:43"; def newdate = new Da..

How to calculate an age based on a birthday?

Possible Duplicate: How do I calculate someone’s age in C#? I want to write an ASP.NET helper method which returns the age of a person given his or her birthday. I've tried code like..

try/catch with InputMismatchException creates infinite loop

So I'm building a program which takes ints from user input. I have what seems to be a very straightforward try/catch block which, if the user doesn't enter an int, should repeat the block until they d..

Get 2 Digit Number For The Month

I have an integer column "Month" I would like to get 2 digit number for month. This is what I have tried: DATEPART(mm, @Date) It returns one digit for months January to September I am using SQL Serv..

Resync git repo with new .gitignore file

Is it possible to "refresh" a git repository after updating the gitignore file? I just added more ignorations(?) to my gitignore and would like to remove stuff already in the repo matching the new fi..

How to list the files in current directory?

I want to be able to list the files in the current directory. I've made something that should work but doesn't return all the file names. File dir = new File("."); File[] filesList = dir.listFiles();..

how to pass this element to javascript onclick function and add a class to that clicked element

I had an html navigation code as below _x000D_ _x000D_ function Data(string) { //1. get some data from server according to month year etc., //2. unactive all the remaining li's and make the curren..

How to pre-populate the sms body text via an html link

How to use an html link to open the sms app with a pre-filled body? Everything I have read seems to indicate that sms:18005555555?body=bodyTextHere Should work, but on the iPhone, this doesn't work...

Create an array or List of all dates between two dates

I am generating multi-series graphs with the date along the X-Axis. The problem is that not all of the series in the graph have the same dates in the date range. Meaning that if I choose 1 Feb thr..

jQuery: read text file from file system

I am trying to read a text file using jquery, like this: // LOAD file and split line by line and append divs $.get('myFile.txt', function(data) { var lines = data.split("\n"); $.each(lin..

Extract regression coefficient values

I have a regression model for some time series data investigating drug utilisation. The purpose is to fit a spline to a time series and work out 95% CI etc. The model goes as follows: id <- ts(1:l..

Argument Exception "Item with Same Key has already been added"

I keep getting an error with the following code: Dictionary<string, string> rct3Features = new Dictionary<string, string>(); Dictionary<string, string> rct4Features = new Dictionary..

How do I fix certificate errors when running wget on an HTTPS URL in Cygwin?

For example, running wget results in the following errors: ERROR: The certificate of `' is not trusted. ERROR: The certificate of `' hasn't got a..

What is the difference between int, Int16, Int32 and Int64?

What is the difference between int, System.Int16, System.Int32 and System.Int64 other than their sizes?..

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..

VSCode cannot find module '@angular/core' or any other modules

My project was generated with Angular CLI version 1.2.6. I can compile the project and it works fine, but I always get error in VSCode telling me: cannot find module '@angular/core' cannot find modu..

How to set a selected option of a dropdown list control using angular JS

I am using Angular JS and I need to set a selected option of a dropdown list control using angular JS. Forgive me if this is ridiculous but I am new with Angular JS Here is the dropdown list control..

FirstOrDefault: Default value other than null

As I understand it, in Linq the method FirstOrDefault() can return a Default value of something other than null. What I haven't worked out is what kind of things other than null can be returned by th..

How to set xlim and ylim for a subplot in matplotlib

I would like to limit the X and Y axis in matplotlib for a specific subplot. The subplot figure itself doesn't have any axis property. I want for example to change only the limits for the second plot:..

How to iterate through a list of dictionaries in Jinja template?

I tried: list1 = [{"username": "abhi", "pass": 2087}] return render_template("file_output.html", list1=list1) In the template: <table border=2> <tr> <td> Key <..

c++ exception : throwing std::string

I would like to throw an exception when my C++ methods encounter something weird and can't recover. Is it OK to throw a std::string pointer? Here's what I was looking forward to doing: void Foo::Bar..

What is *.o file?

I'm compiling own project. And it halted by this error: LINK||fatal error LNK1181: cannot open input file 'obj\win\release\src\lua\bindings.o'| Compiling using Code::Blocks with VS 2005/2008..

What's a quick way to comment/uncomment lines in Vim?

I have a Ruby code file open in vi, there are lines commented out with #: class Search < ActiveRecord::Migration def self.up # create_table :searches do |t| # t.integer :user_id # ..

How to set viewport meta for iPhone that handles rotation properly?

So I've been using: <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"/> to get my HTML content to display nicely on the iPhone. It works great until t..

How do I export an Android Studio project?

I just started using the Android Studio IDE and I already released and published a simple APK to Google Play store. The problem is that I did this at work. Now I downloaded the Android Studio at my ho..

Modify property value of the objects in list using Java 8 streams

I have a list of Fruit objects in ArrayList and I want to modify fruitName to its plural name. Refer the example: @Data @AllArgsConstructor @ToString class Fruit { long id; String name; ..

CSS: Set a background color which is 50% of the width of the window

Trying to achieve a background on a page that is "split in two"; two colors on opposite sides (seemingly done by setting a default background-color on the body tag, then applying another onto a div th..

PHP combine two associative arrays into one array

$array1 = array("$name1" => "$id1"); $array2 = array("$name2" => "$id2", "$name3" => "$id3"); I need a new array combining all together, i.e. it would be $array3 = array("$name1" => "$..

Could not load file or assembly 'System.Web.WebPages.Razor, Version=

I want using external logins so I installed Oauth by package manager: PM> Install-Package Microsoft.AspNet.WebPages.OAuth Then I got this error after installed it then I install razor: PM> ..

Failed to execute removeChild on Node

Other stack answers such as this and this seem to be specialized cases and I believe my case is more generalized. I am doing this in my js: var markerDiv = document.createElement("div");

Use dynamic variable names in `dplyr`

I want to use dplyr::mutate() to create multiple new columns in a data frame. The column names and their contents should be dynamically generated. Example data from iris: library(dplyr) iris <- as_..

Switch php versions on commandline ubuntu 16.04

I have installed php 5.6 and and php 7.1 on my Ubuntu 16.04 I know with Apache as my web server, I can do a2enmod php5.6 #to enable php5 a2enmod php7.1 #to enable php7 When I disable php7.1 in Apache..

How can I stop a While loop?

I wrote a while loop in a function, but don't know how to stop it. When it doesn't meet its final condition, the loop just go for ever. How can I stop it? def determine_period(universe_array): pe..

Php - Your PHP installation appears to be missing the MySQL extension which is required by WordPress

How do I fix the error below? Your PHP installation appears to be missing the MySQL extension which is required by WordPress. I use my NAS with a telnet connection. I installed FFP 0.7 My php...

PHP date() format when inserting into datetime in MySQL

What is the correct format to pass to the date() function in PHP if I want to insert the result into a MySQL datetime type column? I've been trying date('Y-M-D G:i:s') but that just inserts "0000..

Run script with rc.local: script works, but not at boot

I have a node.js script which need to start at boot and run under the www-data user. During development I always started the script with: su www-data -c 'node /var/www/php-jobs/manager.js I saw exa..

How to do associative array/hashing in JavaScript

I need to store some statistics using JavaScript in a way like I'd do it in C#: Dictionary<string, int> statistics; statistics["Foo"] = 10; statistics["Goo"] = statistics["Goo"] + 1; statist..

Where are the recorded macros stored in Notepad++?

I have recorded a macro that I want to share with my work colleague. In what location are these recorded macros saved, so that I can add it to his machine? If interested, the macro is for taking a l..

How can I add a new column and data to a datatable that already contains data?

How do I add a new DataColumn to a DataTable object that already contains data? PseudoCode //call SQL helper class to get initial data DataTable dt = sql.ExecuteDataTable("sp_MyProc"); dt.Columns...

Codeigniter's `where` and `or_where`

I'm trying to specify a query in my model $this->db ->select('*') ->from('library') ->where('library.rating >=', $form['slider']) ->where('library.vo..

Use grep --exclude/--include syntax to not grep through certain files

I'm looking for the string foo= in text files in a directory tree. It's on a common Linux machine, I have bash shell: grep -ircl "foo=" * In the directories are also many binary files which..

How to wait until WebBrowser is completely loaded in VB.NET?

I am using the WebBrowser control in my VB.NET application to load a few URLs ( ~10-15) and save their HTML source in a text file. However, my code doesn't write the source of the current page rather ..

Why check both isset() and !empty()

Is there a difference between isset and !empty. If I do this double boolean check, is it correct this way or redundant? and is there a shorter way to do the same thing? isset($vars[1]) AND !empty($va..

Find index of last occurrence of a sub-string using T-SQL

Is there a straightforward way of finding the index of the last occurrence of a string using SQL? I am using SQL Server 2000 right now. I basically need the functionality that the .NET System.String..

What's the difference between django OneToOneField and ForeignKey?

What's the difference between Django OneToOneField and ForeignKey?..

PHP: check if any posted vars are empty - form: all fields required

Is there a simpler function to something like this: if (isset($_POST['Submit'])) { if ($_POST['login'] == "" || $_POST['password'] == "" || $_POST['confirm'] == "" || $_POST['name'] == "" || $_PO..

what does "dead beef" mean?

What does the word "dead beef" mean? I read it from a interview question. It has something to do with ipv6. I figured it could be a random hex number used for examples, like "The quick brown fox jumps..

Best way to test for a variable's existence in PHP; isset() is clearly broken

From the isset() docs: isset() will return FALSE if testing a variable that has been set to NULL. Basically, isset() doesn't check for whether the variable is set at all, but whether it's set to an..

Check if a string contains an element from a list (of strings)

For the following block of code: For I = 0 To listOfStrings.Count - 1 If myString.Contains(lstOfStrings.Item(I)) Then Return True End If Next Return False The output is: Case 1: m..

Tips for debugging .htaccess rewrite rules

Many posters have problems debugging their RewriteRule and RewriteCond statements within their .htaccess files. Most of these are using a shared hosting service and therefore don't have access to the..

Force the origin to start at 0

How can I set the origin / interception of the y-axis and x-axis in ggplot2? The line of the x-axis should be exactly at y=Z. With Z=0 or another given value...

Horizontal ListView in Android?

Is it possible to make the ListView horizontally? I have done this using a gallery view, but the selected item comes to the center of the screen automatically. I don't want the selected item at the sa..

Get value (String) of ArrayList<ArrayList<String>>(); in Java

I know it's simple question, but in ArrayList<ArrayList<String>> collection; ArrayList<String> listOfSomething; collection= new ArrayList<ArrayList<String>>(); listOfSom..

SQL Server 2008 - Login failed. The login is from an untrusted domain and cannot be used with Windows authentication

I've just installed SQL Server 2008 Developer edition and I'm trying to connect using SQLCMD.exe, but I get the following error: H:\>sqlcmd.exe -S ".\SQL2008" Msg 18452, Level 14, State 1, Server..

In Python, is there an elegant way to print a list in a custom format without explicit looping?

I know you can do print str(myList) to get [1, 2, 3] and you can do i = 0 for entry in myList: print str(i) + ":", entry i += 1 to get 0: 1 1: 2 2: 3 But is there a way si..

Check if object is a jQuery object

Is there a fast way of checking if an object is a jQuery object or a native JavaScript object? example: var o = {}; var e = $('#element'); function doStuff(o) { if (o.selector) { consol..

Changing the size of a column referenced by a schema-bound view in SQL Server

I'm trying to change the size of a column in sql server using: ALTER TABLE [dbo].[Address] ALTER COLUMN [Addr1] [nvarchar](80) NULL where the length of Addr1 was originally 40. It failed, raising ..

ng-change not working on a text input

I am new to angular js. In my code there is color picker initialized from a text field. User changes the value of color and I want that color to be reflected as a background of a text in a span. It is..

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.

I have been trying from a couple of days to resolve the following error but I am unable to resolve it :( My module's pom.xml file is: <project xmlns="" xmlns:xs..

How to compare 2 dataTables

I have 2 datatables and I just want to know if they are the same or not. By "the same", I mean do they have exactly the same number of rows with exactly the same data in each column, or not. I'd love..

How do you convert a JavaScript date to UTC?

Suppose a user of your website enters a date range. 2009-1-1 to 2009-1-3 You need to send this date to a server for some processing, but the server expects all dates and times to be in UTC. Now s..

Page Redirect after X seconds wait using JavaScript

I need to redirect to specific url after 5 seconds after putting an error message. First i have used Javascript as below. document.ready(window.setTimeout(location.href = "",5..

`React/RCTBridgeModule.h` file not found

Getting this error while building a react-native iOS app on xcode. Started getting this error after npm install and rpm linking react-native-fs library. But after searching online for a solution, I..

Merge two HTML table cells

I'm creating a table in HTML and I'd like to have my top cell be the width of two. Here's a rough drawing: __________________________________________ | HEADER | | ..

How to refresh datagrid in WPF

My source is in a MySQL database, I've made an update command and now I need to refresh my DataGrid. MySqlCommand cmd = new MySqlCommand( "update request set status = " + StatusRequest(value) + ..

How to count duplicate rows in pandas dataframe?

I am trying to count the duplicates of each type of row in my dataframe. For example, say that I have a dataframe in pandas as follows: df = pd.DataFrame({'one': pd.Series([1., 1, 1]), ..

How do you replace all the occurrences of a certain character in a string?

I am reading a csv into a: import csv import collections import pdb import math import urllib def do_work(): a=get_file('c:/pythonwork/cds/cds.csv') a=remove_chars(a) print a[0:10] def get_fi..

jquery validate check at least one checkbox

I have something like this: <form> <input name='roles' type='checkbox' value='1' /> <input name='roles' type='checkbox' value='2' /> <input name='roles' type='checkbox' value='3'..

Hibernate error: ids for this class must be manually assigned before calling save():

Caused by: org.springframework.orm.hibernate3.HibernateSystemException: ids for this class must be manually assigned before calling save(): com.rfid.model.Role; nested exception is

Maven: add a folder or jar file into current classpath

I am using maven-compile plugin to compile classes. Now I would like to add one jar file into the current classpath. That file stays in another location (let's say c:/jars/abc.jar . I prefer to leave ..

Eclipse - Failed to create the java virtual machine

I'm having issue with running my Eclipse with the following config: eclipse.ini -startup plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar --launcher.library plugins/org.eclipse.equinox.launc..

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 to make a progress bar

How would one go about making a progress bar in html/css/javascript. I don't really want to use Flash. Something along the lines of what can be found here: All I re..

Mongodb service won't start

I am not sure why, and the service was working fine just yesterday, all of a sudden I can not get MongoDB to start up. [root@purr ~]# service mongod start Starting mongod: Thu Aug 29 23:26:07.550 Th..

What is this: [Ljava.lang.Object;?

I get this when I call toString on an object I received from a function call. I know the type of the object is encoded in this string, but I don't know how to read it. What is this type of encoding c..

How do I get the SelectedItem or SelectedIndex of ListView in

As you know by question that what I want. I was using listbox. In ListBox we can get selected item by a simple line of code: listbox1.SelectedItem. Now I am using ListView, how I get the SelectedItem ..

How to assign an action for UIImageView object in Swift

I'm trying to assign an UIImageView to an action when the user taps it. I know how to create an action for a UIButton, but how could I mimic the same behavior of a UIButton, but using a UIImageView?..

How do I capture the output into a variable from an external process in PowerShell?

I'd like to run an external process and capture it's command output to a variable in PowerShell. I'm currently using this: $params = "/verify $pc /" start-process "netdom.exe" $p..