Questions Tagged with #Iwork

iWork is the Apple suite of office application to create documents, spreadsheets and presentations on the Mac and iOS devices.

Java: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

I have a class that will download a file from a https server. When I run it, it returns a lot of errors. It seems that I have a problem with my certificate. Is it possible to ignore the client-server..

Setting default permissions for newly created files and sub-directories under a directory in Linux?

I have a bunch of long-running scripts and applications that are storing output results in a directory shared amongst a few users. I would like a way to make sure that every file and directory created..

Angular2: Cannot read property 'name' of undefined

I am beginning to learn Angular2. I've been following the Heroes Tutorial provided at angular.io. All was working fine until, being annoyed by the clutter of HTML using the template, I used template ..

Android: Creating a Circular TextView?

My current simple XML is below, however i would like the 3 TextViews within it to be circular, rather than rectangular. How can I change my code to do so? <?xml version="1.0" encoding="utf-8"?>..

Node.js – events js 72 throw er unhandled 'error' event

I'm new to Node.js and wish to run a program using streams. With other programs, I had to start a server simultaneously (mongodb, redis, etc) but I have no idea if I'm supposed to run one with this. P..

Inversion of Control vs Dependency Injection

According to the paper written by Martin Fowler, inversion of control is the principle where the control flow of a program is inverted: instead of the programmer controlling the flow of a program, the..

Use of "global" keyword in Python

What I understand from reading the documentation is that Python has a separate namespace for functions, and if I want to use a global variable in that function, I need to use global. I'm using Python..

Unable to import a module that is definitely installed

After installing mechanize, I don't seem to be able to import it. I have tried installing from pip, easy_install, and via python setup.py install from this repo: https://github.com/abielr/mechanize. ..

How to get certain commit from GitHub project

I need to download the Facebook API from GitHub. Normally, I just click on the 'Downloads" tab to download the latest source code. In this case, I need an older commit: 91f256424531030a454548693c3a6ca..

OnClickListener in Android Studio

I'm attempting to develop and app using the new Android Studio, but I keep receiving major errors on my OnClickListeners. Mainly it is telling me that it cannot resolve symbol "setOnClickListener" and..

What is the string concatenation operator in Oracle?

What is the string concatenation operator in Oracle SQL? Are there any "interesting" features I should be careful of? (This seems obvious, but I couldn't find a previous question asking it). ..

getch and arrow codes

I'm writing a programm that's using getch() to scan for arrow keys. My code so far is: switch(getch()) { case 65: // key up break; case 66: // key down break; case 6..

Angular 2 - innerHTML styling

I am getting chunks of HTML codes from HTTP calls. I put the HTML blocks in a variable and insert it on my page with[innerHTML] but i can not style the inserted HTML block. Does anyone have any sugges..

How to remove a branch locally?

I have a master and a dev branch in my repository. I want to remove the master branch from my computer so that I don't accidentally commit to it (it's happened..). There are questions on here about ..

Unable to auto-detect email address

I'm new to SmartGit. I can't commit through my repository, the message I'm receiving is: Unable to auto-detect email address (got 'Arreane@Arreane-PC.(none)') *** Please tell me who you are. Run ..

Conditional HTML Attributes using Razor MVC3

The variable strCSSClass often has a value but sometimes is empty. I do not want to include an empty class="" in this input element's HTML, which means if strCSSClass is empty, I don't want the clas..

Codeigniter: Passing data from controller to view

I want to pass $data from the controller named poll to the results_view however I am getting an undefined variable error. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'..

<img>: Unsafe value used in a resource URL context

Since upgrading to the latest Angular 2 release candidate, my img tags: <img class='photo-img' [hidden]="!showPhoto1" src='{{theMediaItem.photoURL1}}'> are throwing a browser error: ORIGI..

How do I start my app on startup?

I tried using the sample code in this link but it seems outdated and it did not work. So what changes do I have to make and to what files to have my app start automatically when Android finishes booti..

php.ini & SMTP= - how do you pass username & password

My ISP account requires that I send a username & password for outbound SMTP mail. How do I get PHP to use this when executing php.mail()? The php.ini file only contains entries for the server (S..

How to use HTTP_X_FORWARDED_FOR properly?

Alright, I have an small authentication issue. My web service allows to connect to my API over HTTP with a username and password, but this connection can also be restricted to a specific IP address. ..

Laravel 5 show ErrorException file_put_contents failed to open stream: No such file or directory

I have a project on Laravel 5 and I work with it at the office and at home too. It works fine, but recently at home it stopped working. Laravel show me two ErrorException file_put_contents(G:\projec..

HTML input field hint

I want to provide the user with a hint on what he needs to enter into my text field. However, when I set the value, it does not disappear once a user clicks on the text field. How can you make it disa..

Initialize a vector array of strings

Would it be possible to initialize a vector array of strings. for example: static std::vector<std::string> v; //declared as a class member I used static just to initialize and fill it with st..

Can Mockito capture arguments of a method called multiple times?

I have a method that gets called twice, and I want to capture the argument of the second method call. Here's what I've tried: ArgumentCaptor<Foo> firstFooCaptor = ArgumentCaptor.forClass(Foo.c..

How to decrypt a SHA-256 encrypted string?

I have a string that was salted, hashed with SHA-256, then base64 encoded. Is there a way to decode this string back to its original value?..

How to check if a process is running via a batch script

How can I check if an application is running from a batch (well cmd) file? I need to not launch another instance if a program is already running. (I can't change the app to make it single instance on..

java doesn't run if structure inside of onclick listener

All you must see as code is below. bSet.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method..

jQuery: How to get the event object in an event handler function without passing it as an argument?

I have an onclick attribute on my link: <a href="#" onclick="myFunc(1,2,3)">click</a> That points to this event handler in JavaScript: function myFunc(p1,p2,p3) { //need to refer t..

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

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

Promise.all().then() resolve?

Using Node 4.x. When you have a Promise.all(promises).then() what is the proper way to resolve the data and pass it to the next .then()? I want to do something like this: Promise.all(promises).then(..

Find files containing a given text

In bash I want to return file name (and the path to the file) for every file of type .php|.html|.js containing the case-insensitive string "document.cookie" | "setcookie" How would I do that?..

String strip() for JavaScript?

What's a clean and efficient JavaScript implementation to strip leading and trailing spaces from a string? For example: " dog" "dog " " dog " " dog " all get turned into "dog"..

How to return 2 values from a Java method?

I am trying to return 2 values from a Java method but I get these errors. Here is my code: // Method code public static int something(){ int number1 = 1; int number2 = 2; return number1,..

SCP Permission denied (publickey). on EC2 only when using -r flag on directories

scp -r /Applications/XAMPP/htdocs/keypairfile.pem uploads ec2-user@publicdns:/var/www/html where uploads is a directory returns Permission denied (publickey). However scp -i /Applications/XAMPP/h..

How can you get the first digit in an int (C#)?

In C#, what's the best way to get the 1st digit in an int? The method I came up with is to turn the int into a string, find the 1st char of the string, then turn it back to an int. int start = Conver..

How to call a function after delay in Kotlin?

As the title, is there any way to call a function after delay (1 second for example) in Kotlin?..

How do I escape spaces in path for scp copy in Linux?

I'm new to linux, I want to copy a file from remote to local system... now I'm using scp command in linux system.. I have some folders or files names are with spaces, when I try to copy that file, it ..

What is the email subject length limit?

How many characters are allowed to be in the subject line of Internet email? I had a scan of The RFC for email but could not see specifically how long it was allowed to be. I have a colleague that wan..

Get the last element of a std::string

I was wondering if there's an abbreviation or a more elegant way of getting the last character of a string like in: char lastChar = myString.at( myString.length() - 1 ); Something like myString.bac..

Adjust width and height of iframe to fit with content in it

I need a solution for auto-adjusting the width and height of an iframe to barely fit its content. The point is that the width and height can be changed after the iframe has been loaded. I guess I need..

Cant get text of a DropDownList in code - can get value but not text

I am using ASP.NET 3.5 I have a drop-down list called lstCountry with an item in it like this: <asp:ListItem Value="United States">Canada</asp:ListItem> This will display Canada but i..

jQuery show/hide not working

I have a basic html page with some JS and CSS: _x000D_ _x000D_ $('.expand').click(function() {_x000D_ $('.img_display_content').show();_x000D_ });_x000D_ @charset "utf-8";_x000D_ _x000D_ /* CSS Doc..

Hibernate dialect for Oracle Database 11g?

Is there a Hibernate dialect for Oracle Database 11g? Or should I use the org.hibernate.dialect.Oracle10gDialect that ships with Hibernate?..

How to set Android camera orientation properly?

I want to set the camera orientation according to the device orientation in Android but nothing seems to be working. I tried to rotate the Surface as well as the camera parameters but the camera previ..

Sorting arraylist in alphabetical order (case insensitive)

I have a string arraylist names which contains names of people. I want to sort the arraylist in alphabetical order. ArrayList<String> names = new ArrayList<String>(); names.add("seetha");..

java create date object using a value string

I am using this to get the current time : java.util.Calendar cal = java.util.Calendar.getInstance(); System.out.println(new java.text.SimpleDateFormat("EEEE, dd/MM/yyyy/hh:mm:ss") .fo..

Use of min and max functions in C++

From C++, are min and max preferable over fmin and fmax? For comparing two integers, do they provide basically the same functionality? Do you tend to use one of these sets of functions or do you pr..

How to start mongodb shell?

I am using MAC and I have successfully logged in to the server and started the server using the following command ./mongod then it says Thu Jul 14 01:50:41 db version v1.6.5, pdfile version 4.5 T..

How can I convince IE to simply display application/json rather than offer to download it?

While debugging jQuery apps that use AJAX, I often have the need to see the json that is being returned by the service to the browser. So I'll drop the URL for the JSON data into the address bar. Th..

Change arrow colors in Bootstraps carousel

I'm obviously missing something stupidly simple here. I have images with a white background so I want to be able to edit the arrows on the Bootstraps Carousel so they are visible. So many changing the..

org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class

I replaced j2ee.jar with servle-api.com from my tomcat 6.0 installation directory: And that yields the error below. I'm presently trying to figure out the cause. What might the problem be. I have a ..

How does OAuth 2 protect against things like replay attacks using the Security Token?

As I understand it, the following chain of events occurs in OAuth 2 in order for Site-A to access User's information from Site-B. Site-A registers on Site-B, and obtains a Secret and an ID. When Use..

Style input element to fill remaining width of its container

Let's say I have an html snippet like this: <div style="width:300px;"> <label for="MyInput">label text</label> <input type="text" id="MyInput" /> </div> This i..

PDO error message?

Here is a snippet of my code: $qry = ' INSERT INTO non-existant-table (id, score) SELECT id, 40 FROM another-non-existant-table WHERE description LIKE "%:search_string%" AND ava..

Is it possible to set a number to NaN or infinity?

Is it possible to set an element of an array to NaN in Python? Additionally, is it possible to set a variable to +/- infinity? If so, is there any function to check whether a number is infinity or no..

Two models in one view in ASP MVC 3

I have 2 models: public class Person { public int PersonID { get; set; } public string PersonName { get; set; } } public class Order { public int OrderID { get; set; } public int Tota..

javax.net.ssl.SSLException: Received fatal alert: protocol_version

Has anyone encountered this error before? I'm new to SSL, is there anything obviously wrong with my ClientHello that I'm missing? That exception is thrown with no ServerHello response. Any advice i..

Oracle JDBC intermittent Connection Issue

I am experiencing a very strange problem This is a very simple use of JDBC connecting to an Oracle database OS: Ubuntu Java Version: 1.5.0_16-b02 1.6.0_17-b04 Database: Oracle 11g Rel..

how to hide a vertical scroll bar when not needed

I have a textarea which is contained in a div as I have jquery hint and wanted to use opacity without changing the border. There is a visible vertical scroll bar how I only want this displayed when I ..

How to negate a method reference predicate

In Java 8, you can use a method reference to filter a stream, for example: Stream<String> s = ...; long emptyStrings = s.filter(String::isEmpty).count(); Is there a way to create a method ref..

Convert generator object to list for debugging

When I'm debugging in Python using IPython, I sometimes hit a break-point and I want to examine a variable that is currently a generator. The simplest way I can think of doing this is converting it to..

How to update the value of a key in a dictionary in Python?

I have a dictionary which represents a book shop. The keys represent the book title and values represent the number of copies of the book present. When books are sold from the shop,the number of copie..

AngularJS ng-style with a conditional expression

I am handling my issue like this: ng-style="{ width: getTheValue() }" But to avoid having this function on the controller side, I would much prefer to do something like this: ng-style="{ width: my..

Convert list to dictionary using linq and not worrying about duplicates

I have a list of Person objects. I want to convert to a Dictionary where the key is the first and last name (concatenated) and the value is the Person object. The issue is that I have some duplicated..

Groovy method with optional parameters

I would like to write a wrapper method for a webservice, the service accepts 2 mandatory and 3 optional parameters. To have a shorter example, I would like to get the following code working def my..

Android EditText delete(backspace) key event

How can I detect delete (backspace) key event for a editText? I've tried using TextWatcher, but when the editText is empty, when I press delete key, nothing happens. I want to detect delete key press ..

Adding padding to a tkinter widget only on one side

How can I add padding to a tkinter window, without tkinter centering the widget? I tried: self.canvas_l = Label(self.master, text="choose a color:", font="helvetica 12") self.canvas_l.grid(row=9, c..

Postgres: check if array field contains value?

I'm sure this is a duplicate question in the sense that the answer is out there somewhere, but I haven't been able to find the answer after Googling for 10 minutes, so I'd appeal to the editors not to..

Convert hex color value ( #ffffff ) to integer value

I am receiving hex color values from a server (in this form, #xxxxxx , example #000000 for black) How do I convert this to an integer value? I tried doing Integer.valueOf("0x" + passedColor.substri..

SELECT * FROM multiple tables. MySQL

SELECT name, price, photo FROM drinks, drinks_photos WHERE drinks.id = drinks_id yeilds 5 rows (5 arrays), photo is the only unique field in a row. name, price get repeated (here, fanta- name, pric..

Waiting for HOME ('android.process.acore') to be launched

I tried working the Hello World application and the emulator freezes after it flashes the Android start screen. The home page is not shown. The last display on the console is Waiting for HOME ('a..

Excluding Maven dependencies

I have a query about exclusion of maven dependencies . Consider the following <dependency> <groupId>org.springframework.security</groupId> <artifactId>sprin..

Google.com and clients1.google.com/generate_204

I was looking into google.com's Net activity in firebug just because I was curious and noticed a request was returning "204 No Content." It turns out that a 204 No Content "is primarily intended to a..

What does %>% mean in R

I am following this example, the server.R, file is here. I plan to do a similar filter, but am lost as to what %>% does. # Apply filters m <- all_movies %>% filter( Revie..

A valid provisioning profile for this executable was not found... (again)

I know this has been asked and answered multiple times but I'm tearing my hair out as none of the proposed solutions appears to work. I receive the above error, despite having a valid provisioning ..

How to resolve "Could not find schema information for the element/attribute <xxx>"?

In visual studio, I have an asp.net 3.5 project that is using MS Enterprise Library 4.0 application blocks. When I have my web config file open, my Error list fills up with 99 messages with things l..

Using an integer as a key in an associative array in JavaScript

When I create a new JavaScript array, and use an integer as a key, each element of that array up to the integer is created as undefined. For example: var test = new Array(); test[2300] = 'Some string'..

How to parse JSON response from Alamofire API in Swift?

Following code I have written and I am getting response in JSON also but the type of JSON is "AnyObject" and I am not able to convert that into Array so that I can use that. Alamofire.request(.POST, ..

How to compile C program on command line using MinGW?

What command does one have to enter at the command line in Windows 7 to compile a basic C program? Like I am literally wondering what you type in the command prompt, to compile a .c file. I tried: ..

Request redirect to /Account/Login?ReturnUrl=%2f since MVC 3 install on server

We have an internal ASP.NET Webforms application running on a Windows 2008/IIS7 server which has been running fine until we installed MVC3. Now any requests redirect to /Account/Login?ReturnUrl=%2f. ..

Ukkonen's suffix tree algorithm in plain English

I feel a bit thick at this point. I've spent days trying to fully wrap my head around suffix tree construction, but because I don't have a mathematical background, many of the explanations elude me as..

How to access SVG elements with Javascript

I'm messing around with SVG and I was hoping I could create SVG files in Illustrator and access elements with Javascript. Here's the SVG file Illustrator kicks out (It also seems to add a load of ju..

How to parse a string into a nullable int

I'm wanting to parse a string into a nullable int in C#. ie. I want to get back either the int value of the string or null if it can't be parsed. I was kind of hoping that this would work int? val ..

How do I get a list of installed CPAN modules?

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

How do I disable the security certificate check in Python requests

I am using import requests requests.post(url='https://foo.com', data={'bar':'baz'}) but I get a request.exceptions.SSLError. The website has an expired certficate, but I am not sending sensitive da..

How can a file be copied?

How do I copy a file in Python? I couldn't find anything under os...

How can I escape square brackets in a LIKE clause?

I am trying to filter items with a stored procedure using like. The column is a varchar(15). The items I am trying to filter have square brackets in the name. For example: WC[R]S123456. If I do a L..

Search for highest key/index in an array

How can I get with PHP the highest key/index in an array? I know how to do it for the values. E.g. From this array I would like to get "10" as an integer value: $arr = array( 1 => "A", 10 => "..

iOS change navigation bar title font and color

So i have this code that should change the nav bar title font, but it doenst NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont ..

How to set environment via `ng serve` in Angular 6

I am trying to update my Angular 5.2 app to Angular 6. I successfully followed instructions in the Angular update guide (including the update of angular-cli to v6), and now I am trying to serve the ap..

Cannot find libcrypto in Ubuntu

I want to try one program which have makefile on it but when I put make in the shell the error was: g++ -g -DaUNIX -I../../acroname/aInclude -I../../acroname/aSource -Wl,-rpath,. unix_aLaserDem..

How to store JSON object in SQLite database

how do I store a JSON Object in an SQLite database? What is the correct way? one place is the blob type column. if i can convert the JSON object into byte array and use Fileoutputstream the other ..

Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies

I have a WinJS project that is previously built on Windows 8.1 using VS 2013. Recently I upgraded this project to Universal Windows 10 by creating a blank Javascript Universal windows 10 project and..

How do you iterate through every file/directory recursively in standard C++?

How do you iterate through every file/directory recursively in standard C++?..

How can I read a large text file line by line using Java?

I need to read a large text file of around 5-6 GB line by line using Java. How can I do this quickly?..

position: fixed doesn't work on iPad and iPhone

I have been struggling with fixed positioning in iPad for a while. I know iScroll and it does not always seem to work (even in their demo). I also know that Sencha has a fix for that, but I couldn't C..

Converting a number with comma as decimal point to float

I have a list of prices with a comma for a decimal point and a dot as the thousand separator. Some examples: 12,30 116,10 1.563,14 These come in this format from a third party. I want to convert t..

How to initialize a vector with fixed length in R

How to initialize a vector with fixed length in R ?? For example, I want a vector of characters with length of 10??..

Windows 7: unable to register DLL - Error Code:0X80004005

When I tried to register a COM DLL, regsvr32 rpcrt4.dll I get the following error message: `The module "c:\windows\system 32\"rpcrt4.dll" was loaded but the call to DllRegisterServer failed with ..

PHP "php://input" vs $_POST

I have been directed to use the method php://input instead of $_POST when interacting with Ajax requests from JQuery. What I do not understand is the benefits of using this vs the global method of $_P..

How to read a file without newlines?

In Python, calling temp = open(filename,'r').readlines() results in a list in which each element is a line in the file. It's a little stupid but still: readlines() also writes newline character to ..

Why use the INCLUDE clause when creating an index?

While studying for the 70-433 exam I noticed you can create a covering index in one of the following two ways. CREATE INDEX idx1 ON MyTable (Col1, Col2, Col3) -- OR -- CREATE INDEX idx1 ON MyTable..

How to make lists contain only distinct element in Python?

I have a list in Python, how can I make it's values unique?..

Can I export a variable to the environment from a bash script without sourcing it?

Suppose that I have this script export.bash: #! /usr/bin/env bash export VAR="HELLO, VARIABLE" When I execute the script and try to access to the $VAR, I get no value! echo $VAR Is there any wa..

String formatting: % vs. .format vs. string literal

Python 2.6 introduced the str.format() method with a slightly different syntax from the existing % operator. Which is better and for what situations? Python 3.6 has now introduced another string forma..

Use of for_each on map elements

I have a map where I'd like to perform a call on every data type object member function. I yet know how to do this on any sequence but, is it possible to do it on an associative container? The closes..

Android Location Providers - GPS or Network Provider?

In my application I would like to determine the user's current location. I do however have a couple of questions in this regard: There are different Location Providers, which one is the most accurat..

Uncaught SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>)

I need some help with this error : Uncaught SyntaxError: Unexpected end of JSON input at JSON.parse () at Object.success (dashboard.js:22) at fire (jquery-3.3.1.js:3268) at..

C++ passing an array pointer as a function argument

I'm trying to use pointers of arrays to use as arguments for a function which generates an array. void generateArray(int *a[], int *si){ srand(time(0)); for (int j=0;j<*si;j++) *a[j]=(..

Capturing image from webcam in java?

How can I continuously capture images from a webcam? I want to experiment with object recognition (by maybe using java media framework). I was thinking of creating two threads one thread: Node 1..

How to resolve git error: "Updates were rejected because the tip of your current branch is behind"

A well meaning colleague has pushed changes to the Master instead of making a branch. This means that when I try to commit I get the error: Updates were rejected because the tip of your current bran..

How To Use DateTimePicker In WPF?

I have no idea how to use the DateTimePicker control in WPF. It is not available in the Toolbox...

iPhone system font

What is the name of the default system font on the iPhone? I would like to retrieve this for customizing a UIView...

postgresql return 0 if returned value is null

I have a query that returns avg(price) select avg(price) from( select *, cume_dist() OVER (ORDER BY price desc) from web_price_scan where listing_Type='AARM' and u_kbalikepart..

Upload a file to Amazon S3 with NodeJS

I ran into a problem while trying to upload a file to my S3 bucket. Everything works except that my file paramters do not seem appropriate. I am using Amazon S3 sdk to upload from nodejs to s3. These..

Descending order by date filter in AngularJs

<div class="recent" ng-repeat="reader in (filteredItems = (book.reader | orderBy: 'created_at' | limitTo: 1))"> </div> So the book comes from rest api and it has many readers attache..

Get current url in Angular

How can I get the current url in Angular 4? I've searched the web for it a lot, but am unable to find solution. app.module.ts import { BrowserModule } from '@angular/platform-browser'; import { NgMo..

alert() not working in Chrome

'nuff said. I have absolutely no clue why using alert() there wouldn't work. It works perfectly in Firefox, but gives that error in Chrome...

Button Center CSS

Usual CSS centering issue, just not working for me, the problem is that I don't know the finished width px I have a div for the entire nav and then each button inside, they dont center anymore when t..

How to avoid Python/Pandas creating an index in a saved csv?

I am trying to save a csv to a folder after making some edits to the file. Every time I use pd.to_csv('C:/Path of file.csv') the csv file has a separate column of indexes. I want to avoid printing t..

How to make a SIMPLE C++ Makefile

We are required to use a Makefile to pull everything together for our project, but our professor never showed us how to. I only have one file, a3driver.cpp. The driver imports a class from a location..

How to Turn Off Showing Whitespace Characters in Visual Studio IDE

I don't know what I did but I don't know how to get rid of those arrows on the left. ..

How to get the value from the GET parameters?

I have a URL with some GET parameters as follows: www.test.com/t.html?a=1&b=3&c=m2-m3-m4-m5 I need to get the whole value of c. I tried to read the URL, but I got only m2. How do I do this..

Best way to check if a drop down list contains a value?

When the user navigates to a new page, this ddl's selected index is determined by a cookie, but if the ddl doesn't contain that cookie's value, then I'd like it to be set the 0. What method would I us..

"React.Children.only expected to receive a single React element child" error when putting <Image> and <TouchableHighlight> in a <View>

I have the following render method in my React Native code: render() { const {height, width} = Dimensions.get('window'); return ( <View style={styles.container}> <Image..

Get current time in hours and minutes

I'm trying to collect information from a system and I need to get the current time in hours and minutes. Currently I have: date | awk '{print $4}' which outputs something like: 16:18:54 How do ..

Can you append strings to variables in PHP?

Why does the following code output 0? It works with numbers instead of strings just fine. I have similar code in JavaScript that also works. Does PHP not like += with strings? <?php $selectBo..

VBA for filtering columns

I have a big database-like sheet, first row contains headers. I would like a subset of rows of this table based on column values. Two issues: 1) VBA-wise I would like to loop through the columns, whe..

Why do table names in SQL Server start with "dbo"?

At least on my local instance, when I create tables, they are all prefixed with "dbo.". Why is that?..

Converting pixels to dp

I have created my application with the height and width given in pixels for a Pantech device whose resolution is 480x800. I need to convert height and width for a G1 device. I thought converting it i..

How to check the input is an integer or not in Java?

In my program I want an integer input by the user. I want an error message to be show when user inputs a value which is not an integer. How can I do this. My program is to find area of circle. In whi..

Revert to a commit by a SHA hash in Git?

I'm not clear on how git revert works. For example, I want to revert to a commit six commits behind the head, reverting all the changes in the intermediary commits in between. Say its SHA hash is 56e..

How do I insert non breaking space character &nbsp; in a JSF page?

How do I insert a non breaking space character in JSF page like I can in HTML using &nbsp;? Is there such a tag in JSF?..

How to check if a line has one of the strings in a list?

Possible Duplicate: Check if multiple strings exist in another string I am trying to find out if there is a nice and clean way to test for 3 different strings. Basically I am looping troug..

How to set tbody height with overflow scroll

I am facing problem while setting tbody height width overflow scroll. <style> tbody{ height:50px;display:block;overflow:scroll } </style> <h3>Table B&l..

How to Compare two Arrays are Equal using Javascript?

I want position of the array is to be also same and value also same. var array1 = [4,8,9,10]; var array2 = [4,8,9,10]; I tried like this var array3 = array1 === array2 // returns false ..

How to write a multiline Jinja statement

I have an if statement in my Jinja templates which I want to write it in multines for readability reasons. Consider the case {% if (foo == 'foo' or bar == 'bar') and (fooo == 'fooo' or baar == 'baar'..

Get the content of a sharepoint folder with Excel VBA

Usually I use this piece of code to retrieve the content of a folder in VBA. But this doesn't work in the case of a sharepoint. How can I do ? Dim folder As folder Dim f As File Dim fs As New FileSys..

How to start Apache and MySQL automatically when Windows 8 comes up

I am using XAMPP, version 3.2.1. I just installed it on Windows 8. Every time I need to go to the XAMPP Control Panel to start services (MySQL, Apache,...); in Windows 7 it started automatic..

Can I make 'git diff' only the line numbers AND changed file names?

This question calls for "line numbers", if you do not care about line numbers in the output see this question and answer. Basically, I don't want to see the changed content, just the file names and..

Proper way to handle multiple forms on one page in Django

I have a template page expecting two forms. If I just use one form, things are fine as in this typical example: if request.method == 'POST': form = AuthorForm(request.POST,) if form.is_valid..

How to create a List with a dynamic object type

How can I create a new List<T> where the T is a dynamic Type object. I have dynamic DyObj = new ExpandoObject(); if (condition1) { DyObj.Required = true; DyObj.Message = "This is the fir..

Android studio doesn't list my phone under "Choose Device"

Just starting out with Android development; have a Nexus 5 bought in Japan, but with English version of android (presumably shouldn't matter). I installed Android Studio on Windows 8.1 to try making a..

Convert Java object to XML string

Yes, yes I know that lots of questions were asked about this topic. But I still cannot find the solution to my problem. I have a property annotated Java object. For example Customer, like in this exam..

Fastest way to determine if an integer's square root is an integer

I'm looking for the fastest way to determine if a long value is a perfect square (i.e. its square root is another integer): I've done it the easy way, by using the built-in Math.sqrt() function, bu..

How do I force Robocopy to overwrite files?

In general, Robocopy ignores files for which lastwrittendate and filesize are the same. How can we escape this design? I'd like to force overwriting with Robocopy. I expected that dst\sample.txt shou..

Selecting last element in JavaScript array

I'm making an application that updates a user's location and path in real time and displays this on a Google Map. I have functionality that allows multiple users to be tracked at the same time using a..

Why can't Python find shared objects that are in directories in sys.path?

I'm trying to import pycurl: $ python -c "import pycurl" Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: libcurl.so.4: cannot open shared object file:..

How to convert answer into two decimal point

This is my code and I want the output which is txtA.Text and txtB.Text to be in two decimal places. Public Class Form1 Private Sub btncalc_Click(ByVal sender As System.Object, ..

How to ignore user's time zone and force Date() use specific time zone

In an JS app, I receive timestamp (eq. 1270544790922) from server (Ajax). Basing on that timestamp I create Date object using: var _date = new Date(); _date.setTime(1270544790922); Now, _date deco..

rsync error: failed to set times on "/foo/bar": Operation not permitted

I'm getting a confusing error from rsync and the initial things I'm finding from web searches (as well as all the usual chmod'ing) are not solving it: rsync: failed to set times on "/foo/bar": Operat..

git push vs git push origin <branchname>

I'm quite new to Git. I'm creating a branch and then want to push it to origin. I think that simply issuing git push (while standing on my branch) should be sufficient. Is it possible/reasonable to..

How do you get the current text contents of a QComboBox?

Using pyqt4 and python 2.6, I am using a qcombobox to provide a list of options. I am having problems with using the selected option. I have been able to use a signal to trigger a method when the opti..

Connecting client to server using Socket.io

I'm relatively new to node.js and it's addons, so this is probably a beginnersquestion. I'm trying to get a simple HTML page on a webserver connect to a different server running node.js with websocke..

Send Email to multiple Recipients with MailMessage?

I have multiple email recipients stored in SQL Server. When I click send in the webpage it should send email to all recipients. I have separated emails using ;. Following is the single recipient code...

Android: How to rotate a bitmap on a center point

I've been looking for over a day for a solution to this problem but nothing helps, even the answers here. Documentation doesn't explain anything too. I am simply trying to get a rotation in the direc..

IE6/IE7 css border on select element

Does anyone have a solution for styling the borders of "select" elements in Internet Explorer using CSS?..

How can I make git show a list of the files that are being tracked?

Using command line git, how can I make git show a list of the files that are being tracked in the repository?..

Difference between <span> and <div> with text-align:center;?

I don't understand this: I have tried to center the text-align of a HTML <span> tag but it did nothing... With the <div> tag, everything worked. Same sittuation with setting margin: 0px a..

How do I remove whitespace from the end of a string in Python?

I need to remove whitespaces after the word in the string. Can this be done in one line of code? Example: string = " xyz " desired result : " xyz" ..

Toggle Checkboxes on/off

I have the following: $(document).ready(function() { $("#select-all-teammembers").click(function() { $("input[name=recipients\\[\\]]").attr('checked', true); }); }); ..

Regular expression containing one word or another

I need to create an expression matching a whole number followed by either "seconds" or ""minutes" I tried this expression: ([0-9]+)\s+(\bseconds\b)|(\bminutes\b) It works fine for seconds, but not m..

Getting 400 bad request error in Jquery Ajax POST

I am trying to send an Ajax POST request using Jquery but I am having 400 bad request error. Here is my code: $.ajax({ type: 'POST', url: "http://localhost:8080/project/server/rest/subjects", ..

Could not connect to SMTP host: localhost, port: 25; nested exception is: java.net.ConnectException: 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: java.net.ConnectException: Connection refu..

Find index of last occurrence of a substring in a string

I want to find the position (or index) of the last occurrence of a certain substring in given input string str. For example, suppose the input string is str = 'hello' and the substring is target = 'l..

Only Add Unique Item To List

I'm adding remote devices to a list as they announce themselves across the network. I only want to add the device to the list if it hasn't previously been added. The announcements are coming across..

jQuery get the name of a select option

I have a dropdown list with several option, each option has a name attribute. When I select an option, a different list of checkboxes needs to appear - when another options is selected, that checkbox ..

How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?

I tried to install a package, using install.packages("foobarbaz") but received the warning Warning message: package 'foobarbaz' is not available (for R version x.y.z) Why doesn't R think that th..

How to turn on WCF tracing?

Update: I have been trying to turn on WCF tracing, but still no success... Below is my lastest update. Do I need a permission to write to the below location? <system.diagnostics> <tr..

Delimiter must not be alphanumeric or backslash and preg_match

I have this code : $string1 = "My name is 'Kate' and im fine"; $pattern = "My name is '(.*)' and im fine"; preg_match($pattern , $string1, $matches); echo $matches[1]; and when im run it returns ..

TypeError: Object of type 'bytes' is not JSON serializable

I just started programming Python. I want to use scrapy to create a bot,and it showed TypeError: Object of type 'bytes' is not JSON serializable when I run the project. import json import codecs c..

Get all rows from SQLite

I have been trying to get all rows from the SQLite database. But I got only last row from the following codes. FileChooser class: public ArrayList<String> readFileFromSQLite() { fileName =..

Free Barcode API for .NET

Is there a decent free API/component for printing barcodes in C#?..

Apply formula to the entire column

I'm trying to recode all the zip code from Column A into Column B with the formula: =TEXT(A1,"00000") Like this: I want every cell in Column B to be transformed using the formula above. But I h..

Get current date in Swift 3?

How can I set label.text current date in Swift 3? I want to print just today to the screen. I did not find how to do that. In c# is very simple: var date = DateTime.Now I need to write 15.09.201..

Laravel 5.1 API Enable Cors

I've looked for some ways to enable cors on laravel 5.1 specifically, I have found some libs like: https://github.com/neomerx/cors-illuminate https://github.com/barryvdh/laravel-cors but none of th..

How to execute multiple commands in a single line

I know Unix has the following command which can execute multiple commands in a single line, how can I do this in DOS? command1 ; command2 ; command3 ... ..

What is the iPad user agent?

From what I gather, the iPad is using iPhone OS, but with a different screen resolution from the iPhone and iPod touch. So many sites may have to change their user agent detection to adapt to the iPad..

How do I trim a file extension from a String in Java?

What's the most efficient way to trim the suffix in Java, like this: title part1.txt title part2.html => title part1 title part2 ..

How to use WPF Background Worker

In my application I need to perform a series of initialization steps, these take 7-8 seconds to complete during which my UI becomes unresponsive. To resolve this I perform the initialization in a sepa..

ipython notebook clear cell output in code

In a iPython notebook, I have a while loop that listens to a Serial port and print the received data in real time. What I want to achieve to only show the latest received data (i.e only one line show..

"Content is not allowed in prolog" when parsing perfectly valid XML on GAE

I've been beating my head against this absolutely infuriating bug for the last 48 hours, so I thought I'd finally throw in the towel and try asking here before I throw my laptop out the window. I'm t..

Delete all nodes and relationships in neo4j 1.8

I know this question is asked by many people already for my research, here's some questions asked before How to delete all relationships in neo4j graph? https://groups.google.com/forum/#!topic/neo4j..

Split string with PowerShell and do something with each token

I want to split each line of a pipe on spaces, and then print each token on its own line. I realise that I can get this result using: (cat someFileInsteadOfAPipe).split(" ") But I want more flexib..

How to convert milliseconds into a readable date?

The following: new Date(1324339200000).toUTCString() Outputs: "Tue, 20 Dec 2011 00:00:00 GMT" I need it to return Dec 20. Is there a better method I can use besides toUTCString()? I am looking f..

Correct way to find max in an Array in Swift

I've so far got a simple (but potentially expensive) way: var myMax = sort(myArray,>)[0] And how I was taught to do it at school: var myMax = 0 for i in 0..myArray.count { if (myArray[i] &g..

Given a DateTime object, how do I get an ISO 8601 date in string format?

Given: DateTime.UtcNow How do I get a string which represents the same value in an ISO 8601-compliant format? Note that ISO 8601 defines a number of similar formats. The specific format I am looki..

Bootstrap Collapse not Collapsing

I am trying to create a collapsable component using Bootstrap. My code is this _x000D_ _x000D_ <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">..

How to print a int64_t type in C

C99 standard has integer types with bytes size like int64_t. I am using the following code: #include <stdio.h> #include <stdint.h> int64_t my_int = 999999999999999999; printf("This is my_..

How to create a multiline UITextfield?

I am developing an application where user has to write some information. For this purpose I need a UITextField which is multi-line (in general UITextField is a single line). As I'm Googling I find a ..

Is it possible to CONTINUE a loop from an exception?

I have a fetch being executed inside of a loop. If this fetch fails (no data) I would like to CONTINUE the loop to the next record from within the EXCEPTION. Is this possible? I'm getting a ORA-065..

"Operation must use an updateable query" error in MS Access

I am getting an error message: "Operation must use an updateable query" when I try to run my SQL. From my understanding, this happens when joins are used in update/delete queries in MS Access. However..

jQuery.ajax handling continue responses: "success:" vs ".done"?

I have been working with jQuery and AJAX for a few weeks now and I saw two different ways to 'continue' the script once the call has been made: success: and .done. From the synopsis from the jQuery do..

Disable all table constraints in Oracle

How can I disable all table constrains in Oracle with a single command? This can be either for a single table, a list of tables, or for all tables...

Cannot find runtime 'node' on PATH - Visual Studio Code and Node.js

With a downloaded and installed version of Visual Studio Code 1.2.1, and a 64bit version of node.exe msi placed in my working directory (I am assuming that is correct), how do we add node and npm comm..

What is the difference between "SMS Push" and "WAP Push"?

The terms WAP Push and SMS Push seems to both be used when talking about pushing messages to a mobile application to trigger download of WAP content. Do the terms refer to the same mechanism or do th..

jQuery: Change button text on click

After seeing Toggling button text in jquery this question, I tried to re create it in my situation but can't seem to have it work. Here is a fiddle of what I've done: http://jsfiddle.net/V4u5X/ $('...

How to access the ith column of a NumPy multidimensional array?

Suppose I have: test = numpy.array([[1, 2], [3, 4], [5, 6]]) test[i] gets me ith line of the array (eg [1, 2]). How can I access the ith column? (eg [1, 3, 5]). Also, would this be an expensive ope..

Change the size of a JTextField inside a JBorderLayout

When I use the code below it doesn't alter the size at all, it still fills the area in the grid. JPanel displayPanel = new JPanel(new GridLayout(4, 2)); JTextField titleText = new JTextField("title"..

What is the difference between i++ & ++i in a for loop?

I've just started learning Java and now I'm into for loop statements. I don't understand how ++i and i++ works in a for-loop. How do they work in mathematics operations like addition and subtraction?..