Questions Tagged with #Multitasking

Multitasking is the apparent simultaneous execution of two or more tasks by a computer.

iOS - Ensure execution on main thread

I want to know how to call my function on the main thread. How do I make sure my function is called on the main thread? (this follows a previous question of mine)...

Difference between multitasking, multithreading and multiprocessing?

Whats the difference between multitasking, multiprogramming & multiprocessing This comes regularly for my university OS exams and I can't find a good answer. I know quite a bit about multitasking..

CSS "and" and "or"

I've got quite big trouble, because i need to anathematise from styling some input types. I had something like: .registration_form_right input:not([type="radio") { //Nah. } But i don't want to sty..

If statements for Checkboxes

I wanted to know how to write if statements to see if one or another check box is checked or not. I have two check boxes. I wanted it to check to see if checkbox 1 is checked and checkbox 2 is null ..

Join a list of items with different types as string in Python

I need to join a list of items. Many of the items in the list are integer values returned from a function; i.e., myList.append(munfunc()) How should I convert the returned result to a string i..

phpmyadmin #1045 Cannot log in to the MySQL server. after installing mysql command line client

I installed wamp.phpmyadmin working fine. Now that I have installed mysql command line client I am not able to connect to my databases from mysql command line or phpmyadmin. After restarting I could ..

JQuery create new select option

I have the below functions in regular JavaScript creating select options. Is there a way I can do this with jQuery without having to use the form object? Perhaps storing the options as an array of JSO..

How to remove first 10 characters from a string?

How to ignore the first 10 characters of a string? Input: str = "hello world!"; Output: d! ..

Set database from SINGLE USER mode to MULTI USER

I need help with setting a database that was restored in SINGLE_USER mode to MULTI_USER. Every time I run ALTER DATABASE BARDABARD SET MULTI_USER; GO I get this error: Changes to the state or option..

AttributeError: 'numpy.ndarray' object has no attribute 'append'

I am trying to run the code presented on the second page:

Is there any option to limit mongodb memory usage?

I am using Mongo-DBv1.8.1. My server memory is 4GB but Mongo-DB is utilizing more than 3GB. Is there memory limitation option in Mongo-DB?...

How do I install Maven with Yum?

I'm trying not to learn much about either yum or maven. I've inherited this code and I don't want to spend more time than I have to in this environment. I've got yum. My installation "has" ("is att..

How to subtract 30 days from the current date using SQL Server

I am unable subtract 30 days from the current date and I am a newbie to SQL Server. This is the data in my column date ------------------------------ Fri, 14 Nov 2014 23:03:35 GMT Mon, 03 Nov 2014..

source command not found in sh shell

I have a script that uses sh shell. I get an error in the line that uses the source command. It seems source is not included in my sh shell. If I explicitly try to run source from shell I get: sh: ..

How to prevent the "Confirm Form Resubmission" dialog?

How do I clean information in a form after submit so that it does not show this error after a page refresh? See image (from chrome): The dialog has the text: The page that you're looking for u..

Query to get all rows from previous month

I need to select all rows in my database that were created last month. For example, if the current month is January, then I want to return all rows that were created in December, if the month is Feb..

Error: TypeError: $(...).dialog is not a function

I am having an issue getting a dialog to work as basic functionality. Here is my jQuery source imports: <script type="text/javascript" src="scripts/jquery-1.9.1.js"></script> <script t..

How to break lines in PowerShell?

I am [completely new to PowerShell and] concatenating a string in a loop, if a special condition occurs I should insert a line can I do this? Basically looking for the equivalent of \n. ..

Get refresh token google api

I can't get my refresh token with my code. I can only get my access token, token type etc., I have followed some tutorials like putting access_type=offline on my login URL: echo "<a href='https://..

Testing web application on Mac/Safari when I don't own a Mac

Having been caught out recently when a web site I launched displayed perfectly on IE, Firefox, Chrome and Safari on Windows but was corrupted when viewed using Safari on the Mac (by a potential custom..

jQuery: how to find first visible input/select/textarea excluding buttons?

I tried $(":input:not(input[type=button],input[type=submit],button):visible:first") but it doesn't find anything. What is my mistake? UPD: I execute this on $(document).load() <script type="t..

Uncaught TypeError: $(...).datepicker is not a function(anonymous function)

I found few answers on stack overflow but still cant resolve my problem. I am running on Django but I dont think it is relevant for this error. I try to make work my date picker java script but I am ..

How to filter in NaN (pandas)?

I have a pandas dataframe (df), and I want to do something like: newdf = df[(df.var1 == 'a') & (df.var2 == NaN)] I've tried replacing NaN with np.NaN, or 'NaN' or 'nan' etc, but nothing evaluat..

Cannot open include file: 'unistd.h': No such file or directory

After having installed libpng into my computer, I've included it into my project using #include <png.h> on a Windows 7 SP1 plateform and using Visual Studio Ultimate 2013. But at build time, I'..

live output from subprocess command

I'm using a python script as a driver for a hydrodynamics code. When it comes time to run the simulation, I use subprocess.Popen to run the code, collect the output from stdout and stderr into a subp..

How to check if a String contains only ASCII?

The call Character.isLetter(c) returns true if the character is a letter. But is there a way to quickly find if a String only contains the base characters of ASCII?..

Load jQuery with Javascript and use jQuery

I am appending the jQuery library to the dom using: var script = document.createElement('script'); script.src = ''; script.type = 't..

How do I get monitor resolution in Python?

What is the simplest way to get monitor resolution (preferably in a tuple)? ..

Create Map in Java

I'd like to create a map that contains entries consisting of (int, Point2D) How can I do this in Java? I tried the following unsuccessfully. HashMap hm = new HashMap(); hm.put(1, new Point2D.Doubl..

What does body-parser do with express?

I don't understand why we need body-parser in an Express application, as we can get data without using body-parser. And what does it do actually and how?..

Capturing URL parameters in request.GET

I am currently defining regular expressions in order to capture parameters in a URL, as described in the tutorial. How do I access parameters from the URL as part the HttpRequest object? My HttpReques..

How can I pass command-line arguments to a Perl program?

I'm working on a Perl script. How can I pass command line parameters to it? Example: "string1" "string2" ..

How to find the array index with a value?

Say I've got this imageList = [100,200,300,400,500]; Which gives me [0]100 [1]200 etc. Is there any way in JavaScript to return the index with the value? I.e. I want the index for 200, I get ret..

How to escape "&" in XML?

I write <string name="magazine">Newspaper & Magazines</string> in strings.xml But the Compiler says: The entity name must immediately follow the '&' in the entity refere..

Difference between static memory allocation and dynamic memory allocation

I would like to know what is the difference between static memory allocation and dynamic memory allocation? Could you explain this with any example?..

Bulk Insert to Oracle using .NET

What is the fastest way to do Bulk insert to Oracle using .NET? I need to transfer about 160K records using .NET to Oracle. Currently, I'm using insert statement and execute it 160K times.It takes abo..

How to update fields in a model without creating a new record in django?

I have a model in django that I want to update only, that is, when I call it and set the data, it will not create a new record, only update the existing one. How can I do this? Here is what I have: c..

What are the performance characteristics of sqlite with very large database files?

2020 update, about 11 years after the question was posted and later closed, preventing newer answers. Almost everything written here is obsolete. Once upon a time sqlite was limited to the memory capa..

Select arrow style change

I'm trying to replace the arrow of a select with a picture of my own. I'm including the select in a div with the same size, I set the background of the select as transparent and I'm including a pictur..

InputStream from a URL

How do I get an InputStream from a URL? for example, I want to take the file at the url and read it as an InputStream in Java, through a servlet. I've tried InputStream i..

How do I add a foreign key to an existing SQLite table?

I have the following table: CREATE TABLE child( id INTEGER PRIMARY KEY, parent_id INTEGER, description TEXT); How do I add a foreign key constraint on parent_id? Assume foreign keys are en..

How to change the Content of a <textarea> with JavaScript

How would I change the content of a <textarea> element with JavaScript? I want to make it empty...

Test for non-zero length string in Bash: [ -n "$var" ] or [ "$var" ]

I've seen Bash scripts test for a non-zero length string in two different ways. Most scripts use the -n option: #!/bin/bash # With the -n option if [ -n "$var" ]; then # Do something when var is no..

How to test abstract class in Java with JUnit?

I am new to Java testing with JUnit. I have to work with Java and I would like to use unit tests. My problem is: I have an abstract class with some abstract methods. But there are some methods which ..

What is this Javascript "require"?

I'm trying to get Javascript to read/write to a PostgreSQL database. I found this project on github. I was able to get the following sample code to run in node. var pg = require('pg'); //native libpq..

Is there a way to get a <button> element to link to a location without wrapping it in an <a href ... tag?

Just wondering if there is a way to get a HTML <button> element to link to a location without wrapping it in an <a href... tag? Button currently looks like: <button>Visit Page Now<..

How to protect Excel workbook using VBA?

With a trigger like a check box I want to protect my work book. I tried Excel 2003: thisworkbook.protect("password",true,true) thisworkbook.unprotect("password") It's not working. Any suggestions?..

Python: avoiding pylint warnings about too many arguments

I want to refactor a big Python function into smaller ones. For example, consider this following code snippet: x = x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 Of course, this is a trivial example. I..

Should __init__() call the parent class's __init__()?

I'm used that in Objective-C I've got this construct: - (void)init { if (self = [super init]) { // init class } return self; } Should Python also call the parent class's impleme..

You seem to not be depending on "@angular/core". This is an error

I want to create an angular 2 App with angular cli I have written in the cmd: npm install angular-cli -g then: ng firstngapp but it show me an error when I write npm start ! I don'..

python NameError: global name '__file__' is not defined

When I run this code in python 2.7, I get this error: Traceback (most recent call last): File "C:\Python26\Lib\site-packages\pyutilib.subprocess-3.5.4\", line 30, in <module> long_d..

LinkButton Send Value to Code Behind OnClick

I have a ASP LinkButton Control and I was wondering how to send a value to the code behind when it is clicked? Is that possible with this event? <asp:LinkButton ID="ENameLinkBtn" runat="server" ..

How to create an empty file at the command line in Windows?

How to create an empty file at the DOS/Windows command-line? I tried: copy nul > file.txt but it always displays that a file was copied. Is there any other method in the standard cmd? It shou..

Android webview & localStorage

I have a problem with a webview which may access to the localStorage by an HTML5 app. The test.html file informs me that local storage is'nt supported by my browser (ie. the webview). If you have any..

Post request in Laravel - Error - 419 Sorry, your session/ 419 your page has expired

I installed Laravel 5.7 Added a form to the file \resources\views\welcome.blade.php <form method="POST" action="/foo" > @csrf <input type="text" name="name"/><br/> <..

Retrieving the text of the selected <option> in <select> element

In the following: <select id="test"> <option value="1">Test One</option> <option value="2">Test Two</option> </select> How can I get the text of the sel..

Select rows where column is null

How do you write a SELECT statement that only returns rows where the value for a certain column is null?..

JFrame.dispose() vs System.exit()

What is the difference between these two methods - System.exit() and JFrame.dispose()? If we want to close a Java Swing application when a button is clicked, which method should I use?..

Exit Shell Script Based on Process Exit Code

I have a shell script that executes a number of commands. How do I make the shell script exit if any of the commands exit with a non-zero exit code?..

How to calculate a mod b in Python?

Is there a modulo function in the Python math library? Isn't 15 % 4, 3? But 15 mod 4 is 1, right?..

Onchange open URL via select - jQuery

What would be the best way to attach an event so on change of a select option a URL. Store the href in an attr and grab it on change?..

Stop jQuery .load response from being cached

I have the following code making a GET request on a URL: $('#searchButton').click(function() { $('#inquiry').load('/portal/?f=searchBilling&pid=' + $('#query').val()); }); But t..

How to use Git and Dropbox together?

Is it possible to use Git and Dropbox together?..

Javascript ES6 export const vs export let

Let's say I have a variable that I want to export. What's the difference between export const a = 1; vs export let a = 1; I understand the difference between const and let, but when you export t..

NSAttributedString add text alignment

How can I add text alignment attribute to an NSAttributedString to center the text? Edit: Am I doing anything wrong? It doesn't seem to change the alignment. CTParagraphStyleSetting setting; setting..

How can compare-and-swap be used for a wait-free mutual exclusion for any shared data structure?

Being new to multi-threading and mutexes I was going through the wikipedia for starters. I came across this portion: CAS can be used to achieve wait-free mutual exclusion for any shared data struc..

How do I delete NuGet packages that are not referenced by any project in my solution?

Somehow during the upgrade to VS2012 and .NET 4.5, I've managed to get NuGet confused. There are packages that appear in the package manager (and the packages folder) that I cannot delete (I believe ..

How can I redirect a php page to another php page?

Possible Duplicate: How to redirect users to another page? I'm a beginner in the programming field....I want to redirect a php page to another one..How is it possible in the most easiest way? My co..

getting the index of a row in a pandas apply function

I am trying to access the index of a row in a function applied across an entire DataFrame in Pandas. I have something like this: df = pandas.DataFrame([[1,2,3],[4,5,6]], columns=['a','b','c']) >&g..

A generic error occurred in GDI+, JPEG Image to MemoryStream

This seems to be a bit of an infamous error all over the web. So much so that I have been unable to find an answer to my problem as my scenario doesn't fit. An exception gets thrown when I save the im..

Blocks and yields in Ruby

I am trying to understand blocks and yield and how they work in Ruby. How is yield used? Many of the Rails applications I've looked at use yield in a weird way. Can someone explain to me or show me ..

C# Foreach statement does not contain public definition for GetEnumerator

I'm having a problem with a Windows Form application I'm building in C#. The error is stating "foreach statement cannot operate on variables of type 'CarBootSale.CarBootSaleList' because 'CarBootSale...

How to remove line breaks (no characters!) from the string?

This might appear to be a dupe, but rest assured it isn't - I have searched both SO as well as the rest of the web for an answer to my problem and ended up finding the same insufficient "solutions" ov..

how to include glyphicons in bootstrap 3

I've not used any of the bootstrap frameworks before. I want to include some of the glyphicons in bootstrap 3 on my page. From what I understand they should be included in a bootstrap.css file which I..

Freezing Row 1 and Column A at the same time

I want to "freeze" Row 1 and Column A simultaneously in Excel 2010. Is this possible?..

List<String> to ArrayList<String> conversion issue

I have a following method...which actually takes the list of sentences and splits each sentence into words. Here is it: public List<String> getWords(List<String> strSentences){ allWords =..

how to toggle attr() in jquery

I have a simple add attribute function: $(".list-toggle").click(function() { $(".list-sort").attr('colspan', 6); }); My question is: how can I turn this into a toggle, so colspan="6" is removed..

How to clean node_modules folder of packages that are not in package.json?

Assume I install project packages with npm install that looks into package.json for modules to be installed. After a while I see that I don't need some specific module and remove its dependency from p..

Anyway to prevent the Blue highlighting of elements in Chrome when clicking quickly?

Most of the time I'm not worried about it but I have an image carousel and if I click on the next and previous divs quickly, they will be highlighted in Chrome. I tried using outline:none but no effe..

Login to Microsoft SQL Server Error: 18456

I am getting this error while trying to connect to the SQL Server. Microsoft SQL Server Error: 18456 Can anybody tell me what the error code means?..

Convert a Pandas DataFrame to a dictionary

I have a DataFrame with four columns. I want to convert this DataFrame to a python dictionary. I want the elements of first column be keys and the elements of other columns in same row be values. Da..

android pinch zoom

My layout contains buttons, textviews, etc. Is it possible to implement pinch zoom in my layout?..

PHP Composer behind http proxy

I use composer on a network where the only way to access the internet is using HTTP or socks proxy. I have http_proxy and https_proxy environment variables. When compose tries to access HTTPS URLs I g..

Clear variable in python

Is there a way to clear the value of a variable in python? For example if I was implementing a binary tree: class Node: self.left = somenode1 self.right = somenode2 If I wanted to remove some..

How to extract svg as file from web page

I want to save SVG as file from this page Is there any Chrome extension or other way to do this?..

How to change the height of a <br>?

I have a big paragraph of text that is divided into subparagraphs with <br>'s: <p> Blah blah blah. <br/> Blah blah blah. Blah blah blah. Blah blah blah. <br/> Blah b..

Blurring an image via CSS?

On many smartphones (Samsung Galaxy II being an example) when you browse through a photo gallery, its blurred copy is laid out in the background. Can this be achieved by CSS dynamically (ie. without t..

Why are elementwise additions much faster in separate loops than in a combined loop?

Suppose a1, b1, c1, and d1 point to heap memory, and my numerical code has the following core loop. const int n = 100000; for (int j = 0; j < n; j++) { a1[j] += b1[j]; c1[j] += d1[j]; } T..

Password masking console application

I tried the following code... string pass = ""; Console.Write("Enter your password: "); ConsoleKeyInfo key; do { key = Console.ReadKey(true); // Backspace Should Not Work if (key.Key !..

Unable to execute dex: Multiple dex files define Lcom/myapp/R$array;

Since updating to ADT 14 I can no longer build my project. It was building fine prior to updating. The error: [2011-10-23 16:23:29 - Dex Loader] Unable to execute dex: Multiple dex files define Lco..

Angular2 material dialog has issues - Did you add it to @NgModule.entryComponents?

I am trying to follow the docs on but I cannot understand why it has the below issue? I added the below on my component: @Component({ select..

404 Not Found The requested URL was not found on this server

I'm having small troubles and was wondering if someone can help me over the hump. I pulled a copy of a website down from Hostgator and I'm trying to set it up on my local machine using WAMP but, I ke..

jQuery remove special characters from string and more

I have a string like this: var str = "I'm a very^ we!rd* Str!ng."; What I would like to do is removing all special characters from the above string and replace spaces and in case they are being typ..

Groovy Shell warning "Could not open/create prefs root node ..."

I tried to open the Groovy Shell (groovysh) on Windows 8 and got the following output: java.util.prefs.WindowsPreferences <init> WARNING: Could not open/create prefs root node Software\JavaSoft..

Cannot create JDBC driver of class ' ' for connect URL 'null' : I do not understand this exception

Why does it say null URL and gives a empty ' ' class in the exception when I have provided the database URL? I am trying to connect to a derby database via a servlet while using Tomcat. When the servl..

Landscape printing from HTML

I have a HTML report, which needs to be printed landscape because of the many columns. It there a way to do this, without the user having to change the document settings? And what are the options amo..

Examples of Algorithms which has O(1), O(n log n) and O(log n) complexities

What are some algorithms which we use daily that has O(1), O(n log n) and O(log n) complexities?..

How does `scp` differ from `rsync`?

An article about setting up Ghost blogging says to use scp to copy from my local machine to a remote server: scp -r ghost-0.3 root@*your-server-ip*:~/ However, Railscast 339: Chef Solo Basics uses ..

Delete first character of a string in Javascript

I want to delete the first character of a string, if the first character is a 0. The 0 can be there more than once. Is there a simple function that checks the first character and deletes it if it is..

Does static constexpr variable inside a function make sense?

If I have a variable inside a function (say, a large array), does it make sense to declare it both static and constexpr? constexpr guarantees that the array is created at compile time, so would the st..

kill -3 to get java thread dump

I am using kill -3 command to see the JVM's thread dump in unix. But where can I find the output of this kill command? I am lost!!..

bash "if [ false ];" returns true instead of false -- why?

Why does the following output True? #!/bin/sh if [ false ]; then echo "True" else echo "False" fi This will always output True even though the condition would seem to indi..

<button> vs. <input type="button" />. Which to use?

When looking at most sites (including SO), most of them use: <input type="button" /> instead of: <button></button> What are the main differences between the two, if any? Are t..

Fit background image to div

I have a background image in the following div, but the image gets cut off: <div style='text-align:center;background-image: url(/media/img_1_bg.jpg);background-repeat:no-repeat;width:450px;height..

How do I navigate to another page when PHP script is done?

I have a simple POST script that I need to return to the page that was doing the Posting. Is there any way to do it like this? if($done) { //go to page } ..

How to iterate a table rows with JQuery and access some cell values?

<table class="checkout itemsOverview"> <tr class="item"> <td>GR-10 Senderos</td> <td><span class="value">15.00</span> €</td> ..

Play local (hard-drive) video file with HTML5 video tag?

I want to achieve the following. <video src="file:///Users/username/folder/video.webm"> </video> The intent is that the user will be able to select a file from his/her hard drive. And ..

How to set the style -webkit-transform dynamically using JavaScript?

I want to change the -webkit-transform: rotate() property using JavaScript dynamically, but the commonly used setAttribute is not working: img.setAttribute('-webkit-transform', 'rotate(60deg)'); Th..

What does the servlet <load-on-startup> value signify

I am getting a bit confused here. In our application we are having a few servlets defined. Here is the excerpt from the web.xml for one of the servlets: <servlet> <servlet-name>AxisSe..

How to enable TLS 1.2 support in an Android application (running on Android 4.1 JB)

As per the docs in Android for SSLSocket and SSLContext, TLS v1.1 and v1.2 protocols are supported in API level 16+, but are not enabled by default.

Unresolved Import Issues with PyDev and Eclipse

I am very new to PyDev and Python, though I have used Eclipse for Java plenty. I am trying to work through some of the Dive Into Python examples and this feels like an extremely trivial problem that's..

How can I create a product key for my C# application?

How can I create a product key for my C# Application? I need to create a product (or license) key that I update annually. Additionally I need to create one for trial versions. Related: How do I bes..

How can I get a specific field of a csv file?

I need a way to get a specific item(field) of a CSV. Say I have a CSV with 100 rows and 2 columns (comma seperated). First column emails, second column passwords. For example I want to get the passwor..

How to scan multiple paths using the @ComponentScan annotation?

I'm using Spring 3.1 and bootstrapping an application using the @Configuration and @ComponentScan attributes. The actual start is done with new AnnotationConfigApplicationContext(MyRootConfiguration..

Eclipse Workspaces: What for and why?

I have seen, read and thought of different ways of using workspaces (per project, per application (multi-asseted or not), per program language, per target (web-development, plugins,..), and so on) and..

How to change Angular CLI favicon

How can I change the default favicon that is set by the Angular CLI? I have tried many things, but it always shows the Angular logo as the favicon, even though I have deleted that icon (favicon.ico i..

What is the difference between const and readonly in C#?

What is the difference between const and readonly in C#? When would you use one over the other?..

Xcode - Warning: Implicit declaration of function is invalid in C99

Getting a warning : Implicit declaration of function 'Fibonacci' is invalid in C99. What's wrong? #include <stdio.h> int main(int argc, const char * argv[]) { int input; printf("Please..

Downgrade npm to an older version

I tried updating npm to see if it would solve some dependency problems we were having, and now I want to downgrade to the version the rest of the development team is using. How can I install an older ..

C++ Best way to get integer division and remainder

I am just wondering, if I want to divide a by b, and am interested both in the result c and the remainder (e.g. say I have number of seconds and want to split that into minutes and seconds), what is t..

Move an item inside a list?

In Python, how do I move an item to a definite index in a list?..

How to create an empty file with Ansible?

What is the easiest way to create an empty file using Ansible? I know I can save an empty file into the files directory and then copy it to the remote host, but I find that somewhat unsatisfactory. A..

JavaScript by reference vs. by value

I'm looking for some good comprehensive reading material on when JavaScript passes something by value and when by reference and when modifying a passed item affects the value outside a function and wh..

How to force file download with PHP

I want to require a file to be downloaded upon the user visiting a web page with PHP. I think it has something to do with file_get_contents, but am not sure how to execute it. $url = "http://example...

How do I get the directory of the PowerShell script I execute?

I run a PowerShell script. How do I get the directory path of this script I run? How to do this?..

How do I install and use the ASP.NET AJAX Control Toolkit in my .NET 3.5 web applications?

How do I get it to work with my project?

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

How to detect Windows 64-bit platform with .NET?

In a .NET 2.0 C# application I use the following code to detect the operating system platform: string os_platform = System.Environment.OSVersion.Platform.ToString(); This returns "Win32NT". The pro..

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo

I was trying to run a sample code While launching the application in the android 1.5 emulator , I got these errors.... Any one have some hint..? ERROR from LogCat: 01-13 02:28:08.392: ERROR/Android..

Is there a regular expression to detect a valid regular expression?

Is it possible to detect a valid regular expression with another regular expression? If so please give example code below...

Populating a razor dropdownlist from a List<object> in MVC

I have a model: public class DbUserRole { public int UserRoleId { get; set; } public string UserRole { get; set; } } public class DbUserRoles { public List<DbU..

How do I prompt a user for confirmation in bash script?

I want to put a quick "are you sure?" prompt for confirmation at the top of a potentially dangerous bash script, what's the easiest/best way to do this?..

Rotating x axis labels in R for barplot

I am trying to get the x axis labels to be rotated 45 degrees on a barplot with no luck. This is the code I have below: barplot(((data1[,1] - average)/average) * 100, srt = 45, ..

Push item to associative array in PHP

I've been trying to push an item to an associative array like this: $new_input['name'] = array( 'type' => 'text', 'label' => 'First name', 'show' => true, 'required' =>..

JUNIT Test class in Eclipse - java.lang.ClassNotFoundException

I'm trying to run my junit test (to verify that a properties file loads correctly) but I get ClassNotFoundException although the class is there and all required libraries are there too. Here it is t..

Using SSH keys inside docker container

I have an app that executes various fun stuff with Git (like running git clone & git push) and I'm trying to docker-ize it. I'm running into an issue though where I need to be able to add an SSH ..

Define the selected option with the old input in Laravel / Blade

I have this code: <select required="required" class="form-control" name="title"> <option></option> @foreach ($titles as $key => $val) @if (stristr($key, 'isGroup'..

Creating multiline strings in JavaScript

I have the following code in Ruby. I want to convert this code into JavaScript. what's the equivalent code in JS? text = <<"HERE" This Is A Multiline String HERE ..

How to append contents of multiple files into one file

I want to copy the contents of five files to one file as is. I tried doing it using cp for each file. But that overwrites the contents copied from the previous file. I also tried paste -d "\n" 1.txt..

Change Activity's theme programmatically

In particular cases I need to remove dialog theme from my activity but it doesn't seem to be working. Here's an example First activity: public void onCreate(Bundle savedInstanceState) { super.on..

How to get phpmyadmin username and password

I have intalled phpmyadmin recently in my system. Now I lost its username and password. I tried the below methods for login. in etc/phpmyadmin/ I activated the AllowNoPassword $cfg[..

Run javascript function when user finishes typing instead of on key up?

I want to trigger an ajax request when the user has finished typing in a text box. I don't want it to run the function on every time the user types a letter because that would result in A LOT of ajax ..

How to show a confirm message before delete?

I want to get a confirm message on clicking delete (this maybe a button or an image). If the user selects 'Ok' then delete is done, else if 'Cancel' is clicked nothing happens. I tried echoing this ..

Test if string is a number in Ruby on Rails

I have the following in my application controller: def is_number?(object) true if Float(object) rescue false end and the following condition in my controller: if mystring.is_number? end The c..

Store boolean value in SQLite

What is the type for a BOOL value in SQLite? I want to store in my table TRUE/FALSE values. I could create a column of INTEGER and store in it values 0 or 1, but it won't be the best way to implement ..

How do I set default terminal to terminator?

Using Xubuntu. I'd like to have terminator replace the default terminal. For instance, when right-clicking inside a folder then selecting open terminal, I'd like Terminator to open instead of the de..

Cannot truncate table because it is being referenced by a FOREIGN KEY constraint?

Using MSSQL2005, can I truncate a table with a foreign key constraint if I first truncate the child table (the table with the primary key of the FK relationship)? I know that I can either Use a DEL..

How do I "un-revert" a reverted Git commit?

Given a change that has been committed using commit, and then reverted using revert, what is the best way to then undo that revert? Ideally, this should be done with a new commit, so as to not re-wri..

Android Fragment handle back button press

I have some fragments in my activity [1], [2], [3], [4], [5], [6] And on Back Button Press I must to return from [2] to [1] if current active fragment is [2], or do nothing otherwise. What is the ..

Not able to change TextField Border Color

I am trying to change color of the border of my TextField using a BorderSide, but it does not work. This is my code below. new TextField( decoration: new InputDecoration( border: new OutlineIn..

pull access denied repository does not exist or may require docker login

I am using Laravel 4.2 with docker. I setup it on local. It worked without any problem but when I am trying to setup online using same procedure then I am getting error pull access denied for <pro..

how to check if a form is valid programmatically using jQuery Validation Plugin

I have a form with a couple of buttons and I'm using jQuery Validation Plugin from I just want to know if there is any way I can check if the form is considered..

CSS checkbox input styling

Any style for input affects every input element. Is there a way to specify styling to apply for only checkboxes without applying a class to each check box element?..

How to get tf.exe (TFS command line client)?

What's the minimum amount of software I need to install to get the 'tf.exe' program?..

Is there a native jQuery function to switch elements?

Can I easily swap two elements with jQuery? I'm looking to do this with one line if possible. I have a select element and I have two buttons to move up or down the options, and I already have the se..

Is there a NumPy function to return the first index of something in an array?

I know there is a method for a Python list to return the first index of something: >>> l = [1, 2, 3] >>> l.index(2) 1 Is there something like that for NumPy arrays?..

Groovy: How to check if a string contains any element of an array?

I have an array of strings pointAddress and I want to check each entry if it contains strings from another array, validPointTypes. def pointAddress = ['bacnet://240101/AV:3', 'bacnet://240101/BV:9', ..

How to autosize a textarea using Prototype?

I'm currently working on an internal sales application for the company I work for, and I've got a form that allows the user to change the delivery address. Now I think it would look much nicer, if th..

Connect different Windows User in SQL Server Management Studio (2005 or later)

Is there a way in SQL Server Management Studio 2005 (or later) to change the Windows Authentication user (as you could in SQL Server 2000 and older)? This is the general connection properties dialog(..

Javascript, Time and Date: Getting the current minute, hour, day, week, month, year of a given millisecond time

I'm still wrapping my head around this library, but I'm out of time so I'll just skip to the spoiler section and ask. With a given, arbitrary millisecond time value (like the kind you'd gave from .ge..

How to define optional methods in Swift protocol?

Is it possible in Swift? If not then is there a workaround to do it?..

Set session variable in laravel

I would like to set a variable in the session using laravel this way Session::set('variableName')=$value; but the problem is that I don't know where to put this code, 'cause I would like to set it ..

How do I overload the square-bracket operator in C#?

DataGridView, for example, lets you do this: DataGridView dgv = ...; DataGridViewCell cell = dgv[1,5]; but for the life of me I can't find the documentation on the index/square-bracket operator. W..

Global and local variables in R

I am a newbie for R, and I am quite confused with the usage of local and global variables in R. I read some posts on the internet that say if I use = or <- I will assign the variable in the curren..

How to change letter spacing in a Textview?

How can i change letter spacing in a textview? Will it help if I have HTML text in it (I cannot use webview in my code). P.S. I'm using my own typeface in the textview with HTML text...

Converting Varchar Value to Integer/Decimal Value in SQL Server

How to convert the value of records in a table with data type varchar to integer or decimal so I can get the sum of the value. I use SQL Server 2005. Say that I have table structure like this: ID in..

CSS3's border-radius property and border-collapse:collapse don't mix. How can I use border-radius to create a collapsed table with rounded corners?

Edit - Original Title: Is there an alternative way to achieve border-collapse:collapse in CSS (in order to have a collapsed, rounded corner table)? Since it turns out that simply getting the table's ..

How can I auto increment the C# assembly version via our CI platform (Hudson)?

Myself and my group are horrendous at incrementing assembly version numbers and we frequently ship assemblies with versions. Obviously, this causes a lot of headaches. We're getting a lot be..

Excel Calculate the date difference from today from a cell of "7/6/2012 10:26:42"

So I have a cell with 7/6/2012 10:26:42 inputted, I want to show the date difference from today in another cell. I tried to extract 7/6/2012 with =LEFT(A1, Find(" ", A1, 1) -1) but turned out theres..

What is an .axd file?

What kind of purpose do .axd files serve? I know that it is used in the ASP.Net AJAX Toolkit and its controls. I'd like to know more about it. I tried Googling for it, but could not find getting ba..

How to send an HTTP request using Telnet

How to get a web page's content using Telnet? For example, the content of

How to find substring inside a string (or how to grep a variable)?

I'm using BASH, and I don't know how to find a substring. It keeps failing, I've got a string (should this be an array?) Below, LIST is a string list of database names, SOURCE is the reply, one of th..

Creating object with dynamic keys

First off, I'm using Cheerio for some DOM access and parsing with Node.js. Good times. Heres the situation: I have a function that I need to create an object. That object uses variables for both it..

Is there a command line utility for rendering GitHub flavored Markdown?

I'm wondering if there is a command line utility for taking a GitHub flavored Markdown file and rendering it to HTML. I'm using a GitHub wiki to create website content. I've cloned the repository on ..

How to use activity indicator view on iPhone?

An activity indicator view is useful in many applications. Any ideas about how to add, activiate and dismiss an activity indicator view on iPhone? All the methods for this are welcomed here...

How to load image to WPF in runtime?

It seems like it's quite complicated to load an image in runtime to a WPF window. Image image; image = new Uri("Bilder/sas.png", UriKind.Relative); ????.Source = new BitmapImage(image); I'm trying ..

Getting min and max Dates from a pandas dataframe

How do I get the min and max Dates from a dataframe's major axis? value Date 2014-03-13 10000.000 2014-03-21 2000.000 2014-03-27 2000.000 ..

How to create a vector of user defined size but with no predefined values?

In C++ one can create an array of predefined size, such as 20, with int myarray[20]. However, the online documentation on vectors doesn't show an alike way of initialising vectors: Instead, a vector s..

How to add a fragment to a programmatically generated layout?

I have the following code working which generates fragments, but only if I am adding them to a linear layout which exists in my XML file. LinearLayout fragmentsLayout = (LinearLayout) findViewById(R...

When should I really use noexcept?

The noexcept keyword can be appropriately applied to many function signatures, but I am unsure as to when I should consider using it in practice. Based on what I have read so far, the last-minute addi..

Setting environment variable in react-native?

I am using react-native to build a cross-platform app, but I do not know how to set the environment variable so that I can have different constants for different environments. Example: development: ..

WCF service maxReceivedMessageSize basicHttpBinding issue

I can't seem to get my WCF service to accept large amounts of data being sent up to it. I configured the maxReceivedMessageSize for the client and could receive large data down just fine, that's no..

Using C++ base class constructors?

While working with templates I ran into a need to make a base class constructors accessible from inherited classes for object creation to decrease copy/paste operations. I was thinking to do this thro..

File inside jar is not visible for spring

All I created a jar file with the following MANIFEST.MF inside: Manifest-Version: 1.0 Ant-Version: Apache Ant 1.8.3 Created-By: 1.6.0_25-b06 (Sun Microsystems Inc.) Main-Class: my.Main Class-Path: ...

How to determine the Schemas inside an Oracle Data Pump Export file

I have an Oracle database backup file (.dmp) that was created with expdp. The .dmp file was an export of an entire database. I need to restore 1 of the schemas from within this dump file. I don't kno..

Git adding files to repo

I followed basic Git tutorial and added README file, which worked. Then I copied my project files to the same folder and tried to add them to repository by running git add --all git ci 'test' (my ali..

Load and execution sequence of a web page?

I have done some web based projects, but I don't think too much about the load and execution sequence of an ordinary web page. But now I need to know detail. It's hard to find answers from Google or S..

pretty-print JSON using JavaScript

How can I display JSON in an easy-to-read (for human readers) format? I'm looking primarily for indentation and whitespace, with perhaps even colors / font-styles / etc...

Express.js req.body undefined

I have this as configuration of my Express server app.use(app.router); app.use(express.cookieParser()); app.use(express.session({ secret: "keyboard cat" })); app.set('view engine', 'ejs'); app.set("..

Eclipse C++: Symbol 'std' could not be resolved

I am getting this error in the TestExecute.cpp - "Symbol 'std' could not be resolved" CODE #include <iostream> using namespace std; I just created a executable project in Eclipse (in W..

HTTP response code for POST when resource already exists

I'm building a server that allows clients to store objects. Those objects are fully constructed at client side, complete with object IDs that are permanent for the whole lifetime of the object. I ha..

How to delete last character in a string in C#?

Building a string for post request in the following way, var itemsToAdd = sl.SelProds.ToList(); if (sl.SelProds.Count() != 0) { foreach (var item in itemsToAdd) { paramstr =..

How to store a command in a variable in a shell script?

I would like to store a command to use at a later period in a variable (not the output of the command, but the command itself) I have a simple script as follows: command="ls"; echo "Command: $comman..

angular-cli server - how to proxy API requests to another server?

With the angular-cli ng serve local dev server, it's serving all the static files from my project directory. How can I proxy my AJAX calls to a different server?..

HashMap to return default value for non-found keys?

Is it possible to have a HashMap return a default value for all keys that are not found in the set?..

Python 3: ImportError "No Module named Setuptools"

I'm having troubles with installing packages in Python 3. I have always installed packages with install. But now, when I try to install the ansicolors package I get: importerror "No Modu..

How to determine the IP address of a Solaris system

What command do I want to issue when I want to know the IP address of the Solaris machine I'm logged onto?..

dispatch_after - GCD in Swift?

I've gone through the iBook from Apple, and couldn't find any definition of it: Can someone explain the structure of dispatch_after? dispatch_after(<#when: dispatch_time_t#>, <#queue: dispa..

Difference between numpy dot() and Python 3.5+ matrix multiplication @

I recently moved to Python 3.5 and noticed the new matrix multiplication operator (@) sometimes behaves differently from the numpy dot operator. In example, for 3d arrays: import numpy as np a = np...

Which is the best library for XML parsing in java

I'm searching the java library for parsing XML (complex configuration and data files), I googled a bit but couldn't found other than dom4j (Seems like they are working on V2).. I have taken look at co..

How to use PrimeFaces p:fileUpload? Listener method is never invoked or UploadedFile is null / throws an error / not usable

I'm trying to upload a file using PrimeFaces, but the fileUploadListener method isn't being invoked after the upload finishes. Here is the view: <h:form> <p:fileUpload fileUploadListene..

How to delete all files and folders in a folder by cmd call

I use Windows. I want to delete all files and folders in a folder by system call. I may call like that: >rd /s /q c:\destination >md c:\destination Do you know an easier way?..