Jumat, 13 Juni 2008

another post

woah it's been a long time i don't post on this blog
i've been through some business,
which drawn me to no where.
You can see my other blogs.
on http://geeks.netindonesia.net/blogs/cipto/

Minggu, 09 Maret 2008

Proverty in indo

While every daily needs is increasing now.
especially recently from the Fried oil.. for cooking dunno what you call in english,
touching around 15.000 per kg.
i've heard a dramatic news. that cause it is so unaffordable , there are some poor people who cook with sand. . .
sounds awkward right?
but yes it's true . . .
when it's shown on tv, it can fried but not crispy result.
so what's next?

in indonesia, when it's poor it's very poor, but when the rich is extremely rich.
so there's no balance , i think the national developments should touch to this dilemma

Rabu, 05 Maret 2008

In the Middle of No Where

dear blog. . .
after a series of incident in my job
i think it takes more than just a hard work and intelligent.
so many those little things that make us more wise and success.
i finally got in some trouble and being put in a middle of no where

Hmm.. this is a nice obstacle or Exam in my life
it makes me think what about if some day i've no job or if i'm on business
how about if my business Bankrupt...
or how about if i dedicated in a company and then the company bankrupt.
There's nothing that is eternal in this (Fana) World.

Yet on every point in my life, there's has to be a solving way of any trouble
gee, what a headache that i've got.
despite i pass and revive again, it would be a start over

very sad though. . .

Kamis, 21 Februari 2008

Adding validation and business rule on DataTable

Open Dataset Designer , right click on the DataTable you wanted.
it will create partial class YourDataTableName.
and then on the
Create your Validation Sub
For instance
void CheckWorkTypeID(DirectCostRow directcostrow)
{
if (directcostrow.WorkTypeID == 0 || directcostrow.WorkTypeID == DBNull.Value)
{
directcostrow.SetColumnError("WorkTypeID", "Please Input A WorkTypeID");
}
}

Rabu, 20 Februari 2008

Why My table doesn't appear on Local Data Chace Designer

1.Are not in the user’s default schema.

Note:
To determine which schema is being displayed, inspect the text above the list of tables. The text appears in the following format: Tables on 'DatabaseName.SchemaName'. The SchemaName listed is the current default schema. For information about default schemas, see User-Schema Separation in SQL Server 2005 Books Online.


2.Table Doensn't have a primary key defined.

3.Have names longer than 118 characters.

4.Contain columns with data types that are not supported by SQL Server Compact 3.5.

Handle Data Conflicts and Errors ADO.NET Synchronization

partial class LocalDataCache1ServerSyncProvider
{
protected override void OnChangesSelected(ChangesSelectedEventArgs value)
{
base.OnChangesSelected(value);


}
public override SyncContext GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession)
{
return base.GetChanges(groupMetadata, syncSession);
MessageBox.Show(groupMetadata.BatchCount + " Change");
}
protected override void OnSelectingChanges(SelectingChangesEventArgs value)
{
base.OnSelectingChanges(value);

}
protected override void OnApplyChangeFailed(Microsoft.Synchronization.Data.ApplyChangeFailedEventArgs value)
{
DataTable clientchanges = value.Conflict.ClientChange;
DataTable serverchanges = value.Conflict.ServerChange;
if(value.Conflict.ConflictType==ConflictType.ClientUpdateServerDelete)
{


value.Action = ApplyAction.RetryWithForceWrite;


}
if (value.Conflict.ConflictType == ConflictType.ClientInsertServerInsert)
{
value.Action = ApplyAction.RetryWithForceWrite;
}

if (value.Conflict.ConflictType == ConflictType.ClientUpdateServerUpdate)
{
//Logic goes here.
Form1 a = new Form1();
a.ultraGrid1.DataSource = serverchanges;
a.ultraGrid2.DataSource = clientchanges;
a.ultraStatusBar1.Text = "Data has been changed by other user since your last synchronization";
a.ShowDialog();
value.Action = a.action;
}

if (value.Conflict.ConflictType == ConflictType.ErrorsOccurred)
{
//Logic goes here.
MessageBox.Show(value.Conflict.ErrorMessage, "UnKnown Error Happened:Continuing");

}

}
protected override void OnApplyingChanges(ApplyingChangesEventArgs value)
{
DataSet clientchanges = value.Changes;
}
}

Ado.net Synchronize

Hmmm...
i've try the sync one.
you just add new item localchace and
set where the Server reside.
and it will generate you everything including the client sql server compact.
you just say NameofYourChaceSyncAgent.Synchronize

and add this extracode for your localcache

partial class NameofYourChaceServerSyncProvider
{
protected override void OnApplyChangeFailed(Microsoft.Synchronization.Data.ApplyChangeFailedEventArgs value)
{
DataTable clientchanges = value.Conflict.ClientChange;
DataTable serverchanges = value.Conflict.ServerChange;
value.Action = ApplyAction.RetryWithForceWrite;
}
protected override void OnApplyingChanges(ApplyingChangesEventArgs value)
{
DataSet clientchanges = value.Changes;
}
}

Selasa, 19 Februari 2008

Datarow state

Sync FrameWork

After seeing the video ,
I wish that i can use this kind of products in project

on the video seems to good to be true.

Serialize Dataset Using Binary Formatter and XML

How to Serialize to XMl
MyDataSet.writexml(path,xmlwritemode.ignoreschema)
If you want to keep the original datarow object information for later syncrhonized with database
MyDataSet.writexml(path,xmlwritemode.Diffgram)
DiffGram contains all of the DataRowVersion information as shown in the following XML

How to DeSerialize from XMl
MyDataSet.Readxml(path,xmlreadmode.Ignoreschema);
MyDataSet.Readxml(path,xmlreadmode.Diffgram);

How to Serialize to Binary
FileStream fs=new FileStream(
@"c:\MyDataset.bin",FileMode.Create);
BinaryFormatter fmt= newBinaryFormatter();
fmt.Serialize(fs, MyDataset);
fs.Close();

How to Deserialize from Binary
DataSetvendorData;
FileStream fs=new FileStream(
@"c:\MyDataset.bin", FileMode.Open);
BinaryFormatter fmt= newBinaryFormatter();
MyDataset=(DataSet)fmt.Deserialize(fs);
fs.Close();

Senin, 18 Februari 2008

Binding to Listobject display no data

hmmm. i've encountered this problema .
what ever you bind whether ICOLLECTION, or DATATABLE.
Please do not fill it first then bind.
You bind it first then you fill/add the item
Whoallah it appears
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=137631&SiteID=1

Hey i found another solution
it is because you dont' set the propety
AutoSetDataBoundColumnHeader to TRUE

Ribbon and Custom Task Panes

to add custom task pane. on ThisWorkBook.cs
private void ThisWorkbook_Startup(object sender, System.EventArgs e)
{
this.ActionsPane.Controls.Add(new ActionsPaneControl1());
}
to add custom ribbon RIght click project ->add new item->ribbon visual designer.
Everything you add there will be on the Addins Menu when you F5(run).
You can eliminate any other menu on the sheet/workbook. By setting your custom ribbon property ->Start From Scratch ->TRUE
so there's only your menu showed up.
Whualla .. piece of cake

Minggu, 17 Februari 2008

VSTO

Wew, Vsto can host any control, you can host any control on excel. including infragistics

A song Depicts Jakarta's Road

hmm .. after a series of rain. and none of the roads seems to be fix. i always across many big holes on jakarta's road today.
and this morning i've found a song for it.
it comes from the old mcdonald song.
so here we goes.
"Jakarta has Some Roads"
Iya Iya yooooo
"And in on these road they has Some Holes"
Iya Iya yooooo
"at slipi holes, at menceng holes, at kemang holes"
Iya Iya Yooooo
"Jakarta is a big damn Holes"
Iya Iya Yooooo* upps watch out.... the hole.

Thank You

Kamis, 14 Februari 2008

Towards the End of The World?

Well, Yesterday i saw that MTV commercial. About the Green House effect, 2050 there will be 30 Million people starving, all the big cities will be whelmed by this issue.

And the Glitzer or the ice mountain on the north/south pole will be all melt on 100 years if i'm not hearing it wrong.

Human will be the servant of money. won't care about each other.
I know why.. It's because when we do good deeds , and then we are done browned/deceifed.
so we won't do good deeds anymore, and our heart become a bitter.

if you see the disaster ,etc, will we still be survive in another 100 year?

Rabu, 13 Februari 2008

SPK AbbaLove

Now, this is a pretty awkward(strange) teaching in churches called AbbaLove.
They said "We don't Recognize about Dating, In the Bible said nothing about Dating, there's only Marriage". So many of the cell group community especially girl, dump their sinful boyfriend which have those sin hand :) . So most of them said, "next time if somebody like me, i'd ask him if he's serious with me and jump to marriage".
My girlfriend is in one of their churches. After she said about this, I said " Bloody Hell, What the? are you crazy? People Dating because they want to know each other Character cause you'll be living with that character for the next of your live And a relationship is based on understanding and need more adjustment than you can even think". Relationship will go nothing further with out any effort, even a dog need to take care of, treat right, not to mention HUMAN. her bos which is christian disagree with this too, and most of the guys i think LOL.

I said also "THere's CAN NOT be that BIBLE written about Maria and josef going for a date in somewhere doing this and that??", "or Some Prophets Took His wife for a romantic dinner in some restaurant" Would'nt it?

This is what you called, not mature Mind Set, and social Life.
Which comes from Indonesian perspectives. "Hide those Sex things or Everything refers to it or smell like it undercover, it's taboo"

Senin, 11 Februari 2008

Creating Unit Test with VS 2005 teamsuite

Hey it's easy.
Just Right Click on the method you want to test
Choose Create Test Unit

And wualla the magic is creating new project for testing, and you are just coding on the What params to pass,
and then the Assert.

one thing about Assert is that if the result is false it Throw FAILED.
if true and it keep passing through.
common one:
Assert.EQUAL
ex:Assert.AreEqual(6, actual.Count, "Hey it should return just 6 member");
Assert.isnull
assert.notequal
and etc

Object Binding and Search Support

After i followed the video of how to on vbhowto.
i finally realized that an object can be bind ,what most is search,filter support
here is an example of how to add search support, filtered is next


using System.ComponentModel;
namespace SampleObject
{
public class SearchAbleBindingList : BindingList
{
//first override supportsearching core return true
protected override bool SupportsSearchingCore
{
get
{
return true;
}
}
//second override findcore
protected override int FindCore(PropertyDescriptor prop, object key)
{
for(int i=0;i<=Count-1;i++)
{
T item = this[i];
if (prop.GetValue(item).Equals(key)) return i;
}
return -1;
}
}
}

using System.ComponentModel;
namespace SampleObject
{
public class customer
{
private string _name;
private string _adress;

public string name
{
get { return _name; }
set { _name = value; }
}

public string address
{
get { return _adress; }
set { _adress = value; }
}
private BindingList _orders=new BindingList();

public BindingList orders
{
get { return _orders; }
}

public customer(string _name, string _adress)
{
this._name = _name;
this._adress = _adress;
}
}
public class order
{
private int _id;
private string _productname;
private int _quantity;

public int id
{
get { return _id; }
set { _id = value; }
}

public string productname
{
get { return _productname; }
set { _productname = value; }
}

public int quantity
{
get { return _quantity; }
set { _quantity = value; }
}

public order(int _id, string _productname, int _quantity)
{
this._id = _id;
this._productname = _productname;
this._quantity = _quantity;
}
}
}

Kamis, 07 Februari 2008

UltraPopUpControlContainer

This Control is like Contextmenustrip, the difference this can pop any control. with Point where you want to display

Simple Example
private void ultraPopupControlContainer1_Opening(object sender, CancelEventArgs e)
{
ultraPopupControlContainer1.PopupControl = ultraTree1;
}
private void ultraButton1_Click(object sender, EventArgs e)
{
ultraPopupControlContainer1.Show();
}

Selasa, 05 Februari 2008

Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler Could not be created

Add a reference to Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll

Subclassing a WinDataSource to represent a Business Class

http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=7388

Procedure or function has too many arguments specified.

Check Your Store Procedure,
Your Giving too much parameter, than your store proc does

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