Wednesday, June 30, 2010

Zooming and Scrolling in UIScrollView(iphone Application)

Hi,
When i was learning how to use UIScrollview for a controls like image or label. Scrolling is not worked properly so i google for it then i finally found then we need to give contentsize above the scrollview height and width.


Following code gives you image zooming and scrolling.
  1. First create a navigation based application or create a window based application in .h file declare the UIScrollView and UIImageview and add the scrollviewdelegete to zoom the image
#import
@interface ScrollingImage : UIViewController
{
UIScrollView *scrollView;
UIImageView *imageView;
}
@property (nonatomic, retain) UIScrollView *scrollView;
@property (nonatomic, retain) UIImageView *imageView;
@end


    2) In .m file synthesize the scrollView and imageView and in dealloc delegate release them both.


#import "ScrollingImage.h"


@implementation ScrollingImage
@synthesize scrollView, imageView;


- (void)dealloc {
    [super dealloc];
[imageView release]; [scrollView release];
}

//To zoom

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{
return imageView;
}


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Lighthouse.jpg"]]; self.imageView = tempImageView;
tempImageView.frame = CGRectMake(0, 0, 320, 370); scrollView.pagingEnabled = NO; scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0,0,320, 370)];
scrollView.contentSize = CGSizeMake(scrollView.frame.size.width + 150 , scrollView.frame.size.height + 150); scrollView.maximumZoomScale = 10.0; scrollView.minimumZoomScale = 1; scrollView.delegate = self; scrollView.scrollsToTop = NO; scrollView.backgroundColor = [UIColor whiteColor]; scrollView.showsHorizontalScrollIndicator=YES; scrollView.showsVerticalScrollIndicator=YES; [scrollView addSubview:imageView]; [self.view addSubview:scrollView]; [tempImageView release];
}


Now build and go in the simulator to run the application.

Friday, June 18, 2010

jQuery equivalent for document.getElementById("") in javascript

Hi,


When i am trying to write the client validation i used document.getElementById("") to get the value of the control and then validate that and return the result. So, when i move on to jQuery i try to figured out what would be the equivalent code for that i tried


var _Text = $("#controlid").value; //to get the content


but i didn't get the content. So after i browsed in the google and found the $("") ,selector, in jQuery the array so we need to use the array bracket or get method to get the content of the control.


var _Text = $("#controlid")[0].value
or
var _Text = $("#controlid").get(0).value

Sunday, June 13, 2010

Run the database script while running the setup

Hi,

When i am developing a product, i asked myself did i need to run the script after i installed the setup? is there any other way to run the script while i running the setup.

After a long search i found some results but i dont get any complete result for my search so i am post this hope it helps you...

Now i am going to run the script using VBScript.

Open the text editor like notepad

type the following code and save the file with extension .vbs
Dim cn
Set cn = CreateObject("ADODB.Connection")


cn.Open "Provider=SQLOLEDB;Data Source=.\SQLEXPRESS;Initial Catalog=master;Integrated Security=True;Integrated Security=SSPI;"

//This checks is their any database with this name.IF not it create the database.
cn.Execute "if not exists(select * from sys.databases where name = 'databasename') create database databasename"


cn.Execute "Use databasename"

//Then your regular scripts for creating table and stored procedure..


After saved this file add the file to you project.

select the setup and deployment project. Right click on the project from that menu select View--> Custom action



After that add custom action



It display the dialog box 


  • Double click the Application Folder.
  • In that you already added the output of the project,in addition with add the Script.vbs file.
  • Click ok and built the project and now you can run the script before run the setup file.

(Add the prerequisites as SQLexpress edition this will check whether it has sql server database before running the script otherwise you get the error message)

Software Development Cycle

I like it, so i am posting





Software doesn’t just appear on the shelves by magic. That program shrink-wrapped inside the box along with the indecipherable manual and 12-paragraph disclaimer notice actually came to you by way of an elaborate path, through the most rigid quality control on the planet. Here, shared for the first time with the general public, are the inside details of the program development cycle.
1. Programmer produces code he believes is bug-free.
2. Product is tested. 20 bugs are found.
3. Programmer fixes 10 of the bugs and explains to the
testing department that the other 10 aren't really bugs.
4. Testing department finds that five of the fixes didn't
work and discovers 15 new bugs.
5. See 3.
6. See 4.
7. See 5.
8. See 6.
9. See 7.
10. See 8.
11. Due to marketing pressure and an extremely pre-mature
product announcement based on overly-optimistic programming
schedule, the product is released.
12. Users find 137 new bugs.
13. Original programmer, having cashed his royalty check, is
nowhere to be found.
14. Newly-assembled programming team fixes almost all of the
137 bugs, but introduce 456 new ones.
15. Original programmer sends underpaid testing department a
postcard from Fiji. Entire testing department quits.
16. Company is bought in a hostile takeover by competitor using
profits from their latest release, which had 783 bugs.
17. New CEO is brought in by board of directors. He hires programmer
to redo program from scratch.
18. Programmer produces code he believes is bug-free....




Original content is taken form below
http://linkegypt.com/blog/2010/03/27/65/