Questions Tagged with #Captcha

Captcha is a type of challenge-response test used in computing as an attempt to ensure that the response is given by a human being and not generated by a computer.

How do I show multiple recaptchas on a single page?

I have 2 forms on a single page. One of the forms has a recaptcha displaying all the time. The other should display a recaptcha only after a certain event such as maxing out login attempts. So ther..

ReCaptcha API v2 Styling

I have not had much success finding how to style Google's new recaptcha (v2). The eventual goal is to make it responsive, but I am having difficulty applying styling for even simple things like width...

How does Google reCAPTCHA v2 work behind the scenes?

This post refers to Google ReCaptcha v2 (not the latest version) Recently Google introduced a simplified "captcha" verification system (video) that enables users to pass the "captcha" just by clickin..

Issue with virtualenv - cannot activate

I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv an..

Xampp Access Forbidden php

I'm a windows user. I've been using xampp for quite a while but suddenly none of my .php files are working now! I get this error message: Access forbidden! You don't have permission to access the ..

How to determine day of week by passing specific date?

For Example I have the date: "23/2/2010" (23th Feb 2010). I want to pass it to a function which would return the day of week. How can I do this? In this example, the function should return String "Tu..

UTL_FILE.FOPEN() procedure not accepting path for directory?

I am trying to write in a file stored in c:\ drive named vin1.txt and getting this error .Please suggest! > ERROR at line 1: ORA-29280: invalid > directory path ORA-06512: at > "SYS.UTL_FILE..

How do I read text from the clipboard?

How do I read text from the (windows) clipboard with python?..

One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll?

I am trying to compile this code in Microsoft Visual C# 2010 using System; using System.Globalization; class main { static void Main() { dynamic d; d = "dyna"; Cons..

Set angular scope variable in markup

Simple question: How can I set a scope value in html, to be read by my controller? _x000D_ _x000D_ var app = angular.module('app', []);_x000D_ _x000D_ app.controller('MyController', function($scope..

How to extract the hostname portion of a URL in JavaScript

Is there a really easy way to start from a full URL: document.location.href = "http://aaa.bbb.ccc.com/asdf/asdf/sadf.aspx?blah" And extract just the host part: aaa.bbb.ccc.com There's gotta be a..

$(document).ready(function(){ Uncaught ReferenceError: $ is not defined

Hi I am having a "Uncaught ReferenceError: $ is not defined" while using bellow codes I am currently getting the following error in my log. I have been looking at the samples in the framework and I j..

Save bitmap to file function

I'm trying to save a bitmap to file and a specific directly using a function I've created. It's not working. It crashes after bitmap.compress part (before here3). File dir = new File(filepath); ..

How to add text inside the doughnut chart using Chart.js?

How to render Text inside the doughnut chart, I am using ChartJs...

Sibling package imports

I've tried reading through questions about sibling imports and even the package documentation, but I've yet to find an answer. With the following structure: +-- LICENSE.md +-- README.md +-- api ¦ ..

A fatal error has been detected by the Java Runtime Environment: SIGSEGV, libjvm

Hi and thanks for reading, I have the following error while running my program and can't figure out what the solution would be. I also looked at all the topics with a similar error here, but could ..

Accessing dict_keys element by index in Python3

I'm trying to access a dict_key's element by its index: test = {'foo': 'bar', 'hello': 'world'} keys = test.keys() # dict_keys object keys.index(0) AttributeError: 'dict_keys' object has no attribu..

How to execute a shell script in PHP?

I have a script in /var/www/myscript.sh which creates folders and runs the command svn update for my projects. I need to execute this script by calling it in a PHP file in the browser (i.e. Localhost/..

Crystal Reports 13 And Asp.Net 3.5

I'm developing a website using Asp.Net 3.5 in Visual Studio 2008 and we use Crystal Reports 10 (that's come together vs2008). Last Year, We migrate it to Visual Studio 2010 but we still use .Net 3.5..

make: Nothing to be done for `all'

I am going through an eg pgm to create a make file. http://mrbook.org/tutorials/make/ My folder eg_make_creation contains the following files, desktop:~/eg_make_creation$ ls factorial.c functions...

Better way to represent array in java properties file

I'm currently making a .properties file that needs to be loaded and transformed into an array. But there is a possibility of anywhere from 0-25 of each of the property keys to exist. I tried a few i..

Format a JavaScript string using placeholders and an object of substitutions?

I have a string with say: My Name is %NAME% and my age is %AGE%. %XXX% are placeholders. We need to substitute values there from an object. Object looks like: {"%NAME%":"Mike","%AGE%":"26","%EVENT%"..

Creating a div element inside a div element in javascript

I'm trying a very basic example of creating a div inside an already existing div. It doesn't seem to be working when I use: document.getElementbyId('lc').appendChild(element) but works fine when I..

Pipe to/from the clipboard in Bash script

Is it possible to pipe to/from the clipboard in Bash? Whether it is piping to/from a device handle or using an auxiliary application, I can't find anything. For example, if /dev/clip was a device li..

"Not allowed to load local resource: file:///C:....jpg" Java EE Tomcat

I'm trying to retrieve a picture from my file system after a good storage,(instead of putting it in the database I copy it to the disc and i put the path to the db) I had st..

Iterate through DataSet

I have a DataSet named DataSet1. It contains an unknown number of tables and an unknown number of columns and rows in those tables. I would like to loop through each table and look at all of the dat..

How can I print a quotation mark in C?

In an interview I was asked Print a quotation mark using the printf() function I was overwhelmed. Even in their office there was a computer and they told me to try it. I tried like this: void m..

How do pointer-to-pointer's work in C? (and when might you use them?)

How do pointers-to-pointers work in C? When might you use them?..

Getting Hour and Minute in PHP

I need to get the current time, in Hour:Min format can any one help me in this...

How to easily import multiple sql files into a MySQL database?

I have several sql files and I want to import all of them at once into a MySQL database. I go to PHPMyAdmin, access the database, click import, select a file and import it. When I have more than a co..

Creating watermark using html and css

What I need is to create cross website transparent watermark like this using only html and css. Have no idea how to keep that always in one place for ex: right bottom side of browser window. Thanks i..

How to read a file byte by byte in Python and how to print a bytelist as a binary?

I'm trying to read a file byte by byte, but I'm not sure how to do that. I'm trying to do it like that: file = open(filename, 'rb') while 1: byte = file.read(8) # Do something... So does that..

Insert default value when parameter is null

I have a table that has a column with a default value: create table t ( value varchar(50) default ('something') ) I'm using a stored procedure to insert values into this table: create procedur..

Link to reload current page

Is it possible to have a normal link pointing to the current location? I have currently found 2 solutions, but one of them includes JavaScript and in the other you have to know the absolute path to t..

Clearing a text field on button click

I have two text labels: <div> <input type="text" id="textfield1" size="5"/> </div> <div> <input type="text" id="textfield2" size="5"/> ..

Google API authentication: Not valid origin for the client

When making an auth request to the Google API (gapi), it's returning false on the checkOrigin. I have removed any client id's or anything that would link directly to my account and replaced it with a..

Pass Model To Controller using Jquery/Ajax

I am trying to pass my model to a controller using JQuery/Ajax, I'm not sure how to do this correctly. So far I have tried using Url.Action but the model is blank. Note: none of the duplicate threa..

How do I consume the JSON POST data in an Express application

I'm sending the following JSON string to my server. ( { id = 1; name = foo; }, { id = 2; name = bar; } ) On the server I have this. app.post..

ASP.NET Forms Authentication failed for the request. Reason: The ticket supplied has expired

I am getting this error many times in the event log and users are logged out. Event code: 4005 Event message: Forms authentication failed for the request. Reason: The ticket supplied has expir..

Image style height and width not taken in outlook mails

I have a following dom structure in html content I am sending as email. <a href="http://content.mindmatrix.net/email/814xjqjmpj5r/b59tqx7tzz2x7" target="_new"> <span style='text-decoration:..

Can I target all <H> tags with a single selector?

I'd like to target all h tags on a page. I know you can do it this way... h1, h2, h3, h4, h5, h6 { font: 32px/42px trajan-pro-1,trajan-pro-2; } but is there a more efficient way of doing this usi..

OCI runtime exec failed: exec failed: (...) executable file not found in $PATH": unknown

I have dockerized an app which has ffmpeg installed in it via libav-tools. The app launches without problem, yet the problem occured when fluent-ffmpeg npm module tried to execute ffmpeg command, whic..

How can I change a button's color on hover?

I need to change the color of a button on hover. Here is my solution, but it doesn't work. a.button { display: -moz-inline-stack; display: inline-block; width: 391px; height: 62px; ba..

Best practice to run Linux service as a different user

Services default to starting as root at boot time on my RHEL box. If I recall correctly, the same is true for other Linux distros which use the init scripts in /etc/init.d. What do you think is the b..

How do I convert from stringstream to string in C++?

How do I convert from std::stringstream to std::string in C++? Do I need to call a method on the string stream?..

using BETWEEN in WHERE condition

I'd like the following function to select hotels with an accomodation between a certain $minvalue and $maxvalue. What would be the best way to do that? function gethotels($state_id,$city,$accommodati..

Convert a JSON String to a HashMap

I'm using Java, and I have a String which is JSON: { "name" : "abc" , "email id " : ["[email protected]","[email protected]","[email protected]"] } Then my Map in Java: Map<String, Object> retMap = new ..

what is the multicast doing on 224.0.0.251?

On my debian server (squeeze) I get this message every few seconds: Sep 18 21:28:14 myhost kernel: [7903784.720091] AIF:UNPRIV connect attempt: IN=eth0 OUT= MAC= SRC=my_serverip_eth0 DST=224.0.0..

Pass connection string to code-first DbContext

How do I pass a connection string to entity framework's code-first DbContext? My database generation works correctly when both DbContext and the connection string in web.config is in the same project ..

What does the red exclamation point icon in Eclipse mean?

What does the red exclamation point icon in Eclipse mean? There are lots of different search results on the Internet about "red exclamation point icons" and "red exclamation mark decorators" and "red ..

Start thread with member function

I am trying to construct a std::thread with a member function that takes no arguments and returns void. I can't figure out any syntax that works - the compiler complains no matter what. What is the co..

What is difference between arm64 and armhf?

Raspberry Pi Type 3 has 64-bit CPU, but its architecture is not arm64 but armhf. What is the difference between arm64 and armhf?..

Encode/Decode URLs in C++

Does anyone know of any good C++ code that does this?..

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

PHP header redirect 301 - what are the implications?

I have domain.com. If the user is logged in, it should load automatically domain.com/option-X where X is a predefined choice of the user. So, I do this at the top of index.php: header("Location: /op..

Force flex item to span full row width

I'm trying to retain the first 2 child elements on the same row while the third element is in its own below at full width, all while using flex. I'm particularly interested in using the flex-grow and..

How to dismiss the dialog with click on outside of the dialog?

I have implemented a custom dialog for my application. I want to implement that when the user clicks outside the dialog, the dialog will be dismissed. What do I have to do for this?..

www-data permissions?

So I have a directory in /var/www (called cake) and I need to allow www-data to write to it, but I also want to write to it (without having to use sudo). I'm afraid to change the permissions to 777 in..

JavaScript Regular Expression Email Validation

This code is always alerting out "null", which means that the string does not match the expression. var pattern = "^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$"; function isEmailAddress(str) { str = "azam..

loading json data from local file into React JS

I have a React component and I want to load in my JSON data from a file. The console log currently doesn't work, even though I'm creating the variable data as a global 'use strict'; var React = requ..

using favicon with css

I want to set the favicon for a fairly large number of pages. But, instead of using the HTML <head> tag <link rel="shortcut icon" href="favicon.ico">, I'd like to set it in the CSS file. I..

How do I get the position selected in a RecyclerView?

I am experimenting with the support library's recyclerview and cards. I have a recyclerview of cards. Each card has an 'x' icon at the top right corner to remove it: The card xml, list_item.xml: &..

Angular 6: saving data to local storage

I have a data table which display data from external API, I want the number of items /element on the table page should be saved in local storage Here is what I have tried so far: ngOnInit() { t..

Div Scrollbar - Any way to style it?

Is there anyway to control the styling of the scrollbars of a div tag? I am experiencing some contrast issues between IE7 and FireFox 3.5.2. Any help would be greatly appreciated!..

How to enable Ad Hoc Distributed Queries

When I run a query with OPENROWSET in SQL Server 2000 it works. But the same query in SQL Server 2008 generates the following error: SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasou..

Perl read line by line

I have a simple Perl script to read a file line by line. Code is below. I want to display two lines and break the loop. But it doesn't work. Where is the bug? $file='SnPmaster.txt'; open(INFO, $file)..

is there a post render callback for Angular JS directive?

I 've just gotten my directive to pull in a template to append to its element like this: # CoffeeScript .directive 'dashboardTable', -> controller: lineItemIndexCtrl templateUrl: "<%= asset..

Vector of Vectors to create matrix

I am trying to take in an input for the dimensions of a 2D matrix. And then use user input to fill in this matrix. The way I tried doing this is via vectors (vectors of vectors). But I have encountere..

What is best tool to compare two SQL Server databases (schema and data)?

I would like to compare two SQL Server databases including schema (table structure) and data in tables too. What is best tool to do this?..

How to run shell script on host from docker container?

How to control host from docker container? For example, how to execute copied to host bash script?..

Meaning of delta or epsilon argument of assertEquals for double values

I have a question about JUnit assertEquals to test double values. Reading the API doc I can see: @Deprecated public static void assertEquals(double expected, double actual) Deprecated. Use assertEqu..

Makefile to compile multiple C programs?

This is an incredibly simple question, but I'm new to makefiles. I am trying to make a makefile that will compile two independent programs: program1: gcc -o prog1 program1.c program2: gcc -o..

YouTube embedded video: set different thumbnail

I want to embed a video from YouTube that is not mine (so I can not change it at YouTube). The video has a thumbnail that is not representative for the video (I refer to the initial still that is show..

Is there a way to 'uniq' by column?

I have a .csv file like this: [email protected],2009-11-27 01:05:47.893000000,example.net,127.0.0.1 [email protected],2009-11-27 00:58:29.793000000,example.net,255.255.255.0 [email protected],..

How do I print a datetime in the local timezone?

Let's say I have a variable t that's set to this: datetime.datetime(2009, 7, 10, 18, 44, 59, 193982, tzinfo=<UTC>) If I say str(t), i get: '2009-07-10 18:44:59.193982+00:00' How can I get ..

How can I round a number in JavaScript? .toFixed() returns a string?

Am I missing something here? var someNumber = 123.456; someNumber = someNumber.toFixed(2); alert(typeof(someNumber)); //alerts string Why does .toFixed() return a string? I want to round the numbe..

show and hide divs based on radio button click

I want to be able to dynamically change what divs are show using radio button and jQuery - HTML: <div id="myRadioGroup"> 2 Cars<input type="radio" name="cars" checked="checked" value="..

Disable future dates after today in Jquery Ui Datepicker

I want to disable all the future dates after today in Jquery Ui Datepicker Here is the Demo : Code : $( "#start_date" ).datepicker( { maxDate: '0', beforeShow : ..

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

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

A cron job for rails: best practices?

What's the best way to run scheduled tasks in a Rails environment? Script/runner? Rake? I would like to run the task every few minutes...

Do I need Content-Type: application/octet-stream for file download?

The HTTP standard says: If this header [Content-Disposition: attachment] is used in a response with the application/octet-stream content-type, the implied suggestion is that the user agent sho..

What is the easiest way to get the current day of the week in Android?

What would be the easiest way to get the current day of the week in Android?..

How to check if the key pressed was an arrow key in Java KeyListener?

Can you help me refactor this code: public void keyPressed(KeyEvent e) { if (e.getKeyCode()==39) { //Right arrow key code } else if (e.getKeyCode()==37) { ..

How to remove the last character from a bash grep output

COMPANY_NAME=`cat file.txt | grep "company_name" | cut -d '=' -f 2` outputs something like this "Abc Inc"; What I want to do is I want to remove the trailing ";" as well. How can i do that? I am..

Can I define a class name on paragraph using Markdown?

Can I define a class name on paragraph using Markdown? If so, how?..

Remove URL parameters without refreshing page

I am trying to remove everything after the "?" in the browser url on document ready. Here is what I am trying: jQuery(document).ready(function($) { var url = window.location.href; url = url.sp..

Form onSubmit determine which submit button was pressed

I have a form with two submit buttons and some code: HTML: <input type="submit" name="save" value="Save" /> <input type="submit" name="saveAndAdd" value="Save and add another" /> JavaS..

Change limit for "Mysql Row size too large"

How can I change the limit Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 ..

Could not find any resources appropriate for the specified culture or the neutral culture

I have two ASP.NET Web projects (ProjectA and ProjectB). When class in ProjectA is instantiating a class of ProjectB which uses a resource file Blah.resx, I get this error: An exception of type..

Counting the number of option tags in a select tag in jQuery

How do I count the number of <option>s in a <select> DOM element using jQuery? <select data-attr="dropdown" id="input1"> <option value="Male" id="Male">Male</option>..

How to integrate Dart into a Rails app

How should I go about integrating my Dart application, into my rails application. I'm having a hard time with the whole, 'packages' structure that has to exist on every directory. Because the subdire..

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

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

Bootstrap: 'TypeError undefined is not a function'/'has no method 'tab'' when using bootstrap-tabs

I'm building a little site at the moment and wanted to use some of the Bootstrap parts from Initialzr, specifically the tabs. I've currently tried using the example code provided by the Bootstrap proj..

How to read a file line-by-line into a list?

How do I read every line of a file in Python and store each line as an element in a list? I want to read the file line by line and append each line to the end of the list...

C# Sort and OrderBy comparison

I can sort a list using Sort or OrderBy. Which one is faster? Are both working on same algorithm? List<Person> persons = new List<Person>(); persons.Add(new Person("P005", "Janson")); p..

Javascript replace all "%20" with a space

Is there a way to replace every "%20" with a space using JavaScript. I know how to replace a single "%20" with a space but how do I replace all of them? var str = "Passwords%20do%20not%20match"; v..

How can I get the name of an object in Python?

Is there any way to get the name of an object in Python? For instance: my_list = [x, y, z] # x, y, z have been previously defined for bla in my_list: print "handling object ", name(bla) # <-..

What is an instance variable in Java?

My assignment is to make a program with an instance variable, a string, that should be input by the user. But I don't even know what an instance variable is. What is an instance variable? How do I cre..

How do I escape special characters in MySQL?

For example: select * from tablename where fields like "%string "hi" %"; Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the rig..

Proper way to get page content

I have to get specific page content (like page(12)) I used that : <?php $id=47; $post = get_page($id); echo $post->post_content; ?> Work nice execpt for compatibility with translation..

Inheriting constructors

Why does this code: class A { public: explicit A(int x) {} }; class B: public A { }; int main(void) { B *b = new B(5); delete b; } Result in these errors: main.cpp: In func..

Pass a PHP string to a JavaScript variable (and escape newlines)

What is the easiest way to encode a PHP string for output to a JavaScript variable? I have a PHP string which includes quotes and newlines. I need the contents of this string to be put into a JavaSc..

What is the syntax for Typescript arrow functions with generics?

The typescript handbook currently has nothing on arrow functions. Normal functions can be generically typed with this syntax: example: function identity<T>(arg: T): T { return arg; } What..

What is the main purpose of setTag() getTag() methods of View?

What is the main purpose of such methods as setTag() and getTag() of View type objects? Am I right in thinking that I can associate any number of objects with a single View?..

Determine what attributes were changed in Rails after_save callback?

I'm setting up an after_save callback in my model observer to send a notification only if the model's published attribute was changed from false to true. Since methods such as changed? are only useful..

Streaming a video file to an html5 video player with Node.js so that the video controls continue to work?

Tl;Dr - The Question: What is the right way to handle streaming a video file to an html5 video player with Node.js so that the video controls continue to work? I think it has to do with the way that..

Expected block end YAML error

When pasting this YAML file into an online yaml parser, I got an expected block end error: ADDATTEMPTING: 'Tentative d ajout ' ATTEMPTINGTOGIVE: 'Tenter de donner ' ATTEMPTINGTOSET1: 'Tentative de d�..

How to create an android app using HTML 5

Can we create android applications using HTML5?..

PHP - add 1 day to date format mm-dd-yyyy

<?php $date = "04-15-2013"; $date = strtotime($date); $date = strtotime("+1 day", $date); echo date('m-d-Y', $date); ?> This is driving me crazy and seems so simple. I'm pretty..

Authenticate with GitHub using a token

I am trying to authenticate with GitHub using a personal access token. In the help files at github, it states to use the cURL method to authenticate (https://help.github.com/articles/creating-an-acces..

Convert int to ASCII and back in Python

I'm working on making a URL shortener for my site, and my current plan (I'm open to suggestions) is to use a node ID to generate the shortened URL. So, in theory, node 26 might be short.com/z, node 1 ..

How do I use a C# Class Library in a project?

I've created a new Class Library in C# and want to use it in one of my other C# projects - how do I do this?..

Angularjs autocomplete from $http

I'm trying to write an autocomplete directive that fetches data from the server using an $http request (without using any external plugins or scripts). Currently it works only with static data. Now, I..

Best way to add Activity to an Android project in Eclipse?

When adding an activity to an existing Android project, I manually create a new class - is that the best / preferred way? How do others handle that?..

Detecting installed programs via registry

I need to develop a process that will detect if the users computer has certain programs installed and if so, what version. I believe I will need a list with the registry location and keys to look for ..

How to uncommit my last commit in Git

How can I uncommit my last commit in git? Is it git reset --hard HEAD or git reset --hard HEAD^ ?..

send bold & italic text on telegram bot with html

I've created a bot in telegram I want to send bold and italic text with HTML page to bot My HTML code is: <html> <head><title>Telegram</title></head> <body> ..

jquery change button color onclick

I have multiple buttons that I use when people answer a question. How would I get the buttons to change colors when a person clicks on the button? I do not know jquery, I have been told that it is the..

How to download a Nuget package without nuget.exe or Visual Studio extension?

How can I download a NuGet package? I don't have the NuGet Visual Studio extension or the command line program nuget.exe. How can I download the .nupack file from the web? As I understand I will be ab..

Can I set up HTML/Email Templates with ASP.NET?

I'm working on a site that will send out a significant number of emails. I want to set up both header and footer text, or maybe even templates to allow the users to easily edit these emails if they ne..

Rails: Default sort order for a rails model?

I would like to specify a default sort order in my model. So that when I do a .where() without specifying an .order() it uses the default sort. But if I specify an .order(), it overrides the default..

Java converting int to hex and back again

I have the following code... int Val=-32768; String Hex=Integer.toHexString(Val); This equates to ffff8000 int FirstAttempt=Integer.parseInt(Hex,16); // Error "Invalid Int" int SecondAttempt=Integ..

jQuery Validation plugin: disable validation for specified submit buttons

I have a form with multiple fields that I'm validating (some with methods added for custom validation) with Jörn Zaeffere's excellent jQuery Validation plugin. How do you circumvent validation with s..

How to get value by class name in JavaScript or jquery?

i wan to retrive all the value of this code using class name ..is it possible in jquery . i want to retrive only the text within a div or number of div may be change the next form <span class="..

Select all occurrences of selected word in VSCode

Are there any trick or extension to select all instances of selected word in visual studio code, to facilitate editing or deleting those instances without search and replace, like ?Alt+F3 in sublime t..

What is the default access modifier in Java?

What is the default access modifier for a method or an instance variable if I do not state it explicitly? For example: package flight.booking; public class FlightLog { private SpecificFlight fl..

Replace \n with actual new line in Sublime Text

How can I replace \n in Sublime Text with real in-editor displayed new line so: foo\nbar becomes: foo bar in the editor when I view the file in it...

R : how to simply repeat a command?

I'm trying to repeat this simple command 10,000 times (via a simple and easy solution): Tandem <- sample(OUT, size = 815, replace = TRUE, prob = NULL); mean(Tandem) Any advice would be greatly a..

How to read the Stock CPU Usage data

On Ice Cream Sandwich, an option in the Developer Options is "Show CPU Usage", which adds an overlay on the screen (see screenshot below). My question is, how do I read the data ? I guessed that the..

How to bundle vendor scripts separately and require them as needed with Webpack?

I'm trying to do something that I believe should be possible, but I really can't understand how to do it just from the webpack documentation. I am writing a JavaScript library with several modules th..

How can I get the day of a specific date with PHP

I want to get the day (Sunday, Monday,...) of October 22. How can I do that?..

Regular expression for address field validation

I am trying to write a regular expression that facilitates an address, example 21-big walk way or 21 St.Elizabeth's drive I came up with the following regular expression but I am not too keen to how t..

Javascript string/integer comparisons

I store some parameters client-side in HTML and then need to compare them as integers. Unfortunately I have come across a serious bug that I cannot explain. The bug seems to be that my JS reads parame..

Simple pagination in javascript

I am trying to make pagination for my site. (http://anuntorhei.md) CODE: var someVar = 50; function someStupidFunction() { if (objJson.length > 50) { document.getElemen..

Import CSV into SQL Server (including automatic table creation)

I have several CSV files, which I want to import into an SQL Server database. I know if this is possible with BULK insert, but I want a solution, so that also the import table is automatically created..

How to select Multiple images from UIImagePickerController

In my application, I have to select more images ie; up to 3 images from library or capture of images...

How to paginate with Mongoose in Node.js?

I am writing a webapp with Node.js and mongoose. How can I paginate the results I get from a .find() call? I would like a functionality comparable to "LIMIT 50,100" in SQL...

SQL update trigger only when column is modified

By looking at other examples I've come up with the following but it doesn't seem to work as I would like: I want it to only update the modified information if the QtyToRepair value has been updated.....

How do CORS and Access-Control-Allow-Headers work?

I'm trying to make CORS request POST from domain.com to a.domain.com. My javascript looks like this $('#fileupload').fileupload({ xhrFields: { withCredentials: true }, dataType: 'json', ..

Background color in input and text fields

I would like to change the color background in the text and input fields of a form, but when I do this it also affects the submit button! Could it be done in some other way that does not affect the bu..

Delayed rendering of React components

I have a React component with a number of child components in it. I want to render the child components not at once but after some delay (uniform or different for each of the children). I was wonde..

"The specified Android SDK Build Tools version (26.0.0) is ignored..."

In Android Studio 3, I'm seeing this issue: The specified Android SDK Build Tools version (26.0.0) is ignored, as it is below the minimum supported version (26.0.2) for Android Gradle Plugin 3..

Wrap long lines in Python

How do I wrap long lines in Python without sacrificing indentation? For example: def fun(): print '{0} Here is a really long sentence with {1}'.format(3, 5) Suppose this goes over the 79 cha..

How to replace a string in a SQL Server Table Column

I have a table (SQL Sever) which references paths (UNC or otherwise), but now the path is going to change. In the path column, I have many records and I need to change just a portion of the path, bu..

Make code in LaTeX look *nice*

I'm currently writing a project report, and to explain the slightly crazy un-intuitive code that I've used I need to put lots and lots of short excerpts of example code in. How I can get code into La..

How to bind bootstrap popover on dynamic elements

I'm using Twitter Bootstrap's popover on the dynamic list. The list item has a button, when I click the button, it should show up popover. It works fine when I tested on non-dynamic. this is my Jav..

How to select only date from a DATETIME field in MySQL?

I have a table in the MySQL database that is set up with DATETIME. I need to SELECT in this table only by DATE and excluding the time. How do I SELECT in this table by only date and bypassing the time..

Calculate mean across dimension in a 2D array

I have an array a like this: a = [[40, 10], [50, 11]] I need to calculate the mean for each dimension separately, the result should be this: [45, 10.5] 45 being the mean of a[*][0] and 10.5 the ..

How can you have SharePoint Link Lists default to opening in a new window?

In SharePoint, it is easy to set up a List webpart consisting of Links to other documents, folders, sites, etc. Unfortunately, when clicking these links, the default behavior is for the page to open ..

UITableView with fixed section headers

Greets, I'm reading that the default behaviour of UITableView is to pin section header rows to the top of the table as you scroll through the sections until the next section pushes the previos section..

undefined reference to boost::system::system_category() when compiling

I'm trying to compile a program on Ubuntu 11.10 that uses the Boost libraries. I have the 1.46-dev Boost libraries from the Ubuntu Repository installed, but I get an error when compiling the program. ..

Save classifier to disk in scikit-learn

How do I save a trained Naive Bayes classifier to disk and use it to predict data? I have the following sample program from the scikit-learn website: from sklearn import datasets iris = datasets.loa..

How to navigate through textfields (Next / Done Buttons)

How can I navigate through all my text fields with the "Next" Button on the iPhone Keyboard? The last text field should close the Keyboard. I've setup the IB the Buttons (Next / Done) but now I'm st..

Sass - Converting Hex to RGBa for background opacity

I have the following Sass mixin, which is a half complete modification of an RGBa example: @mixin background-opacity($color, $opacity: .3) { background: rgb(200, 54, 54); /* The Fallback */ b..

stop service in android

Here I tried simple service program. Start service works fine and generates Toast but stop service does not. The code of this simple service is as below: public class MailService extends Service { ..

The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead

When I attempt to connect to a MySQL server from PHP, I see the following error: Deprecated: The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /path..

How do I run .sh or .bat files from Terminal?

I have a pretty basic problem here, that has happened so haphazardly to me that up until now, I've just ignored it. I downloaded tomcat web server and "Murach's Java Servlets and JSP" book is telling ..

There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key country

While binding dropdown in MVC, I always get this error: There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key country. View @Html.DropDownList("country", (IEnumerabl..

latex tabular width the same as the textwidth

I am generating some table as follow: \begin{tabular}[l]{|l|l|l|} \hline Input & Output& Action return \\ \hline \hline DNF & simulation & jsp\\ \hline \end{tabular} How can can I..

Android XML Percent Symbol

I have an array of strings in which the % symbol is used. Proper format for using the % is &#37;. When I have a string in that array with multiple &#37; it gives me this error. Multiple anno..

How can I find the first occurrence of a sub-string in a python string?

So if my string is "the dude is a cool dude". I'd like to find the first index of 'dude': mystring.findfirstindex('dude') # should return 4 What is the python command for this? Thanks...

How to set cookie value with AJAX request?

I want to set a cookie value on an AJAX request but the code below doesn't work. $.ajax({ type: "GET", url: "http://example.com", cache: false, setCookies: "lkfh89asdhjahska7al44..

Explicitly calling return in a function or not

A while back I got rebuked by Simon Urbanek from the R core team (I believe) for recommending a user to explicitly calling return at the end of a function (his comment was deleted though): foo = func..

JavaScript: Class.method vs. Class.prototype.method

What is the difference between the following two declarations? Class.method = function () { /* code */ } Class.prototype.method = function () { /* code using this.values */ } Is it okay to think of..

Printing *s as triangles in Java?

My assignment in my Java course is to make 3 triangles. One left aligned, one right aligned, and one centered. I have to make a menu for what type of triangle and then input how many rows is wanted. T..

Strip all non-numeric characters from string in JavaScript

Consider a non-DOM scenario where you'd want to remove all non-numeric characters from a string using JavaScript/ECMAScript. Any characters that are in range 0 - 9 should be kept. var myString = 'abc..

Ruby on Rails: How do I add placeholder text to a f.text_field?

How can I add placeholder text to my f.text_field fields so that the text comes pre-written by default, and when a user click inside the fields, the text goes away - allowing the user to type in the n..

Convert a 1D array to a 2D array in numpy

I want to convert a 1-dimensional array into a 2-dimensional array by specifying the number of columns in the 2D array. Something that would work like this: > import numpy as np > A = np.array(..

Logging levels - Logback - rule-of-thumb to assign log levels

I'm using logback in my current project. It offers six levels of logging: TRACE DEBUG INFO WARN ERROR OFF I'm looking for a rule of thumb to determine the log level for common activities...

Pass Javascript Variable to PHP POST

Possible Duplicate: JavaScript post request like a form submit I have a value calculated in JS that I'd like to pass as part of an input form to a PHP script. How can I get a value the JS v..

Could not determine the dependencies of task ':app:crashlyticsStoreDeobsDebug' if I enable the proguard

I get following error when I was running an app within Android Studio 2. Gradle tasks [:app:assembleDebug] Could not determine the dependencies of task ':app:crashlyticsStoreDeobsDebug'. > Task wi..

How can I check out a GitHub pull request with git?

I'd like to check out a previously created pull request (created via GitHub web interface). I searched and found different places where a refs/pull or refs/pull/pr But when I add fetch = +refs/pull/*..

How can I get two form fields side-by-side, with each field’s label above the field, in CSS?

I am stuck on figuring out some css, I need a section of my form to look like the following, I have tried every variation I can think of, I have given the labels a fixed width and floated them l..

Call break in nested if statements

I have the following situation: IF condition THEN IF condition THEN sequence 1 ELSE break //? ENDIF ELSE sequence 3 ENDIF What is the result of the ..

Debug assertion failed. C++ vector subscript out of range

the following code fills the vector with 10 values in first for loop.in second for loop i want the elements of vector to be printed. The output is till the cout statement before the j loop.Gives error..

Add a new column to existing table in a migration

I can't figure out how to add a new column to my existing database table using the Laravel framework. I tried to edit the migration file using... <?php public function up() { Schema::create(..

How to style the <option> with only CSS?

Note: This question is not about making a custom dropdown. It's only about possibilities of styling <option> elements within the select element in CSS How can I style <option>s of a <s..

Selenium C# WebDriver: Wait until element is present

I want to make sure that an element is present before the webdriver starts doing stuff. I'm trying to get something like this to work: WebDriverWait wait = new WebDriverWait(driver, new TimeSpan(0, 0,..

Send password when using scp to copy files from one server to another

using scp to copy files from 1 unix server to another regularly and performing certain actions. to do this quickly I wish to use a unix script which does the scp and inputs the password required to co..

Java stack overflow error - how to increase the stack size in Eclipse?

I am running a program that I've written in Java in Eclipse. The program has a very deep level of recursion for very large inputs. For smaller inputs the program runs fine however when large inputs ar..

Disable future dates in jQuery UI Datepicker

Is it possible to disable future date from today? Let say today is 23/10/2010, so 24/10/2010 onwards are disabled. Sorry I am very new in jQuery and JavaScript...

Django set field value after a form is initialized

I am trying to set the field to a certain value after the form is initialized. For example, I have the following class. class CustomForm(forms.Form): Email = forms.EmailField(min_length=1, max_..

Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine

I created a windows application developed in .NET 3.5 in a 32 bit Windows 2008 server. When deployed the application in a 64 bit server it shows the error "Microsoft.Jet.OLEDB.4.0' provider is not reg..

Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $

What is this error ? How can I fix this? My app is running but can't load data. And this is my Error: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $ This is my frag..

Left/Right float button inside div

How can I make button float only in div area? Here is my example CSS and HTML. _x000D_ _x000D_ .test {_x000D_ width: 60%;_x000D_ display: inline;_x000D_ overflow: auto;_x000D_ white-space: n..

HTML how to clear input using javascript?

I have this INPUT, it will clear everytime we click inside of it. The problem: I want to clear only if value = [email protected] <script type="text/javascript"> function clearThis(target..

Select 50 items from list at random to write to file

So far I have figured out how to import the file, create new files, and randomize the list. I'm having trouble selecting only 50 items from the list randomly to write to a file? def randomizer(inpu..

How to change color of Toolbar back button in Android?

I could not change the color of back button. I am using toolbar material design. In my app I am applying black background of tool bar but the back design is being black by default that's why I just wa..

2 ways for "ClearContents" on VBA Excel, but 1 work fine. Why?

Good evening friends: I have in mind 2 ways for clearing a content in a defined range of cells of a VBA project (in MS Excel): Worksheets("SheetName").Range("A1:B10").ClearContents Worksheets("Shee..

Need help rounding to 2 decimal places

Why is it that when I do the following... Math.Round(0.75, 1, MidpointRounding.AwayFromZero) I get 0.8 but when I do the following... Math.Round(0.575, 2, MidpointRounding.AwayFromZero) I don't..

MongoDB and "joins"

I'm sure MongoDB doesn't officially support "joins". What does this mean? Does this mean "We cannot connect two collections(tables) together."? I think if we put the value for _id in collection A to..

What JSON library to use in Scala?

I need to build a JSON string, something like this: [ { 'id': 1, 'name': 'John'}, { 'id': 2, 'name': 'Dani'} ] val jArray = JsArray(); jArray += (("id", "1"), ("name", "John")) jArray += (("id",..

Regex to get NUMBER only from String

I recieve "7+" or "5+" or "+5" from XML and wants to extract only the number from string using Regex. e.g Regex.Match() function stringThatHaveCharacters = stringThatHaveCharacters.Trim(); ..

How do I restart my C# WinForm Application?

Developing a C# .NET 2.0 WinForm Application. Need the application to close and restart itself. Application.Restart(); The above method has proven to be unreliable. What is a better way to restar..

How do I reload a page without a POSTDATA warning in Javascript?

I want to reload a page using: window.location.reload(true); But I receive the POSTDATA warning because the refresh function want to resend previous POST form data. How can I refresh my page witho..

How to find difference between two columns data?

I have a temp table with two columns of integer data i want to find the difference between two columns in 3rd column. #TEMP1 Present previous 59 88 75 75 45 45 77 ..

How to write to error log file in PHP

I want to write a message to an error log file when executing PHP code. I am trying to use the PHP error_log() function Docs. But it's not working properly for me...

Mercurial: how to amend the last commit?

I'm looking for a counter-part of git commit --amend in Mercurial, i.e. a way to modify the commit which my working copy is linked to. I'm only interested in the last commit, not an arbitrary earlier ..

default value for struct member in C

Is it possible to set default values for some struct member? I tried the following but, it'd cause syntax error: typedef struct { int flag = 3; } MyStruct; Errors: $ gcc -o testIt test.c test.c..

calling javascript function on OnClientClick event of a Submit button

In my asp.net page, I have three text boxes and one button. First two text boxes are being used to get the value from the user and third one is being used to show the sum of first two boxes. I am c..

What is a C++ delegate?

What is the general idea of a delegate in C++? What are they, how are they used and what are they used for? I'd like to first learn about them in a 'black box' way, but a bit of information on the gu..

C++ Loop through Map

I want to iterate through each element in the map<string, int> without knowing any of its string-int values or keys. What I have so far: void output(map<string, int> table) { map&..

Android: Force EditText to remove focus?

I would like to be able to remove the focus from the EditText. For example if the Keyboard appears, and the user hides it with the back button, I would like the focus and the cursor to disappear. How ..