ColorBrewer project is a very popular tool to select harmoniously matching color palettes. RColorBrewer is a port of the project for R and provides also colorblind-friendly palettes.
An example of use
colors_vec <- brewer.pal(5, name = 'BrBG')
print(colors_vec)
[1] "#A6611A" "...
Quite often there is a need to glimpse the chosen color palette. One elegant solution is the following self defined function:
color_glimpse <- function(colors_string){
n <- length(colors_string)
hist(1:n,breaks=0:n,col=colors_string)
}
An example of use
color_glimpse(...
The package colorspace provides GUI for selecting a palette. On the call of choose_palette() function the following window pops-up:
When the palette is chosen, just hit OK and do not forget to store the output in a variable, e.g. pal.
pal <- choose_palette()
The output is a function that t...
Function colors() lists all the color names that are recognized by R. There is a nice PDF where one can actually see those colors.
colorRampPalette creates a function that interpolate a set of given colors to create new color palettes. This output function takes n (number) as input and produces a...
Before we get our hands dirty with code, I feel it is necessary to understand how data is stored in firebase. Unlike relational databases, firebase stores data in JSON format. Think of each row in a relational database as a JSON object (which is basically unordered key-value pair). So the column nam...
I am gonna assume you already know about adding gradle dependencies firebase in android studio. If you don't just follow the guide from here. Add your app in firebase console, gradle sync android studio after adding dependencies. All dependencies are not needed just firebase database and firebase au...
Take a use case, like a chat app or a collaborative grocery list app (that basically requires a list of objects to be synced across users). If you use firebase database and add a value event listener to the chat parent node or grocery list parent node, you will end with entire chat structure from th...
When you have a huge JSON database, adding a value event listener doesn't make sense. It will return the huge JSON and parsing it would be time consuming. In such cases we can use pagination and fetch part of data and display or process it. Kind of like lazy loading or like fetching old chats when u...
In [1]: df = pd.DataFrame({'A': [1, 2, 3], 'B': [1.0, 2.0, 3.0], 'C': ['a', 'b', 'c'],
'D': [True, False, True]})
In [2]: df
Out[2]:
A B C D
0 1 1.0 a True
1 2 2.0 b False
2 3 3.0 c True
Getting a python list from a series:
In [3]: df['...
When we put the control of Label, the Label does not provide any event.
<Label x:Name="lblSignUp Text="Dont't have account?"/>
as shown the Label only display purpose only.
When the user want to replace Button with Label, then we give the event for Label.
As shown below:
XA...
Magento is a very popular eCommerce application. It offers a great deal of customization and abilities from initial install. Here are a few suggestions for optimizing a Magento installation.
Enabling Output Compression
In your .htaccess file for Magento you will find a section of text starting wit...
First-time visitors to any web page has to make several HTTP requests. By using the “Expires” header you make the components of the requests cacheable. This avoids unnecessary HTTP requests on subsequent page views.
You want to find the area of the .htaccess file that starts with <IfModulemod_ex...
Merge JS and CSS Files
This particular tweak will reduce the number of HTTP requests on your eCommerce site.
[box type=”alert” border=”full”]Note: This can sometimes break some applications. After performing the following steps, please ensure that the site still performs as it did before enabling ...
The model Magento uses to store customer and product data results in longer than average SQL queries and more reads. Enabling the Flat Catalog option for Categories and Products will merge product data into one table, therefore improving performance.
Login to your administration area and go to – Sy...
Login to your administration area and go to – System > Cache
Management
Next, click on the Select All link
Finally, make sure the Actions is set to Enable and click submit
Disable Error Logging
Login to your administration area and go to – System > Configuration > Developer
Under ...
The task is to find the length of the longest subsequence in a given array of integers such that all elements of the subsequence are sorted in ascending order. For example, the length of the longest increasing subsequence(LIS) for {15, 27, 14, 38, 26, 55, 46, 65, 85} is 6 and the longest increasing ...
Ionic’s grid system is based on flexbox, a CSS feature supported by all devices that Ionic supports. The grid is composed of three units-grid, rows and columns. Columns will expand to fill their row, and will resize to fit additional columns.
ClassWidthwidth-1010%width-2020%width-2525%width-3333.33...
Cards are a great way to display important pieces of content, and are quickly emerging as a core design pattern for apps. They're are a great way to contain and organize information, while also setting up predictable expectations for the user. With so much content to display at once, and often so li...
Controller::renderAjax() method can be used to respond to an Ajax request. This method is similar to renderPartial() except that it will inject into the rendering result with JS/CSS scripts and files which are registered with the view
Assume we have login form in a view file:
<?php
use yii\hel...
Given a string what is the longest palindromic subsequence(LPS) of it? Let's take a string agbdba. The LPS of this string is abdba of length 5. Remember, since we're looking for subsequence, the characters need not to be continuous in the original string. The longest palindromic substring of the seq...