Questions Tagged with #Pv3d

How to convert image into byte array and byte array to base64 String in android?

Can someone tell me the code to convert image into byte array and that byte array into base64 string. i write the below code not getting proper result . String filepath = "/sdcard/Image/ic_launcher..

How to set time to midnight for current day?

Every time that I create a non-nullable datetime in my mvc3 application it defaults to now(), where now is current date with current time. I would like to default it to today's date with 12am as the ..

Explode string by one or more spaces or tabs

How can I explode a string by one or more spaces or tabs? Example: A B C D I want to make this an array...

class << self idiom in Ruby

What does class << self do in Ruby?..

Html.Textbox VS Html.TextboxFor

What is the difference between Html.Textbox and Html.TextboxFor?..

Error: Jump to case label

I wrote a program which involves use of switch statements... However on compilation it shows: Error: Jump to case label. Why does it do that? #include <iostream> #include <cstdlib> ..

No provider for TemplateRef! (NgIf ->TemplateRef)

I'm trying to show a checkmark if an answer is the accepted answer: template: `<div ngIf="answer.accepted">&#10004;</div>` But I get this error: EXCEPTION: No provider for Template..

R ggplot2: stat_count() must not be used with a y aesthetic error in Bar graph

I am getting this error while plotting a bar graph and I am not able to get rid of it, I have tried both qplot and ggplot but still the same error. Following is my code: library(dplyr) library(ggp..

Is there StartsWith or Contains in t sql with variables?

I am trying to detect if the server is running Express Edition. I have the following t sql. DECLARE @edition varchar(50); set @edition = cast((select SERVERPROPERTY ('edition')) as varchar) print ..

Setting width of spreadsheet cell using PHPExcel

I'm trying to set the width of a cell in an Excel document generated with PHPExcel with: $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn('C')->setWidth('10'); $objPHPExcel->get..

CSS no text wrap

Please see see code, also quoted below. I need to show text inside the item divs in such a way the text appear only in the green box with specified width rest of the line ..

What's the best way to send a signal to all members of a process group?

I want to kill a whole process tree. What is the best way to do this using any common scripting languages? I am looking for a simple solution...

Regex for quoted string with escaping quotes

How do I get the substring " It's big \"problem " using a regular expression? s = ' function(){ return " It\'s big \"problem "; }'; ..

'cannot open git-upload-pack' error in Eclipse when cloning or pushing git repository

I am not able to clone or push to a git repository at Bitbucket in Eclipse: It's weird, because a day before I didn't have any problem. I have downloaded the sts 3 times with no luck. This error ke..

keytool error Keystore was tampered with, or password was incorrect

I am getting following error while generating certificates on my local machine. C:\Users\abc>keytool -genkey -alias tomcat -keyalg RSA Enter keystore password: keytool error: ..

Dynamic variable names in Bash

I am confused about a bash script. I have the following code: function grep_search() { magic_way_to_define_magic_variable_$1=`ls | tail -1` echo $magic_variable_$1 } I want to be able to c..

How to create/make rounded corner buttons in WPF?

I need to create a rounded corner glossy button in WPF. Can anyone please explain me what steps are needed?..

What is the PostgreSQL equivalent for ISNULL()

In MS SQL-Server, I can do: SELECT ISNULL(Field,'Empty') from Table But in PostgreSQL I get a syntax error. How do I emulate the ISNULL() functionality ?..

Need to find element in selenium by css

I want to find the element of this link "us states" in <h5>. I am trying this in craigslist. Any help will be highly appreciated Here is the url: <html cla..

PHP regular expressions: No ending delimiter '^' found in

I've been having some trouble with regular expressions. This is my code $pattern = "^([0-9]+)$"; if (preg_match($pattern, $input)) echo "yes"; else echo "nope"; I run it and get: Warni..

How do I find duplicate values in a table in Oracle?

What's the simplest SQL statement that will return the duplicate values for a given column and the count of their occurrences in an Oracle database table? For example: I have a JOBS table with the co..

How do you create a dictionary in Java?

I am trying to implement a dictionary (as in the physical book). I have a list of words and their meanings. What data structure / type does Java provide to store a list of words and their meanings a..

int array to string

In C#, I have an array of ints, containing digits only. I want to convert this array to string. Array example: int[] arr = {0,1,2,3,0,1}; How can I convert this to a string formatted as: "012301"..

Xcode variables

In Xcode, I know that you can get variables such as PROJECT_DIR to use in some situations, such as a run script build phase. I am wondering if it's possible to get the build type (i.e., Release or Deb..

ARM compilation error, VFP registers used by executable, not object file

I have been having this problem for the last few days and I can't get my head around what is really happening here, or what is the problem. I have a makefile with these flags: CC = arm-linux-gnueabi..

Launch iOS simulator from Xcode and getting a black screen, followed by Xcode hanging and unable to stop tasks

I'm having trouble running my basic iPhone application (while going through the Stanford iTunes CS193p lectures) in the iOS simulator. I've been searching for a while (both Google and SO), but unable..

How to serve an image using nodejs

I have a logo that is residing at the public/images/logo.gif. Here is my nodejs code. http.createServer(function(req, res){ res.writeHead(200, {'Content-Type': 'text/plain' }); res.end('Hello Worl..

Git: How configure KDiff3 as merge tool and diff tool

Recently I was using GitExtension 2.46, but the Git version that has the same is 1.9.4.msysgit.2. Willing to use only Git commands, I uninstalled GitExtension and install the latest version available ..

How do I convert a number to a letter in Java?

Is there a nicer way of converting a number to its alphabetic equivalent than this? private String getCharForNumber(int i) { char[] alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray(); if (..

how to implement regions/code collapse in javascript

How can you implement regions a.k.a. code collapse for JavaScript in Visual Studio? If there are hundreds of lines in javascript, it'll be more understandable using code folding with regions as in vb..

How to convert a table to a data frame

I have a table in R that has str() of this: table [1:3, 1:4] 0.166 0.319 0.457 0.261 0.248 ... - attr(*, "dimnames")=List of 2 ..$ x: chr [1:3] "Metro >=1 million" "Metro <1 million" "Non-M..

adb command not found in linux environment

While implementing the BluetoothChat application .apk inside G1 device, it always pops up a message: $adb install -r /home/parveen/workspace/BluetoothChat/bin/BluetoothChat.apk -bash: adb: command n..

Email & Phone Validation in Swift

i am using the following code for phone number validation. But i am getting the following error. I cant able to proceed further. Help us to take it forward. class PhoneNumberValidation: Validation { ..

Angular 4/5/6 Global Variables

I really struggle with creating global variables in my Angular 2 application. I already googled and read many posts on StackOverflow on this for the last 3 hours, however it seems like I just can't ..

PHP: How to remove specific element from an array?

How do I remove an element from an array when I know the elements name? for example: I have an array: $array = array('apple', 'orange', 'strawberry', 'blueberry', 'kiwi'); the user enters strawber..

composer laravel create project

I'm trying to use laravel, when I start a project and type composer create-project /Applications/MAMP/htdocs/test_laravel in terminal it shows [InvalidArgumentException] ..

Set the text in a span

I have this span <a title="Prev" data-event="click" data-handler="prev" class="ui-datepicker-prev ui-corner-all"> <span class="ui-icon ui-icon-circle-triangle-w">Prev</span&..

How to programmatically get iOS status bar height

I know that currently the status bar (with the time, battery, and network connection) at the top of the iPhone/iPad is 20 pixels for non-retina screens and 40 pixels for retina screens, but to future ..

Android: how to draw a border to a LinearLayout

I have three files. The XML, the draw function and the main Activity. I have some LinearLayout in my XML file. <LinearLayout android:orientation="horizontal" android:layout_..

python save image from url

I got a problem when I am using python to save an image from url either by urllib2 request or urllib.urlretrieve. That is the url of the image is valid. I could download it manually using the explorer..

get current url in twig template?

I looked around for the code to get the current path in a Twig template (and not the full URL), i.e. I don't want, I only need /page...

How to use a PHP class from another file?

Let's say I've got two files class.php and page.php class.php <?php class IUarts { function __construct() { $this->data = get_data('mydata'); } } ?> That..

Shell script to check if file exists

I'm trying to write a simple script that will tell me if a filename exist in $Temp that starts with the string "Test". For example, I have these files Test1989.txt Test1990.txt Test1991.txt Then I..

Failed binder transaction when putting an bitmap dynamically in a widget

Can anybody tell me the reason for failed binder transaction error? I can see this error message in logcat. I am getting this error while trying to put an bitmap dynamically in a widget.....

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

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

Check if object is a jQuery object

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

Extract value of attribute node via XPath

How can I extract the value of an attribute node via XPath? A sample XML file is: <parents name='Parents'> <Parent id='1' name='Parent_1'> <Children name='Children'> &l..

php exec command (or similar) to not wait for result

I have a command I want to run, but I do not want PHP to sit and wait for the result. <?php echo "Starting Script"; exec('run_baby_run'); echo "Thanks, Script is running in background"; ?> Is..

iloc giving 'IndexError: single positional indexer is out-of-bounds'

I am trying to encode some information to read into a Machine Learning model using the following import numpy as np import pandas as pd import matplotlib.pyplot as py Dataset = pd.read_csv('filenam..

EXCEL Multiple Ranges - need different answers for each range

I have spent a few hours working out how to do this which is why im posting it here now... If you want to return different values in a cell based on which range the value entered in another cell comes..

What is a singleton in C#?

What is a Singleton and when should I use it?..

How to add days to the current date?

I am trying to add days to the current date and it's working fine but when I add 360 days to the current date it gives me wrong value. eg: Current Date is 11/04/2014 And I am adding 360 Days to it, it..

PDOException “could not find driver” in php

I have installed Lampp on my linux system, and I am learning symfony2, while trying to create the schema with symfony2 command php app/console doctrine:schema:create I am getting the following err..

How to Select Min and Max date values in Linq Query

I am moving from SQL to Linq and I need some help. I am testing both Linq-to-SQL and Linq-to-Entities. I want to try both to decide which one suits me best. Your help is appreciated. Thanks What is t..

Parsing ISO 8601 date in Javascript

Need help/tips on converting an ISO 8601 date with the following structure into javascript. CCYY-MM-DDThh:mm:ssTZD I'd like to format the date like so: January 28, 2011 - 7:30PM EST I'd like to ..

How do I turn off autocommit for a MySQL client?

I have a web app that has been written with the assumption that autocommit is turned on on the database, so I don't want to make any changes there. However all the documentation I can find only seems ..

PHP "pretty print" json_encode

Possible Duplicate: Pretty-Printing JSON with PHP I'm working on a script that creates a JSON file. Right now I'm just using json_encode (PHP 5.2.x) to encode an array into JSON output. The..

Does `anaconda` create a separate PYTHONPATH variable for each new environment?

I am starting to work with the Python Anaconda distribution from to do scipy work. I have been able to get Anaconda up and running, but I cannot tell whether Anaconda creates a new PYTHON..

Adding form action in html in laravel

I am unable to pass url in views html form action tag. <form method="post" action="??what to write here??" accept-charset="UTF-8"> I want to set it's action to WelcomeController@log_in functi..

Check free disk space for current partition in bash

I am writing an installer in bash. The user will go to the target directory and runs the install script, so the first action should be to check that there is enough space. I know that df will report a..

Are there any standard exit status codes in Linux?

A process is considered to have completed correctly in Linux if its exit status was 0. I've seen that segmentation faults often result in an exit status of 11, though I don't know if this is simply t..

Easy way to get a test file into JUnit

Can somebody suggest an easy way to get a reference to a file as a String/InputStream/File/etc type object in a junit test class? Obviously I could paste the file (xml in this case) in as a giant Str..

How do I change the title of the "back" button on a Navigation Bar

Currently the left bar button default value is the title of the view that loaded the current one, in other words the view to be shown when the button is pressed (back button). I want to change the te..

What is the difference between float and double?

I've read about the difference between double precision and single precision. However, in most cases, float and double seem to be interchangeable, i.e. using one or the other does not seem to affect t..

Logical operator in a handlebars.js {{#if}} conditional

Is there a way in handlebars JS to incorporate logical operators into the standard handlebars.js conditional operator? Something like this: {{#if section1 || section2}} .. content {{/if}} I know I ..

Passing arguments to require (when loading module)

Is it possible to pass arguments when loading a module using require? I have module, login.js which provides login functionality. It requires a database connection, and I want the same database conne..

How do I define a method which takes a lambda as a parameter in Java 8?

In Java 8, methods can be created as Lambda expressions and can be passed by reference (with a little work under the hood). There are plenty of examples online with lambdas being created and used with..

PL/SQL ORA-01422: exact fetch returns more than requested number of rows

I get keep getting this error I can't figure out what is wrong. DECLARE * ERROR at line 1: ORA-01422: exact fetch returns more than requested number of rows ORA-06512: at line 11 Here is..

How do I inject a controller into another controller in AngularJS

I'm new to Angular and trying to figure out how to do things... Using AngularJS, how can I inject a controller to be used within another controller? I have the following snippet: var app = angular...

ab load testing

Can someone please walk me through the process of how I can load test my website using apache bench tool (ab)? I want to know the following: How many people per minute can the site handle? Please w..

How to add a Try/Catch to SQL Stored Procedure


How to calculate the SVG Path for an arc (of a circle)

Given a circle centered at (200,200), radius 25, how do I draw an arc from 270 degree to 135 degree and one that goes from 270 to 45 degree? 0 degree means it is right on the x-axis (the right side) ..

bodyParser is deprecated express 4

I am using express 4.0 and I'm aware that body parser has been taken out of the express core, I am using the recommended replacement, however I am getting body-parser deprecated bodyParser: use indi..

How to convert std::string to lower case?

I want to convert a std::string to lowercase. I am aware of the function tolower(), however in the past I have had issues with this function and it is hardly ideal anyway as use with a std::string wou..

How do I make Visual Studio pause after executing a console application in debug mode?

I have a collection of Boost unit tests I want to run as a console application. When I'm working on the project and I run the tests I would like to be able to debug the tests, and I would like to hav..

Find out whether radio button is checked with JQuery?

I can set a radio button to checked fine, but what I want to do is setup a sort of 'listener' that activates when a certain radio button is checked. Take, for example the following code: $("#eleme..

Javascript sleep/delay/wait function

Sorry if this question has already been asked here before, I could not find a suitable answer. I am wanting to create a JavaScript sleep/delay/wait function that I can call anywhere in the script, li..

How does one reorder columns in a data frame?

How would one change this input (with the sequence: time, in, out, files): Time In Out Files 1 2 3 4 2 3 4 5 To this output (with the sequence: time, out, in, files)? ..

CSS transition effect makes image blurry / moves image 1px, in Chrome?

I have some CSS that on hover, a CSS transition effect will moves a div. The problem, as you can see in the example, is that the translate transition has the horrible side effect of making the image ..

Cron job every three days

Is it possible to run a cronjob every three days? Or maybe 10 times/month...

How can I run PowerShell with the .NET 4 runtime?

I am updating a PowerShell script that manages some .NET assemblies. The script was written for assemblies built against .NET 2 (the same version of the framework that PowerShell runs with), but now n..

Tool to generate JSON schema from JSON data

We have this json schema draft. I would like to get a sample of my JSON data and generate a skeleton for the JSON schema, that I can rework manually, adding things like description, required, etc, whi..

How to convert php array to utf8?

I have an array: require_once ('config.php'); require_once ('php/Db.class.php'); require_once ('php/Top.class.php'); echo "db"; $db = new Db(DB_CUSTOM); $db->connect(); $res = $db->getResult..

Deleting an SVN branch

I created a branch of an SVN project called 'features', and now whenever I try to update said project, it brings with it a features folder, which contains another copy of the project from the branch. ..

Convert hex color value ( #ffffff ) to integer value

I am receiving hex color values from a server (in this form, #xxxxxx , example #000000 for black) How do I convert this to an integer value? I tried doing Integer.valueOf("0x" + passedColor.substri..

jQuery Combobox/select autocomplete?

Does a jQuery plug-in exist for replacing select/combo box? I tried SexyCombo, and it is as close to what I want, but it doesn't complete if you are writing from middle, only from beginning. I have ..

How to get the correct range to set the value to a cell?

I want to set text or number in Google Sheet from script. I want to set Hello or number 9 in cell F2. I found this code so far: SpreadsheetApp.getActiveRange().setValue('hello'); but that doesn..

How to use HTML Agility pack

How do I use the HTML Agility Pack? My XHTML document is not completely valid. That's why I wanted to use it. How do I use it in my project? My project is in C#...

Getting a list item by index

I've recently started using c# moving over from Java. I can't seem to find how to get a list item by index. In java to get the first item of the list it would be: list1.get(0); What is the equivale..

Technically what is the main difference between Oracle JDK and OpenJDK?

I have been using OpenJDK for ages, initially for small projects where it has no problems. But since I started to play with it for big toys, I started to notice random/unknown fatal error and crashes ..

DataTables: Uncaught TypeError: Cannot read property 'defaults' of undefined

When using the Bootstrap integration for DataTables, I see the following error in the console: Uncaught TypeError: Cannot read property 'defaults' of undefined (dataTables.bootstrap.js:20) This caus..

Displaying a webcam feed using OpenCV and Python

I have been trying to create a simple program with Python which uses OpenCV to get a video feed from my webcam and display it on the screen. I know I am partly there because the window is created and..

How to resize an Image C#

As Size, Width and Height are Get() properties of System.Drawing.Image; How can I resize an Image object at run-time in C#? Right now, I am just creating a new Image using: // objImage is the origin..

Converting dd/mm/yyyy formatted string to Datetime

I am new to DotNet and C#. I want to convert a string in mm/dd/yyyy format to DateTime object. I tried the parse function like below but it is throwing a runtime error. DateTime dt=DateTime.Parse("24..

PuTTY Connection Manager download?

Where can I still download PuTTY Connection Manager? I am a PuTTY user and finally decided I need to upgrade to a tabbed SSH environment. I found a lot of threads/sites talking about PuTTY Connection..

Vertical and horizontal align (middle and center) with CSS

I am practicing CSS and I am so confused about how can I force my div element to be center (vertically and horizontally) at my page (mean which way or ways for cross browser compatibility)? Best rega..

CSS white space at bottom of page despite having both min-height and height tag

I am unable to get the white space at the bottom of this page to disappear. I have both min-height and height tags in body. Any suggestions? Thanks!

How do I keep jQuery UI Accordion collapsed by default?

I am working with jQuery UI Accordion and it works great, but I would like to have the accordion stay closed unless it I click on it. I am using this code right now, which allows be to toggle it clos..

Laravel 5 - redirect to HTTPS

Working on my first Laravel 5 project and not sure where or how to place logic to force HTTPS on my app. The clincher here is that there are many domains pointing to the app and only two out of three ..

Call a function on click event in Angular 2

How to declare a function inside a component (typescript) and call it on a click event in Angular 2? Following is the code for the same functionality in Angular 1 for which I require Angular 2 code: ..

How can I generate Unix timestamps?

Related question is "Datetime To Unix timestamp", but this question is more general. I need Unix timestamps to solve my last question. My interests are Python, Ruby and Haskell, but other approaches..

How can I plot a histogram such that the heights of the bars sum to 1 in matplotlib?

I'd like to plot a normalized histogram from a vector using matplotlib. I tried the following: plt.hist(myarray, normed=True) as well as: plt.hist(myarray, normed=1) but neither option produces..

What's the pythonic way to use getters and setters?

I'm doing it like: def set_property(property,value): def get_property(property): or = value value = I'm new to Python, so i'm still exploring the syntax, a..

react button onClick redirect page

I am working on web application using React and bootstrap. When it comes to applying button onClick, it takes me hard time to let my page being redirect to another. if after a href , I cannot go the..

How to stretch children to fill cross-axis?

I have a left-right flexbox: _x000D_ _x000D_ .wrapper {_x000D_ display: flex;_x000D_ flex-direction: row;_x000D_ align-items: stretch;_x000D_ width: 100%;_x000D_ height: 70vh;_x000D_ min-..

Copying a local file from Windows to a remote server using scp

So, I'm attempting to simply transfer folder of files from my local computer to a server via ssh and scp. After sudoing I'm using the command as follows: scp -r C:/desktop/myfolder/deployments/ user..

What is the best way to implement constants in Java?

I've seen examples like this: public class MaxSeconds { public static final int MAX_SECONDS = 25; } and supposed that I could have a Constants class to wrap constants in, declaring them static ..

access denied for user @ 'localhost' to database ''

I'm seeing a lot of of similar questions to this. but can't find one exactly like mine yet. Not sure where to change these settings or anything, any help appreciated. access denied Access denied for..

Disable eslint rules for folder

Is there a way to disable specific rules for a folder? For example, I don't want to have required JSDoc comments for all my test files in the test folder. Is there a way to do this?..

Notice: Undefined offset: 0 in

I am getting this PHP error, what does it mean? Notice: Undefined offset: 0 in C:\xampp\htdocs\mywebsite\reddit_vote_tut\src\votes.php on line 41 From this code: <?php include("config.php"); ..

removing table border

I cannot get rid of this table border. The initial HTML/CSS is from the ASP.NET MVC default. I removed a lot of code and added a table on top. <!DOCTYPE html> <html> <head> &l..

Quick way to clear all selections on a multiselect enabled <select> with jQuery?

Do I have to iterate through ALL the and set remove the 'selected' attribute or is there a better way?..

Better way to find last used row

I am trying to find the last row the same way I found the last column: Sheets("Sheet2").Cells(1,Sheets("Sheet2").Columns.Count).End(xlToLeft).Column I know this way but it is not ..

How to change package name in flutter?

Is there any way to change Package Name of Flutter project? I want to change package name and application name in flutter project...


I'm wondering, if I have a VARCHAR of 200 characters and that I put a string of 100 characters, will it use 200 bytes or it will just use the actual size of the string?..

Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError.

I have used xuggle library in my project to trans code the video from mp4 to flv. I have used slf4j libraries also to support logging end. import com.xuggle.mediatool.IMediaReader; import com.xuggle...

Disable scrolling in all mobile devices

This sounds like there should be a solution for it all over the internet, but I am not sure why I cannot find it. I want to disable Horizontal scrolling on mobile devices. Basically trying to achieve ..

Date minus 1 year?

I've got a date in this format: 2009-01-01 How do I return the same date but 1 year earlier?..

Creating SVG elements dynamically with javascript inside HTML

I want to create a rectangle inside an HTML page, then write some text on that rectangle. I also need that text to be a hyperlink. This is what I did but it is not working: <!DOCTYPE html> ..

Trying to retrieve first 5 characters from string in bash error?

I'm trying to retrieve the first 5 characters from a string and but keep getting a Bad substitution error for the string manipulation line, I have the following lines in my script: TEST..

Why do we use volatile keyword?

Possible Duplicate: Why does volatile exist? I have never used it but I wonder why people use it? What does it exactly do? I searched the forum, I found it only C# or Java topics...

MongoDB distinct aggregation

I'm working on a query to find cities with most zips for each state: db.zips.distinct("state", db.zips.aggregate([ {$group:{_id:{state:"$state", city:"$city"},numberOfzipcodes:{$sum:1}}}, {$sort:{num..

Splitting String and put it on int array

I have to input a string with numbers ex: 1,2,3,4,5. That's a sample of the input, then I have to put that in an array of INT so I can sort it but is not working the way it should work. package array..

Best Practice: Initialize JUnit class fields in setUp() or at declaration?

Should I initialize class fields at declaration like this? public class SomeTest extends TestCase { private final List list = new ArrayList(); public void testPopulateList() { //..

error: function returns address of local variable

I'm beginner with C and I am learning on my own. I am creating the following function: char *foo(int x){ if(x < 0){ char a[1000]; char b = "blah"; x = x - 1; ..

get list of packages installed in Anaconda

Over a period of time I have loaded a number of packages into the Anaconda I have been using. Now I am not able to keep track of it. How do we get a list of all packages loaded in Anaconda (windows10)..

Usage of MySQL's "IF EXISTS"

Here are two statements that I'd like to work, but which return error messages: IF EXISTS (SELECT * FROM gdata_calendars WHERE `group` = ? AND id = ?) SELECT 1 ELSE SELECT 0 and IF ((SELECT COUNT..

Internet Explorer cache location

Where is cache for IE for current user located?..

Sort a list alphabetically

I have the following class: class Detail { public Detail() { _details = new List<string>(); } public IList<string> Details { get { return _details; } } private..

java : non-static variable cannot be referenced from a static context Error

The following code is generating an error on the variable con2 saying "non-static variable con2 cannot be referenced from a static context Error." I Googled for a resolution and they are suggesting t..

Combine two OR-queries with AND in Mongoose

I want to combine two OR-queries with AND in Monoose, like in this SQL statement: SELECT * FROM ... WHERE (a = 1 OR b = 1) AND (c=1 OR d=1) I tried this in a NodeJS module which only gets the model..

Java using scanner enter key pressed

I am programming using Java. I am trying write code which can recognize if the user presses the enter key in a console based program. How can I do this using java. I have been told that this can be d..

How to create json by JavaScript for loop?

I have array of select tag. <select id='uniqueID' name="status"> <option value="1">Present</option> <option value="2">Absent</option> </select> and ..

JPA eager fetch does not join

What exactly does JPA's fetch strategy control? I can't detect any difference between eager and lazy. In both cases JPA/Hibernate does not automatically join many-to-one relationships. Example: Perso..

How to detect DIV's dimension changed?

I've the following sample html, there is a DIV which has 100% width. It contains some elements. While performing windows re-sizing, the inner elements may be re-positioned, and the dimension of the di..

nil detection in Go

I see a lot of code in Go to detect nil, like this: if err != nil { // handle the error } however, I have a struct like this: type Config struct { host string port float64 } a..

Group list by values

Let's say I have a list like this: mylist = [["A",0], ["B",1], ["C",0], ["D",2], ["E",2]] How can I most elegantly group this to get this list output..

Changing route doesn't scroll to top in the new page

I've found some undesired, at least for me, behaviour when the route changes. In the step 11 of the tutorial you can see the list of ..

Thymeleaf: how to use conditionals to dynamically add/remove a CSS class

By using Thymeleaf as template engine, is it possible to add/remove dynamically a CSS class to/from a simple div with the th:if clause? Normally, I could use the conditional clause as follows: <a..

HTML5 form validation pattern alphanumeric with spaces?

I have the following input tag in my html5 form: <p> <label>Company Name*</label> <input type="text" name="name" class="field" required pattern="[a-zA-Z0-9]+" /> </..

How to get a certain element in a list, given the position?

So I've got a list: list<Object> myList; myList.push_back(Object myObject); I'm not sure but I'm confident that this would be the "0th" element in the array. Is there any function I can use t..

configuring project ':app' failed to find Build Tools revision

My android gradle build fails with a helpful error message $ gradle FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':app'. > failed to find Bu..

How to resolve Error : Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation

I am working on project. In my System when I run the project it is running nicely, but after uploading it to my domain when I check, then it displays the error like: "Showing a modal dialog box or fo..

Sqlite primary key on multiple columns

What is the syntax for specifying a primary key on more than 1 column in SQLITE ? ..

How can I suppress all output from a command using Bash?

I have a Bash script that runs a program with parameters. That program outputs some status (doing this, doing that...). There isn't any option for this program to be quiet. How can I prevent the scri..

str.startswith with a list of strings to test for

I'm trying to avoid using so many if statements and comparisons and simply use a list, but not sure how to use it with str.startswith: if link.lower().startswith("js/") or link.lower().startswith("ca..

How to check if a file exists from a url

I need to check if a particular file exists on a remote server. Using is_file() and file_exists() doesn't work. Any ideas how to do this quickly and easily?..

How to install Cmake C compiler and CXX compiler

I need some help compiling this project with cmake. Here is the error message. $ ./build_avida -- Building for: NMake Makefiles CMake Warning at CMakeLists.txt:1 (PROJECT): To use the NMake generat..

How to change column datatype in SQL database without losing data

I have SQL Server database and I just realized that I can change the type of one of the columns from int to bool. How can I do that without losing the data that is already entered into that table? ..

How to create websockets server in PHP

I am looking for a simple code to create a WebSocket server. I found phpwebsockets but it is outdated now and doesn't support the newest protocol. I tried updating it myself but it doesn't seem to wor..

Saving image from PHP URL

I need to save an image from a PHP URL to my PC. Let's say I have a page,, holding a single "flower" image, nothing else. How can I save this image from the URL with a new..

Why call git branch --unset-upstream to fixup?

I'm more of a novice when it comes to advanced operations in git. I maintain my blog using the blogging framework Octopress. Though Octopress is not under any development since 2011, it serves my purp..

HTML <sup /> tag affecting line height, how to make it consistent?

If I have a <sup> tag in a multi-line <p> tag, the line with the superscript on it has a larger line spacing above it than the other lines, irregardless of what line-height I put on the &l..

PATH issue with pytest 'ImportError: No module named YadaYadaYada'

I used easy_install to install pytest on a mac and started writing tests for a project with a file structure likes so: repo/ repo/ repo/ repo/ repo/tests/ repo/tests/test_ap..

How to write and read a file with a HashMap?

I have a HashMap with two Strings Map<String, String> ldapContent = new HashMap<String, String>. Now I want to save the Map in an external file to use the Map later without initializing i..

How to get image height and width using java?

Is there any other way besides using to get image height and width? Because I encounter an issue that locks up the thread. at com.sun.medialib.codec.jpeg.Decoder.njpeg_decode(Native Met..

Running Selenium Webdriver with a proxy in Python

I am trying to run a Selenium Webdriver script in Python to do some basic tasks. I can get the robot to function perfectly when running it through the Selenium IDE inteface (ie: when simply getting th..

Ajax Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource

I'm writing a simple site that takes as input an idiom, and return its meaning(s) and example(s) from Oxford Dictionary. Here's my idea: I send a request to the following URL: http://www.oxfordlearner..

yum error "Cannot retrieve metalink for repository: epel. Please verify its path and try again" updating ContextBroker

I'm trying to update Orion ContextBroker using the command yum install contextBroker. Unfortunatelly I get the following error: Loaded plugins: fastestmirror, refresh-packagekit, security Loading..

When should I create a destructor?

For example: public class Person { public Person() { } ~Person() { } } When should I manually create a destructor? When have you needed to create a destructor? ..

A warning - comparison between signed and unsigned integer expressions

I am currently working through Accelerated C++ and have come across an issue in exercise 2-3. A quick overview of the program - the program basically takes a name, then displays a greeting within a f..

position fixed header in html

I have a header (dynamic height) with a fixed position. I need to place the container div right below the header. As the header height is dynamic, I can't use the fixed value for top margin. How ca..

How to save a base64 image to user's disk using JavaScript?

I have converted the source content from the <img> html tag to a base64String using JavaScript. The image was displayed clearly. Now I want to save that image to user's disk using javascript. &..

How to determine if OpenSSL and mod_ssl are installed on Apache2

Does anyone know the command to determine if OpenSSL and mod_ssl are installed on Apache2?..

Convert string to integer type in Go?

I'm trying to convert a string returned from flag.Arg(n) to an int. What is the idiomatic way to do this in Go?..

Android: Reverse geocoding - getFromLocation

I am trying to get an address based on the long/lat. it appears that something like this should work? Geocoder myLocation = Geocoder(Locale.getDefault()); List myList = myLocation.getFromLocatio..

Could not resolve this reference. Could not locate the assembly

Everytime I build my solution, I get this error message: Warning 3 Could not resolve this reference. Could not locate the assembly "StandardClassLibrary, Version=, Culture=neutr..

Import / Export database with SQL Server Server Management Studio

I thought this would be trivial, but it isn't... I'm sure there is a simple way to do it but I can't manage to find it. Shame on me. I want to import/export the database itself, the tables, the const..

GLYPHICONS - bootstrap icon font hex value

I'd like to use Glyphicons icon font and I would need the hex value of each icon. I can't seem to find any resources on this on the Bootstrap website nor the Glyphicons website. I'd like to know how ..

Is there a command like "watch" or "inotifywait" on the Mac?

I want to watch a folder on my Mac (Snow Leopard) and then execute a script (giving it the filename of what was just moved into a folder (as a parameter... "filename")). I have a script all writ..

How to switch from POST to GET in PHP CURL

I have tried switching from a previous Post request to a Get request. Which assumes its a Get but eventually does a post. I tried the following in PHP : curl_setopt($curl_handle, CURLOPT_POSTFIELDS,..

How to process a file in PowerShell line-by-line as a stream

I'm working with some multi-gigabyte text files and want to do some stream processing on them using PowerShell. It's simple stuff, just parsing each line and pulling out some data, then storing it in ..

How to delete a file after checking whether it exists

How can I delete a file in C# e.g. C:\test.txt, although apply the same kind of method like in batch files e.g. if exist "C:\test.txt" delete "C:\test.txt" else return nothing (ignore) ..

How to prevent custom views from losing state across screen orientation changes

I've successfully implemented onRetainNonConfigurationInstance() for my main Activity to save and restore certain critical components across screen orientation changes. But it seems, my custom views..

Using Cookie in Asp.Net Mvc 4

I have web application in Asp.Net MVC4 and I want to use cookie for user's login and logout. So my actions as follows: Login Action [HttpPost] public ActionResult Login(string username, stri..

List all the files and folders in a Directory with PHP recursive function

I'm trying to go through all of the files in a directory, and if there is a directory, go through all of its files and so on until there are no more directories to go to. Each and every processed item..

Instagram: Share photo from webpage

In my shopping site I had implemented the functionality for 'Login via Instagram' and found it is working well. Now is it possible to share a product image and its description to the user Instagram ac..

Sequence Permission in Oracle

How can I check a permission granted for particular sequence and assign permission to particular sequence from SQL*Plus. Thank you..

How to use Object.values with typescript?

I am trying to form a comma separated string from an object, const data = {"Ticket-1.pdf":"8e6e8255-a6e9-4626-9606-4cd255055f71.pdf","Ticket-2.pdf":"106c3613-d976-4331-ab0c-d581576e7ca1.pdf"}; cons..

C linked list inserting node at the end

I'm having some trouble with my insertion method for a linked list in C. It seems to only add at the beginning of the list. Any other insertion I make fail. And this CodeBlocks debugger is so hard to ..

How to check if mysql database exists

Is it possible to check if a (MySQL) database exists after having made a connection. I know how to check if a table exists in a DB, but I need to check if the DB exists. If not I have to call another..

Is there a float input type in HTML5?

According to, the "number" input type's "value attribute, if specified and not empty, must have a value that is a valid floating point number." Yet it is simply (in the latest version of Ch..

How to add a search box with icon to the navbar in Bootstrap 3?

I am using the new Twitter Bootstrap 3, and am trying to place a search box like this (below) in the top navbar: In Bootstrap 2, it could've ben done like this: <form class="form-search" method..

Change bullets color of an HTML list without using span

I was wondering if there is a way to change the color on the bullets in a list. I have a list like this: <ul> <li>House</li> <li>Car</li> <li>Garden<..

Is there a naming convention for MySQL?

Here's how I do it: Table names are lower case, uses underscores to separate words, and are singular (e.g. foo, foo_bar, etc. I generally (not always) have a auto increment PK. I use the following c..

An error occurred while collecting items to be installed (Access is denied)

I'm getting the error given below when I try to install the upgrade from Eclipse and it goes like half way and then throw the error. An error occurred while collecting items to be installed session ..

What's the easy way to auto create non existing dir in ansible

In my Ansible playbook many times i need to create file there - name: Copy file template: src: code.conf.j2 dest: "{{project_root}}/conf/code.conf" now many times conf dir is not ther..

Add Twitter Bootstrap icon to Input box

How can we add a Twitter Bootstrap icon icon-search to the right of a text input element? The following attempt placed all the icons inside the input element, how can we crop it so it only displays t..

C#: How to add subitems in ListView

Creating an item(Under the key) is easy,but how to add subitems(Value)? listView1.Columns.Add("Key"); listView1.Columns.Add("Value"); listView1.Items.Add("sdasdasdasd"); //How to add "asdasdasd" unde..

Disable nginx cache for JavaScript files

Ok, I'm almost giving up on this, but how can I disable the caching from Nginx for JavaScript files? I'm using a docker container with Nginx. When I now change something in the JavaScript file, I need..

How do you build a Singleton in Dart?

The singleton pattern ensures only one instance of a class is ever created. How do I build this in Dart?..

Constructor overload in TypeScript

Has anybody done constructor overloading in TypeScript. On page 64 of the language specification (v 0.8), there are statements describing constructor overloads, but there wasn't any sample code given...

Replace HTML Table with Divs

Alright, I'm trying to buy into the idea that html tables should not be used, and that divs should be. However, I often have code that resembles the following <table> <tr> <..

How to query for Xml values and attributes from table in SQL Server?

I have a table that contains a Xml column: SELECT * FROM Sqm A sample of the xml data of a row would be: <Sqm version="1.2"> <Metrics> <Metric id="TransactionCleanupThread...

Is it possible to clone html element objects in JavaScript / JQuery?

I am looking for some tips on how to solve my problem. I have a html element (like select box input field) in a table. Now I want to copy the object and generate a new one out of the copy, and that ..

Delete all but the most recent X files in bash

Is there a simple way, in a pretty standard UNIX environment with bash, to run a command to delete all but the most recent X files from a directory? To give a bit more of a concrete example, imagine ..

"RangeError: Maximum call stack size exceeded" Why?

If I run Array.apply(null, new Array(1000000)).map(Math.random); on Chrome 33, I get RangeError: Maximum call stack size exceeded Why?..

How do you Encrypt and Decrypt a PHP String?

What I mean is: Original String + Salt or Key --> Encrypted String Encrypted String + Salt or Key --> Decrypted (Original String) Maybe something like: "hello world!" + "ABCD1234" --> Enc..

LoDash: Get an array of values from an array of object properties

I'm sure it's somewhere inside the LoDash docs, but I can't seem to find the right combination. var users = [{ id: 12, name: 'Adam' },{ id: 14, name: 'Bob' },{ id: ..

org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

I am using struts and hibernate. I have a parent and child relation using set in hbm. In the action I am using session.saveOrUpdate() method to save but while saving it is showing the below error. Can..

Table fixed header and scrollable body

I am trying to make a table with fixed header and a scrollable content using the bootstrap 3 table. Unfortunately the solutions I have found does not work with bootstrap or mess up the style. Here th..