An extremely little set of rules to write good commit messages. History (how code changes over time) become a very useful tool if associated with good commit m…

PR's Tumblrdome
Alisa U Zemlji Chuda
Sade Olutola

No title available

@theartofmadeline

pixel skylines
Lint Roller? I Barely Know Her
RMH
wallacepolsom

Product Placement
hello vonnie
trying on a metaphor
Peter Solarz
Misplaced Lens Cap
AnasAbdin
Mike Driver
DEAR READER

JBB: An Artblog!
d e v o n
No title available
seen from United States

seen from Malaysia

seen from Malaysia

seen from Malaysia

seen from South Korea
seen from Germany

seen from Malaysia

seen from T1

seen from Malaysia

seen from Malaysia
seen from France
seen from United States
seen from United States

seen from United States
seen from United States

seen from Malaysia
seen from Finland
seen from Germany

seen from United States

seen from United States
@codebleederscode
An extremely little set of rules to write good commit messages. History (how code changes over time) become a very useful tool if associated with good commit m…
Validating a group of inputs in Angular-UI
I'm working on a project with Angular-UI and I had a add a validation where at least one checkbox from a group of 2 checkboxes should be selected.
Initially, I began with writing a common validation function for both checkboxes. But, I came across a scenario, where this approach failed:
Let's say one of the checkbox1 is selected, if I un-select checkbox1, the form became invalid. However, selecting checkbox2 didn't make the form valid again. I'd to select checkbox1, select checkbox2 and then un-select checkbox1.
To fix this you have to write a dummy hidden input with a validation function. It goes something like this:
<label for="chk1">Label1 <input type="checkbox"   ng-model="form.chk1"   id="chk1"   ui-validate="{validateChk: 'form.validateChk()'}" > <label for="chk2">Label2 <input type="checkbox"   ng-model="form.chk2"   id="chk2"   ui-validate="{validateChk: 'form.validateChk()'}" > <!-- Dummy input > <input ng-hide="true"   name="dummyChk"   ui-validate-watch="['form.chk1', 'form.chk2'] "   ui-validate=" 'form.chk1 || form.chk2' "   ng-model="_dummyModel" > <span ng-show="form.dummyChk.$invalid" class="ng-hide"> Please select at least one checkbox
Keep the De-Morgan’s law in mind at all times
I just enhanced a function that takes in a type(lets call it type1) of object and sends out email. I included code to handle for one more type (lets call it type2) of object(It's a bad practice). I came across a piece of code which read out like this:
if(x.Type != type1) { throw new Exception("Invalid type"); }
I needed to add a check for the newer type as well. Initially, I thought this would work:
if(x.Type != type1 || x.Type != type2) { throw new Exception("Invalid type"); }
Then I realized my mistake: I've to apply the De-Morgan's law. The correct logic is:
if(x.Type != type1 && x.Type != type2) { throw new Exception("Invalid type"); }
ES2015 new features
'use strict' at the beginning of the code will prevent coder from making mistakes.
var -> function level scoping
let -> block level scoping (block = if, for, while)
const allows one time assignment
You can insert variable values within template strings using the ${variable.value}
Enclose template strings with a ` (back-tick) character
New string methods: startsWith(), endsWith(), includes()
Arrow function: Shorter anonymous function, and non-binding with 'this'
Default parameters can be specified in function definitions: function(arg1 = default1, arg2 = default2){}
For the function to use default parameter, use 'undefined': function(undefined, 'param2');
Rest parameters: function func1(param1, ...params){console.log(param1, params);} - params is an array of values: func1('a', 1,2,3);//params=[1,2,3]
Spread operator: myFunction('a', ...nums){}; // ['a', 1, 2, 3]
Destructuring: I'm not sure if I would use it. I think storing values within an object is neat. 14.for..of
Short hand property names 16.Class syntax
Getters and Setters
Clearing the confusion in SSRS: DataSource, and DataSet
There is a lack of consistency in naming in SSRS, and C# code.
In an SSRS report, A DataSource is a connection to the database, a DataSet is a single DataTable (as in C#). I’ll refer to this DataSet as: “SSRS-DataSet”. And the DataSource as: “SSRS-DataSource”.
Now, I had 2 SSRS-DataSets in a report both derived from the same SSRS-DataSource. Here’s where I went wrong: I thought I can pass a C#-DataSet, which contains multiple C#-DataTables in the constructor function:
ReportDataSource(string dataSourceName, DataSource dataSource)
The property name “ReportDataSource” is confusing. It refers to SSRS-DataSet, which is actually a C#-DataTable!
So, if you have multiple C#-DataTables you want to pass as SSRS-DataSets, you use:
report.DataSources.Add(dataSource)
Razor
Form:
@using (Html.BeginForm()) { <div> @Html.Label("Name") @Html.TextBox("Name") </div> }
This beginner Java tutorial describes fundamentals of programming in the Java programming language
Just have to note the way inner classes need to be instantiated.
Converting DataTable column to array (Today I learned)
I was trying to read all values from a column DataTable, and the solution I found was to convert the datatable into enumerable class, and use LINQ.
As mentioned in this post: http://stackoverflow.com/questions/20629547/how-to-save-datatable-first-column-in-array-c-sharp
Things to note on ArrayLists
Don't forget to include: import java.util.ArrayList;
ArrayList in java unlike C# (List) doesn't have length/count property
To find it's length, use x.size();
Too convert it to an Array using the toArray() function: Integer[] iArr = oArrList.toArray(new Integer[0]);
When initializing an ArrayList, primitives are not allowed as iterables: ArrayList{Integer} x = new ArrayList{Integer}(); // replace curly braces with less-than, and greater-than signs. These signs are not getting saved in the blog post. Sorry!
Semantic versioning
It consists of 3 numbers separated by dots:
v2.5.1 - SNAPSHOT
First number:
Major version.
Make API changes not compatible with previous releases.
Second number:
Minor version.
Add functionality in a backwards compatible manner
Third number:
Patch or bug fixes
SNAPSHOT
Indicates latest development version
Code for under development, but not yet released
Gradle
Gradle is a build tool.
GroupId: specify packaging information. ArtefactId: What do you want to call the JAR file that gets created.
Specify a dependency:
In build.gradle:
dependencies { compile group: 'org.apache.commons', name: 'commons-csv', version: '1.2' }
To install gradle:
open the terminal to run gradle wrapper:
./gradlew
To install dependencies:
./gradlew dependencies
This beginner Java tutorial describes fundamentals of programming in the Java programming language
If you are coming from JavaScript, anonymous functions should not be a surprise :)
This beginner Java tutorial describes fundamentals of programming in the Java programming language
This Java tutorial describes exceptions, basic input/output, concurrency, regular expressions, and the platform environment
It was introduced in Java SE7. This is useful.
Interfaces in Java
It's a contract saying that all the functionality listed in the interface works.
It says 'what' you can do. The 'how' is left to the implementer.
Example:
public class A implements Comparable { ... @Override public int compareTo(Object o) { } }
Arrays in Java
Declaration
String[] a = new String[3]; a[0] = "Hi"; a[1] = "bye"; a[2] = "Lie";
Length property
a.length;
copy from one array into another
System.arraycopy(srcArray, <start index of srcArray>, dstArray, <start index of dstArray>, <last index from first index>);
For example:
String[] b = new String[3]; System.arraycopy(a, 0, b, 0, 2);
Adding an extra element:
import java.util.Arrays; a = Arrays.copyOf(a, 4); // 4 : new length of the array
Sorting
Arrays.sort(a);
Looking for a Java pattern matching and regex tester? Highlight groups, matches, and replacements. Visualize regex in java, syntax, all online in real time.
Nice site to check your regex