Questions Tagged with #File read

What's the best practice to round a float to 2 decimals?

I'm using eclipse + Android SDK. I need to round a float value to 2 decimals. I usually use the next "trick" using Math library. float accelerometerX = accelerometerX * 100; accelerometerX = rou..

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I just discovered a logical bug in my code which was causing all sorts of problems. I was inadvertently doing a bitwise AND instead of a logical AND. I changed the code from: r = mlab.csv2rec(datafi..

Error: fix the version conflict (google-services plugin)

As per this SO thread, I know there are version conflicts, but issue still persists after new versions from Google. Error:Execution failed for task ':app:processDebugGoogleServices'. Please fix ..

MySQL with Node.js

I've just started getting into Node.js. I come from a PHP background, so I'm fairly used to using MySQL for all my database needs. How can I use MySQL with Node.js?..

Conversion between UTF-8 ArrayBuffer and String

I have an ArrayBuffer which contains a string encoded using UTF-8 and I can't find a standard way of converting such ArrayBuffer into a JS String (which I understand is encoded using UTF-16). I've se..

Python: Split a list into sub-lists based on index ranges

UPDATED: In python, how do i split a list into sub-lists based on index ranges e.g. original list: list1 = [x,y,z,a,b,c,d,e,f,g] using index ranges 0 - 4: list1a = [x,y,z,a,b] using index rang..

Export query result to .csv file in SQL Server 2008

How can I export a query result to a .csv file in SQL Server 2008?..

Node.js: printing to console without a trailing newline?

Is there a method for printing to the console without a trailing newline? The console object documentation doesn't say anything regarding that: console.log() Prints to stdout with newline. This funct..

How do I convert datetime.timedelta to minutes, hours in Python?

I get a start_date like this: from django.utils.timezone import utc import datetime start_date = datetime.datetime.utcnow().replace(tzinfo=utc) end_date = datetime.datetime.utcnow().replace(tzinfo=u..

Merge r brings error "'by' must specify uniquely valid columns"

R doesn't like me today... I have two tables asembled via cbind(). Tab 1 (dwd_nogap) is x1 col1_x1 col2_x1 A "1982 12 01 00:00" " 0.4" " 0" B "1982 12 0..

Cannot find the declaration of element 'beans'

I have the spring jars of spring-3.2.0.RC1.jar and trying to implement Apache ActiveMQ helloWorld program from tutorial given here. The xml configuration file is: <?xml version="1.0" encoding="UTF..

Launch an event when checking a checkbox in Angular2

I'm newbie in Angular2 and in web globally , I want to launch an action that changes an oject paramater value in the Database when checking a checkbox and or unchecking it using Material-Design, I tri..

SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) symfony2

When I try to login I get an error: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) parametrs.yml: This file is auto-generated during the composer install pa..

How to remove gaps between subplots in matplotlib?

The code below produces gaps between the subplots. How do I remove the gaps between the subplots and make the image a tight grid? import matplotlib.pyplot as plt for i in range(16): i = i + 1..

Passing an array of parameters to a stored procedure

I need to pass an array of "id's" to a stored procedure, to delete all rows from the table EXCEPT the rows that match id's in the array. How can I do it in a most simple way?..

Convert string to Color in C#

I am encountering a problem which is how do I convert input strings like "RED" to the actual Color type Color.Red in C#. Is there a good way to do this? I could think of using a switch statement and ..

Convert from List into IEnumerable format

IEnumerable<Book> _Book_IE List<Book> _Book_List How shall I do in order to convert _Book_List into IEnumerable format?..

How do I display images from Google Drive on a website?

A client of mine has uploaded some photos to their Google Drive and would like me to display their photos on their company website. I reviewed the documentation for displaying Google Drive content in ..

Is this very likely to create a memory leak in Tomcat?

I configured tomcat to work with a different external open source. However, after the tomcat is running for a few minutes I get: SEVERE: The web application [/MyProject] created a ThreadLocal wit..

Manually type in a value in a "Select" / Drop-down HTML list?

In a Windows Forms application, a drop-down selector list also gives the user the option of typing an alternate value into that same field (assuming the developer has left this option enabled on the c..

Android Fragment onClick button Method

I'm trying to invoke the method in my onClick (View v) XML, but does not work with Fragment. This is the error. 01-17 12:38:36.840: E/AndroidRuntime(4171): java.lang.IllegalStateException: Could not..

MySQLi count(*) always returns 1

I'm trying to count the number of rows in a table and thought that this was the correct way to do that: $result = $db->query("SELECT COUNT(*) FROM `table`;"); $count = $result->num_rows; But ..

Difference between RegisterStartupScript and RegisterClientScriptBlock?

Is the only difference between the RegisterStartupScript and the RegisterClientScriptBlock is that RegisterStartupScript puts the javascript before the closing </form> tag of the page and Regist..

Date Difference in php on days?

Is there a quick way to calculate date difference in php? For example: $date1 = '2009-11-12 12:09:08'; $date2 = '2009-12-01 08:20:11'; And then do a calculation, $date2 minus $date1 I read php.net..

How to determine the current shell I'm working on

How can I determine the current shell I am working on? Would the output of the ps command alone be sufficient? How can this be done in different flavors of Unix?..

"E: Unable to locate package python-pip" on Ubuntu 18.04

I am trying to install virtualenv on Ubuntu. First it said command 'pip' not found, so I typed sudo apt install python-pip then it said E: Unable to locate package python-pip I tried to rese..

Limit the height of a responsive image with css

My end goal is to have a fluid <img> that won't expand past an explicitly set height of a parent/grandparent element using only css. Currently I'm doing this with a normal (max-width:100; heig..

How to install JRE 1.7 on Mac OS X and use it with Eclipse?

I want to use the JRE 1.7 that I downloaded from Oracle website. So I correctly install the .pkg file, and when I try /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -versi..

'this' is undefined in JavaScript class methods

I'm new to JavaScript. New as far as all I've really done with it is tweaked existing code and wrote small bits of jQuery. Now I'm attempting to write a "class" with attributes and methods, but I'm h..

How to grant all privileges to root user in MySQL 8.0

Tried mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION; Getting ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corre..

Swift: Convert enum value to String?

Given the following enum: enum Audience { case Public case Friends case Private } How do I get the string "Public" from the audience constant below? let audience = Audience.Public ..

How do I get a plist as a Dictionary in Swift?

I am playing around with Apple's new Swift programming language and have some problems... Currently I'm trying to read a plist file, in Objective-C I would do the following to get the content as a NS..

Safest way to run BAT file from Powershell script

I can not get a powershell script to execute a bat file directly. For example, this works on the command line: .\\my-app\my-fle.bat When I add this command to a script, it outputs: The term '.\\my..

How can a LEFT OUTER JOIN return more records than exist in the left table?

I have a very basic LEFT OUTER JOIN to return all results from the left table and some additional information from a much bigger table. The left table contains 4935 records yet when I LEFT OUTER JOIN ..

Angular Material: mat-select not selecting default

I have a mat-select where the options are all objects defined in an array. I am trying to set the value to default to one of the options, however it is being left selected when the page renders. My ..

Numpy, multiply array with scalar

Is it possible to use ufuncs https://docs.scipy.org/doc/numpy/reference/ufuncs.html In order to map function to array (1D and / or 2D) and scalar If not what would be my way to achieve this? For examp..

create a trusted self-signed SSL cert for localhost (for use with Express/Node)

Trying to follow various instructions on creating a self-signed cert for use with localhost, Most of the instructions seem to be for IIS, but I'm trying to use Nodejs/Express. None of them work pro..

How to trigger button click in MVC 4

I'm new to MVC and I'm creating a Registration form for my app but my button click is not working current code is not given below view <fieldset> <legend>Sign Up</legend&g..

Can not deserialize instance of java.util.ArrayList out of START_OBJECT token

I'm trying to POST a List of custom objects. My JSON in request body is this: { "collection": [ { "name": "Test order1", "detail": "ahk ks" }, { ..

EditText underline below text property

I would like to change the blue colour below the edit text, i don't know what property it is. I tried using a different background colour for it but it didn't work. I've attached an image below: ..

iOS - Dismiss keyboard when touching outside of UITextField

I'm wondering how to make the keyboard disappear when the user touches outside of a UITextField...

How can I compile a Java program in Eclipse without running it?

I would like to compile my Java program in Eclipse but not to run it. I can't understand how to do it. How can I compile a Java program to .class files in Eclipse without running it?..

apache mod_rewrite is not working or not enabled

I have installed rewrite_module and modified php.ini on Apache. I create rewrite.php and .htaccess files, but it's not working. My filesystem folders like: /var/www/html /var/www/html/test /var/www..

"document.getElementByClass is not a function"

I am trying to run a function onclick of any button with class="stopMusic". I'm getting an error in Firebug document.getElementByClass is not a function Here is my code: var stopMusicExt = doc..

Getting value from table cell in JavaScript...not jQuery

I can't believe how long this has taken me but I can't seem to figure out how to extract a cell value from an HTML table as I iterate through the table with JavaScript. I am using the following to it..

How to make div fixed after you scroll to that div?

How to make a div remain fixed after you scroll to that div? I have a div that is later in a page and you need to scroll to get to that div. If I use: .divname { position: fixed; } The div will ..

Issue with virtualenv - cannot activate

I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv an..

Git status ignore line endings / identical files / windows & linux environment / dropbox / mled

How do I make git status ignore line ending differences? Background info: I use randomly Windows and Linux to work on the project. The project is in Dropbox. I found a lot about how do make ..

Assert an object is a specific type

Is it possible in JUnit to assert an object is an instance of a class? For various reasons I have an object in my test that I want to check the type of. Is it a type of Object1 or a type of Object2? ..

Letsencrypt add domain to existing certificate

I am just simply trying to add the domain test.example.com to the certificate that already exists for example.com. How do I add a domain to my existing certificate and replace the old certificate? I ..

Click toggle with jQuery

I've used a hover function where you do x on mouseover and y and mouseout. I'm trying the same for click but it doesn't seem to work: $('.offer').click(function(){ $(this).find(':checkbox').attr('..

Clone() vs Copy constructor- which is recommended in java

clone method vs copy constructor in java. which one is correct solution. where to use each case?..

How to count the NaN values in a column in pandas DataFrame

I want to find the number of NaN in each column of my data so that I can drop a column if it has fewer NaN than some threshold. I looked but wasn't able to find any function for this. value_counts is..

CSS I want a div to be on top of everything

How do I make an html div tag to be on top of everything? ..

Angular2 use [(ngModel)] with [ngModelOptions]="{standalone: true}" to link to a reference to model's property

Let's say I have a typescript object of type Mailtype like following: export class Mailtype { constructor( public name?: string, public locale?: string, public email?: string, publi..

How do I insert non breaking space character &nbsp; in a JSF page?

How do I insert a non breaking space character in JSF page like I can in HTML using &nbsp;? Is there such a tag in JSF?..

How to download Xcode DMG or XIP file?

Where does the Mac App Store download the files to under Lion? I need the DMG file in order to repair something in my system, but how can I access that file?..

How to set menu to Toolbar in Android

I want use ToolBar instead of ActionBar, but don't show me menu in toolbar!!! i want set menu such as Refresh or Setting buttons in ActionBar. Toolbar.xml code : <?xml version="1.0" encoding="u..

What is HTTP "Host" header?

Given that the TCP connection is already established when the HTTP request is sent, the IP address and port are implicitly known -- a TCP connection is an IP + Port. So, why do we need the Host header..

jquery loop on Json data using $.each

I have the following JSON returned in a variable called data. THIS IS THE JSON THAT GETS RETURNED... [ {"Id": 10004, "PageName": "club"}, {"Id": 10040, "PageName": "qaz"}, {"Id": 10059, "PageName..

Python, how to read bytes from file and save it?

I want to read bytes from a file and then write those bytes to another file, and save that file. How do I do this?..

Declaring a python function with an array parameters and passing an array argument to the function call?

I am a complete newbie to python and attempting to pass an array as an argument to a python function that declares a list/array as the parameter. I am sure I am declaring it wrong, here goes: def d..

GitHub "fatal: remote origin already exists"

I am trying to follow along Michael Hartl's Rails tutorial but I've run across an error. I signed up on Github and issued a new SSH key and made a new repository. But when I enter the next line into..

How to convert a SVG to a PNG with ImageMagick?

I have a SVG file that has a defined size of 16x16. When I use ImageMagick's convert program to convert it into a PNG, then I get a 16x16 pixel PNG which is way too small: convert test.svg test.png ..

JQuery - Get select value

I'm trying to get the selected value from a drop down list via jQuery. I have a bit of javascript that validates a form when I click SEND, to make sure there are no blanks, code is as follows: functi..

Node.js Mongoose.js string to ObjectId function

Is there a function to turn a string into an objectId in node using mongoose? The schema specifies that something is an ObjectId, but when it is saved from a string, mongo tells me it is still just a ..

How do you use Intent.FLAG_ACTIVITY_CLEAR_TOP to clear the Activity Stack?

I've read through several posts about using this, but must be missing something as it's not working for me. My activity A has launchmode="singleTop" in the manifest. It starts activity B, with launchm..

How to send email to multiple recipients using python smtplib?

After much searching I couldn't find out how to use smtplib.sendmail to send to multiple recipients. The problem was every time the mail would be sent the mail headers would appear to contain multipl..

Split a string by another string in C#

I've been using the Split() method to split strings, but this only appears to work if you are splitting a string by a character. Is there a way to split a string, with another string being the split b..

How to use Selenium with Python?

How do I set up Selenium to work with Python? I just want to write/export scripts in Python, and then run them. Are there any resources for that? I tried googling, but the stuff I found was either ref..

Javascript onHover event

Is there a canonical way to set up a JS onHover event with the existing onmouseover, onmouseout and some kind of timers? Or just any method to fire an arbitrary function if and only if user has hover..

How to remove all numbers from string?

I'd like to remove all numbers from a string [0-9]. I wrote this code that is working: $words = preg_replace('/0/', '', $words ); // remove numbers $words = preg_replace('/1/', '', $words ); // remov..

Passing data to components in vue.js

I'm struggling to understand how to pass data between components in vue.js. I have read through the docs several times and looked at many vue related questions and tutorials, but I'm still not getti..

SQL Query - how do filter by null or not null

I want to filter a record.... If statusid is null, filter the record (where statusId is not null) If statusid is not null, filter the record where statusid is equal to the specified statusid. How d..

How to change app default theme to a different app theme?

I have an Android app that has a default theme of Holo.Light but I want to change it to Theme.Black.I tried to do this by changing the style tag in the manifest android:theme="@style/AppTheme" to Them..

Is there any way to install Composer globally on Windows?

I've read the global installation documentation for Composer, but it's for *nix systems only: curl -s https://getcomposer.org/installer | php sudo mv composer.phar /usr/local/bin/composer I would..

How to link 2 cell of excel sheet?

I want to link 2 cell of a excel sheet so that depending on changes on 1st cell the second cell will change. I am novice in excel sheet so if it is a stupid question please forgive me..

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

What does "|=" mean? (pipe equal operator)

I tried searching using Google Search and Stack Overflow, but it didn't show up any results. I have seen this in opensource library code: Notification notification = new Notification(icon, ticke..

How to specify multiple return types using type-hints

I have a function in python that can either return a bool or a list. Is there a way to specify the return types using type hints. For example, Is this the correct way to do it? def foo(id) -> lis..

How to remove all non-alpha numeric characters from a string in MySQL?

I'm working on a routine that compares strings, but for better efficiency I need to remove all characters that are not letters or numbers. I'm using multiple REPLACE functions now, but maybe there is..

How to Verify if file exist with VB script

How do I verify via VBScript if the file conf exist under Program Files (i.e. C:\Program Files\conf)? For example if it exists, then msgBox "File exists" If not, then msgbox "File doesn't exist"..

How to Edit a row in the datatable

I have created a data table. It has 3 column Product_id, Product_name and Product_price Datatable table= new DataTable("Product"); table.Columns.Add("Product_id", typeof(int)); table.Col..

Cannot start session without errors in phpMyAdmin

I get the below error when pointing browser to phpMyAdmin Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation p..

How to decode jwt token in javascript without using a library?

How can I decode the payload of JWT using JavaScript? Without a library. So the token just returns a payload object that can consumed by my front-end app. Example token: xxxxxxxxx.XXXXXXXX.xxxxxxxx ..

HTML form with multiple "actions"

I'm setting up a form wherein I need two "actions" (two buttons): 1 - "Submit this form for approval" 2 - "Save this application for later" How do I create an HTML form that supports multiple "actio..

Why does 2 mod 4 = 2?

I'm embarrassed to ask such a simple question. My term does not start for two more weeks so I can't ask a professor, and the suspense would kill me. Why does 2 mod 4 = 2?..

Resizing Images in VB.NET

I'd like to make a simple VB utility to resize images using vb.net. I am having trouble figuring out what vb class to use to actually manipulate the images. The Image class and the Bitmap class don't ..

CMake error at CMakeLists.txt:30 (project): No CMAKE_C_COMPILER could be found

I'm trying make a Visual Studio solution with CMake to compile the latest version of aseprite and CMake keeps giving me the: No CMAKE_C_COMPILER could be found. No CMAKE_CXX_COMPILER could be found. ..

Read pdf files with php

I have a large PDF file that is a floor map for a building. It has layers for all the office furniture including text boxes of seat location. My goal is to read this file with PHP, search the documen..

How to merge 2 List<T> and removing duplicate values from it in C#

I have two lists List that I need to combine in third list and remove duplicate values from that lists A bit hard to explain, so let me show an example of what the code looks like and what I want as ..

How to move a file?

I looked into the Python os interface, but was unable to locate a method to move a file. How would I do the equivalent of $ mv ... in Python? >>> source_files = '/PATH/TO/FOLDER/*' >>&..

Start index for iterating Python list

What is the best way to set a start index when iterating a list in Python. For example, I have a list of the days of the week - Sunday, Monday, Tuesday, ... Saturday - but I want to iterate through th..

Java - Convert int to Byte Array of 4 Bytes?

Possible Duplicate: Convert integer into byte array (Java) I need to store the length of a buffer, in a byte array 4 bytes large. Pseudo code: private byte[] convertLengthToByte(byte[] my..

How to run a PowerShell script

How do I run a PowerShell script? I have a script named myscript.ps1 I have all the necessary frameworks installed I set that execution policy thing I have followed the instructions on this MSDN hel..

Exporting PDF with jspdf not rendering CSS

I am using jspdf.debug.js to export different data from a website but there are a few problems, I can't get it to render the CSS in the exported PDF and if I have an image in the page I am exporting, ..

SASS and @font-face

I have the following CSS - how would I describe it in SASS? I've tried reverse compiling it with css2sass, and just keep getting errors.... is it my CSS (which works ;-) )? @font-face { font-family..

Permission denied when launch python script via bash

# ./scripts/replace-md5sums.py bash: ./scripts/replace-md5sums.py: Permission denied replace-md5sums.py has chmod 600 # ls -l ./scripts/replace-md5sums.py -rw------- 1 ubuntu ubuntu 661 2011-04-27 ..

How do I copy the contents of a String to the clipboard in C#?

If I have some text in a String, how can I copy that to the clipboard so that the user can paste it into another window (for example, from my application to Notepad)?..

Password must have at least one non-alpha character

I need a regular expression for a password. The password has to contain at least 8 characters. At least one character must be a number or a special character (not a letter). [StringLength(100, ErrorM..

What's the difference between Visual Studio Community and other, paid versions?

What's missing in Visual Studio Community 2015? They say it's full-featured and free, but if that's the case, then why do/will they still sell Visual Studio Ultimate 2015 or Visual Studio Enterprise 2..

Unit tests vs Functional tests

What is the difference between unit tests and functional tests? Can a unit test also test a function?..

Fragment onResume() & onPause() is not called on backstack

I have multiple fragment inside an activity. On a button click I am starting a new fragment, adding it to backstack. I naturally expected the onPause() method of current Fragment and onResume() of new..

Dismissing a Presented View Controller

I have a theoretic question. Now I'm reading Apple's ViewController guide. They wrote: When it comes time to dismiss a presented view controller, the preferred approach is to let the presentin..

Getting value GET OR POST variable using JavaScript?

How to get value of the get or post variable on page load using JavaScript?..

Angular2 - Input Field To Accept Only Numbers

In Angular 2, how can I mask an input field (textbox) such that it accepts only numbers and not alphabetical characters? I have the following HTML input: <input type="text" *ngSwitchDefault..

What is the difference between an Instance and an Object?

What is the difference between an Instance and an Object? Is there a difference or not?..

throwing an exception in objective-c/cocoa

What's the best way to throw an exception in objective-c/cocoa?..

Connect Bluestacks to Android Studio

I have recently shifted to android studio. I would like to know how I can test my apps in Bluestacks app player. I had already had the bluestacks connected and working with eclipse using adb connect l..

Oracle row count of table by count(*) vs NUM_ROWS from DBA_TABLES

Looks like count(*) is slower than NUM_ROWS. Can experts in this area throw some light on this...

Python Pandas : group by in group by and average?

I have a dataframe like this: cluster org time 1 a 8 1 a 6 2 h 34 1 c 23 2 d 74 3 w 6 I would like to calc..

How to set "style=display:none;" using jQuery's attr method?

Following is the form with id msform that I want to apply style="display:none" attribute to. <form id="msform" style="display:none;"> </form> Also the check should be performed before a..

Difference between document.addEventListener and window.addEventListener?

While using PhoneGap, it has some default JavaScript code that uses document.addEventListener, but I have my own code which uses window.addEventListener: function onBodyLoad(){ document.addEventL..

What is std::move(), and when should it be used?

What is it? What does it do? When should it be used? Good links are appreciated...

Copy row but with new id

I have a table "test" with an auto incremented id and an arbitrary number of columns. I want to make a copy of a row in this table with all columns the same except for the id of course. Is there a ..

How to search multiple columns in MySQL?

I'm trying to make a search feature that will search multiple columns to find a keyword based match. This query: SELECT title FROM pages LIKE %$query%; works only for searching one column, I notice..

Hex to ascii string conversion

i have an hex string and want it to be converted to ascii string in C. How can i accomplish this??..

How to append to New Line in Node.js

I'm trying to Append data to a Log file using Node.js and that is working fine but it is not going to the next line. \n doesn't seem to be working in my function below. Any suggestions? function pro..

How to replace all occurrences of a string in Javascript?

I have this string in my Javascript code: "Test abc test test abc test test test abc test test abc" Doing: str = str.replace('abc', ''); seems to only remove the first occurrence of abc in..

"Please try running this command again as Root/Administrator" error when trying to install LESS

I'm trying to install LESS on my machine and have installed node already. However, when I enter "node install -g less" I get the following error and am not sure what to do? FPaulMAC:bin paul$ npm ins..

SQL Query with NOT LIKE IN

Please help me to write a sql query with the conditions as 'NOT LIKE IN' Select * from Table1 where EmpPU NOT Like IN ('%CSE%', '%ECE%', '%EEE%') Getting error...

Get file size, image width and height before upload

How can I get the file size, image height and width before upload to my website, with jQuery or JavaScript?..

What is the purpose for using OPTION(MAXDOP 1) in SQL Server?

I have never clearly understood the usage of MAXDOP. I do know that it makes the query faster and that it is the last item that I can use for Query Optimization. However, my question is, when and wher..

Bootstrap push div content to new line

Somehow I can not get out how to finish my code which I formatted as a list and need to format it as grid too which is switched by javascript. My HTML Code below is used to list a content: <div c..

The server committed a protocol violation. Section=ResponseStatusLine ERROR

I have created a program, tried to post a string on a site and I get this error: "The server committed a protocol violation. Section=ResponseStatusLine" after this line of code: gResponse = (..

open the file upload dialogue box onclick the image

I want to open the image upload file dialogue box if i click the button tag.is it possible.if so how can i do it in php while{ echo "<td><button><img src='".$cfet['productimage']...

Consider defining a bean of type 'package' in your configuration [Spring-Boot]

I am getting the following error: *************************** APPLICATION FAILED TO START *************************** Description: Parameter 0 of method setApplicant in webService.controller.Reques..

Why number 9 in kill -9 command in unix?

I understand it's off topic, I couldn't find anywhere online and I was thinking maybe programming gurus in the community might know this. I usually use kill -9 pid to kill the job. I always wonder..

PostgreSQL error 'Could not connect to server: No such file or directory'

Like some others I am getting this error when I run rake db:migrate in my project or even try most database tasks for my Ruby on Rails 3.2 applications. PGError (could not connect to server: No su..

How to suppress Update Links warning?

I'm trying to write a script that opens many Excel files. I keep getting the prompt: This workbook contains links to other data sources. I want to keep this message from appearing, so that my scri..

Set Background color programmatically

I try to set background color programmatically but when I set every one of my colors, the background being black but with any color background being white like the application theme. View someView = ..

convert string to date in sql server

How do I convert YYYY-MM-DD (2012-08-17) to a date in SQL Server? I don't see this format listed on the help page: http://msdn.microsoft.com/en-us/library/ms187928.aspx..

How to make remote REST call inside Node.js? any CURL?

In Node.js, other than using child process to make CURL call, is there a way to make CURL call to remote server REST API and get the return data? I also need to set up the request header to the remot..

CSV with comma or semicolon?

How is a CSV file built in general? With commas or semicolons? Any advice on which one to use?..

Does tkinter have a table widget?

I'm learning Python, and I would like to use it to create a simple GUI application, and since Tkinter is already built-in (and very simple to use) I would like to use it to build my application. I wo..

Adding a view controller as a subview in another view controller

I have found few posts for this problem but none of them solved my issue. Say like I've.. ViewControllerA ViewControllerB I tried to add ViewControllerB as a subview in ViewControllerA but, it's ..

Remove special symbols and extra spaces and replace with underscore using the replace method

I want to remove all special characters and spaces from a string and replace with an underscore. The string is var str = "hello world & hello universe"; I have this now which replaces only ..

Subtracting Dates in Oracle - Number or Interval Datatype?

I have a question about some of the internal workings for the Oracle DATE and INTERVAL datatypes. According to the Oracle 11.2 SQL Reference, when you subtract 2 DATE datatypes, the result will be a N..

Reading a text file using OpenFileDialog in windows forms

I am new to the OpenFileDialog function, but have the basics figured out. What I need to do is open a text file, read the data from the file (text only) and correctly place the data into separate text..

Comparing two NumPy arrays for equality, element-wise

What is the simplest way to compare two NumPy arrays for equality (where equality is defined as: A = B iff for all indices i: A[i] == B[i])? Simply using == gives me a boolean array: >>> ..

Moment js get first and last day of current month

How do I get the first and last day and time of the current month in the following format in moment.js: 2016-09-01 00:00 I can get the current date and time like this: moment().format('YYYY-MM-D..

Writing .csv files from C++

I'm trying to output some data to a .csv file and it is outputting it to the file but it isn't separating the data into different columns and seems to be outputting the data incorrectly. ofstrea..

Setting the height of a DIV dynamically

In a web application, I have a page that contains a DIV that has an auto-width depending on the width of the browser window. I need an auto-height for the object. The DIV starts about 300px from the..

Javascript - sort array based on another array

Is it possible to sort and rearrange an array that looks like this: itemsArray = [ ['Anne', 'a'], ['Bob', 'b'], ['Henry', 'b'], ['Andrew', 'd'], ['Jason', 'c'], ['Thomas', 'b..

Postgres "psql not recognized as an internal or external command"

For Postgres, I keep getting this error multiple times even though I have already set the location of the bin folder to the path variable in Windows 8. Is there something else I'm missing? (I can't p..

C# 'or' operator?

Is there an or operator in C#? I want to do: if (ActionsLogWriter.Close or ErrorDumpWriter.Close == true) { // Do stuff here } But I'm not sure how I could do something like that...

No provider for Router?

Im getting this error: EXCEPTION: Error in ./AppComponent class AppComponent - inline template:0:0 caused by: No provider for Router! This is my app component: import {Component} from '@angul..

angularjs - using {{}} binding inside ng-src but ng-src doesn't load

I have been trying to bind a value to the ng-src of an img HTML element to no avail. HTML code: <div ng-controller='footerCtrl'> <a href="#"><img ng-src="{{avatar_url}}"/></a>..

How to add a new object (key-value pair) to an array in javascript?

I have an array as : items=[{'id':1},{'id':2},{'id':3},{'id':4}]; How should I add a new pair {'id':5} to the array?..

How to hide app title in android?

I want to hide the app title bar...

Are there dictionaries in php?

For example: $names = {[bob:27, billy:43, sam:76]}; and then be able to reference it like this: $names[bob] ..

How to remove last n characters from a string in Bash?

I have a variable var in a Bash script holding a string, like: echo $var "some string.rtf" I want to remove the last 4 characters of this string and assign the result to a new variable var2, so tha..

parse html string with jquery

I have an HTML string from a Ajax loaded source. I would like to get some attributes from an object (image) in this string, before I put the HTML into the document. I've got something like: $.ajax(..

How to iterate through a DataTable

I need to iterate through a DataTable. I have an column there named ImagePath. When I am using DataReader I do it this way: SqlDataReader dr = null; dr = cmd.ExecuteReader(); while (dr.Read()) { ..

Does React Native styles support gradients?

I see that someone made this for it: https://github.com/brentvatne/react-native-linear-gradient But is there support for it in RN itself? Something like style = StyleSheet.create({ backgroundGra..

Check if a value is in an array (C#)

How do I check if a value is in an array in C#? Like, I want to create an array with a list of printer names. These will be fed to a method, which will look at each string in turn, and if the string..

In Perl, how to remove ^M from a file?

I have a script that is appending new fields to an existing CSV, however ^M characters are appearing at the end of the old lines so the new fields end up on a new row instead of the same one. How do I..

Vendor code 17002 to connect to SQLDeveloper

I'm trying to connect to a database using SQLDeveloper and I get the following error: An Error was Encountered performing The requested operation: IO Error: Conection reset Vendor code 17002. Cou..

Index was out of range. Must be non-negative and less than the size of the collection parameter name:index

I'm trying to add data as one by one row to a datagridview here is my code and it says: "Index was out of range. Must be non-negative and less than the size of the collection parameter name:inde..

How to access remote server with local phpMyAdmin client?

Assuming there is a remote server and I have phpMyAdmin client installed localy on my computer. How can I access this server and manage it via phpMyAdmin client? Is that possible? ..

Angular 2 Hover event

In the new Angular2 framework, does anyone know the proper way to do a hover like an event? In Angular1 there was ng-Mouseover, but that doesn't seem to have been carried over. I've looked through..

org.hibernate.MappingException: Could not determine type for: java.util.List, at table: College, for columns: [org.hibernate.mapping.Column(students)]

I'm using Hibernate for all CRUD operations in my project. It doesn't work for One-To-Many and Many-To-One relationships. It gives me the below error. org.hibernate.MappingException: Could not determ..

Replace an element into a specific position of a vector

I want to replace an element into a specific position of a vector, can I just use an assignment: // vec1 and 2 have the same length & filled in somehow vec1; vec2; vec1[i] = vec2[i] // insert ve..

XMLHttpRequest blocked by CORS Policy

I add an API with following script in let's say http://www.test.com: <script src="http://apiendpoint.com/api/v1/api.js"></script> <div id="api" data-apikey="LA59CJI9HZ-KIJK4I5-3CKJC"&..

How can I reuse a navigation bar on multiple pages?

I just finished making my home/index.html page. To keep the nav bar where it is, and have it stay while users click through all my pages. Do I have to copy and paste the nav code to the top of each pa..

Android: Tabs at the BOTTOM

I've seen some chatter about this, but nothing definite. Is there a way to put the tabs in a TabWidget to the bottom of the screen? If so, how? I've tried the following, but didn't work: a) sett..

How to tell which row number is clicked in a table?

I have a table like the following: _x000D_ _x000D_ <table>_x000D_ <tr>_x000D_ <td>1</td><td>1</td><td>1</td>_x000D_ </tr>_x000D_ &..

Best way to call a JSON WebService from a .NET Console

I am hosting a web service in ASP.Net MVC3 which returns a Json string. What is the best way to call the webservice from a c# console application, and parse the return into a .NET object? Should I re..

In what cases will HTTP_REFERER be empty

I know it's possible to get an empty HTTP_REFERER. Under what circumstances does this happen? If I get an empty one, does it always mean that the user changed it? Is getting an empty one the same as g..

Increase number of axis ticks

I'm generating plots for some data, but the number of ticks is too small, I need more precision on the reading. Is there some way to increase the number of axis ticks in ggplot2? I know I can tell g..

Java character array initializer

I tried to make a program that separates characters. The question is: "Create a char array and use an array initializer to initialize the array with the characters in the string 'Hi there'. Display..

How to parse JSON data with jQuery / JavaScript?

I have a AJAX call that returns some JSON like this: $(document).ready(function () { $.ajax({ type: 'GET', url: 'http://example/functions.php', data: { get_param: 'valu..

Storage permission error in Marshmallow

In Lollipop, the download functionality works fine in my app, but when I upgraded to Marshmallow, my app crashes and gives this error when I try to download from the internet into the SD card: Neith..

libclntsh.so.11.1: cannot open shared object file.

I want to schedule a task on Linux by icrontab, and the task is written in python and have to import cx_Oracle module, so I export ORACLE_HOME and LD_LIBRARY_PATH in .bash_profile, but it raise the er..

Invalid application path

IIS7 Windows 7 64bit No matter what I do I can't seem to add an application to a web site. When I 'Test settings' I get "Invalid application path". Any one have a guess as to what I could be doing ..

In Chrome 55, prevent showing Download button for HTML 5 video

I am getting this download button with <video> tags in Chrome 55, but not on Chrome 54: How can I remove this so no one can see the download button in Chrome 55? I have used <video> tag..

Should MySQL have its timezone set to UTC?

Follow up question of https://serverfault.com/questions/191331/should-servers-have-their-timezone-set-to-gmt-utc Should the MySQL timezone be set to UTC or should it be set to be the same timezone as..

How to perform update operations on columns of type JSONB in Postgres 9.4

Looking through the documentation for the Postgres 9.4 datatype JSONB, it is not immediately obvious to me how to do updates on JSONB columns. Documentation for JSONB types and functions: http://w..

jQuery changing style of HTML element

I have a list on HTML <div id="header" class="row"> <div id="logo" class="col_12">And the winner is<span>n't...</span></div> <div id="navigation" class="row"..

Right click to select a row in a Datagridview and show a menu to delete it

I have few columns in my DataGridView, and there is data in my rows. I saw few solutions in here, but I can not combine them! Simply a way to right-click on a row, it will select the whole row and sh..

What does Python's socket.recv() return for non-blocking sockets if no data is received until a timeout occurs?

Basically, I've read in several places that socket.recv() will return whatever it can read, or an empty string signalling that the other side has shut down (the official docs don't even mention what ..

Could not find com.google.android.gms:play-services:3.1.59 3.2.25 4.0.30 4.1.32 4.2.40 4.2.42 4.3.23 4.4.52 5.0.77 5.0.89 5.2.08 6.1.11 6.1.71 6.5.87

referencing the play-services via gradle stopped working for me - boiled it down - even the sample I used as a reference in the first place stopped working: https://plus.google.com/+AndroidDevelopers..

indexOf Case Sensitive?

Is the indexOf(String) method case sensitive? If so, is there a case insensitive version of it?..

How to install a Notepad++ plugin offline?

I am trying to install a Notepad++ plugin from Plugins -> Plugin Manager, but my office firewall is restricting its download. Is there any alternate way to download plugin offline?..

What is the native keyword in Java for?

While playing this puzzle (It's a Java keyword trivia game), I came across the native keyword. What is the native keyword in Java used for?..

How can I send an email through the UNIX mailx command?

How can I send an email through the UNIX mailx command?..

Comparing two arrays of objects, and exclude the elements who match values into new array in JS

here is my use case in JavaScript: I have two arrays of objects which have properties that match (id & name). var result1 = [ {id:1, name:'Sandra', type:'user', username:'sandra'}, {id:2..

MassAssignmentException in Laravel

I am a Laravel newbie. I want to seed my database. When I run the seed command I get an exception [Illuminate\Database\Eloquent\MassAssignmentException] username db:seed [--class[="..."]] [--d..

What does a question mark represent in SQL queries?

While going through some SQL books I found that examples tend to use question marks (?) in their queries. What does it represent?..

What are Makefile.am and Makefile.in?

These two files are mostly seen in open source projects. What are they for, and how do they work?..

convert string to number node.js

I'm trying to convert req.params to Number because that is what I defined in my schema for year param. I have tried req.params.year = parseInt( req.params.year, 10 ); and Number( req.params.yea..

How to disable scientific notation?

I have a dataframe with a column of p-values and I want to make a selection on these p-values. > pvalues_anova [1] 9.693919e-01 9.781728e-01 9.918415e-01 9.716883e-01 1.667183e-02 [6] 9.952762e-0..

ng if with angular for string contains

I have the following Angular code: <li ng-repeat="select in Items"> <foo ng-repeat="newin select.values"> {{new.label}}</foo> How can I use an ng-if con..

Refresh Fragment at reload

In an android application I'm loading data from a Db into a TableView inside a Fragment. But when I reload the Fragment it displays the previous data. Can I repopulate the Fragment with current data i..

Read a local text file using Javascript

I have read some of the previous questions on this topic but I really need to be 100% sure! Is it possible to read from a .txt file on my local system and present it in my HTML-BODY? I have tried se..

keyword not supported data source

I have an asp.net-mvc application with the default membership database. I am accessing it by ADO.NET Entity Framework. Now I want to move it to IIS, but several problems showed up. I had to install ..

Append an array to another array in JavaScript

This question is an exact duplicate of: How to append an array to an existing JavaScript Array? How do you append an array to another array in JavaScript? Other ways that a person might word this q..

How to override Bootstrap's Panel heading background color?

I'm using a Panel from Bootstrap however for the heading I want to use my own background color for the heading. When I don't put panel-heading class for the div, the layout gets screwed. So I thought ..

Relational Database Design Patterns?

Design patterns are usually related to object oriented design. Are there design patterns for creating and programming relational databases? Many problems surely must have reusable solutions. Examples..

Android Spinner : Avoid onItemSelected calls during initialization

I created an Android application with a Spinner and a TextView. I want to display the selected item from the Spinner's drop down list in the TextView. I implemented the Spinner in the onCreate method ..