Saturday, January 7, 2017

IQueryable


  • An interface
  • Provides the functionality to evaluate queries against a specific data source
  • <T> is the type of data in the data source
  • the IQueryable<T> interface extends the IEnumerable<T> interface
  • IEnumerable<T> has the GetEnumerator() method with you have access to with IQueryable
  • has two methods that IEnumerable does NOT have
  1. query provider
  2. query expression

Interfaces in C#

  • like an abstract base class
  • cannot be instantiated directly
  • it's members are implemented by any class or struct that implements the interface
  • can contain events, indexers, methods, and properties

IEnumerable

IEnumerable is an interface

  • It specifies that the underlying type implements GetEnumerator
  • It enables foreach
  • Consider the seasons in understanding IEnumerable - "One season comes after another. The chill of winter settles on an area. All things freeze. In spring, warmth thaws the land and life begins again. In summer, produce is harvested. In fall, life slows down and prepares for winter. Soon, winter appears on the scene again. With time, we enumerate seasons. An array or list has elements that come one after the other. Like seasons, we can enumerate an array or list's elements in a loop."
  • List and Arrary implement the IEnumerable interface
  • LINQ (Language Integrated Query) acts on IEnumerable things.
  • In IEnumerable<T> the "T" is the type
  • Example

using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
 IEnumerable<int> result = from value in Enumerable.Range(0, 2)
      select value;

 // Loop.
 foreach (int value in result)
 {
     Console.WriteLine(value);
 }

 // We can use extension methods on IEnumerable<int>
 double average = result.Average();

 // Extension methods can convert IEnumerable<int>
 List<int> list = result.ToList();
 int[] array = result.ToArray();
    }
}

Output

0
1

Saturday, November 19, 2016

HTML Block-level Elements

Elements in HTML are either block-level or inline. A block-level element occupies the entire space of its parent element (container), thereby creating a block. Browsers typically display the block-level element with a newline both before and after the element. You can visualize them as a stack of boxes. Refer to the following link for more information.


<address>         Contact information.
<blockquote> Long ("block") quotation.
<dd>         Definition description.
<div> Document division.
<dl> Definition list.
<fieldset> Field set label.
<form> Input form.
<h1>, <h2>, <h3>, <h4>, <h5>, <h6> Heading levels 1-6.
<hr> Horizontal rule (dividing line).
<li> List item.
<main> Contains the central content unique to this document.
<nav> Contains navigation links.
<noscript> Content to use if scripting is not supported or turned off.
<ol> Ordered list.
<p> Paragraph.
<pre> Preformatted text.
<q> Short quote.
<table> Table.
<tfoot> Table footer.
<ul> Unordered list.


HTML 5 Block-level elements.

<article> Article content.
<aside> Aside content.
<canvas> Drawing canvas.
<figcaption> Figure caption.
<figure> Groups media content with a caption.
<footer> Section or page footer.
<header> Section or page header.
<hgroup> Groups header information.
<output> Form output.
<section> Section of a webpage
<video> Video player.


Video player.

Wednesday, November 16, 2016

HTML Web Server for Angular Research/Study

My recommendation is to use the http-server module of Node.js. Node.js is available cross-platform and can be installed fromhttp://nodejs.org/Once Node.js is installed, installing the http-server module and running the http server are easy. Open the command line and type the following command:

npm install http-server –g

This installs the HTTP server at the global level. To run the server, just navigate to the folder where the app code resides, or open the folder from where we want to serve static files, and type this:

http-server

You will have an HTTP server running at http://localhost:8080 that can serve files from the current directory.

To run the server on port 80 so you don't have to append the port every time you start the server type this:

sudo http-server -p 80

You will not have an HTTP server running on http://localhost that can serve files from the current directory. Note we used sudo in the case above as most systems wouldn't allow you to work with port 80. You'll need to be in the sudoers file to be able to access sudo.


The http-server module does support some startup configurations. Check the documentation at https://github.com/nodeapps/http-server.


Tuesday, November 15, 2016

Diff Files in Visual Studio

You can invoke devenv.exe /diff list1.txt list2.txt from the command prompt or, if a Visual Studio instance is already running, you can type Tools.DiffFiles in the Command window, with a handy file name completion:
Using Tools.DiffFiles from Visual Studio Command window

Entire article is on StackOverflow
http://stackoverflow.com/questions/13752998/compare-two-files-in-visual-studio-2012



7
Does this diff tool provide any useful feature like copy to left, copy to right, etc? When I diff working copy with the server version I sometimes wish to undo some of the changes and has to do manual copy pasting. – Samuel Feb 12 '14 at 10:24
54
Why is this feature hidden from the VS UI ? This is the easiest and effective way of comparing two files... – eka808 Feb 14 '14 at 15:23
4
If your path has spaces, you can wrap either the entire path or just the part part with spaces in quotes. – pennstatephil Jun 24 '14 at 15:16
40
For those of you who are new to Visual Studio the Command Window can be opened by going to: View > Other Windows > Command Window (VS Pro 2013) or with CTRL+ALT+A – Cleanshooter Jun 26 '14 at 13:30
12
such a shame VS doesn't have a menu item for this very basic functionality. many IDE's/ editors do. – dewdSep 16 '14 at 9:09


Sunday, May 1, 2016

Apple - Running Questions

Upgraded my MacBook Pro last week to El Capitan.  So far I'm struggling to keep a positive attitude.  My issues follow.


     1) My laptop can now take longer than 30+ minutes to book, and in same cases I have to power off the machine and then power it back on in order to be able to log in.


     2) My Time Machine backups are now acting  up as well.  I want to get a couple of "good" backups before I completely format my machine and re-install the os.  However, my backups start and now never finish.  I'd replaced my existing external drive with a different one and when it runs it's not registering anywhere near the same size of the files as I have I disk.  This makes me question my backups.  I attempted to just do a file copy to an external drive and that fails saying that my file name is too long or I have an illegal character.


Bottom line, I used my system for work and this upgrade has really cost me confidence, time, and money.  Worse still, I haven't resolved my issues so I'm not up and running yet...