{{ if not (isset site.Params "color_theme") }}
{{ errorf "Please complete the installation of Academic by following the steps at https://sourcethemes.com/academic/docs/install/" }}
{{ end }}
A group of volunteer, like-minded students
Who are the people? A group of volunteer, like-minded students at IIT Kharagpur who promote Open Source. To get more beginners introduced to Open Source, we hold events like Read more about our Events.Kharagpur Open Source Society
For the love of coding
at IIT Kharagpur who promote Open SourceCommunity


iGuards security and facility management solution is designed to help security agency's to ease their operations and increase their revenue through streamlining their process. iGuards help the organization in increase project efficiency, profit and accountability by streamlining and mobilizing project communication and documentation. We have developed an online web application specifically for the security guard and facility management companies. There is a lot of paper work and excel work is done in these companies every month, To ease the operations we have tailored made our solution that would cater to all security guard and facility management companies.
Every company has some specific formats,agreements,contracts and terms and conditions and it becomes difficult for the companies to manage. We have come up with this solutuion named iGUARDS. Now, generating bills, paysheets, wage slips, issuing loans, deducting salary advances, client’s contracts, generating audit reports like PF report/ESI report etc is made very easy. One employee/guard can be deployed to any number of sites and the salary structure can be different for each site. According to the terms and conditions of the contract his/her salary will be generated. The data is accessible from anywhere, anytime.


public class PhysicsVector
extends java.lang.Object
| Constructor | Description |
|---|---|
PhysicsVector() |
Default constructor that creates a PhysicsVector with zero
magnitude
|
PhysicsVector(double[] x) |
Constructor that takes an array of length 3 and sets the components of
the vector to the values stored in the array.
|
PhysicsVector(double x,
double y) |
Constructor that takes two arguments to create a PhysicsVector
with the first argument x giving the component in the i
direction and the second argument y giving the component in the
j direction.
|
PhysicsVector(double x,
double y,
double z) |
Constructor that takes three arguments to create a PhysicsVector
with the first argumentgiving the component in the i
direction, the second argument giving the component in the
j direction and the third argument giving the component
in the k direction.
|
PhysicsVector(PhysicsVector v) |
Constructor that creates a vector with the same value as the
PhysicsVector passed as an argument.
|
| Modifier and Type | Method | Description |
|---|---|---|
static PhysicsVector |
add(PhysicsVector v,
PhysicsVector u) |
standard vector addition.
|
void |
decreaseBy(PhysicsVector v) |
Subtract a vector v from the original vector.
|
static double |
dot(PhysicsVector v,
PhysicsVector u) |
Dot is a standard vector scalar product.
|
PhysicsVector |
getUnitVector() |
Returns a vector with magnitude of one and the origibal
direction of the original vector.
|
double |
getX() |
return the x-component of the vector
|
double |
getY() |
return the y-component of the vector
|
double |
getZ() |
return the z-component of the vector
|
void |
increaseBy(PhysicsVector v) |
Add a vector v to the original vector.
|
double |
magnitude() |
Returns the magnitude of the vector.
|
void |
print() |
Prints the vector to 'standard out'.
|
void |
print2D() |
Prints the vector to 'standard out'.
|
java.lang.String |
return2DString() |
Method to return a String which represents the vector and has
the form xi + yj.
|
java.lang.String |
returnSimple2DString() |
Method to return a String which represents the vector and has
the form x y (I.e.
|
java.lang.String |
returnSimpleString() |
Method to return a String which represents the vector and has
the form x y z (I.e.
|
java.lang.String |
returnString() |
Method to return a String which represents the vector and has
the form xi + yj +zk.
|
void |
scale(double x) |
scale the components of the vector by the scalar.
|
static PhysicsVector |
scale(double x,
PhysicsVector v) |
Scale the components of the vector by a scalar.
|
void |
setVector(double x,
double y) |
Change the value of the vector to xi + yj.
|
void |
setVector(double x,
double y,
double z) |
Change the value of the vector to xi + yj + zk
|
void |
setVector(PhysicsVector v) |
Modify the vector so that it is equal to vector v
|
static PhysicsVector |
subtract(PhysicsVector v,
PhysicsVector u) |
vector subtraction.
|
static PhysicsVector |
vectorProduct(PhysicsVector v,
PhysicsVector u) |
vectorProduct is a standard 3D vector product.
|
public PhysicsVector()
public PhysicsVector(double x, double y)
x
- Double to be set to x-component of vectory
- Double to be set to y-component of vectorpublic PhysicsVector(double x, double y, double z)
x
- Double to be set to x-component of vectory
- Double to be set to y-component of vectorz
- Double to be set to z-component of vectorpublic PhysicsVector(double[] x)
x
- Array to be converted to a PhysicsVectorpublic PhysicsVector(PhysicsVector v)
v
- PhysicsVector to be copiedpublic java.lang.String return2DString()
public java.lang.String returnSimple2DString()
public java.lang.String returnString()
public java.lang.String returnSimpleString()
public void print2D()
public void print()
public void setVector(double x, double y, double z)
x
- x-component
of the vectory
- y-component
of the vectorz
- z-component
of the vectorpublic void setVector(double x, double y)
x
- x-component
of the vectory
- y-component
of the vectorpublic void setVector(PhysicsVector v)
v
- the vector that is then used to set the values of the
modified vector.public void increaseBy(PhysicsVector v)
v
- vector to be added to original vector.public void decreaseBy(PhysicsVector v)
v
- Vector to be subtracted from the original vector.public double magnitude()
public double getX()
public double getY()
public double getZ()
public PhysicsVector getUnitVector()
public void scale(double x)
x
- the factor to scale the vector by.public static PhysicsVector scale(double x, PhysicsVector v)
x
- The factor to scale the vector by.v
- The vector to scalepublic static double dot(PhysicsVector v, PhysicsVector u)
v
- first vector in productu
- second vector in productpublic static PhysicsVector vectorProduct(PhysicsVector v, PhysicsVector u)
v
- first vector in cross productu
- second vector in cross productpublic static PhysicsVector add(PhysicsVector v, PhysicsVector u)
v
- first vector in sumu
- second vector in sumpublic static PhysicsVector subtract(PhysicsVector v, PhysicsVector u)
v
- first vector in sumu
- second vector in sum


0
0
AC
C
%
7
8
9
x
4
5
6
÷
1
2
3
-
.
0
+/-
+
(
)
=
Made by
Carlos Bertaglia
Fork or suggest edits on
GitHub
Follow @carlosbertaglia
Tweet about it.


Welcome to the demo's start page
Although this is just static html content, it feels SPA-like.
Although this is just static html content, it feels SPA-like.
Although this is just static html content, it feels SPA-like.
Although this is just static html content, it feels SPA-like.
Although this is just static html content, it feels SPA-like.
Although this is just static html content, it feels SPA-like.
Although this is just static html content, it feels SPA-like.
More headlines
Although this is just static html content, it feels SPA-like.
Although this is just static html content, it feels SPA-like.
Although this is just static html content, it feels SPA-like.
Although this is just static html content, it feels SPA-like.
Although this is just static html content, it feels SPA-like.
Although this is just static html content, it feels SPA-like.
Although this is just static html content, it feels SPA-like.


Northwestern University
University of Zurich
Stanford
MIT
Georgia Tech
TU Munich
Caltech
ETH Zurich
| All times in EDT (UTC - 04) | |
| 9:00a | Welcome Remarks |
| 9:10a | Invited Session 1 |
| 9:10-9:30a | Alex Liniger (ETH) - Pushing the Limits of Friction: A Story of Model Mismatch |
| 9:30-9:50a | Markus Lienkamp (TUM) - Indy Autonomous Challenge Key Opportunities and Challenges |
| 9:50-10:10a | Panagiotis Tsiotras (Georgia Tech) - Fast and Furious: Modeling and Control Design for Competitive Car Racing |
| 10:10-10:30a | Q/A and Discussion for Invited Session 1 |
| 10:30-11:30a | Contributed Papers 1-6 |
| 11:30-11:50a | Q/A for Papers 1-6 |
| 11:50a | Invited Session 2 |
| 11:50-12:10p | Davide Scaramuzza (U of Zurich) Autonomous Drone Racing |
| 12:10-12:30p | Todd Murphey (Northwestern) - Real-Time Learning After Safety Violations |
| 12:30-12:50p | Chris Gerdes (Stanford): Lessons for Autonomous Racing from Professional Drivers and Neural Networks |
| 12:50-1:10p | Q/A and Discussion for Invited Session 2 |
| 1:10-2:20p | Contributed Papers 7-13 |
| 2:20-2:40p | Q/A for Papers 7-13 |
| 2:40-3:00p | Panel Discussion - Autonomous Racing Competitions |
| 3:00p | Invited Session 3 |
| 3:00-3:20p | Sertac Karaman (MIT) - On Fast and Agile Autonomous Super-Vehicles: New Problems, Tools and Algorithms |
| 3:20-3:40p | Ugo Rosolia (Caltech) - Learning how to race using a predictive control approach: towards multi-agents racing |
| 3:40-3:50 | Q/A for Invited Session 3 |
| 3:50-4:15p | Workshop concluding remarks |
| [Paper #1] | Chanyoung Jung, Seungwook Lee, Hyunki Seong, Andrea Finazzi and David Hyunchul Shim, Game-Theoretic Model Predictive Control with Data-Driven Identification of Vehicle Model for Head-to-Head Autonomous Racing [Link to Paper] |
| [Paper #2] | Nan Li, Eric Goubault, Laurent Pautet and Sylvie Putot, Autonomous racecar control in head-to-head competition using Mixed-Integer Quadratic Programming [Link to Paper] |
| [Paper #3] | Antonio Loquercio, Elia Kaufmann, Yunlong Song and Davide Scaramuzza, High-Speed Drone Flight with On-Board Sensing and Computing [Link to Paper] |
| [Paper #4] | Markus Schratter, Jasmina Zubaca, Konstantin Mautner-Lassnig, Tobias Renzler, Martin Kirchengast, Stefan Loigge, Michael Stolz and Daniel Watzenig, Lidar-based Mapping and Localization for Autonomous Racing [Link to Paper] |
| [Paper #5] | Trent Weiss, John Chrosniak and Madhur Behl, Towards Multi-Agent Autonomous Racing with the DeepRacing framework [Link to Paper] |
| [Paper #6] | Matthias Schmid, Qilun Zhu, Ashley Boncimino, Robert Prucka and Chris Paredis, Control Informed Design of the IAC Autonomous Racecar for Operation at the Dynamic Envelope [Link to Paper] |
| [Paper #7] | Xuesu Xiao, Joydeep Biswas and Peter Stone, Learning Inverse Kinodynamics for Accurate High-Speed Off-Road Navigation on Unstructured Terrain [Link to Paper] |
| [Paper #8] | Dvij Kalaria, Parv Maheshwari, Animesh Jha, Arnesh Issar, Debashish Chakravarty, Sohel Anwar and Andres Tovar, Local NMPC on Global Optimised Path for Autonomous Racing |
| [Paper #9] | Jayanth Bhargav, Johannes Betz, Hongrui Zheng and Rahul Mangharam, Track based Offline Policy Learning for Overtaking Maneuvers with Autonomous Racecars [Link to Paper] |
| [Paper #10] | Shakti Wadekar, Benjamin Schwartz, Aly Gamal, Shyam Kannan, Manuel Mar, Rohan Manna, Vishnu Chellapandi and Daniel Gonzalez, Towards End-to-End Deep Learning for Autonomous Racing: On Data Collection and a Unified Architecture for Steering and Throttle Prediction [Link to Paper] |
| [Paper #11] | Tim Brüdigam, Alexandre Capone, Sandra Hirche, Dirk Wollherr and Marion Leibold, Gaussian Process-based Stochastic Model Predictive Control for Overtaking in Autonomous Racing [Link to Paper] |
| [Paper #12] | Rongyao Wang, Yiqiang Han and Umesh Vaidya, Deep Koopman Data-driven Control Framework forAutonomous Racing [Link to Paper] |
| [Paper #13] | Minghao Jiang, Kristina Miller, Dawei Sun, Zexiang Liu, Yixuan Jia, Arnab Datta, Necmiye Ozay and Sayan Mitra, Continuous Integration and testing for Autonomous Racing Software: An Experience Report from GRAIC [Link to Paper] |
Assistant Professor
Department of Computer Science
University of Virginia
Postdoctoral Researcher
Department of Electrical and Systems Engineering
University of Pennsylvania
Michelin Chair Professor
Department of Automotive Engineering
Clemson University
Associate Professor
Department of Electrical and Systems Engineering
University of Pennsylvania
Demonstrating high-speed autonomous racing can be considered as a grand challenge for self-driving cars, and making progress here has the potential to enable breakthroughs in agile and safe autonomy. To succeed at racing, an autonomous vehicle is required to perform both precise steering and throttle maneuvers in a physically-complex, uncertain environment, and by executing a series of high-frequency decisions. This makes racing an interesting opportunity to explore the physical and algorithmic limits of autonomous driving. Autonomous racing competitions, such as Autonomous Formula SAE, F1/10 autonomous racing, Roborace, and Indy Autonomous Challenge are, both figuratively and literally, getting a lot of traction and becoming proving grounds for testing perception, planning, and control algorithms at high speeds.
We are proposing this workshop to raise awareness of the overall autonomous racing area to the IEEE Robotics and Automation Society community that can take inspiration from the problem space in their own research. This is a good time for such a workshop around this unique and important application space, that will require innovations across core topics in robotics and we believe it will gather a lot of interest.
We invite short papers (4-6 pages, including references) for submission to the workshop related to the topics above and the theme of autonomous racing. Position papers, work in progress and novel but not necessarily thoroughly worked out ideas are encouraged. The submissions will be reviewed by the workshop’s program committee and we will accept papers for oral (live) presentations, or a video highlight. A best paper award will be presented in both categories. We are currently exploring the possibility of a journal special issue in the Journal of Field Robotics for the best contributions at the workshop. Each paper will undergo a thorough review process and receive two high quality reviews. Accepted paper will be made available on the website.
The paper should be in PDF format and use the standard IEEE ICRA template.
Please use the following EasyChair link for paper submissions: Submission Link


bUnit - a testing library for Blazor Components
bUnit, previously known as Blazor Components Testing Library, is a unit testing library for Blazor Components. You can easily define components under test in C# or Razor syntax and verify outcome using semantic HTML diffing/comparison logic. You can interact with and inspect components, trigger event handlers, provide cascading values, inject services, mock IJsRuntime, and perform snapshot testing.
This library's goal is to make it easy to write comprehensive, stable unit tests for Blazor Components/Razor Components. To see how, go to the Documentation pages.
Contributors
Shout outs and a big thank you to the contributors to this library. Here they are, in alphabetically:


Personal Research Statement Advice
I’m writing this post because I was inspired by Nelson Liu’s service in making his personal research statement public. The information needed to get into the academic ivory tower is not that accessible, and it’s awesome that there are people out there trying to change this. This is my attempt to follow in their footsteps! Hope this is useful to anyone applying to PhD programs in the USA.
My personal research statement can be read here.
Disclaimer: I do NLP research and only applied to research programs in NLP. However, in a previous life, I applied to Neuroscience PhD programs, and I can attest that these pieces of advice would have really helped my application back then. So I think they are pretty generalizable.
The two most important aspects to your graduate application are your recommendation letters and personal statement. My advisor, Noah Smith, has great advice on recommendation letters here, so you should check that out.
Here are a few things I learned throughout the process of writing the statement. I tried to highlight some key points which you can refer to my personal statement to understand further.
-
Your research statement should be opinionated about NLP. BERT and GPT-3 are great and all, but what are their limitations? Where do you want to see the field go from here? Where are the new frontiers of NLP, and why do you care about them? In my statement, I chose to highlight the brittleness and expensiveness of NLP models, and how our evaluation methods don’t really transfer to the real-world. These topics wove together most of my previous work, even that in neuroscience.
-
Tell a story. Lots of personal statements re-hash CVs; don’t do that. Instead, try to weave a narrative around your work, and if you have had the opportunity to do multiple research projects, see if you can draw connections and relationships between them. I’m learning that selling your vision is as important as executing it. So this is good practice! Again, I chose to focus on one or two overall themes, and tried to figure out how my previous work would fit into them.
-
Just to emphasize this point further, make sure your ideas in your statement flow. Don’t start and end descriptions of new ideas without at least partially connecting them to previous ones.
-
Claim some ownership of area(s) of NLP that excite you, even if you haven’t delved into them a ton yet. Claiming ownership of a subarea doesn’t lock you into that area, but it does make you more focused and conveys scientific maturity. If you can show that you’ve worked on projects in this direction, even better.
-
Even though I think you should be bold about your ideas, make sure to be humble; most of the projects we’ve done or witnessed in NLP so far are just initial steps towards our scientific dreams. Using the right language to convey appreciation for the complexities/difficulties of NLP problems, while highlighting that you have done some cool stuff towards solving them, will go a long way.
-
While you should tell a story, make it structured. Put yourself in the faculty members’ shoes; they are reading hundreds of applications each cycle. Get to your points quickly and in simple language. Highlight keywords if you’d like, and structure your essay in such a way that someone can understand your main points easily. I structured my essay to highlight the main research ideas I was interested in, allocating one paragraph per idea.
-
With respect to structure, there’s a ton of ways you could go. Here’s one structure that I like, and followed in my personal statement: try to start your statement off with your main themes. Pretend the application reviewer only has time to read the first paragraph. What do you want them to take away from the whole thesis? Then break the themes down into finer ideas, referencing previous or ongoing work when you can, and then zoom back out to your overall PhD goals to finish.
-
Don’t be shy to use plain English, and always err on the side of simpler is better.  For example, there was a lot of technical stuff we did in the VAMPIRE paper, but I was advised to highlight the most salient idea from the work in a couple sentences. The main idea I wrote about was that it’s a cheap pretraining method using bag-of-words instead of sequences. Simple and easy to understand.
-
Feel free to discuss ongoing work. While I was working on my personal statement, we were submitting our eventual paper Don’t Stop Pretraining. I just talked about the current ideas I had around this direction, even though they weren’t ironed out yet. This is a great thing to do; it will give you more to talk about during your visit days/interviews!
-
Make sure you mention who you want to work with at the university and why. Just 2-3 sentences towards the end are necessary, since faculty use this to direct your application to specific people.
-
Get people to read your statement I got probably 5-10 different people, some of whom were not super familiar with NLP, to read my statement and tell me if they 1) understood what I was trying to convey 2) whether there was any ideas that seemed to not make sense, or needed substantial clarification or simplification.
Anyway, there’s probably a lot more stuff I could mention; I’ll update this post if I think of anything else. Feel free to reach out on Twitter if you have any specific questions.
Last thing I’ll mention is that there are a number of cool programs to get feedback on your application. I’d point you to the UW PARS program where current UW CSE students are providing application guidance to prospective applicants.
Hope this helps, and good luck!


{% extends "email/_wrapper.html" %} {% block content %}
Hi {{ carpool.driver.name }},
You have a new ride request! {{ rider.name }} ({{ rider.gender_string() }}) has requested a ride in your carpool from {{ carpool.from_place }} to {{ carpool.destination.name }} at {{ carpool.leave_time | humanize }}.
{% if ride_request.notes %}
Message from {{rider.name}}: {{ride_request.notes}}
{% endif %}
Please click here and approve or deny this request.
{{ rider.name }} can be contacted at {{ rider.email }}{% if rider.phone_number|trim() %} or {{ rider.phone_number }} ({{ rider.preferred_contact_method }} preferred){% endif %}.
You'll receive a reminder email containing all of your passengers' contact information two days before your departure date.
Thanks!
{{ config.get('BRANDING_EMAIL_SIGNATURE') }}
SAFETY TIPS
CANVASSING TIPS


Lorem ipsum doler hello i am very exited to make this webpage!!
Do Something Another ThingLorem ipsum this is my favourite pattern and it's clicked by me only and i feel great i am hero my name is Ali Siddiqui.
DownloadLorem ipsum this is my favourite pattern and it's clicked by me only and i feel great i am hero my name is Ali Siddiqui.
DownloadLorem ipsum this is my favourite pattern and it's clicked by me only and i feel great i am hero my name is Ali Siddiqui.
Download


The intention works if Use flying geese braces is checked in Editor | Code Style | Groovy | Wrapping and Braces | Braces placement.


Given the increased demand for easily accessible at-home entertainment, M.A.R movies created a database for families and movie aficionados alike. We compiled information from IMDB and Kaggle on movie directors, genres, available streaming platforms, budgets, and revenues for easy data exploration. Users can determine what streaming platforms work best for them based on their preference for low budget films or popular blockbuster movies.
Interested in finding out more? Click Here :)


To add or update your KeePass file, drag it from your file system or desktop onto this area.
Alternatively, click the button below to choose a file to upload
or... {{errorMessage}}
Files are stored in Chrome, so you won't need to add them again on this device. Click on the one that you want to use right now.


| Class | Description |
|---|---|
| ExtremalTupleByNthField |
This class is similar to MaxTupleBy1stField except that it allows you to
specify with field to use (instead of just using 1st field) and to specify
ascending or descending.
|
| ExtremalTupleByNthField.HelperClass |
Utility classes and methods
|
| IsDouble |
This UDF is used to check whether the String input is a Double.
|
| IsFloat |
This UDF is used to check whether the String input is a Float.
|
| IsInt |
This UDF is used to check whether the String input is an Integer.
|
| IsLong |
This UDF is used to check whether the String input is a Long.
|
| IsNumeric |
This UDF is used to check if a String is numeric.
|
| MaxTupleBy1stField |
MaxTupleBy1stField UDF returns a tuple with max value of the first field in a
given bag.
|
| MaxTupleBy1stField.Final | |
| MaxTupleBy1stField.Initial | |
| MaxTupleBy1stField.Intermediate | |
| Over |
Given an aggregate function, a bag, and possibly a window definition,
produce output that matches SQL OVER.
|
| Stitch |
Given a set of bags, stitch them together tuple by tuple.
|
Copyright © 2007-2017 The Apache Software Foundation


# The command below will search the file system for file names containing certain keywords. You can specify as many keywords as you wish.
dir /s *pass* == *cred* == *vnc* == *.config*
# Search certain file types for a keyword, this can generate a lot of output.
findstr /si password *.xml | *.ini | *.txt
findstr.exe /si passw *.txt *.ini *.vbs *.cmd *.ps1 *.bat *.xml *.inf *.eml


vignettes/upbm-quickstart.Rmd
upbm-quickstart.Rmd
Abstract
“Protein binding microarrays (PBMs) allow for the high-throughput quantification of DNA binding specificities of proteins, such as transcription factors, in vitro. While several probe designs have been proposed for PBMs, universal PBMs (uPBMs) designed to cover all 10-mer DNA sequences, have enjoyed the most wide-spread adoption. The upbm package provides tools and methods for organizing probe-level PBM data from raw GPR scan files, summarizing PBM data at K-mer resolution, and performing statistical inference when replicate experiments are available. The package was developed for the analysis of uPBMs and may not be appropriate for other PBM designs. upbm package version: 0.99.0”
While a large collection of methods and software packages have been developed for processing and analyzing traditional DNA microarrays, the development of tools for protein binding microarrays (PBMs) has been limited. PBMs and DNA microarrays measure fundamentally different things, with PBMs detecting protein-DNA interactions and DNA microarrays assaying nucleic acid hybridization. Blindly applying DNA microarray tools to PBM data can lead to problems.
This package provides tools and methods for reading, processing, and analyzing PBM data using standard Bioconductor data structures. The primary focus is on universal-design PBMs (uPBMs) which provide approximately uniform coverage of all 8-mer DNA sequences across probes on the array (Berger et al. 2006). The methods in this package have not been tested with other array designs.
suppressPackageStartupMessages(library("upbm"))
In this quickstart guide, we demonstrate the basic functionality of the upbm package. More details on the individual steps for pre-processing and inference, as well as the specialized classes (PBMExperiment and PBMDesign) are provided in other vignettes (vignette("upbm-classes")
).
The input to the upbm package is raw GenePix Results (GPR) data for Alexa488 and Cy3 scans. Functions for reading GPR data into R are included with this package (see vignette("upbm-classes")
). For this quickstart guide, we will use just the Alexa488 scans for a PBM dataset included in the upbmData package. Details on how Cy3 scans can also be used provided in a separate vignette (see vignette("upbm-preprocessing")
).
data(hoxc9alexa, package = "upbmData")
The dataset includes PBM data for four allelic variants of the HOXC9 human TF (wild type, K195R, R193K, R222W). For simplicity, we will subset this data to scans at a single PMT gain (450) and keep just the wild type and R222W alleles.
alexa_subset <- hoxc9alexa[, colData(hoxc9alexa)$pmt == 450]
alexa_subset <- alexa_subset[, colData(alexa_subset)$condition %in%
c("HOXC9-REF", "HOXC9-R222W")]
The data is stored as a PBMExperiment object, which extends the standard Bioconductor SummarizedExperiment class. Each sample is stored as a column, with rows corresponding to probes on the array.
## class: PBMExperiment
## dim: 62976 6
## metadata(0):
## assays(2): fore back
## rownames: NULL
## rowData names(4): Column Row probeID Sequence
## colnames(6): s4 s7 ... s33 s34
## colData names(10): date version ... condition id_idx
## probeCols(4): Column Row probeID Sequence
## probeFilter names(1): probeID
## probeTrim: 1 36
Analysis of uPBM data is performed in three steps: sample pre-processing, 8-mer summarization, and 8-mer inference. First, samples are preprocessed using upbm::upbmPreprocess
. This wrapper functions performs various pre-processing steps, including Cy3 normalization. In this quickstart, we will not be using Cy3 scans and instead set the cy3pe=
option to NULL
. We also silence verbose output here.
alexa_normed <- upbmPreprocess(pe = alexa_subset, cy3pe = NULL,
verbose = FALSE)
The returned object is a PBMExperiment object with the same number of columns as the original PBMExperiment, with normalized probe intensities now stored in the normalized
assay. Rows have been filtered to remove background and control probes.
## class: PBMExperiment
## dim: 41944 6
## metadata(0):
## assays(4): normalized fore back spatialbias
## rownames: NULL
## rowData names(4): Column Row probeID Sequence
## colnames(6): s4 s7 ... s33 s34
## colData names(13): date version ... acrossRepMultScale
## acrossRepAddScale
## probeCols(4): Column Row probeID Sequence
## probeFilter names(0):
## probeTrim: 1 36
After normalization, probe-level intensities are aggregated across replicates by fitting a probe-level model to the data. Since the dataset includes samples for different conditions, this must be specified. In our dataset, this information is included in the "condition"
column of the colData
of the PBMExperiment. This is passed to the stratify=
parameter.
alexa_pfit <- probeFit(alexa_normed, stratify = "condition")
The resulting object is a PBMExperiment with the same number of rows, but only one column for each unique value in the column specified by stratify=
. In this case, we have two conditions, HOXC9-REF
and HOXC9-R222W
. Aggregated probe summaries are stored in the beta
assay.
## class: PBMExperiment
## dim: 41944 2
## metadata(0):
## assays(3): beta sd df
## rownames: NULL
## rowData names(4): Column Row probeID Sequence
## colnames(2): HOXC9-R222W HOXC9-REF
## colData names(0):
## probeCols(4): Column Row probeID Sequence
## probeFilter names(0):
## probeTrim: 1 36
Next, probe-level summaries are used to obtain 8-mer-level summaries. A helper function, upbm::uniqueKmers
is provided for generating the full set of K-mers of a specified length (unique to reverse complementation). During this step, parameters are also estimated for downstream differential testing and inference. The baseline condition must be specified to the baseline=
parameter.
alexa_kfit <- kmerFit(alexa_pfit, kmers = uniqueKmers(8L),
baseline = "HOXC9-REF")
The result is a SummarizedExperiment with K-mer-level affinity and variance estimates for each condition, with rows now corresponding to K-mers rather than probes.
## class: SummarizedExperiment
## dim: 32896 2
## metadata(1): baseline
## assays(5): affinityEstimate affinityVariance contrastDifference
## contrastAverage contrastVariance
## rownames: NULL
## rowData names(1): seq
## colnames(2): HOXC9-R222W HOXC9-REF
## colData names(0):
To test for differential 8-mer affinity across conditions between a baseline condition (e.g. the wild type HOXC9 TF) and all other conditions, we make a call to upbm::kmerTestContrast
. Other methods for inference are also defined in upbm::kmerTestAffinity
and upbm::kmerTestSpecificity
. Note that all differential affinity and specificity calls are relative to the baseline condition specified above.
alexa_kdiff <- kmerTestContrast(alexa_kfit)
The resulting object is again a SummarizedExperiment with assays containing the results of differential affinity testing.
## class: SummarizedExperiment
## dim: 32896 2
## metadata(0):
## assays(6): contrastAverage contrastDifference ... contrastP
## contrastQ
## rownames: NULL
## rowData names(1): seq
## colnames(2): HOXC9-R222W HOXC9-REF
## colData names(0):
K-mer level averages and differences between the baseline and all other conditions are included in the contrastAverage
and contrastDifference
assays. FDR-adjusted p-values are included in the contrastQ
assay. We can tidy the results from a PBMExperiment to a tibble using the broom::tidy
function.
diffdat <- broom::tidy(alexa_kdiff, assay = c("contrastAverage",
"contrastDifference",
"contrastQ"))
diffdat <- dplyr::filter(diffdat, !is.na(contrastAverage))
diffdat
## # A tibble: 32,896 x 5
## seq cname contrastAverage contrastDifference contrastQ
## <chr> <chr> <dbl> <dbl> <dbl>
## 1 AAAAAAAA HOXC9-R222W 11.5 -0.340 0.00485
## 2 AAAAAAAC HOXC9-R222W 11.4 -0.405 0.00322
## 3 AAAAAAAG HOXC9-R222W 11.3 -0.0669 0.578
## 4 AAAAAAAT HOXC9-R222W 11.6 -0.418 0.000297
## 5 AAAAAACA HOXC9-R222W 11.4 -0.350 0.0232
## 6 AAAAAACC HOXC9-R222W 11.3 -0.257 0.0791
## 7 AAAAAACG HOXC9-R222W 11.5 -0.559 0.00000616
## 8 AAAAAACT HOXC9-R222W 11.2 -0.0980 0.391
## 9 AAAAAAGA HOXC9-R222W 11.4 -0.412 0.00108
## 10 AAAAAAGC HOXC9-R222W 11.2 -0.0273 0.853
## # … with 32,886 more rows
Assays are now contained in columns with rows corresponding to single samples and rows from the PBMExperiment. The tidy
function can be used with any of the PBMExperiment objects above. More details are provided in vignette("other-tidydata")
. Using the tidy data, plot the results of differential testing is now relatively straightforward. We can create a standard MA plot by plotting the contrastAverage
and contrastDifference
columns as the X and Y axes.
suppressPackageStartupMessages(library("ggplot2"))
ggplot(diffdat, aes(x = contrastAverage,
y = contrastDifference,
color = contrastQ < 0.001)) +
geom_point(alpha = 1/10) +
geom_hline(yintercept = 0) +
scale_color_brewer(palette = "Set1", direction = -1) +
theme_bw() +
guides(color = guide_legend(override.aes = list(alpha = 1))) +
facet_grid(. ~ cname) +
ggtitle("HOXC9 differential 8-mer affinity MA plot")
Additionally, we can also take a look at the distribution of 8-mer-level differential affinities between conditions.
ggplot(diffdat, aes(x = contrastDifference,
fill = contrastQ < 0.001)) +
geom_histogram(color = 'black', binwidth = .05, boundary = 0) +
geom_vline(xintercept = 0) +
scale_fill_brewer(palette = "Set1", direction = -1) +
theme_bw() +
guides(color = guide_legend(override.aes = list(alpha = 1))) +
facet_grid(. ~ cname) +
ggtitle("HOXC9 differential 8-mer-level affinity")
Using the tabular data, we can also identify the set of 8-mers with largest differences between the two conditions.
suppressPackageStartupMessages(library("dplyr"))
diffdat %>%
dplyr::top_n(10, abs(contrastDifference)) %>%
dplyr::arrange(contrastDifference) %>%
dplyr::select(cname, seq, contrastDifference, contrastQ)
## # A tibble: 10 x 4
## cname seq contrastDifference contrastQ
## <chr> <chr> <dbl> <dbl>
## 1 HOXC9-R222W GTCGTAAA -2.36 1.74e-195
## 2 HOXC9-R222W GTCGTTAA -2.23 5.70e-129
## 3 HOXC9-R222W GTCATTAA -2.17 1.50e-197
## 4 HOXC9-R222W GTAATTAC -2.15 1.87e-119
## 5 HOXC9-R222W GGTAATTA -2.11 0.
## 6 HOXC9-R222W GGTCGTTA -2.05 1.30e- 90
## 7 HOXC9-R222W GCCATTAA -2.04 6.42e-152
## 8 HOXC9-R222W CCATTAAA -2.02 2.65e-116
## 9 HOXC9-R222W CCCATTAA -2.01 9.13e-152
## 10 HOXC9-R222W ATCGTAAA -2.00 2.06e-141
More details on various components of the package are provided in several other vignettes included with the package.
vignette("upbm-classes")
: Details on the two uPBM classes defined in the package.vignette("analysis-preprocessing")
: Details on the pre-processing procedures.vignette("analysis-summarization")
: Details on the steps for summarizing probes to 8-mers.vignette("analysis-inference")
: Details on the various K-mer-level inference procedures.vignette("other-qcplots")
: Details on various QC plots useful when evaluating the quality of PBM data.vignette("other-tidydata")
: Details on how data can be tidied from PBMExperiment to tibble format.


Challenge an oponent. The player to solve the most checkmate-in-one-move puzzles in 20 seconds catches a pokémon. Can you catch 'em all?


This is a network in which nodes are countries which are connected if the texts of their constitutions are similar. The network forms 4 distinct
clusters of countries corresponding to the Commonwealth, former Soviet Union, Iberian
and Francophone countries.


Room Squares
2019-10-30
Chapter 1 Introduction
In 1850 Thomas Penyngton Kirkman, an English mathematician from Bolton, published the following problem in the Lady’s and Gentleman’s Diary.
Fifteen young ladies of a school walk out three abreast for seven days in succession: it is required to arrange them daily so that no two shall walk abreast more than once
In solving this problem Kirkman discovered the following square array, which he observed was a very “curious arrangement”.
| hi | kl | mn | op | |||
| il | mo | np | hk | |||
| no | hl | mp | ik | |||
| lp | in | ko | hm | |||
| im | kp | lo | hn |
The curiosity of this square is that each of the letters h, i, k, l, m, n, o, p occurs precisely once in every column and row, while in the entire square each of the letters makes a pair with every other letter exactly once. Kirkman was able to employ this square to solve his Schoolgirl Problem. To each pair in the first column he added the element 1, to each pair in the second column 2 and so on. In addition he introduced the missing triple of numbers to each row. (e.g. row one has no elements in any of the first three columns so the numbers 1,2 and 3 would not appear hence he would add the triple 123). The seven rows of unique triples then corresponded to seven days in which the elements, corresponding to schoolgirls, were paired together exactly once throughout the arrangement. Thereby solving the problem.
| Day 1 | 123 | hi4 | kl5 | mn6 | op7 |
| Day 2 | 147 | il2 | mo3 | np5 | hk6 |
| Day 3 | 156 | no2 | hl3 | mp4 | ik7 |
| Day 4 | 267 | lo2 | in3 | ko4 | hm5 |
| Day 5 | 245 | io2 | kp3 | lo6 | hn7 |
| Day 6 | 357 | ho2 | km2 | ln4 | ip6 |
| Day 7 | 346 | ko2 | hp2 | io5 | lm7 |
Kirkman was a notable mathematician who is often regarded as the originator of the object in Figure 2, which has subsequently become known as a Room square (after T.G. Room).
1.1 Tournaments
Suppose the English Football Association proposed hosting a new type of international tournament to be staged as a one-off event in England. This tournament would involve eight national sides competing in a league that would be staged in various stadia around the country over two weeks. The structure of the tournament would be such that every team played every other team once, with the winner being the team which accumulated most points in the manner of a normal football league (3 points for a win, 1 for a draw).
To know which matches need playing is simple. Suppose the eight invited teams are:
| Argentina | England |
| Brazil | France |
| Columbia | Germany |
| Denmark | Holland |
If we write matches as alphabetic pairs in the obvious way, (e.g. ab denoting Argentina versus Brazil). The complete list of matches (the match set, M) is simply all unordered pairs from team set, T: \[T = \{a, b, c, d, e, f, g, h\}.\] i.e.
\[ M = \{ ab,ac,ad,ae,af,ag,ah,bc,bd,be,bf,bg,bh,cd, ce,cf,cg,ch,de,df,dg,dh,ef,eg,eh,fg,fh,gh \} \]
It remains to be decided where and when the matches will be played.
The English F.A., for whatever reason (the financial cost of hosting eight teams, for example), has imposed a time limit of two weeks on the tournament. Realistically the treams can only manage to play on alternate days so it is decided to have, in effect, seven different “rounds” with each team competing once in each round. (Seven being the smallest number of rounds because each team has to play seven others).
For reasons of fairness the F.A. also demands the condition that each team will play once at each stadium. Can such a tournament exist? Suppose the stadia used are the following:
| Wembley |
| Highbury |
| Villa Park |
| Stadium of Light |
| Stamford Bridge |
| Old Trafford |
| St. James Park |
Then figure 4 provides a match schedule which is suitable for such a tournament.
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | |
|---|---|---|---|---|---|---|---|
| 1 | ab | cd | ef | gh | |||
| 2 | bd | eg | fh | ah | |||
| 3 | fg | ad | eh | bc | |||
| 4 | dh | bf | cg | ae | |||
| 5 | be | ch | bg | af | |||
| 6 | ag | ce | df | bh | |||
| 7 | cf | ah | bg | de |
Looking along the rows, each team plays once in each round. Looking down columns, each stadia hosts each team exactly once. And throughout the tournament as a whole each pair from the original match list appears exactly once, hence every team opposes every other team once. Figure 4 is another Room square of side 7. Alternatively, because the pairs are made from a set containing 8 elements, we say that this is a Room square of order 8.
1.2 T.G. Room, (1902-86)
In 1955, Thomas Gerald Room, then Professor of Mathematics at the University of Sydney, published a brief note in the Mathematical Gazette entitled A new type of magic square.[20] In it he presented another example of a square array with the same properties as Kirkman’s. This square, Room explained, had been discovered as “a by-product of another investigation”. It was preceded in the note by a particularly efficient statement of the properties of these squares, which have subsequently been known by his name.
“The problem is to arrange the \(n(2n-1)\) symbols \(rs\) (which is the same as \(sr\)) formed from all pairs of \(2n\) digits such that in each row and each column there appear \(n\) symbols (and \(n-1\) blanks) which among them contain all \(2n\) digits.”
Room’s note went on to explain that while the trivial \(n = 1\) Room square exists[^1] , the non-existence of those with \(n = 2\) (side 2) and \(n = 3\) (side 5) is easily proven. Room considered the \(n = 2\) proof so straightforward that it was omitted from this note, while for the \(n = 3\) case he made reference to a graph-theoretic proof.
Consider the \(n = 2\) case, we are required to place all the pairs of 4 digits in a 3x3 array. If we choose to use the set of non-negative integers \(\{0, 1, 2, 3\}\), then we need to find somewhere to put each of the pairs \(\{01, 02, 03, 12, 13, 23\}\). That we can swap the rows and columns of a Room square without damaging that square’s Room-ness is self-evident. Therefore there is no less of generality in assuming that a \(3 \times 3\) Room square has the pair \(\{0, 1\}\) in cell \((1, 1)\).
| 01 |
If we hope to make this array a Room square we must place the pair \(\{2, 3\}\) in the first row, while to complete the first column we must also place the same pair in either position \((1, 2)\) or \((1, 3)\), but each pair is only allowed to appear once. So there is no Room square of side 3, order 4.
For the \(n = 3\), a Room square of side 5, case we consider the following array:
| 01 | 23 | 45 | - | - |
| 24 | - | - | - | - |
| 35 | - | - | - | - |
There is no loss in generality in using this array because we can reorder rows and columns to obtain the first row in this form and then the first column must contain either the pairs \(\{01, 24, 35\}\) or \(\{01, 25, 34\}\) and the latter can be converted into the former by the permutation \((45)\)[^2] which leaves the first row unchanged. We now show that completion of this square is impossible. The pairs \(\{2,5\},\{3,4\}\) must appear somewhere in the array other than the first three rows or columns. Also they must appear in separate rows/columns to prevent a forced recurrence of \(\{0, 1\}\). Suppose we put \(\{2, 5\}\) in \((4, 4)\) and \(\{3, 4\}\) in \((5, 5)\), then we know that cells \((4, 5)\) and \((5, 4)\) are empty, as the only pair which could legally go in either would be \(\{0, 1\}\).
Hence we know that cells \((4, 2), (4, 3), (5, 2), (5, 3)\) each contain pairs. Take cell \((5, 2)\), it could only contain \(\{0, 5\}\) or \(\{1, 5\}\), and the latter becomes the former under \((01)\), so assume it contains \(\{0, 5\}\). We are now forced to fill in the other cells to give the array in Figure 8.
| 01 | 23 | 45 | - | - |
| 24 | - | - | - | - |
| 35 | - | - | - | - |
| - | 14 | 03 | 25 | - |
| - | 05 | 12 | - | 34 |
We still need to place the pairs \(\{0, 2\}\) and \(\{0, 4\}\), which cannot be done because neither can appear in the second row and they cannot both appear in the third row. Hence there is no Room square of side 5, order 6.
The real significance of Room’s note was that mathematicians soon took on the task of determining the spectra of Room squares (those values of \(n\) for which Room squares exist). Research which cumulated 19 years later in the complete statement of the existence of Room squares, made by W.D. Wallis, that:
“Room squares exist for all odd positive integer sides except 3 and 5” [24]
Proving this statement, which was suspected to be true from an early stage, turned out to be protracted and difficult.
The most significant breakthrough came in 1968 when Stanton and Mullin introduced the starter-adder method for constructing Room squares. This method reduces the problem of constructing Room squares to the problem of finding a certain type of initial row from which a Room square can be developed straightforwardly.
In this work much emphasis will be placed upon the proof of the existence of Room squares.
1.3 The Galois Field
Throughout this work much use will be made of a particular finite field, known as the Galois field, denoted by \(GF(p^n)\). Whenever \(p^n\) is a prime (i.e. \(n=1\)) the Galois field is precisely the integers under modulo p arithmetic, denoted \(Z_p\). The Galois field has a number of important properties which are used in many of the proofs that follow, we introduce some of these now.
- Every Galois field (every finite field in fact) has a primitive element. An element, \(x\) say, is primitive in \(GF(q)\) if \(x^0,x^1,x^2,...,x^{q-1}\) are all the non-zero members of \(GF(q)\).
1.3.1 Example
\(x=2\) is a primitive element in \(GF(11)\) because, \[x^0 = 1 \hspace{0.5cm} x^1 = 2 \hspace{0.5cm} x^2 = 4 \hspace{0.5cm} x^3 = 8 \hspace{0.5cm} x^4 = 5\] \[x^5 = 10 \hspace{0.5cm} x^6 = 9 \hspace{0.5cm} x^7 = 7 \hspace{0.5cm} x^8 = 3 \hspace{0.5cm} x^9 = 6\]
It can be shown [3] that \(x^{q-1}=1\) is always true for any \(GF(q)\) where \(q\) is odd, and \(x^i \neq 1\) for any \(1 \leq i \leq q-1\)
\(x^{q-1}=1\) implies that \((x^{\frac{1}{2}(q-1)}-1)(x^{\frac{1}{2}(q-1)}+1)=0\), therefore either \(x^{\frac{1}{2}(q-1)}=1\) or \(x^{\frac{1}{2}(q-1)}=-1\). Clearly because of the previous remark, only the latter can be true.
If \(b\) is a non-zero residue modulo \(p\), then \(b\) is a quadratic residue (or square) if \(x^2 \equiv b(\textrm{mod } p)\) has solutions, otherwise \(b\) is a quadratic non-residue (or non-square). So the non-zero squares are precisely the even powers of the primitive element, while the non-zero non-squares are the odd powers.
There are precisely \(\frac{1}{2}(p-1)\) squares mod \(p\), and \(\frac{1}{2}(p-1)\) non-squares.
\(-1\) is a square if \(q \equiv 1(\textrm{mod } 4)\), but not a square for \(q \equiv 3(\textrm{mod } 4)\)
\(q \equiv 1(\textrm{mod } 4)\), then if \(x^i\) is a square so is \(-x^i\).
\(q \equiv 3(\textrm{mod } 4)\), then \(x^i\) is a square \(-x^i\) is a non-square.


SourceGrid is a .NET Windows Forms grid control written entirely in C# with managed code.
SourceGrid can be used to visualize or to change data in a table format.
SourceGrid con be used bound to a data source (typically a DataView) or creating each cell directly.
There are a lot of controls of this type available, but often are expensive, difficult
to customize or too DataSet oriented.
SourceGrid use only managed code (without API or Interop) and can be used with any .NET 2 compatible environments.
In this article I want to supply an overview of the utilization and functionalities
of the SourceGrid control. For details on the classes, properties or methods you
can consult the documentation in CHM format or the example project in the ZIP file.
For more information, a discussion forums, bug tracker system or to download the latest release go to the SourceForge page:
http://sourceforge.net/projects/sourcegrid or to my home page
http://www.devage.com/
To use SourceGrid you must have a .NET 2 compatible development environment (like Visual Studio 2005).
Download the latest release from http://sourceforge.net/projects/sourcegrid.
Unzip the file and reference from your project these assemblies:
Open the form where you want to add the grid control, open the IDE ToolBox, right-click and select "Choose Items...". Browse and add SourceGrid.dll and SourceGrid.Extensions.dll assemblies on the IDE ToolBox.
These assemblies are the same assemblies required by the runtime that you must redistribute with your application to the end-user.
There are 2 main controls inside the SourceGrid.dll assembly:
GridVirtual
- A grid of virtual cells (ICellVirtual)
.Grid
- A grid of real cells (ICell)
.There are therefore two fundamentally distinct objects: virtual cells and real cells. Virtual cells are cells that determine the appearance and the behaviour of the cell but don't contain the value. The real cells have the same properties as virtual cells but also contain the value of the cell, and are therefore associated to a specific position in the grid.
You can use the Grid
control for any kinds of grid where you don't need to display large amounts of cells (typically less than 50.000 cells).
If you have to display large amount of cells you must usually use a GridVirtual
derived controls, see the next chapters for more information.
Typically in this article I will use the Grid
control because is more simply to use especially for simply examples. But consider that basically the same code can be used also for GridVirtual
.
The Grid
is also used if you have unusual grids that require maximum flexibility.
Drag the Grid control inside your forms as any other .NET control and start using it.
For now SourceGrid has a poor design time support, so usually you must write manually the code to manipulate the grid.
Suppose that you have a Grid
control named grid1
you can write this code in the Form.Load
event:
grid1.BorderStyle = BorderStyle.FixedSingle;
grid1.ColumnsCount = 3;
grid1.FixedRows = 1;
grid1.Rows.Insert(0);
grid1[0,0] = new SourceGrid.Cells.ColumnHeader("String");
grid1[0,1] = new SourceGrid.Cells.ColumnHeader("DateTime");
grid1[0,2] = new SourceGrid.Cells.ColumnHeader("CheckBox");
for (int r = 1; r < 10; r++)
{
grid1.Rows.Insert(r);
grid1[r,0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string));
grid1[r,1] = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime));
grid1[r,2] = new SourceGrid.Cells.CheckBox(null, true);
}
grid1.AutoSizeCells();
As you can see you can use the grid like a 2 dimension array.
In the previous code I have set the grid border, the number of columns, the number
of fixed rows and created the first header row. For the header I have used a ColumnHeader
cell. With a simple loop I have created the other cells using a specific type for
each column. The Cell
class automatically creates an appropriate editor
for the type specified (in this case a TextBox and a DateTimePicker). For the last
column I have used a CheckBox
cell that allows the display of a checkbox
directly in the cell. Each kind of cell defines its own visual aspect and behaviour.
The form should look like the one in the following picture.
The grid created supports sorting, column sizing and editing of the cells.
Here some other important features:
grid1[r,c].Value
property where r and c are the row and column of the cell.grid1.Rows.Remove(r)
grid1.Columns[c].Width = 100
If you want to change some visual properties of the cell you must use the View
class.
Let's see another example:
grid1.BorderStyle = BorderStyle.FixedSingle;
grid1.ColumnsCount = 3;
grid1.FixedRows = 1;
grid1.Rows.Insert(0);
SourceGrid.Cells.Views.ColumnHeader boldHeader = new SourceGrid.Cells.Views.ColumnHeader();
boldHeader.Font = new Font(grid1.Font, FontStyle.Bold | FontStyle.Underline);
SourceGrid.Cells.Views.Cell yellowView = new SourceGrid.Cells.Views.Cell();
yellowView.BackColor = Color.Yellow;
SourceGrid.Cells.Views.CheckBox yellowViewCheck = new SourceGrid.Cells.Views.CheckBox();
yellowViewCheck.BackColor = Color.Yellow;
grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("String");
grid1[0, 0].View = boldHeader;
grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime");
grid1[0, 1].View = boldHeader;
grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("CheckBox");
grid1[0, 2].View = boldHeader;
for (int r = 1; r < 10; r++)
{
grid1.Rows.Insert(r);
grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string));
grid1[r, 0].View = yellowView;
grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime));
grid1[r, 1].View = yellowView;
grid1[r, 2] = new SourceGrid.Cells.CheckBox(null, true);
grid1[r, 2].View = yellowViewCheck;
}
I have created a column header view with a style FontStyle.Bold | FontStyle.Underline, one view for a standard cell with a yellow backcolor and a checkbox view always with a yellow backcolor. Then I have assigned these instances to the View
property of each cell.
The form should look like the one in the following picture.
You can note that I have assigned the same instance of the View
class for many cells. This is useful to optimize the resources used.
Each cell can have an editor (Editor
property) associated. The editor is used to edit the cell value.
You can manually create an editor class (see SourceGrid.Cells.Editors
namespace) or use the
SourceGrid.Cells.Editors.Factory
class to create an editor based on a Type
.
You can also use the Cell
constructor that automatically calls SourceGrid.Cells.Editors.Factory
if you specify the Type
parameter.
Here an example that creates some cells and the editors associated using one of the methods described.
//A DateTime editor
grid1[r, c] = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime));
//A string editor
grid1[r, c] = new SourceGrid.Cells.Cell("Ciao", typeof(string));
//A double editor
grid1[r, c] = new SourceGrid.Cells.Cell(58.4);
grid1[r, c].Editor = SourceGrid.Cells.Editors.Factory.Create(typeof(double));
Like the View
classes also the editors can be shared between one or more cells.
Now you can start to work with SourceGrid, for more advanced information see the chapters below.
The Grid
control is the ideal if you want the greatest flexibility
and simplicity but without many cells. In fact, in this control every cell is represented
by a .NET class and therefore occupies a specific quantity of resources. Moreover
this is the only grid that supports features of RowSpan and ColumnSpan (cells merge).
Using the control in a Windows form is trivial. It's just like adding any other control like a Button or a DataGrid. First, create or open a Windows Application project and open a Windows Form into the designer. Now you are ready to customize the Toolbox: Right-Click the Toolbox, .NET Framework Components, Browse, select the DevAge.SourceGrid.dll. The Grid Control is now added to the Toolbox and can be inserted in Windows Form as any other control.
After inserting the control in the form we can begin to write our code using the
grid. For example in the Load
event of the form we can write this code:
grid1.Redim(2, 2);
grid1[0,0] = new SourceGrid.Cells.Cell("Hello from Cell 0,0");
grid1[1,0] = new SourceGrid.Cells.Cell("Hello from Cell 1,0");
grid1[0,1] = new SourceGrid.Cells.Cell("Hello from Cell 0,1");
grid1[1,1] = new SourceGrid.Cells.Cell("Hello from Cell 1,1");
The previous code creates a table with 2 lines and 2 columns (Redim
method) and populates every position with a cell. I have used the SourceGrid.Cells
namespace which contains the definition for real cells.
To read a specific value of the grid you can use the value property of the cell
like this: object val = grid1[1,0].Value;
.
See the other chapters for more information.
The GridVirtual
control is ideal when it is necessary to visualize
a lot of cells and you already have available structured data like a DataSet
,
an Array
, a document XML or other data structure.
This type of grid have the same features of the Grid
control except
for the automatic sort (this because the grid cannot automatically order any external
data structure without copying its content) and the feature of RowSpan and ColumnSpan
that allows spanning of a cell across other adjacent cells.
Another disadvantage is that creating a virtual grid is a little more difficult.
The main concept in a virtual grid is that each cell reads and writes its value from an external data structure
and the grid doesn't maintain all the rows and columns but are normally read directly from the data source.
This idea was implemented with an abstract GridVirtual
class and with the abstract methods CreateRowsObject
, CreateColumnsObject
and GetCell
. Then you can use a special IValueModel
to read the values
directly from the data source.
To use GridVirtual
it is therefore necessary to create a class that
derives from GridVirtual
and personalize the reading of the data source
overriding CreateRowsObject
, CreateColumnsObject
and GetCell
methods.
The purpose of the method GetCell
is to return, for a given position
(row and column), the chosen cell, the methods CreateRowsObject
and
CreateColumnsObject
are used to create the columns and the rows objects
for the used data source. This allows great flexibility because you can return any
ICellVirtual
for a specific type; for example you could return a cell
of type header when the row is 0.
Usually you don't need to use directly the GridVirtual
but one of the
derived controls. For now I have implemented two controls that directly use the
virtual grid features:
DataGrid
- A grid bound to a DataView object.ArrayGrid
- A grid bound to an Array object.
If you want to create your custom control to read from a specific data source you
can see ArrayGrid
class for an example.
Every cell is composed of four fundamental parts based on a modified Model-View-Controller pattern:
Model
: The Model is the class that manages the value of the cells.
It contains the values or properties associated and is accessible by the other components.View
: The View is the class that draws the cell and contains the visual
properties. Controller
: The Controller is the class that supplies the behaviour
of the cell.Editor
: The Editor is the class used to customize the editor of the
cell.This subdivision grants great flexibility and reusability of code, saves time and
supplies a solid base for every type of customization.
For the more common cases there are some classes already arranged and configured,
but with a few lines of code is possible to create personalized cells (see the next
paragraphs for the details).
The main components of a grid are the rows and the columns. To manipulate this information, SourceGrid supplies 2 properties:
Rows
- Manages the rows information, the base class is the RowsBase
class.Columns
- Manages the columns information, the base class is the
ColumnsBase
class.
When using a real grid the base classes are extended with the RowInfoCollection
and the ColumnInfoCollection
. These are collection of RowInfo
and ColumnInfo
classes. When using a virtual grid you must extend the
base classes with your custom code to provide information of your data source.
NOTE: Only valid for real grid.
These are some of the RowInfo
class properties: Height
,
Top
, Bottom
, Index
, Tag
. In
contrast, these are the properties of the ColumnInfo
class:Width
,
Left
, Right
, Index
, Tag
.
There are many ways to create rows and columns:
grid1.Redim(2,2);
grid1.RowsCount = 2;
grid1.ColumnsCount = 2;
grid1.Rows.Insert(0);
grid1.Rows.Insert(1);
grid1.Columns.Insert(0);
grid1.Columns.Insert(1);
These three examples perform all the same task of creating a table with 2 rows and 2 columns.
To change the width or the height of a row or a column you can use this code:
grid1.Rows[0].Height = 100;
grid1.Columns[0].Width = 100;
The properties Top
, Bottom
, Left
and Right
are automatically calculated using the width and the height of the rows and columns.
After allocating the rows and columns, you must create for each position of the grid the required cells, like this code:
grid1.Redim(2,2);
grid1[0, 0] = new SourceGrid.Cells.Cell("Cell 0, 0");
grid1[1, 0] = new SourceGrid.Cells.Cell("Cell 1, 0");
grid1[0, 1] = new SourceGrid.Cells.Cell("Cell 0, 1");
grid1[1, 1] = new SourceGrid.Cells.Cell("Cell 1, 1");
Namespace: SourceGrid.Cells.Models
The purpose of the Model
classes is to separate the data in the cells
from the cell object. This separation is used for two main reasons:
Model
, if implemented in the right way, reads
the data directly from the data source.Cell
class to add new
features, but you can simply add a new Model
.
Every cell has a property Model
that gets or sets a ModelContainer
object. This class is a collection of IModel
interface. Each IModel
interface contains all the properties used for a specific feature.
The main Model
is the ValueModel
which contains the value
of the cell, but there also other models and you can crate your custom models. Here
are the default models:
IValueModel
IToolTipText
ICheckBox
ISortableHeader
Each of these models contains the properties specified for each features, for example
the IToolTipText
contains the ToolTipText string.
Each cell has a collection of models to allow using many features on a single cell.
Usually using real cell you can use a model that simply implement the right interface storing directly the required data; using virtual grid you can implement the interface to bind the values directly to an external data source.
Namespace: SourceGrid.Cells.Views
Every cell has a property View
to gets or sets an interface of type
IView
. The cell uses this interface to draw and to customize the visual
properties of the cell.
The purpose of the View
is to separate the drawing code from the rest
of the code and allows sharing of the same visual properties between cells. In fact
the same instance of View
can be used on many cells simultaneously
thus optimizing the use of the resources of the system.
These are the default View
classes in the namespace SourceGrid.Cells.Views:
SourceGrid.Cells.Views.Cell
- Used for classic cells. In this view
you can customize the colours, the font, the borders and a lot other properties.SourceGrid.Cells.Views.Button
- Used for a cell with a button style
with theme support.SourceGrid.Cells.Views.Link
- Used for a cell with a link style.SourceGrid.Cells.Views.CheckBox*
- Used for checkbox style cells. The
checkbox can be selected, disabled and can contain a caption.SourceGrid.Cells.Views.Header*
- Used for a generic header cell.SourceGrid.Cells.Views.ColumnHeader*
- Used for a column header cell
with theme support.SourceGrid.Cells.Views.RowHeader
- Used for row header cell with theme
support.SourceGrid.Cells.Views.MultiImages
- Allows the drawing of more than
one image in the cell.
*The View
marked with an asterisk requires special components to work
correctly, for example the CheckBox
view needs an ICheckBox
Model
.
Some of the previous classes contain one or more static properties with some convenient default instances.
This code shows how to create a View
class, change some properties
and assign it to more cells previously created:
SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
view.BackColor = Color.Khaki;
grid1[0,0].View = view;
grid1[2,0].View = view;
With some line of code you can create your custom View
, in this case
I suggest deriving your class from Cell
, which already has implemented
some default methods. In the following code example I create a View
that draws a red ellipse over the cell:
public class MyView : SourceGrid.Cells.Views.Cell
{
protected override void DrawCell_Background(SourceGrid.Cells.ICellVirtual p_Cell,
SourceGrid.Position p_CellPosition, PaintEventArgs e, Rectangle p_ClientRectangle)
{
base.DrawCell_Background (p_Cell, p_CellPosition, e, p_ClientRectangle);
e.Graphics.DrawEllipse(Pens.Red, p_ClientRectangle);
}
}
To use this new View
in a cell use this code:
MyView myView = new MyView();
//...... code to populate the grid
grid1[r, c].View = myView;
Namespace: SourceGrid.Cells.Controllers
Every cell has a property Controller
that gets or sets a ControllerContainer
object. This class is a collection of IController
interface. Each
IController
interface can be used to extend the behaviour of the cell
using many events like Click, MouseDown, KeyPress,
...
These are the default classes:
SourceGrid.Cells.Controllers.Cell
- Common behaviour of a cell.SourceGrid.Cells.Controllers.Button
- A cell that acts as a button.SourceGrid.Cells.Controllers.CheckBox
* - A cell with a behaviour of
a CheckBox. (need ICheckBox
Model)SourceGrid.Cells.Controllers.ColumnFocus
- Used to set the focus on
the column when clicking the header cell.SourceGrid.Cells.Controllers.ColumnSelector
- Used to set select the
column when clicking the header cell.SourceGrid.Cells.Controllers.CustomEvents
- Exposes a list of events
that you can use without creating a new Controller
.SourceGrid.Cells.Controllers.FullColumnSelection
- Used to enable the
columns selection mode.SourceGrid.Cells.Controllers.FullRowSelection
- Used to enable the
rows selection mode.SourceGrid.Cells.Controllers.MouseCursor
- Used to display a mouse
cursor over the cell.SourceGrid.Cells.Controllers.MouseInvalidate
- Used to invalidate the
cell area when receiving a mouse event.SourceGrid.Cells.Controllers.Resizable
- Used to create a resizable
cell, for both width and height.SourceGrid.Cells.Controllers.RowFocus
- Used to set the focus on the
row when clicking the header cell.SourceGrid.Cells.Controllers.RowSelector
- Used to set select the row
when clicking the header cell.SourceGrid.Cells.Controllers.SortableHeader
* - Used to create a sortable
column header cell. (need a ISortableHeader
Model)SourceGrid.Cells.Controllers.ToolTipText
* - Used to create a cell with
a ToolTip. (need IToolTipText
Model)SourceGrid.Cells.Controllers.Unselectable
- Used to create an unselectable
cell.
*The Controller
marked with an asterisk need special models to complete
their tasks.
Some of the previous classes contain one or more static properties with some convenient
default instances.
Here the list of events that can be used inside a Controller
:
OnMouseDown
, OnMouseUp
, OnMouseMove
, OnMouseEnter
, OnMouseLeave
OnKeyUp
, OnKeyDown
, OnKeyPress
OnDoubleClick
, OnClick
OnFocusLeaving
, OnFocusLeft
, OnFocusEntering
, OnFocusEntered
, CanReceiveFocus
OnValueChanging
, OnValueChanged
OnEditStarting
, OnEditStarted
, OnEditEnded
With some line of code you can create your custom Controller
, in this
case I suggest deriving your class from ControllerBase
, which already
have implemented some default methods. In the following code example I create a
Controller
that changes the backcolor of the cell when the user moves
the mouse over it:
public class MyController : SourceGrid.Cells.Controllers.ControllerBase
{
private SourceGrid.Cells.Views.Cell MouseEnterView = new SourceGrid.Cells.Views.Cell();
private SourceGrid.Cells.Views.Cell MouseLeaveView = new SourceGrid.Cells.Views.Cell();
public MyController()
{
MouseEnterView.BackColor = Color.Green;
}
public override void OnMouseEnter(SourceGrid.CellContext sender, EventArgs e)
{
base.OnMouseEnter (sender, e);
sender.Cell.View = MouseEnterView;
sender.Grid.InvalidateCell(sender.Position);
}
public override void OnMouseLeave(SourceGrid.CellContext sender, EventArgs e)
{
base.OnMouseLeave (sender, e);
sender.Cell.View = MouseLeaveView;
sender.Grid.InvalidateCell(sender.Position);
}
}
To use this new Controller
in a cell use this code:
MyController myController = new MyController();
//...... code to populate the grid
grid1[r, c].AddController(myController);
You can also add a controller to the whole grid to apply the same controller to all the cells:
grid1.Controller.AddController(new MyController());
Consider for example the Controller below that open a messagebox each time a user click on a cell:
class ClickController : SourceGrid.Cells.Controllers.ControllerBase { public override void OnClick(SourceGrid.CellContext sender, EventArgs e) { base.OnClick(sender, e); object val = sender.Value; if (val != null) MessageBox.Show(sender.Grid, val.ToString()); } }
You can add this controller to all the cells with this code:
grid1.Controller.AddController(new ClickController());
Here another example of how to use a controller to check when the value of a cell change, using the OnValueChanged event:
public class ValueChangedEvent : SourceGrid.Cells.Controllers.ControllerBase { public override void OnValueChanged(SourceGrid.CellContext sender, EventArgs e) { base.OnValueChanged(sender, e); string val = "Value of cell {0} is '{1}'"; MessageBox.Show(sender.Grid, string.Format(val, sender.Position, sender.Value)); } }
You can add this controller to all the cells with this code:
grid1.Controller.AddController(new ValueChangedEvent());
Each time the value of a cell change the previous controller show a messagebox with the position of the cell and the new value.
Namespace: SourceGrid.Cells.Editors
Every cell has a property Editor
that gets or sets an EditorBase
object. This class is used to supply a cell editor. If this property is null it
is not possible to edit the cell.
Usually the Editor
uses the Model
class to manage the
necessary conversion, particularly the string conversion (used to represent the
cell value).
These are the default classes:
ComboBox
- A ComboBox
editor.DateTimePicker
- A DateTimePicker
editor.NumericUpDown
- A NumericUpDown
editor.TextBox
- A TextBox
editor. This is one of the more used
editors by all types that support string conversion (string, int, double, enum,....)
.TextBoxCurrency
- A TextBox
editor specialized for numeric
currency values. TextBoxNumeric
- A TextBox
editor specialized for numeric
values.TimePicker
- A DateTimePicker
editor specialized for time
values.TextBoxUITypeEditor
- Supplies the editing of the cell of all types
that have a UITypeEditor
. This is a very useful class because a lot
of types support this class: DateTime, Font, enums, and you can also create your
custom UITypeEditor
.ImagePicker
- An editor that can be used to select an image file and edit a byte[] values.
An Editor
can be shared between many cells of the same grid; for example
you can use the same Editor
for every cell of a column, but always
with the same grid.
Each Editor
class has a property Control
that returns
an instance of the Windows Forms
control used to edit the cell. You
can use this instance to customize the editor control or for advanced features.
Here some ways to create an editable cell:
SourceGrid.Cells.Editor.Factory.Create
, which returns a valid
Editor
for the type specified or null.
//String cell
grid1[0, 0] = new SourceGrid.Cells.Cell("Hello", typeof(string));
//Double cell
grid1[0, 1] = new SourceGrid.Cells.Cell(0.7, typeof(double));
Editor
separately and then assign it to the cells:
//String editor
SourceGrid.Cells.Editors.IEditor editorString = SourceGrid.Cells.Editor.Factory.Create(typeof(string));
//Double editor
SourceGrid.Cells.Editors.IEditor editorDouble = SourceGrid.Cells.Editor.Factory.Create(typeof(double));
//String cell
grid1[0, 0] = new SourceGrid.Cells.Cell("Hello");
grid1[0, 0].Editor = editorString;
//Double cell
grid1[0, 1] = new SourceGrid.Cells.Cell(0.7);
grid1[0, 1].Editor = editorDouble;
This method is recommended when you want to use the same editor for several cells.
SourceGrid.Cells.Editors.TextBox txtBox =
new SourceGrid.Cells.Editors.TextBox(typeof(string));
grid1[2,0].Editor = txtBox;
If you need greater control on the type of editor or there are special requirements
I suggest to manually creating the editor.
In this case, for example, I manually create the class EditorTextBox
and then set the property MaxLength
.
//String editor
SourceGrid.Cells.Editors.TextBox editorString = new SourceGrid.Cells.Editors.TextBox(typeof(string));
editorString.Control.MaxLength = 10;
//String cell
grid1[0, 0] = new SourceGrid.Cells.Cell("Hello");
grid1[0, 0].Editor = editorString;
The editor can be used also to customize the format of the cell, in the code below for example I create a cell with a custom numeric format:
//Double editor
SourceGrid.Cells.Editors.TextBoxNumeric editorDouble = new SourceGrid.Cells.Editors.TextBoxNumeric(typeof(double));
editorDouble.TypeConverter = new DevAge.ComponentModel.Converter.NumberTypeConverter(typeof(double), "#,###.00");
//String cell
grid1[0, 0] = new SourceGrid.Cells.Cell(9419.3894);
grid1[0, 0].Editor = editorDouble;
I have used the TypeConverter
property to customize the conversion
to and from string values. There are many other TypeConverter
available:
DevAge.ComponentModel.Converter.NumberTypeConverter
- For numeric types
like double, decimal, int, floatDevAge.ComponentModel.Converter.PercentTypeConverter
- For numeric
types like double, decimal and float but with percent format.DevAge.ComponentModel.Converter.CurrencyTypeConverter
- For Decimal
and double types with currency format.DevAge.ComponentModel.Converter.DateTimeTypeConverter
- For DateTime
type.Below another example that create a DateTime editor with a custom format:
//DateTime editor with custom format
string[] dtParseFormats = new string[] { dtFormat2 };
System.Globalization.DateTimeStyles dtStyles = System.Globalization.DateTimeStyles.AllowInnerWhite |
System.Globalization.DateTimeStyles.AllowLeadingWhite |
System.Globalization.DateTimeStyles.AllowTrailingWhite |
System.Globalization.DateTimeStyles.AllowWhiteSpaces;
TypeConverter dtConverter = new DevAge.ComponentModel.Converter.DateTimeTypeConverter(dtFormat2, dtParseFormats, dtStyles);
SourceGrid.Cells.Editors.TextBoxUITypeEditor editorDt2 = new SourceGrid.Cells.Editors.TextBoxUITypeEditor(typeof(DateTime));
editorDt2.TypeConverter = dtConverter;
grid[currentRow, 1] = new SourceGrid.Cells.Cell(DateTime.Today);
grid[currentRow, 1].Editor = editorDt2;
The following picture shows most of the editors available and some special cells (picture from Sample 3):
It is possible to create a custom Editor
with custom control or special
behaviours with few lines of code.
You can derive your custom class from EditorControlBase
and create
any Windows Forms control. This is an example of an editor that uses DateTimePicker
control:
public class DateTimePicker : EditorControlBase
{
public DateTimePicker():base(typeof(System.DateTime))
{
}
protected override Control CreateControl()
{
System.Windows.Forms.DateTimePicker dtPicker =
new System.Windows.Forms.DateTimePicker();
dtPicker.Format = DateTimePickerFormat.Short;
dtPicker.ShowCheckBox = AllowNull;
return dtPicker;
}
protected override void OnChanged(EventArgs e)
{
base.OnChanged(e);
if (Control != null)
Control.ShowCheckBox = AllowNull;
}
public new System.Windows.Forms.DateTimePicker Control
{
get
{
return (System.Windows.Forms.DateTimePicker)base.Control;
}
}
protected override void OnStartingEdit(CellContext cellContext,
Control editorControl)
{
base.OnStartingEdit(cellContext, editorControl);
System.Windows.Forms.DateTimePicker dtPicker =
(System.Windows.Forms.DateTimePicker)editorControl;
dtPicker.Font = cellContext.Cell.View.Font;
}
public override void SetEditValue(object editValue)
{
if (editValue is DateTime)
Control.Value = (DateTime)editValue;
else if (editValue == null)
Control.Checked = false;
else
throw new SourceGridException
("Invalid edit value, expected DateTime");
}
public override object GetEditedValue()
{
if (Control.Checked)
return Control.Value;
else
return null;
}
protected override void OnSendCharToEditor(char key)
{
}
}
Consider that you can share the same instance of the editor with many cells but only with a single grid control. Basically each editor is associated with only one grid.
For large grid it is always a good idea to share the editors, because each editor has a Windows Forms Control associated and so it is quite heavy.
Namespace: SourceGrid.Cells
These are the default cells available:
GridVirtual
control.
CellVirtual
- Base cell for each other implementations; use for the
most common type of virtual cells.Header
- A header cell.ColumnHeader
- A column header cell.RowHeader
- A row header cell.Button
- A button cell.CheckBox
- A checkbox cell.ComboBox
- A combobox cell.Link
- A link style cell.Image
- An image cell.Grid
control.
Cell
- Base cell for all other implementations; use for the most common
type of real cells.Header
- A header cell.ColumnHeader
- A column header cell.RowHeader
- A row header cell.Button
- A button cell.CheckBox
- A checkbox cell.ComboBox
- A combobox cell.Link
- A link style cell.Image
- An image cell.
The goal of these classes is to simplify the use of View, Model, Controller and
Editor
classes. If we look at the code of any of the cell classes we
can see that these classes use these components according to the role of the cell.
This is, for example, the code of the cell SourceGrid.Cells.CheckBox
:
public class CheckBox : Cell
{
public CheckBox(string caption, bool checkValue):base(checkValue)
{
if (caption != null && caption.Length > 0)
View = Views.CheckBox.MiddleLeftAlign;
else
View = Views.CheckBox.Default;
Model.AddModel(new Models.CheckBox());
AddController(Controllers.CheckBox.Default);
AddController(Controllers.MouseInvalidate.Default);
Editor = new Editors.EditorBase(typeof(bool));
Caption = caption;
}
private Models.CheckBox CheckBoxModel
{
get{return (Models.CheckBox)Model.FindModel(typeof(Models.CheckBox));}
}
public bool Checked
{
get{return CheckBoxModel.GetCheckBoxStatus(this, Range.Start).Checked;}
set{CheckBoxModel.SetCheckedValue(this, Range.Start, value);}
}
public string Caption
{
get{return CheckBoxModel.Caption;}
set{CheckBoxModel.Caption = value;}
}
}
A cell can be selected or can have the focus. Only one cell can have the focus,
identified by the Grid.Selection.ActivePosition
property of the grid,
while many cells can be selected. A cell is selected when is present in the Selection
object of the grid.
The cell with the focus receives all the mouse and keyboard events, while the selected
cells can receive actions like copy, paste and clear.
To set the focus on a specific cell you can use Grid.Selection.Focus(Position
pos)
method, using for input the position of the cell that will receive
the focus, use Position.Empty as parameter to remove the focus.
Use the Grid.Selection.SelectCell method or SelectRange method to add or remove specific cells from the selection.
To list all the selected cells you can use Grid.Selection.GetRanges()
method that returns a list of selected Range, or check if a particular cell is
selected using the IsSelectedCell
method. You can customize many aspects of
the selection with these properties: Grid.Selection.BackColor
, Grid.Selection.Border
,
Grid.Selection.FocusBackColor
, ...
You can also use these events to respond to specific action of the user: Grid.Selection.FocusRowEntered
,
Grid.Selection.FocusRowLeaving
, Grid.Selection.FocusColumnEntered
,
Grid.Selection.FocusColumnLeaving
, Grid.Selection.CellLostFocus
,
Grid.Selection.CellGotFocus
, Grid.Selection.SelectionChanged
, ...
You can set the selection mode using the Grid.SelectionMode
property. The available options are: GridSelectionMode.Cell, GridSelectionMode.Row and GridSelectionMode.Column.
In this way you can set the grid to select only entire row, entire column or only single cell.
To enable or disable multi selection you must use the Grid.Selection.EnableMultiSelection
property.
You can select multiple cells using the mouse or with the Ctrl or Shift key.
Two of the most used objects in the project are the structures Position
and Range
. The struct Position
identifies a position with
a Row and a Column, while the struct Range
identifies a group of cells
delimited from a start Position
and an end Position
.
You can read the actual location of a specified cell using grid.PositionToRectangle
method. The resulting rectangle is relative to the grid client area.
You can convert the resulting Rectangle to an absolute screen position using grid.PointToScreen
.
You can obtain the Position
for a specific client area Point
using grid.PositionAtPoint
method.
CellContext
is a structure that encapsulates a Cell
and a Position
and contains all the method to manipulate the cells.
The most important methods are:
Here a common example that show how to use a CellContext
class:
SourceGrid.CellContext context = new SourceGrid.CellContext(grid, new SourceGrid.Position(r, c)); context.Value = "hello"; context.StartEdit();
Usually a CellContext
instance is automatically created as a parameter of the controller events, in this way you can always access the main cell properties.
Each View
class has a property Border
of type DevAge.Drawing.IBorder
. The DevAge.Drawing.IBorder
is a generic interface that can be used to draw a border around the cell.
Usually the IBorder
interface it is implemented by the DevAge.Drawing.RectangleBorder
structure.
Below an example to change a border of a cell:
DevAge.Drawing.Border border = new DevAge.Drawing.Border(Color.Red, 1); DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border); SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell(); view.Border = cellBorder; grid[r, c].View = view;
The default border set only the Right and Bottom side, in this way when you have a group of cells you don't see a double border.
You can also set the border for the grid using the Grid.BorderStyle
property.
See form sample 26 for more information.
You can bind a ToolTip on each cell. You must create a SourceGrid.Cells.Controllers.ToolTipText
controller and associate it to a cell. Here an example:
SourceGrid.Cells.Controllers.ToolTipText toolTipController = new SourceGrid.Cells.Controllers.ToolTipText(); toolTipController.ToolTipTitle = "ToolTip example"; toolTipController.ToolTipIcon = ToolTipIcon.Info; toolTipController.IsBalloon = true; grid1[r, c] = new SourceGrid.Cells.Cell("Hello"); grid1[r, c].ToolTipText = "Example of tooltip, bla bla bla ...."; grid1[r, c].AddController(toolTipController);
The ToolTipText
property of the cell automatically populates a SourceGrid.Cells.Models.IToolTipText
interface bound to the standard cell.
See form sample 26 for more information.
Note: To use the ToolTip on a GridVirtual you must define your custom SourceGrid.Cells.Models.IToolTipText
implementation that read the value from your data source and then add the controller and the model to the virtual cell. See form sample 41.
You can create a ContextMenu (PopUp Menu) for a cell using the code below. First define a controller with the ContextMenu:
//Define a controller with a ContextMenu public class PopupMenu : SourceGrid.Cells.Controllers.ControllerBase { ContextMenu menu = new ContextMenu(); public PopupMenu() { menu.MenuItems.Add("Menu 1", new EventHandler(Menu1_Click)); menu.MenuItems.Add("Menu 2", new EventHandler(Menu2_Click)); } public override void OnMouseUp(SourceGrid.CellContext sender, MouseEventArgs e) { base.OnMouseUp (sender, e); if (e.Button == MouseButtons.Right) menu.Show(sender.Grid, new Point(e.X, e.Y)); } private void Menu1_Click(object sender, EventArgs e) { //TODO Your code here } private void Menu2_Click(object sender, EventArgs e) { //TODO Your code here } }
Then add the controller to a cell:
PopupMenu menuController = new PopupMenu(); ... grid1[r, c] = new SourceGrid.Cells.Cell("Hello"); grid1[r, c].AddController(menuController);
See form sample 26 for more information.
SourceGrid supports clipboard copy, paste and cut operations. To enable these features you can use this code:
grid1.ClipboardMode = SourceGrid.ClipboardMode.All;
The user can then copy, paste and cut the selected cells using Ctrl+C, Ctrl+V or Ctrl+X or delete the content using Delete key.
NOT SUPPORTED: From version 4.5 drag and drop is no more supported, I will try to insert this feature again soon.
Usually with SourceGrid you must do all the work with code, for this reason one import suggestion is to organize it in a good and reusable manner. Here some tips:
If you need to customize some aspects of the cell I usually suggest to create a new class and write your customization code here. In this manner you can reuse your class in all your application and forms. Suppose for example that you want to create all the cells with a gray back color, you can write these new classes:
public class GrayView : SourceGrid.Cells.Views.Cell
{
public new static readonly GrayView Default = new GrayView();
public GrayView()
{
BackColor = Color.LightGray;
}
}
public class GrayCell : SourceGrid.Cells.Cell
{
public GrayCell(object val):base(val)
{
View = GrayView.Default;
}
}
This rule can be applied to any aspects of the grid, for example you can create
a new Controller
class and use it in your cell.
Another important feature that we can see in the previous code is that I have assigned
the View
property from a static
variable. In this way
you can share the same instance with many cells, and optimize the resources of the
system.
Another little suggestion is about the use of namespaces. Many SourceGrid classes
have the same name of some system classes. For example there is a CheckBox
cell with the same name of the CheckBox
control of System.Windows.Forms
,
for this reason is sometime difficult to use a normal using statement. If you don't
like to use a long namespace and want a more readable code I suggest to rename the
namespace in the using statement. For example you can replace this code:
SourceGrid.Cells.Button bt = new SourceGrid.Cells.Button();
with:
using Cells = SourceGrid.Cells;
.................
Cells.Button bt = new Cells.Button();
Other then the default Grid
control there are some extensions that can be used in some specific cases.
You can directly use one of these extensions or you can copy the code and create your own extension.
SourceGrid.DataGrid
is control derived from GridVirtual
used for binding the data to a DevAge.ComponentModel.BoundListBase
class.
The BoundListBase
is an abstract class that can be used to as a generic layer to binding any kind of list control to a list data source.
Typically a data source is a System.Data.DataView
or a custom list class.
Currently there are 2 concrete classes that use BoundListBase
:
DevAge.ComponentModel.BoundDataView
- Used for System.Data.DataView
.DevAge.ComponentModel.BoundList<T>
- Used for any List<T>
class. You can use any kind of object with a default constructor and public property.Basically the DataGrid
control uses a special Model
class of type IValueModel
that reads the data directly from the data source.
SourceGrid.DataGrid
has a property DataSource
used to store the BoundListBase
object.
Here is a simple example on how to use this control:
//Create a sample DataTable
DataTable table = new DataTable();
table.Columns.Add("A", typeof(string));
table.Columns.Add("B", typeof(bool));
table.Rows.Add(new object[]{"Row 1", false});
table.Rows.Add(new object[]{"Row 2", true});
table.Rows.Add(new object[]{"Row 3", false});
dataGrid1.DataSource = new DevAge.ComponentModel.BoundDataView(table.DefaultView);
In the previous code I have created a DataTable
with 2 columns and
some rows, then you can use the DefaultView
property to retrieve a DataView
class and assign it to the DataGrid
control by creating an instance of a BoundDataView
class.
If you want you can customize the columns using the Columns
property.
This property returns a collection of DataGridColumn
objects, you can
customize each column to create customized cells. Here is an example:
//Create a custom View class
SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
view.BackColor = Color.LightBlue;
//Manually add the column
SourceGrid.DataGridColumn gridColumn;
gridColumn = dataGrid.Columns.Add("Country", "Country", typeof(string));
gridColumn.DataCell.View = view;
In this example I have manually created a column and assigned a LightBlue back color at the cell.
You can also use the DataGridColumn.Conditions
to dynamically change the data cell.
For example in the following code I create a condition to use a different cell backcolor for even rows (alternate backcolor):
SourceGrid.Conditions.ICondition condition = SourceGrid.Conditions.ConditionBuilder.AlternateView(gridColumn.DataCell.View, Color.LightGray, Color.Black); gridColumn.Conditions.Add(condition);
In the following other example I create condition to use a View with a bold font and a green forecolor when a specific column is true.
SourceGrid.Conditions.ConditionView selectedConditionBold = new SourceGrid.Conditions.ConditionView(viewSelected); selectedConditionBold.EvaluateFunction = delegate(SourceGrid.DataGridColumn column, int gridRow, object itemRow) { DataRowView row = (DataRowView)itemRow; return row["Selected"] is bool && (bool)row["Selected"] == true; }; gridColumn.Conditions.Add(selectedConditionBold);
Currently there are 2 types of conditions: SourceGrid.Conditions.ConditionView
that can be used to use a special view and SourceGrid.Conditions.ConditionCell
to use a completely different cell.
Both conditions can be used with a delegate to evaluate the row using your specific code.
In the sample project you can find more examples and code.
SourceGrid.ArrayGrid
is a control derived from GridVirtual
used to bind the grid to an array. You can use this control setting the DataSource
property with any System.Array
. You can then customize the cells using
the ValueCell, Header, RowHeader and ColumnHeader
properties.
SourceGrid.Planning.PlanningGrid
control is a UserControl
that internally use a real Grid
to create a grid that can be used to
show appointments. You can call the LoadPlanning
method to set the
range of the visible days and hours, and then add the appointments using the Appointments
properties. This is a collection of IAppointment
interface (implemented
by the AppointmentBase
class).
Each appointment has a View
property that can be used to customize
the appointment cell.
DevAgeSourcePack references these assemblies:
DevAge.Core.dll, DevAge.Windows.Forms.dll
- An open source library with many commons features for .NET. Contains the core of the drawing library and some of the controls used as editors. You can find this library at DevAgeSourcePack article Remember to redistribute these assemblies with SourceGrid.dll.
As any .NET control you can use SourceGrid with any .NET language, also VB.NET. Unfortunately I don't have any example for VB.NET, consider anyway that the code is very similar to C#. Here some of the more common differences:
| C# | VB.NET |
| double x; | Dim x as Double |
| typeof(string) | GetType(String) |
| Class.Event += new EventHandler(Class_Event); | AddHandler Class.Event, Addressof Class_Event |
| grid[r,c] | grid.Item(r,c) |
public class Dog { public Dog() { } public string Name { get{return mName;} set{mName = value;} } } |
Public class Dog Public sub New() End sub Public Property Name() as String Get Return mName End Get Set mName = Value End Set End Property End class |
| List<string> x; | Dim x as List(Of String) |
Frequently Asked Questions:
Q: Can I use this project with Visual Studio 2005?
A: Yes, SourceGrid is compiled with .NET 2 and Visual Studio 2005.
Q: Can I use this project with Visual Studio 2003?
A: No, SourceGrid is compiled with .NET 2 and Visual Studio 2005. If you want you can use an older version (like SourceGrid 3).
Q: How can I create a tree view with SourceGrid? (hierarchical view)
A: For now SourceGrid doesn't support this kind of view. I hope to work on this for a future release.
Q: Can I use these controls with ASP.NET?
A: No, these are Windows Forms Controls. With Internet Explorer you can host a Windows Forms Control inside an html page, but it is usually not a good solution for web pages.
Q: Can I use these controls with .NET Compact Framework? And with Mono?
A: Currently this project is compatible only with Microsoft .NET Framework and Windows platforms.
I'm working for porting some of the code to Mono and Compact Framework.
Consider anyway that all the code is written with managed C# so probably it is not too difficult to use this library with other frameworks.
A special thanks to all who have helped to make this project with suggestions, bug reports, ideas and code.
I've also benefited greatly from:
Visible
property to the ColumnInfo
and RowInfo
class to show or hide columns or rows. For example you can hide a column with this code: grid1.Columns[0].Visible = false;
. See form 50 for an example. (1569378)HeaderHeight
property in the DataGridRows
class, which can be used to set the header height of the DataGrid
control. (1604395)This is a major release with many inportant changes and improvements. Consider that this is a BETA release and probably there are still some bugs and problems. This version can can be unstable. Use the forum for submitting bugs or if you have problems.
Editor.UseCellViewProperties
. The default is true. Set this property to false to manually change the editor control ForeColor, BackColor and Font, otherwise the editor read these properties from the View class.Editor.KeyPress
that can be used to handle any key press of the editor (also when the user start the edit operation with a key)SourceGrid 4 is the evolution of the SourceGrid 3 control. The major differences are:
You can find more information about previous SourceGrid versions at this link: http://www.devage.com/
SourceGrid LICENSE (MIT style)
Copyright (c) 2006 www.devage.com, Davide Icardi
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.


fputwc
, putwc
, fputwc_unlocked
, putwc_unlocked
—write a wide character on a stream or fileSynopsis
#include <stdio.h> #include <wchar.h> wint_t fputwc(wchar_t wc, FILE *fp); #define _GNU_SOURCE #include <stdio.h> #include <wchar.h> wint_t fputwc_unlocked(wchar_t wc, FILE *fp); #include <stdio.h> #include <wchar.h> wint_t _fputwc_r(struct _reent *ptr, wchar_t wc, FILE *fp); #include <stdio.h> #include <wchar.h> wint_t _fputwc_unlocked_r(struct _reent *ptr, wchar_t wc, FILE *fp); #include <stdio.h> #include <wchar.h> wint_t putwc(wchar_t wc, FILE *fp); #define _GNU_SOURCE #include <stdio.h> #include <wchar.h> wint_t putwc_unlocked(wchar_t wc, FILE *fp); #include <stdio.h> #include <wchar.h> wint_t _putwc_r(struct _reent *ptr, wchar_t wc, FILE *fp); #include <stdio.h> #include <wchar.h> wint_t _putwc_unlocked_r(struct _reent *ptr, wchar_t wc, FILE *fp);
Description
fputwc
writes the wide character argument wc to the file or
stream identified by fp.
If the file was opened with append mode (or if the stream cannot support positioning), then the new wide character goes at the end of the file or stream. Otherwise, the new wide character is written at the current value of the position indicator, and the position indicator oadvances by one.
fputwc_unlocked
is a non-thread-safe version of fputwc
.
fputwc_unlocked
may only safely be used within a scope
protected by flockfile() (or ftrylockfile()) and funlockfile(). This
function may safely be used in a multi-threaded program if and only
if they are called while the invoking thread owns the (FILE *)
object, as is the case after a successful call to the flockfile() or
ftrylockfile() functions. If threads are disabled, then
fputwc_unlocked
is equivalent to fputwc
.
The putwc
and putwc_unlocked
functions or macros function identically
to fputwc
and fputwc_unlocked
. They may be implemented as a macro, and
may evaluate its argument more than once. There is no reason ever to use them.
The _fputwc_r
, _putwc_r
, _fputwc_unlocked_r
, and
_putwc_unlocked_r
functions are simply reentrant versions of the above
that take an additional reentrant structure argument: ptr.
Returns
If successful, fputwc
and putwc
return their argument wc.
If an error intervenes, the result is EOF
. You can use
‘ferror(fp)
’ to query for errors.
Portability
fputwc
and putwc
are required by C99 and POSIX.1-2001.
fputwc_unlocked
and putwc_unlocked
are GNU extensions.


Preparation time
less than 30 mins
Cooking time
10 to 30 mins
Serves
Serves 4 (or 8 as a side dish)
Dietary
This hearty vegetarian stew is quick and easy to prepare. Serve with yoghurt and pitta breads.
Each serving provides 257kcal, 11g protein, 27g carbohydrate (of which 7g sugars), 10g fat (of which 1g saturates), 10g fibre and 1.3g salt.
Heat a large deep frying pan over a medium to high heat.
Add the oil, onion, garlic, ginger, chillies and salt and cook for five minutes (or until the onions are soft) being careful to stir regularly.
Add the chickpeas, 80ml/2¾fl oz water, cumin, turmeric and pepper and cook for five minutes or until the water evaporates.
Add the tomatoes and cook for another two minutes to soften.
Remove from the heat and check for seasoning.
Stir through the spinach and top with yoghurt.
To make the pitta crisps, break up pieces of pitta bread and drizzle with olive oil, salt, pepper and paprika.
Bake in a moderate oven for 10-12 minutes or until crisp.
Serve with the stew on a warmed plate.


Location:
Heading:
Pitch:
Field of View/Zoom:
Street View Image URL:
Clear
Update Image
Update All
Copy and paste the URL in the textbox below for the image you want to use.


Logo Image
Enter your yes / no question and click on the eight ball to see your future.
(animation on click)


--- title: tty-share terminal sharing layout: default bodyClass: page-home ---
Only one binary needed on your side. The remote participant needs no tool.
The connection from your machine to the remote side is fully encrypted.


Some of the interfaces has been upgraded.
mermaid_config is no longer used. Instead a call to mermaid initialize is done as in the example below:
mermaid_config = { startOnLoad:true };
mermaid.initialize({ startOnLoad:true });