Questions Tagged with #Pixelformat

Android: Unable to add window. Permission denied for this window type

I'm working on an app where I need to display a window with some info ON the Lock Screen (KeyGuard) without unlocking the phone. I figured I could probably do it with WindowManager.LayoutParams.TYPE_K..

Unable to add window -- token null is not valid; is your activity running?

i want to show a custom popup menu when user click on a floating icon the float icon create with an service and i have no activity this is my floating icon code public class copy_actions_service ex..

Creating a system overlay window (always on top)

I'm trying to create an always-op-top button/clickable-image which stays on top of all the windows all the time. The proof of concept is here - Smart Taskbar (on AppBrain) and here V1.4.0 Sidebar..

how to play video from url

I am beginner in android development and try to play video from link. But it's giving error "sorry,we can't play this video". I tried so many links but for all links its show same error. My code is t..

Convert an image to grayscale

Is there a way to convert an image to grayscale 16 bits per pixel format, rather than setting each of the r,g and b components to luminance. I currently have a bmp from file. Bitmap c = new Bitmap("..

WPF Image Dynamically changing Image source during runtime

I have a window with a title on it. When the user selects a choice from a drop down list, the title image can change. The problem is when the image loads, it's a blurred, stretched, and pixelated. The..

Setting WPF image source in code

I'm trying to set a WPF image's source in code. The image is embedded as a resource in the project. By looking at examples I've come up with the below code. For some reason it doesn't work - the image..

Get underlined text with Markdown

I am using BlueCloth as a Markdown library for Ruby, and I can't find any syntax for getting a text underlined. What is it?..

sql delete statement where date is greater than 30 days

I need a SQL statement to delete row that are older than 30 days. My table events has a field date that contains the date and the time it was inserted in the database. Will this work? SELECT * from Re..

What does ||= (or-equals) mean in Ruby?

What does the following code mean in Ruby? ||= Does it have any meaning or reason for the syntax?..

Free easy way to draw graphs and charts in C++?

I am doing a little exploring simulation and I want to show the graphs to compare the performance among the algorithms during run-time. What library comes to your mind? I highly prefer those that com..

Error 1920 service failed to start. Verify that you have sufficient privileges to start system services

We have created a custom windows service. The deployment package is done in InstallShield and the installation prompts for the user name and password for the service Log On account. We have had no is..

How to set image to UIImage

How can I set image to UIImage object. For example: UIImage *img = [[UIImage alloc] init]; [img setImage:[UIImage imageNamed:@"anyImageName"]]; My UIImage object is declared in .h file and allocate..

Download file of any type in Asp.Net MVC using FileResult?

I've had it suggested to me that I should use FileResult to allow users to download files from my Asp.Net MVC application. But the only examples of this I can find always has to do with image files (s..

Oracle: is there a tool to trace queries, like Profiler for sql server?

i work with sql server, but i must migrate to an application with Oracle DB. for trace my application queries, in Sql Server i use wonderful Profiler tool. is there something of equivalent for Oracle?..

GitHub: Permission denied (publickey). fatal: The remote end hung up unexpectedly

I have followed these instructions below to upload a project. Global setup: Download and install Git git config --global "Your Name" git config --global [email protected] ..

How to disable right-click context-menu in JavaScript

Not that I'm trying to prevent 'View Source' or anything silly like that, but I'm making some custom context menus for certain elements. EDIT: response to answers: I've tried this: <a id="moo" hr..

How to solve this java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream?

I am using the below code to upload a file in to tomcat5.5 and it gives me the following exception java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream could you pl..

jQuery add class .active on menu

I've got a problem. I want to add the class "active" on item menu when the relative page is on. the menu is very simple: <div class="menu"> <ul> <li><a href="~/link1/">LINK..

C++, how to declare a struct in a header file

I've been trying to include a structure called "student" in a student.h file, but I'm not quite sure how to do it. My student.h file code consists of entirely: #include<string> using namespace..

Convert an array into an ArrayList

I'm having a lot of trouble turning an array into an ArrayList in Java. This is my array right now: Card[] hand = new Card[2]; "hand" holds an array of "Cards". How this would look like as an Array..

Counting the number of option tags in a select tag in jQuery

How do I count the number of <option>s in a <select> DOM element using jQuery? <select data-attr="dropdown" id="input1"> <option value="Male" id="Male">Male</option>..

Python multiprocessing PicklingError: Can't pickle <type 'function'>

I am sorry that I can't reproduce the error with a simpler example, and my code is too complicated to post. If I run the program in IPython shell instead of the regular Python, things work out well. ..

Get a list of all functions and procedures in an Oracle database

I'm comparing three Oracle schemas. I want to get a list of all the functions and procedures used in each database. Is this possible via a query? (preferably including a flag as to whether they compi..

How to get images in Bootstrap's card to be the same height/width?

So here is my code, it displays 6 cards, three across and two rows. I would like for the images to all be the same size without having to manually resize the images. The responsiveness does work, I us..

How to remove leading zeros from alphanumeric text?

I've seen questions on how to prefix zeros here in SO. But not the other way! Can you guys suggest me how to remove the leading zeros in alphanumeric text? Are there any built-in APIs or do I need to..

Exception in thread "main" java.util.NoSuchElementException

Whenever I run this, the chooseCave() function works fine with the in.nextInt(). When I choose the cave, the messages pop up at 2-second intervals, and then as soon as it gets past that part, it gives..

Can JavaScript connect with MySQL?

Can JavaScript connect with MySQL? If so, how?..

nodejs mongodb object id to string

IN nodejs, with mongodb, mongoosejs as orm I am doing this I have a model, User User.findOne({username:'someusername'}).exec(function(err,user){ console.log(user) //this gives full object with some..

Finding all the subsets of a set

I need an algorithm to find all of the subsets of a set where the number of elements in a set is n. S={1,2,3,4...n} Edit: I am having trouble understanding the answers provided so far. I would like..

Why would you use String.Equals over ==?

I recently was introduced to a large codebase and noticed all string comparisons are done using String.Equals() instead of == What's the reason for this, do you think?..

Gerrit error when Change-Id in commit messages are missing

I set up a branch in the remote repository and made some commits on that branch. Now I want to merge the remote branch to the remote master. Basically follows are my operations: checkout branch che..

How to deal with bad_alloc in C++?

There is a method called foo that sometimes returns the following error: terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Abort Is there a way that I can us..

How can I make Flexbox children 100% height of their parent?

I'm trying to fill the vertical space of a flex item inside a Flexbox. _x000D_ _x000D_ .container {_x000D_ height: 200px;_x000D_ width: 500px;_x000D_ display: flex;_x000D_ flex-direction: row..

How do I write a "tab" in Python?

Let's say I have a file. How do I write "hello" TAB "alex"?..

GROUP BY without aggregate function

I am trying to understand GROUP BY (new to oracle dbms) without aggregate function. How does it operate? Here is what i have tried. EMP table on which i will run my SQL. SELECT ename , sal FROM emp G..

Mapping a JDBC ResultSet to an object

I have a user class that has 16 attributes, things such as firstname, lastname, dob, username, password etc... These are all stored in a MySQL database and when I want to retrieve users I use a Result..

Oracle - How to create a readonly user

It's possible create a readonly database user at an Oracle Database? How?..

display HTML page after loading complete

Is there a way to force the browser to display a page only after all of the page's contents are completely loaded (such as images, scripts, css, etc)?..

How to Detect if I'm Compiling Code with a particular Visual Studio version?

Is there any way to know if I'm compiling under a specific Microsoft Visual Studio version?..

Broken references in Virtualenvs

I recently installed a bunch of dotfiles on my Mac along with some other applications (I changed to iTerm instead of Terminal, and Sublime as my default text editor) but ever since, all my virtual env..

This compilation unit is not on the build path of a Java project

When I try to use ctrl+space this error is shown: This compilation unit is not on the build path of a Java project. I see that there are similar topics but my work environment is Eclipse and i pul..

Parameterize an SQL IN clause

How do I parameterize a query containing an IN clause with a variable number of arguments, like this one? SELECT * FROM Tags WHERE Name IN ('ruby','rails','scruffy','rubyonrails') ORDER BY Count DES..

json parsing error syntax error unexpected end of input

I got the following piece of code function pushJsonData(productName) { $.ajax({ url: "/knockout/SaveProduct", type: "POST", contentType: "application/json", dataTy..

How to construct a relative path in Java from two absolute paths (or URLs)?

Given two absolute paths, e.g. /var/data/stuff/xyz.dat /var/data How can one create a relative path that uses the second path as its base? In the example above, the result should be: ./stuff/xyz.da..

How to get the response of XMLHttpRequest?

I'd like to know how to use XMLHttpRequest to load the content of a remote URL and have the HTML of the accessed site stored in a JS variable. Say, if I wanted to load and alert() the HTML of http://..

Babel 6 regeneratorRuntime is not defined

I'm trying to use async, await from scratch on Babel 6, but I'm getting regeneratorRuntime is not defined. .babelrc file { "presets": [ "es2015", "stage-0" ] } package.json file "devDependenc..

Javascript: Extend a Function

The main reason why I want it is that I want to extend my initialize function. Something like this: // main.js window.onload = init(); function init(){ doSomething(); } // extend.js function..

Where can I download Spring Framework jars without using Maven? changed their site to Does someone know how to get the latest build without Maven/github? from

insert data into database using servlet and jsp in eclipse

I am trying to add or insert values into table of database using servlet and jsp and MySQL Workbench as database. These are the following details: 1.> package; import jav..

This API project is not authorized to use this API. Please ensure that this API is activated in the APIs Console

I have a latitude, and longitude : "-27.0000,133.0000". I want produce a map base on that. I've tried go to this link,133.0000&..

What's the best way to check if a file exists in C?

Is there a better way than simply trying to open the file? int exists(const char *fname) { FILE *file; if ((file = fopen(fname, "r"))) { fclose(file); return 1; } ..

What does <T> denote in C#

I'm new to C# and directly diving into modifying some code for a project I received. However, I keep seeing code like this : class SampleCollection<T> and I cannot make sense of what the &..

Turn off textarea resizing

I'm trying to turn off textarea resizing in my site; right now I'm using this method: .textarea { clear:left; min-width: 267px; max-width: 267px; min-height:150px; max-height:150p..

Understanding offsetWidth, clientWidth, scrollWidth and -Height, respectively

There are several questions on StackOverflow regarding offsetWidth / clientWidth / scrollWidth (and -Height, respectively), but none give comprehensive explanation of what those values are. Also, ther..

How to format a number as percentage in R?

One of the things that used to perplex me as a newby to R was how to format a number as a percentage for printing. For example, display 0.12345 as 12.345%. I have a number of workarounds for this, b..

Why is the GETDATE() an invalid identifier

Why is the GETDATE() an invalid identifier says Oracle Sql Developer tool when I debug this code: CREATE OR REPLACE TRIGGER SPName AFTER UPDATE ON TableName FOR EACH ROW BEGIN UPDATE TableName S..

Can I find events bound on an element with jQuery?

I bind two event handlers on this link: <a href='#' id='elm'>Show Alert</a> JavaScript: $(function() { $('#elm').click(_f); $('#elm').mouseover(_m); }); function _f(){alert('click..

warning: assignment makes integer from pointer without a cast

When I declare a char * to a fixed string and reuse the pointer to point to another string /* initial declaration */ char *src = "abcdefghijklmnop"; ..... /* I get the "warning: assignment makes i..

How to undo "git commit --amend" done instead of "git commit"

I accidentally amended my previous commit. The commit should have been separate to keep history of the changes I made to a particular file. Is there a way to undo that last commit? If I do something ..

undefined reference to `WinMain@16'

When I try to build a program using Eclipse CDT, I get the following: /mingw/lib/libmingw32.a(main.o):main.c:(.text+0x106): undefined reference to `WinMain@16 Why is that? And, how can I solve..

How to clear the text of all textBoxes in the form?

private void CleanForm() { foreach (var c in this.Controls) { if (c is TextBox) { ((TextBox)c).Text = String.Empty; } } } This method above doesn't wo..

List of <p:ajax> events

I've searched the Internet and I cannot find a list of <p:ajax> events. Can anyone provide a complete list of events for the <p:ajax> tag? I'm particularly interested if there is an onblu..

Creating multiple log files of different content with log4j

Is there a way to configure log4j so that it outputs different levels of logging to different appenders? I'm trying to set up multiple log files. The main log file would catch all INFO and above mess..

React JS - Uncaught TypeError: is not a function

I'm working with reactjs and cannot seem to prevent this error when trying to display JSON data (either from file or server): Uncaught TypeError: is not a function I've looked a..

How to make popup look at the centre of the screen?

When i click a link, a pop up comes out. The thing is that it is not aligned to the centre of the screen. By the way my code also helps the website (and the pop up) to look perfectly in a mobile versi..

Python DNS module import error

I have been using python dns module.I was trying to use it on a new Linux installation but the module is not getting loaded. I have tried to clean up and install but the installation does not seem to ..

Create a string with n characters

Is there a way in java to create a string with a specified number of a specified character? In my case, I would need to create a string with 10 spaces. My current code is: StringBuffer outputBuffer..

CAML query with nested ANDs and ORs for multiple fields

I am working on proof-of-concept code to dynamically generate CAML based on keywords provided to a highly-specific search web service that I am writing. I am not using the SharePoint-provided search w..

Detect if PHP session exists

Facebook now offer subscriptions to users so you can get realtime updates on changes. If my app receives an update, I plan to store it in the database. I would also like to detect if their session exi..

Matplotlib discrete colorbar

I am trying to make a discrete colorbar for a scatterplot in matplotlib I have my x, y data and for each point an integer tag value which I want to be represented with a unique colour, e.g. plt.scat..

How to fill Matrix with zeros in OpenCV?

The code below causes an exception. Why? #include <opencv2/core/core.hpp> #include <iostream> using namespace cv; using namespace std; void main() { try { Mat m1 = Mat(1,1,..

How to vertical align an inline-block in a line of text?

I want to create an inline-block that will take on some unknown width and height. (It'll have a table inside it with content dynamically generated). Further, the inline-block should be placed inside ..

Scroll part of content in fixed position container

I have a position: fixed div in a layout, as a sidebar. I've been asked to have part of it's content stay fixed to the top of it (internally), and the rest to scroll if it overflows the bottom of the ..

UIScrollView scroll to bottom programmatically

How can I make a UIScrollView scroll to the bottom within my code? Or in a more generic way, to any point of a subview?..

The response content cannot be parsed because the Internet Explorer engine is not available, or

I need to download a channel 9 series using powershell, however the scripts I have tried have errors: This script $url="" $rss=invoke-webreq..

How to check if the string is empty?

Does Python have something like an empty string variable where you can do: if myString == string.empty: Regardless, what's the most elegant way to check for empty string values? I find hard coding ..

System.BadImageFormatException An attempt was made to load a program with an incorrect format

I'm writing a plug-in for another program that is based on a public .NET API. Typically these plugins are made by creating a class library DLL that references the API assembly. Then a command class is..

Getting the difference between two repositories

How can we get the difference between two git repositories? The scenario: We have a repo_a and repo_b. The latter was created as a copy of repo_a. There have been parallel development in both the rep..

Change the maximum upload file size

I have a website hosted on a PC I have no access to. I have an upload form allowing people to upload mp3 files up to 30MB big. My server side script is done in PHP. Every time I try and upload a file..

Define variable to use with IN operator (T-SQL)

I have a Transact-SQL query that uses the IN operator. Something like this: select * from myTable where myColumn in (1,2,3,4) Is there a way to define a variable to hold the entire list "(1,2,3,4)"..

How to read json file into java with simple JSON library

I want to read this JSON file with java using json simple library. My JSON file looks like this: [ { "name":"John", "city":"Berlin", "cars":[ "audi", ..

Function passed as template argument

I'm looking for the rules involving passing C++ templates functions as arguments. This is supported by C++ as shown by an example here: #include <iostream> void add1(int &v) { v+=1; } ..

jQuery removeClass wildcard

Is there any easy way to remove all classes matching, for example, color-* so if I have an element: <div id="hello" class="color-red color-brown foo bar"></div> after removing, it w..

Setting PATH environment variable in OSX permanently

I have read several answers on how to set environmental variables on OSX as permanently. First, I tried this, How to permanently set $PATH on Linux/Unix? but I had an error message saying no such fi..

Filtering a list of strings based on contents

Given the list ['a','ab','abc','bac'], I want to compute a list with strings that have 'ab' in them. I.e. the result is ['ab','abc']. How can this be done in Python?..

Create file path from variables

I am looking for some advice as to the best way to generate a file path using variables, currently my code looks similar to the following: path = /my/root/directory for x in list_of_vars: if ..


I have two tables like here: DROP TABLE IF EXISTS; DROP TABLE IF EXISTS schemas.category; DROP SCHEMA IF EXISTS schemas; CREATE SCHEMA schemas; CREATE TABLE schemas.category ( ..

Git push error: "origin does not appear to be a git repository"

I am following the instructions given here to create a Git repository. All went well until the last line: $ git push -u origin master fatal: 'origin' does not appear to be a git repository ..

How to use class from other files in C# with visual studio?

I am a newbie of C# and MS visual studio, and I want to use the C# class which defined in another file, but can't get it work. Here is the program.cs(and why can't I rename that file ?) using System..

How to properly -filter multiple strings in a PowerShell copy script

I am using the PowerShell script from this answer to do a file copy. The problem arises when I want to include multiple file types using the filter. Get-ChildItem $originalPath -filter "*.htm" | ` ..

Windows command for file size only

Is there a Windows command that will output the size in bytes of a specified file like this? > filesize test.jpg 65212 I know that the dir command outputs this information, but it outputs other ..

jQuery exclude elements with certain class in selector

I want to setup a click event trigger in jQuery for certain anchor tags. I want to open certain links in a new tab while ignoring ones with a certain class (before you ask I cannot put classes on the..

Best way to split string into lines

How do you split multi-line string into lines? I know this way var result = input.Split("\n\r".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); looks a bit ugly and loses empty lines. Is the..

How do I use regex in a SQLite query?

I'd like to use a regular expression in sqlite, but I don't know how. My table has got a column with strings like this: "3,12,13,14,19,28,32" Now if I type "where x LIKE '3'" I also get the rows whic..

How to put php inside JavaScript?

I've tried (but its not working): <?php $htmlString= 'testing'; ?> <html> <body> <script type="text/javascript"> var htmlString=<?php echo $htmlString; ?&..

Which port(s) does XMPP use?

I´ve searched and didnt find which ports does XMPP uses. I need to implement XMPP server and client and use XML transfer, file transfer and streaming. Do they use different ports?? Is there a way I c..

What should I use to open a url instead of urlopen in urllib3

I wanted to write a piece of code like the following: from bs4 import BeautifulSoup import urllib2 url = '' html = urllib2.urlopen(url) soup = BeautifulSoup..

What is the best IDE to develop Android apps in?

I am about to start developing an android app and need to get an IDE. Eclipse and the android eclipse plugin appears to be the natural choice. However I am familiar with intelliJ and re-sharper so I w..

Getting a HeadlessException: No X11 DISPLAY variable was set

Exception in thread "main" java.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it. at java.awt.GraphicsEnvironment.checkHead..

How to rename uploaded file before saving it into a directory?

Below is the code I used in order to upload files into a directory. It works fine. My main question is: move_uploaded_file() is the one that saves the uploaded file into the directory, and it is also..

How to convert TimeStamp to Date in Java?

How do I convert 'timeStamp' to date after I get the count in java? My current code is as follows: public class GetCurrentDateTime { public int data() { int count = 0; java.sql...

How to line-break from css, without using <br />?

output: hello How are you code: <p>hello <br> How are you </p> How to achieve same output without <br>?..

Regex to match only uppercase "words" with some exceptions

I have technical strings as the following: "The thing P1 must connect to the J236 thing in the Foo position." I would like to match with a regular expression those only-in-uppercase words (namely h..

slideToggle JQuery right to left

i'm new in JQ i have this script i found on the internet and its do exactly what i need but i want the sliding will be from the right to the left how can i do it? please help this is the code <sc..

Rails.env vs RAILS_ENV

I see both in examples when checking what env one is running in. What's preferred? Are they, for all intents and purposes equal?..

Are there such things as variables within an Excel formula?

I hate repeating functions, particularly in Excel formulas. Is there any way that I can avoid something like: =IF( VLOOKUP(A1, B:B, 1, 0) > 10, VLOOKUP(A1, B:B, 1, 0) - 10, VLOOKUP(A1, B:B, 1, 0)..

Undefined reference to `sin`

I have the following code (stripped down to the bare basics for this question): #include<stdio.h> #include<math.h> double f1(double x) { double res = sin(x); return 0; } /* The ..

Convert all data frame character columns to factors

Given a (pre-existing) data frame that has columns of various types, what is the simplest way to convert all its character columns to factors, without affecting any columns of other types? Here's an ..

Visual Studio: How to show Overloads in IntelliSense?

Once code has been written, the only way I know of to view the overloads for a method is to actually edit the method by deleting the Parenthesis () and reopening them. Is there a shortcut key that I ..

How ViewBag in ASP.NET MVC works

How does the ASP.NET MVC's ViewBag work? MSDN says it is just an Object, which intrigues me, how does "Magic" properties such as ViewBag.Foo and magic strings ViewBag["Hello"] actually work? Also, ho..

How can I remove an element from a list, with lodash?

I have an object that looks like this: var obj = { "objectiveDetailId": 285, "objectiveId": 29, "number": 1, "text": "x", "subTopics": [{ "subTopicId": 1, "number"..

How to increase space between dotted border dots

I am using dotted style border in my box like .box { width: 300px; height: 200px; border: dotted 1px #f00; float: left; } I want to the increase the space between each dot of the bo..

Python sum() function with list parameter

I am required to use the sum() function in order to sum the values in a list. Please note that this is DISTINCT from using a for loop to add the numbers manually. I thought it would be something simpl..

Converting string "true" / "false" to boolean value

I have a JavaScript string containing "true" or "false". How may I convert it to boolean without using the eval function?..

Laravel 5.4 ‘cross-env’ Is Not Recognized as an Internal or External Command

I'm trying to run npm run dev for Laravel Mix and I get this error: > @ dev D:\projects\ptcs > cross-env NODE_ENV=development webpack --progress --hide-modules -- config=node_modules/laravel-mi..

Threads vs Processes in Linux

I've recently heard a few people say that in Linux, it is almost always better to use processes instead of threads, since Linux is very efficient in handling processes, and because there are so many p..

How can I represent a range in Java?

Let's say an integer should be within the range: [0...2147483647] I want to check whether an integer variable falls within this range. I know it can be accomplished by a simple if-else statement, but..

Bash: Echoing a echo command with a variable in bash

Ok, here is one I am struggling with as we speak. Echoing a echo command with a variable. echo "creating new script file." echo "#!/bin/bash" > $servsfile echo "read -p "Please enter a service: " ..

CSS content property: is it possible to insert HTML instead of Text?

Just wondering if it's possible somehow to make the CSS content property insert html code instead string on :before or :after an element like: .header:before{ content: '<a href="#top">Back<..

How to do relative imports in Python?

Imagine this directory structure: app/ sub1/ sub2/ I'm coding mod1, and I need to import something from mod2. Ho..

How can I test what my file will look like before committing to github?

I am writing a readme for my github project in the .md format. Is there a way can I test what my file will look like before committing to github? ..

How to create web service (server & Client) in Visual Studio 2012?

How to create web service (server & Client) in Visual Studio 2012? like being done before 2012 as

403 - Forbidden: Access is denied. You do not have permission to view this directory or page using the credentials that you supplied

I have my website. First time I can succesfully login. Default address: I typed this on browser and I redirected to my login page: I entered my logi..

SOAP PHP fault parsing WSDL: failed to load external entity?

I'm trying to run a web service using PHP & SOAP, but all I'm getting so far is this: (SoapFault)[2] message which states: 'SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost/MyReg..

Find specific string in a text file with VBS script

I need to find the string "Test Case " & index in a txt file. I give you an example of the lines you can find in this file: <tr><td><a href="../../Login/Log_ in_U1A1">Log_ in_..

Jquery and HTML FormData returns "Uncaught TypeError: Illegal invocation"

I'm using this script to upload my image files: $('.uploader input:file').on('change', function() { $this = $(this); $('.alert').remove(); $.each($this[0].files, fu..

Equal height rows in a flex container

As you can see, the list-items in the first row have same height. But items in the second row have different heights. I want all items to have a uniform height. Is there any way to achieve this witho..

Printing leading 0's in C

I'm trying to find a good way to print leading 0, such as 01001 for a ZIP Code. While the number would be stored as 1001, what is a good way to do it? I thought of using either case statements or if t..

Keyboard shortcut to change font size in Eclipse?

It is relatively straightforward to change font sizes in Eclipse through preferences (and answered several times in this forum). However I'd like to change font size quickly (e.g., with Ctrl++ and C..

How to check what version of jQuery is loaded?

How do I check which version of jQuery is loaded on the client machine? The client may have jQuery loaded but I don't know how to check it. If they have it loaded how do I check the version and the pr..

Reference an Element in a List of Tuples

Sorry in advance, but I'm new to Python. I have a list of tuples, and I was wondering how I can reference, say, the first element of each tuple within the list. I would think it's something like f..

Xcode 6: Keyboard does not show up in simulator

The keyboard does not show up when I run the simulator and click in the UITextView. How do I re-enable the keyboard? It used to work but now it doesn't - I don't know what I might have clicked by acc..

How to write some data to excel file(.xlsx)

This is what i am trying to do. 1.Create excel file(.xlsx) c://test/files/work1_4.13.14.xlsx with name + value(date) example: work1_4.13.14.xlsx 2.Set headers to the file example: [Name] [Age] [Ci..

Assignment makes pointer from integer without cast

Coming from a Java background I'm learning C, but I find those vague compiler error messages increasingly frustrating. Here's my code: /* * PURPOSE * Do case-insensetive string comparison. */..

Cross Browser Flash Detection in Javascript

Does anyone have an example of script that can work reliably well across IE/Firefox to detect if the browser is capable of displaying embedded flash content. I say reliably because I know its not poss..

How do you specify the Java compiler version in a pom.xml file?

I wrote some Maven code in Netbeans that has approximately more than 2000 lines. When I compile it on Netbeans, everything is fine, but if I want to run it on command line, I will get these errors: ge..

Python loop to run for certain amount of seconds

I have a while loop, and I want it to keep running through for 15 minutes. it is currently: while True: #blah blah blah (this runs through, and then restarts. I need it to continue doing this e..

Add a dependency in Maven

How do I take a jar file that I have and add it to the dependency system in maven 2? I will be the maintainer of this dependency and my code needs this jar in the class path so that it will compile...

Single Page Application: advantages and disadvantages

I've read about SPA and it advantages. I find most of them unconvincing. There are 3 advantages that arouse my doubts. Question: Can you act as advocate of SPA and prove that I am wrong about first t..

javac not working in windows command prompt

I'm trying to use javac with the windows command prompt, but it's not working. After adding the directory "C:\Program Files\Java\jdk1.6.0_16\bin\" to the end of the PATH environment variable, the jav..

c# open a new form then close the current form?

For example, Assume that I'm in form 1 then I want: Open form 2( from a button in form 1) Close form 1 Focus on form 2 ..

POST unchecked HTML checkboxes

I've got a load of checkboxes that are checked by default. My users will probably uncheck a few (if any) of the checkboxes and leave the rest checked. Is there any way to make the form POST the che..

Variable name as a string in Javascript

Is there a way to get a variable name as a string in Javascript? (like NSStringFromSelector in Cocoa) I would like to do like this: var myFirstName = 'John'; alert(variablesName(myFirstName) + ":" +..

Length of string in bash

How do you get the length of a string stored in a variable and assign that to another variable? myvar="some string" echo ${#myvar} # 11 How do you set another variable to the output 11?..

Parsing command-line arguments in C

I'm trying to write a program that can compare two files line by line, word by word, or character by character in C. It has to be able to read in command line options -l, -w, -i or --... if the optio..

How do I change data-type of pandas data frame to string with a defined format?

I'm starting to tear my hair out with this - so I hope someone can help. I have a pandas DataFrame that was created from an Excel spreadsheet using openpyxl. The resulting DataFrame looks like: print..

How to fix Invalid AES key length?

I am working on a text encryption and decryption project (following Struts 2) Whenever I enter the password and the plain text I get a Invalid AES Key Length error. The Service Class package

jQuery UI Dialog individual CSS styling

I'm looking to style a modal dialog (using UI Dialog) with unique CSS that is separate from the traditional dialog, so in essence to have two jQuery dialogs that each look different. I've styled one,..

XPath to fetch SQL XML value

Here is my problem: from the following XML that is within a column, I want to know if the value of a variable with the name 'Enabled' is equal to 'Yes' given a step Id and a component Id. '<xml>..

How do I make an HTML button not reload the page

I have a button (<input type="submit">). When it is clicked the page reloads. Since I have some jQuery hide() functions that are called on page load, this causes these elements to be hidden agai..

CS0234: Mvc does not exist in the System.Web namespace

I converted a 4 webform project to MVC4 according to Chapter 13 of the Professional ASP.NET 3.5 MVC, by Scott Hanselmen, Phil Haack, and Rob Conery, Published by Wiley Publishing, Inc...

Count the items from a IEnumerable<T> without iterating?

private IEnumerable<string> Tables { get { yield return "Foo"; yield return "Bar"; } } Let's say I want iterate on those and write something like processing #n of #..

Change bar plot colour in geom_bar with ggplot2 in r

I have the following in order to bar plot the data frame. c1 <- c(10, 20, 40) c2 <- c(3, 5, 7) c3 <- c(1, 1, 1) df <- data.frame(c1, c2, c3) ggplot(data=df, aes(x=c1+c2/2, y=c3)) + geom..

removing new line character from incoming stream using sed

I am new to shell scripting and i am trying to remove new line character from each line using SED. this is what i have done so far : printf "{new\nto\nlinux}" | sed ':a;N;s/\n/ /g' removes only Ist..

Angularjs error Unknown provider

I'm trying to display the configured values author and version in angular value service in html page.Version code is displayed fine but not the author name Here is the html code <!doctype html..

PL/SQL print out ref cursor returned by a stored procedure

How can I fetch from a ref cursor that is returned from a stored procedure (OUT variable) and print the resulting rows to STDOUT in SQL*PLUS? ORACLE stored procedure: PROCEDURE GetGrantListByPI(p_fi..

CSS: background-color only inside the margin

I have searched for an answer but couldn't find it anywhere. My question is reasonably simple: I have a background color of my body, then a large margin, and now I want a different background color in..

How to SELECT in Oracle using a DBLINK located in a different schema?

We have an Oracle DBMS (11g) and the following configuration: A DB user "MYUSER" Two schemas "MYUSER" and "SCHEMA_B" User "MYUSER" can access "SCHEMA_B" and has READ permissions on its tables A publ..

Why are the Level.FINE logging messages not showing?

The JavaDocs for java.util.logging.Level state: The levels in descending order are: SEVERE (highest value) WARNING INFO CONFIG FINE FINER FINEST (lowest value) Source import java.util.loggi..

A Java collection of value pairs? (tuples?)

I like how Java has a Map where you can define the types of each entry in the map, for example <String, Integer>. What I'm looking for is a type of collection where each element in the collect..

Why specify @charset "UTF-8"; in your CSS file?

I've been seeing this instruction as the very first line of numerous CSS files that have been turned over to me: @charset "UTF-8"; What does it do, and is this at-rule necessary? Also, if I incl..

Cannot connect to MySQL 4.1+ using old authentication

I'm trying to connect to a mySQL database at, but when I try to connect, it gives this error: Connect Error (2000) mysqlnd cannot connect to MySQL 4.1+ using old authentication I..

Programmatically add new column to DataGridView

I have a DataGridView bound to a DataTable. The DataTable is populated from a database query. The table contains a column named BestBefore. BestBefore is a date formatted as a string (SQLite doesn't h..

cor shows only NA or 1 for correlations - Why?

I'm running cor() on a data.framewith all numeric values and I'm getting this as the result: price exprice... price 1 NA exprice NA 1 ... So it's either 1 or NA for each va..

How do I disable form fields using CSS?

Is it possible to disable form fields using CSS? I of course know about the attribute disabled, but is it possible to specify this in a CSS rule? Something like - <input type="text" name="username..

How can I draw vertical text with CSS cross-browser?

I want to rotate a single word of text by 90 degrees, with cross-browser (>= IE6, >= Firefox 2, any version of Chrome, Safari, or Opera) support. How can this be done?..

Round double value to 2 decimal places

I have a double value as 22.368511 I want to round it to 2 decimal places. i.e. it should return 22.37 How can I do that?..

Invoke-customs are only supported starting with android 0 --min-api 26

before i'm use build version gradle 26 but after change buildtoolsversion to 27 like as this image error : error build gradle screenshot ..

Django - Did you forget to register or load this tag?

I've created a custom tag that I want to use, but Django can't seem to find it. My templatetags directory is set up like this: from pygments import highlight from pygments.lexers im..

Lightweight workflow engine for Java

Is it better to write a new workflow engine or to use an existing BPM engine: jBPM 5, Activiti 5? My application is a web based application and performance is important. My doubt is whether using jBP..

Query grants for a table in postgres

How can I query all GRANTS granted to an object in postgres? For example I have table "mytable": GRANT SELECT, INSERT ON mytable TO user1 GRANT UPDATE ON mytable TO user2 I need somthing which gi..

How to check if pytorch is using the GPU?

I would like to know if pytorch is using my GPU. It's possible to detect with nvidia-smi if there is any activity from the GPU during the process, but I want something written in a python script. Is ..

Different ways of loading a file as an InputStream

What's the difference between: InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName) and InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStre..

Embed HTML5 YouTube video without iframe?

Is it possible to embed an html5 version of a youtube video without using an iframe?..

How to set Toolbar text and back arrow color

Toolbar background is dark color, I want text and back arrow to be white. I tried following, but it doesnt work. <style name="Theme.MyTheme" parent="Theme.AppCompat.Light.NoActionBar"> ..

Using Apache httpclient for https

I have enabled https in tomcat and have a self-signed certificate for server auth. I have created an http client using Apache httpClient. I have set a trust manager loading the server certificate. The..

Printing list elements on separated lines in Python

I am trying to print out Python path folders using this: import sys print sys.path The output is like this: >>> print sys.path ['.', '/usr/bin', '/home/student/Desktop', '/home/student/my..

How do I join two SQLite tables in my Android application?

Background I have an Android project that has a database with two tables: tbl_question and tbl_alternative. To populate the views with questions and alternatives I am using cursors. There are no probl..

Laravel 5: Display HTML with Blade

I have a string returned to one of my views, like this: $text = '<p><strong>Lorem</strong> ipsum dolor <img src="images/test.jpg"></p>' I'm trying to display it with B..

Refused to load the script because it violates the following Content Security Policy directive

When I tried to deploy my app onto devices with Android system above 5.0.0 (Lollipop), I kept getting these kind of error messages: 07-03 18:39:21.621: D/SystemWebChromeClient(9132): file:///android_..

Change x axes scale in matplotlib

I created this plot using Matlab Using matplotlib, the x-axies draws large numbers such as 100000, 200000, 300000. I would like to have something like 1, 2, 3 and a 10^5 to indicate that it's actu..

Convert text into number in MySQL query

Is it possible to convert text into a number within MySQL query? I have a column with an identifier that consists a name and a number in the format of "name-number". The column has VARCHAR t..

Open page in new window without popup blocking

Hope you can help a bit here... I have a form that translate a word in a field, populate the field with the translated term and then do submit action all in one submit button. the submit is being mad..

Is arr.__len__() the preferred way to get the length of an array in Python?

In Python, is the following the only way to get the number of elements? arr.__len__() If so, why the strange syntax?..

Format number to 2 decimal places

I would like to know how can I output a number with 2 decimal places, without rounding the original number. For example: 2229,999 -> 2229,99 I already tried: FORMAT(2229.999, 2) CONVERT(2229.9..

Annotation-specified bean name conflicts with existing, non-compatible bean def

I'm having a problem with some Spring bean definitions. I have a couple of context xml files that are being loaded by my main() method, and both of them contain almost exclusively a tag. When my main..

How do I select a range of values in a switch statement?

When I try to compile I get this error: 1>------ Build started: Project: snake, Configuration: Debug Win32 ------ 1> exercise.cpp 1>c:\users\robin\documents\visual studio 2010\projects\snake\snake\..

How do I clone into a non-empty directory?

I have directory A with files matching directory B. Directory A may have other needed files. Directory B is a git repo. I want to clone directory B to directory A but git-clone won't allow me to sinc..

How to add new line into txt file

I'd like to add new line with text to my date.txt file, but instead of adding it into existing date.txt, app is creating new date.txt file.. TextWriter tw = new StreamWriter("date.txt"); // write a ..

How should I tackle --secure-file-priv in MySQL?

I am learning MySQL and tried using a LOAD DATA clause. When I used it as below: LOAD DATA INFILE "text.txt" INTO table mytable; I got the following error: The MySQL server is running with the ..

How to import a csv file using python with headers intact, where first column is a non-numerical

This is an elaboration of a previous question, but as I delve deeper into python, I just get more confused as to how python handles csv files. I have a csv file, and it must stay that way (e.g., cann..

Change size of text in text input tag?

I have a large input box for text but I can't change the font size? <input type="text"> I would like to change the font size inside the text field but I can't seem to do it using CSS. Any help..

Close all infowindows in Google Maps API v3

I am busy with a script that will make a google maps canvas on my website, with multiple markers. I want that when you click on a marker, a infowindow opens. I have done that, and the code is at the m..

password-check directive in angularjs

I'm writing a password verify directive : Directives.directive("passwordVerify",function(){ return { require:"ngModel", link: function(scope,element,attrs,ctrl){ ctrl..

Creating a Plot Window of a Particular Size

How can I create a new on-screen R plot window with a particular width and height (in pixels, etc.)?..

Get local IP address

In the internet there are several places that show you how to get an IP address. And a lot of them look like this example: String strHostName = string.Empty; // Getting Ip address of local machine.....

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

Running an executable in Mac Terminal

I just made a .c file and compiled it with gcc in the terminal on OS X 10.8.2. My syntax was gcc -o <filename> <sourcefile> and that was fine. Now I see I have an executable and file <..

Why is "cursor:pointer" effect in CSS not working

HTML: <div id="firstdiv"> <div id="intro"> <h1 id="name">YOU CHIA LAI</h1> <ul> <li class="about"..

Circle button css

I'm a beginner and very confused, as a div tag when I give the same width and height with border-radius: 50% it always becomes circle. but with the tag a in case I want to make a circle button, It doe..

What is python's site-packages directory?

The directory site-packages is mentioned in various Python related articles. What is it? How to use it?..

How do you determine what technology a website is built on?

Quite often I come across a nice looking or functional website, and wonder what technology was used to create it. What techniques are available to figure out what a particular website was built with? ..

How to set width of mat-table column in angular?

Here in my mat-table have 6 column when any column has not more words then it looks like Image-1, but when any column has more words then UI looks like Image-2, so how to set UI like Image-1 when any ..

How to run the Python program forever?

I need to run my Python program forever in an infinite loop.. Currently I am running it like this - #!/usr/bin/python import time # some python code that I want # to keep on running # Is this ..

VBA: activating/selecting a worksheet/row/cell

Hello Stackoverflowers, I'm trying to use a button, that first goes to another excel file in a specific directory. While performing something, I want to add a row in a sheet the excel file i'm runnin..

How to access html form input from code behind

I have a basic HTML form that gets inserted into a server side div tag based on how many records exist in the database. This HTML form comes out just fine, and everything looks good. But on my action ..