« July 2005 | Main | September 2005 »
August 31, 2005
Hide methods/properties from IntelliSense
I can't really find a good reason why you would hide methods/properties from IntelliSense. Maybe you want to hide all the internal properties? Anyway I just found out a way to do this, use the EditorBrowsable attribute when defining your property.
However this apparently has a problem with the current Visual Studio .NET C# IDE where even if you set it to Never your property is still being picked up by IntelliSense. This should work fine with the Visual Basic IDE.
Posted by vhadiant at 10:00 PM | Comments (0) | TrackBack
August 30, 2005
Stop solution build when a project build fails
Visual Studio .NET always try to compile every single projects in it even though there's a problem in one of the project. If you are working with a small solution with a few projects that's not too bad, however I'm currently is working with a massive solution that has 45 projects in it. A full build takes over 5 minutes, I usually go nuts when there's a compilation problem and Visual Studio .NET just happily compile the rest of the projects. That really sucks, and I'm not the only one who think that it sucks. Enrico Sabbadin shows how to stop your solution building when there's a project compilation issue.
Just in case the original article disappear, this is the meat of the article. You need to do this in your MyMacros' Environment Events module:
Private Sub BuildEvents_OnBuildProjConfigDone( _
ByVal Project As String, _
ByVal ProjectConfig As String, _
ByVal Platform As String, _
ByVal SolutionConfig As String, _
ByVal Success As Boolean) Handles _
BuildEvents.OnBuildProjConfigDone
If Success = False Then
DTE.ExecuteCommand("Build.Cancel", "")
Dim win As Window = DTE.Windows.Item( _
EnvDTE.Constants.vsWindowKindOutput)
Dim OW As OutputWindow = CType( _
win.Object, OutputWindow)
OW.OutputWindowPanes.Item( _
"Build").OutputString( _
"ERROR IN " & Project & _
" Build Stopped" +
System.Environment.NewLine)
End If
End Sub
Posted by vhadiant at 07:47 AM | Comments (0) | TrackBack
August 29, 2005
MovableType 3.2
Seems that SixApart has finally released MovableType 3.2. However since my last debacle trying to upgrade to 3.2 Beta I'll have to be extra careful trying to upgrade.
Posted by vhadiant at 11:09 AM | Comments (0) | TrackBack
August 18, 2005
Creating DataView
Interesting information about creating DataView (.NET) from MSDN:
Because the index for a DataView is built both when the DataView is created, and when any of the Sort, RowFilter, or RowStateFilter properties are modified, you will achieve best performance by supplying any initial sort order or filtering criteria as constructor arguments when you create the DataView. Creating a DataView without specifying sort or filter criteria and then setting the Sort, RowFilter, or RowStateFilter properties later results in the index being built at least twice: once when the DataView is created, and again when any of the sort or filter properties are modified.
Posted by vhadiant at 08:07 PM | Comments (0) | TrackBack
August 16, 2005
Oracle's cardinality hint
Whenever you are trying to use in memory array in your SQL statement, Oracle's query optimiser seems to get confused in doing its job. You have to help it by giving the cardinality hint, otherwise a full table scan is guaranteed to happen.
For example you have a type
numtable is table of number
And you populate your internal array like this:
select client_id bulk collect into client_ids
from client where client_type = "XXX";
When you're trying to use the array in this query:
select a.client_name, a.address
from client_detail a,
table(cast(client_ids as numtable )) t
where a.client_id = t.column_value
This looks simple, but regardless how you define the index, Oracle will do a full table scan. Don't really know why. To fix this you need to give it a cardinality hint, doesn't have to be precise but at least some rough estimate how many records you think the array will contain. For example:
select /*+ cardinality (t 8) */ a.client_name, a.address
from client_detail a,
table(cast(client_ids as numtable )) t
where a.client_id = t.column_value
That will make the query peforms heaps better.
Posted by vhadiant at 08:52 PM | Comments (0) | TrackBack
August 14, 2005
Static fields in generic classes
Guz Perez pointed out an interesting info about how static fields are going to be implemented in the upcoming C# 2.0
Posted by vhadiant at 10:52 PM | Comments (0) | TrackBack
August 13, 2005
Agent Ransack
Agent Ransack is a much better alternative than the Windows' standard search functionality and it supports regular expression too!
Use this if you don't want to install Google Desktop Search, MSN Desktop Search or enabling Windows Index Server service. It doesn't run in the background, create any indexes or that kind of stuff, kinda a (good) grep alternative for Windows.
Posted by vhadiant at 10:04 AM | Comments (0) | TrackBack
August 12, 2005
Google toolbar spell checker rocks!
Finally a spell check that works in almost all kind of web forms. No longer do I need to copy and paste from MS Word when blogging for spell checking, I can just use Google toolbar new spell check feature to check my blog post. It works beautifully with MovableType's text boxes. The only draw back is that it's a bit slow and even slower in Firefox. Now if only they have basic grammar check as well that will be gold.
Posted by vhadiant at 07:34 AM | Comments (0) | TrackBack
August 11, 2005
Optimistic locking with Oracle 10
New in Oracle 10 is the ORA_ROWSCN pseudo column. This column contains a number which will be automatically incremented upon update.
For example table A
ORA_ROWSCN | ID | DESC
=======================
4300001231 | 10 | Just some desc
4300001231 | 11 | another desc
When you do an update use a simple select statement like this:
update A set DESC = 'New desc' where ID = 10 AND ORA_ROWSCN = 4300001231;
Of course this is assuming that you brought back the ORA_ROWSCN value when you do your select statement. After the update and commit the ORA_ROWSCN value of 4300001231 will be automatically incremented. So how do you know that your update is successful or not? If you are using ADO.NET you should be able to tell how many records are affected and throw an error if it's less than you expected (this is situation it is 1 record), in PL/SQL you check the ROWCOUNT variable like this:
if SQL%ROWCOUNT<=0 then
raise_application_error(-20000, 'Record has been changed by another');
end if;
This way you can do you update safely without locking the row. Oh by default Oracle will not enable rowscn tracking so you have to enable it yourself using the rowdependencies keyword when creating the table, ie:
create table A (...) rowdependencies;
Posted by vhadiant at 10:57 PM | Comments (0) | TrackBack
August 10, 2005
Oracle outer join with multiple fields
I don't know why but I always thought that outer joining with multiple fields are not going to work. So when I had to do one today I decided to give it a test.
Say a simple table
parent
{ p_id number,
account_num varchar2(10),
account_type number
}
and
child
{ c_id number,
account_num varchar2(10),
account_type number
}
and we need to join where both the account_num and account_type is the same if they exist on the child table, if the child record does not exist still include the parent record. The query is simply:
select *
from parent p, child c
where p.account_num = c.account_num(+)
and p.account_type = c.account_type(+)
It's so simple I didn't think it was going to work initially :)
Posted by vhadiant at 11:11 PM | Comments (0) | TrackBack
August 09, 2005
MidpSSH
MidpSSH is a J2ME SSH client. I've downloaded it and install it in my K750i and it works really good. Now I have access to my web server wherever I am :) Not sure if I can do anything useful though, doing anything with the mobile phone keypad is atrocious at best.
One setting that may need to be changed if you ever download this to your mobile phone is to make sure that your Java application connectivity is set to the "Internet" mode not "WAP" mode. For example with my Vodafone settings I have three entries: "VF Live! AU", "VF Internet", and "Vodafone PXT".
For normal WAP browsing I need to set my Internet setting to hse the "VF Life! AU" profile, this is needed for WAP stuff, don't really know why. I thought WAP is a simplified version of HTML and still runs under HTTP, but I must be mistaken.
Now for the MidpSSH I had to set the Java connectivity setting to "VF Internet". That's all. Oh and if you're wondering where do I get all these settings from? Just call Vodafone and they'll SMS you all the settings, you only need to select "Install" when the SMS arrived and it will automatically created for you. Isn't that cool?
Posted by vhadiant at 10:02 PM | Comments (0) | TrackBack
August 04, 2005
Concerning enum and switch statement
So thanks to Peter Hallam to clear up one thing that always bother me but couldn't be bothered to look it up.
Posted by vhadiant at 11:23 PM | Comments (0) | TrackBack
August 01, 2005
Magic Eight J2ME style
I thought creating a simple app will be good for me for learning J2ME, so I created a basic Magic Eight Ball. I always wish that I have a Magic Eight Ball with me in a critical moment, such as should I ask her out question, or should we go to a movie question, or simply should I ask her to marry me question ... you know usual stuff.
Now don't despair you can have a Magic Eight Ball (well not quite a ball really) right there on your pocket/handbag/nearby/or wherever your mobile phone is, when you need it and when you want it (no one would hire me in marketing).
Download it here, unzip, upload to your mobile phone and install. I would have put the jad file on the web to test download J2ME app but I don't have a control on my website so I can't change the content-type of the jad file as a J2ME app, it sucks really.
Posted by vhadiant at 11:45 PM | Comments (0) | TrackBack
Windows Vista
Windows Vista (formerly "Longhorn"). It sounds so corny. Longhorn would have been a better choice, IMHO.
Disclaimer: I'm not good with names and couldn't figure out a name for what had become Sauce Reader.
Posted by vhadiant at 12:20 AM | Comments (0) | TrackBack
