Questions Tagged with #Each

An iterator function or language struct which can be used to iterate over arrays or lists.

C++ for each, pulling from vector elements

I am trying to do a foreach on a vector of attacks, each attack has a unique ID say, 1-3. The class method takes the keyboard input of 1-3. I am trying to use a foreach to run through my elements in..

jQuery looping .each() JSON key/value not working

I am having problems in looping the key/value of JSON by jQuery .each() function Initially I have a JSON like this: json = {"aaa":[ {"id":"1","data":"aaa1data"} ,{"id":"2..

Jquery each - Stop loop and return object

Can anybody tell me why the loop did not stop after the 5 entry? http://jsbin.com/ucuqot/edit#preview $(document).ready(function() { someArray = new Array(); someArray[0] = 't5'; someArray[1..

jQuery, get ID of each element in a class using .each?

I'm trying this to get the id of each element in a class but instead it's alerting each name of the class separately, so for class="test" it's alerting: t, e, s, t... Any advice on how to get the each..

jQuery 'each' loop with JSON array

I'm trying to use jQuery's each loop to go through this JSON and add it to a div named #contentHere. The JSON is as follows: { "justIn": [ { "textId": "123", "text": "Hello", "textType": "Greeting"..

Invoking a jQuery function after .each() has completed

In jQuery, is it possible to invoke a callback or trigger an event after an invocation of .each() (or any other type of iterative callback) has completed. For example, I would like this "fade and rem..

How to iterate over array of objects in Handlebars?

This might seem a silly question but I can't seem to find the answer anywhere. I'm hitting this Web API that returns an array of objects in JSON format: Handlebars docs shows the following example..

jquery $.each() for objects

<script> $(document).ready(function() { var data = { "programs": [ { "name":"zonealarm", "price":"500" }, { "name":"kaspersky", "price":"200" } ] }; $.each(data.programs[0], ..

How to parse JSON array in jQuery?

EDIT I checked the jQuery documentation and using $.ajax with the json datatype specified returns an evaluated javascript object, so eval() isn't the answer here. I knew that anyway, since I am able ..

Excel VBA For Each Worksheet Loop

I am working on code to basically go through each sheet in my Workbook, and then update column widths. Below is the code I wrote; I don't receive any errors, but it also doesn't actually do anything. ..

Get href attribute on jQuery

I have some table rows <tr class="b_row"> <td> <div class="cpt"> <h2> <a href="/ref/ref/1.html">example</a> <..

Nested jQuery.each() - continue/break

Consider the following code: var sentences = [ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'Vivamus aliquet nisl quis velit ornare tempor.', 'Cras sit amet..

"for" vs "each" in Ruby

I just had a quick question regarding loops in Ruby. Is there a difference between these two ways of iterating through a collection? # way 1 @collection.each do |item| # do whatever end # way 2 fo..

jQuery '.each' and attaching '.click' event

I am not a programer but I enjoy building prototypes. All of my experience comes from actionScript2. Here is my question. To simplify my code I would like to figure out how to attach '.click' events ..

Last element in .each() set

I have an issue, where by I am doing a simple form validation, that needs some custom stuff that the validation plugin could not do for me. Basically, I have a name, email and message field, all are r..

JQuery $.each() JSON array object iteration

I am having some real difficulty attempting to solve a JQuery $.each() iteration This is my array, limiting results for convenience [{"GROUP_ID":"143", "GROUP_TYPE":"2011 Season", "EVENTS":[ ..

jQuery .each() with input elements

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

jQuery.each - Getting li elements inside an ul

I have this HTML on my page: <div class="phrase"> <ul class="items"> <li class="agap"><ul><li>TEXT1</li></ul></li> <li class="ag..

jQuery .each() index?

I am using $('#list option').each(function(){ //do stuff }); to loop over the options in a list. I am wondering how I could get the index of the current loop? as I dont want to have to have var i..

jQuery animated number counter from zero to value

I have created a script to animate a number from zero to it's value. Working jQuery _x000D_ _x000D_ $({ Counter: 0 }).animate({_x000D_ Counter: $('.Single').text()_x000D_ }, {_x000D_ duration: ..

How to use continue in jQuery each() loop?

In my application i am using AJAX call. I want to use break and continue in this jQuery loop. $('.submit').filter(':checked').each(function() { }); ..

jQuery each loop in table row

I am having something like: <table id="tblOne"> <tbody> <tr> <td> <table id="tblTwo"> ..

How do I loop through or enumerate a JavaScript object?

I have a JavaScript object like the following: var p = { "p1": "value1", "p2": "value2", "p3": "value3" }; Now I want to loop through all p elements (p1, p2, p3...) And get their keys a..

Best way to test if a row exists in a MySQL table

I'm trying to find out if a row exists in a table. Using MySQL, is it better to do a query like this: SELECT COUNT(*) AS total FROM table1 WHERE ... and check to see if the total is non-zero or is ..

File upload from <input type="file">

Using angular 2 beta, I cannot seem to get an <input type="file"> to work. Using diagnostic, I can see two-way binding for other types such as text. <form> {{diagnostic}} <div..

Resolving instances with ASP.NET Core DI from within ConfigureServices

How do I manually resolve a type using the ASP.NET Core MVC built-in dependency injection framework? Setting up the container is easy enough: public void ConfigureServices(IServiceCollection service..

Simple If/Else Razor Syntax

I'm trying to do a simple If/Else within a foreach with this code: @{ var count = 0; foreach (var item in Model) { if (count++ % 2 == 0) { @:<tr class="alt-row"> } else { ..

jQuery find and replace string

I have somewhere on website a specific text, let's say "lollypops", and I want to replace all the occurrences of this string with "marshmellows". The problem is that I don't know where exactly the tex..

How to upload & Save Files with Desired name

i am using this code to upload files(images to a folder) <form action='' method='POST' enctype='multipart/form-data'> <input type='file' name='userFile'><br> <input type='submit'..

RegEx to exclude a specific string constant

Can regular expression be utilized to match any string except a specific string constant let us say "ABC" ? Is this possible to exclude just one specific string constant? Thanks your help in advance...

Removing MySQL 5.7 Completely

I am trying to uninstall mysql from my ubuntu 12.04 completely. But not able to. I tried a lot of commands. But nothing is working. Can anyone help out here! sudo apt-get remove mysql-server mysql-c..

Is False == 0 and True == 1 an implementation detail or is it guaranteed by the language?

Is it guaranteed that False == 0 and True == 1, in Python (assuming that they are not reassigned by the user)? For instance, is it in any way guaranteed that the following code will always produce th..

Write HTML string in JSON

Is it possible to write an HTML string inside JSON? Which I want to write like below in my JSON file: [ { "id": "services.html", "img": "img/SolutionInnerbananer.jpg", "h..

Solution to "subquery returns more than 1 row" error

I have one query that returns multiple rows, and another query in which I want to set criteria to be either one of values from those multiple rows , so basicly I want the subquery to look something li..

Java Reflection: How to get the name of a variable?

Using Java Reflection, is it possible to get the name of a local variable? For example, if I have this: Foo b = new Foo(); Foo a = new Foo(); Foo r = new Foo(); is it possible to implement a metho..

TypeError: 'undefined' is not a function (evaluating '$(document)')

I'm using a WordPress site. I'm including this script in the header. When the script loads, I get this error: TypeError: 'undefined' is not a function (evaluating '$(document)') I have no ide..

What does git rev-parse do?

What does git rev-parse do? I have read the man page but it raised more questions than answers. Things like: Pick out and massage parameters Massage? What does that mean? I'm using as a resolv..

Convert YYYYMMDD string date to a datetime value

Possible Duplicate: Convert string to DateTime in c# A question I got a string value that actually get from directoryInfo. What i wanted to accomplish is to convert the string value to a d..

Share cookie between subdomain and domain

I have two questions. I understand that if I specify the domain as .mydomain.com (with the leading dot) in the cookie that all subdomains can share a cookie. Can subdomain.mydomain.com access a cooki..

How can I specify a branch/tag when adding a Git submodule?

How does git submodule add -b work? After adding a submodule with a specific branch, a new cloned repository (after git submodule update --init) will be at a specific commit, not the branch itself (g..

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

How to re-index all subarray elements of a multidimensional array?

The question is how to reset key e.g. for an array: Array ( [1_Name] => Array ( [1] => leo [4] => NULL ) [1_Phone] => Array ( [1] => 12345 ..

MySQL Trigger after update only if row has changed

Is there any possibility to use an "after update" trigger only in the case the data has been REALLY changed. I know of "NEW and OLD". But when using them I'm only able to compare columns. For example ..

What is the "right" way to iterate through an array in Ruby?

PHP, for all its warts, is pretty good on this count. There's no difference between an array and a hash (maybe I'm naive, but this seems obviously right to me), and to iterate through either you just ..

:before and background-image... should it work?

I've got a div and apply :before and :after an image as content. That works perfectly. Now I would need to apply a background image so it does repeat as the div resizes, but it does not seem to work. ..

Open an image using URI in Android's default gallery image viewer

I have extracted image uri, now I would like to open image with Android's default image viewer. Or even better, user could choose what program to use to open the image. Something like File Explorers o..

psql: server closed the connection unexepectedly

I've been trying to run this batch file that goes through the Postgre DB Server and run two different sql files, as shown below: set PGPASSWORD=blah cls @echo on "C:\Progra~1\pgAdmin III\1.16\psql" -..

What is the correct way to represent null XML elements?

I have seen null elements represented in several ways: The element is present with xsi:nil="true": <book> <title>Beowulf</title> <author xsi:nil="true"/> </boo..

how do I give a div a responsive height

I'm stating to learn responsive design, but there's one thing I can't seem to figure out, so far... Here's a working example: http://ericbrockmanwebsites.com/dev1/ I'd like the div element (contactB..

Command output redirect to file and terminal

I am trying to throw command output to file plus console also. This is because i want to keep record of output in file. I am doing following and it appending to file but not printing ls output on term..

Regex empty string or email

I found a lot of Regex email validation in SO but I did not find any that will accept an empty string. Is this possible through Regex only? Accepting either empty string or email only? I want to hav..

Comparing arrays in C#

I am trying to compare two arrays with each other. I tried this code and got the following errors. static bool ArraysEqual(Array a1, Array a2) { if (a1 == a2) return true; if (a1 == ..

Convert absolute path into relative path given a current directory using Bash

Example: absolute="/foo/bar" current="/foo/baz/foo" # Magic relative="../../bar" How do I create the magic (hopefully not too complicated code...)?..

How to resolve 'npm should be run outside of the node repl, in your normal shell'

I am new to node.js. I downloaded and install node.js installer from the official site. I have added this installer folder in PATH environment variable and I am able to run programs. But when I try to..

How to leave/exit/deactivate a Python virtualenv

I'm using virtualenv and the virtualenvwrapper. I can switch between virtualenv's just fine using the workon command. me@mymachine:~$ workon env1 (env1)me@mymachine:~$ workon env2 (env2)me@mymachine..

How to select all checkboxes with jQuery?

I need help with jQuery selectors. Say I have a markup as shown below: _x000D_ _x000D_ <form>_x000D_ <table>_x000D_ <tr>_x000D_ <td><input type="checkbox" id="s..

Read a HTML file into a string variable in memory

If I have a HTML file on disk, How can I read it all at once in to a String variable at run time? Then I need to do some processing on that string variable. Some html file like this: <html> ..

Docker - Ubuntu - bash: ping: command not found

I've got a Docker container running Ubuntu which I did as follows: docker run -it ubuntu /bin/bash however it doesn't seem to have ping. E.g. bash: ping: command not found Do I need to install t..

What's the shebang/hashbang (#!) in Facebook and new Twitter URLs for?

I've just noticed that the long, convoluted Facebook URLs that we're used to now look like this: http://www.facebook.com/example.profile#!/pages/Another-Page/123456789012345 As far as I can recall, ..

How to get ASCII value of string in C#

I want to get the ASCII value of characters in a string in C#. If my string has the value "9quali52ty3", I want an array with the ASCII values of each of the 11 characters. How can I get ASCII value..

Xpath for href element

I need to click on the below href element,which is present among similar href elements. <a id="oldcontent" href="listDetails.do?camp=1865"><u>Re-Call</u></a> Can anyone prov..

Oracle SQL: Update a table with data from another table

Table 1: id name desc ----------------------- 1 a abc 2 b def 3 c adf Table 2: id name desc ----------------------- 1 x 123 2 y 345 ..

Align button at the bottom of div using CSS

I want to align my button at the bottom right corner of my div. How can I do that? Current css of div: float: right; width: 83%; margin-right: 0px; font-family: Arial, Helvetica, s..

Removing element from array in component state

I am trying to find the best way to remove an element from an array in the state of a component. Since I should not modify the this.state variable directly, is there a better way (more concise) to re..

How to remove a web site from google analytics

I am Administrator of several web sites on google analytics. Can i delete some of them? If yes, how? Many of you suggested me to remove my profile. So my doubts are: 1. I am administrator ..

Why use pip over easy_install?

A tweet reads: Don't use easy_install, unless you like stabbing yourself in the face. Use pip. Why use pip over easy_install? Doesn't the fault lie with PyPI and package authors mostly? If ..

How to check Spark Version

I want to check the spark version in cdh 5.7.0. I have searched on the internet but not able to understand. Please help...

how to check if input field is empty

I'm making a form with inputs, if the input type is empty then the button submit is disabled but, if the input fields is with length > 0 the submit button is enabled <input type='text' id='spa' on..

PHP simple foreach loop with HTML

I am wondering if it will work best to actually write the following for example: <table> <?php foreach($array as $key=>$value){ ?> <tr> <td><?php echo $k..

Check if Variable is Empty - Angular 2

How can one check if a variable is empty in Angular 2? I know that there are native ways such as if (myVar === null) {do stuff} but I am looking for something like Angular 1 had such as if (angu..

Extract Month and Year From Date in R

I have tried a number of methods to no avail. I have data in terms of a date (YYYY-MM-DD) and am trying to get in terms of just the month and year, such as: MM-YYYY or YYYY-MM. Ultimately, I would li..

Counting DISTINCT over multiple columns

Is there a better way of doing a query like this: SELECT COUNT(*) FROM (SELECT DISTINCT DocumentId, DocumentSessionId FROM DocumentOutputItems) AS internalQuery I need to count the number of..

Calculate rolling / moving average in C++

I know this is achievable with boost as per: Using boost::accumulators, how can I reset a rolling window size, does it keep extra history? But I really would like to avoid using boost. I have google..

How do I remove the file suffix and path portion from a path string in Bash?

Given a string file path such as /foo/fizzbuzz.bar, how would I use bash to extract just the fizzbuzz portion of said string?..

Reset auto increment counter in postgres

I would like to force the auto increment field of a table to some value, I tried with this: ALTER TABLE product AUTO_INCREMENT = 1453 AND ALTER SEQUENCE product RESTART WITH 1453; ERROR: relati..

Class 'App\Http\Controllers\DB' not found and I also cannot use a new Model

I have very basic problem. In L4 thes below methods worked out of the box, so now I am lost. Please help. A few days ago I started a Laravel 5.0 project. I have now fresh, clean installation. Problem..

Validation for 10 digit mobile number and focus input field on invalid

I need the code for validating email and mobile number in jQuery and also focus() on that particular field where validations are not satisfied. This is my query <form name="enquiry_form" method=..

Installing PDO driver on MySQL Linux server

I was suggested, not long ago, to change my code to use PDO in order to parameterize my queries and safely save HTML in the database. Well, here are the main problems: I looked at http://php.net/ma..

How do I create a GUI for a windows application using C++?

I am deciding on how to develop a GUI for a small c++/win32 api project (working Visual Studio C++ 2008). The project will only need a few components to start off the main process so it will be very l..

json_encode sparse PHP array as JSON array, not JSON object

I have the following array in PHP: Array ( [0] => Array ( [id] => 0 [name] => name1 [short_name] => n1 ) [2] => Array ..

What's the difference between "Request Payload" vs "Form Data" as seen in Chrome dev tools Network tab

I have an old web application I have to support (which I did not write). When I fill out a form and submit then check the "Network" tab in Chrome I see "Request Payload" where I would normally see "F..

For vs. while in C programming?

There are three loops in C: for, while, and do-while. What's the difference between them? For example, it seems nearly all while statements can be replaced by for statements, right? Then, what's the ..

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

Easiest way to copy a single file from host to Vagrant guest?

I have a use case where I occasionally want to copy a single file from my host machine to the Vagrant guest. I don't want to do so via traditional provisioners (Puppet / Chef) because this is often a..

What to put in a python module docstring?

Ok, so I've read both PEP 8 and PEP 257, and I've written lots of docstrings for functions and classes, but I'm a little unsure about what should go in a module docstring. I figured, at a minimum, it..

Fatal error: Maximum execution time of 30 seconds exceeded

I am downloading a JSON file from an online source and and when it runs through the loop I am getting this error: Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\temp\fet..

Apply style ONLY on IE

Here is my block of CSS: .actual-form table { padding: 5px 0 15px 15px; margin: 0 0 30px 0; display: block; width: 100%; background: #f9f9f9; border-top: 1px solid #d0d0d0; border-botto..

How to check if an element is in an array

In Swift, how can I check if an element exists in an array? Xcode does not have any suggestions for contain, include, or has, and a quick search through the book turned up nothing. Any idea how to che..

How do I generate a random int number?

How do I generate a random integer in C#?..

How do I use $rootScope in Angular to store variables?

How do I use $rootScope to store variables in a controller I want to later access in another controller? For example: angular.module('myApp').controller('myCtrl', function($scope) { var a = //somet..

How to use PHP OPCache?

PHP 5.5 has been released and it features a new code caching module called OPCache, but there doesn't appear to be any documentation for it. So where is the documentation for it and how do I use OPc..

jQuery post() with serialize and extra data

I'm trying to find out if it's possible to post serialize() and other data that's outside the form. Here's what I thought would work, but it only sends 'wordlist' and not the form data. $.post("page..

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

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

How to delete a record by id in Flask-SQLAlchemy

I have users table in my MySql database. This table has id, name and age fields. How can I delete some record by id? Now I use the following code: user = User.query.get(id) db.session.delete(user) ..

Add to python path mac os x

I thought import sys sys.path.append("/home/me/mydir") is appending a dir to my pythonpath if I print sys.path my dir is in there. Then I open a new command and it is not there anymore. But some..

What is the largest TCP/IP network port number allowable for IPv4?

What is the highest port number one can use?..

Android: disabling highlight on listView click

I want to disable the orange highlight that occurs when touching a listView row. So far in my xml I have tried the following: android:focusable="false" android:focusableInTouchMode="false" android:cl..

String to char array Java

I am stumped on this and I need some fresh eyes, I'm not sure why this code is doing this. String string = new String(new char[] {(char) 0x01, (char) 0x02, ... ,(char) 0xFC}); The output is everyth..

How can I get form data with JavaScript/jQuery?

Is there a simple, one-line way to get the data of a form as it would be if it was to be submitted in the classic HTML-only way? For example: <form> <input type="radio" name="foo" value..

pull out p-values and r-squared from a linear regression

How do you pull out the p-value (for the significance of the coefficient of the single explanatory variable being non-zero) and R-squared value from a simple linear regression model? For example... x..

Mask for an Input to allow phone numbers?

Is it possible to have model-driven form in Angular 2 and implement a directive that would allow to mask an input field like a phone number entry (123) 123-4567?..

how to destroy bootstrap modal window completely?

I've made use of modal window for a wizard implementation which has around 4,5 steps. I need to destroy it completely after the last step(onFinish) and OnCancel step without having a page refresh. I c..

In Python, how do I create a string of n characters in one line of code?

I need to generate a string with n characters in Python. Is there a one line answer to achieve this with the existing Python library? For instance, I need a string of 10 letters: string_val = 'abcd..

How can one run multiple versions of PHP 5.x on a development LAMP server?

I need to test my PHP applications with multiple versions of PHP 5.x, such as PHP 5.0.0 and PHP 5.2.8. Is there a way that I can configure a development LAMP server so I can quickly test applications..

Return value of x = os.system(..)

When I type os.system("whoami") in Python, as root, it returns root, but when I try to assign it to a variable x = os.system("whoami") it set's the value of x to 0. Why ? (: ..

Android Fatal signal 11 (SIGSEGV) at 0x636f7d89 (code=1). How can it be tracked down?

I've been reading the other posts on tracking down the reasons for getting a SIGSEGV in an Android app. I plan to scour my app for possible NullPointers related to Canvas use, but my SIGSEGV barfs up ..

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

How to create web service (server & Client) in Visual Studio 2012? like being done before 2012 as http://www.tutorialspoint.com/asp.net/asp.net_web_services.htm..

LaTeX "\indent" creating paragraph indentation / tabbing package requirement?

The LaTeX code provided below shows the usage of the command "\indent" as it appears in the document, but it does not produce the desired indentation within the document. Is there a specific package a..

Lightweight Javascript DB for use in Node.js

Anybody know of a lightweight yet durable database, written in Javascript, that can be used with Node.js. I don't want the 'weight' of (great) solutions like Mongo or Couch. A simple, in memory JS d..

How to find a whole word in a String in java

I have a String that I have to parse for different keywords. For example, I have the String: "I will come and meet you at the 123woods" And my keywords are '123woods' 'woods' I should report when..

Cleanest way to reset forms

What is the cleanest way to reset forms in Angular 2 latest version? I would like to reset the input textboxes after adding a post. @Component({ selector: 'post-div', template: ` &l..

Is there a way to split a widescreen monitor in to two or more virtual monitors?

Like most developers I have grown to love dual monitors. I won't go into all the reasons for their goodness; just take it as a given. However, they are not perfect. You can never seem to line them up..

Styling input buttons for iPad and iPhone

I'm using CSS to style the input buttons on my website, but on IOS devices the styling is replaced by Mac's default buttons. Is there a way to style buttons for iOS, or a way to maybe make a hyperlink..

Difference between database and schema

What's the difference between a Database and a Schema in SQL Server? Both are the containers of tables and data. If a Schema is deleted, then are all the tables contained in that schema also deleted ..

How to find out the server IP address (using JavaScript) that the browser is connected to?

Is there any way you can find the IP of the server that the browser is connected to? For e.g. if the browser is accessing http://www.google.com, can we tell in any way what IP it is connected to? This..

How do you tell if caps lock is on using JavaScript?

How do you tell if caps lock is on using JavaScript? One caveat though: I did google it and the best solution I could find was to attach an onkeypress event to every input, then check each time if th..

Corrupted Access .accdb file: "Unrecognized Database Format"

I'm having a problem. One of my databases on our shared network will not open for any user. It says "Unrecognized Database Format." I've had this problem before but was still able to open the databas..

What's default HTML/CSS link color?

I need its code representation, like #FFFFFF...

How to retrieve SQL result column value using column name in Python?

Is there a way to retrieve SQL result column value using column name instead of column index in Python? I'm using Python 3 with mySQL. The syntax I'm looking for is pretty much like the Java construct..

ERROR 2003 (HY000): Can't connect to MySQL server (111)

This question is related to the following questions: Can't connect to MySQL server error 111 Trying to connect to remote MySQL host (error 2003) I am configuring a new MySQL (5.1) server on my..

How can I connect to a Tor hidden service using cURL in PHP?

I'm trying to connect to a Tor hidden service using the following PHP code: $url = 'http://jhiwjjlqpyawmpjx.onion/' $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RET..

Can Python test the membership of multiple values in a list?

I want to test if two or more values have membership on a list, but I'm getting an unexpected result: >>> 'a','b' in ['b', 'a', 'foo', 'bar'] ('a', True) So, Can Python test the membership..

Call a Class From another class

I want to call class2 from class1 but class2 doesn't have a main function to refer to like Class2.main(args); ..

Java Class that implements Map and keeps insertion order?

I'm looking for a class in java that has key-value association, but without using hashes. Here is what I'm currently doing: Add values to a Hashtable. Get an iterator for the Hashtable.entrySet(). ..

How to get the day of week and the month of the year?

I don't know much about Javascript, and the other questions I found are related to operations on dates, not only getting the information as I need it. Objective I wish to get the date as below-forma..

Getting Image from URL (Java)

I am trying to read the following image But it is showing IIOException. Here is the code: Image image = null; URL url = new URL("http://bks6.books.google.ca/books?id=5VTBuvfZDyoC&printsec=fro..

How do I assert equality on two classes without an equals method?

Say I have a class with no equals() method, to which do not have the source. I want to assert equality on two instances of that class. I can do multiple asserts: assertEquals(obj1.getFieldA(), obj2..

Excel SUMIF between dates

I have column A with date values formatted as mm/dd/yyyy. I am trying to sum the values of column B if A >=DATE(2012,1,1) AND =SUM(B:B) sums B properly, but if I try to use =SUMIF(B:B,A:A>=DATE(..

AngularJs ReferenceError: $http is not defined

I have the following Angular function: $scope.updateStatus = function(user) { $http({ url: user.update_path, method: "POST", data: {user_id: user.id, draft: true} ..

Reading file line by line (with space) in Unix Shell scripting - Issue

I want to read a file line by line in Unix shell scripting. Line can contain leading and trailing spaces and i want to read those spaces also in the line. I tried with "while read line" but read comma..

How to delete a workspace in Perforce (using p4v)?

I'm new to Perforce and have created a few workspaces as exercises for getting familiar with it. Now I would like to delete some of the workspaces. I just want to get rid of the workspaces so that the..

3D Plotting from X, Y, Z Data, Excel or other Tools

I have data that looks like this: 1000 13 75.2 1000 21 79.21 1000 29 80.02 5000 29 87.9 5000 37 88.54 5000 45 88.56 10000 29 90.11 10000 37 90.79 10000 45 90.87 I w..

How to fully clean bin and obj folders within Visual Studio?

If you right click on a folder, you will see a "Clean" menu item. I assumed this would clean (remove) the obj and bin directory. However, as far as I can see, it does nothing. Is there another way? (..

JavaScript Promises - reject vs. throw

I have read several articles on this subject, but it is still not clear to me if there is a difference between Promise.reject vs. throwing an error. For example, Using Promise.reject return asyncIsP..

SQL ON DELETE CASCADE, Which Way Does the Deletion Occur?

If I have two relations in a database, like this: CREATE TABLE Courses ( CourseID int NOT NULL PRIMARY KEY, Course VARCHAR(63) NOT NULL UNIQUE, Code CHAR(4) NOT NULL UNIQUE ); CREATE TABLE Boo..

How to check the version of GitLab?

How to check which version of GitLab is installed on the server? I am about version specified in GitLab changelog: https://gitlab.com/gitlab-org/gitlab-foss/blob/master/CHANGELOG.md For example: ..

How to get a list of column names on Sqlite3 database?

I want to migrate my iPhone app to a new database version. Since I don't have some version saved, I need to check if certain column names exist. This Stackoverflow entry suggests doing the select SE..

How do I change Bootstrap 3 column order on mobile layout?

I'm making a responsive layout with a top fixed navbar. Underneath I have two columns, one for a sidebar (3), and one for content (9). Which on desktop looks like this navbar [3][9] When I resize ..

What's the difference between SHA and AES encryption?

What's the difference between SHA and AES encryption?..

ORA-01843 not a valid month- Comparing Dates

I have a problem when try to select data from a table filtering by date. For example: SELECT * FROM MYTABLE WHERE MYTABLE.DATEIN = '23/04/49'; The Oracle Error is: Informe de error: Error SQ..

How do I cancel form submission in submit button onclick event?

I'm working on an ASP.net web application. I have a form with a submit button. The code for the submit button looks like <input type='submit' value='submit request' onclick='btnClick();'>. I ..

How to correctly catch change/focusOut event on text input in React.js?

I've got a form, in which I want to handle change event on text inputs, but React onChange triggering on key down (opposite to native JS, that triggers change event when an input field is out of focus..

Reason for Column is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause

I got an error - Column 'Employee.EmpID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. select loc.LocationID, emp.EmpID f..

Set select option 'selected', by value

I have a select field with some options in it. Now I need to select one of those options with jQuery. But how can I do that when I only know the value of the option that must be selected? I have the ..

Plain Old CLR Object vs Data Transfer Object

POCO = Plain Old CLR (or better: Class) Object DTO = Data Transfer Object In this post there is a difference, but frankly most of the blogs I read describe POCO in the way DTO is defined: DTOs are s..

jQuery: how to trigger anchor link's click event

I have a anchor link like <a id="myanchor" href="http://google.com" target="_blank">Google</a> How to open href target in a new tab programatically?..

When is it appropriate to use C# partial classes?

I was wondering if someone could give me an overview of why I would use them and what advantage I would gain in the process...

Restrict varchar() column to specific values?

Is there a way to specify, for example 4 distinct values for a varchar column in MS SQL Server 2008? For example, I need a column called Frequency (varchar) that only accepts 'Daily', 'Weekly', 'Mont..

How to reload page every 5 seconds?

I am converting one layout to html; once I make the changes in code/html/css, every time I have to hit F5. Is there any simple javascript/jQuery solution for this? I.e. after I add the script, reload ..

How can I create numbered map markers in Google Maps V3?

I'm working on a map that has multiple markers on it. These markers use a custom icon, but I'd also like to add numbers on top. I've seen how this has been accomplished using older versions of the AP..

How to parse XML using shellscript?

I would like to know what would be the best way to parse an XML file using shellscript ? Should one do it by hand ? Does third tiers library exist ? If you already made it if you could let me know..

Recursive Fibonacci

I'm having a hard time understanding why #include <iostream> using namespace std; int fib(int x) { if (x == 1) { return 1; } else { return fib(x-1)+fib(x-2); } } ..

Where can I find WcfTestClient.exe (part of Visual Studio)

The MSDN docs state that I can find the WCF Test Client in: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ but it seems like a lot of stuff is missing from there, including WcfTestCli..

Short form for Java if statement

I know there is a way for writing a Java if statement in short form. if (city.getName() != null) { name = city.getName(); } else { name="N/A"; } Does anyone know how to write the short form..

How to call Stored Procedure in Entity Framework 6 (Code-First)?

I am very new to Entity Framework 6 and I want to implement stored procedures in my project. I have a stored procedure as follows: ALTER PROCEDURE [dbo].[insert_department] @Name [varchar](100) A..

How to hide Bootstrap modal with javascript?

I've read the posts here, the Bootstrap site, and Googled like mad - but can't find what I'm sure is an easy answer... I have a Bootstrap modal that I open from a link_to helper like this: <%= li..

Database cluster and load balancing

What is database clustering? If you allow the same database to be on 2 different servers how do they keep the data between synchronized. And how does this differ from load balancing from a database se..

How to Get the HTTP Post data in C#?

I am using Mailgun API. There is a section that I need to provide a URL to them, then they are going to HTTP Post some data to me. I provide this URL (http://test.com/MailGun/Webhook.aspx) to Mailgun..

How to choose an AWS profile when using boto3 to connect to CloudFront

I am using the Boto 3 python library, and want to connect to AWS CloudFront. I need to specify the correct AWS Profile (AWS Credentials), but looking at the official documentation, I see no way to spe..

Matching an empty input box using CSS

How do I apply a style to an empty input box? If the user types something in the input field, the style should no longer be applied. Is this possible in CSS? I tried this: input[value=""] ..

How can I handle the warning of file_get_contents() function in PHP?

I wrote a PHP code like this $site="http://www.google.com"; $content = file_get_content($site); echo $content; But when I remove "http://" from $site I get the following warning: Warning: fil..

How to compare arrays in C#?

Possible Duplicate: Easiest way to compare arrays in C# How can I compare two arrays in C#? I use the following code, but its result is false. I was expecting it to be true. Array.Equals(..

How to add Date Picker Bootstrap 3 on MVC 5 project using the Razor engine?

I need some guide lines on how to install a Date Picker Bootstrap 3 on a MVC 5 project using the Razor engine. I found this link here but couldn't make it work in VS2013. Copying from the example in..

Last Key in Python Dictionary

I am having difficulty figuring out what the syntax would be for the last key in a Python dictionary. I know that for a Python list, one may say this to denote the last: list[-1] I also know that o..

Font Awesome & Unicode

I'm using (the excellent) Font-Awesome in my site, and it's working fine, if I use it this way: <i class="icon-home"></i> But (for some reasons) I want to use it in the Unicode way, lik..

JavaScript Number Split into individual digits

I am trying to solve a math problem where I take a number e.g. 45, or 111 and then split the number into separate digits e.g. 4 5 or 1 1 1. I will then save each number to a var to run a method on. Do..

How to choose the right bean scope?

I noticed that there are different bean scopes like: @RequestScoped @ViewScoped @FlowScoped @SessionScoped @ApplicationScoped What is the purpose of each? How do I choose a proper scope for my bean..

Sum one number to every element in a list (or array) in Python

Here I go with my basic questions again, but please bear with me. In Matlab, is fairly simple to add a number to elements in a list: a = [1,1,1,1,1] b = a + 1 b then is [2,2,2,2,2] In python this..

Changing Background Image with CSS3 Animations

Why this isn't working? What am I doing wrong? CSS @-webkit-keyframes test { 0% { background-image: url('frame-01.png'); } 20% { background-image: url('frame-02.png'); } 40% { ..

Java Interfaces/Implementation naming convention

How do you name different classes / interfaces you create? Sometimes I don't have implementation information to add to the implementation name - like interface FileHandler and class SqlFileHandler. W..

How to convert float to int with Java

I used the following line to convert float to int, but it's not as accurate as I'd like: float a=8.61f; int b; b=(int)a; The result is : 8 (It should be 9) When a = -7.65f, the result is : -7 ..

How to read a CSV file from a URL with Python?

when I do curl to a API call link http://example.com/passkey=wedsmdjsjmdd curl 'http://example.com/passkey=wedsmdjsjmdd' I get the employee output data on a csv file format, like: "Steve","421","0..

Basic Ajax send/receive with node.js

So I'm trying to make a very basic node.js server that with take in a request for a string, randomly select one from an array and return the selected string. Unfortunately I'm running into a few prob..

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 to commit to remote git repository

I am new to git. I have done a clone of remote repo as follows git clone https://[email protected]/repo.git then I did git checkout master made some changes and committed these changes t..

When to use an interface instead of an abstract class and vice versa?

This may be a generic OOP question. I wanted to do a generic comparison between an interface and an abstract class on the basis of their usage. When would one want to use an interface and when would..

Python conversion between coordinates

Are there functions for conversion between different coordinate systems? For example, Matlab has [rho,phi] = cart2pol(x,y) for conversion from cartesian to polar coordinates. Seems like it should be ..

Sublime Text 2 - View whitespace characters

How can Sublime Text show non printable characters (I'm interested in SPACEs and TABs)?..

Passing variables to the next middleware using next() in Express.js

Well, my question is I want to pass some variable from the first middleware to another middleware, and I tried doing this, but there was "req.somevariable is a given as 'undefined'". //app.js .. ap..

Equivalent of varchar(max) in MySQL?

What is the equivalent of varchar(max) in MySQL?..

How to compile and run C/C++ in a Unix console/Mac terminal?

How can I compile/run C or C++ in Unix console or a Mac terminal? (I know it, forget it, and relearn it again. Time to write it down.)..

How do I set a VB.Net ComboBox default value

I can not locate the correct method to make the first item in a combo box visible. The app starts with an empty combo box. The user makes a radio box selection then clicks Go! (how original). The com..

Simple Deadlock Examples

I would like to explain threading deadlocks to newbies. I have seen many examples for deadlocks in the past, some using code and some using illustrations (like the famous 4 cars). There are also class..

element with the max height from a set of elements

I have a set of div elements. In jQuery, I would like to be able to find out the div with the maximum height and also the height of that div. For instance: <div> <div class="panel"> L..

How to clear the cache in NetBeans

I created a project in NetBeans, and I would like to clear the NetBeans cache. I'm running NetBeans 7.0.1 on a Windows 7 machine. How do I do this?..

Query to count the number of tables I have in MySQL

I am growing the number of tables I have and I am sometimes curious just to do a quick command line query to count the number of tables in my database. Is that possible? If so, what is the query?..

How to undo local changes to a specific file

I'm trying to undo local changes to a specific file. Nothing has been committed. When I want to revert all changes, I can perform git revert --reset HEAD. However, in this case, I don't want to rever..

Official way to ask jQuery wait for all images to load before executing something

In jQuery when you do this: $(function() { alert("DOM is loaded, but images not necessarily all loaded"); }); It waits for the DOM to load and executes your code. If all the images are not loade..

SQL MERGE statement to update data

I've got a table with data named energydata it has just three columns (webmeterID, DateTime, kWh) I have a new set of updated data in a table temp_energydata. The DateTime and the webmeterID stay..

What is the Angular equivalent to an AngularJS $watch?

In AngularJS you were able to specify watchers to observe changes in scope variables using the $watch function of the $scope. What is the equivalent of watching for variable changes (in, for example, ..

How to compile LEX/YACC files on Windows?

I'm having Lex and YACC files to parse my files (.l file and .y file). How to compile those files and how to make equivalent .c file for them in windows platform?..

Reactjs setState() with a dynamic key name?

EDIT: this is a duplicate, see here I can't find any examples of using a dynamic key name when setting the state. This is what I want to do: inputChangeHandler : function (event) { this.se..

How can I do an UPDATE statement with JOIN in SQL Server?

I need to update this table in SQL Server with data from its 'parent' table, see below: Table: sale id (int) udid (int) assid (int) Table: ud id (int) assid (int) sale.assid contains the corr..

jQuery or Javascript - how to disable window scroll without overflow:hidden;

Hi is it possible to disable window scrolling without using overflow:hidden; when i'm hover an element? i tryed : $('.chat-content').on('mouseenter',function(){ $(document).scroll(function(e){ ..

Postgres: INSERT if does not exist already

I'm using Python to write to a postgres database: sql_string = "INSERT INTO hundred (name,name_slug,status) VALUES (" sql_string += hundred + ", '" + hundred_slug + "', " + status + ");" cursor.execu..

How to increase the vertical split window size in Vim

:vsplit (short form: :vs) split the Vim viewport vertically. :30vs splits the viewport, making the new window 30 characters wide. Once this 30 char window is created, how would one change it's size to..

How to describe table in SQL Server 2008?

I want to describe a table in SQL Server 2008 like what we can do with the DESC command in Oracle. I have table [EX].[dbo].[EMP_MAST] which I want to describe, but it does not work. Error shown: ..

What is Hash and Range Primary Key?

I am not able to understand what Range / primary key is here in the docs on Working with Tables and Data in DynamoDB How does it work? What do they mean by "unordered hash index on the hash attri..

What reference do I need to use Microsoft.Office.Interop.Excel in .NET?

I am interested in using C# to manipulate/Automate Excel files. After browsing the web I have found VSTO but it seems you can not use that in Visual Studio Express Edition so I can not use that. Jus..

Convert timestamp to string

In java I need to display 'time of the program start' It must be in String. How do I get the current time, and then convert it to a String?..

The request was rejected because no multipart boundary was found in springboot

As I am trying this with spring boot and webservices with postman chrome add-ons. In postman content-type="multipart/form-data" and I am getting the below exception. HTTP Status 500 - Request proces..

How do I download NLTK data?

Updated answer:NLTK works for 2.7 well. I had 3.2. I uninstalled 3.2 and installed 2.7. Now it works!! I have installed NLTK and tried to download NLTK Data. What I did was to follow the instrution o..

Disable developer mode extensions pop up in Chrome

Since the latest release of chrome (34.0.1847.116) last week, I have been receiving the “Disable developer mode extensions" when running automated tests using watir-webdriver. This seems to be th..

':app:lintVitalRelease' error when generating signed apk

I've tried to upload my apk on google play and encountered an error message: "You uploaded a debuggable APK. For security reasons you need to disable debugging before it can be published in Googl..

twitter-bootstrap: how to get rid of underlined button text when hovering over a btn-group within an <a>-tag?

Using the markup below, the button text is underlined when hovered over. How can I get rid of that behavior? Is there a better way to add links to a btn-group in bootstrap that avoids this behavior? ..

How can you find the height of text on an HTML canvas?

The spec has a context.measureText(text) function that will tell you how much width it would require to print that text, but I can't find a way to find out how tall it is. I know it's based on the fon..

Post values from a multiple select

How can I post values from a multiple select in a form? When I hit submit none of the selected values are posted. <form id="form" action="" method="post"> <div> <select id..

Storing data into list with class

I have the following class: public class EmailData { public string FirstName{ set; get; } public string LastName { set; get; } public string Location{ set; get; } } I then did the follo..

Send cookies with curl

I am using curl to retrieve cookies like so: curl -c cookies.txt url then I parse the cookie I want from the cookies.txt file and send the request again with the cookie curl -b "name=value" url ..

invalid_client in google oauth2

I try to make a web page for youtube video upload, therefore I try to get the client id from google api console, and in the api console it shows something like this: Client ID: 533832195920.apps.goog..

Reverse a string in Python

There is no built in reverse function for Python's str object. What is the best way of implementing this method? If supplying a very concise answer, please elaborate on its efficiency. For example, w..

how to bold words within a paragraph in HTML/CSS?

I am a beginner in web programming and have some very simple questions. I'm trying to bold several words in one paragraph but I don't know how to do that using HTML/CSS. I've figured out how to bold ..

OS detecting makefile

I routinely work on several different computers and several different operating systems, which are Mac OS X, Linux, or Solaris. For the project I'm working on, I pull my code from a remote git reposit..

Responsive image map

I have an existing image map in a responsive html layout. Images scale according to browser size, but the image coordinates are obviously fixed pixel sizes. What options do I have to resize the image ..

Local variable referenced before assignment?

I am using the PyQt library to take a screenshot of a webpage, then reading through a CSV file of different URLs. I am keeping a variable feed that incremements everytime a URL is processed and theref..

An efficient way to transpose a file in Bash

I have a huge tab-separated file formatted like this X column1 column2 column3 row1 0 1 2 row2 3 4 5 row3 6 7 8 row4 9 10 11 I would like to transpose it in an efficient way using only bash command..

How to stop/kill a query in postgresql?

This question is while postmaster is running your query in the background, how to kill or stop it? For example, your shell or any frontend may be disconnected due to network issue, you cannot use ctr..

How to configure CORS in a Spring Boot + Spring Security application?

I use Spring Boot with Spring Security and Cors Support. If I execute following code url = 'http://localhost:5000/api/token' xmlhttp = new XMLHttpRequest xmlhttp.onreadystatechange = -> if ..

Arrow operator (->) usage in C

I am reading a book called "Teach Yourself C in 21 Days" (I have already learned Java and C# so I am moving at a much faster pace). I was reading the chapter on pointers and the -> (arrow) operator..

Vue 2 - Mutating props vue-warn

I started https://laracasts.com/series/learning-vue-step-by-step series. I stopped on the lesson Vue, Laravel, and AJAX with this error: vue.js:2574 [Vue warn]: Avoid mutating a prop directly sinc..

How to prevent colliders from passing through each other?

I am having trouble keeping game objects inside of a contained space. When they reach the edge, there is some momentary push back but then they will go right through the wall. I am using a Box Collid..

What does a Status of "Suspended" and high DiskIO means from sp_who2?

I'm trying to troubleshoot some intermittent slowdowns in our application. I've got a separate question here with more details. I ran sp_who2 to and I've noticed a few connections that have a statu..

When to use MongoDB or other document oriented database systems?

We offer a platform for video- and audio-clips, photos and vector-grafics. We started with MySQL as the database backend and recently included MongoDB for storing all meta-information of the files, be..