Questions Tagged with #Interposing

Python : List of dict, if exists increment a dict value, if not append a new dict

I would like do something like that. list_of_urls = ['', '', '', '', 'http://www..

How can you flush a write using a file descriptor?

It turns out this whole misunderstanding of the open() versus fopen() stems from a buggy I2C driver in the Linux 2.6.14 kernel on an ARM. Backporting a working bit bashed driver solved the root ca..

Simple file write function in C++

I have this code: // basic file operations #include <iostream> #include <fstream> using namespace std; int main() { writeFile(); } int writeFile () { ofstream myfile; myfile.op..

Given two directory trees, how can I find out which files differ by content?

If I want find the differences between two directory trees, I usually just execute: diff -r dir1/ dir2/ This outputs exactly what the differences are between corresponding files. I'm interested in..

How can I make a div stick to the top of the screen once it's been scrolled to?

I would like to create a div, that is situated beneath a block of content but that once the page has been scrolled enough to contact its top boundary, becomes fixed in place and scrolls with the page...

get string from right hand side

I am writing a query in Oracle. I want to get a string from the right hand side but the string length is dynamic. Ex: 299123456789 I want to get 123456789 substr(PHONE_NUMBERS,-X,Y) X is differ..

Private Variables and Methods in Python

Possible Duplicate: The meaning of a single- and a double-underscore before an object name in Python Which should I use _foo (an underscore) or __bar (double underscore) for private members..

React.js, wait for setState to finish before triggering a function?

Here's my situation: on this.handleFormSubmit() I am executing this.setState() inside this.handleFormSubmit(), I am calling this.findRoutes(); - which depends on the successful completion of

What is the .idea folder?

When I create a project in JetBrains WebStorm, a folder called .idea gets created. Is it okay if I delete it? Will it affect my project?..

MySQL: How to allow remote connection to mysql

I have installed MySQL Community Edition 5.5 on my local machine and I want to allow remote connections so that I can connect from external source. How can I do that?..

How can I check whether an array is null / empty?

I have an int array which has no elements and I'm trying to check whether it's empty. For example, why is the condition of the if-statement in the code below never true? int[] k = new int[3]; if (k..

plain count up timer in javascript

I am looking for a simple count up timer in javascript. All the scripts I find are 'all singing all dancing'. I just want a jQuery free, minimal fuss count up timer that displays in minutes and secon..

How to set child process' environment variable in Makefile

I would like to change this Makefile: SHELL := /bin/bash PATH := node_modules/.bin:$(PATH) boot: @supervisor \ --harmony \ --watch etc,lib \ --extensions..

Display Images Inline via CSS

I have three images that I want to display in a single row next to each other. Here is the HTML: <div id="client_logos"> <img style="display: inline; margin: 0 5px;" title="heartica_logo" s..

Create Git branch with current changes

I started working on my master branch thinking that my task would be easy. After a while I realized it would take more work and I want to do all this work in a new branch. How can I create a new br..

How to switch activity without animation in Android?

How can I use properly the Intent flag FLAG_ACTIVITY_NO_ANIMATION in AndroidManifest file? I supose my problem is trivial, but I can't find good example or solution to it. <intent-filter> ..

Background position, margin-top?

I currently have my background set to top right as: #thedivstatus { background-image: url("imagestatus.gif"); background-position: right top; background-repeat: no-repeat; } BUT! I need..

How to use Oracle's LISTAGG function with a unique filter?

I have a table like this: group_id name -------- ---- 1 David 1 John 1 Alan 1 David 2 Julie 2 Charles And I want the following result: group_id ..

Is there a way to detect if an image is blurry?

I was wondering if there is a way to determine if an image is blurry or not by analyzing the image data...

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

Maven dependencies are failing with a 501 error

Recently Maven build jobs running in Jenkins are failing with the below exception saying that they couldn't pull dependencies from Maven Central and should use HTTPS. I'm not sure how to change the re..

Trusting all certificates with okHttp

For testing purposes, I'm trying to add a socket factory to my okHttp client that trusts everything while a proxy is set. This has been done many times over, but my implementation of a trusting socket..

How to download a file from server using SSH?

I need to download a file from server to my desktop. (UBUNTU 10.04) I don't have a web access to the server, just ssh. If it helps, my OS is Mac OS X and iTerm 2 as a terminal...

SQL: How to get the id of values I just INSERTed?

I inserted some values into a table. There is a column whose value is auto-generated. In the next statement of my code, I want to retrieve this value. Can you tell me how to do it the right way?..

Importing packages in Java

How to import a method from a package into another program? I don't know how to import... I write a lil' code: package Dan; public class Vik { public void disp() { System.out.println..

How to rotate a div using jQuery

Is it possible to rotate a div using jQuery? I can rotate an image but can't rotate a div; is there any solution for this?..

How to get just numeric part of CSS property with jQuery?

I need to do a numeric calculation based on CSS properties. However, when I use this to get info: $(this).css('marginBottom') it returns the value '10px'. Is there a trick to just getting the numbe..

How to call a function in shell Scripting?

I have a shell script which conditionally calls a function. For Example:- if [ "$choice" = "true" ] then process_install elif [ "$choice" = "false" ] then process_exit fi process_install() { ..

How to scroll to bottom in react?

I want to build a chat system and automatically scroll to the bottom when entering the window and when new messages come in. How do you automatically scroll to the bottom of a container in React?..

How to join on multiple columns in Pyspark?

I am using Spark 1.3 and would like to join on multiple columns using python interface (SparkSQL) The following works: I first register them as temp tables. numeric.registerTempTable("numeric") Ref..

What does the ">" (greater-than sign) CSS selector mean?

For example: div > p.some_class { /* Some declarations */ } What exactly does the > sign mean?..

How do I list all tables in a schema in Oracle SQL?

How do i list all tables in a schema in Oracle SQL?..

What causes imported Maven project in Eclipse to use Java 1.5 instead of Java 1.6 by default and how can I ensure it doesn't?

I imported a Maven project and it used Java 1.5 even though I have 1.6 configured as my Eclipse default Preferences->Java->Installed JREs. When I changed the Maven project to use the 1.6 JRE i..

Laravel Redirect Back with() Message

I am trying to redirect to the previous page with a message when there is a fatal error. App::fatal(function($exception) { return Redirect::back()->with('msg', 'The Message'); } In the view ..

throwing an exception in objective-c/cocoa

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

What is tail call optimization?

Very simply, what is tail-call optimization? More specifically, what are some small code snippets where it could be applied, and where not, with an explanation of why?..

how to specify new environment location for conda create

the default location for packages is .conda folder in my home directory. however, on the server I am using, there is a very strict limit of how much space I can use, which basically avoids me from put..

Autocompletion of @author in Intellij

I'm migrating from Eclipse to Intellij Idea. One thing I couldn't figure out yet is autocompletion of the @author JavaDoc tag. When typing @a in Eclipse, there are two proposals: @author - author na..

CSS Layout - Dynamic width DIV

I have a pretty common layout issue that I have traditionally used a table to solve, but would like some advice on getting it done with CSS. I have 3 images that makeup a 'container'. The left and rig..

Single Line Nested For Loops

Wrote this function in python that transposes a matrix: def transpose(m): height = len(m) width = len(m[0]) return [ [ m[i][j] for i in range(0, height) ] for j in range(0, width) ] In ..

How do I publish a UDP Port on Docker?

How do I forward a UDP port from my Docker container to the host machine?..

Tree implementation in Java (root, parents and children)

I need to create a tree structure similar as the attached image in Java. I've found some questions related to this one but I haven't found a convincing and well explained response. The application bus..

Angularjs $http post file and form data

I have the below request in python import requests, json, io cookie = {} payload = {"Name":"abc"} url = "/test" file = "out/test.json" fi = {'file': ('file', open(file) )} r ="http:/..

Can't import my own modules in Python

I'm having a hard time understanding how module importing works in Python (I've never done it in any other language before either). Let's say I have: myapp/ myapp/myapp/ myapp/mya..

On Selenium WebDriver how to get Text from Span Tag

On Selenium Webdriver, how I can retrieve text from a span tag & print? I need to extract the text UPS Overnight - Free HTML code are as follow: div id="customSelect_3" class="select_wrapp..

Effective swapping of elements of an array in Java

I am wondering if there is a more efficient way of swapping two elements in an Array, than doing something like this: String temp = arr[1]; arr[1] = arr[2]; arr[2] = temp; Well, this is obviously n..

How to get IP address of running docker container

I am using Docker for Mac. I am running a nodejs based microservice in a Docker container. I want to test node microservice through the browser. How to get IP address of running docker container?..

How do I set an absolute include path in PHP?

In HTML, I can find a file starting from the web server's root folder by beginning the filepath with "/". Like: /images/some_image.jpg I can put that path in any file in any subdirectory, a..

CSS selector for "foo that contains bar"?

Is there a way to make a CSS Selector that matches the following? All OBJECT elements which have a PARAM element inside of them The selector OBJECT PARAM doesn't work, as it matches the PARAM,..

Display animated GIF in iOS

I noticed that with iMessage, animated gifs can now be sent and displayed. Does this mean that Apple is now supporting the display of animated GIFs in an application, or is the easiest method still to..

Animate element to auto height with jQuery

I want to animate a <div> from 200px to auto height. I can’t seem to make it work though. Does anyone know how? Here’s the code: $("div:first").click(function(){ $("#first").animate({ ..

How to check whether mod_rewrite is enable on server?

Currently I am using the hosting with lightspeed server. Hosting says mod_rewrite is enabled but I can't get my script working there. Whenever I try to access the URL, it returns 404 - not found page...

How to split the name string in mysql?

How to split the name string in mysql ? E.g.: name ----- Sachin ramesh tendulkar Rahul dravid Split the name like firstname,middlename,lastname: firstname middlename lastname --------- --..

Why is 2 * (i * i) faster than 2 * i * i in Java?

The following Java program takes on average between 0.50 secs and 0.55 secs to run: public static void main(String[] args) { long startTime = System.nanoTime(); int n = 0; for (int i = 0;..

ASP.NET 2.0 - How to use app_offline.htm

I've read about the app_offline.htm file which can be placed within the root of a .NET 2.0 application which will in essence shut down the application and disable any other pages from being requested...

How to retrieve images from MySQL database and display in an html tag

I created a MySQL database with a table using phpmyadmin. I created this table with a BLOB column to hold a jpeg file. I have issues with regards to the php variable $result here. My code so far: (..

How to make a parent div auto size to the width of its children divs

I'm trying to make the parent div only as wide as the child div's. Auto width is making the parent div fit the entire screen. The children divs will be different widths depending on their content so I..

Install specific branch from github using Npm

I would like to install bootstrap-loader from github in my project using npm Currently they are maintaining two version of this project which are comaptible with webpack version 1 and 2. I would lik..

Split string in JavaScript and detect line break

I have a small function I found that takes a string from a textarea and then puts it into a canvas element and wraps the text when the line gets too long. But it doesn't detect line breaks. This is wh..

Best way in to force https for an entire site?

About 6 months ago I rolled out a site where every request needed to be over https. The only way at the time I could find to ensure that every request to a page was over https was to check it in the ..

"unexpected token import" in Nodejs5 and babel?

In js file, i used import to instead of require import co from 'co'; And tried to run it directly by nodejs since it said import is 'shipping features' and support without any runtime flag (https:/..

String's Maximum length in Java - calling length() method

In Java, what is the maximum size a String object may have, referring to the length() method call? I know that length() return the size of a String as a char [];..

Is there a way to create multiline comments in Python?

I have recently started studying Python, but I couldn't find how to implement multi-line comments. Most languages have block comment symbols like /* */ I tried this in Python, but it throws an err..

JFrame: How to disable window resizing?

I am creating a JFrame and I call the method setSize(500, 500). Now the desired behaviour is that JFrame should not be resized by user in any condition. Either by maximizing or by dragging the borders..

Simple URL GET/POST function in Python

I can't seem to Google it, but I want a function that does this: Accept 3 arguments (or more, whatever): URL a dictionary of params POST or GET Return me the results, and the response code. Is ..

how to change attribute "hidden" in jquery

<td> <input id="check" type="checkbox" name="del_attachment_id[]" value="<?php echo $attachment['link'];?>"> </td> <td id="delete" hidden="true"> the file will be delete..

Could not resolve '...' from state ''

This is first time i am trying to use ui-router. Here is my app.js angular.module('myApp', ['ionic']) .run(function($ionicPlatform) { $ionicPlatform.ready(function() { // Hide the accessory b..

How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds

I am trying to work with Spring Data and Neo4j. I started by trying to follow this guide linked to by the main site. In particular I based my pom.xml off of the "Hello, World!" example file. Here is a..

Store images in a MongoDB database

How can I store images in a MongoDB database rather than just text? Can I create an array of images in a MongoDB database? Will it be possible to do the same for videos?..

Difference between "or" and || in Ruby?

What's the difference between the or and || operators in Ruby? Or is it just preference?..

How to read string from keyboard using C?

I want to read a string entered by the user. I don't know the length of the string. As there are no strings in C I declared a pointer: char * word; and used scanf to read input from the keyboard: ..

Safely remove migration In Laravel

In Laravel, there appears to be a command for creating a migration, but not removing. Create migration command: php artisan migrate:make create_users_table If I want to delete the migration, can I..

How to get current time and date in C++?

Is there a cross-platform way to get the current date and time in C++?..

Git checkout - switching back to HEAD

I've been doing my project while at some point I discovered that one thing stopped working. I needed to look up the state of my code when it was working correctly, so I've decided to use git checkout ..

Enabling HTTPS on express.js

I'm trying to get HTTPS working on express.js for node, and I can't figure it out. This is my app.js code. var express = require('express'); var fs = require('fs'); var privateKey = fs.readFileSync..

How to change root logging level programmatically for logback

I have the following logback.xml file: <configuration debug="true"> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{HH:mm:ss.SS..

How can I change the version of npm using nvm?

I've been using NVM to install the latest versions of nodeJS for my node work. It works totally fine for installing separate versions and switching between them. It also installs the latest version of..

How to add a form load event (currently not working)

I have a Windows Forms form where I am trying to show a user control when the form loads. Unfortunately, it is not showing anything. What am I doing wrong? Please see the code below: AdministrationV..

Is there an opposite to display:none?

The opposite of visibility: hidden is visibility: visible. Similarly, is there any opposite for display: none? Many people become confused figuring out how to show an element when it has display: no..

TimeSpan to DateTime conversion

I want to convert a Timespan to Datetime. How can I do this? I found one method on Google: DateTime dt; TimeSpan ts="XXX"; //We can covnert 'ts' to 'dt' like this: dt= Convert.ToDateTime(ts.ToStri..

How do you read from stdin?

I'm trying to do some of the code golf challenges, but they all require the input to be taken from stdin. How do I get that in Python?..

Counting the number of elements with the values of x in a vector

I have a vector of numbers: numbers <- c(4,23,4,23,5,43,54,56,657,67,67,435, 453,435,324,34,456,56,567,65,34,435) How can I have R count the number of times a value x appears in the vec..

How come I can't remove the blue textarea border in Twitter Bootstrap?

In Chrome, there is a blue border around the textarea. How come I can't remove it? textarea:hover, input:hover, textarea:active, input:active, textarea:focus, input:focus { outline:0px !impo..

Documentation for using JavaScript code inside a PDF file

Where can I find documentation on running JavaScript code inside a PDF? I've never added a JavaScript action inside a PDF document. However, I've done quite a bit of web development using JavaScript...

Init function in javascript and how it works

I often see the following code: (function () { // init part })(); but I never could get my head around how it works. I find the last brackets especially confusing. Could someone explain how it wo..

What is the newline character in the C language: \r or \n?

What is the newline character in C? I know that different OS have different line-ending characters, but they get translated into the C newline character. What is that character?..

Fixing the order of facets in ggplot

Data: df <- data.frame( type = c("T", "F", "P", "T", "F", "P", "T", "F", "P", "T", "F&..

Best way to check if object exists in Entity Framework?

What is the best way to check if an object exists in the database from a performance point of view? I'm using Entity Framework 1.0 (ASP.NET 3.5 SP1)...

Unescape HTML entities in Javascript?

I have some Javascript code that communicates with an XML-RPC backend. The XML-RPC returns strings of the form: <img src='myimage.jpg'> However, when I use the Javascript to insert the string..

Return the most recent record from ElasticSearch index

I would like to return the most recent record (top 1) from ElasticSearch index similar to the sql query below; SELECT TOP 1 Id, name, title FROM MyTable ORDER BY Date DESC; Can this be done?..

How to make <label> and <input> appear on the same line on an HTML form?

I am creating a registration form for a website. I want each label and its corresponding input element to appear on the same line. Here's my code: _x000D_ _x000D_ #form {_x000D_ background-color: ..

How do I fix an "Invalid license data. Reinstall is required." error in Visual C# 2010 Express?

I've tried to install Visual C# 2010 Express edition onto my PC, but whenever I try to run it, I get a error message. Invalid license data. Reinstall is required. I've already tried reinstalling..

Separation of business logic and data access in django

I am writing a project in Django and I see that 80% of the code is in the file This code is confusing and, after a certain time, I cease to understand what is really happening. Here is what..

Allow docker container to connect to a local/host postgres database

I've recently been playing around with Docker and QGIS and have installed a container following the instructions in this tutorial. Everything works great, although I am unable to connect to a localho..

Jupyter Notebook not saving: '_xsrf' argument missing from post

I've been running a script on jupyter notebooks for about 26 hour; I haven't really been using my computer for anything else, but it needs to run this program that will take ~30 hours to complete. At ..

Accessing private member variables from prototype-defined functions

Is there any way to make “private” variables (those defined in the constructor), available to prototype-defined methods? TestClass = function(){ var privateField = "hello"; this.nonProtoH..

Best practices to test protected methods with PHPUnit

I found the discussion on Do you test private method informative. I have decided, that in some classes, I want to have protected methods, but test them. Some of these methods are static and short. Be..

Quickly reading very large tables as dataframes

I have very large tables (30 million rows) that I would like to load as a dataframes in R. read.table() has a lot of convenient features, but it seems like there is a lot of logic in the implementati..

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined raised when starting react app

I'm working on a project in React and ran into a problem that has me stumped. Whenever I run yarn start I get this error: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type ..

How can I change text color via keyboard shortcut in MS word 2010

While typing sentences I would like to change the text color at few places. To do so I have to do it manually by going to fonts pop section. Is there any way to create a keyboard shortcut so that I ca..

How do you make an array of structs in C?

I'm trying to make an array of structs where each struct represents a celestial body. I don't have that much experience with structs, which is why I decided to try to use them instead of a whole bunc..

How to install python-dateutil on Windows?

I'm trying to convert some date/times to UTC, which I thought would be dead simple in Python - batteries included, right? Well, it would be simple except that Python (2.6) doesn't include any tzinfo c..

Java: How can I compile an entire directory structure of code ?

The use case is simple. I got the source files that were created using Eclipse. So, there is a deep directory structure, where any Java class could be referring to another Java class in the same, chil..

How do I set multipart in axios with react?

When I curl something, it works fine: curl -L -i -H 'x-device-id: abc' -F "url=" How do I get this to work right with axi..

Is there a way to view past mysql queries with phpmyadmin?

I'm trying to track down a bug that's deleting rows in a mysql table. For the life of me I can't track it down in my PHP code, so I'd like to work backwards by finding the actual mysql query that's ..

Get current value when change select option - Angular2

I'm writing an angular2 component and am facing this problem. Description: I want to push an option value in select selector to its handler when the (change) event is triggered. Such as the below temp..

How do I put variables inside javascript strings?

s = 'hello %s, how are you doing' % (my_name) That's how you do it in python. How can you do that in javascript/node.js?..

Get value of div content using jquery

I have the following html and I want to get the value of the div which is "Other" How can I do this with jQuery? <div class="readonly_label" id="field-function_purpose"> Other </d..

ViewPager and fragments — what's the right way to store fragment's state?

Fragments seem to be very nice for separation of UI logic into some modules. But along with ViewPager its lifecycle is still misty to me. So Guru thoughts are badly needed! Edit See dumb solution b..

How to fluently build JSON in Java?

I'm thinking of something like: String json = new JsonBuilder() .add("key1", "value1") .add("key2", "value2") .add("key3", new JsonBuilder() .add("innerKey1", "value3")) .toJson(); Whic..

Regular Expression to match every new line character (\n) inside a <content> tag

I'm looking for a regular expression to match every new line character (\n) inside a XML tag which is <content>, or inside any tag which is inside that <content> tag, for example : <bl..

How to convert List<string> to List<int>?

My question is part of this problem: I recieve a collection of id's from a form. I need to get the keys, convert them to integers and select the matching records from the DB. [HttpPost] public A..

Append text with .bat

I want to create a log of every operation processed in a batch file and used the following but to no avail. How do I fix it (the file was not created)? REM>> C:\"VTS\ADVANCED TOOLS\SYSTEM\LOG\A..

How to check if array element is null to avoid NullPointerException in Java

I have a partially nfilled array of objects, and when I iterate through them I tried to check to see whether the selected object is null before I do other stuff with it. However, even the act of check..

How to show progress bar while loading, using ajax

I have a dropdown box. When the user selects a value from the dropdown box, it performs a query to retrieve the data from the database, and shows the results in the front end using ajax. It takes a li..

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

Adding JPanel to JFrame

I have a program in which a JPanel is added to a JFrame: public class Test{ Test2 test = new Test2(); JFrame frame = new JFrame(); Test(){ ... frame.setLayout(new BorderLayout(..

Authenticating against Active Directory with Java on Linux

I have a simple task of authenticating against Active Directory using Java. Just verifying credentials and nothing else. Let's say my domain is "", OU path is unknown, and username/password..

how to display full stored procedure code?

How do you view a stored procedure/function? Say I have an old function without the original definition - I want to see what it is doing in pg/psql but I can't seem to figure out a way to do that. u..

Conversion from byte array to base64 and back

I am trying to: Generate a byte array. Convert that byte array to base64 Convert that base64 string back to a byte array. I've tried out a few solutions, for example those in this question. Fo..

Send data through routing paths in Angular

Is there anyway to send data as parameter with router.navigate? I mean, something like this example, as you can see the route has a data parameter, but doing this it's not working: this.router.navig..

View markdown files offline

Is there a way to display .md files offline so we know what it will look like once it's uploaded in Github? I'm referring to showing the file as it would come out in Github, and not as for e..

' << ' operator in verilog

i have a verilog code in which there is a line as follows: parameter ADDR_WIDTH = 8 ; parameter RAM_DEPTH = 1 << ADDR_WIDTH; here what will be stored in RAM_DEPTH and what does the << o..

addEventListener not working in IE8

I have created a checkbox dynamically. I have used addEventListener to call a function on click of the checkbox, which works in Google Chrome and Firefox but doesn't work in Internet Explorer 8. This..

Using colors with printf

When written like this, it outputs text in blue: printf "\e[1;34mThis is a blue text.\e[0m" But I want to have format defined in printf: printf '%-6s' "This is text" Now I have tried several opt..

ASP.NET Identity's default Password Hasher - How does it work and is it secure?

I am wondering wether the Password Hasher that is default implemented in the UserManager that comes with MVC 5 and ASP.NET Identity Framework, is secure enough? And if so, if you could explain to me h..

Generating a PDF file from React Components

I have been building a polling application. People are able to create their polls and get data regarding the question(s) they ask. I would like to add the functionality to let the users download the r..

Replacing column values in a pandas DataFrame

I'm trying to replace the values in one column of a dataframe. The column ('female') only contains the values 'female' and 'male'. I have tried the following: w['female']['female']='1' w['female'][..

How To Raise Property Changed events on a Dependency Property?

I have a control with two properties. One is a DependencyProperty, the other is an "alias" to the first one. How do I raise the PropertyChanged event for the second one (the alias) when the first one..

Can I get "&&" or "-and" to work in PowerShell?

&& is notoriously hard to search for on Google Search, but the best I've found is this article which says to use -and. Unfortunately it doesn't give any more information, and I can't find out ..

Iterating through a list to render multiple widgets in Flutter?

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

Error: Cannot find module 'ejs'

Here is my complete error: Error: Cannot find module 'ejs' at Function._resolveFilename (module.js:317:11) at Function._load (module.js:262:25) at require (module.js:346:19) at View.t..

How to get all selected values of a multiple select box?

I have a <select> element with the multiple attribute. How can I get this element's selected values using JavaScript? Here's what I'm trying: function loopSelected() { var txtSelectedVal..

how to use DEXtoJar

I find the solution to decompile a file dex to jar from this link but i don't understand how to use it...

Get the latest record from mongodb collection

I want to know the most recent record in a collection. How to do that? Note: I know the following command line queries works: 1. db.test.find().sort({"idate":-1}).limit(1).forEach(printjson); 2. db...

How to clear variables in ipython?

Sometimes I rerun a script within the same ipython session and I get bad surprises when variables haven't been cleared. How do I clear all variables? And is it possible to force this somehow every tim..

Git remote branch deleted, but still it appears in 'branch -a'

Let's say I had a branch named coolbranch in my repository. Now, I decided to delete it (both remotely and locally) with: git push origin :coolbranch git branch -D coolbranch Great! Now the branch..

Evaluating a mathematical expression in a string

stringExp = "2^4" intVal = int(stringExp) # Expected value: 16 This returns the following error: Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError..

adding directory to sys.path /PYTHONPATH

I am trying to import a module from a particular directory. The problem is that if I use sys.path.append(mod_directory) to append the path and then open the python interpreter, the directory mod_dir..

compare two list and return not matching items using linq

i have a two list List<Sent> SentList; List<Messages> MsgList; both have the same property called MsgID; MsgList SentList MsgID Content MsgID Content Stauts 1 ..

Node.js: close client connection

How can I close the socket connection on the client side? I am using: 0.9 node.js 0.10.15 express 3.3.4 i.e.: call localhost/test -- server side var test = io .of('/test') .on('conne..

C# get string from textbox

I am just a noob in C#, and I've got this question to ask you. I have here a form that asks for login details. It has two textfields: Username Password What I want is to get the strings entered ..

How to launch an application from a browser?

Is it possible to launch an application from a browser? I am not talking about opening a file from a browser (like open a PDF with Adobe Reader), but rather opening a new (blank) instance of an applic..

ng if with angular for string contains

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

Test if string begins with a string?

In VBA, what's the most straight forward way to test if a string begins with a substring? Java has startsWith. Is there a VBA equivalent?..

How to make HTML open a hyperlink in another window or tab?

This is a line for a hyperlink in HTML: <a href="">Starfall</a> Thus, if I click on "Starfall" my browser - I am using FireFox - will take me to that new page an..

What's the difference between xsd:include and xsd:import?

What's the difference between xsd:include and xsd:import? When would you use one instead of the other, and when might it not matter?..

Absolute position of an element on the screen using jQuery

How do I find out the absolute position of an element on the current visible screen (viewport) using jQuery? I am having position:relative, so offset() will only give the offset within the parent. I..

$(window).height() vs $(document).height

I am having problem of getting wrong height with $(window).height(); and got the similar question here In my case when I try $(document).height(); it seems to return me correct result windo..

jQuery Toggle Text?

How to toggle HTML text of an anchor tag using jQuery? I want an anchor that when clicked the text alternates between Show Background & Show Text as well as fading in & out another div. This w..

Append values to a set in Python

I have a set like this: keep = set(generic_drugs_mapping[drug] for drug in drug_input) How do I add values [0,1,2,3,4,5,6,7,8,9,10] into this set?..

instanceof Vs getClass( )

I see gain in performance when using getClass() and == operator over instanceOf operator. Object str = new Integer("2000"); long starttime = System.nanoTime(); if(str instanceof String) { Syst..

Symbolicating iPhone App Crash Reports

I'm looking to try and symbolicate my iPhone app's crash reports. I retrieved the crash reports from iTunes Connect. I have the application binary that I submitted to the App Store and I have the dSY..

Determine Pixel Length of String in Javascript/jQuery?

Is there any way to determine the pixel length of a string in jQuery/JavaScript?..

Stop Powershell from exiting

I know that there is that little -noexit switch for PowerShell. Is there anyway of staying in the shell without using that switch? In other words, I want a script command(s) that executes then leave..

Filtering a spark dataframe based on date

I have a dataframe of date, string, string I want to select dates before a certain period. I have tried the following with no luck data.filter(data("date") < new java.sql.Date(format.parse("2..

How to secure RESTful web services?

I have to implement secure RESTful web services. I already did some research using Google but I'm stuck. Options: TLS (HTTPS) + HTTP Basic (pc1oad1etter) HTTP Digest two-legged OAuth a Cookie-bas..

Java integer list

I am trying to make java go trough a list of numbers. It chooses the first one, gives this as output, waits/sleeps like 2000 milliseconds and then give the next one as output, waits 2000 milliseconds,..

What's the difference between echo, print, and print_r in PHP?

I use echo and print_r much, and almost never use print. I feel echo is a macro, and print_r is an alias of var_dump. But that's not the standard way to explain the differences...

Select elements by attribute in CSS

Is it possible to select elements in CSS by their HTML5 data attributes (for example, data-role)?..

dyld: Library not loaded ... Reason: Image not found

When trying to run an executable I've been sent in Mac OS X, I get the following error dyld: Library not loaded: libboost_atomic.dylib Referenced from: /Users/"Directory my executable is in" Reas..

How to access session variables from any class in ASP.NET?

I have created a class file in the App_Code folder in my application. I have a session variable Session["loginId"] I want to access this session variables in my class, but when I am writing the fo..

SVN Error: Commit blocked by pre-commit hook (exit code 1) with output: Error: n/a (6)

Some weird error cropped up suddenly outta nowhere and is preventing me from checking in my code via TortoiseSVN. I'm using a free account on This is on a Windows Vista system. I..

Must declare the scalar variable

I wrote this SQL in a stored procedure but not working, declare @tableName varchar(max) = 'TblTest' declare @col1Name varchar(max) = 'VALUE1' declare @col2Name varchar(max) = 'VALUE2' declare @value1..

Tensorflow r1.0 : could not a find a version that satisfies the requirement tensorflow

I want to install Tensorflow 1.o for python on windows. This is information for my system. D:\>python --version Python 3.5.2 :: Anaconda 4.2.0 (32-bit) D:\>pip3 --version pip 9.0.1 from d:\we..

Resize Google Maps marker icon image

When I load an image into the icon property of a marker it displays with its original size, which is a lot bigger than it should be. I want to resize to the standard to a smaller size. What is the be..

How can I programmatically check whether a keyboard is present in iOS app?

I need to check the condition of keyboard visibility in my iOS app. Pseudocode: if(keyboardIsPresentOnWindow) { //Do action 1 } else if (keyboardIsNotPresentOnWindow) { //Do action 2 } How..

Shorten string without cutting words in JavaScript

I'm not very good with string manipulation in JavaScript, and I was wondering how you would go about shortening a string without cutting any word off. I know how to use substring, but not indexOf or a..

'invalid value encountered in double_scalars' warning, possibly numpy

As I run my code I get these warnings, always in groups of four, sporadically. I have tried to locate the source by placing debug messages before and after certain statements to pin-point its origin. ..

PowerShell : retrieve JSON object by field value

Consider JSON in this format : "Stuffs": [ { "Name": "Darts", "Type": "Fun Stuff" }, { "Name": "Clean Toilet", "Type": "Boring Stuff" } ] In PowerShe..

How to set column widths to a jQuery datatable?

I have a jQuery datatable(outlined in red), but what happens is that the table jumps out of the width I have set for the div(which is 650 px). Here is the screen shot: Here is my code: <script typ..

Update Android SDK Tool to 22.0.4(Latest Version) from 22.0.1

I want to Update my Android SDK Tool from 22.0.1 to 22.0.4 I also Have ADT installed, but could not update the SDK Tool to 22.0.4 I am facing the following issue : Download interrupted: Read time..

What is the correct syntax of ng-include?

I’m trying to include an HTML snippet inside of an ng-repeat, but I can’t get the include to work. It seems the current syntax of ng-include is different than what it was previously: I see many ex..

Getting rid of all the rounded corners in Twitter Bootstrap

I love Twitter Bootstrap 2.0 - I love how it's such a complete library... but I want to make a global modification for a very boxy-not-round site, which is to get rid of all the rounded corners in Boo..

python convert list to dictionary

l = ["a", "b", "c", "d", "e"] I want to convert this list to a dictionary like: d = {"a": "b", "c": "d", "e": ""} So basically, the evens will be keys whereas the odds will be values. I know that..

UITableView Separator line

How can I change the separator line that appears at the end of each cell in UITableView? I want to have an image that is a thin separator type line image. ..

The infamous java.sql.SQLException: No suitable driver found

I'm trying to add a database-enabled JSP to an existing Tomcat 5.5 application (GeoServer 2.0.0, if that helps). The app itself talks to Postgres just fine, so I know that the database is up, user ca.. is not a function

I'm bashing my head against an error I can't work out how to fix. I have the following; JSON {"products": [ { "product_id" : "123", "product_data" : { "image_id" : "..

Split code over multiple lines in an R script

I want to split a line in an R script over multiple lines (because it is too long). How do I do that? Specifically, I have a line such as setwd('~/a/very/long/path/here/that/goes/beyond/80/character..

HTML text input field with currency symbol

I would like to have a text input field containing the "$" sign in the very beginning, and no matter what editing occurs to the field, for the sign to be persistent. I would be good if only numbers w..

Floating point exception

I successfully complied this code: #include <stdio.h> #include <math.h> int q; int main() { srand( time(NULL) ); int n=3; q=ceil(sqrt(n)); printf("%d\n %d\n", n,q); ..

C# Lambda expressions: Why should I use them?

I have quickly read over the Microsoft Lambda Expression documentation. This kind of example has helped me to understand better, though: delegate int del(int i); del myDelegate = x => x * x; int..

How to assign a NULL value to a pointer in python?

I am C programmer. I am new to python. In C , when we define the structure of a binary tree node we assign NULL to it's right and left child as : struct node { int val; struct node *righ..

Overriding !important style

Title pretty much sums it up. The external style sheet has the following code: td.EvenRow a { display: none !important; } I have tried using: = "inline"; and

Tar archiving that takes input from a list of files

I have a file that contain list of files I want to archive with tar. Let's call it mylist.txt It contains: file1.txt file2.txt ... file10.txt Is there a way I can issue TAR command that takes myli..

sorting and paging with gridview

I'm trying to get a gridview to sort and page manually with no success. The problem is that when a user clicks the column they want to sort, it sorts that page, but doesn't sort the datasource (datav..

When to use the JavaScript MIME type application/javascript instead of text/javascript?

Based on the question jQuery code not working in IE, text/javascript is used in HTML documents so Internet Explorer can understand it. But I’m wondering, when would you use application/javascript, ..

How to pad a string to a fixed length with spaces in Python?

I'm sure this is covered in plenty of places, but I don't know the exact name of the action I'm trying to do so I can't really look it up. I've been reading an official Python book for 30 minutes try..

Cancel split window in Vim

I have split my windows horizontally. Now how can I return to normal mode, i.e. no split window just one window without cancelling all of my open windows. I have 5 and do not want to "quit", just want..

Calculate age based on date of birth

I have a table of users in sql and they each have birth dates. I want to convert their date of birth to their age (years only), e.g. date: 15.03.1999 age: 14 and 15.03.2014 will change to age: 15 Her..

Sending email with PHP from an SMTP server

$from = ""; $headers = "From:" . $from; echo mail ("" ,"testmailfunction" , "Oj",$headers); I have trouble sending email in PHP. I get an error: SMTP server..

How to add hyperlink in JLabel?

What is the best way to add a hyperlink in a JLabel? I can get the view using html tags, but how to open the browser when the user clicks on it?..

JavaScript function to add X months to a date

I’m looking for the easiest, cleanest way to add X months to a JavaScript date. I’d rather not handle the rolling over of the year or have to write my own function. Is there something built in t..

Why am I getting this redefinition of class error?

Apologies for the code dump: gameObject.cpp: #include "gameObject.h" class gameObject { private: int x; int y; public: gameObject() { x = 0; y = 0; } gameObj..

LINQ Inner-Join vs Left-Join

Using extension syntax I'm trying to create a left-join using LINQ on two lists that I have. The following is from the Microsoft help but I've modified it to show that the pets list has no elements. W..

Does VBA have Dictionary Structure?

Does VBA have dictionary structure? Like key<>value array? ..

Implicit function declarations in C

What is meant by the term "implicit declaration of a function"? A call to a standard library function without including the appropriate header file produces a warning as in the case of: int main(){ ..

How do I use checkboxes in an IF-THEN statement in Excel VBA 2010?

I need to use the value of checkboxes for an IF-THEN statement. Based on what the user checks, the way I have to calculate things changes. However, I can't figure out how to use the checkbox values, o..

Integer division with remainder in JavaScript?

In JavaScript, how do I get: The whole number of times a given integer goes into another? The remainder? ..

Finding a substring within a list in Python

Background: Example list: mylist = ['abc123', 'def456', 'ghi789'] I want to retrieve an element if there's a match for a substring, like abc Code: sub = 'abc' print any(sub in mystring for mystring in..