Selasa, 29 Januari 2008

Infragistic UltraGrid Data Source Hang

using (WinCEsDataContext context = new WinCEsDataContext())
{

context.Log = Console.Out;
var q = from i in context.TenderResults select i;
ultraGrid1.DisplayLayout.MaxBandDepth = 1;
ultraGrid1.DataSource=q;
}

If you don't set to 1 your application will hang. cause it will try to create new band to all it childs

Infragistic UltraGrid

hmm.. i've just used this grid
and i've test it, that if i drag many objects to DBML
say many relation on each other.
and then when i use linq to give me result and i just simply
bind it to this grid. it hangs.
If just one or two table related to each other than works fine.
It won't hang on ordinary datagridview

Gee what explaination for this

Jumat, 25 Januari 2008

Indonesia Economic Growth

What is wrong?
well, they always says things got better, our growth is 6.3 percent.
next year will be 6.8%
....
And then Boom
everything's expensive,Disaster.
Gee what is wrong with you?
Do you always make a false alarm to your people?
the growth doesn't lift people's life
and you always hide your proverty statistic

Making some Advertisement on TV,
like promoting your bad work?????
Let's save the energy bla bla bla
while you know that the growth of electricity , but you don't grow your electricity plant.
Every of your department going for advertisement but yeah, hell yeah what is new ?
There are so many hole, cause of this Crisis.Other country has go out from crisis, but why can't we? we are dealing with numerous problem in 2008
and how can you answer it?

Indonesia Criticsm

Hmm, i'm Indonesian Chinesse.
What i see from this country. is a lamb ass.
Not foward going person, open minded people for Changes to a better future.
Problems and problems:
Corruption,
Proverty,
Unemployement,
Traffic Jam,
EU banned over Air Flight,
poor Birocracy,
Bad Economic Growth,
Wealthy natural resource but being handled and taken by foreigner,
Not growing farming,
Not growing biofuel,
Not growing Busway,
Now it's the daily needs that rise again,
Soya Beans, Rice, Minyak Tanah,Eggs,Flour=> PEOPLE are dying , don't you have any pitty on them???
SO everything that This Nation Government do is SLEEPPING
taking salary, sit, and go home and do nothing.
It awakes when everything gone bad, and that like some kind of Surprise or Shock like From sleeping and suddenly awake,"What to do , what to do, how to handle this?".
But never see to the future if this problem happens, what should we do from now.
It suck's THERE is just NEVER , NEVER they -> Government of Indonesia that Makes JUST ONE , i mean ONE RIGHT policy which is WORKING and make people life's better.
WHo do you put on the top position/head of your Government Department?????
A sleeping as worker??

UltraToolBarManager,UltraDataSource

Now this is something .
Excel 2007 Like
Very Neat
Ribbon etc....
Coool

HOw to access and change property
1.Sharedprop
2.Instanceprop
can find it just cast down
TextBoxTool tooltmp = (TextBoxTool)ultraToolbarsManager1.Tools["TxtFormula"];
tooltmp.ToolKeyPress += new ToolKeyPressEventHandler(tooltmp_ToolKeyPress);

UltraDatasource How to
------------------------
Ultradatasource1.Setcount(int)=>this fire the ultradatasouce Cell data requested
Bind each of that to Your object Collection property

Kamis, 24 Januari 2008

LinQ Insert, Update

First to Insert just
Create New object of your mapping
ex: class MyuserList
string username;
int age;

MyuserList a=new MyuserList();
a.username="cipto";
a.age="26";

or Dynamicinsert(a);

Mydatacontext tmp=new Mydatacontext();
tmp.insertonsubmit(a);

For Update
-------------------
just get the recod and change the properti and then
submitchanges();=>everything is update to DB

LinQ Example

How To Get End result as List
-------------------------------
public IList GetAllEntity()
{
var r = (from s in Manager.Context.CalculationFormula select s.Code).ToList();
return r;
}
How to Get just One Row Result
----------------------------------
public CalculationFormula GetbyCode(string code)
{
var r = (from s in Manager.Context.CalculationFormula
where s.Code==code
select s).Single();
return r;
}
How to Order the Result
-----------------------
return Entity.GetByJobiD(ID).OrderBy(s=>s.RowIndex).ToList();
How to Lazy loading
----------------------
I assume the meaning is, because on each object we have one to many relation ship you can told linq to hold/postpone the loading of these related data by setting it's differedloading=false;
How to get datatable
----------------------
unfortunately you have to have your datatable as source first, there's no way of returning as datatable, so from datatable source you can Query it again againts it. and return as a new datatalbe result using linq.datasetextension.dll the method name is , .CopyasDatatable() or .CopyasDataView()
HOw to join to several tables, join, etc,
-----------------------------------------
Now linq can get very complex, and hierrachiall(does this spell right?)
but it's your job to find out.

Infragistic UltraGrid

how to Hide Column
-------------------
private void ultraGrid1_InitializeLayout{
foreach (UltraGridColumn oColumn in (sender as UltraGrid ) .DisplayLayout.Bands[0].Columns)
{
switch (oColumn.Key.ToUpper())
{
case "ISFORMULA":
oColumn.Hidden = true;
break;
case "ISTITLE":
oColumn.Hidden = true;
break;
case "ISITEM":
oColumn.Hidden = true;
break;
case "ISSUBTOTAL":
oColumn.Hidden = true;
break;

}
}
}
Setting cell Value
--------------------
ultraGrid1.ActiveRow.Cells[0].SetValue("",false);
How to Focus on a Cell
-------------------------
ultraGrid1.PerformAction(UltraGridAction.EnterEditMode, false, false);
to exit the edit mode
ultraGrid1.PerformAction(UltraGridAction.ExitEditMode, false, false);
Coloring Rows/Cell
-------------------
ultraGrid1.DisplayLayout.Rows[rowindex].CellAppearance.BackColor = Color.Gray;
Cell.Appearance.BackColor = Color.Red;
How to on Enter move to next Cell that has Focus(Text)
-------------------
void NextControlFocus()
{
int index=ultraGrid1.ActiveCell.Column.Index;
ultraGrid1.ActiveRow.Cells[index+1].Activate();
ultraGrid1.PerformAction(UltraGridAction.EnterEditMode, false, false);
}
How to Get the Object that Bind to The grid current Row
-------------------------------------------------------
1.((object)BindingContext[ultraGrid1.DataSource].Current); Or
2.ultraGrid1.ActiveRow.ListObject
How to for a Cell to be a multiline Text and have scrollbar and always prompt when edit mode?
--------------------------------------------------------
On Initialize Layout
ultraGrid1.DisplayLayout.Bands[0].Columns["Description"].CellMultiLine = DefaultableBoolean.True;
ultraGrid1.DisplayLayout.Bands[0].Columns["Description"].VertScrollBar = true;
e.Layout.ScrollStyle = ScrollStyle.Immediate;
How to Process Data from ClipBoard or Ctrl+C
--------------------------------------------
on Key Down.
switch (e.KeyData)
{
case Keys.Control|Keys.V:
this.ProcessData();
On ProcessData
DataObject o = Clipboard.GetDataObject() as DataObject;
if (!o.GetDataPresent("Text")) return; //Make sure we have Clipboard text
string theClipboardText = (string)o.GetData("Text", true);
How to Resize?
---------------
1.ultraGrid1.Rows.Band.Columns[1].PerformAutoResize();
2.AutoFitStyle
How to Validate Each Cell in row before leaving?
-------------------------------------------------
OnLast Cell key press refer to
private bool ValidateAllCellinRow()
{
CellsCollection allcell = ultraGrid1.ActiveRow.Cells;
foreach (UltraGridCell tmp in allcell)
{
if (tmp.Text == "" )
{
MessageBox.Show(tmp.Column.Key + " May not be empty");
ultraGrid1.ActiveRow.Cells[tmp.Column.Key].Activate();
ultraGrid1.PerformAction(UltraGridAction.EnterEditMode, false, false);
return false;
}
}
return true;
}
how to delete silently
--------------------------
ultraGrid1.ActiveRow.Delete(false);

Linq to SQL

well it's my first post on linq to SQL.
after several days using it.
Hmmm
i found it quite intersesting
By default
it generate's everything(table,storeproc) that u click drag to the dbml
including store procedure(will be come a method in our vs)..

Hmmm.. i'm trying to bind ienumerable to infragistic grid, and it's a mess...
some table display valid some hang out. guess the datatable is the solution for binding or Customized through ultra data source

u can combine with extension or, just add your additional method to your object.
by default linq is optimistic concurrency.
meaning that if on multi user environment,when a user trying to update or delete a row which has been changed by other user it throws exception.

Using transaction in linq to sql :
http://blogs.msdn.com/wriju/archive/2007/08/06/linq-to-sql-using-transaction.aspx

Expression Math In String to Double

is there a time in your programming life when you meet such as changing
your math expression string x="3,14*(5^2)+(10^2)" like that or etc.
than what you need is an engine expression parser

May be below link can help and make life easier.
:)

http://www.c-sharpcorner.com/uploadfile/patricklundin/mathexpparser12062005062213am/mathexpparser.aspx

Selasa, 22 Januari 2008

The class name '?' is not a valid identifier for this language

This error can happen to the form designer
just close the visual studio 2008 and open it again
it will vanish
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=248764

Senin, 14 Januari 2008

Codesmith.Data , Rules, Rules.validation And

if you are using plinq the latest one
and could not compile the codesmith.data Because
changedObjects.AddedEntities
changedObjects.ModifiedEntities
changedObjects.RemovedEntities

Change to
changedObjects.Inserts
changedObjects.Updates
changedObjects.Deletes

Respectively.
And it should run now
add reference to the misssing Codesmith.data it includes all to the rules etc.

and also notice to change the DBML generated by codesmith, change the Encoding to utf-8 instead of utd-16

HOpe this help who are needed