Questions Tagged with #Root

On Unix-like systems, a special user account used for system administration.

How to set the context path of a web application in Tomcat 7.0

I know that I can rename my webapp (or it's WAR file) to ROOT but this is a terrible way to do it, IMHO. Now I checked out the tomcat doc & it says It is NOT recommended to place elements di..

How do I get the APK of an installed app without root access?

I'm trying to extract the APK file of an installed Android app WITHOUT root permissions. I thought that this was impossible, because all APK files for non-system-apps are located in /data/app, and ac..

How to get domain root url in Laravel 4?

I'm ready to scream how hard can this be? I've been trying for too long. If I have or similar I want to be able to get Thats all. So I can..

adb remount permission denied, but able to access super user in shell -- android

so, i'm trying to push some files to /system on android device (zte) I've rooted, connected with ADB, adb remount -> I get permission denied adb shell su -> I'm able to access shell and create folde..

vagrant login as root by default

Problem: frequently the first command I type to my boxes is su -. Question: how do I make vagrant ssh use the root user by default? Version: vagrant 1.6.5..

Import Certificate to Trusted Root but not to Personal [Command Line]

I am trying to import two certificates to my local machine using the command line. I have one certificate to add to the Personal Store of the local machine, and another one to add to the Trusted Root..

SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'

I just installed Ubuntu 16.04 and installed web server on it. Everything works well, but I cannot access database. Even if I create new user and grant all privileges, I can't create database In PHP I'..

Root user/sudo equivalent in Cygwin?

I'm trying to run a bash script in Cygwin. I get Must run as root, i.e. sudo ./scriptname errors. chmod 777 scriptname does nothing to help. I've looked for ways to imitate sudo on Cygwin, to..

Access Denied for User 'root'@'localhost' (using password: YES) - No Privileges?

I am continuously receiving this error. I am using mySQL Workbench and from what I am finding is that root's schema privileges are null. There are no privileges at all. I am having troubles across p..

MySQL user DB does not have password columns - Installing MySQL on OSX

I am trying to change MySql root password. What I have done is below. Install MySql-5.7.6 ~ .dmg(Community Server) and workbench. Turn off the server on OSX System preferences. Access MySql with co..

How to restart adb from root to user mode?

Basic question on ADB. adb root restarts adb as root. But what i want is to restart it back to user after some time. I tried the following : adb kill-server adb start-server doesnt work.. ps -A ..

Connect to docker container as user other than root

BY default when you run docker run -it [myimage] OR docker attach [mycontainer] you connect to the terminal as root user, but I would like to connect as a different user. Is this possible? ..

How to get root access on Android emulator?

I have All Android SDK versions(from 1.5 to 2.3.3), and I tried many methods for getting root in Android emulator. I don't use any Android device and test everything on emulator(AVD). I need to get r..

Android: adbd cannot run as root in production builds

I have an Android-based phone (2.3.6) with unlocked root privileges. Since i'd like to have access to my phone through my computer, today i've installed QtAdb and Android SDK. If i open a command prom..

Viewing root access files/folders of android on windows

I'm trying to view the files and folders at root level on an android device using USB Debugging mode and windows. Is this possible? Phone is rooted. I've downloaded a file explorer app which allows m..

Is there a way for non-root processes to bind to "privileged" ports on Linux?

It's very annoying to have this limitation on my development box, when there won't ever be any users other than me. I'm aware of the standard workarounds, but none of them do exactly what I want: a..

How to check if running as root in a bash script

I'm writing a script that requires root level permissions, and I want to make it so that if the script is not run as root, it simply echoes "Please run as root." and exits. Here's some pseudocode for..

How to parse a String containing XML in Java and retrieve the value of the root node?

I have XML in the form of a String that contains <message>HELLO!</message> How can I get the String "Hello!" from the XML? It should be ridiculously easy but I am lost. The XML isn't ..

phpMyAdmin - can't connect - invalid setings - ever since I added a root password - locked out

I run XAMPP, a few days back i had set up a password for the root password through phpmyadmin I am not able to access phpMyAdmin ever since that moment I followed help on this link but everything see..

MySQL root password change

I have been trying to reset my MySQL root password. I have run the mysqld_safe --skip-grant-tables, updated the root password, and checked the user table to make sure it is there. Once restarting th..

Document Root PHP

Just to confirm, is using: $_SERVER["DOCUMENT_ROOT"] the same as using: / in HTML. Eg. If current document is: folder/folder/folder/index.php I could use (in HTML) to start at the roort: /som..

A terminal command for a rooted Android to remount /System as read/write

I'm writing an android app that needs to copy a file to the "/system" partition at runtime. I've got the commands to run "su" and can successfully request SuperUser permissions and run commands as roo..

Determine if running on a rooted device

My app has a certain piece of functionality that will only work on a device where root is available. Rather than having this feature fail when it is used (and then show an appropriate error message to..

adb shell su works but adb root does not

I rooted my unlocked Galaxy S3 (SGH-T999) Now, I'm trying to run adb root from Windows Command Prompt, however, I'm getting adbd cannot run as root in production builds error. So, the very first thin..

sql like operator to get the numbers only

This is I think a simple problem but not getting the solution yet. I would like to get the valid numbers only from a column as explained here. Lets say we have a varchar column with following values ..

How to hide 'Back' button on navigation bar on iPhone?

I added a navigation control to switch between views in my app. But some of the views shouldn't have 'Back' (the previous title) button. Any ideas about how to hide the back button?..

Android- Error:Execution failed for task ':app:transformClassesWithDexForRelease'

The Problem is that i am able to run my app when i change to debug mode but it fails when i switch to release mode. Exception: **FAILURE: Build failed with an exception.** > Execution failed for ..

Decode JSON with unknown structure

I want to get a string that represents a json like this one: { "votes": { "option_A": "3" } } and include a "count" key in it so it ends like this: { "vot..

cpp / c++ get pointer value or depointerize pointer

I was wondering if it's possible to make a pointer not a pointer.. The problem is I have a function that accepts a pointer for an paramater for me to easily get a value to that pointer. It's a simple..

Using Ansible set_fact to create a dictionary from register results

In Ansible I've used register to save the results of a task in the variable people. Omitting the stuff I don't need, it has this structure: { "results": [ { "item": { ..

Can I stretch text using CSS?

Can I stretch text in CSS? I don't want the font to be bigger, because that makes it appear bolder than smaller text beside it. I just want to stretch the text vertically so it's kind of deformed. Th..

How many spaces will Java String.trim() remove?

In Java, I have a String like this: " content ". Will String.trim() remove all spaces on these sides or just one space on each?..

How to reformat JSON in Notepad++?

I need Notepad++ to take a json string from this {"menu": {"id": "file","value": "File","popup": {"menuitem": [{"value": "New", "onclick": "CreateNewDoc()"},{"value": "Open", "onclick": "OpenDoc()"},..

PHP save image file

Possible Duplicate: Saving image from PHP URL I have an image as a url link from the 3rd party web thumb site (IE

Find the host name and port using PSQL commands

I have PSQL running, and am trying to get a perl application connecting to the database. Is there a command to find the current port and host that the database is running on?..

What is the (best) way to manage permissions for Docker shared volumes?

I've been playing around with Docker for a while and keep on finding the same issue when dealing with persistent data. I create my Dockerfile and expose a volume or use --volumes-from to mount a host..

" netsh wlan start hostednetwork " command not working no matter what I try

C:\Windows\system32>netsh wlan show drivers Interface name: Wireless Network Connection Driver : DW1501 Wireless-N WLAN Half-Mini Card Vendor : Broadcom Provid..

How to stop process from .BAT file?

So I have process I started from one bat file. How to stop it from another?..

What does $@ mean in a shell script?

What does a dollar sign followed by an at-sign (@) mean in a shell script? For example: umbrella_corp_options $@ ..

How to update/modify an XML file in python?

I have an XML document that I would like to update after it already contains data. I thought about opening the XML file in "a" (append) mode. The problem is that the new data will be written after th..

PHP Parse error: syntax error, unexpected end of file in a CodeIgniter View

I am getting an unexpected end of file error on my CodeIgniter View. I have pasted the PHP code at This code passed various online PHP syntax tests, but I don't know why..

Clicking at coordinates without identifying element

As part of my Selenium test for a login function, I would like to click a button by identifying its coordinates and instructing Selenium to click at those coordinates. This would be done without ident..

Proper Linq where clauses

I write a fair amount of linq in my day to day life, but mostly simple statements. I have noticed that when using where clauses, there are many ways to write them and each have the same results as fa..

Returning multiple values from a C++ function

Is there a preferred way to return multiple values from a C++ function? For example, imagine a function that divides two integers and returns both the quotient and the remainder. One way I commonly ..

async for loop in node.js

I am new to this node.js ..I am little bit confused about this callback..In my app inside a for loop i am calling a asynchronous function call,i think my problem is that before i am getting response o..

How to get "their" changes in the middle of conflicting Git rebase?

I have conflicting branches, branch2 branched from branch1. Let's say when rebasing branch2 on current branch1, while resolving conflicts, I decide to take some (not all) of "their" (i.e. branch1) fi..

How do I get the position selected in a RecyclerView?

I am experimenting with the support library's recyclerview and cards. I have a recyclerview of cards. Each card has an 'x' icon at the top right corner to remove it: The card xml, list_item.xml: &..

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

how to increment integer Columns value by 1 in SQL

My questions is how to increment a column's value by 1. For example, suppose a column ID has values 1,2,3,4, .. Now when I update this table then ID column should increment by 1, Now ID will b..

Find the differences between 2 Excel worksheets?

I have two excel files with the same structure: they both have 1 column with data. One has 800 records and the other has 805 records, but I am not sure which of the 5 in the 805 set are not in the 8..

JDBC ResultSet: I need a getDateTime, but there is only getDate and getTimeStamp

I would like to get the DATETIME column from an Oracle DB Table with JDBC. Here is my code: int columnType = rsmd.getColumnType(i); if(columnType == Types.DATE) { Date aDate = rs.getDate(i); ..

Matplotlib figure facecolor (background color)

Can someone please explain why the code below does not work when setting the facecolor of the figure? import matplotlib.pyplot as plt # create figure instance fig1 = plt.figure(1) fig1.set_figheight..

TensorFlow not found using pip

I'm trying to install TensorFlow using pip: $ pip install tensorflow --user Collecting tensorflow Could not find a version that satisfies the requirement tensorflow (from versions: ) No matching dist..

What does 'super' do in Python?

What's the difference between: class Child(SomeBaseClass): def __init__(self): super(Child, self).__init__() and: class Child(SomeBaseClass): def __init__(self): SomeBaseCl..


I am using Google notifications in my app, and until now I have done below in the manifest: <!-- GCM --> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <!-- GCM req..

Reading/parsing Excel (xls) files with Python

What is the best way to read Excel (XLS) files with Python (not CSV files). Is there a built-in package which is supported by default in Python to do this task?..

What is the best IDE for PHP?

I'm a PHP developer and now I use Notepad++ for code editing, but lately I've been searching for an IDE to ease my work. I've looked into Eclipse, Aptana Studio and several others, but I'm not really..

Video auto play is not working in Safari and Chrome desktop browser

I spent quite a lot of time trying to figure out why video embedded like here: <video height="256" loop autoplay muted controls id="vid"> <source type="video/mp4" src="

How to save all files from source code of a web site?

I want to download all files (html, images, js, css) from one website. I can download each and every file separately. I tried in Google Chrome, after clicking on the view source, then ctrl + s then ..

How to convert an entire MySQL database characterset and collation to UTF-8?

How can I convert entire MySQL database character-set to UTF-8 and collation to UTF-8?..

Download a single folder or directory from a GitHub repo

How can I download only a specific folder or directory from a remote Git repo hosted on GitHub? Say the example GitHub repo lives here: [email protected]:foobar/Test.git Its directory structure: Tes..

How to iterate over each string in a list of strings and operate on it's elements

Im new to python and i need some help with this. TASK : given a list --> words = ['aba', 'xyz', 'xgx', 'dssd', 'sdjh'] i need to compare the first and the last element of each string in the list, ..

Calculating the position of points in a circle

I'm having a bit of a mind blank on this at the moment. I've got a problem where I need to calculate the position of points around a central point, assuming they're all equidistant from the center and..

Play infinitely looping video on-load in HTML5

I'm looking to place a video in an HTML5 page that will begin playing on page-load, and once completed, loop back to the beginning without a break. The video should also NOT have any controls associat..

Test if a variable is a list or tuple

In python, what's the best way to test if a variable contains a list or a tuple? (ie. a collection) Is isinstance() as evil as suggested here? Update: th..

Execute multiple command lines with the same process using .NET

I'm trying to execute multiple commands without create a new process each time. Basically, I want to start the DOS command shell, switch to the MySQL command shell, and execute a command. Here's how I..

Java Multiple Inheritance

In an attempt to fully understand how to solve Java's multiple inheritance problems I have a classic question that I need clarified. Lets say I have class Animal this has sub classes Bird and Horse a..

Sublime Text 2 multiple line edit

I want to edit multiple lines and every "word" within that line. For example: 45 28 42 65 24 87 47 95 01 25 87 98 I want to select every whole number in all lines and put a "0x" before it so it wou..

Importing text file into excel sheet

I'm writing a VBA code which supposed to delete the data on a selected excel sheet, open a dialog box for text file selection, and then import the data from that text file to the same exact sheet I've..

Difference between setTimeout with and without quotes and parentheses

I am learning JavaScript and I have learned recently about JavaScript timing events. When I learned about setTimeout at W3Schools, I noticed a strange figure which I didn’t run into before. They are..

z-index not working with fixed positioning

I have a div with default positioning (i.e. position:static) and a div with a fixed position. If I set the z-indexes of the elements, it seems impossible to make the fixed element go behind the static..

How do I output an ISO 8601 formatted string in JavaScript?

I have a Date object. How do I render the title portion of the following snippet? <abbr title="2010-04-02T14:12:07">A couple days ago</abbr> I have the "relative time in words" portion ..

How to stick <footer> element at the bottom of the page (HTML5 and CSS3)?

When I use position relative with no content, footer goes up, with absolute with a lot of content, the footer goes down, and with fixed it is always there. Is there a easy way to get at the end of t..

TCPDF not render all CSS properties

I try to make a PDF writing CSS and HTML but my CSS doesn't appear in my PDF. The only thing considered is the font-size and font-color. I give you the code (sorry, it's a little long...) $config = ..

Iterating through a list to render multiple widgets in Flutter?

I have a list of strings defined like this: var list = ["one", "two", "three", "four"]; I want to render the values on the screen side by side using text widgets. I have attempted to use the follo..

Write to .txt file?

How can I write a little piece of text into a .txt file? I've been Googling for over 3-4 hours, but can't find out how to do it. fwrite(); has so many arguments, and I don't know how to use it. What..

How can I get the sha1 hash of a string in node.js?

I'm trying to create a websocket server written in node.js To get the server to work I need to get the SHA1 hash of a string. What I have to do is explained in Section 5.2.2 page 35 of the docs. ..

How to calculate percentage with a SQL statement

I have a SQL Server table that contains users & their grades. For simplicity's sake, lets just say there are 2 columns - name & grade. So a typical row would be Name: "John Doe", Grade:"A". I..

How to fix Ora-01427 single-row subquery returns more than one row in select?

When i execute the following query, i get the message like "Ora-01427 single-row subquery returns more than one row" SELECT E.I_EmpID AS EMPID, E.I_EMPCODE AS EMPCODE, E.I_EmpName..

Drawing circles with System.Drawing

I have this code that draws a Rectangle ( Im trying to remake the MS Paint ) case "Rectangle": if (tempDraw != null) { tempDraw = (Bitmap)snapshot...

Export SQL query data to Excel

I have a query that returns a very large data set. I cannot copy and paste it into Excel which I usually do. I have been doing some research on how to export directly to an Excel sheet. I am running S..

Remove all multiple spaces in Javascript and replace with single space

How can I automatically replace all instances of multiple spaces, with a single space, in Javascript? I've tried chaining some s.replace but this doesn't seem optimal. I'm using jQuery as well, in c..

Java properties UTF-8 encoding in Eclipse

I've recently had to switch encoding of webapp I'm working on from ISO-xx to utf8. Everything went smooth, except properties files. I added -Dfile.encoding=UTF-8 in eclipse.ini and normal files work f..

How to convert milliseconds into human readable form?

I need to convert an arbitrary amount of milliseconds into Days, Hours, Minutes Second. For example: 10 Days, 5 hours, 13 minutes, 1 second...

Python - IOError: [Errno 13] Permission denied:

I'm getting IOError: [Errno 13] Permission denied and I don't know what is wrong wit this code. I'm trying to read a file given an absolute path (meaning only file.asm), and a relative path (meaning..

How to use Comparator in Java to sort

I learned how to use the comparable but I'm having difficulty with the Comparator. I am having a error in my code: Exception in thread "main" java.lang.ClassCastException: New.People cannot be cast ..

TypeError: 'undefined' is not a function (evaluating '$(document)')

I'm using a WordPress site. I'm including this script in the header. When the script loads, I get this error: TypeError: 'undefined' is not a function (evaluating '$(document)') I have no ide..

Split string based on regex

What is the best way to split a string like "HELLO there HOW are YOU" by upper case words (in Python)? So I'd end up with an array like such: results = ['HELLO there', 'HOW are', 'YOU'] EDIT: I..

Algorithm for solving Sudoku

I want to write a code in python to solve a sudoku puzzle. Do you guys have any idea about a good algorithm for this purpose. I read somewhere in net about a algorithm which solves it by filling the w..

Spell Checker for Python

I'm fairly new to Python and NLTK. I am busy with an application that can perform spell checks (replaces an incorrectly spelled word with the correct one). I'm currently using the Enchant library on P..

When to use reinterpret_cast?

I am little confused with the applicability of reinterpret_cast vs static_cast. From what I have read the general rules are to use static cast when the types can be interpreted at compile time hence t..

Update MySQL version from 5.1 to 5.5 in CentOS 6.2

I tried to update MySQL from 5.1 to 5.5 in CentOS 6.2. The following is the process I did: 1. rpm -Uvh 2. yum install libmysqlclient15 --enablerepo=we..

How do I install PHP cURL on Linux Debian?

How do I install PHP cURL on Linux Debian? I tried the following code and got the error below apt-get update apt-get install curl libcurl3 php5-curl Error: W: Failed to fetch http://zm.archive.ub..

Pip install Matplotlib error with virtualenv

I am trying to install matplotlib in a new virtualenv. When I do: pip install matplotlib or pip install

Application Installation Failed in Android Studio

Yesterday my app was running perfect from Android Studio but today when I started working on my app and running it i am getting error message continuously Installation failed with message Failed t..

Match linebreaks - \n or \r\n?

While writing this answer, I had to match exclusively on linebreaks instead of using the s-flag (dotall - dot matches linebreaks). The sites usually used to test regular expressions behave differen..

OpenCV - DLL missing, but it's not?

I am trying just a basic program with OpenCV with the following code: #include "cv.h" #include "highgui.h" int main() { IplImage* newImg; newImg = cvLoadImage("~/apple.bmp", 1); cvNamedW..

PHP PDO: charset, set names?

I had this previously in my normal mysql_* connection: mysql_set_charset("utf8",$link); mysql_query("SET NAMES 'UTF8'"); Do I need it for the PDO? And where should I have it? $connect = new PDO("m..

Showing alert in angularjs when user leaves a page

I'm an angularjs new bee. I'm trying to write a validation which alerts the user when he tries to close the browser window. I have 2 links on my page v1 and v2.When clicked on the links it takes to t..

Using HTML5/Canvas/JavaScript to take in-browser screenshots

Google's "Report a Bug" or "Feedback Tool" lets you select an area of your browser window to create a screenshot that is submitted with your feedback about a bug. Screenshot by Ja..

jQuery autocomplete tagging plug-in like StackOverflow's input tags?

What solutions accomplish the same auto-completion that SO uses for entering tags? There are plugins that can handle one word but I haven't seen any that handle multiple words...

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

Sharing a URL with a query string on Twitter

I'm trying to put a Twitter share link in an email. Because this is in an email I can't rely on JavaScript, and have to use the "Build Your Own" Tweet button. For example, sharing a link to..

Bootstrap 3 collapse accordion: collapse all works but then cannot expand all while maintaining data-parent

I'm using Bootstrap 3 and trying to setup the following accordion/collapse structure: Onload: Each accordion panel in a group is fully collapsed and functions as documented/expected. Button click: E..

md-table - How to update the column width

I have started using the md-table for my project, and I want fixed column width. Currently all columns width are divided into equal size. Where can I get the documentation of data table dimensions? ..

Exception : peer not authenticated

public HttpClientVM() { BasicHttpParams params = new BasicHttpParams(); ConnManagerParams.setMaxTotalConnections(params, 10); HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); ..

String to object in JS

I have a string as string = "firstName:name1, lastName:last1"; now I need one object obj such that obj = {firstName:name1, lastName:last1} How can I do this in JS?..

How to add a filter class in Spring Boot?

I wonder, if there is any annotation for a Filter class (for web applications) in Spring Boot? Perhaps @Filter? I want to add a custom filter in my project. The Spring Boot Reference Guide mentione..

HRESULT: 0x800A03EC on Worksheet.range

I am getting HRESULT: 0x800A03EC on Worksheet.range method. Number of rows are more than 70K. Office 2007. Code: Microsoft.Office.Interop.Excel.Range neededRange = currentWS.Range[cell.Cells[1, ..

How to set environment variables in Jenkins?

I would like to be able to do something like: AOEU=$(echo aoeu) and have Jenkins set AOEU=aoeu. The Environment Variables section in Jenkins doesn't do that. Instead, it sets AOEU='$(echo aoeu)'. ..

How to delete the top 1000 rows from a table using Sql Server 2008?

I have a table in SQL Server. I would like to delete the top 1000 rows from it. However, I tried this, but I instead of just deleting the top 1000 rows it deleted all the rows in the table. Here is..

Manifest merger failed : uses-sdk:minSdkVersion 14

Since downloading the latest SDK and installing Android Studio, my project fails to build. I get the following message: Error:Gradle: Execution failed for task ':SampleProject:processProdDebugManifes..

load Js file in HTML

My first PhoneGap application includes 2 HTML files. The first one is named index.html which uses index.js. This file will display a list item. When I click an item in that list, it brings me to det..

html script src="" triggering redirection with button

i have the following login.html page for login located in design folder. <html> <head> <title>Login Page</title> <script src="../Script/login.js"> </script&..

How to debug a stored procedure in Toad?

I have Oracle 10g installed and there is a package which has a number of cursors and procedures, how do I debug one of these procedures or cursors. Can you please provide steps for that? I ran a Goog..

What do 3 dots next to a parameter type mean in Java?

What do the 3 dots following String in the following method mean? public void myMethod(String... strings){ // method body } ..

How to count TRUE values in a logical vector

In R, what is the most efficient/idiomatic way to count the number of TRUE values in a logical vector? I can think of two ways: z <- sample(c(TRUE, FALSE), 1000, rep = TRUE) sum(z) # [1] 498 tabl..

Interface defining a constructor signature?

It's weird that this is the first time I've bumped into this problem, but: How do you define a constructor in a C# interface? Edit Some people wanted an example (it's a free time project, so yes, it..

How do I convert a calendar week into a date in Excel?

I have a week number and a year, and would like to calculate the date of the Monday for that specific week in Microsoft Excel. Year Week Date (Monday) 2012 1 January 2, 2012 2013 16 ..

Construct a manual legend for a complicated plot

I cannot figure out how to manually set up a legend for this plot. All I really want is a simple legend to the right that uses the three colors and has a name next to each. The current code looks l..

Execute action when back bar button of UINavigationController is pressed

I need to execute an action (emptying an array), when the back button of a UINavigationController is pressed, while the button still causes the previous ViewController on the stack to appear. How coul..

How to build a query string for a URL in C#?

A common task when calling web resources from a code is building a query string to including all the necessary parameters. While by all means no rocket science, there are some nifty details you need t..

Jenkins pipeline if else not working

I am creating a sample jenkins pipeline, here is the code. pipeline { agent any stages { stage('test') { steps { sh 'echo hello' } ..

In Perl, how can I concisely check if a $variable is defined and contains a non zero length string?

I currently use the following Perl to check if a variable is defined and contains text. I have to check defined first to avoid an 'uninitialized value' warning: if (defined $name && length $n..

Does adding a duplicate value to a HashSet/HashMap replace the previous value

Please consider the below piece of code: HashSet hs = new HashSet(); hs.add("hi"); -- (1) hs.add("hi"); -- (2) hs.size() will give 1 as HashSet doesn't allow duplicates so only one element will be ..

How to use mouseover and mouseout in Angular 6

I have this older Angular code which works but not in the latest version of Angular 6. <div ng-mouseover="changeText=true" ng-mouseleave="changeText=false" ng-init="changeText=false"> <spa..

How to get all possible combinations of a list’s elements?

I have a list with 15 numbers in, and I need to write some code that produces all 32,768 combinations of those numbers. I've found some code (by Googling) that apparently does what I'm looking for, ..

Select columns from result set of stored procedure

I have a stored procedure that returns 80 columns, and 300 rows. I want to write a select that gets 2 of those columns. Something like SELECT col1, col2 FROM EXEC MyStoredProc 'param1', 'param2' ..

IF formula to compare a date with current date and return result

I'm looking for a formula which allows me to look at a cell and check if it greater than or equal to today's date and to return a worded result such as "overdue". If it is blank to return another word..

jQuery: outer html()

imagine what we have something like this: <div id="xxx"><p>Hello World</p></div> if we call .html function in this way: $("#xxx").html(); we will get: <p>Hello Wor..

gradient descent using python and numpy

def gradient(X_norm,y,theta,alpha,m,n,num_it): temp=np.array(np.zeros_like(theta,float)) for i in range(0,num_it):,theta) #temp[j]=theta[j]-(alpha/m)*( np.sum(..

import sun.misc.BASE64Encoder results in error compiled in Eclipse

For this two imports; import sun.misc.BASE64Encoder; import sun.misc.BASE64Decoder; I got this error: Access restriction: The type BASE64Decoder is not accessible due to restriction on required li..

Leaflet changing Marker color

Is there a way to randomly change marker-colors in native Leaflet? I'm using svg elements which could be styled. I know that it is possible with mapbox.js EDIT: To clarify what I intend to do: If you ..

How to return a value from pthread threads in C?

I'am new to C and would like to play with threads a bit. I would like to return some value from a thread using pthread_exit() My code is as follows: #include <pthread.h> #include <stdio.h&g..

Using jQuery to test if an input has focus

On the front page of a site I am building, several <div>s use the CSS :hover pseudo-class to add a border when the mouse is over them. One of the <div>s contains a <form> which, usin..

How can I simulate mobile devices and debug in Firefox Browser?

I am looking for a tool, that shows my website in a mobile device mode. Also I want to debug my website with tools like Firebug or ... even better I can use Firebug. What is an established solution to..

Python find elements in one list that are not in the other

I need to compare two lists in order to create a new list of specific elements found in one list but not in the other. For example: main_list=[] list_1=["a", "b", "c", "d", "e"] list_2=["a", "f", "c"..

How to edit .csproj file

When I am compiling my .csproj file using .NET Framework 4.0 MSBUILD.EXE file, I am getting an error: "lable01" not found in the current context of "website01.csproj". Actually, I ..

UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 20: ordinal not in range(128)

I'm having problems dealing with unicode characters from text fetched from different web pages (on different sites). I am using BeautifulSoup. The problem is that the error is not always reproducibl..

C++ auto keyword. Why is it magic?

From all the material I used to learn C++, auto has always been a weird storage duration specifier that didn't serve any purpose. But just recently, I encountered code that used it as a type name in ..

How to get unique values in an array

How can I get a list of unique values in an array? Do I always have to use a second array or is there something similar to java's hashmap in JavaScript? I am going to be using JavaScript and jQuery o..

How to get the selected date value while using Bootstrap Datepicker?

Using jquery and the Bootstrap Datepicker, how do I get the new date value I selected using the Bootstrap Datepicker? FYI, I'm using Rails 3 and Coffescript. I set up the datapicker using: <inpu..

Fade In on Scroll Down, Fade Out on Scroll Up - based on element position in window

I'm trying to get a series of elements to fade in on scroll down when they are fully visible in the window. If I keep scrolling down, I do not want them to fade out, but if I scroll up, I do want them..

How do I convert between ISO-8859-1 and UTF-8 in Java?

Does anyone know how to convert a string from ISO-8859-1 to UTF-8 and back in Java? I'm getting a string from the web and saving it in the RMS (J2ME), but I want to preserve the special chars and get..

Hibernate problem - "Use of @OneToMany or @ManyToMany targeting an unmapped class"

I'm finding my feet with Hibernate Annotations and I've hit a problem I hope someone can help with. I have 2 entities, Section and ScopeTopic. The section has a List class member, so a One to Many re..

Case insensitive searching in Oracle

The default behaviour of LIKE and the other comparison operators, = etc is case-sensitive. Is it possible make them case-insensitive?..

Comparing user-inputted characters in C

The following code snippets are from a C program. The user enters Y or N. char *answer = '\0'; scanf (" %c", answer); if (*answer == ('Y' || 'y')) // do work I can't figure out why this if s..

How to check if the URL contains a given string?

How could I do something like this: <script type="text/javascript"> $(document).ready(function () { if(window.location.contains("franky")) // This doesn't work, any suggestions? { ..

$(document).ready(function() is not working

I am using Jquery for getting a json object from a solr server. When I run my html file with Tomcat it is runns fine but when I embed it with my project which is running on weblogic it gets this erro..

json.dump throwing "TypeError: {...} is not JSON serializable" on seemingly valid object?

Background: I am writing a python program which should manage my music files. It crawls directories and puts the files and their meta data (via mutagen), encoded in JSON, in a file as a simple "databa..

MySQL SELECT AS combine two columns into one

Using this solution, I tried to use COALESCE as part of a MySQL query that outputs to a csv file using SELECT As to name the column names when exporting the data. SELECT FirstName AS First_Name ..

Getting Spring Application Context

Is there a way to statically/globally request a copy of the ApplicationContext in a Spring application? Assuming the main class starts up and initializes the application context, does it need to pass..

Convert JSON String To C# Object

Trying to convert a JSON string into an object in C#. Using a really simple test case: JavaScriptSerializer json_serializer = new JavaScriptSerializer(); object routes_list = json_serializer.Deserial..

What does <value optimized out> mean in gdb?

(gdb) n 134 a = b = c = 0xdeadbeef + ((uint32_t)length) + initval; (gdb) n (gdb) p a $30 = <value optimized out> (gdb) p b $31 = <value optimized out> (gdb) p c $32 = 3735928563 How ca..

Initializing a dictionary in python with a key value and no corresponding values

I was wondering if there was a way to initialize a dictionary in python with keys but no corresponding values until I set them. Such as: Definition = {'apple': , 'ball': } and then later i can set ..

How to extend a class in python?

In python how can you extend a class? For example if I have class Color: def __init__(self, color): self.color = color def getcolor(self): return self.color color_..

What is the difference between exit and return?

What is difference between return and exit statement in C programming when called from anywhere in a C program?..

Default value in Doctrine

How do I set a default value in Doctrine 2?..

How can I keep Bootstrap popovers alive while being hovered?

I am using a Bootstrap popover to create a hover card showing user info, and I am triggering it on mouseover of a button. I want to keep this popover alive while the popover itself is being hovered, b..

Do Git tags only apply to the current branch?

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

How to convert FileInputStream to InputStream?

I just want to convert a FileInputStream to an InputStream, how can I do that? e.g FileInputStream fis = new FileInputStream("c://filename"); InputStream is = ?; fis.close(); ..

failed to open stream: HTTP wrapper does not support writeable connections

I have uploaded my localhost files to my website but it is showing me this error:- : [2] file_put_contents( ***WebsiteURL*** /cache/lang/ ***FileName*** .php) [function.file-put-contents]: failed to..

How do I make an image smaller with CSS?

I have this page and I have users uploading an icon image for the industries and they are uploading a bigger image. I want to resize it via CSS and it's cutting it when changing it in Firebug. To see ..

Clear MySQL query cache without restarting server

Is there any way to clear mysql query cache without restarting mySQL server?..

how to return a char array from a function in C

I want to return a character array from a function. Then I want to print it in main. how can I get the character array back in main function? #include<stdio.h> #include<string.h> int main..

Resolve Javascript Promise outside function scope

I have been using ES6 Promise. Ordinarily, a Promise is constructed and used like this new Promise(function(resolve, reject){ if (someCondition){ resolve(); } else { reject()..

Does Python SciPy need BLAS?

numpy.distutils.system_info.BlasNotFoundError: Blas ( libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site..

How to set bootstrap navbar active class with Angular JS?

If I have a navbar in bootstrap with the items Home | About | Contact How do I set the active class for each menu item when they are active? That is, how can I set class="active" when the angular r..

Java JSON serialization - best practice

I need to implement JSON serialization for some objects, and I've encountered a problem when it came to integration with generic collections. All serializable classes implement this interface (JSONO..

How to save user input into a variable in html and js

i am making a game and at the start it asks for your name. I want this name to be saved as varible. i have this html code: <form id="form" onsubmit="return false;"> <input style=position:a..

Access iframe elements in JavaScript

I have a webpage where there is a textarea within an iframe. I need to read the value of this textarea from its child page using JavaScript. Presently by using window.parent.getelementbyID().value in..

Return back to MainActivity from another activity

The MainActivity contains some buttons. Each button opens a new activity via an intent. These activities then have a button to return to the MainActivity via an intent. But when I press a button to r..

Should I use alias or alias_method?

I found a blog post on alias vs. alias_method. As shown in the example given in that blog post, I simply want to alias a method to another within the same class. Which should I use? I always see alias..

Meaning of delta or epsilon argument of assertEquals for double values

I have a question about JUnit assertEquals to test double values. Reading the API doc I can see: @Deprecated public static void assertEquals(double expected, double actual) Deprecated. Use assertEqu..

How to setup Main class in manifest file in jar produced by NetBeans project

I have the following problem. I have a Java project in my NetBeans IDE 6.8. When I compile it and it produces a .jar file containing everything possible, the META-INF is not right. It doesn't contain ..

Function pointer to member function

I'd like to set up a function pointer as a member of a class that is a pointer to another function in the same class. The reasons why I'm doing this are complicated. In this example, I would like the..

CSV parsing in Java - working example..?

I want to write a program for a school java project to parse some CSV I do not know. I do know the datatype of each column - although I do not know the delimiter. The problem I do not even marginally..

no such file to load -- rubygems (LoadError)

I recently installed rails in fedora 12. I'm new to linux as well. Everything works fine on Windows 7. But I'm facing lot of problems in linux. Help please! I've installed all the essentials to my kn..

Convert R vector to string vector of 1 element

Im working with the programming language R now. I have a vector: a <- c("aa", "bb", "cc") And I want to paste these to a system command, I'm trying it this way now: args <- paste(a, sep=" ")..

C# LINQ select from list

i have a list of event Ids returned from an xml document as shown below public IEnumerable<EventFeed> GetEventIdsByEventDate(DateTime eventDate) { return (from feed in xmlDoc.Desce..

Local file access with JavaScript

Is there local file manipulation that's been done with JavaScript? I'm looking for a solution that can be accomplished with no install footprint like requiring Adobe AIR. Specifically, I'd like to re..

Java check to see if a variable has been initialized

I need to use something similar to php's isset function. I know php and java are EXTREMELY different but php is my only basis of previous knowledge on something similar to programming. Is there some k..

Search for "does-not-contain" on a DataFrame in pandas

I've done some searching and can't figure out how to filter a dataframe by df["col"].str.contains(word), however I'm wondering if there is a way to do the reverse: filter a dataframe by that set's com..

File size exceeds configured limit (2560000), code insight features not available

I am trying to work on a large Javascript file in Jetbrains WebStorm 8 and I am getting a message at the top of the editing window that says: File size exceeds configured limit (2560000). Code ins..

How to convert a string to integer in C?

I am trying to find out if there is an alternative way of converting string to integer in C. I regularly pattern the following in my code. char s[] = "45"; int num = atoi(s); So, is there a bette..

Proper way to handle multiple forms on one page in Django

I have a template page expecting two forms. If I just use one form, things are fine as in this typical example: if request.method == 'POST': form = AuthorForm(request.POST,) if form.is_valid..

What does the shrink-to-fit viewport meta attribute do?

I'm having trouble finding documentation for this. Is it Safari specific? There was a recent bug in iOS 9 (here), the solution to which is adding shrink-to-fit=no to the viewport meta. What does th..

No internet on Android emulator - why and how to fix?

I am trying to use internet with the Android emulator, but with no success. Any ideas?..

Django: OperationalError No Such Table

I'm building a fairly simple application, research, in my Django project that uses Django-CMS. (It's my first ground-up attempt at a project/application.) It's main purpose is to store various intel..

Scaling a System.Drawing.Bitmap to a given size while maintaining aspect ratio

I want to scale a System.Drawing.Bitmap to at least less than some fixed width and height. This is to generate thumbnails for an image gallery on a website, so I want to keep the aspect ratio the same..

check android application is in foreground or not?

I went through a lot of answers for this question.But it's all about single activity..How to check whether the whole app is running in foreground or not ?..

Failed to load ApplicationContext for JUnit test of Spring controller

I want to write a test case to check my controller (getPersons). This is a server side code. I have confusion what should i put inside @ContextConfiguration(locations={"file:src/main/webapp/WEB-INF/ap..

How to read/write a boolean when implementing the Parcelable interface?

I'm trying to make an ArrayList Parcelable in order to pass to an activity a list of custom object. I start writing a myObjectList class which extends ArrayList<myObject> and implement Parcelabl..

How do I give ASP.NET permission to write to a folder in Windows 7?

I have a new Win7 workstation and I am trying to get ScrewTurn Wiki to run on the machine. My STW installation is using the file system option to store its data, and as such I need to give write perm..

How can I recover a lost commit in Git?

First, got "your branch is ahead of origin/master by 3 commits" then my app has reverted to an earlier time with earlier changes. How can I get what I spent the last 11 hours doing back?..

What does the 'static' keyword do in a class?

To be specific, I was trying this code: package hello; public class Hello { Clock clock = new Clock(); public static void main(String args[]) { clock.sayTime(); } } But it ga..

What is the shortcut to Auto import all in Android Studio?

Is there any way of auto importing (like in Eclipse Shift+Ctrl+O) in Android Studio? I have found only Ctrl+Alt+O which ask for each thing, and I have to press Alt+Enter to accept it. No way to do ..

How do I run a terminal inside of Vim?

I am used to Emacs, but I am trying out Vim to see which one I like better. One thing that I like about Emacs is the ability to run a terminal inside Emacs. Is this possible inside of Vim? I know th..

How to export data from Excel spreadsheet to Sql Server 2008 table

I want to import data from an Excel file - assume Excel 2003 / .xls - to Sql Server 2008. Have tried adding a linked server to the JET OLE DB Access driver, and of course it fails on the 64-bit machi..

Stretch image to fit full container width bootstrap

I have an image that's 1300px wide, using bootstrap I want this image to fill the full width of my container which is set to 1300px. I create a row, give it a full 12 columns and then add in the image..

Gnuplot line types

How do I draw different types of lines on gnuplot? I got to draw different colors. My script joins several files and I think it is why the lines are not dash. Only two of four are dashed. Thanks Felip..

Use virtualenv with Python with Visual Studio Code in Ubuntu

I have a Python project and navigation/autocomplete work perfectly within files in the project. I want to specify a virtualenv so that navigation/autocomplete work with packages inside that virtualenv..

Attribute Error: 'list' object has no attribute 'split'

I am trying read a file and split a cell in each line by a comma and then display only the first and the second cells which contain information regarding the latitude and the longitude. This is the fi..

Set focus on <input> element

I am working a front-end application with Angular 5, and I need to have a search box hidden, but on click of a button, the search box should be displayed and focused. I have tried a few ways found on..

No @XmlRootElement generated by JAXB

I'm trying to generate Java classes from the FpML (Finanial Products Markup Language) version 4.5. A ton of code is generated, but I cannot use it. Trying to serialize a simple document I get this: j..

Can I check if Bootstrap Modal Shown / Hidden?

Can I check if Bootstrap Modal currently Shown / Hidden Programatically? Like bool a = if("#myModal").shown(); ? I need true/false..

Check date between two other dates spring data jpa

I have this model: public class Event { private String name; private Date start; private Date end; } and repository as @Repository public interface EventRepository extends JpaRepositor..

redirect while passing arguments

In flask, I can do this: render_template("foo.html", messages={'main':'hello'}) And if foo.html contains {{ messages['main'] }}, the page will show hello. But what if there's a route that leads to ..

Set NOW() as Default Value for datetime datatype?

I have two columns in table users namely registerDate and lastVisitDate which consist of datetime data type. I would like to do the following. Set registerDate defaults value to MySQL NOW() Set last..

force client disconnect from server with and nodejs

Is there any way to disconnect a client with SocketIO, and literally close the connection? So if someone is connected to my server, and I want to close the connection between them and my server, how w..

How to reenable event.preventDefault?

I have a web page which I have prevented the default action on all submit buttons, however I would like to re-enable default submit action on a button how can I do this? I am currently preventing the..

Get selected item value from Bootstrap DropDown with specific ID

I am "creating" my own "ComboBox" using Bootstrap 3 and JavaScript. Here is the JSFiddle for what I have so far: HTML: <div class="input-group"> ..

How to add a button dynamically using jquery

My task is to add button dynamically to the div.. here is the code that i follow to add button dynamically but its not working please give me a solution for this <!DOCTYPE html> <html..

An Authentication object was not found in the SecurityContext - Spring 3.2.2

I'm trying to invoke a protected method from a class that implements the ApplicationListener<AuthenticationSuccessEvent> interface on successful login (Spring 3.2.2 and Spring Security 3.2.0 M1)..

Newline character in StringBuilder

How do you append a new line(\n\r) character in StringBuilder?..

Simple way to count character occurrences in a string

Is there a simple way (instead of traversing manually all the string, or loop for indexOf) in order to find how many times, a character appears in a string? Say we have "abdsd3$asda$asasdd$sadas" and..

Twitter bootstrap scrollable table

I would like to have a table on my website. The problem is that this table will have about 400 lines. How can I limit the table's height, and apply scrollbar to it? This is my code: <div class="sp..

Get real path from URI, Android KitKat new storage access framework

Before the new gallery access in Android 4.4 (KitKat) I got my real path on the SD card with this method: public String getPath(Uri uri) { String[] projection = { MediaStore.Images.Media.DATA }; ..

How do I run a batch file from my Java Application?

In my Java application, I want to run a batch file that calls "scons -Q implicit-deps-changed build\file_load_type export\file_load_type" It seems that I can't even get my batch file to execute. I'm ..

Split text file into smaller multiple text file using command line

I have multiple text file with about 100,000 lines and I want to split them into smaller text files of 5000 lines each. I used: split -l 5000 filename.txt That creates files: xaa xab aac xad xbe..

'NoneType' object is not subscriptable?

list1 = ["name1", "info1", 10] list2 = ["name2", "info2", 30] list3 = ["name3", "info3", 50] MASTERLIST = [list1, list2, list3] def printe..

Why aren't programs written in Assembly more often?

It seems to be a mainstream opinion that assembly programming takes longer and is more difficult to program in than a higher level language such as C. Therefore it seems to be recommend or assumed tha..

SQL Server equivalent to Oracle's CREATE OR REPLACE VIEW

In Oracle, I can re-create a view with a single statement, as shown here: CREATE OR REPLACE VIEW MY_VIEW AS SELECT SOME_FIELD FROM SOME_TABLE WHERE SOME_CONDITIONS As the syntax implies, this will ..

How can I disable HREF if onclick is executed?

I have an anchor with both HREF and ONCLICK attributes set. If clicked and Javascript is enabled, I want it to only execute ONCLICK and ignore HREF. Likewise, if Javascript is disabled or unsupported,..