C# Rows Behaving Weird And Not The Way I want It - c#

I am using C# and I want to change the view of the output. The Original output was this.
|---------------|---------------|-----------------|
| Student Name | Student Year | Student Teacher |
|---------------|---------------|-----------------|
| StudentName01 | Junior | Ms. Mandy |
| StudentName02 | Junior | Ms. Mandy |
| StudentName03 | Junior | Ms. Mandy |
| StudentName04 | Junior | Ms. Mandy |
| StudentName05 | Junior | Ms. Mandy |
| StudentName06 | Junior | Ms. Mandy |
| StudentName07 | Junior | Ms. Mandy |
| StudentName08 | Junior | Ms. Mandy |
| StudentName09 | Junior | Ms. Mandy |
| StudentName10 | Junior | Ms. Mandy |
|---------------|---------------|-----------------|
Target Output:
|---------------|---------------|-----------------|---------------|---------------|-----------------|
| Student Name | Student Year | Student Teacher | Student Name | Student Year | Student Teacher |
|---------------|---------------|-----------------|---------------|---------------|-----------------|
| Martha | Junior | Ms. Mandy | Barry | Junior | Ms. Mandy |
| Joseph | Junior | Ms. Mandy | Cathy | Junior | Ms. Mandy |
| Adam | Junior | Ms. Mandy | Elle | Junior | Ms. Mandy |
| Lyn | Junior | Ms. Mandy | Faye | Junior | Ms. Mandy |
| Drew | Junior | Ms. Mandy | Gary | Junior | Ms. Mandy |
|---------------|---------------|-----------------|---------------|---------------|-----------------|
Current Output:
|---------------|---------------|-----------------|---------------|---------------|-----------------|
| Student Name | Student Year | Student Teacher | Student Name | Student Year | Student Teacher |
|---------------|---------------|-----------------|---------------|---------------|-----------------|
| Martha | Junior | Ms. Mandy | | | |
| Joseph | Junior | Ms. Mandy | | | |
| Adam | Junior | Ms. Mandy | | | |
| Lyn | Junior | Ms. Mandy | | | |
| Drew | Junior | Ms. Mandy | | | |
| | | | Barry | Junior | Ms. Mandy |
| | | | Cathy | Junior | Ms. Mandy |
| | | | Elle | Junior | Ms. Mandy |
| | | | Faye | Junior | Ms. Mandy |
| | | | Gary | Junior | Ms. Mandy |
|---------------|---------------|-----------------|---------------|---------------|-----------------|
This is my code and I am getting the Current Output. What should I add to get the Target Output?
CString temp;
int qtnt;
for (int i = 0 ; i <= Student_Max; i++)
{
StudentInfo[i].StudentLine1 = "Student Name";
StudentInfo[i].StudentLine1 = YEAR;
StudentInfo[i].StudentNo1 = -1;
StudentInfo[i].StudentLine2 = "Student Name";
StudentInfo[i].StudentLine2 = YEAR;
StudentInfo[i].StudentNo2 = -1;
if (qtnt = (Student_Max / 2)
{
int qtnt1 = qtnt;
int qtnt2 = qtnt1 + qtnt;
temp.Format("StudentName %d", i+1);
if (i < qtnt1)
{
StudentInfo[i].StudentLine1 = (new CString(temp))[0];
StudentInfo[i].StudentYear1 = STUDENTYEAR;
StudentInfo[i].StudentNo1 = i;
}
else if (i < qtnt2)
{
StudentInfo[i].StudentLine2 = (new CString(temp))[0];
StudentInfo[i].StudentLine2 = STUDENTYEAR;
StudentInfo[i].StudentNo2 = i;
}
}
}

What about this?
for(int i = 0 ; i <= Student_Max; i++){
StudentInfo[i].StudentLine1 = "Student Name";
StudentInfo[i].StudentLine1 = YEAR;
StudentInfo[i].StudentNo1 = -1;
StudentInfo[i].StudentLine2 = "Student Name";
StudentInfo[i].StudentLine2 = YEAR;
StudentInfo[i].StudentNo2 = -1;
if (qtnt = (Student_Max / 2)
{
int qtnt1 = qtnt;
int qtnt2 = qtnt1 + qtnt;
temp.Format("StudentName %d", i+1);
if (i < qtnt1)
{
StudentInfo[i].StudentLine1 = (new CString(temp))[0];
StudentInfo[i].StudentYear1 = STUDENTYEAR;
StudentInfo[i].StudentNo1 = i;
}
else if (i < qtnt2)
{
--> StudentInfo[i - qtnt1].StudentLine2 = (new CString(temp))[0];
--> StudentInfo[i - qtnt1].StudentLine2 = STUDENTYEAR;
--> StudentInfo[i - qtnt1].StudentNo2 = i;
}
}
This only works for 2 columns and you would need to redim StudentInfo[] appropriately.

Related

What causes the difference of different copy method of different array length in C#?

In C#, there are some different ways to copy the elements of an array to another. To the best of my knowledge, they are "For" loop, Array.CopyTo, Span<T>.CopyTo, T[].CopyTo and Buffer.BlockCopy.
Since looping to copy the elements is always the slowest way, I skip it and run benchmark test for the other four methods. However, it seems that the speed of them are related with the length of the array, which really confused me.
My code of benchmark test is shown below. My experiment environment is Windows 11, .NET 6, Intel 12700 CPU, 64bits, using "BenchmarkDotnet" as the benchmark test framework.
public class UnitTest1
{
static readonly int times = 1000;
static readonly int arrayLength = 8;
int[] src = GetRandomArray(arrayLength);
int[] dst = new int[arrayLength];
public static int[] GetRandomArray(int length)
{
int[] array = new int[length];
for (int i = 0; i < length; i++)
{
array[i] = new Random(DateTime.Now.Millisecond).Next(int.MinValue, int.MaxValue);
}
System.Threading.Thread.Sleep(2000);
return array;
}
[Benchmark]
public void TestArrayCopy()
{
for (var j = 0; j < times; j++)
{
src.CopyTo(dst, 0);
}
}
[Benchmark]
public void TestSingleSpanCopy()
{
var dstSpan = dst.AsSpan();
for (var j = 0; j < times; j++)
{
src.CopyTo(dstSpan);
}
}
[Benchmark]
public void TestDoubleSpanCopy()
{
var srcSpan = src.AsSpan();
var dstSpan = dst.AsSpan();
for (var j = 0; j < times; j++)
{
srcSpan.CopyTo(dstSpan);
}
}
[Benchmark]
public void BufferCopy()
{
for (var j = 0; j < times; j++)
{
System.Buffer.BlockCopy(src, 0, dst, 0, sizeof(int) * src.Length);
}
}
}
Here are the test results.
times = 1000, arrayLength = 8
| Method | Mean | Error | StdDev |
|------------------- |---------:|----------:|----------:|
| TestArrayCopy | 3.061 us | 0.0370 us | 0.0543 us |
| TestSingleSpanCopy | 1.297 us | 0.0041 us | 0.0038 us |
| TestDoubleSpanCopy | 1.113 us | 0.0190 us | 0.0203 us |
| BufferCopy | 7.162 us | 0.1250 us | 0.1044 us |
times = 1000, arrayLength = 16
| Method | Mean | Error | StdDev |
|------------------- |---------:|----------:|----------:|
| TestArrayCopy | 3.426 us | 0.0677 us | 0.0806 us |
| TestSingleSpanCopy | 1.609 us | 0.0264 us | 0.0206 us |
| TestDoubleSpanCopy | 1.478 us | 0.0228 us | 0.0202 us |
| BufferCopy | 7.465 us | 0.0866 us | 0.0723 us |
times = 1000, arrayLength = 32
| Method | Mean | Error | StdDev | Median |
|------------------- |----------:|----------:|----------:|----------:|
| TestArrayCopy | 4.063 us | 0.0417 us | 0.0390 us | 4.076 us |
| TestSingleSpanCopy | 4.115 us | 0.3552 us | 1.0473 us | 4.334 us |
| TestDoubleSpanCopy | 3.576 us | 0.3391 us | 0.9998 us | 3.601 us |
| BufferCopy | 12.922 us | 0.7339 us | 2.1640 us | 13.814 us |
times = 1000, arrayLength = 128
| Method | Mean | Error | StdDev | Median |
|------------------- |----------:|----------:|----------:|----------:|
| TestArrayCopy | 7.865 us | 0.0919 us | 0.0815 us | 7.842 us |
| TestSingleSpanCopy | 7.036 us | 0.2694 us | 0.7900 us | 7.256 us |
| TestDoubleSpanCopy | 7.351 us | 0.0914 us | 0.0855 us | 7.382 us |
| BufferCopy | 10.955 us | 0.1157 us | 0.1083 us | 10.947 us |
times = 1000, arrayLength = 1024
| Method | Mean | Error | StdDev | Median |
|------------------- |---------:|---------:|----------:|---------:|
| TestArrayCopy | 45.16 us | 3.619 us | 10.670 us | 48.95 us |
| TestSingleSpanCopy | 36.85 us | 3.608 us | 10.638 us | 34.77 us |
| TestDoubleSpanCopy | 38.88 us | 3.378 us | 9.960 us | 39.91 us |
| BufferCopy | 48.83 us | 4.352 us | 12.833 us | 53.65 us |
times = 1000, arrayLength = 16384
| Method | Mean | Error | StdDev |
|------------------- |---------:|----------:|----------:|
| TestArrayCopy | 1.417 ms | 0.1096 ms | 0.3233 ms |
| TestSingleSpanCopy | 1.487 ms | 0.1012 ms | 0.2983 ms |
| TestDoubleSpanCopy | 1.438 ms | 0.1115 ms | 0.3287 ms |
| BufferCopy | 1.423 ms | 0.1147 ms | 0.3383 ms |
times = 100, arrayLength = 65536
| Method | Mean | Error | StdDev |
|------------------- |---------:|---------:|----------:|
| TestArrayCopy | 630.9 us | 47.01 us | 138.61 us |
| TestSingleSpanCopy | 629.5 us | 46.83 us | 138.08 us |
| TestDoubleSpanCopy | 655.4 us | 47.23 us | 139.25 us |
| BufferCopy | 419.0 us | 3.31 us | 2.93 us |
When the arrayLength is 8 or 16, the Span<T>.CopyTo() is the fastest. When the arrayLength is 32 or 128, the first three way are almost the same and all faster than Buffer.BlockCopy.Ehen the arrayLength is 1024, however, the Span<T>.CopyTo and T[].CopyTo are again faster than the other two ways. When the arrayLength is 16384, these four ways are almost the same. But when the arrayLength is 65536, the Buffer.BlockCopy is the fastest! Besides, the Span<T>.CopyTo here is a bit slower than the first two ways.
I really can't understand the results. At first I guess it's the cpu cache that matters. However, the L1 Cache of my CPU is 960KB, which is larger than the space of the array of any test case. Maybe it's the different implementation that causes this?
I will appreciate it if you are willing to explain it for me or discuss with me. I will also think about it and update the question if I get an idea.
As #Ralf mentioned, the source and destination of the array in each time are all the same, which could impact on the results. I modified my code and tried the test again, as is shown below. To avoid the time consume, I just declare a new array each time instead of randomize it manually.
using System.Buffers;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
public class Program
{
public static void Main(string[] args)
{
var summary = BenchmarkRunner.Run(typeof(Program).Assembly);
Console.WriteLine(summary);
}
}
public class UnitTest1
{
static readonly int times = 1000;
static readonly int arrayLength = 8;
public static int[] GetRandomArray(int length)
{
int[] array = new int[length];
//for (int i = 0; i < length; i++)
//{
// array[i] = new Random(DateTime.Now.Millisecond).Next(int.MinValue, int.MaxValue);
//}
return array;
}
[Benchmark]
public void ArrayCopy()
{
for (var j = 0; j < times; j++)
{
int[] src = GetRandomArray(arrayLength);
int[] dst = new int[arrayLength];
src.CopyTo(dst, 0);
}
}
[Benchmark]
public void SingleSpanCopy()
{
for (var j = 0; j < times; j++)
{
int[] src = GetRandomArray(arrayLength);
int[] dst = new int[arrayLength];
src.CopyTo(dst.AsSpan());
}
}
[Benchmark]
public void DoubleSpanCopy()
{
for (var j = 0; j < times; j++)
{
int[] src = GetRandomArray(arrayLength);
int[] dst = new int[arrayLength];
src.AsSpan().CopyTo(dst.AsSpan());
}
}
[Benchmark]
public void BufferCopy()
{
for (var j = 0; j < times; j++)
{
int[] src = GetRandomArray(arrayLength);
int[] dst = new int[arrayLength];
System.Buffer.BlockCopy(src, 0, dst, 0, sizeof(int) * src.Length);
}
}
}
times = 1000, arrayLength = 8
| Method | Mean | Error | StdDev | Median |
|--------------- |----------:|----------:|----------:|----------:|
| ArrayCopy | 8.843 us | 0.1762 us | 0.3040 us | 8.843 us |
| SingleSpanCopy | 6.864 us | 0.1366 us | 0.1519 us | 6.880 us |
| DoubleSpanCopy | 10.543 us | 0.9496 us | 2.7999 us | 10.689 us |
| BufferCopy | 21.270 us | 1.3477 us | 3.9738 us | 22.630 us |
times = 1000, arrayLength = 16
| Method | Mean | Error | StdDev | Median |
|--------------- |---------:|---------:|---------:|---------:|
| ArrayCopy | 16.94 us | 0.952 us | 2.808 us | 17.27 us |
| SingleSpanCopy | 12.54 us | 1.054 us | 3.109 us | 12.32 us |
| DoubleSpanCopy | 13.23 us | 0.930 us | 2.741 us | 13.25 us |
| BufferCopy | 23.43 us | 1.218 us | 3.591 us | 24.99 us |
times = 1000, arrayLength = 32
| Method | Mean | Error | StdDev | Median |
|--------------- |---------:|---------:|---------:|---------:|
| ArrayCopy | 24.35 us | 1.774 us | 5.229 us | 26.23 us |
| SingleSpanCopy | 20.64 us | 1.726 us | 5.089 us | 21.09 us |
| DoubleSpanCopy | 19.97 us | 1.915 us | 5.646 us | 20.08 us |
| BufferCopy | 26.24 us | 2.547 us | 7.511 us | 24.59 us |
times = 1000, arrayLength = 128
| Method | Mean | Error | StdDev |
|--------------- |---------:|---------:|---------:|
| ArrayCopy | 39.11 us | 0.529 us | 0.495 us |
| SingleSpanCopy | 39.14 us | 0.782 us | 1.070 us |
| DoubleSpanCopy | 40.24 us | 0.798 us | 1.398 us |
| BufferCopy | 42.20 us | 0.480 us | 0.426 us |
times = 1000, arrayLength = 1024
| Method | Mean | Error | StdDev |
|--------------- |---------:|--------:|--------:|
| ArrayCopy | 254.6 us | 4.92 us | 8.87 us |
| SingleSpanCopy | 241.4 us | 2.98 us | 2.78 us |
| DoubleSpanCopy | 243.7 us | 4.75 us | 4.66 us |
| BufferCopy | 243.0 us | 2.85 us | 2.66 us |
times = 1000, arayLength = 16384
| Method | Mean | Error | StdDev |
|--------------- |---------:|----------:|----------:|
| ArrayCopy | 4.325 ms | 0.0268 ms | 0.0250 ms |
| SingleSpanCopy | 4.300 ms | 0.0120 ms | 0.0112 ms |
| DoubleSpanCopy | 4.307 ms | 0.0348 ms | 0.0325 ms |
| BufferCopy | 4.293 ms | 0.0238 ms | 0.0222 ms |
times = 100, arrayLength = 65536
| Method | Mean | Error | StdDev | Median |
|--------------- |---------:|---------:|---------:|---------:|
| ArrayCopy | 153.6 ms | 1.46 ms | 1.29 ms | 153.1 ms |
| SingleSpanCopy | 213.4 ms | 8.78 ms | 25.87 ms | 218.2 ms |
| DoubleSpanCopy | 221.2 ms | 9.51 ms | 28.04 ms | 229.7 ms |
| BufferCopy | 203.1 ms | 10.92 ms | 32.18 ms | 205.6 ms |
#Ralf is right, there is indeed some differences. The most significant one is that when arrayLength = 65536, Array.Copy instead of Buffer.BlockCopy is the fastest.
But still, the results are very confusing..
Are you sure you can repeat the same benchmark and get the same results? Perhaps it was just a one time occurence, maybe caused by heat issues or another app taking processor time. When I try it on my machine, the values I get are more in line with what you'd expect.
It says Windows 10 for some reason, I'm using 11 too.
BenchmarkDotNet=v0.13.1, OS=Windows 10.0.22000
11th Gen Intel Core i9-11980HK 2.60GHz, 1 CPU, 16 logical and 8 physical cores
.NET SDK=6.0.201
[Host] : .NET 6.0.3 (6.0.322.12309), X64 RyuJIT
DefaultJob : .NET 6.0.3 (6.0.322.12309), X64 RyuJIT
| Method | Mean | Error | StdDev |
|------------------- |---------:|--------:|--------:|
| TestArrayCopy | 466.6 us | 0.69 us | 0.61 us |
| TestSingleSpanCopy | 444.7 us | 1.07 us | 1.00 us |
| TestDoubleSpanCopy | 443.8 us | 0.62 us | 0.52 us |
| BufferCopy | 447.1 us | 7.28 us | 6.08 us |
Just before posting this, I realized: Your CPU, 12700, has performance and efficiency cores. What if it ran most of the benchmark on efficiency cores and just so happened to run the BufferCopy part on performance cores? Can you try disabling your efficiency cores in BIOS?

How to describe C# yield return in UML sequence diagram?

For example,
using System;
using System.Collections;
namespace ConsoleApplication
{
class A : IEnumerable
{
B b;
public A()
{
b = new B();
}
public IEnumerator GetEnumerator()
{
yield return b.FunA(0);
yield return b.FunB(1);
yield return b.FunC(2);
yield return b.FunD(3);
yield return b.FunE(4);
}
}
class B
{
public int FunA(int x)
{
return x;
}
public int FunB(int x)
{
return x * 2;
}
public int FunC(int x)
{
return x * 3;
}
public int FunD(int x)
{
return x * 4;
}
public int FunE(int x)
{
return x * 5;
}
}
class Program
{
static void Main(string[] args)
{
var a = new A();
foreach(var number in a)
{
Console.WriteLine(number);
}
Console.ReadLine();
}
}
}
How to describe this program in sequence diagram?
I think it should be something similar to a loop or alt section like below.
+------------+ +------------+ +------------+
| Program | | A | | B |
+-----+------+ +------+-----+ +------+-----+
| | |
| | |
| | |
| | |
+-----+--------------------------------------------------------------+
|loop | | [0] | | |
+-----+ | | | |
| | | | |
| | | | |
| | | | |
+--------------------------------------------------------------------+
| | [1] | | |
| | | | |
| | | | |
| | | | |
| | | | |
+--------------------------------------------------------------------+
| | [2] | | |
| | | | |
| | | | |
| | | | |
| | | | |
+--------------------------------------------------------------------+
| | [3] | | |
| | | | |
| | | | |
| | | | |
| | | | |
+--------------------------------------------------------------------+
| | [4] | | |
| | | | |
| | | | |
| | | | |
| | | | |
+--------------------------------------------------------------------+
| | |
| | |
Edit:
I'm analyzing the source code of a plugin of Unity3D. IEnumerator and yield are used to implement a coroutine model. The coroutine is used as an alternative to the thread. So it IS reasonable to show the part of the logic of coroutine in the sequence diagram.
For sequence diagram you can define the loop(while loop) as far as yield keyword execution is concern please refer the below link
internals of C# interators
I think this link will help you to understand why the yield can be represented as loop.

How do I insert data in Excel into database

I have been beating my head on this for awhile, this is in import form, it imports lines from a excel spreadsheet to a datagridview then allows the user to make sure changes if needed, then adds or updates the db lines.
I have included sample rows from the spreadsheet, and the part of the code that checks the lines. My issue is that 4 of the rows do not flag as prev. found no matter how many times you run it.
Any input?
Sample excel file:
+-------+----------+-----------+------------------+-------+------------+--------+------------------------+
| Trans | Eff Date | Policy # | Insured Name | PIF | GWP | Agent% | Agent NB Comm |
+-------+----------+-----------+------------------+-------+------------+--------+------------------------+
| AV | Jul-10 | 186990710 | FLORECE, BOB | 0 | 0.00 | 10.000 | 0.00 |
| AV | Jul-18 | 193214729 | CIRONIDA, JOHN A | 0 | 0.00 | 10.000 | 0.00 |
| CH | Jun-26 | 186990710 | FLORECE, BOB | 0 | 51.97 | 10.000 | 5.20 |
| CH | Jul-10 | 186990710 | FLORECE, BOB | 0 | (64.83) | 10.000 | (6.48) - NOT MATCHED |
| CH | Jul-10 | 186990710 | FLORECE, BOB | 1 | 272.19 | 10.000 | 27.22 |
| CH | Jul-01 | 192182230 | URZ, SUSAN A | 0 | (50.70) | 10.000 | (5.07) - NOT MATCHED |
| CH | Jul-09 | 193089995 | STOMPKINS, JIM | 0 | 45.37 | 10.00 | 4.54 |
| CH | Jul-18 | 193214729 | CIRONIDA, JOHN A | 1 | 125.99 | 10.000 | 12.60 |
| CH | May-15 | 196666151 | STROP, JONA | 0 | 13.40 | 10.000 | 1.34 |
| CH | May-15 | 196666151 | STROP, JONA | 0 | (13.40) | 10.000 | (1.34) |
| CN | Jul-03 | 193435083 | MADDORE, SHARON | -1 | (1,097.81) | 10.000 | (109.78) - NOT MATCHED |
| NB | Jul-01 | 192182230 | URZ, SUSAN A | 3 | 570.10 | 10.000 | 57.01 |
| CH | Jul-10 | 197907782 | LANSKY, WAYNE | 0 | 4.34 | 10.000 | 0.43 |
| NB | Jul-14 | 184221262 | SMITH, DAN | 2 | 419.60 | 10.000 | 41.96 |
| CH | Jul-03 | 184532495 | MULLEN, ROBERT | 0 | (16.41) | 10.000 | (1.64) - NOT MATCHED |
+-------+----------+-----------+------------------+-------+------------+--------+------------------------+
code:
intDGRow = dgvImported.Rows.Count;
for (int i = 0; i < intDGRow; i++)
{
//set var values from the dgv
strPolicyNum = dgvImported.Rows[i].Cells["policynum"].Value.ToString().Replace(" ", string.Empty);
strEDate = DateTime.Parse(dgvImported.Rows[i].Cells["EffDate"].Value.ToString()).ToShortDateString();
strGWP = dgvImported.Rows[i].Cells["gwp"].Value.ToString().Replace(",", string.Empty);
strPIF = dgvImported.Rows[i].Cells["pif"].Value.ToString();
//check if row matches a current transaction in the DB - if so update matched column to value = matched - checks for match by doing a row count in the DB that match the fields - if only 1 row matches then the transaction is a match
if (dbAccess.RowCount("sales", "policynum = '" + strPolicyNum + "' AND effectivedate = #" + strEDate + "# AND pif = " + strPIF + " AND gwp = " + strGWP) == 1)
{
if (dbAccess.RowCount("sales", "policynum = '" + strPolicyNum + "' AND effectivedate = #" + strEDate + "# AND pif = " + strPIF + " AND gwp = " + strGWP + "AND matched = true") == 1)
{
dgvImported.Rows[i].Cells["Matched"].Value = "PrevMatched"; //update the matched column to reflect this item was previously matched
}
else
{
dgvImported.Rows[i].Cells["Matched"].Value = "Matched"; //update the matched column to reflect this item was matched
}//end sub if / else (prev matched)
}//end if
else
{
dgvImported.Rows[i].Cells["Matched"].Value = "UnMatched"; //update the matched column to reflect this item was not matched
}//end else
dgvImported.Rows[i].Cells["producer"].Value = dbAccess.ValueLookup("SELECT producer FROM sales WHERE policynum = '" + strPolicyNum + "'", "producer"); //lookup the producer for the policy number - should pull the last producer attached to the policy
dgvImported.Rows[i].Cells["SalesID"].Value = dbAccess.ValueLookup("SELECT saleskey FROM sales WHERE policynum = '" + strPolicyNum + "' AND effectivedate = #" + strEDate + "# AND gwp = " + strGWP, "saleskey"); //lookup the saleskey from sales table that matches the transaction
}//end for
}//end if file open
}//end file open button
if you need any additional details let me know.

configure mercurial .hgingore to ignore all files and folder in a directory except 'repositories.config'

I have a multi-project solution with directory structure given below
What i want is to ignore all files and folder with path library-management-system\packages. But the packages folder has a file named repositories.config which i don't want to be ignored by Mercurial.
How can i do that ?
Folder PATH listing for volume PARIMAL
Volume serial number is 00650067 DD35:25E5
R:\LIBRARY-MANAGEMENT-SYSTEM
| LibraryManagementSystem.sln
| LibraryManagementSystem.sln.DotSettings.user
| .hgignore
|
+---CybotechDomain
| | App.config
| | CybotechDomain.csproj
| | CybotechDomain.csproj.user
| |
| +---Entity
| | Batch.cs
| | Book.cs
| | BookIssue.cs
| | Course.cs
| | Faculty.cs
| | Manager.cs
| | Person.cs
| | Semester.cs
| | Student.cs
| |
| +---Properties
| | AssemblyInfo.cs
| |
| +---bin
| | \---Debug
| | CybotechDomain.dll.config
| | CybotechDomain.dll
| | CybotechDomain.pdb
| |
| \---obj
| \---Debug
| | DesignTimeResolveAssemblyReferencesInput.cache
| | CybotechDomain.pdb
| | CybotechDomain.dll
| | CybotechDomain.csproj.FileListAbsolute.txt
| |
| \---TempPE
+---LibraryData
| | App.config
| | LibraryData.csproj
| | packages.config
| |
| +---Data
| | BookRepository.cs
| | CourseRepository.cs
| | FacultyRepository.cs
| | IRepository.cs
| | IUnitOfWork.cs
| | LibraryContext.cs
| | LibraryInitializer.cs
| | LibraryUnitOfWork.cs
| | StudentRepository.cs
| |
| +---Properties
| | AssemblyInfo.cs
| |
| +---bin
| | \---Debug
| | CybotechDomain.dll
| | EntityFramework.dll
| | CybotechDomain.pdb
| | EntityFramework.xml
| | LibraryData.dll.config
| | LibraryData.dll
| | LibraryData.pdb
| |
| \---obj
| \---Debug
| | DesignTimeResolveAssemblyReferencesInput.cache
| | LibraryData.csprojResolveAssemblyReference.cache
| | LibraryData.pdb
| | LibraryData.dll
| | LibraryData.csproj.FileListAbsolute.txt
| |
| \---TempPE
+---LibraryManager
| | LibraryManager.csproj
| | LibraryManager.csproj.DotSettings
| | Program.cs
| | app.config
| | packages.config
| |
| +---Application
| | ApplicationModule.cs
| | Composition.cs
| |
| +---Icons
| | books.ico
| | course.ico
| |
| +---Images
| | add-16.png
| | add-24.png
| | book-32.png
| | book-48.png
| | book-issue.png
| | book-read.png
| | books.png
| | course.png
| | delete-16.png
| | delete-24.png
| | header.jpg
| | issue_book.png
| | lock-32.png
| | logo.PNG
| | orb.jpg
| | student-32.png
| | teacher-32.png
| |
| +---Properties
| | AssemblyInfo.cs
| | Resources.Designer.cs
| | Resources.resx
| | Settings.Designer.cs
| | Settings.settings
| |
| +---View
| | BookForm.Designer.cs
| | BookForm.cs
| | BookForm.resx
| | BookIssueForm.Designer.cs
| | BookIssueForm.cs
| | BookIssueForm.resx
| | BookListForm.Designer.cs
| | BookListForm.cs
| | BookListForm.resx
| | CourseForm.Designer.cs
| | CourseForm.cs
| | CourseForm.resx
| | Extensions.cs
| | FacultyAddForm.Designer.cs
| | FacultyAddForm.cs
| | FacultyAddForm.resx
| | InputBox.cs
| | InputForm.Designer.cs
| | InputForm.cs
| | InputForm.resx
| | LoginForm.Designer.cs
| | LoginForm.cs
| | LoginForm.resx
| | MainForm.Designer.cs
| | MainForm.cs
| | MainForm.resx
| | OfficeFormWithStatus.cs
| | StudentAddForm.Designer.cs
| | StudentAddForm.cs
| | StudentAddForm.resx
| |
| +---bin
| | \---Debug
| | | LibraryManager.vshost.exe.config
| | | LibraryManager.vshost.exe.manifest
| | | LibraryManager.vshost.exe
| | | CybotechDomain.dll
| | | EntityFramework.dll
| | | Equin.ApplicationFramework.BindingListView.dll
| | | LibraryData.dll
| | | Ninject.dll
| | | System.Data.SqlServerCe.dll
| | | CybotechDomain.pdb
| | | LibraryData.pdb
| | | EntityFramework.xml
| | | Equin.ApplicationFramework.BindingListView.pdb
| | | Ninject.pdb
| | | Ninject.xml
| | | LibraryManager.exe.config
| | | LibraryManager.exe
| | | LibraryManager.pdb
| | |
| | +---x86
| | | | sqlceca40.dll
| | | | sqlcecompact40.dll
| | | | sqlceer40EN.dll
| | | | sqlceme40.dll
| | | | sqlceqp40.dll
| | | | sqlcese40.dll
| | | |
| | | \---Microsoft.VC90.CRT
| | | Microsoft.VC90.CRT.manifest
| | | msvcr90.dll
| | | README_ENU.txt
| | |
| | \---amd64
| | | sqlceca40.dll
| | | sqlcecompact40.dll
| | | sqlceer40EN.dll
| | | sqlceme40.dll
| | | sqlceqp40.dll
| | | sqlcese40.dll
| | |
| | \---Microsoft.VC90.CRT
| | Microsoft.VC90.CRT.manifest
| | msvcr90.dll
| | README_ENU.txt
| |
| \---obj
| \---x86
| \---Debug
| | DesignTimeResolveAssemblyReferencesInput.cache
| | LibraryManager.csproj.FileListAbsolute.txt
| | DesignTimeResolveAssemblyReferences.cache
| | LibraryManager.csprojResolveAssemblyReference.cache
| | Cybotech.Properties.Resources.resources
| | Cybotech.View.BookForm.resources
| | Cybotech.View.BookIssueForm.resources
| | Cybotech.View.BookListForm.resources
| | Cybotech.View.CourseForm.resources
| | Cybotech.View.FacultyAddForm.resources
| | Cybotech.View.InputForm.resources
| | Cybotech.View.LoginForm.resources
| | Cybotech.View.MainForm.resources
| | Cybotech.View.StudentAddForm.resources
| | LibraryManager.csproj.GenerateResource.Cache
| | LibraryManager.pdb
| | LibraryManager.exe
| |
| \---TempPE
| Properties.Resources.Designer.cs.dll
|
+---LibraryTest
| | App.config
| | LibraryTest.csproj
| | LibraryTester.cs
| | packages.config
| |
| +---Properties
| | AssemblyInfo.cs
| |
| +---bin
| | \---Debug
| | CybotechDomain.dll
| | EntityFramework.dll
| | LibraryData.dll
| | CybotechDomain.pdb
| | LibraryData.pdb
| | EntityFramework.xml
| | LibraryTest.dll.config
| | LibraryTest.dll
| | LibraryTest.pdb
| |
| \---obj
| \---Debug
| | DesignTimeResolveAssemblyReferencesInput.cache
| | LibraryTest.csprojResolveAssemblyReference.cache
| | LibraryTest.pdb
| | LibraryTest.dll
| | LibraryTest.csproj.FileListAbsolute.txt
| |
| \---TempPE
+---packages
| | repositories.config
| |
| +---EntityFramework.4.3.1
| | | EntityFramework.4.3.1.nuspec
| | | EntityFramework.4.3.1.nupkg
| | |
| | +---Content
| | | App.config.transform
| | | Web.config.transform
| | |
| | +---lib
| | | \---net40
| | | EntityFramework.dll
| | | EntityFramework.xml
| | |
| | \---tools
| | EF4.3on.NET4.5Readme.txt
| | EntityFramework.PowerShell.dll
| | EntityFramework.psd1
| | EntityFramework.psm1
| | init.ps1
| | install.ps1
| | migrate.exe
| |
| +---Ninject.3.0.1.10
| | | Ninject.3.0.1.10.nuspec
| | | Ninject.3.0.1.10.nupkg
| | |
| | \---lib
| | +---net35
| | | Ninject.dll
| | | Ninject.pdb
| | | Ninject.xml
| | |
| | +---net40
| | | Ninject.dll
| | | Ninject.pdb
| | | Ninject.xml
| | |
| | +---net45-full
| | | Ninject.dll
| | | Ninject.pdb
| | | Ninject.xml
| | |
| | +---sl2
| | | Ninject.dll
| | | Ninject.pdb
| | | Ninject.xml
| | |
| | +---sl3-wp
| | | Ninject.dll
| | | Ninject.pdb
| | | Ninject.xml
| | |
| | +---sl3
| | | Ninject.dll
| | | Ninject.pdb
| | | Ninject.xml
| | |
| | +---sl4-windowsphone71
| | | Ninject.dll
| | | Ninject.pdb
| | | Ninject.xml
| | |
| | +---sl4
| | | Ninject.dll
| | | Ninject.pdb
| | | Ninject.xml
| | |
| | \---sl5
| | Ninject.dll
| | Ninject.pdb
| | Ninject.xml
| |
| +---Microsoft.SqlServer.Compact.4.0.8876.1
| | | SQLCE_EULA_ENU.rtf
| | | Microsoft.SqlServer.Compact.4.0.8876.1.nuspec
| | | Microsoft.SqlServer.Compact.4.0.8876.1.nupkg
| | |
| | +---Content
| | | web.config.transform
| | |
| | +---lib
| | | \---net40
| | | System.Data.SqlServerCe.dll
| | |
| | +---NativeBinaries
| | | +---amd64
| | | | | sqlceca40.dll
| | | | | sqlcecompact40.dll
| | | | | sqlceer40EN.dll
| | | | | sqlceme40.dll
| | | | | sqlceqp40.dll
| | | | | sqlcese40.dll
| | | | |
| | | | \---Microsoft.VC90.CRT
| | | | Microsoft.VC90.CRT.manifest
| | | | msvcr90.dll
| | | | README_ENU.txt
| | | |
| | | \---x86
| | | | sqlceca40.dll
| | | | sqlcecompact40.dll
| | | | sqlceer40EN.dll
| | | | sqlceme40.dll
| | | | sqlceqp40.dll
| | | | sqlcese40.dll
| | | |
| | | \---Microsoft.VC90.CRT
| | | Microsoft.VC90.CRT.manifest
| | | msvcr90.dll
| | | README_ENU.txt
| | |
| | \---tools
| | Install.ps1
| | Uninstall.ps1
| | VS.psd1
| | VS.psm1
| |
| \---Unofficial.BindingListView.1.2.0.0
| | Unofficial.BindingListView.1.2.0.0.nuspec
| | Unofficial.BindingListView.1.2.0.0.nupkg
| |
| \---lib
| \---net20
| Equin.ApplicationFramework.BindingListView.dll
| Equin.ApplicationFramework.BindingListView.pdb
|
+---.hg
| | 00changelog.i
| | requires
| | hgrc
| | cur-message.txt
| |
| \---store
\---.nuget
NuGet.targets
NuGet.exe
NuGet.Config
.hgignore doesn't affect files that have been added to the repository so the easiest way to do what you want is to ignore the packages folder and manually add the packages\repositories.config file.
Use a look ahead regexp entry in .hgignore
syntax: regexp
^library-management-system/packages/(?!repositories\.config).+$
Does that folder happen to be a NuGet package folder? In that case you can tell NuGet itself to ignore that folder, except for the config file: http://docs.nuget.org/docs/workflows/using-nuget-without-committing-packages
Of course this only applies if you are using your version control system integrated into Visual Studio.

itextsharp Generate a three column by two row table on a page

Wanting it to look something like this. I am then planning to put barcodes in each of the tables. Any help is appreciated.
_________ ________ ______
| | | | | |
| | | | | |
| | | | | |
| | | | | |
--------- -------- --------
_________ ________ ______
| | | | | |
| | | | | |
| | | | | |
| | | | | |
--------- -------- --------
Hope the following code helpful...
Document document = new Document(rect, marginLeft, marginRight, marginTop, marginBottom);
int tableColumns = 3;
Table aTable = new Table(tableColumns);
int row = 1;
int col = 0;
foreach (Barcode s in codeslist)
{
// Create new barcode
Image imageCode128 = GetImageCode128(s);
// Create a new cell to host the barcode image
Cell cell = new Cell();
cell.Add(imageCode128);
aTable.AddCell(cell,row,col);
if (col == tableColumns-1)
{
col = 0;
row ++;
}
else col++;
}
// Add the completed table to the Document and close it.
document.Add(aTable);
document.Close();

Categories