Search Results

Search found 48 results on 2 pages for 'rohith nair'.

Page 2/2 | < Previous Page | 1 2 

  • Javacript in html - Using single quote inside another single quote

    - by Ashish Nair
    document.getElementById("img").innerHTML="< img src='/sitepath/"+imgg+".jpg' width='72' height='44' onclick='alert('hello');' />"; The above code is my javascript. Problem is printing hello or any other string. If I just type 123 in place of hello, it does give alert. But am not able to use a string like hello there. Normally a string in an alert function is kept inside quotes ' ' but the entire content is inside double quotes and I have already used single quote at the beginning of onclick function. I tried using Escape character ("\") but it didnt help. Any suggestions?

    Read the article

  • Unable to sync custom authentication with RIA services in SL3 + RIA implementation

    - by Nair
    I am developing SL3 + RIA services with custom authentication. I followed the example in http://code.msdn.microsoft.com/RiaServices/Release/ProjectReleases.aspx?ReleaseId=2661 to implement custom authentication. Based on the implementation, you first do login request from client to service. This request is async process. Noe the client GUI will start to bind data to SL controls using RIA services, which requires the authentication to be successful (by adding [RequireAuthentication] attribute). The trouble is, since you requested login from the main process, while it is doing authentication, the page control takes over and starts to bind data using RIA services. But the problem is authentication is not completed yet thus which ever the first service method data binding hits will fail with 'Access denied'. Bottom line is GUI is will not wait for authentication to be completed to start the data binding. My question is how do you handle this situation? Thanks,

    Read the article

  • Integrating CKeditor to my symfony2 project

    - by Jishnu G Nair
    I was trying to integrate ckeditor to my symfony2 project so that some of the textarea will have the ckeditor html editor. I brought the ckeditor on my required textarea by calling the class="ckeditor" in my form. The issue that I am facing now is that when I use the ckeditor the submit button of my form will not work instead I will have to use the built in "Save" option of the ckeditor toolbar for submitting the form. When I remove the ckeditor from the textareas and use normal textarea the submit button seems to work. I do not want to use the "Save" button on the ckeditor toolbar to submit my form. Is there a workaround to make the submit button work? Tried googling out for possible solutions but could not find any. P.S: I would also like to know if there are other html text editors like ckeditor that would work well with symfony2 and link to implementation instructions.

    Read the article

  • Removing stopwords,but should return as a line

    - by Sarath R Nair
    My question may appear silly. But as I am a rookie in Python , help me out. I have to pass a line to a stopword removal function. It works fine. But my problem is return of the function is appending the words. I want it as like follows: line = " I am feeling good , but I cant talk" Let "I,but,cant" are stopwords. After passing to the function , my output should be as "am feeling good , talk". What I a getting now is [['am','feeling','good','talk']]. Help me.

    Read the article

  • Generating PDF document using XSLT

    - by Nair
    I have one huge XML document. I have set of XSL representing each node in the XML. These XSL also have java script to generate the dynamic content. It uses images which are in seperate images folder and it uses fonts as well. At present, I have a program which displays all the nodes that can be transformed and user click on one of the node and the program performs XSLT and display the content in HTML format on IE screen. I want to write a program (.Net , C# or any .Net language) which will allow user to do XSLT tranform on all the available notes and create one PDF document. My initial requirement was to display all the document in the IE itself, so I reused the existing code, and foreach node, perform XSLT and then append it to the current HTML with a page break and it worked ok till we hit huge files. So the requirement changed to create one PDF file with all the nodes. I have couple of questions, 1. What is the best way to create PDF file using XSLT transformation? 2. Since the images are relative path, if we generate the XSLT in html and then write it to a output stream will it loose the images? 3. Will the font be preserved in the PDF document? Really appriciate if someone could point me to some good example that I can take and run with it. Thanks a lot.

    Read the article

  • WCF Runtime Error while using Constructor

    - by Pranesh Nair
    Hi all, I am new to WCF i am using constructor in my WCF service.svc.cs file....It throws this error when i use the constructor The service type provided could not be loaded as a service because it does not have a default (parameter-less) constructor. To fix the problem, add a default constructor to the type, or pass an instance of the type to the host. When i remove the constructor its working fine....But its compulsory that i have to use constructor... This is my code namespace UserAuthentication { [ServiceBehavior(InstanceContextMode=System.ServiceModel.InstanceContextMode.Single)] public class UserAuthentication : UserRepository,IUserAuthentication { private ISqlMapper _mapper; private IRoleRepository _roleRepository; public UserAuthentication(ISqlMapper mapper): base(mapper) { _mapper = mapper; _roleRepository = new RoleRepository(_mapper); } public string EduvisionLogin(EduvisionUser aUser, int SchoolID) { UserRepository sampleCode= new UserRepository(_mapper); sampleCode.Login(aUser); return "Login Success"; } } } can anyone provide ideas or suggestions or sample code hw to resolve this issue...

    Read the article

  • is there difference between debug and release reference path while compiling?

    - by Nair
    I am building a SL3 + RIA application in VS2008. When compiled the application in debug mode it compiles fine with out any error, but when I compile the same application with out any code change in release mode I get an error 'The type of namespace name 'BusyIndicator' does not exist in the namespace 'System.Windows.Controls' (are you missing an assembly reference). All the errors are coming from the generated code name.g.cs Just curious anyone run into this problem.

    Read the article

  • Deploying asp.net application(.Net4.0) package on to IIS 6.0

    - by Vinod.Nair
    Hi , I have created a asp.net application project in Visual Studio 2010 (.net 4.0). I had published it using Project- Build Deployment Package. It generated .zip file along with files having extension " .deply.cmd", ".SetParameters.xml", ".SourceManifest.xml" and readme.txt, in Application (obj\Release\Package) folder My intension is to host the package on test server which has IIS6.0, Windows Server 2003 R2 x64 Edition service pack 2. It has .net 4.0. I tried by running the cmd file but its showed me an message as below: ERROR: The system was unable to find the specified registry key or value. msdeploy.exe is not found on this machine. Please install Web Deploy before execute the script. any help pl....

    Read the article

  • ClickOnce related

    - by Nair
    After publishing a WPF application to a central location using ClickOnce, I am getting following exception when user tries to access the application. There are other applications, which works fine for them and issue is only when they access a particular application. I can't workout why this hence the exception doesn't seems to be very helpful. Problem signature: Problem Event Name: CLR20r3 Problem Signature 01: KG0SYKVDCXEI452K403RIQ4BNPUF3BQA Problem Signature 02: 1.0.0.0 Problem Signature 03: 528094d2 Problem Signature 04: System.Data Problem Signature 05: 4.0.0.0 Problem Signature 06: 4dd23ac7 Problem Signature 07: 24da Problem Signature 08: 2c Problem Signature 09: System.Windows.Markup.XamlParse OS Version: 6.1.7601.2.1.0.256.48 Locale ID: 2057 Additional Information 1: 0a9e Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 Additional Information 3: 0a9e Additional Information 4: 0a9e372d3b4ad19135b953a78882e789 Read our privacy statement online: http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409 If the online privacy statement is not available, please read our privacy statement offline: C:\Windows\system32\en-US\erofflps.txt

    Read the article

  • '/usr/lib/mozilla/plugins/npPluginTest.so' is not an ELF executable for sh

    - by rakesh nair
    I have created NPAPI plugin, which is workig fine on linux where I have created the .so file but when I deployed this plugin on our production device where we have linux environment with limited resources(due to performance constraints) , following error is thrown '/usr/lib/mozilla/plugins/npPluginTest.so' is not an ELF executable for sh FYI:so file created on 32bit linux box. how can I resolve this issue?

    Read the article

  • How to make a cell in a datagrid readonly based the content on another cell in SL4?

    - by Nair
    I have two columns, the second column depends on the content on the first column. By default, the second columns is readonly. When I enter some valid value, I want the second column to become editable. To achive this, I created a cell template and cell edit template on the second column where back ground and read only bound to the first column. On load, the first column is null so my second columns comes correctly as read only. Following is Cell Template for second column, where the background color is set by based on the first column. <DataTemplate> <Grid> <Border Background="{Binding FristColumn,Converter={StaticResource ColorConverter}}"/> <TextBlock Text="{Binding SecondColumn, Converter={StaticResource NumberFormatter}}" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="0"/> </Grid> </DataTemplate> Following is cell edit template for second column to make it editable <DataTemplate> <Grid> <TextBox Text="{Binding SecondColumn, Mode=TwoWay, Converter={StaticResource NumberFormatter}}" Margin="0" HorizontalAlignment="Right" IsReadOnly="{Binding FirstColumn, Converter={StaticResource readOnlyConverter}, ConverterParameter=FirstColumn}" Background="{Binding Depend,Converter={StaticResource ColorConverter}, ConverterParameter=FirstColumn}" /> </Grid> </DataTemplate> With these two in place, when enter the valid value in the first column, I was expecting the second column color to change but it does not. But If I double click on the cell then it behaves properly based on the first cell. Is there some thing I am missing?

    Read the article

  • How to presist the user authentication in SL3 + RIA

    - by Nair
    I am developing SL3 + RIA services with custom authentication. I followed the example in http://code.msdn.microsoft.com/RiaServices/Release/ProjectReleases.aspx?ReleaseId=2661 to implement custom authentication. Based on the implementation, you first do login request from client to service. This request is async process. Since login is async, the control will go back to GUI which then starts to do data bind in SL controls using RIA services, the services happens to requires the authentication to be successful (by adding [RequireAuthentication] attribute). The trouble is, since you requested login might not have completed before the data binding starts t this stage the authentication is false because of that data binding will fail. I would like to know if you require your web services to have 'RequireAuthentication' how would you wait for authentication to complete at the server side or client side. Appriciate the help. Thanks,

    Read the article

  • One value display two columns in data grid

    - by Nair
    I have a XML with 3 values, they are 'name', 'department', 'value'. I want to display a data grid with four columns like Name, department, credit and debit. When I have a value positive in 'value' column I want to enter the value in debit column and 0 in credit column and vice versa.

    Read the article

  • Fiddler2 to debug SL

    - by Nair
    I have a SL3 + Ria service application that I want to trace what is are the calls made between the client and the server. Since I am debugging the application in localhost, I am unable to see any trace in fiddler. I tried http://localhost.:port/websitename/page.aspx and I got "The requested URL could not be retrieved" message. If i remove '.' between localhost and port my page show up but there is no fiddler capture. How would one go about to see/capture all the calls made between the client and service in localhost? Thanks,

    Read the article

  • function file_exists not working in php

    - by Rakesh R Nair
    I have been trying to find if a file_exist in the directory. If not i want to use a different image. But as i am using the file_exists function it always returns false. The code i used is while($r=mysql_fetch_row($res)) { if(!file_exists('http://localhost/dropbox/lib/admin/'.$r[5])) { $file='http://localhost/dropbox/lib/admin/images/noimage.gif'; } else $file='http://localhost/dropbox/lib/admin/'.$r[5];} But the function always return false even if the file exits. I checked that by using <img src="<?php echo 'http://localhost/dropbox/lib/admin/'.$r[5]; ?>" /> This displayed the image correctly. Please Someone Help Me

    Read the article

  • How to make silverlight datagrid editable?

    - by Nair
    I created a simple collection of Person with name, age and sex where all three fields have getters and setters. I bound the collection to the data grid using the itemssource. I can see the data been showed up in the data grid but it does not allow me to edit any of the rows. What do I make so that it becomes editable? Thanks.

    Read the article

  • Finding data file location while using Microsoft Test Framework

    - by Nair
    I have been using NUnit and now I am switching to the Microsoft Unit Test frame work. In my test project I have a folder called TestData and I kept all my test input data files there. I want to use that files for my unit testing. In my test code, I am using Application name space and assembly name space but I can not get to the data folder directly until unless I write a code to find and replace some string to point to the data folder. I am sure someone might have run into the same problem, is the solution to change the path through program or is there a API call which will let us get to executing assembly folders? Thanks,

    Read the article

  • is a streaming server necessary to play iphone streaming video??

    - by user171389
    Hi guys, I am a noob with regards to this. I just wanted to know if a streaming server is necessary to play streaming videos on the iphone. e.g. I have a couple of mp4's hosted on a server. Can i play those files directly using MPMoviePlayerController with the http://xxxx.xx.mp4 url?? Are there any commercial solutions for hosting videos for the iphone? Thanks guys Prasad Nair

    Read the article

  • Java Developer Days India Trip Report

    - by reza_rahman
    You are probably aware of Oracle's decision to discontinue the relatively resource intensive regional JavaOnes in favor of more Java Developer Days, virtual events and deeper involvement with independent conferences. In comparison to the regional JavaOnes, Java Developer Days are smaller, shorter (typically one full day), more focused (mostly Oracle speakers/topics) and more local (targeting cities). For those who have been around the Java ecosystem for a few years, they are basically the current incarnation of the highly popular and developer centric Sun Tech Days. October 21st through October 25th I spoke at Java Developer Days India. This was basically three separate but identical events in the cities of Pune (October 21st), Chennai (October 24th) and Bangalore (October 25th). For those with some familiarity with India, other than Hyderabad these cities are India's IT powerhouses. The events were basically focused on Java EE. I delivered five of the sessions (yes, you read that right), while my friend NetBeans Group Product Manager Ashwin Rao delivered three talks. Jagadish Ramu from the GlassFish team India helped me out in Bangalore by delivering two sessions. It was also a pleasure to introduce my co-contributor to the Cargo Tracker Java EE Blue Prints project Vijay Nair at Bangalore during the opening talk. I thought it was a great dynamic between Ashwin and I flipping between talking about the new features and demoing live code in NetBeans. The following were my sessions (source PDF and abstracts posted as usual on my SlideShare account): JavaEE.Next(): Java EE 7, 8, and Beyond Building Java HTML5/WebSocket Applications with JSR 356 What’s New in Java Message Service 2 JAX-RS 2: New and Noteworthy in the RESTful Web Services API Using NoSQL with JPA, EclipseLink and Java EE The event went well and was packed in all three cities. The Q&A was great and Indian developers were particularly generous with kind words :-). It seemed the event and our presence was appreciated in the truest sense which I must say is a rarity. The events were exhausting but very rewarding at the same time. As hectic as the three city trip was I tried to see at least some of the major sights (mostly at night) since this was my very first time to India. I think the slideshow below is a good representation of the riddle wrapped up in an enigma that is India (and the rest of the Indian sub-continent for that matter): Ironically enough what struck me the most during this trip is the woman pictured below - Shushma. My chauffeur, tour guide and friend for a day, she fluidly navigated the madness that is Mumbai traffic with skills that would make Evel Knievel blush while simultaneously pointing out sights and prompting me to take pictures (Mumbai was my stopover and gateway to/from India). In some ways she is probably the most potent symbol of the new India. When we parted ways I told her she should take solace in the fact she has won mostly without a fight a potentially hazardous battle her sisters across the Arabian sea are still fighting. I'm not sure she entirely understood the significance of what I told her. I hope that she did. I also had occasion to take a pretty cool local bus ride from Chennai to Bangalore instead of yet another boring flight. All in all I really enjoyed the trip to India and hope to return again soon. Jai Hind :-)!

    Read the article

  • Create PDF document using iTextSharp in ASP.Net 4.0 and MemoryMappedFile

    - by sreejukg
    In this article I am going to demonstrate how ASP.Net developers can programmatically create PDF documents using iTextSharp. iTextSharp is a software component, that allows developers to programmatically create or manipulate PDF documents. Also this article discusses the process of creating in-memory file, read/write data from/to the in-memory file utilizing the new feature MemoryMappedFile. I have a database of users, where I need to send a notice to all my users as a PDF document. The sending mail part of it is not covered in this article. The PDF document will contain the company letter head, to make it more official. I have a list of users stored in a database table named “tblusers”. For each user I need to send customized message addressed to them personally. The database structure for the users is give below. id Title Full Name 1 Mr. Sreeju Nair K. G. 2 Dr. Alberto Mathews 3 Prof. Venketachalam Now I am going to generate the pdf document that contains some message to the user, in the following format. Dear <Title> <FullName>, The message for the user. Regards, Administrator Also I have an image, bg.jpg that contains the background for the document generated. I have created .Net 4.0 empty web application project named “iTextSharpSample”. First thing I need to do is to download the iTextSharp dll from the source forge. You can find the url for the download here. http://sourceforge.net/projects/itextsharp/files/ I have extracted the Zip file and added the itextsharp.dll as a reference to my project. Also I have added a web form named default.aspx to my project. After doing all this, the solution explorer have the following view. In the default.aspx page, I inserted one grid view and associated it with a SQL Data source control that bind data from tblusers. I have added a button column in the grid view with text “generate pdf”. The output of the page in the browser is as follows. Now I am going to create a pdf document when the user clicking on the Generate PDF button. As I mentioned before, I am going to work with the file in memory, I am not going to create a file in the disk. I added an event handler for button by specifying onrowcommand event handler. My gridview source looks like <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Width="481px" CellPadding="4" ForeColor="#333333" GridLines="None" onrowcommand="Generate_PDF" > ………………………………………………………………………….. ………………………………………………………………………….. </asp:GridView> In the code behind, I wrote the corresponding event handler. protected void Generate_PDF(object sender, GridViewCommandEventArgs e) { // The button click event handler code. // I am going to explain the code for this section in the remaining part of the article } The Generate_PDF method is straight forward, It get the title, fullname and message to some variables, then create the pdf using these variables. The code for getting data from the grid view is as follows // get the row index stored in the CommandArgument property int index = Convert.ToInt32(e.CommandArgument); // get the GridViewRow where the command is raised GridViewRow selectedRow = ((GridView)e.CommandSource).Rows[index]; string title = selectedRow.Cells[1].Text; string fullname = selectedRow.Cells[2].Text; string msg = @"There are some changes in the company policy, due to this matter you need to submit your latest address to us. Please update your contact details / personnal details by visiting the member area of the website. ................................... "; since I don’t want to save the file in the disk, I am going the new feature introduced in .Net framework 4, called Memory-Mapped Files. Using Memory-Mapped mapped file, you can created non-persisted memory mapped files, that are not associated with a file in a disk. So I am going to create a temporary file in memory, add the pdf content to it, then write it to the output stream. To read more about MemoryMappedFile, read this msdn article http://msdn.microsoft.com/en-us/library/dd997372.aspx The below portion of the code using MemoryMappedFile object to create a test pdf document in memory and perform read/write operation on file. The CreateViewStream() object will give you a stream that can be used to read or write data to/from file. The code is very straight forward and I included comment so that you can understand the code. using (MemoryMappedFile mmf = MemoryMappedFile.CreateNew("test1.pdf", 1000000)) { // Create a new pdf document object using the constructor. The parameters passed are document size, left margin, right margin, top margin and bottom margin. iTextSharp.text.Document d = new iTextSharp.text.Document(PageSize.A4, 72,72,172,72); //get an instance of the memory mapped file to stream object so that user can write to this using (MemoryMappedViewStream stream = mmf.CreateViewStream()) { // associate the document to the stream. PdfWriter.GetInstance(d, stream); /* add an image as bg*/ iTextSharp.text.Image jpg = iTextSharp.text.Image.GetInstance(Server.MapPath("Image/bg.png")); jpg.Alignment = iTextSharp.text.Image.UNDERLYING; jpg.SetAbsolutePosition(0, 0); //this is the size of my background letter head image. the size is in points. this will fit to A4 size document. jpg.ScaleToFit(595, 842); d.Open(); d.Add(jpg); d.Add(new Paragraph(String.Format("Dear {0} {1},", title, fullname))); d.Add(new Paragraph("\n")); d.Add(new Paragraph(msg)); d.Add(new Paragraph("\n")); d.Add(new Paragraph(String.Format("Administrator"))); d.Close(); } //read the file data byte[] b; using (MemoryMappedViewStream stream = mmf.CreateViewStream()) { BinaryReader rdr = new BinaryReader(stream); b = new byte[mmf.CreateViewStream().Length]; rdr.Read(b, 0, (int)mmf.CreateViewStream().Length); } Response.Clear(); Response.ContentType = "Application/pdf"; Response.BinaryWrite(b); Response.End(); } Press ctrl + f5 to run the application. First I got the user list. Click on the generate pdf icon. The created looks as follows. Summary: Creating pdf document using iTextSharp is easy. You will get lot of information while surfing the www. Some useful resources and references are mentioned below http://itextsharp.com/ http://www.mikesdotnetting.com/Article/82/iTextSharp-Adding-Text-with-Chunks-Phrases-and-Paragraphs http://somewebguy.wordpress.com/2009/05/08/itextsharp-simplify-your-html-to-pdf-creation/ Hope you enjoyed the article.

    Read the article

  • How to update the user profile through tokenid when a particular user logs in using his username and password

    - by Rani
    i have an application in which when the user enters his username and password in the login form , his username and password are submitted to the server database for validation and if he is a valid user a tokenid is generated for him through JSON response and he is allowed to log in.this is the JSON response that i get in the console when a valid user log in through the log in form : {"TokenID":"kaenn43otO","isError":false,"ErrorMessage":"","Result":[{"UserId":"164","FirstName":"Indu","LastName":"nair","Email":"[email protected]","ProfileImage":null,"ThumbnailImage":null,"DeviceInfoId":"22"}],"ErrorCode":900} 2011-06-24 11:56:57.639 Journey[5526:207] this is token id:kaenn43otO so when the same user wants to update his profile by clicking on the update tab using the tokenid So that if he want he can his firstname,lastname,password,email.etc.i i have done the following code to update the user profile using tokenid but it does not work.i get tokenid when the user log in and this tokenid i have to pass to other class: this is my code to update user profile: -(void)sendRequest { //this is the class in which i get the tokenid and i am passing it to this class apicontroller *apitest = [[apicontroller alloc]init]; NSString *tokentest = apitest.tokenapi; NSString *post = [NSString stringWithFormat:@"Token=%@&firstname=%@&lastname=%@&Username=%@&Password=%@&Email=%@",tokentest,txtfirstName.text,txtlast.text,txtUserName.text,txtPassword.text,txtEmail.text]; NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]]; NSLog(@"%@",postLength); NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL URLWithString:@"http://192.168.0.1:96/JourneyMapperAPI?RequestType=Register&Command=SET"]]; [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; [request setHTTPBody:postData]; NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; if (theConnection) { webData = [[NSMutableData data] retain]; NSLog(@"%@",webData); [theConnection start]; } else { } } -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { [webData setLength: 0]; } -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [webData appendData:data]; } -(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { [connection release]; [webData release]; } -(void)connectionDidFinishLoading:(NSURLConnection *)connection { NSString *loginStatus = [[NSString alloc] initWithBytes: [webData mutableBytes] length:[webData length] encoding:NSUTF8StringEncoding]; NSLog(@"%@",loginStatus); [loginStatus release]; [connection release]; [webData release]; } -(IBAction)click:(id)sender { [self sendRequest]; } this is my apicontroller.m file in which i am creating login form so that user login and in this page tokenid is generated -(void)sendRequest { UIDevice *device = [UIDevice currentDevice]; NSString *udid = [device uniqueIdentifier]; //NSString *sysname = [device systemName]; NSString *sysver = [device systemVersion]; NSString *model = [device model]; NSLog(@"idis:%@",[device uniqueIdentifier]); NSLog(@"system nameis :%@",[device systemName]); NSLog(@"System version is:%@",[device systemVersion]); NSLog(@"System model is:%@",[device model]); NSLog(@"device orientation is:%d",[device orientation]); NSString *post = [NSString stringWithFormat:@"Loginkey=%@&Password=%@&DeviceCode=%@&Firmware=%@&IMEI=%@",txtUserName.text,txtPassword.text,model,sysver,udid]; NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]]; NSLog(@"%@",postLength); NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL URLWithString:@"http://192.168.0.1:96/JourneyMapperAPI?RequestType=Login"]]; [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; [request setHTTPBody:postData]; NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; if (theConnection) { webData = [[NSMutableData data] retain]; NSLog(@"%@",webData); } else { } } //to select username and password from database. -(void)check { //app.journeyList = [[NSMutableArray alloc]init]; [self createEditableCopyOfDatabaseIfNeeded]; NSString *filePath = [self getWritableDBPath]; sqlite3 *database; if(sqlite3_open([filePath UTF8String], &database) == SQLITE_OK) { const char *sqlStatement = "SELECT Username,Password FROM UserInformation where Username=? and Password=?"; sqlite3_stmt *compiledStatement; if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) { sqlite3_bind_text(compiledStatement, 1, [txtUserName.text UTF8String], -1, SQLITE_TRANSIENT); sqlite3_bind_text(compiledStatement, 2, [txtPassword.text UTF8String], -1, SQLITE_TRANSIENT); //NSString *loginname= [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)]; // NSString *loginPassword = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 2)]; } if(sqlite3_step(compiledStatement) != SQLITE_ROW ) { NSLog( @"Save Error: %s", sqlite3_errmsg(database) ); UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"UIAlertView" message:@"User is not valid" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; alert = nil; } else { isUserValid = YES; if (isUserValid) { UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"UIAlertView" message:@"Valid User" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; } } sqlite3_finalize(compiledStatement); } sqlite3_close(database); } -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { [webData setLength: 0]; } -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [webData appendData:data]; } -(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { [connection release]; [webData release]; } -(void)connectionDidFinishLoading:(NSURLConnection *)connection { NSString *loginStatus = [[NSString alloc] initWithBytes: [webData mutableBytes] length:[webData length] encoding:NSUTF8StringEncoding]; NSLog(@"%@",loginStatus); //this is to perfrom insert opertion on the userinformation table NSString *json_string = [[NSString alloc] initWithData:webData encoding:NSUTF8StringEncoding]; NSDictionary *result = [json_string JSONValue]; //here i am storing the tokenid tokenapi = [result objectForKey:@"TokenID"]; NSLog(@"this is token id:%@",tokenapi); // BOOL errortest = [[result objectForKey:@"isError"] boolValue]; if(errortest == FALSE) { values = [result objectForKey:@"Result"]; NSLog(@"Valid User"); } else { NSLog(@"Invalid User"); } NSMutableArray *results = [[NSMutableArray alloc] init]; for (int index = 0; index<[values count]; index++) { NSMutableDictionary * value = [values objectAtIndex:index]; Result * result = [[Result alloc] init]; //through this i get the userid result.UserID = [value objectForKey:@"UserId"]; result.FirstName = [value objectForKey:@"FirstName"]; result.Username =[value objectForKey:@"Username"]; result.Email =[value objectForKey:@"Email"]; result.ProfileImage =[value objectForKey:@"ProfileImage"]; result.ThumbnailImage =[value objectForKey:@"ThumbnailImage"]; result.DeviceInfoId =[value objectForKey:@"DeviceInfoId"]; NSLog(@"%@",result.UserID); [results addObject:result]; [result release]; } for (int index = 0; index<[results count]; index++) { Result * result = [results objectAtIndex:index]; //save the object variables to database here [self createEditableCopyOfDatabaseIfNeeded]; NSString *filePath = [self getWritableDBPath]; sqlite3 *database; if(sqlite3_open([filePath UTF8String], &database) == SQLITE_OK) { const char *sqlStatement = "insert into UserInformation(UserID,DeviceId,Username,Password,FirstName,Email) VALUES (?,?,?,?,?,?)"; sqlite3_stmt *compiledStatement; if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) { //sqlite3_bind_text( compiledStatement, 1, [journeyid UTF8String],-1,SQLITE_TRANSIENT); sqlite3_bind_text( compiledStatement, 1, [result.UserID UTF8String],-1,SQLITE_TRANSIENT); sqlite3_bind_text(compiledStatement, 2, [result.DeviceInfoId UTF8String],-1,SQLITE_TRANSIENT); sqlite3_bind_text(compiledStatement, 3, [txtUserName.text UTF8String],-1,SQLITE_TRANSIENT); sqlite3_bind_text(compiledStatement, 4, [txtPassword.text UTF8String],-1,SQLITE_TRANSIENT); sqlite3_bind_text (compiledStatement, 5, [result.FirstName UTF8String],-1,SQLITE_TRANSIENT); sqlite3_bind_text (compiledStatement, 6, [result.Email UTF8String],-1,SQLITE_TRANSIENT); } if(sqlite3_step(compiledStatement) != SQLITE_DONE ) { NSLog( @"Save Error: %s", sqlite3_errmsg(database) ); } else { UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"UIAlertView" message:@"Record added" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; alert = nil; } sqlite3_finalize(compiledStatement); } sqlite3_close(database); } [loginStatus release]; [connection release]; [webData release]; } -(IBAction)click:(id)sender { [self sendRequest]; //this is to select username and password from database. [self check]; } for a particular user who logs in only his profile must be update by using tokenid and userid.Please help me in solving this problem.Thanks

    Read the article

< Previous Page | 1 2