19/10/2006

Wrongly Configured Platform

Filed under: General, Technology, Programming — Mulyadi @ 3:35 pm

lol… It all boils down to that. An incorrectly configured unix platform, which caused EEM to fail every single day at 5pm. Who would have thought that such a small mistake like this, will actually cause such a massive problem :| After all the code changes to manage and optimised the memory issues of the application, and many developers working round the clock to fight this problem, my team finally found the root of it all. Muahahahahaa…. not before the EEM manager taking heavy fire for not ensuring his team produces quality work though. really pity that guy.

Well after the new code changes last week, EEM was still failing every single day. Pouring over the log file, the problem was still the same. Insufficient memory. Thats the challenge. To find out whats causing these memory problems. DBA issues? Coding inefficiency? Well these does affect the memory problems but eventually it was found out that the server was incorrectly configured. Whoever set up the production server set the application to use only 256mb of memory instead of the 512 mb memory which was specifically allocated to it. hahahaa… upon changing it back to 512mb, everything worked fine :P What a week… lol


end of post

24/3/2006

Paging a Repeater in ASP.Net/C#

Filed under: General, Technology, Programming — Mulyadi @ 12:37 pm

Those who code ASP.Net web pages will probably already know, the DataGrid Server Control has built-in paging features. This means that to implement paging in a DataGrid control, all you need to do is set a couple of the DataGrids properties. This is quite easily done in Visual Studio.Net (vs.net) 2003. Go to the design screen, click on DataGrid and drag it to the page, right click the DataGrid controls and choose property builder. From there, you can easily set the pagination properties. Easy.. Can this be done too, for a DataList or Repeater controls??

Not really. For DataList, the property builder has no pagination options and for Repeater, you don’t even have a property builder. All codes have to be written in the code view. So how do you actually paginate them? Was googling it up and realised that the PagedDataSource Class is actually used to provide the DataGrids paging features and this Class can be used directly to facilitate paging on any type of DataBound control. Awesome… :) Below is how you can do this..

1) Get the data that you want to page through. This can be an array, a DataSet, a DataReader, or any other object that can be assigned to a data Web control’s DataSource property.

2)Create the PagedDataSource instance, and assign the data to page through to the PagedDataSource’s DataSource property.

3) Set the PagedDataSource class’s paging properties, such as setting AllowPaging to True, and setting PageSize (to indicate how many records per page to show).

4) Assign the PagedDataSource instance to the data Web control’s DataSource property and call the data Web control’s DataBind() method and Voila! Instant pagination support for a Repeater. Its not too hard to understand.


// initialise all the page variables
int curr_page;


// setting the current page and the record to start from
if (Request.QueryString["page"] == null
|| int.Parse(Request.QueryString["page"]) < 1)
{ tcurr_page = 1; }
else
{ curr_page = int.Parse(Request.QueryString["page"]); }


//All your initialisation of the stored procedure goes here


// Setting a new DataAdapter to use the GetBooks
// stored procedures
SqlDataAdapter myAdapter = new SqlDataAdapter(GetBooks);


// Use a DataSet - required for paging in a PagedDataSource
// object and populating it with data from the DataAdapter
DataSet ds = new DataSet();
myAdapter.Fill(ds);


// Populate the PagedDataSource with the DataSet ds
PagedDataSource pds = new PagedDataSource();
pds.DataSource = ds.Tables[0].DefaultView;


// Indicate that the data should be paged
pds.AllowPaging = true;


// Set the number of items you wish to display per page
pds.PageSize = 3;


// Set the PagedDataSource's current page
pds.CurrentPageIndex = curr_page - 1;


// Binding the PagedDataSource to the BookList DataRepeater
BookList.DataSource = objPds;
BookList.DataBind();

Cool thing bout the PagedDataSource Class is that you can make use of the available methods such as PageCount(), IsFirstPage(), IsLastPage() etc…. Makes your life easier rather than to manually calculate if the current page you are in is the last or first or how many records there are in the Repeater :)


end of post

27/12/2004

Exploiting Phpbb using SQL code injection

Filed under: Technology, Programming — Mulyadi @ 10:00 am

Bout a month back, phpbb announced that a very serious flaw exists which could lead to an sql code injection being possible. It was advised that all webmaster, running phpbb forums upgrade it to the latest version which is 2.0.11. Did not realise the seriousness if the exploit until yesterday, when I went around looking for forums to try it on.

With the sql injection, I managed to get the user name and password of several user in different forums. I also managed to get the database connection name and password as well as execute simple unix command such as ls and -la. I was shocked. There still exists many forums which have not upgraded their softwares and with this exploit, it makes it easy for me to deface the site or do anything I want, including deleteing of files, hacking of passwords etc…

Let this be a warning to everyone to quickly update their software fast and as a precaution, do change the passwords to your database connection asap. You would be surprise what I can do with the exploit….


end of post

28/9/2004

Security Flaw in Jpeg File handling

Filed under: Technology, Programming — Mulyadi @ 6:07 pm

A new security flaw in the way Jpeg files are being handled has just been announced bout few days back. This flaw will cause a buffer overrun and allow code execution without the user knowing it. All this by just viewing a picture.

Imagine this scenario…

You get a forwarded email from your friends which contains lots of cute pictures. Thinking its just pictures, and nothing harmful, you continue to view it. While u are viewing the picture, the malicious codes within the picture file proceeds to download a trojan horse from a remote server and then executing it in your computer. All this are done in the background while you view the picture. You close the email and u think, “Hey, I didn’t download any exe files so my computer is still safe” Wrong…. Your computer has already been infected and anybody can now access your computer.

The above scenario is not only limited to just email. You can be viewing a picture from a website, or from a word document, or powerpoint slide etc.. and you’ll still be affected by it.

Cool huh…. I’ve already managed to get the software which allows me to do the above scenario. What the software does is to embedd a small piece of code into the jpeg file which will cause a buffer overrun and execute a file, downloaded from a remote server, locally on your computer. Now all I need right now it to find the source codes to this software so I can start experimenting with it.

Those who need this cool piece of software can email me for it and I’ll be glad to let you have it. If anyone can find the source code to exploit this vulnerability, can u let me know about it.


end of post

10/5/2004

New Sony Camera

Filed under: Technology — Mulyadi @ 2:25 pm

Looks like 2 of the new Sony cameras I was eyeing on just reached Singapore. Was looking around for a camera and read up on the 2 new models and now, its finally reached our shore. Not sure which to get though. Both cameras look good.

P93 :

The new Sony Cybershot P93

What I liked about this camera is that it uses standard AA batteries which is much cheaper than proprietary batteries from Sony. This camera also gives manual apperture and shutter control but limited I guess, compared to a DSLR camera. The 5mp resolution is a big plus compared to my current 3.2mp camera. It also allows 30 fps 640 x 480 movie mode. Price wise is also quite reasonable considering all the features it has.

P100 :

The new Sony Cybershot P100

What I liked about this camera is the Carl Zeis lens that it uses. This is the first Sony Cybershot P series to use a Carl Zeis lens. The camera is also slim and looks aesthetically pleasing. More or less the same features as the p93 model.

So now will have to decide which to get. Get a cheaper but bigger camera or the more expnsive but nicer looking camera. Hmmmm…..


end of post
Older Entries »