Questions Tagged with #Reification

Reification refers to process of taking an abstract concept and making a concrete representation out of it.

SQL - HAVING vs. WHERE

I have the following two tables: 1. Lecturers (LectID, Fname, Lname, degree). 2. Lecturers_Specialization (LectID, Expertise). I want to find the lecturer with the most Specialization. When I try t..

How to ignore HTML element from tabindex?

Is there any way in HTML to tell the browser not to allow tab indexing on particular elements? On my page though there is a sideshow which is rendered with jQuery, when you tab through that, you get ..

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

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

How to set RelativeLayout layout params in code not in xml?

For example I want to add 3 buttons on screen: one align left, one align center, last one align right. How can I set their layout in code, not in xml?..

'console' is undefined error for Internet Explorer

I'm using Firebug and have some statements like: console.log("..."); in my page. In IE8 (probably earlier versions too) I get script errors saying 'console' is undefined. I tried putting this at th..

How to use If Statement in Where Clause in SQL?

I need to use if statement inside where clause in sql. Select * from Customer WHERE (I.IsClose=@ISClose OR @ISClose is NULL) AND (C.FirstName like '%'+@ClientName+'%' or @ClientName is NULL ) ..

Finding sum of elements in Swift array

What is the easiest (best) way to find the sum of an array of integers in swift? I have an array called multiples and I would like to know the sum of the multiples...

Outlets cannot be connected to repeating content iOS

I have just created an app and have started hooking up @IBOutlet's to the storyboard. I am connecting some of them to labels in a UITableViewCell Prototype Cell with a Basic Style. When I connect it t..

What is the difference between Eclipse for Java (EE) Developers and Eclipse Classic?

What is the difference between Eclipse for Java (EE) Developers and Eclipse Classic? Both are marked as version 3.6. Which one should I use?..

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

The conversion of the varchar value overflowed an int column

For some value of @nReservationID: SELECT @phoneNumber= CASE WHEN ISNULL(rdg2.nPhoneNumber ,0) = 0 THEN ISNULL(rdg2.nMobileNumber, 0) ELSE ISNULL(rdg2.nPhoneNumber ,0) END from tblRe..

Copy files without overwrite

I just can't seem to find a way on the command line to say "copy all the files from directory A to directory B, but if the file already exists in directory B, don't overwrite it, no matter which file ..

Oracle DateTime in Where Clause?

I have sql something like this: SELECT EMP_NAME, DEPT FROM EMPLOYEE WHERE TIME_CREATED >= TO_DATE('26/JAN/2011','dd/mon/yyyy') -> This returns 10 rows and TIME_CREATED = '26-JAN-2011' Now when ..

How can I SELECT multiple columns within a CASE WHEN on SQL Server?

I have searched this site extensively but cannot find a solution. Here is the example of my query: SELECT ActivityID, Hours = (CASE WHEN ActivityTypeID <> 2 THEN ..

PHPUnit assert that an exception was thrown?

Does anyone know whether there is an assert or something like that which can test whether an exception was thrown in the code being tested?..

Not able to access adb in OS X through Terminal, "command not found"

I have installed Android SDK and Eclipse on my Mac system. I am able to program using Eclipse and have created few sample applications. But I am still not able to access adb through the terminal wind..

How to uncheck checkbox using jQuery Uniform library

I have a problem with unchecking a checkbox. Have a look at my jsFiddle, where I am attempting: $("#check2").attr("checked", true); I use uniform for styling the checkbox and it simply does not..

How to Get XML Node from XDocument

How to Get an XML Element from XDocument using LINQ ? Suppose I have an XDocument Named XMLDoc which is shown below: <Contacts> <Node> <ID>123</ID> ..

How to uninstall Eclipse?

I want to uninstall Eclipse version Mars 2, but it doesn't appear in the "Programs and Features" area of the Windows Control Panel. The installer has installed start menu shortcuts and other artifacts..

HttpWebRequest using Basic authentication

I'm trying to go through an authentication request that mimics the "basic auth request" we're used to seeing when setting up IIS for this behavior. The URL is: https://telematicoprova.agenziadogane.i..

MySQL Where DateTime is greater than today

I want to get every record from my MySQL database which is greater than today. Sample: "Go to Lunch","2014-05-08 12-00-00" "Go to Bed","2014-05-08 23-00-00" Ou..

How to do a redirect to another route with react-router?

I am trying to do A SIMPLE using react-router ( version ^1.0.3 ) to redirect to another view and I am just getting tired. import React from 'react'; import {Router, Route, Link, RouteHandler} from 'r..

Creating Dynamic button with click event in JavaScript

How can I create a dynamic button with a click event with JavaScript? I tried this, but when I click the add button, an alert message show up! It's not what I want - I want to be able to click the bu..

How to send HTML-formatted email?

I could be able to let the web application sends automatic emails using Windows Task Scheduler. Now I want to send HTML-Formatted email using the following method that I wrote for sending emails. My ..

How to extract text from a PDF file?

I'm trying to extract the text included in this PDF file using Python. I'm using the PyPDF2 module, and have the following script: import PyPDF2 pdf_file = open('sample.pdf') read_pdf = PyPDF2.PdfFi..

Clearfix with twitter bootstrap

I have an issue with twitter bootstrap that looks a little bit strange to me. I have a sidebar with fixed with at the left side and a main area. <div> <div id="sidebar"> <ul> ..

importing go files in same folder

I am having difficulty in importing a local go file into another go file. My project structure is like something below -samplego --pkg --src ---github.com ----xxxx -----a.go -----b.go --bin I am t..

Switching to landscape mode in Android Emulator

This is probably a pretty easy to answer question, but I can't find the solution myself after a couple hours of searching the documentation and Google. I set the orientation of my Android app to lands..

CSS scrollbar style cross browser

How can I define a CSS scrollbar style cross browser? I tested this code, it only works in IE and opera, but failed in Chrome, Safari and Firefox. <style type="text/css"> <!-- body { ..

Local and global temporary tables in SQL Server

What is the difference between local and global temporary tables in SQL Server?..

Implement Stack using Two Queues

A similar question was asked earlier there, but the question here is the reverse of it, using two queues as a stack. The question... Given two queues with their standard operations (enqueue, dequeue..

How to push a new folder (containing other folders and files) to an existing git repo?

I cloned a repository to my desktop machine using git clone sshurl. As expected, this created a folder in my desktop. Now, instead of a single file, I want to push a whole folder into git. For exampl..

Vertically align an image inside a div with responsive height

I have the following code which sets up a container which has a height that changes with the width when the browser is re-sized (to maintain a square aspect ratio). HTML <div class="responsive-co..

Adding space/padding to a UILabel

I have a UILabel where I want to add space in the top and in the bottom. With minimun height in constrainst I've modified it to: EDIT: To do this I've used: override func drawTextInRect(rect: ..

How do I get a list of installed CPAN modules?

Aside from trying perldoc <module name> individually for any CPAN module that takes my fancy or going through the file system and looking at the directories I have no idea what modules we hav..

Change URL without refresh the page

I would like to replace an url without page refresh. I need to change: https://example.com/en/step1 to https://example.com/en/step2 How to do that ?..

What is the most appropriate way to store user settings in Android application

I am creating an application which connects to the server using username/password and I would like to enable the option "Save password" so the user wouldn't have to type the password each time the app..

Regular expression to detect semi-colon terminated C++ for & while loops

In my Python application, I need to write a regular expression that matches a C++ for or while loop that has been terminated with a semi-colon (;). For example, it should match this: for (int i = 0; ..

How to return value from Action()?

In regards to the answer for this question Passing DataContext into Action(), how do I return a value from action(db)? SimpleUsing.DoUsing(db => { // do whatever with db }); Should be more li..

Warning: mysqli_error() expects exactly 1 parameter, 0 given error

I get the following error Warning: mysqli_error() expects exactly 1 parameter, 0 given The problem is with this line of the code: $query = mysqli_query($myConnection, $sqlCommand) or die (my..

Android Transparent TextView?

Simply, how to make a TextView transparent? (Not full transparency) I searched the docs and the StackNetwork and couldn't find it? I guess there is something like this. Thanks. UPDATE This is the ..

How do you delete a column by name in data.table?

To get rid of a column named "foo" in a data.frame, I can do: df <- df[-grep('foo', colnames(df))] However, once df is converted to a data.table object, there is no way to just remove a column. ..

Received an invalid column length from the bcp client for colid 6

I want to bulk upload csv file data to sql server 2005 from c# code but I am encountering the below error - Received an invalid column length from the bcp client for colid 6. when bulk copy wri..

Using Html.ActionLink to call action on different controller

I am trying to navigate between controllers using ActionLink. I will tell my problem with an example. I am on Index view of Hat controller, and I am trying to use below code to create a link to Detai..

How do I check if a given Python string is a substring of another one?

I have two strings and I would like to check whether the first is a substring of the other. Does Python have such a built-in functionality?..

Official reasons for "Software caused connection abort: socket write error"

Given this stack trace snippet Caused by: java.net.SocketException: Software caused connection abort: socket write error  at java.net.SocketOutputStream.socketWrite0(Native Method) ..

how can I copy a conditional formatting in Excel 2010 to other cells, which is based on a other cells content?

I need to copy a formula based conditional formatting to other cells but i have to change the formula for every single cell condition. how can I do a copy of this condition so that the formula changes..

How to run Node.js as a background process and never die?

I connect to the linux server via putty SSH. I tried to run it as a background process like this: $ node server.js & However, after 2.5 hrs the terminal becomes inactive and the process dies. ..

Tomcat base URL redirection

Using tomcat, how do I get a request for http://www.mydomain.com to redirect to http://www.mydomain.com/somethingelse/index.jsp ? i haven't even managed to get an index.html to display from http://myd..

Change icon-bar (?) color in bootstrap

I want to change ? color. HTML: <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#menu"> <span class="sr-only">Toggle menu navigation</span> <..

Convert seconds into days, hours, minutes and seconds

I would like to convert a variable $uptime which is seconds, into days, hours, minutes and seconds. Example: $uptime = 1640467; Result should be: 18 days 23 hours 41 minutes ..

Pushing to Git returning Error Code 403 fatal: HTTP request failed

I was able to clone a copy of this repo over HTTPS authenticated. I've made some commits and want to push back out to the GitHub server. Using Cygwin on Windows 7 x64. C:\cygwin\home\XPherior\Code\lu..

Accessing elements of Python dictionary by index

Consider a dict like mydict = { 'Apple': {'American':'16', 'Mexican':10, 'Chinese':5}, 'Grapes':{'Arabian':'25','Indian':'20'} } How do I access for instance a particular element of this dictio..

Modify SVG fill color when being served as Background-Image

Placing the SVG output directly inline with the page code I am able to simply modify fill colors with CSS like so: polygon.mystar { fill: blue; }? circle.mycircle { fill: green; } This wor..

getaddrinfo: nodename nor servname provided, or not known

I have a Ruby on Rails application that I am deploying on a computer running Mac OS X 10.6. The code where the problem arises is run by a delayed_job. The problem only occurs when it is run through de..

Maximum call stack size exceeded error

I am using a Direct Web Remoting (DWR) JavaScript library file and am getting an error only in Safari (desktop and iPad) It says Maximum call stack size exceeded. What exactly does this error ..

How a thread should close itself in Java?

This is a short question. At some point my thread understand that it should suicide. What is the best way to do it: Thread.currentThread().interrupt(); return; By the way, why in the first case we..

NodeJS w/Express Error: Cannot GET /

This is what i have, the filename "default.htm" actually exists and loads when doing a readFile with NodeJS. var express = require('express'); var app = express(); app.use(express.static(__dirname +..

TCP vs UDP on video stream

I just came home from my exam in network-programming, and one of the question they asked us was "If you are going to stream video, would you use TCP or UDP? Give an explanation for both stored video a..

Comparing the contents of two files in Sublime Text

I have two cloned repositories of two very similar open-source projects, which I have been working on in different instances in Sublime Text 2 to arrive at my desired result. Code from both of these p..

Add Auto-Increment ID to existing table?

I have a pre-existing table, containing 'fname', 'lname', 'email', 'password' and 'ip'. But now I want an auto-increment column. However, when I enter: ALTER TABLE users ADD id int NOT NULL AUTO_INCR..

How add "or" in switch statements?

This is what I want to do: switch(myvar) { case: 2 or 5: ... break; case: 7 or 12: ... break; ... } I tried with "case: 2 || 5" ,but it didn't work. The purpose is to ..

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

How to disable JavaScript in Chrome Developer Tools?

I am trying to debug the features of a website when users disable their JavaScript. I was wondering how do you disable JavaScript for a page from the Google Chrome DevTools?..

Check if returned value is not null and if so assign it, in one line, with one method call

Java is littered with statements like: if(cage.getChicken() != null) { dinner = cage.getChicken(); } else { dinner = getFreeRangeChicken(); } Which takes two calls to getChicken() before th..

Convert System.Drawing.Color to RGB and Hex Value

Using C# I was trying to develop the following two. The way I am doing it may have some problem and need your kind advice. In addition, I dont know whether there is any existing method to do the same...

How to find MAC address of an Android device programmatically

How do i get Mac Id of android device programmatically. I have done with IMIE Code and I know how to check Mac id on device manually but have no idea how to find out programmatically...

Rotating a Div Element in jQuery

Trying to rotate a div element...This might be DOM blasphemy, could it work possibly with a canvas element? I'm not sure - if anybody has any ideas of how this could work or why it doesn't, I'd love t..

How can moment.js be imported with typescript?

I'm trying to learn Typescript. While I don't think it's relevant, I'm using VSCode for this demo. I have a package.json that has these pieces in it: { "devDependencies": { "gulp": "^3.9.1", ..

PHP session handling errors

I have this at the very top of my send.php file: ob_start(); @session_start(); //some display stuff $_SESSION['id'] = $id; //$id has a value header('location: test.php'); And the following at the..

DATEDIFF function in Oracle

I need to use Oracle but DATEDIFF function doesn't work in Oracle DB. How to write the following code in Oracle? I saw some examples using INTERVAL or TRUNC. SELECT DATEDIFF ('2000-01-01','2000-01-..

Hadoop cluster setup - java.net.ConnectException: Connection refused

I want to setup a hadoop-cluster in pseudo-distributed mode. I managed to perform all the setup-steps, including startuping a Namenode, Datanode, Jobtracker and a Tasktracker on my machine. Then I tr..

ElasticSearch: Unassigned Shards, how to fix?

I have an ES cluster with 4 nodes: number_of_replicas: 1 search01 - master: false, data: false search02 - master: true, data: true search03 - master: false, data: true search04 - master: false, data:..

How do I disable a Button in Flutter?

I'm just starting to get the hang of Flutter, but I'm having trouble figuring out how to set the enabled state of a button. From the docs, it says to set onPressed to null to disable a button, and gi..

How to create a delay in Swift?

I want to pause my app at a certain in point. In other words, I want my app to execute the code, but then at a certain point, pause for 4 seconds, and then continue on with the rest of the code. How c..

How to implement OnFragmentInteractionListener

I have a wizard generated app with navigation drawer in android studio 0.8.2 I have created a fragment and added it with newInstance() and I get this error: com.domain.myapp E/AndroidRuntime? FAT..

How can I save application settings in a Windows Forms application?

What I want to achieve is very simple: I have a Windows Forms (.NET 3.5) application that uses a path for reading information. This path can be modified by the user, by using the options form I provid..

Iterate two Lists or Arrays with one ForEach statement in C#

This just for general knowledge: If I have two, let's say, List, and I want to iterate both with the same foreach loop, can we do that? Edit Just to clarify, I wanted to do this: List<String>..

Html Agility Pack get all elements by class

I am taking a stab at html agility pack and having trouble finding the right way to go about this. For example: var findclasses = _doc.DocumentNode.Descendants("div").Where(d => d.Attributes.Cont..

Creating files in C++

I want to create a file using C++, but I have no idea how to do it. For example I want to create a text file named Hello.txt. Can anyone help me?..

Does dispatch_async(dispatch_get_main_queue(), ^{...}); wait until done?

I have a scenario in my app, where I want to do some time consuming task which consists of some data processing as well as UI update, in a method. My method looks like this, - (void)doCalculationsAnd..

UL or DIV vertical scrollbar

I have problem with vertical scrollbar on my page. I have lot of items inside ul inside div, I tried with overflow:auto in style for div but it doesn't help. How to add scrollbar vertical to ul or div..

How to detect idle time in JavaScript elegantly?

Is it possible to detect "idle" time in JavaScript? My primary use case probably would be to pre-fetch or preload content. Idle time: Period of user inactivity or without any CPU usage..

jQuery autocomplete with callback ajax json

I'm trying to find a way to use jQuery autocomplete with callback source getting data via an ajax json object list from the server. Could anybody give some directions? I googled it but couldn't find..

How can I add an image file into json object?

I want to add an image file into json object . Is it possible to add image file into json object? I tried below code but its not working ? Because i want to send that json object to the server then s..

How to convert an XML file to nice pandas dataframe?

Let's assume that I have an XML like this: <author type="XXX" language="EN" gender="xx" feature="xx" web="foobar.com"> <documents count="N"> <document KEY="e95a9a6c790ecb95..

How to access property of anonymous type in C#?

I have this: List<object> nodes = new List<object>(); nodes.Add( new { Checked = false, depth = 1, id = "div_" + d.Id }); ... and I'm wondering if I can..

MySQL join with where clause

I have two tables I want to join. I want all of the categories in the categories table and also all of the categories subscribed to by a user in the category_subscriptions table. essentially this is..

CodeIgniter Select Query

I have a simple CodeIgniter Active record query to select an ID: $q = $this -> db -> select('id') -> where('email', $email) -> limit(1) -> g..

Favorite Visual Studio keyboard shortcuts

What is your favorite Visual Studio keyboard shortcut? I'm always up for leaving my hands on the keyboard and away from the mouse! One per answer please...

How to check if Receiver is registered in Android?

I need to check if my registered receiver is still registered if not how do i check it any methods?..

PHP Fatal error: Call to undefined function json_decode()

Apache is logging PHP Fatal error: Call to undefined function json_decode(). After some googling, it seems this problem is a result of not having the latest version of php. Oddly, running php --versi..

{"<user xmlns=''> was not expected.} Deserializing Twitter XML

I'm pulling in the XML from Twitter via OAuth. I'm doing a request to http://twitter.com/account/verify_credentials.xml, which returns the following XML: <?xml version="1.0" encoding=&quo..

Assign JavaScript variable to Java Variable in JSP

Ello there, I'm trying to assign the value of a javascript variable to a java variable. But I don't have clue how to do this? Say for example I have this: <html> <head> <script typ..

When to use static classes in C#

Here's what MSDN has to say under When to Use Static Classes: static class CompanyInfo { public static string GetCompanyName() { return "CompanyName"; } public static string GetCompanyAddres..

What are the ascii values of up down left right?

What are the ASCII values of the arrow keys? (up/down/left/right)..

How to secure the ASP.NET_SessionId cookie?

I have set the .ASPXAUTH cookie to be https only but I am not sure how to effectively do the same with the ASP.NET_SessionId. The entire site uses HTTPS so there is no need for the cookie to work wit..

Javascript: best Singleton pattern

Possible Duplicate: Simplest/Cleanest way to implement singleton in JavaScript? I'm using this pattern for singletons, in the example the singleton is PlanetEarth: var NAMESPACE = function..

Check if a string contains numbers and letters

I want to detect if a string contains both numbers and letters. For example: Given PncC1KECj4pPVW, it would be written to a text file because it contains both. Given qdEQ, it would not, because it ..

Why does configure say no C compiler found when GCC is installed?

I am trying to make Sphinx from source on a 32-bit CentOS 6 VPS. When I run this command: ./configure --prefix=/usr/local/sphinx I get this error output: checking build environment --------------..

What is a loop invariant?

I'm reading "Introduction to Algorithm" by CLRS. In chapter 2, the authors mention "loop invariants". What is a loop invariant?..

Batch files - number of command line arguments

Just converting some shell scripts into batch files and there is one thing I can't seem to find...and that is a simple count of the number of command line arguments. eg. if you have: myapp foo bar ..

Unicode (UTF-8) reading and writing to files in Python

I'm having some brain failure in understanding reading and writing text to a file (Python 2.4). # The string, which has an a-acute in it. ss = u'Capit\xe1n' ss8 = ss.encode('utf8') repr(ss), repr(ss8..

Failed to create provisioning profile

I'm trying to create a project in Xcode, Version 8.0 beta 6 (8S201h) and I'm getting this error. The apple account is a free one because I'm just playing around with Xcode but it is forcing me to s..

How to center div vertically inside of absolutely positioned parent div

I am trying to get blue container in the middle of pink one, however seems vertical-align: middle; doesn't do the job in that case. <div style="display: block; position: absolute; left: 50px; top:..

Visual Studio window which shows list of methods

In Visual Studio, is there a window which shows list of methods in the active class? A small window like the Solution Explorer would be great. In Eclipse, there is one...

Using Colormaps to set color of line in matplotlib

How does one set the color of a line in matplotlib with scalar values provided at run time using a colormap (say jet)? I tried a couple of different approaches here and I think I'm stumped. values[] i..

How do I add a library (android-support-v7-appcompat) in IntelliJ IDEA

I created a project, copied the resource files in the project, library, added it to the project structure, prescribed style Theme.AppCompat. Compiled without errors, but when you start the relegation ..

How to convert Calendar to java.sql.Date in Java?

Calendar cal; String sql = "INSERT INTO ttable (dt) values (?);" //dt is a dateTime field in ttable PreparedStatement stmt = connection.prepareStatement(sql); stmt = setDate(1,cal); //not working s..

Is there an addHeaderView equivalent for RecyclerView?

I'm looking for an equivalent to addHeaderView for a recycler view. Basically I want to have an image with 2 buttons be added as a header to the listview. Is there a different way to add a header view..

error: expected primary-expression before ')' token (C)

I am trying to call a function named characterSelection(SDL_Surface *screen, struct SelectionneNonSelectionne sel) which returns a void This is the .h of the function I try to call: struct Selectionne..

VB.NET Inputbox - How to identify when the Cancel Button is pressed?

I have a simple windows application that pops up an input box for users to enter in a date to do searches. How do I identify if the user clicked on the Cancel button, or merely pressed OK without e..

Tomcat - maxThreads vs maxConnections

In Tomcat server.xml what is maxThreads versus maxConnections I understand that maxConnections is the number of connections open to the server And maxThreads is the maximum number of request process..

Best way to get value from Collection by index

What is the best way to get value from java.util.Collection by index?..

What's the difference between an element and a node in XML?

I'm working in Java with XML and I'm wondering; what's the difference between an element and a node?..

Hibernate: failed to lazily initialize a collection of role, no session or session was closed

My code: @Test public void testAddRoleAndAddUser() { Role r = roleDao.findByProperty("name", "admin"); if(r == null) { r = new Role(); r.setName("admin"); r.setDe..

How to add a RequiredFieldValidator to DropDownList control?

I have a DropDownList binded with aSqlDataSource to display the values from the database. I am unable to validate using a RequiredFieldValidator...

Drawing circles with System.Drawing

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

What is the difference between absolute and relative xpaths? Which is preferred in Selenium automation testing?

What is the difference between absolute and relative xpaths? Which is preferred in Selenium automation testing? I am preparing test scripts using Selenium and Robot framework...

Cannot kill Python script with Ctrl-C

I am testing Python threading with the following script: import threading class FirstThread (threading.Thread): def run (self): while True: print 'first' class SecondThread ..

Should I use the datetime or timestamp data type in MySQL?

Would you recommend using a datetime or a timestamp field, and why (using MySQL)? I'm working with PHP on the server side...

How do I use Assert to verify that an exception has been thrown?

How do I use Assert (or other Test class?) to verify that an exception has been thrown? ..

How to compare objects by multiple fields

Assume you have some objects which have several fields they can be compared by: public class Person { private String firstName; private String lastName; private String age; /* Const..

How do you convert a jQuery object into a string?

How do you convert a jQuery object into a string?..

Is there a way to add/remove several classes in one single instruction with classList?

So far I have to do this: elem.classList.add("first"); elem.classList.add("second"); elem.classList.add("third"); While this is doable in jQuery, like this $(elem).addClass("first second third"); ..

Compiling an application for use in highly radioactive environments

We are compiling an embedded C++ application that is deployed in a shielded device in an environment bombarded with ionizing radiation. We are using GCC and cross-compiling for ARM. When deployed, our..

How to insert 1000 rows at a time

I made Wpf appliaction. I want to test it with 1000 values in grid. I want to check that whether my grid will load 1000 data records fastly or not. So how to write one query to insert more than 1000 r..

I cannot access tomcat admin console?

I am try to build an app with the integration of JPA and Struts. to do it need to access tomcat manager. But when I access URL http://localhost:8080/manager/html it gives 404 Error to me. My tomcat-..

Sending email from Command-line via outlook without having to click send

I need to send email via command-line without any human interactions for automation. I know we can use mailto command but that would compose email, subject,body and everything but it wouldn't send it..

How to unescape HTML character entities in Java?

Basically I would like to decode a given Html document, and replace all special chars, such as "&nbsp;" -> " ", "&gt;" -> ">". In .NET we can make use of HttpUtility.HtmlDecode. What's t..

How to count the number of occurrences of an element in a List

I have an ArrayList, a Collection class of Java, as follows: ArrayList<String> animals = new ArrayList<String>(); animals.add("bat"); animals.add("owl"); animals.add("bat"); animals.add("..

Sending data back to the Main Activity in Android

I have two activities: main activity and child activity. When I press a button in the main activity, the child activity is launched. Now I want to send some data back to the main screen. I used the ..

figure of imshow() is too small

I'm trying to visualize a numpy array using imshow() since it's similar to imagesc() in Matlab. imshow(random.rand(8, 90), interpolation='nearest') The resulting figure is very small at the center ..

How can I escape white space in a bash loop list?

I have a bash shell script that loops through all child directories (but not files) of a certain directory. The problem is that some of the directory names contain spaces. Here are the contents of..

How to List All Redis Databases?

I ran this command to access my redis server. telnet 127.0.0.1 6379 What is the command to show all of my databases?..

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

Returning a boolean value in a JavaScript function

I am doing a client side form validation to check if passwords match. But the validation function always returns undefined. function validatePassword(errorMessage) { var password = document.getEle..

Pie chart with jQuery

I want to create a pie chart in JavaScript. On searching I found the Google Charts API. Since we are using jQuery I found that there is jQuery integration for Google Charts available. But my problem..

Selecting all text in HTML text input when clicked

I have the following code to display a textbox in a HTML webpage. <input type="text" id="userid" name="userid" value="Please enter the user ID" /> When the page displays, the text contains th..

In Ruby on Rails, what's the difference between DateTime, Timestamp, Time and Date?

In my experience, getting dates/times right when programming is always fraught with danger and difficulity. Ruby and Rails have always eluded me on this one, if only due to the overwhelming number o..

Embedding VLC plugin on HTML page

I have a html file (getStream.html) that takes a stream from a certain url and show it. The code is the following: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org..

Postgresql tables exists, but getting "relation does not exist" when querying

I have a postgresql db with a number of tables. If I query: SELECT column_name FROM information_schema.columns WHERE table_name="my_table"; I will get a list of the columns returned properly. How..

Installing tkinter on ubuntu 14.04

I want to run python code on Ubuntu 14.04, but when I execute it, it gives me the following error message Traceback (most recent call last): File "main.py", line 2, in <module> from tkint..

Check if a value is in an array (C#)

How do I check if a value is in an array in C#? Like, I want to create an array with a list of printer names. These will be fed to a method, which will look at each string in turn, and if the string..

How can I alias a default import in JavaScript?

Using ES6 modules, I know I can alias a named import: import { foo as bar } from 'my-module'; And I know I can import a default import: import defaultMember from 'my-module'; I'd like to alias a def..

How to store command results in a shell variable?

I want to find out the number of directories and files in home directory and store that in a shell variable. I am using the following set of commands. command="ls -l | grep -c \"rahul.*patle..

How to remove undefined and null values from an object using lodash?

I have a Javascript object like: var my_object = { a:undefined, b:2, c:4, d:undefined }; How to remove all the undefined properties? False attributes should stay...

How to hide element label by element id in CSS?

Let's say I've got this code <table> <tr> <td><input id="foo" type="text"></td> <td><label for="foo">This is foo</label></td>..

ssh: Could not resolve hostname [hostname]: nodename nor servname provided, or not known

I am trying to set up a VPN with a Raspberry Pi, and the first step is gaining the ability to ssh into the device from outside my local network. For whatever reason, this is proving to be impossible a..

Scanner is skipping nextLine() after using next() or nextFoo()?

I am using the Scanner methods nextInt() and nextLine() for reading input. It looks like this: System.out.println("Enter numerical value"); int option; option = input.nextInt(); // Read numeric..

Unbound classpath container in Eclipse

I have checked out a project using Subversive for Eclipse and I am getting the following errors: The project cannot be built until build path errors are resolved Unbound classpath container: 'JRE Sy..

How to connect Robomongo to MongoDB

I am have MongoDB and Robomongo in my running system, and I am using Robomongo as the client. I have installed MongoDB on a different system which I am treating as server, and I want to connect Robomo..

What are the differences between virtual memory and physical memory?

I am often confused with the concept of virtualization in operating systems. Considering RAM as the physical memory, why do we need the virtual memory for executing a process? Where does this virtual..

How to bring back "Browser mode" in IE11?

UPDATE: The old question applies only to IE11 preview; browser mode had returned in final release of IE11. But there is a catch: it is next to useless, because it does not emulate conditional comments..

PHP: Call to undefined function: simplexml_load_string()

I am implementing facebook count function using cron file. In which cron runs every 10 minutes and counts the total likes of a page. for($i=0;$i<3;$i++){ $source_url =$cars[$i]; $rest_url ..

How to draw a custom UIView that is just a circle - iPhone app

How would I go about drawing a custom UIView that is literally just a ball (a 2D circle)? Would I just override the drawRect method? And can someone show me the code for drawing a blue circle? Also,..

Copy and paste content from one file to another file in vi

I am working with two files, and I need to copy a few lines from one file and paste into another file. I know how to copy (yy) and paste (p) in the same file. But that doesn't work for different files..

How to rename files and folder in Amazon S3?

Is there any function to rename files and folders in Amazon S3? Any related suggestions are also welcome...

"unrecognized import path" with go get

I'm trying to install a web.go, but running go get github.com/hoisie/web returns package bufio: unrecognized import path "bufio" package bytes: unrecognized import path "bytes" package crypto/rand: u..

What resources are shared between threads?

Recently, I have been asked a question in an interview what's the difference between a process and a thread. Really, I did not know the answer. I thought for a minute and gave a very weird answer. T..

How to get Android GPS location

Cheers, I'm trying to get the current GPS-Location via Android. I followed this Tutorial and Vogellas article aswell. Though it ain't working. When using LocationManager.NETWORK_PROVIDER I'm always ge..

Print PHP Call Stack

I'm looking for a way to print the call stack in PHP. Bonus points if the function flushes the IO buffer...

Importing data from a JSON file into R

Is there a way to import data from a JSON file into R? More specifically, the file is an array of JSON objects with string fields, objects, and arrays. The RJSON Package isn't very clear on how to dea..

Programmatically scroll to a specific position in an Android ListView

How can I programmatically scroll to a specific position in a ListView? For example, I have a String[] {A,B,C,D....}, and I need to set the top visible item of the ListView to the index 21 of my Stri..

Access images inside public folder in laravel

How can I access the images stored inside public/images folder without the use of Laravel's own functions like assets()? I just want to get the direct URL of the images stored in images folder. Eg:..

WampServer: php-win.exe The program can't start because MSVCR110.dll is missing

if I try to install WampServer the above error appears. I already tried to install all the programs which were recommended, for example here: WAMP shows error 'MSVCR100.dll' is missing when in..

How to list containers in Docker

There's a command to list images, docker images, but there doesn't seem to be a corresponding docker containers. Other than becoming root and looking into /var/lib/docker there doesn't seem a way to ..

How to "wait" a Thread in Android

private void startGameTimeElapseThread(){ new Thread(new Runnable() { Date d = new Date(); public void run() { while (gameOn){ Log.d(TAG,""+d.getTime()+..

Generate a heatmap in MatPlotLib using a scatter data set

I have a set of X,Y data points (about 10k) that are easy to plot as a scatter plot but that I would like to represent as a heatmap. I looked through the examples in MatPlotLib and they all seem to a..

Unable to set variables in bash script

I am attempting to automate moving files from a folder to a new folder automatically every night using a bash script run from AppleScript on a schedule. I am attempting to write a bash script on Mac O..

How to make HTML input tag only accept numerical values?

I need to make sure that a certain <input> field only takes numbers as value. The input is not part of a form. Hence it doesn't get submitted, so validating during submission is not an option. I..

Evaluate expression given as a string

I'm curious to know if R can use its eval() function to perform calculations provided by e.g. a string. This is a common case: eval("5+5") However, instead of 10 I get: [1] "5+5" Any solution?..

How do I use select with date condition?

In sqlserver, how do I compare dates? For example: Select * from Users where RegistrationDate >= '1/20/2009' (RegistrationDate is datetime type) Thanks..

Convert string into Date type on Python

I have this string: '2012-02-10' # (year-month-day) and I need it to be as date type for me to use the date function isoweekday(). Does anyone know how I can convert this string into a date?..

Reset C int array to zero : the fastest way?

Assuming that we have a T myarray[100] with T = int, unsigned int, long long int or unsigned long long int, what is the fastest way to reset all its content to zero (not only for initialization but to..

jQuery Ajax requests are getting cancelled without being sent

I am trying to hook up a script to Microsoft's World-Wide Telescope app. The latter listens on port 5050 for commands. It is running on the same machine as the browser (Chrome right now, but as far as..

isPrime Function for Python Language

So I was able to solve this problem with a little bit of help from the internet and this is what I got: def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False..

Using ADB to capture the screen

I'm trying to get a screenshot of the phone screen as fast as possible. Currently, I am doing: adb shell screencap -p /sdcard/screencap.png && adb pull /sdcard/screencap.png Howeve..

Difference between application/x-javascript and text/javascript content types

What is the difference between these headers? Content-Type: application/javascript Content-Type: application/x-javascript Content-Type: text/javascript Which one is best and why? Please do not say..

Is it possible to stop JavaScript execution?

Is it possible in some way to stop or terminate JavaScript in a way that it prevents any further JavaScript-based execution from occuring, without reloading the browser? I am thinking of a JavaScript..

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

How can I strip first X characters from string using sed?

I am writing shell script for embedded Linux in a small industrial box. I have a variable containing the text pid: 1234 and I want to strip first X characters from the line, so only 1234 stays. I have..

Tools to generate database tables diagram with Postgresql?

Are there any free tools to generate tables diagrams with Postgresql?..

Phone: numeric keyboard for text input

Is there a way to force the number keyboard to come up on the phone for an <input type="text">? I just realized that <input type="number"> in HTML5 is for “floating-point numbers”, so ..

MySQL string replace

I have a column containing urls (id, url): http://www.example.com/articles/updates/43 http://www.example.com/articles/updates/866 http://www.example.com/articles/updates/323 http://www.example.com/ar..

How can I use JQuery to post JSON data?

I would like to post Json to a web service on the same server. But I don't know how to post Json using JQuery. I have tried with this code: $.ajax({ type: 'POST', url: '/form/', data: {"n..

How do I split a string in Rust?

From the documentation, it's not clear. In Java you could use the split method like so: "some string 123 ffd".split("123"); ..

Importing modules from parent folder

I am running Python 2.5. This is my folder tree: ptdraft/ nib.py simulations/ life/ life.py (I also have __init__.py in each folder, omitted here for readability) How do I import th..

Javascript: Uncaught TypeError: Cannot call method 'addEventListener' of null

I'm trying to do something fairly simple, but for the reason of me probably not being good enough to search documentation, I can't get this to work. I have a functioning inline JS that looks like thi..

Return Bit Value as 1/0 and NOT True/False in SQL Server

I have a Table in SQL Server 2000 with BitValue Column. But, it is being displayed as True/False in SQL Server Management Studio. When I do a Select * from Tablename it returns the BitValue Column val..

java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient

I have Hadoop 2.7.1 and apache-hive-1.2.1 versions installed on ubuntu 14.0. Why this error is occurring ? Is any metastore installation required? When we typing hive command on terminal how the xm..

How to check for the type of a template parameter?

Suppose I have a template function and two classes class animal { } class person { } template<class T> void foo() { if (T is animal) { kill(); } } How do I do the check for T is anim..

How to stop docker under Linux

My version of OS Ubuntu 16.04. I want to stop docker, so I run in the terminal: sudo systemctl stop docker But this commands doesn't help me: gridsim1103 ~: ps ax | grep docker 11347 ? Sl ..

laravel-5 passing variable to JavaScript

is there any ways that JavaScript can get the variable from compact controller Laravel-5. Example: I have the code below: $langs = Language::all(); return View::make('NAATIMockTest.Admin.Langu..

combining results of two select statements

I'm using T-SQL with ASP.NET, and c# and i'm pretty new to SQL. I was wondering how i could combine the results of two queries Query1: SELECT tableA.Id, tableA.Name, [tableB].Username AS Owner, [t..

Why does JSON.parse fail with the empty string?

Why does: JSON.parse(''); produce an error? Uncaught SyntaxError: Unexpected end of input Wouldn't it be more logical if it just returned null? EDIT: This is not a duplicate of the linked question. ..

How can I select all options of multi-select select box on click?

This is my HTML <select name="countries" id="countries" MULTIPLE size="8"> <option value="UK">UK</option> <option value="US">US</option> <option value="Canad..

subtract time from date - moment js

I have for instance this datetime: 01:20:00 06-26-2014 and I want to subtract a time like this: 00:03:15 after that I'd like to format the result like this: 3 hours and 15 minutes earlier. Ho..

R: Comment out block of code

Possible Duplicate: R: Multiline Comment Workarounds? I want to comment out several lines of code in R. Is there any way of doing it without having to put a # before each line - sort of lik..

Fixed header, footer with scrollable content

How can I get fixed header, footer with scrollable content? Something like this page. I can look at the source to get the CSS, but I just want to know minimum CSS and HTML I need to get this working. ..