Questions Tagged with #Generic interface

Understanding the order() function

I'm trying to understand how the order() function works. I was under the impression that it returned a permutation of indices, which when sorted, would sort the original vector. For instance, > ..

WCF Service, the type provided as the service attribute values…could not be found

When I right click on Eval.svc within Visual Studio 2012 and view in browser, I get the following - The type 'EvalServiceLibary.Eval', provided as the Service attribute value in the ServiceHost d..

How do I turn a C# object into a JSON string in .NET?

I have classes like these: class MyDate { int year, month, day; } class Lad { string firstName; string lastName; MyDate dateOfBirth; } And I would like to turn a Lad object into a ..

Redirecting 404 error with .htaccess via 301 for SEO etc

I couldn't find a straight answer to my question and need to know it from the real experts. I had a website which urls were generated by Joomla. I believe that tons of urls are around in the search e..

Map enum in JPA with fixed values?

I'm looking for the different ways to map an enum using JPA. I especially want to set the integer value of each enum entry and to save only the integer value. @Entity @Table(name = "AUTHORITY_") publ..

How to open my files in data_folder with pandas using relative path?

I'm working with pandas and need to read some csv files, the structure is something like this: folder/folder2/scripts_folder/ folder/folder2/data_folder/data.csv How can I open the data.csv..

C# how to convert File.ReadLines into string array?

The question that I have is regarding converting the process of reading lines from a text file into an array instead of just reading it. The error in my codes appear at string[] lines = File.ReadLine..

How to export non-exportable private key from store

I need to export private key from Windows store. What should I do if the key is marked as non-exportable? I know that it is possible, program jailbreak can export this key. To export key I use Org.Bo..

When should use Readonly and Get only properties

In a .NET application when should I use "ReadOnly" properties and when should I use just "Get". What is the difference between these two. private readonly double Fuel= 0; public double FuelConsumpti..

How to get elements with multiple classes

Say I have this: <div class="class1 class2"></div> How do I select this div element? document.getElementsByClassName('class1')[0].getElementsByClassName('class2')[0] That does not wo..

PDO's query vs execute

Are they both do the same thing, only differently? Is there any difference besides using prepare between $sth = $db->query("SELECT * FROM table"); $result = $sth->fetchAll(); and $sth = $..

How can I simulate an anchor click via jquery?

I have a problem with faking an anchor click via jQuery: Why does my thickbox appear the first time I click on the input button, but not the second or third time? Here is my code: <input onclick=..

python: how to send mail with TO, CC and BCC?

I need for testing purposes to populate few hundred email boxes with various messages, and was going to use smtplib for that. But among other things I need to be able to send messages not only TO spec..

An App ID with Identifier '' is not available. Please enter a different string

I am trying to add a new APP ID to prepare for App Store submission and got the following error under the bundle ID I provided. An App ID with Identifier 'com.domainName.AppName' is not available. Pl..

How to create a label inside an <input> element?

I would like to insert a descriptive text inside an input element that disappers when the user click on it. I know it is a very common trick, but I do not know how to do that.. What is the simplest/..

What is the most effective way to get the index of an iterator of an std::vector?

I'm iterating over a vector and need the index the iterator is currently pointing at. AFAIK this can be done in two ways: it - vec.begin() std::distance(vec.begin(), it) What are the pros and cons..

CreateElement with id?

I'm trying to modify this code to also give this div item an ID, however I have not found anything on google, and idName does not work. I read something about append, however it seems pretty complicat..

System.currentTimeMillis vs System.nanoTime

Accuracy Vs. Precision What I would like to know is whether I should use System.currentTimeMillis() or System.nanoTime() when updating my object's positions in my game? Their change in movement is d..

Attach IntelliJ IDEA debugger to a running Java process

Is it possible to attach the IntelliJ IDEA debugger to a running Java process? If yes, how?..

Google Apps Script to open a URL

Is there a way to write a google apps script so when ran, a second browser window opens to (or another site of my choice)? I am trying to come up with a work-around to my previous ques..

How to find and return a duplicate value in array

arr is array of strings: ["hello", "world", "stack", "overflow", "hello", "again"] What would be an easy and elegant way to check if arr has duplicates, and if so, return one of them (no matter whi..

std::enable_if to conditionally compile a member function

I am trying to get a simple example to work to understand how to use std::enable_if. After I read this answer, I thought it shouldn't be too hard to come up with a simple example. I want to use std::e..

Insert an item into sorted list in Python

I'm creating a class where one of the methods inserts a new item into the sorted list. The item is inserted in the corrected (sorted) position in the sorted list. I'm not allowed to use any built-in l..

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

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

Stack, Static, and Heap in C++

I've searched, but I've not understood very well these three concepts. When do I have to use dynamic allocation (in the heap) and what's its real advantage? What are the problems of static and stack? ..

How to display images from a folder using php - PHP

It would be great if someone could help me figure out why the browser cannot load the images (error 404). The code works, and the image source is correct, but I cannot figure out what is wrong. (using..

Pytorch tensor to numpy array

I have a pytorch Tensor of size torch.Size([4, 3, 966, 1296]) I want to convert it to numpy array using the following code: imgs = imgs.numpy()[:, ::-1, :, :] Can anyone please explain what this co..

Docker error response from daemon: "Conflict ... already in use by container"

I've been using Docker on my PC to run Quantum GIS with the following instructions I've found here: docker-qgis-desktop - A simple docker container that runs QGIS desktop Everything has been running ..

How do I use arrays in cURL POST requests

I am wondering how do I make this code support arrays? At the moment the images array only seems to send the first value. Here is my code: <?php //extract data from the post extract($_POST); //s..

How do I right align div elements?

The body of my html document consists of 3 elements, a button, a form, and a canvas. I want the button and the form to be right aligned and the canvas to stay left aligned. The problem is when I try t..

Django: TemplateSyntaxError: Could not parse the remainder

I am getting this issue when I type localhost:8000/admin/. `TemplateSyntaxError: Could not parse the remainder: ':password_change' from 'admin:password_change'. The syntax of 'url' changed in Djan..

Mapping US zip code to time zone

When users register with our app, we are able to infer their zip code when we validate them against a national database. What would be the best way to determine a good potential guess of their time z..

What characters are forbidden in Windows and Linux directory names?

I know that / is illegal in Linux, and the following are illegal in Windows (I think) * . " / \ [ ] : ; | , What else am I missing? I need a comprehensive guide, however, and one that takes into a..

How to fix Terminal not loading ~/.bashrc on OS X Lion

Whenever I open a new tab in Terminal using Cmd + T, it opens bash in the same directory, as the previous tab. This works fine when I'm in the ~ directory, but if I'm anywhere else, I get an error loa..

How to update attributes without validation

I've got a model with its validations, and I found out that I can't update an attribute without validating the object before. I already tried to add on => :create syntax at the end of each validat..

String compare in Perl with "eq" vs "=="

I am (a complete Perl newbie) doing string compare in an if statement: If I do following: if ($str1 == "taste" && $str2 == "waste") { } I see the correct result (i.e. if the condition matc..

"The semaphore timeout period has expired" error for USB connection

I'm getting this error... The semaphore timeout period has expired. On this line... ThePorts.ActivePort1.Open(); ...but I only get it from time to time. When it happens, it happens over an..

What is the non-jQuery equivalent of '$(document).ready()'?

What is the non-jQuery equivalent of $(document).ready()?..

Converting a value to 2 decimal places within jQuery

Possible Duplicate: JavaScript: formatting number with exactly two decimals Now that I have got a bit of script to add values in to a div with a total in it, I then try to divide the values..

How do I remove all non-ASCII characters with regex and Notepad++?

I searched a lot, but nowhere is it written how to remove non-ASCII characters from Notepad++. I need to know what command to write in find and replace (with picture it would be great). If I want t..

What is the equivalent of ngShow and ngHide in Angular 2+?

I have a number of elements that I want to be visible under certain conditions. In AngularJS I would write <div ng-show="myVar">stuff</div> How can I do this in Angular 2+?..

jQuery plugin returning "Cannot read property of undefined"

I'm trying to do something i've done numerous times. I can't figure out why this isn't working. No matter how i write the jQuery code, it doesn't work. menuitems[i].action() just does NOT work. Below ..

Search for a string in all tables, rows and columns of a DB

I am lost in a big database and I am not able to find where the data I get comes from. I was wondering if it is possible with SQL Server 2005 to search for a string in all tables, rows and columns of ..

Completely uninstall PostgreSQL 9.0.4 from Mac OSX Lion?

This question may look like a duplicate of: How to uninstall postgresql on my Mac (running Snow Leopard) however, there are two major differences. I'm running Lion and I'm trying to uninstall PostgreS..

How do I specify C:\Program Files without a space in it for programs that can't handle spaces in file paths?

A configuration file needs position of another file, but that file is located in "C:\Program Files", and the path with space in it is not recognized, Is there another way to specify the location wi..

How can I get current date in Android?

I wrote the following code Date d = new Date(); CharSequence s = DateFormat.format("MMMM d, yyyy ", d.getTime()); But is asking me parameter, I want current date in string format, like 28-Dec-..

How do I configure git to ignore some files locally?

Can I ignore files locally without polluting the global git config for everyone else? I have untracked files that are spam in my git status but I don't want to commit git config changes for every sing..

How to stretch div height to fill parent div - CSS

I have a page with divs like below <div id="container"> <div id="A"></div> <div id="B"> <div id="B1"></div> ..

Change the background color in a twitter bootstrap modal?

When creating a modal in twitter bootstrap, is there any way to change the background color? Remove the shading entirely? NB: For removing shading, this doesn't work, because it also changes the cli..

Difference between == and ===

In swift there seem to be two equality operators: the double equals (==) and the triple equals (===), what is the difference between the two?..

How to config routeProvider and locationProvider in angularJS?

I want to active html5Mode in angularJS, but I don't know why it's not working. Is there anything wrong with my code? angular .module('myApp',[]) .config(function($locationProvider, $routePro..

How to set dialog to show in full screen?

I have a GridView and i want to make an implémentation of a dialog, on which the picture that i have selected should display in full screen. so how can i make the dialog shows in a full screen mode ..

jQuery Select first and second td

How can I add a class to the first and second td in each tr? <div class='location'> <table> <tbody> <tr> <td>THIS ONE</td> <td>THIS ONE</td> <td>..

Where should I put <script> tags in HTML markup?

When embedding JavaScript in an HTML document, where is the proper place to put the <script> tags and included JavaScript? I seem to recall that you are not supposed to place these in the <he..

Why would one mark local variables and method parameters as "final" in Java?

In Java, you can qualify local variables and method parameters with the final keyword. public static void foo(final int x) { final String qwerty = "bar"; } Doing so results in not being able to ..

Disable clipboard prompt in Excel VBA on workbook close

I have an Excel workbook, which using VBA code that opens another workbook, copies some data into the original, then closes the second workbook. When I close the second workbook (using Application.Cl..

Last segment of URL in jquery

How do I get the last segment of a url? I have the following script which displays the full url of the anchor tag clicked: $(".tag_name_goes_here").live('click', function(event) { event.preventD..

What's the difference between INNER JOIN, LEFT JOIN, RIGHT JOIN and FULL JOIN?

What's the difference between INNER JOIN, LEFT JOIN, RIGHT JOIN and FULL JOIN in MySQL?..

How to Automatically Close Alerts using Twitter Bootstrap

I'm using twitter's bootstrap CSS framework (which is fantastic). For some messages to users I am displaying them using the alerts Javascript JS and CSS. For those interested, it can be found here:..

Getting the application's directory from a WPF application

I found solutions for Windows Forms with AppDomain but what would be the equivalent for a WPF Application object?..

jQuery .each() with input elements

//save tablet jQuery("#savetablet"+jTablets[i].idtablets).on('click', function() { alert("alertsepy2..."); console.log(jTablets[i].idtablets); jQuery("#tablet"+jTablets[i].idtablets+" .det..

Run Command Line & Command From VBS

I need to run a command to copy a file from one location to another through Command Prompt using a vbs file. this is what I have however it keeps throwing an error at me. 'Dim oShell Set oShell = WSc..

jQuery $(".class").click(); - multiple elements, click event once

I have multiple classes on a page of the same name. I then have a .click() event in my JS. What I want to happen is the click event only happen once, regardless of multiple classes on my page. The sc..

Join vs. sub-query

I am an old-school MySQL user and have always preferred JOIN over sub-query. But nowadays everyone uses sub-query, and I hate it; I don't know why. I lack the theoretical knowledge to judge for my..

Android Drawing Separator/Divider Line in Layout?

I would like to draw a line right in the middle of a layout and use it as a separator of other items like TextView. Is there a good widget for this. I don't really want to use an image as it would be..

How do I replace all the spaces with %20 in C#?

I want to make a string into a URL using C#. There must be something in the .NET framework that should help, right?..

Get the current file name in gulp.src()

In my gulp.js file I'm streaming all HTML files from the examples folder into the build folder. To create the gulp task is not difficult: var gulp = require('gulp'); gulp.task('examples', function..

The equivalent of wrap_content and match_parent in flutter?

In Android match_parent and wrap_content are used to resize the widgets automatically relative to their parent to the content the widget contains. In Flutter it seems by default all widgets are set t..

Inner join with 3 tables in mysql

I want to select data from more tables with Inner join. These are my tables. Student (studentId, firstName, lastname) Exam (examId, name, date) Grade (gradeId, fk_studentId, fk_examId, grade) I wa..

Entity Framework (EF) Code First Cascade Delete for One-to-Zero-or-One relationship

Following the "Code First Modeling" section of the Pluralsight "Getting Started with Entity Framework 5" course by Julie Lerman, I created two POCO classes with a one-to-zero-or-one relationship: a pa..

How does Java import work?

I would like to know how the import statement works. I'm asking this because I have the following imports in my project: import static com.googlecode.javacv.jna.highgui.cvCreateCameraCapture; import..

Check if boolean is true?

bool foo = true; // Do this? if (foo) { } // Or this? if (foo == true) { } I like one of them and my coworker the other. The result is the same, but what is (more) correct?..

How to show all rows by default in JQuery DataTable

Does anybody know how to show all rows by default in jQuery datatable? I have tried this code, but it only shows 10 rows by default. $("#adminProducts").dataTable({ "aLengthMenu": [100] ..

Apache SSL Configuration Error (SSL Connection Error)

I'm trying to configure Apache on my server to work with ssl, but everytime I visit my site, I get the following message in my browser: SSL connection error. Unable to make a secure connection to the..

python pandas convert index to datetime

How do i convert a pandas index of strings to datetime format my dataframe 'df' is like this value 2015-09-25 00:46 71.925000 2015-09-25 00:47 71.625000 2015-09-..

Attempted to read or write protected memory

I've started seeing an AccessViolationException being thrown in my application a several different spots. It never occured on my development pc, our test server. It also only manifested itself on 1 o..

CURL ERROR: Recv failure: Connection reset by peer - PHP Curl

I'm having this strange error, CURL ERROR: Recv failure: Connection reset by peer This is how it happens, if I did not connect to the server and all of a sudden trying to connect to the server via CU..

How to kill all active and inactive oracle sessions for user

I am trying the below script to kill all active and inactive oracle sessions for user at once but it doesn't work. The script executes successfully but does not kill sessions for user. BEGIN FOR r ..

Chrome extension: accessing localStorage in content script

I have an options page where the user can define certain options and it saves it in localStorage: options.html Now, I also have a content script that needs to get the options that were defined in the..

Iterate all files in a directory using a 'for' loop

How can I iterate over each file in a directory using a for loop? And how could I tell if a certain entry is a directory or if it's just a file?..

Hive cast string to date dd-MM-yyyy

How can I cast a string in the format 'dd-MM-yyyy' to a date type also in the format 'dd-MM-yyyy' in Hive? Something along the lines of: CAST('12-03-2010' as date 'dd-mm-yyyy') ..

Simplest way to merge ES6 Maps/Sets?

Is there a simple way to merge ES6 Maps together (like Object.assign)? And while we're at it, what about ES6 Sets (like Array.concat)?..

How can I echo a newline in a batch file?

How can you you insert a newline from your batch file output? I want to do something like: echo hello\nworld Which would output: hello world ..

How to hide keyboard in swift on pressing return key?

I am using UITextfied while clicking on textfied keyboard appear but when i pressed the return key, keyboard is not disappearing. I used the following code: func textFieldShouldReturn(textField: UITe..

What is the proper declaration of main in C++?

Questions What is the proper signature of the main function in C++? What is the correct return type, and what does it mean to return a value from main? What are the allowed parameter types, and wha..

Change image source in code behind - Wpf

I need to set image source dynamically, please note my image is in somewhere on the Network, here is my code BitmapImage logo = new BitmapImage(); logo.BeginInit(); logo.UriSource = new Uri(@"pack://..

How can I group by date time column without taking time into consideration

I have a bunch of product orders and I'm trying to group by the date and sum the quantity for that date. How can I group by the month/day/year without taking the time part into consideration? 3/8/201..

Batch file for PuTTY/PSFTP file transfer automation

I have a batch file for moving file from my local PC to server through SFTP. I have PuTTY installed in my system and the batch file code follows. cd C:\Program Files (x86)\PuTTY psftp open <IP>..

How to set default vim colorscheme

The latest upgrade of Ubuntu made my vim colorscheme unusable. I know how to set it manually (:colo evening, for example), but I want to set the default for all vim sessions. I see reference in other ..

How do I get data from a table?

How do I pull data (string) from a column called "Limit" in a table ("displayTable") in Javascript? var table = document.getElementById('displayTable'); var rowCount =

String escape into XML

Is there any C# function which could be used to escape and un-escape a string, which could be used to fill in the content of an XML element? I am using VSTS 2008 + C# + .Net 3.0. EDIT 1: I am concat..

Android: How do bluetooth UUIDs work?

I don't understand what a bluetooth UUID denotes. Do UUIDs denote protocols (e.g. RFCOMM)? If so, why do the createRfcommSocketToServiceRecord() methods require UUIDs, when they specify rfcomm right i..

How to add LocalDB to Visual Studio 2015 Community's SQL Server Object Explorer?

Problem I don't understand how to make LocalDB show up in the SQL Server Object Explorer. On some VMs, it shows up automatically, on some other VMs, it doesn't. Still, after googling for hours, I don'..

Converting Object to JSON and JSON to Object in PHP, (library like Gson for Java)

I am developing a web application in PHP, I need to transfer many objects from server as JSON string, is there any library existing for PHP to convert object to JSON and JSON String to Objec, like Gs..

Running Java Program from Command Line Linux

I am not very experience with java and this is driving me crazy. I wrote a java program FileManagement and I need to run it from the command line. I can compile it from the command line with javac Fi..

Can't compile project when I'm using Lombok under IntelliJ IDEA

I'm trying to use Lombok in my project that I'm developing using IntelliJ IDEA 11. I've installed 3rd-party plugin for IDEA and it seems working fine because IDEA sees all autogenerated methods/fields..

How to make a query with group_concat in sql server

I know that in sql server we cannot use Group_concat function but here is one issue i have in which i need to Group_Concat my query.I google it found some logic but not able to correct it.My sql query..

Is Laravel really this slow?

I just started using Laravel. I've barely written any code yet, but my pages are taking nearly a second to load! This is a bit shocking to me when my framework-less apps and NodeJS apps take ~2ms. ..

cmd line rename file with date and time

Project moving forwards, I can see why creating .bat files to do things can become addictive! I can now save somefile.txt at regular intervals, I then rename somefile.txt by adding the time and date t..

What is the best way to auto-generate INSERT statements for a SQL Server table?

We are writing a new application, and while testing, we will need a bunch of dummy data. I've added that data by using MS Access to dump excel files into the relevant tables. Every so often, we want ..

Explicit Return Type of Lambda

When I try and compile this code (VS2010) I am getting the following error: error C3499: a lambda that has been specified to have a void return type cannot return a value void DataFile::removeComment..

Getting text from td cells with jQuery

I have this code in jQuery: children('table').children('tbody').children('tr').children('td') Which gets all table cells for each row. My question is: how can I get the text value in each cell in e..

How to use ? : if statements with Razor and inline code blocks

I'm updating my old .aspx views with the new Razore view engine. I have a bunch of places where I have code like this: <span class="vote-up<%= puzzle.UserVote == VoteType.Up ? "-selected" : "" ..

Mysql select distinct

I am trying to select of the duplicate rows in mysql table it's working fine for me but the problem is that it is not letting me select all the fields in that query , just letting me select the field ..

Pass accepts header parameter to jquery ajax

When I inspect the following code in Chrome Console it shows me a Request header Accept:undefined jQuery.ajax({ url: _this.attr('href'), accepts: "application/json; charset=utf-8", ..

How to refresh activity after changing language (Locale) inside application

My application users can change the language from the app's settings. Is it possible to change the language inside the application without having effect to general language settings ? This question o..

Split a large dataframe into a list of data frames based on common value in column

I have a data frame with 10 columns, collecting actions of "users", where one of the columns contains an ID (not unique, identifying user)(column 10). the length of the data frame is about 750000 rows..

org.apache.catalina.core.StandardContext startInternal SEVERE: Error listenerStart

I am trying to start my web application on Tomcat 7, but whenever I click on the start button, I get this error: FAIL - Application at context path /Web could not be started and below lines are ..

using stored procedure in entity framework

I am using mvc 5 and C# with Entity Framework... I have model and domain classes for function... now I need to use stored procedure.... which I am struggling at the movement. I am following ..

Javascript: Load an Image from url and display

I want to preface this with the fact that I am very very new to JavaScript. I appreciate your patience with me. I'm trying to create a script that allows a user to input a name into a text-area, pres..

How can I see function arguments in IPython Notebook Server 3?

I've recently switched to IPython Notebook 3 (3.1.0-cbccb68 to be exact), the Anaconda version. Previously when I typed a function and opened a parenthesis like this: time.sleep() and if the cursor..

fatal: bad default revision 'HEAD'

I'm using GIT as my source control system. We have it installed on one of our Linux boxes. Tortoise GIT is my windows client. This morning I checked in some changes, and tagged the code. I then did a..

org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 15

I'm porting a webapp from Tomcat 7 to another server with Tomcat 7 but with Java 8. Tomcat starts successfully but in log catalina.out I get: org.apache.tomcat.util.bcel.classfile.ClassFormatExcepti..

Override valueof() and toString() in Java enum

The values in my enum are words that need to have spaces in them, but enums can't have spaces in their values so it's all bunched up. I want to override toString() to add these spaces where I tell it ..

Installing R with Homebrew

I'm trying to install R using Homebrew. I ran these commands which are recommended elsewhere on SO: brew tap homebrew/science brew install R For brew tap homebrew/science, I'm receiving this error:..

How to analyze disk usage of a Docker container

I can see that Docker takes 12GB of my filesystem: 2.7G /var/lib/docker/vfs/dir 2.7G /var/lib/docker/vfs 2.8G /var/lib/docker/devicemapper/mnt 6.3G /var/lib/docker/devicemapper/devicemapp..

Python list / sublist selection -1 weirdness

So I've been playing around with python and noticed something that seems a bit odd. The semantics of -1 in selecting from a list don't seem to be consistent. So I have a list of numbers ls = range(1..

Difference between <input type='button' /> and <input type='submit' />

What is the difference between HTML <input type='button' /> and <input type='submit' />?..

Batch file to run a command in cmd within a directory

I want to have a batch file(must be placed on desktop) which does the following; opens cmd navigates to a directory, e.g. C:\activiti-5.9\setup runs a command within the directory, e.g. ant demo.sta..

See :hover state in Chrome Developer Tools

I want to see the :hover style for an anchor I'm hovering on in Chrome. In Firebug, there's a style dropdown that allows me to select different states for an element. I can't seem to find anythin..

How to remove a character at the end of each line in unix

I would like to remove comma , at the end of each line in my file. How can I do it other than using substring function in awk. please suggest me.Thanks Sample Input SUPPLIER_PROC_ID BIGINT N..

Pip - Fatal error in launcher: Unable to create process using '"'

I installed python 3.5.1 via ampps and it's working. However, when i try to use pip, i get the following message: Fatal error in launcher: Unable to create process using '"' I already reinstalled a..

CodeIgniter: How To Do a Select (Distinct Fieldname) MySQL Query

I'm trying to retrieve a count of all unique values in a field. Example SQL: SELECT count(distinct accessid) FROM (`accesslog`) WHERE record = '123' How can I do this kind of query inside of CodeI..

Set position / size of UI element as percentage of screen size

I'm trying to work out if it's possible to use percentage positions/sizes when creating a layout. What I want is something like this... ^ | | | 68% | | v Gallery (height equivalent of 16% total scree..

String variable interpolation Java

String building in Java confounds me. I abhore doing things like: url += "u1=" + u1 + ";u2=" + u2 + ";u3=" + u3 + ";u4=" + u4 + ";"; url += "x=" + u1 + ";y=" + u2 + ";z=" + u3 + ";da1=" + u4 + ";"; u..

Debugging "Element is not clickable at point" error

I see this only in Chrome. The full error message reads: "org.openqa.selenium.WebDriverException: Element is not clickable at point (411, 675). Other element would receive the click: ..." The e..

How to use switch statement inside a React component?

I have a React component, and inside the render method of the component I have something like this: render() { return ( <div> <div> // removed for ..

Getting Excel to refresh data on sheet from within VBA

How do you get spreadsheet data in Excel to recalculate itself from within VBA, without the kluge of just changing a cell value?..

Converting <br /> into a new line for use in a text area

If I have a variable: $var1 = "Line 1 info blah blah <br /> Line 2 info blah blah"; And a text area: <textarea>echo $var1</textarea> How can I get the text area to display a ne..

What is the purpose of a self executing function in javascript?

In javascript, when would you want to use this: (function(){ //Bunch of code... })(); over this: //Bunch of code... ..

Change bootstrap navbar collapse breakpoint without using LESS

Currently when the browser width drops below 768px, the navbar changes to collapsed mode. I want to change this width to 1000px so when the browser is below 1000px the navbar changes to collapsed mode..

Read an Excel file directly from a R script

How can I read an Excel file directly into R? Or should I first export the data to a text- or CSV file and import that file into R?..

Is it possible to get a history of queries made in postgres

Is it possible to get a history of queries made in postgres? and is it be possible to get the time it took for each query? I'm currently trying to identify slow queries in the application I'm working ..

How do I draw a circle in iOS Swift?

let block = UIView(frame: CGRectMake(cellWidth-25, cellHeight/2-8, 16, 16)) block.backgroundColor = UIColor(netHex: 0xff3b30) block.layer.cornerRadius = 9 block.clipsToBounds = true This is what I h..

Download file using libcurl in C/C++

I am building an application (on windows using Dev-C++) and I want it to download a file. I am doing this using libcurl (I have already installed the source code using packman). I found a working exam..

What does $_ mean in PowerShell?

I've seen the following a lot in PowerShell, but what does it do exactly? $_ ..

Set database timeout in Entity Framework

My command keeps timing out, so I need to change the default command timeout value. I've found myDb.Database.Connection.ConnectionTimeout, but it's readonly. How can I set the command timeout in Ent..

Laravel Eloquent inner join with multiple conditions

I have a question about inner joins with multiple on values. I did build my code like this in laravel. public function scopeShops($query) { return $query->join('kg_shops', function($join) ..

What is the JUnit XML format specification that Hudson supports?

I have Hudson as continuous integration server and I want to use option 'Publish JUnit test result report'. But I don't use xUnit tools for testing, instead of that i have shell scripts which run test..

Add vertical scroll bar to panel

I am trying to make a Panel scrollable, but only vertically (so AutoScroll won't work because the child controls go past the left edge and must). So how is this done?..

How to do a SUM() inside a case statement in SQL server

I want to add some calculation inside my case statement to dynamically create the contents of a new column but I get the error: Column 'Test1.qrank' is invalid in the select list because it is no..

Getting number of elements in an iterator in Python

Is there an efficient way to know how many elements are in an iterator in Python, in general, without iterating through each and counting?..

load and execute order of scripts

There are so many different ways to include JavaScript in a html page. I know about the following options: inline code or loaded from external URI included in <head> or <body> tag [1,2] having..

How do I check if a string is a number (float)?

What is the best possible way to check if a string can be represented as a number in Python? The function I currently have right now is: def is_number(s): try: float(s) return T..

Plot multiple lines (data series) each with unique color in R

I am fairly new to R and I have the following queries : I am trying to generate a plot in R which has multiple lines (data series). Each of these lines is a category and I want it to have a unique co..

Adding close button in div to close the box

I have created a URL preview box for the entered URL. Preview is shown in the div box. I want to add a close option on the right top. How could be done so that when users click on its box should be di..

Read and write to binary files in C?

Does anyone have an example of code that can write to a binary file. And also code that can read a binary file and output to screen. Looking at examples I can write to a file ok But when I try to rea..

How to convert Blob to File in JavaScript

I need to upload an image to NodeJS server to some directory. I am using connect-busboy node module for that. I had the dataURL of the image that I converted to blob using the following code: dataUR..

Split function equivalent in T-SQL?

I’m looking to split '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15...' (comma delimited) into a table or table variable. Does anyone have a function that returns each one in a row?..

Making a request to a RESTful API using python

I have a RESTful API that I have exposed using an implementation of Elasticsearch on an EC2 instance to index a corpus of content. I can query the search by running the following from my terminal (Mac..

Count if two criteria match - EXCEL formula

I have this table and I would like to create a formula which would count values based on true conditions from column A and column C. Example: If in column A value is M (male), and in column C is YES..

SQLite DateTime comparison

I can't seem to get reliable results from the query against a sqlite database using a datetime string as a comparison as so: select * from table_1 where mydate >= '1/1/2009' and mydate <= ..

SQL Switch/Case in 'where' clause

I tried searching around, but I couldn't find anything that would help me out. I'm trying to do this in SQL: declare @locationType varchar(50); declare @locationID int; SELECT column1, column2 FROM..

auto create database in Entity Framework Core

My application which is being ported to .NET core will use the new EF Core with SQLite. I want to automatically create the database and table structures when the app is first run. According to the EF ..

How to run a JAR file

I created a JAR file like this: jar cf Predit.jar *.* I ran this JAR file by double clicking on it (it didn't work). So I ran it from the DOS prompt like this: java -jar Predit.jar It raised "Fa..

C++ Remove new line from multiline string

Whats the most efficient way of removing a 'newline' from a std::string?..

how do I get a new line, after using float:left?

What I am trying to do is have rows of images, 6 images in each row. Some of these images need to have another image floating on top of them (flush with the lower-right corner). I was able to get tha..

What is the difference between square brackets and parentheses in a regex?

Here is a regular expression I created to use in JavaScript: var reg_num = /^(7|8|9)\d{9}$/ Here is another one suggested by my team member. var reg_num = /^[7|8|9][\d]{9}$/ The rule is to valid..

Omitting the second expression when using the if-else shorthand

Can I write the if else shorthand without the else? var x=1; x==2 ? dosomething() : doNothingButContinueCode(); I've noticed putting null for the else works (but I have no idea why or if that'..

SSRS - Checking whether the data is null

I've the following expression in my report. =FormatNumber(MAX(Fields!Reading.Value, "CellReading_Reading"),3) Now when the dataset is empty 'Fields!Reading.Value' becomes empty and finding their ma..

How do I use arrays in C++?

C++ inherited arrays from C where they are used virtually everywhere. C++ provides abstractions that are easier to use and less error-prone (std::vector<T> since C++98 and std::array<T, n>..

Python pip install module is not found. How to link python to pip location?

I'm a newbie and I needed the pySerial and feedparser module for my projects. I'm running Mountain lion. I followed the following tutorial so that I could upgrade to python 2.7.3 and then use the abo..

Internet Explorer 11- issue with security certificate error prompt

I am testing a website in IE11. It has mixed content (http and https). In previous versions, there is a prompt which asks which we should allow the content with security certificate error. However no ..

indexOf Case Sensitive?

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

Command to change the default home directory of a user

I would like to know whether there is any simple shell command to change the user home directory in Linux/Unix (one similar to chsh which changes the default login shell of an existing valid user) wit..

POST JSON fails with 415 Unsupported media type, Spring 3 mvc

I am trying to send a POST request to a servlet. Request is sent via jQuery in this way: var productCategory = new Object(); productCategory.idProductCategory = 1; productCategory.description = "Desc..

How to assign the output of a Bash command to a variable?

I have a problem putting the content of pwd command into a shell variable that I'll use later. Here is my shell code (the loop doesn't stop): #!/bin/bash pwd= `pwd` until [ $pwd = "/" ] do ..

What Vim command(s) can be used to quote/unquote words?

How can I quickly quote/unquote words and change quoting (e.g. from ' to ") in Vim? I know about the surround.vim plugin, but I would like to use just Vim. ..

Getting only hour/minute of datetime

Using C#, I have a datetime object, but all I want is the hour and the minutes from it in a datetime object. So for example: if I have a DateTime object of July 1 2012 12:01:02 All I want is July 1 ..

Plot two histograms on single chart with matplotlib

I created a histogram plot using data from a file and no problem. Now I wanted to superpose data from another file in the same histogram, so I do something like this n,bins,patchs = ax.hist(mydata1,1..

Most efficient way to concatenate strings in JavaScript?

In JavaScript, I have a loop that has many iterations, and in each iteration, I am creating a huge string with many += operators. Is there a more efficient way to create a string? I was thinking about..


I apologize if this is a silly question, but I have been trying to teach myself how to use BeautifulSoup so that I can create a few projects. I was following this link as a tutorial: https://www.yout..

Give all permissions to a user on a PostgreSQL database

I would like to give an user all the permissions on a database without making it an admin. The reason why I want to do that is that at the moment DEV and PROD are different DBs on the same cluster so ..

What are the Android SDK build-tools, platform-tools and tools? And which version should be used?

I know this is a very rudimentary question, but to my surprise, I could not find any document about Android SDK Build-tools. Besides Android SDK Tools and Android SDK Platform-tools, there are a bunch..

PHP error: "The zip extension and unzip command are both missing, skipping."

When I run a composer update I get this error message: Loading composer repositories with package information Updating dependencies (including require-dev) Failed to download psr/log from dist: T..

"Use of undeclared type" in Swift, even though type is internal, and exists in same module

I have a type in my module: import Cocoa class ColoredDotView : NSView { ... } It is used in a number of different classes with no issue: class EditSubjectPopoverController : NSObject { @..

What do 'lazy' and 'greedy' mean in the context of regular expressions?

What are these two terms in an understandable way?..

OAuth2 and Google API: access token expiration time?

We have a standalone Java application (see "Installed application") which runs periodically and uses Google API (updates some information from customer databases/ldap/...). To access Google APIs we..

Leap year calculation

In order to find leap years, why must the year be indivisible by 100 and divisible by 400? I understand why it must be divisible by 4. Please explain the algorithm...

How to Load RSA Private Key From File

I am working on a test harness for a SAML 1.1 Assertion Consumer Service. The test must generate a signed SAMLResponse and submit it to the ACS encoded in Base64. The ACS must be able to verify the ..

what do these symbolic strings mean: %02d %01d?

I'm looking at a code line similar to: sprintf(buffer,"%02d:%02d:%02d",hour,minute,second); I think the symbolic strings refer to the number of numeric characters displayed per hour, minute etc - o..

What is (x & 1) and (x >>= 1)?

I am trying to do assignment: "Find the number of bits in an unsigned integer data type without using the sizeof() function." And my design is to convert the integer to bits and then to count them. F..

Python - PIP install trouble shooting - PermissionError: [WinError 5] Access is denied

I get the following error when using PIP to either install new packages or even upgrade pip itself to the latest version. I am running pip on a windows 8.1 machine with Python 3.4. The message is tel..

CreateProcess error=2, The system cannot find the file specified

I am writing a program in java which would execute winrar and unzip a jar file for me placed in h:\myjar.jar into the folder h:\new. My java code goes something like this import; import ..

Unable to merge dex

I have Android Studio Beta. I created a new project with compile my old modules but when I tried launching the app it did not launch with the message: Error:Execution failed for task ':app:transformD..

Remove insignificant trailing zeros from a number?

Have I missed a standard API call that removes trailing insignificant zeros from a number? Ex. var x = 1.234000 // to become 1.234; var y = 1.234001; // stays 1.234001 Number.toFixed() and Number...

How to put a link on a button with bootstrap?

How would one put a link on a button with bootstrap? there are 4 methods in the bootstrap documentation: <a href="#" class="btn btn-info" role="button">Link Button</a> <button type="b..

Access mysql remote database from command line

I have a server with Rackspace. I want to access the database from my local machine command line. I tried like: mysql -u username -h -ppassword But it gives an error: ERROR 2003 (..

How to convert DataTable to class Object?

I have already developed an application which returns DataTable everywhere. Now my client wants to convert (use some part using service stack), so I need to return DTO (objects) in my application. I..

Is there a php echo/print equivalent in javascript

Say I want to print html from inside a script tag. A source like this <div>foo</div> <script> print('<div>Print this after the script tag</div>'); </script> <d..

WP -- Get posts by category?

I'm using this in my page template to get posts by their category: <?php if (is_page(19)){ ?> <ul> <?php global $post; ..

Drop view if exists

I have script where I want to first drop view and then create it. I know how to drop table: IF EXISTS (SELECT * FROM sys.tables WHERE name = 'table1' AND type = 'U') DROP TABLE table1; so I did the..

How to tell if a string contains a certain character in JavaScript?

I have a page with a textbox where a user is supposed to enter a 24 character (letters and numbers, case insensitive) registration code. I used maxlength to limit the user to entering 24 characters. ..

Fixed position but relative to container

I am trying to fix a div so it always sticks to the top of the screen, using: position: fixed; top: 0px; right: 0px; However, the div is inside a centered container. When I use position:fixed it fi..

Delete all items from a c++ std::vector

I'm trying to delete everything from a std::vector by using the following code vector.erase( vector.begin(), vector.end() ); but it doesn't work. Update: Doesn't clear destruct the elements held..

How can I append a string to an existing field in MySQL?

I want to update the code on all my record to what they currently are plus _standard any ideas? So for example if the codes are apple_1 and apple_2 I need them to be apple_1_standard and apple_2_stan..

IOError: [Errno 13] Permission denied

I have this piece of code to create a .json file to store python data. When i run it in my server i get this error: IOError: [Errno 13] Permission denied: 'juliodantas2015.json' at line with open(out..

Missing artifact in pom.xml

I am using Eclipse Luna and working on a maven project. When I add the entry for ojdbc jar in pom.xml , it is giving error in the xml. I can't find any reason for the issue as groupId, artifactId an..

How to insert text at beginning of a multi-line selection in vi/Vim

In Vim, how do I insert characters at the beginning of each line in a selection? For instance, I want to comment out a block of code by prepending // at the beginning of each line assuming my langu..

Is it possible to apply CSS to half of a character?

What I am looking for: A way to style one HALF of a character. (In this case, half the letter being transparent) What I have currently searched for and tried (With no luck): Methods for styling ha..