Pages

Thursday, February 24, 2011

Fatal error: Class 'Debugger' not found in when debug level set to 2 in core.php

Just started off with another RAD platform Cake PHP..and faced an issue so decided to share this fresh hard nut of my cake...

As I downloaded the version 2.0.0 of the Cake PHP RAD platform and copied it to my Apache's root...

And then there was a welcome message awaiting for me

Fatal error: Class 'Debugger' not found

I altered the Debugger value in php.ini file to 0 this problem went away..But I wanted the debugger level to be 2 so I started peeping into the websites for a solution and got a one liner

Add this:

App::import('Core', 'Debugger');

in app/config/bootstrap.php

I am still studying so will let you know more on this statement as I get back till now its a mere copy paste

Thursday, February 10, 2011

Items collection must be empty before using ItemsSource.

This error occurs when you try to add Children to a control which already has a item source as a result there is a lot of confusion to the parser regarding which one to choose.

Any children you add to the control are a part of its item collection consider for example

<listview margin="8,9,11,125" name="listView1" itemssource="{Binding}" minwidth="250" minheight="200" columnspan="2" rowspan="2">
<listview.view>
<gridview>
<gridviewcolumn header="ID" displaymemberbinding="{Binding Path=ID}"></gridviewcolumn>
<gridviewcolumn header="Company" displaymemberbinding="{Binding Path=Company}"></gridviewcolumn>
<gridviewcolumn header="Email" displaymemberbinding="{Binding Path=Email}"></gridviewcolumn>
<gridviewcolumn header="Website" displaymemberbinding="{Binding Path=Website}"></gridviewcolumn>
<gridviewcolumn header="Phone" displaymemberbinding="{Binding Path=Phone}"></gridviewcolumn>
<gridviewcolumn header="Address" displaymemberbinding="{Binding Path=Address}"></gridviewcolumn>
<gridviewcolumn header="Field of Development" displaymemberbinding="{Binding Path=Field}"></gridviewcolumn>
<gridviewcolumn header="Notes" displaymemberbinding="{Binding Path=Notes}"></gridviewcolumn>
</gridview>
</listview.view>
<Button Margin="0,0,-326.634,-49.995" Name="buttonReset" HorizontalAlignment="Right" Grid.Row="6" Width="99.99" Height="31.123" VerticalAlignment="Bottom" Click="buttonReset_Click">Reset</Button>
</listview>

Now here I have added a button in the last as a part of Item collection for the list view so it gives me that error

When I remove that code everything works fine.We cannot insert items and set items source at same time.

A Database WPF Application

I started fresh on WPF and decided to build an app which required storage of some kind of database.To my amaze it was a bit different than my other applications on Windows Forms.

Although the ADO .Net connectivity part was almost same there was much changes in the XML part.

Let me brief you regarding my design a bit

I have used a List view which holds a Grid View which holds my data in turn.The Grid view is a part of view property of my List view.Lets see how

<listview margin="8,9,11,125" name="listView1" itemssource="{Binding}" minwidth="250" minheight="200" columnspan="2" rowspan="2">
<listview.view>
<gridview>
<gridviewcolumn header="ID" displaymemberbinding="{Binding Path=ID}"></gridviewcolumn>
<gridviewcolumn header="Company" displaymemberbinding="{Binding Path=Company}"></gridviewcolumn>
<gridviewcolumn header="Email" displaymemberbinding="{Binding Path=Email}"></gridviewcolumn>
<gridviewcolumn header="Website" displaymemberbinding="{Binding Path=Website}"></gridviewcolumn>
<gridviewcolumn header="Phone" displaymemberbinding="{Binding Path=Phone}"></gridviewcolumn>
<gridviewcolumn header="Address" displaymemberbinding="{Binding Path=Address}"></gridviewcolumn>
<gridviewcolumn header="Field of Development" displaymemberbinding="{Binding Path=Field}"></gridviewcolumn>
<gridviewcolumn header="Notes" displaymemberbinding="{Binding Path=Notes}"></gridviewcolumn>
</gridview>
</listview.view>
</listview>

Now if you see above ItemsSource="{Binding}" is the crux of this binding.It tells that the List view View data come from a binding source.What Happens if I add a control to my listview.I tried it got an error which I will discuss in my next post.

Mean while My code behind file has the following code

SqlConnection con = new SqlConnection(@"Data Source=PC\SQLEXPRESS AttachDbFilename=|DataDirectory|\JAMS.mdf;Integrated Security=True;User Instance=True");
con.Open();
try
{
SqlCommand comm = new SqlCommand("SELECT ID, Company, Email, Website, Phone, Address, Field, Notes FROM JAMS_Companies", con);
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(comm);
da.Fill(dt);
Console.Write("Blah");
Console.Write(dt.Rows[0][0].ToString());
listView1.DataContext = dt.DefaultView;
}
catch (Exception e)
{
Console.Write(e.ToString());
}

As usual dt is bound to the list view.

Now I am trying to add a button to this Window.I will get back as soon as I get Success

Visual Studio 2008,WPF application,Events button(yellow lightning) not visible

A very Small problem but sometimes leads to extra efforts as you can't select between the known events in Solution.

To solve this issue update your VS 2008 with Service Pack1

To download click here

http://www.microsoft.com/downloads/en/details.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E&displaylang=en

Tuesday, February 8, 2011

Use of sn Strong Names

GAC is Global access cache sometimes I also heard it as Global Assembly cache.
GAC is used particularly when a dll or assembly is needed by many programs and that requires some Administrative security rights to work.In this case that dll is placed under "C:/windows/Assamblies/GAC" depending on the type of GAC folder When I dir my "C:/windows/assembley" folder I get following GAC's
  1. GAC
  2. GAC_32
  3. GAC_MSIL
Since GAC stores assemblies common to all problem of DLL HELL can occur which means two different apps with requirement of same dll with different versions may not be able to work simultaneously. Since their requirement is of only1 concerned dll and only 1 version of a dll can be present at a time in GAC.

This problem is solved using sn or Strong Naming where a hash value of dll is taken and is decoded using a private key and a public key is added to the resultant information or to its name.
Thus multiple versions of same dll can be used with different public keys.

This can be seen here in the below figure

Here if you see in the end there is a dir in the end with name 2.0.0.0__b77a5c561934e089 the first part here implies the version and second part implies the public key.
We can also create Strong Names of our own dll's a tool called gc.exe comes with Visual studio for that purpose I will cover the use of that tool in my next post.

Saturday, February 5, 2011

Could not write value to Key in registry during installation in windows server 2003


I am using Windows 2003 server sp2 protected with Mcafee Enterprise edition antivirus recently I faced an issue during installation of programs like Microsoft Office or VS 2008.I thought it had to do with security in windows that is why it is unable to access.But to my amaze I wasn't installing any 3rd party software it was all Microsoft.My doubts raised on my antivirus

I went to the antivirus console and turned off Access protection as shown in the image and it solved my problem

Wednesday, February 2, 2011

Running Joomla and Apache on same machine

I am using Win 7 iis7.Recently I installed Wamp just to try a hand on PHP.But to my amaze when I started off with my localhost It was showing iis7 content.

I figured out the problem that port 80 was configured with IIS so it could not bee allocated to Apache.

You can test this on Wamp by left clicking on Wapm icon in taskbar goto services and test port 80.

And a command window popper up showing that it was in use by Microsoft IIS.So I gave my Apache a first Aid

I just changed the port under the httpd.conf.Here is how I did it

Find a test called "Listen 80" in httpd.conf which is Apache's configuration file and change its value to "Listen 85"

Now your localhost url will be as follows

for Apache

http://localhost:85/

And for IIS

http://localhost or http://localhost:80

Browsers by default listen to port 80.

That's it