Questions Tagged with #Distribution

This tag concerns statistical distributions, their implementations, and properties.

Fitting empirical distribution to theoretical ones with Scipy (Python)?

INTRODUCTION: I have a list of more than 30,000 integer values ranging from 0 to 47, inclusive, e.g.[0,0,0,0,..,1,1,1,1,...,2,2,2,2,...,47,47,47,...] sampled from some continuous distribution. The val..

Generate random numbers following a normal distribution in C/C++

How can I easily generate random numbers following a normal distribution in C or C++? I don't want any use of Boost. I know that Knuth talks about this at length but I don't have his books at hand r..

How to draw a standard normal distribution in R

Possible Duplicate: Making a standard normal distribution in R Using R, draw a standard normal distribution. Label the mean and 3 standard deviations above and below the (10) mean. Inclu..

Rails 3.1 and Image Assets

I have put all my images for my admin theme in the assets folder within a folder called admin. Then I link to it like normal ie. # Ruby image_tag "admin/file.jpg" ..... #CSS .logo{ background:url..

How do I install TensorFlow's tensorboard?

How do I install TensorFlow's tensorboard?..

Android SDK is missing, out of date, or is missing templates. Please ensure you are using SDK version 22 or later

Possible duplicate, I just download a Android Studio Zip file like Eclipse, as I opened getting this error. But problem is how to update it?..

Indirectly referenced from required .class file

I'm getting an error message when I try to build my project in eclipse: The type weblogic.utils.expressions.ExpressionMap cannot be resolved. It is indirectly referenced from required .class files ..

Setting selected values for ng-options bound select elements

Fiddle with the relevant code: I'm trying to set the selected value of a drop down that is bound to a child collection of an object referenced in an ng-repeat. I don't ..

Gradle to execute Java class (without modifying build.gradle)

There is simple Eclipse plugin to run Gradle, that just uses command line way to launch gradle. What is gradle analog for maven compile and run mvn compile exec:java -Dexec.mainClass=example.Example ..

Is either GET or POST more secure than the other?

When comparing an HTTP GET to an HTTP POST, what are the differences from a security perspective? Is one of the choices inherently more secure than the other? If so, why? I realize that POST doesn't ..

Read a text file in R line by line

I would like to read a text file in R, line by line, using a for loop and with the length of the file. The problem is that it only prints character(0). This is the code: fileName="up_down.txt" con=fi..

Confirm deletion using Bootstrap 3 modal box

I need to confirm deletion using Bootstrap 3 modal box (YES/NO). How can I create this? HTML code: <form action="blah" method="POST"> <button class='btn' type="submit" name="remove_leve..

How to add local jar files to a Maven project?

How do I add local jar files (not yet part of the Maven repository) directly in my project's library sources?..

How to use Redirect in the new react-router-dom of Reactjs

I am using the last version react-router module, named react-router-dom, that has become the default when developing web applications with React. I want to know how to make a redirection after a POST ..

How do you write a migration to rename an ActiveRecord model and its table in Rails?

I'm terrible at naming and realize that there are a better set of names for my models in my Rails app. Is there any way to use a migration to rename a model and its corresponding table?..

bootstrap.min.js:6 Uncaught Error: Bootstrap dropdown require Popper.js

Suddenly I started to get error when I try to open my dropdown menu : bootstrap.min.js:6 Uncaught Error: Bootstrap dropdown require Popper.js ( at bootstrap.min.js:6 ..

How do I tidy up an HTML file's indentation in VI?

How do I fix the indentation of his huge html files which was all messed up? I tried the usual "gg=G command, which is what I use to fix the indentation of code files. However, it didn't seem to wor..

Round to at most 2 decimal places (only if necessary)

I'd like to round at most 2 decimal places, but only if necessary. Input: 10 1.7777777 9.1 Output: 10 1.78 9.1 How can I do this in JavaScript? ..

Use of ~ (tilde) in R programming Language

I saw in a tutorial about regression modeling the following command: myFormula <- Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width What exactly does this command do, and what is t..

MySQL: can't access root account

I'm running MySQL 5.x on my local Windows box and, using MySQL administrator, I can't connect to the databases I created using the root account. The error I get is: MySQL Error number 1045 Access ..

How to print binary number via printf

Possible Duplicate: Is there a printf converter to print in binary format? Here is my program #include<stdio.h> int main () { int i,a=2; i=~a; printf("a=%d\ni=%d\n",a,i); ..

How to convert Blob to String and String to Blob in java

I'm trying to get string from BLOB datatype by using Blob blob = rs.getBlob(cloumnName[i]); byte[] bdata = blob.getBytes(1, (int) blob.length()); String s = new String(bdata); It is working fine b..

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

MySQL - ignore insert error: duplicate entry

I am working in PHP. Please what's the proper way of inserting new records into the DB, which has unique field. I am inserting lot of records in a batch and I just want the new ones to be inserted an..

Set a button group's width to 100% and make buttons equal width?

I'm using Bootstrap, and I'd like to set an entire btn-group to have a width of 100% of its parent element. I'd also like the inner buttons to take equal widths. As it is, I can't achieve either. I'..

Mocking a function to raise an Exception to test an except block

I have a function (foo) which calls another function (bar). If invoking bar() raises an HttpError, I want to handle it specially if the status code is 404, otherwise re-raise. I am trying to write so..

How to get the browser to navigate to URL in JavaScript

What is the best (correct, modern, cross-browser, safe) way to get a web browser to navigate to a URL of your choice using JavaScript?..

How to adjust the size of y axis labels only in R?

How can I adjust only the size of Y-axis labels in R? I know that cex.axis alters the size of the axis labels but it only affects the x-axis. Why, and how can I adjust the y axis?..

How to make bootstrap 3 fluid layout without horizontal scrollbar

here is sample link: this is html i use. <div class="row"> <div class="col-md-6">.col-md-6</div> <div class="col-md-6">.col-md-6</div> <..

How to cast int to enum in C++?

How do I cast an int to an enum in C++? For example: enum Test { A, B }; int a = 1; How do I convert a to type Test::A?..

What is the difference between an annotated and unannotated tag?

If I want to tag the current commit. I know both of the following command lines work: git tag <tagname> and git tag -a <tagname> -m '<message>' What is the difference between t..

How to generate JAXB classes from XSD?

I'm a total newbie with XML. I'm doing a Java EE project REST implementation and we return a lot of XML. With this we decided to use JAXB. So far, we manually coded the Models for the XML. But there ..

How might I schedule a C# Windows Service to perform a task daily?

I have a service written in C# (.NET 1.1) and want it to perform some cleanup actions at midnight every night. I have to keep all code contained within the service, so what's the easiest way to accomp..

Trigger validation of all fields in Angular Form submit

I'm using this method: to only validate fields on blur. This works fine, but I would also like to validate them (and thus show the errors for those ..

Lightweight Javascript DB for use in Node.js

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

database attached is read only

I used the following the script to attach a database. But the database created is read only. What modifications should I make in the script to make it read-write. Please help me. USE [master] GO CRE..

Kotlin Ternary Conditional Operator

What is the equivalent of this expression in Kotlin? a ? b : c This is not valid code in Kotlin...

How to get multiple counts with one SQL query?

I am wondering how to write this query. I know this actual syntax is bogus, but it will help you understand what I am wanting. I need it in this format, because it is part of a much bigger query. SE..

How can I transform string to UTF-8 in C#?

I have a string that I receive from a third party app and I would like to display it correctly in any language using C# on my Windows Surface. Due to incorrect encoding, a piece of my string looks l..

Angular pass callback function to child component as @Input similar to AngularJS way

AngularJS has the & parameters where you could pass a callback to a directive (e.g AngularJS way of callbacks. Is it possible to pass a callback as an @Input for an Angular Component (something li..

python object() takes no parameters error

I can't believe this is actually a problem, but I've been trying to debug this error and I've gotten nowhere. I'm sure I'm missing something really simple because this seems so silly. import Experien..

Insert if not exists Oracle

I need to be able to run an Oracle query which goes to insert a number of rows, but it also checks to see if a primary key exists and if it does, then it skips that insert. Something like: INSERT ALL ..

Emulate Samsung Galaxy Tab

I would like to test my application with new Samsung Galaxy Tab tablet. What parameter should I set in emulator to emulate this device? What resolution and density should I set? How can I indicate ..

DateTime.TryParse issue with dates of yyyy-dd-MM format

I have the following date in string format "2011-29-01 12:00 am" . Now I am trying to convert that to datetime format with the following code: DateTime.TryParse(dateTime, out dt); But I am alwayws..

How do I upgrade the Python installation in Windows 10?

I have a Python 2.7.11 installed on one of my LAB stations. I would like to upgrade Python to at least 3.5. How should I do that ? Should I prefer to completely uninstall 2.7.11 and than install the ..

Node.js connect only works on localhost

I've written a small Node.js app, using connect, that serves up a web page, then sends it regular updates. It also accepts and logs user observations to a disk file. It works fine as long as I am on ..

Python: How exactly can you take a string, split it, reverse it and join it back together again?

How exactly can you take a string, split it, reverse it and join it back together again without the brackets, commas, etc. using python?..

python time + timedelta equivalent

I'm trying to do something like this: time() + timedelta(hours=1) however, Python doesn't allow it, apparently for good reason. Does anyone have a simple work around? Related: What is the stand..

split python source code into multiple files?

I have a code that I wish to split apart into multiple files. In matlab one can simply call a .m file, and as long as it is not defined as anything in particular it will just run as if it were part of..

Capture Image from Camera and Display in Activity

I want to write a module where on a click of a button the camera opens and I can click and capture an image. If I don't like the image I can delete it and click one more image and then select the ima..

Numpy: Creating a complex array from 2 real ones?

I want to combine 2 parts of the same array to make a complex array: Data[:,:,:,0] , Data[:,:,:,1] These don't work: x = np.complex(Data[:,:,:,0], Data[:,:,:,1]) x = complex(Data[:,:,:,0], Data[:,:,:..

jQuery's .click - pass parameters to user function

I am trying to call a function with parameters using jQuery's .click, but I can't get it to work. This is how I want it to work: $('.leadtoscore').click(add_event('shot')); which calls function ad..

How to increase buffer size in Oracle SQL Developer to view all records?

How to increase buffer size in Oracle SQL Developer to view all records (there seems to be a certain limit set at default)? Any screen shots and/or tips will be very helpful...

How do you clear your Visual Studio cache on Windows Vista?

I have a problem where my ASP.NET controls are not able to be referenced from the code behind files. I found a solution in Stack Overflow question ASP.NET controls cannot be referenced in code-..

Where can I find a list of Mac virtual key codes?

I'm using CGEventCreateKeyboardEvent and need to know what CGKeyCode values to use. Specifically, I am after the key code for the Command key. The docs give examples for other keys: z is 6, shift is ..

Update ViewPager dynamically?

I can't update the content in ViewPager. What is the correct usage of methods instantiateItem() and getItem() in FragmentPagerAdapter class? I was using only getItem() to instantiate and return my f..

jQuery find file extension (from string)

I was wondering if it was possible for jQuery to find a file extension based on a returned string? A filename (string) will be passed to a function (openFile) and I wanted that function to do differe..

What parameters should I use in a Google Maps URL to go to a lat-lon?

I would like to produce a url for Google Maps that goes to a specific latitude and longitude. Now, I generate a url such as this: 41.881N 152 31.324W..

bootstrap 4 file input doesn't show the file name

I have a problem with the custom-file-input class in Bootstrap 4. after I chose which file I want to upload the filename do not show. I use this code: <div class="input-group mb-3"> <div ..

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

How to enable CORS in AngularJs

I have created a demo using JavaScript for Flickr photo search API. Now I am converting it to the AngularJs. I have searched on internet and found below configuration. Configuration: myApp.config(..

How to overwrite the output directory in spark

I have a spark streaming application which produces a dataset for every minute. I need to save/overwrite the results of the processed data. When I tried to overwrite the dataset

On delete cascade with doctrine2

I'm trying to make a simple example in order to learn how to delete a row from a parent table and automatically delete the matching rows in the child table using Doctrine2. Here are the two entities ..

Footnotes for tables in LaTeX

When I do \footnote{} for a value in a table, the footnote doesn't show up. How do I get it to show up? Also, is it possible to get it to show up at the bottom of the table rather than the bottom of t..

Take nth column in a text file

I have a text file: 1 Q0 1657 1 19.6117 Exp 1 Q0 1410 2 18.8302 Exp 2 Q0 3078 1 18.6695 Exp 2 Q0 2434 2 14.0508 Exp 2 Q0 3129 3 13.5495 Exp I want to take the 2nd and 4th word of every line like th..

Shorthand if/else statement Javascript

I'm wondering if there's a shorter way to write this: var x = 1; if(y != undefined) x = y; I initially tried x = y || 1, but that didn't work. What's the correct way to go about this?..

Hide horizontal scrollbar on an iframe?

I need to hide the horizontal scollbar on an iframe using css, jquery or js...

Maximum and Minimum values for ints

I am looking for minimum and maximum values for integers in python. For eg., in Java, we have Integer.MIN_VALUE and Integer.MAX_VALUE. Is there something like this in python?..

Importing variables from another file?

How can I import variables from one file to another? example: file1 has the variables x1 and x2 how to pass them to file2? How can I import all of the variables from one to another?..

Making a Bootstrap table column fit to content

I'm using Bootstrap, and drawing a table. The rightmost column has a button in it, and I want it to drop down to the minimum size it needs to fit said button. _x000D_ _x000D_ <link href="https://m..

What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it?

What does ArrayIndexOutOfBoundsException mean and how do I get rid of it? Here is a code sample that triggers the exception: String[] names = { "tom", "bob", "harry" }; for (int i = 0; i <= name..

What is a provisioning profile used for when developing iPhone applications?

What is the purpose of a provisioning profile and why is it needed when developing an iPhone application? If I don't have a provisioning profile, what happens?..

Installing a local module using npm?

I have a downloaded module repo, I want to install it locally, not globally in another directory? What is an easy way to do this?..

How do I provide a username and password when running "git clone [email protected]"?

I know how to provide a username and password to an HTTPS request like this: git clone https://username:password@remote But I'd like to know how to provide a username and password to the remote lik..

The difference between fork(), vfork(), exec() and clone()

I was looking to find the difference between these four on Google and I expected there to be a huge amount of information on this, but there really wasn't any solid comparison between the four calls. ..

How to check if file already exists in the folder

I am trying to copy some files to folder. I am using the following statement to check if the source fie exists If My.Computer.FileSystem.FileExists(fileToCopy) Then But I donot know how to check i..

How to save a spark DataFrame as csv on disk?

For example, the result of this: df.filter("project = 'en'").select("title","count").groupBy("title").sum() would return an Array. How to save a spark DataFrame as a csv file on disk ?..

What is the question mark for in a Typescript parameter name

export class Thread { id: string; lastMessage: Message; name: string; avatarSrc: string; constructor(id?: string, name?: string, avatarSrc?: string) { this.i..

Service located in another namespace

I have been trying to find a way to define a service in one namespace that links to a Pod running in another namespace. I know that containers in a Pod running in namespaceA can access serviceX defin..

Capturing window.onbeforeunload

I have a form where the input fields are saved onChange. In Firefox (5) this works even when the window is closed, but for Chrome and IE it doesn't and I need to be sure that I'm saving this data even..

OnItemCLickListener not working in listview

Activity class code: conversationList = (ListView)findViewById(; ConversationArrayAdapter conversationArrayAdapter=new ConversationArrayAdapter(this, R.layout.conversation_list_ite..

__init__() missing 1 required positional argument

I am trying to learn Python. This is a really simple code. All I am trying to do here is to call a class's constructor. Initialize some variables there and print that variable. But it is giving me an ..

How to escape apostrophe (') in MySql?

The MySQL documentation says that it should be \'. However, both scite and mysql shows that '' works. I saw that and it works. What should I do?..

PHP - Notice: Undefined index:

Possible Duplicate: PHP: “Notice: Undefined variable” and “Notice: Undefined index” I am trying to do a registration form that registers a user in a database (MySQL). The code is ..

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

Javascript validation: Block special characters

How can I restrict users from entering special characters in the text box. I want only numbers and alphabets to be entered ( Typed / Pasted ). Any samples?..

Where is after pip install?

I'm trying to setup virtualenvwrapper on OSX, and all the instructions and tutorials I've found tell me to add a source command to .profile, pointing towards I've checked all the..

Formatting a field using ToText in a Crystal Reports formula field

I'm trying to create a Crystal Reports formula field (to calculate the percentage change in a price) that will return "N/A" if a particular report field is null, but return a number to two decimal pla..

Installing ADB on macOS

I had issues finding a good solid tutorial on how to setup ADB for Mac. How can I add ADB to macOS in such a way that it can be used in the terminal? UPDATE For those reading this post. Yes, as t..

Can anyone recommend a simple Java web-app framework?

I'm trying to get started on what I'm hoping will be a relatively quick web application in Java, yet most of the frameworks I've tried (Apache Wicket, Liftweb) require so much set-up, configuration, a..

Can you force Vue.js to reload/re-render?

Just a quick question. Can you force Vue.js to reload/recalculate everything? If so, how?..

Create table in SQLite only if it doesn't exist already

I want to create a table in a SQLite database only if doesn't exist already. Is there any way to do this? I don't want to drop the table if it exists, only create it if it doesn't...

Calculate a MD5 hash from a string

I use the following C# code to calculate a MD5 hash from a string. It works well and generates a 32-character hex string like this: 900150983cd24fb0d6963f7d28e17f72 string sSourceData; byte[] tmpSour..

Shared folder between MacOSX and Windows on Virtual Box

I need to set up shared folder. I've got Mac OSX Yosemite host and clean Win7 x64 on the VirtualBox. In MacOSX, i go to the VirtualBox -> win7 settings -> "Shared Folders" -> Add shared folder -> c..

Run all SQL files in a directory

I have a number of .sql files which I have to run in order to apply changes made by other developers on an SQL Server 2005 database. The files are named according to the following pattern: 0001 - abc..

How to use a TRIM function in SQL Server

I cannot get this TRIM code to work SELECT dbo.COL_V_Cost_GEMS_Detail.TNG_SYS_NR AS [EHP Code], dbo.COL_TBL_VCOURSE.TNG_NA AS [Course Title], LTRIM(RTRIM(FCT_TYP_CD)& ') AND (' & ..

html text input onchange event

is there a way to implement a text change event to detect text change on an HTML input text field? It's possible to simulate these using key events (key press etc), however, it's really not performan..

Query for documents where array size is greater than 1

I have a MongoDB collection with documents in the following format: { "_id" : ObjectId("4e8ae86d08101908e1000001"), "name" : ["Name"], "zipcode" : ["2223"] } { "_id" : ObjectId("4e8ae86d08101..

Bootstrap Carousel Full Screen

I am trying to get the image in the bootstrap carousel to show full screen but haven't been able to figure it out, I've been working on this for awhile and am totally stuck. Right now I have just one..

how to open a jar file in Eclipse

I downloaded a demo jar file, and would like to open it in eclipse. What I did is import->Existing projects into workspace ->select archive file However, the eclipse returns "No projects are fou..

Java "lambda expressions not supported at this language level"

I was testing out some new features of Java 8 and copied the example into my IDE (Eclipse originally, then IntelliJ) as shown here Eclipse offered no support whatsoever for lambda expressions, and In..

Where does Hive store files in HDFS?

I'd like to know how to find the mapping between Hive tables and the actual HDFS files (or rather, directories) that they represent. I need to access the table files directly. Where does Hive store i..

How do I configure IIS for URL Rewriting an AngularJS application in HTML5 mode?

I have the AngularJS seed project and I've added $locationProvider.html5Mode(true).hashPrefix('!'); to the app.js file. I want to configure IIS 7 to route all requests to http://localhost/ap..

Why isn't sizeof for a struct equal to the sum of sizeof of each member?

Why does the sizeof operator return a size larger for a structure than the total sizes of the structure's members?..

Vue v-on:click does not work on component

I'm trying to use the on click directive inside a component but it does not seem to work. When I click the component nothings happens when I should get a 'test clicked' in the console. I don't see any..

Can I open a dropdownlist using jQuery

For this dropdownlist in HTML: <select id="countries"> <option value="1">Country</option> </select> I would like to open the list (the same as left-clicking on it). Is this ..

Delete duplicate records from a SQL table without a primary key

I have the below table with the below records in it create table employee ( EmpId number, EmpName varchar2(10), EmpSSN varchar2(11) ); insert into employee values(1, 'Jack', '555-55-5555'); inser..

How to Update Date and Time of Raspberry Pi With out Internet

I have connect my Raspberry Pi to LAN but there is no internet available. Is there any method to update raspberry pi date time by using a PC (windows 7) in LAN? I want to get computer date and time to..

Laravel 5.4 redirection to custom url after login

I am using Laravel Framework 5.4.10, and I am using the regular authentication that php artisan make:auth provides. I want to protect the entire app, and to redirect users to /themes after login. ..

Write objects into file with Node.js

I've searched all over stackoverflow / google for this, but can't seem to figure it out. I'm scraping social media links of a given URL page, and the function returns an object with a list of URLs. ..

How can I do width = 100% - 100px in CSS?

In CSS, how can I do something like this: width: 100% - 100px; I guess this is fairly simple but it is a bit hard to find examples showing that...

Python multiprocessing PicklingError: Can't pickle <type 'function'>

I am sorry that I can't reproduce the error with a simpler example, and my code is too complicated to post. If I run the program in IPython shell instead of the regular Python, things work out well. ..

Can PHP cURL retrieve response headers AND body in a single request?

Is there any way to get both headers and body for a cURL request using PHP? I found that this option: curl_setopt($ch, CURLOPT_HEADER, true); is going to return the body plus headers, but then I ne..

Get the last day of the month in SQL

I need to get the last day of the month given as a date in SQL. If I have the first day of the month, I can do something like this: DATEADD(DAY, DATEADD(MONTH,'2009-05-01',1), -1) But does anyone k..

Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: VISTA

I am not able to run my script in any of the browsers. Below is the error i get for firefox. The location where firefox is installed is correct. Dont know what is wrong. I am using Firefox 15. Seleni..

Loading all images using imread from a given folder

Loading and saving images in OpenCV is quite limited, so... what is the preferred ways to load all images from a given folder? Should I search for files in that folder with .png or .jpg extensions, st..

XmlWriter to Write to a String Instead of to a File

I have a WCF service that needs to return a string of XML. But it seems like the writer only wants to build up a file, not a string. I tried: string nextXMLstring = ""; using (XmlWriter writer = Xm..

Count words in a string method?

I was wondering how I would write a method to count the number of words in a java string only by using string methods like charAt, length, or substring. Loops and if statements are okay! I really ap..

How to set the first option on a select box using jQuery?

I have two HTML select boxes. I need to reset one select box when I make a selection in another. <select id="name" > <option value="">select all</option> <option value="1..

How to send a HTTP OPTIONS request from the command line?

I tried to use cURL but it seems that by default (Debian) is not compiled with HTTPS support and I dont want to build it myself. wget seems to have SSL support but I found no information on how to ge..

jQuery Mobile how to check if button is disabled?

I disable the button like this on my jQuery Mobile webpage: $(document).ready(function() { $("#deliveryNext").button(); $("#deliveryNext").button('disable'); }); and i can enable it with $..

how to break the _.each function in underscore.js

I'm looking for a way to stop iterations of underscore.js _.each() method, but can't find the solution. jQuery .each() can break if you do return false. Is there a way to stop underscore each()? _([..

Node.js - get raw request body using Express

When I use Express, and my code is: app.use(express.bodyParser()); How would I get the raw request body?..

PLS-00201 - identifier must be declared

I executed a PL/SQL script that created the following table TABLE_NAME VARCHAR2(30) := 'B2BOWNER.SSC_Page_Map'; I made an insert function for this table using arguments CREATE OR REPLACE FUNCTION..

HorizontalAlignment=Stretch, MaxWidth, and Left aligned at the same time?

This seems like it should be easy but I'm stumped. In WPF, I'd like a TextBox that stretches to the width of it's parent, but only to a maximum width. The problem is that I want it to be left justifie..

How do you load custom UITableViewCells from Xib files?

The question is simple: How do you load custom UITableViewCell from Xib files? Doing so allows you to use Interface Builder to design your cells. The answer apparently is not simple due to memory mana..

Check string for palindrome

A palindrome is a word, phrase, number or other sequence of units that can be read the same way in either direction. To check whether a word is a palindrome I get the char array of the word and compa..

How to turn on front flash light programmatically in Android?

I want to turn on front flash light (not with camera preview) programmatically in Android. I googled for it but the help i found referred me to this page Does anyone have any links or sample code?..

"Application tried to present modally an active controller"?

I just came across a crash showing a NSInvalidArgumentException with this message on an app which wasn't doing this before. Application tried to present modally an active controller UITabBarCont..

Update cordova plugins in one command

I am wondering is there an easier way to update cordova plugin? I googled, found a hook (@ year 2013), but this is not 100% what I want. I know I can do this by two steps: rm, then add but I am look..

How to tell if browser/tab is active

Possible Duplicate: Is there a way to detect if a browser window is not currently active? I have a function that is called every second that I only want to run if the current page is in the..

How to custom switch button?

I am looking to Custom The Switch Button to becoming as following : How to achieve this ?..

Could not connect to SMTP host: localhost, port: 25; nested exception is: Connection refused: connect

I'm doing application for send email from localhost in jsp & i found error like Could not connect to SMTP host: localhost, port: 25; nested exception is: Connection refu..

How do I find out if first character of a string is a number?

In Java is there a way to find out if first character of a string is a number? One way is string.startsWith("1") and do the above all the way till 9, but that seems very inefficient. ..

Fastest way to check a string contain another substring in JavaScript?

I'm working with a performance issue on JavaScript. So I just want to ask: what is the fastest way to check whether a string contains another substring (I just need the boolean value)? Could you pleas..

What is the maximum size of a web browser's cookie's key?

What is the maximum size of a web browser's cookie's key? I know the maximum size of a cookie is 4KB, but does the key have a limitation as well?..

PHP how to get local IP of system

I need to get local IP of computer like 192.*.... Is this possible with PHP? I need IP address of system running the script, but I do not need the external IP, I need his local network card address...

Meaning of tilde in Linux bash (not home directory)

First off, I know that ~/ is the home directory. CDing to ~ or ~/ takes me to the home directory. However, cd ~X takes me to a special place, where X seems to be anything. In bash, if I hit "cd ~" a..

HAProxy redirecting http to https (ssl)

I'm using HAProxy for load balancing and only want my site to support https. Thus, I'd like to redirect all requests on port 80 to port 443. How would I do this? Edit: We'd like to redirect to the ..

'typeid' versus 'typeof' in C++

I am wondering what the difference is between typeid and typeof in C++. Here's what I know: typeid is mentioned in the documentation for type_info which is defined in the C++ header file typeinfo. ..

ggplot2: sorting a plot

I have a data.frame, that is sorted from highest to lowest. For example: x <- structure(list(variable = structure(c(10L, 6L, 3L, 4L, 2L, 8L, 9L, 5L, 1L, 7L), .Label = c("a", "b", "c", "d", "e", ..

How do I return a string from a regex match in python?

I am running through lines in a text file using a python script. I want to search for an img tag within the text document and return the tag as text. When I run the regex re.match(line) it returns a ..

Convert negative data into positive data in SQL Server

The current data of the table is: a b --------- -1 5 -11 2 -5 32 My request is to convert every data into a positive value. Unfortunately, I forgot the name of the built-in function of SQL..

Docker is installed but Docker Compose is not ? why?

I have installed docker on centos 7. by running following commands, curl -sSL | sh systemctl enable docker && systemctl start docker docker run hello-world NOTE: he..

How can I upload fresh code at github?

I have a directory with all my coding projects. I want to upload (correct terminology?) it to GitHub using the command line. I have already looked at Old question. I know how to clone an existing ..

Changing selection in a select with the Chosen plugin

I'm trying to change the currently selected option in a select with the Chosen plugin. The documentation covers updating the list, and triggering an event when an option is selected, but nothing (tha..

What is the opposite of evt.preventDefault();

Once I've fired an evt.preventDefault(), how can I resume default actions again?..

How to add elements to a list in R (loop)

I would like to add elements to a list in a loop (I don't know exactly how many) Like this: l <- list(); while(...) l <- new_element(...); At the end, l[1] would be my first element, l[2]..

How to remove array element in mongodb?

Here is array structure contact: { phone: [ { number: "+1786543589455", place: "New Jersey", createdAt: "" } { number: "+19..

What is SuppressWarnings ("unchecked") in Java?

Sometime when looking through code, I see many methods specify an annotation: @SuppressWarnings("unchecked") What does this mean?..

How can I get the URL of the current tab from a Google Chrome extension?

I'm having fun with Google Chrome extension, and I just want to know how can I store the URL of the current tab in a variable?..

How to detect simple geometric shapes using OpenCV

I have this project where I need (on iOS) to detect simple geometric shapes inside an image. After searching the internet I have concluded that the best tool for this is OpenCV. The thing is that u..

Save and retrieve image (binary) from SQL Server using Entity Framework 6

I am trying to save a bitmap image to database Bitmap map = new Bitmap(pictureBoxMetroMap.Size.Width, pictureBoxMetroMap.Size.Height); I created a column imgcontent in the database with datatype b..

How to change package name in android studio?

I have made an app and it is my very first app so when I started coding, I left the package name as com.example.stuff and now when I try to upload to the play store it wont let me due to the package n..

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

Intellij idea cannot resolve anything in maven

I'm new to Intellij Idea, i just import a project with pom.xml, but the ide didn't resolve anything in maven dependencies. Anything defined in pom.xml dependencies when import in code raise an error ..

Error :- java runtime environment JRE or java development kit must be available in order to run eclipse

I tried to run "eclipse-jee-juno-win32-x86_64" , but it raised the following error " java runtime environment JRE or java development kit must be available in order to run eclipse. No java virtual mac..

Use table row coloring for cells in Bootstrap

Twitter Bootstrap offers classes to color table rows like so: <tr class="success"> I like the color choice and the class naming. Now what I would like to do, is to re-use these classes and ap..

How to save local data in a Swift app?

I'm currently working on a iOS app developed in Swift and I need to store some user-created content on the device but I can't seem to find a simple and quick way to store/receive the users content on ..

How to print third column to last column?

I'm trying to remove the first two columns (of which I'm not interested in) from a DbgView log file. I can't seem to find an example that prints from column 3 onwards until the end of the line. Note t..

Rename Files and Directories (Add Prefix)

I would like to add prefix on all folders and directories. Example: I have Hi.jpg 1.txt folder/ another_folder.ok/ I would like to add prefix "PRE_" PRE_Hi.jpg PRE_1.txt PR..

MySQL - Meaning of "PRIMARY KEY", "UNIQUE KEY" and "KEY" when used together while creating a table

Can anyone explain about the purpose of PRIMARY KEY, UNIQUE KEY and KEY, if it is put together in a single CREATE TABLE statement in MySQL? CREATE TABLE IF NOT EXISTS `tmp` ( `id` int(11) NOT NULL ..

Index of duplicates items in a python list

Does anyone know how I can get the index position of duplicate items in a python list? I have tried doing this and it keeps giving me only the index of the 1st occurrence of the of the item in the lis..

bootstrap datepicker today as default

I am using this bootstrap-datepicker for my datepicker. I'd like the datepicker to choose "today" for start day or default day. I cannot figure out how to set "today" automatically, so I did an ineff..

How to use the switch statement in R functions?

I would like to use for my function in R the statement switch() to trigger different computation according to the value of the function's argument. For instance, in Matlab you can do that by writing..

Session timeout in ASP.NET

I am running an ASP.NET 2.0 application in IIS 6.0. I want session timeout to be 60 minutes rather than the default 20 minutes. I have done the following Set <sessionState timeout="60"></se..

How to call Makefile from another Makefile?

I'm getting some unexpected results calling one makefile from another. I have two makefiles, one called /path/to/project/makefile and one called /path/to/project/gtest-1.4.0/make/Makefile. I'm attem..

css3 transition animation on load?

Is it possible to use CSS3 transition animation on page load without using Javascript? This is kind of what I want, but on page load: W..

UITableView set to static cells. Is it possible to hide some of the cells programmatically?

UITableView set to static cells. Is it possible to hide some of the cells programmatically?..

How do I get a Cron like scheduler in Python?

I'm looking for a library in Python which will provide at and cron like functionality. I'd quite like have a pure Python solution, rather than relying on tools installed on the box; this way I run on..

Efficient way of having a function only execute once in a loop

At the moment, I'm doing stuff like the following, which is getting tedious: run_once = 0 while 1: if run_once == 0: myFunction() run_once = 1: I'm guessing there is some more a..

How to create an installer for a .net Windows Service using Visual Studio

How do I create an installer for a Windows Service that I have created using Visual Studio?..

How To Upload Files on GitHub

I have recently downloaded GitHub and created a repository on it. I am trying to upload an Objective C project in it. How do I go about doing this? ..

Unable to load script.Make sure you are either running a Metro server or that your bundle '' is packaged correctly for release

react-native run-android command terminates by leaving a message in android simulator. The message is as follows: Unable to load script.Make sure you are either running a Metro server or that your bu..

Ruby: character to ascii from a string

this wiki page gave a general idea of how to convert a single char to ascii But say if I have a string and I wanted to get each character's ascii f..

Getting strings recognized as variable names in R

Related: Strings as variable references in R Possibly related: Concatenate expressions to subset a dataframe I've simplified the question per the comment request. Here goes with some example data. ..

Determine project root from a running node.js application

Is there a better way than process.cwd() to determine the root directory of a running node.js process? Something like the equivalent of Rails.root, but for Node.js. I'm looking for something that is a..

Box shadow for bottom side only

I have an box of content and need to give shadow for that. But I want to give shadow for the bottom of the box only. I used this css box-shadow: 0 3px 5px #000000; If i give this code it shows left,..

How to install SimpleJson Package for Python I am just diving into the Python world and want to make a simple twitter application which requires the installation of simplejson but not sure how I can set it..

Finding elements not in a list

So heres my code: item = [0,1,2,3,4,5,6,7,8,9] z = [] # list of integers for item in z: if item not in z: print item z contains a list of integers. I want to compare item to z and pri..

How to use jQuery to show/hide divs based on radio button selection?

I have some radio buttons and I'd like to have different hidden divs show up based on which radio button is selected. Here's what the HTML looks like: <form name="form1" id="my_form" method="post"..

Writing String to Stream and reading it back does not work

I want to write a String to a Stream (a MemoryStream in this case) and read the bytes one by one. stringAsStream = new MemoryStream(); UnicodeEncoding uniEncoding = new UnicodeEncoding(); String mes..

How to remove illegal characters from path and filenames?

I need a robust and simple way to remove illegal path and file characters from a simple string. I've used the below code but it doesn't seem to do anything, what am I missing? using System; using Sys..

Regular expression matching a multiline block of text

I'm having a bit of trouble getting a Python regex to work when matching against text that spans multiple lines. The example text is ('\n' is a newline) some Varying TEXT\n \n DSJFKDAFJKDAFJDSAKFJADS..

SQL Query NOT Between Two Dates

I need some help with SQL Query. I am trying to select all records from table test_table which would not fit between two dates '2009-12-15' and '2010-01-02'. This is my table structure: `start_dat..

Compare 2 JSON objects

Possible Duplicate: Object comparison in JavaScript Is there any method that takes in 2 JSON objects and compares the 2 to see if any data has changed? Edit After reviewing the comments, ..

How to use split?

I need to break apart a string that always looks like this: something -- something_else. I need to put "something_else" in another input field. Currently, this string example is being added to ..

Naming Classes - How to avoid calling everything a "<WhatEver>Manager"?

A long time ago I have read an article (I believe a blog entry) which put me on the "right" track on naming objects: Be very very scrupulous about naming things in your program. For example if my app..

Remove all occurrences of a value from a list?

In Python remove() will remove the first occurrence of value in a list. How to remove all occurrences of a value from a list? This is what I have in mind: >>> remove_values_from_list([1, 2..

JQuery Redirect to URL after specified time

Is there a way to use JQuery to redirect to a specific URL after a give time period?..

JQuery Validate input file type

I have a form that can have 0-hundreds of <input type="file"> elements. I have named them sequentially depending on how many are dynamically added to the page. For example: <input type="fi..

Rounding a double value to x number of decimal places in swift

Can anyone tell me how to round a double value to x number of decimal places in Swift? I have: var totalWorkTimeInHours = (totalWorkTime/60/60) With totalWorkTime being an NSTimeInterval (double)..

How to get Toolbar from fragment?

I have ActionBarActivity with NavigationDrawer and use support_v7 Toolbar as ActionBar. In one of my fragments toolbar has custom view. In other fragments Toolbar should show title. How get Toolbar i..

Nested rows with bootstrap grid system?

I want 1 larger image with 4 smaller images in a 2x2 format like this: My initial thought was to house everything in one row. Then create two columns, and, in the second column, create two rows an..

Writing handler for UIAlertAction

I'm presenting a UIAlertView to the user and I can't figure out how to write the handler. This is my attempt: let alert = UIAlertController(title: "Title", message: "Messa..

How do I store data in local storage using Angularjs?

Currently I am using a service to perform an action, namely retrieve data from the server and then store the data on the server itself. Instead of this, I want to put the data into local storage inst..

PowerShell: Comparing dates

I am querying a data source for dates. Depending on the item I am searching for, it may have more than date associated with it. get-date ($Output | Select-Object -ExpandProperty "Date") An example ..

Get first row of dataframe in Python Pandas based on criteria

Let's say that I have a dataframe like this one import pandas as pd df = pd.DataFrame([[1, 2, 1], [1, 3, 2], [4, 6, 3], [4, 3, 4], [5, 4, 5]], columns=['A', 'B', 'C']) >> df A B C 0 1 2..

Combining a class selector and an attribute selector with jQuery

Is it possible to combine both a class selector and an attribute selector with jQuery? For example, given the following HTML: <TABLE> <TR class="myclass" reference="12345"><TD>Ro..

How to declare variable and use it in the same Oracle SQL script?

I want to write reusable code and need to declare some variables at the beginning and reuse them in the script, such as: DEFINE stupidvar = 'stupidvarcontent'; SELECT stupiddata FROM stupidtable WHE..

Getting the current Fragment instance in the viewpager

Below is my code which has 3 Fragment classes each embedded with each of the 3 tabs on ViewPager. I have a menu option. As shown in the onOptionsItemSelected(), by selecting an option, I need to updat..

Convert Java string to Time, NOT Date

I would like to convert a variable string to a Time type variable, not Date using Java. the string look like this 17:40 I tried using the code below but this instance is a date type variable not time..

How do I view the SQLite database on an Android device?

I have a set of data in an SQLite database. I need to view the database on a device. How do I do that? I have checked in ddms mode. The data in file explorer is empty...