Search Results

Search found 124 results on 5 pages for 'kapil vyas'.

Page 4/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • Checking contents of Uploaded file

    - by kapil
    Hi all, I am using ASP.NEt MVC . I want to upload .zip files for which I am using html input file upload control on my view. I want only .zip files to be uploaded. I want to check that my .zip contains only two files - both having extensions .txt and one of them having name "start". Can anyone please suggest me about how to check this? How can we assure that the uploaded .zip is really a zipped folder and not any other file having just .zip extension. can we use HttpPostedFileBase.ContentType? thanks in advance, kaps

    Read the article

  • psqlODBC won't load after installing MS SQL ODBC driver on RHEL 6

    - by Kapil Vyas
    I had the PostgreSQL drivers working on my RHEL 6. But after I installed Microsoft® SQL Server® ODBC Driver 1.0 for Linux I can no longer connect to PosgreSQL data sources. I can connect to SQL Server data sources fine. When I had this same issue a week ago I uninstalled MS SQL Server ODBC driver from Linux and it fixed the issue. I had to copy the psqlodbcw.so files from another machine to replenish the files. I don't want to do the same this time. I want both drivers to work on Linux. This time around the setup files got deleted: /usr/lib64/libodbcpsqlS.so. Replenishing it did not fix the issue. I kept getting the following error in spite of the file being present with rwx permisions: [root@localhost lib64]# isql -v STUDENT dsname pwd12345 [01000][unixODBC][Driver Manager]Can't open lib '/usr/lib64/psqlodbc.so' : file not found [ISQL]ERROR: Could not SQLConnect [root@localhost lib64]# Here is a printout of the file permissions: [root@localhost lib64]# ls -al p*.so lrwxrwxrwx. 1 root root 12 Dec 7 09:15 psqlodbc.so -> psqlodbcw.so -rwxr-xr-x. 1 root root 519496 Dec 7 09:35 psqlodbcw.so and my odbcinst.ini file looks as follows: [PostgreSQL] Description=ODBC for PostgreSQL Driver=/usr/lib/psqlodbc.so Driver64=/usr/lib64/psqlodbc.so Setup=/usr/lib/libodbcpsqlS.so Setup64=/usr/lib64/libodbcpsqlS.so FileUsage=1 UsageCount=4 I also referred to this link: http://mailman.unixodbc.org/pipermail/unixodbc-support/2010-September.txt

    Read the article

  • Path to background in servlet

    - by kapil chhattani
    //the below line is the element of my HTML form which renders the image sent by the servlet written further below. <img style="margin-left:91px; margin-top:-6px;" class="image" src="http://www.abcd.com/captchaServlet"> I generate a captcha code using the following code in java. public class captchaServlet extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int width = 150; int height = 50; int charsToPrint = 6; String elegibleChars = "ABCDEFGHJKLMPQRSTUVWXYabcdefhjkmnpqrstuvwxy1234567890"; char[] chars = elegibleChars.toCharArray(); StringBuffer finalString = new StringBuffer(); for ( int i = 0; i < charsToPrint; i++ ) { double randomValue = Math.random(); int randomIndex = (int) Math.round(randomValue * (chars.length - 1)); char characterToShow = chars[randomIndex]; finalString.append(characterToShow); } System.out.println(finalString); BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = bufferedImage.createGraphics(); Font font = new Font("Georgia", Font.BOLD, 18); g2d.setFont(font); RenderingHints rh = new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2d.setRenderingHints(rh); GradientPaint gp = new GradientPaint(0, 0, Color.BLUE, 0, height/2, Color.black, true); g2d.setPaint(gp); g2d.fillRect(0, 0, width, height); g2d.setColor(new Color(255, 255, 0)); Random r = new Random(); int index = Math.abs(r.nextInt()) % 5; char[] data=new String(finalString).toCharArray(); String captcha = String.copyValueOf(data); int x = 0; int y = 0; for (int i=0; i<data.length; i++) { x += 10 + (Math.abs(r.nextInt()) % 15); y = 20 + Math.abs(r.nextInt()) % 20; g2d.drawChars(data, i, 1, x, y); } g2d.dispose(); response.setContentType("image/png"); OutputStream os = response.getOutputStream(); ImageIO.write(bufferedImage, "png", os); os.close(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } } But in the above code background is also generated using the setPaint menthod I am guessing. I want the background to be some image from my local machine whoz URL i should be able to mention like URL url=this.getClass().getResource("Desktop/images.jpg"); BufferedImage bufferedImage = ImageIO.read(url); I am just writing the above two lines for making the reader understand better what the issue is. Dont want to use the exact same commands. All I want is the the background of the captcha code generated should be an image of my choice.

    Read the article

  • aapt.exe has stopped working and R.java cannot be resolved after adding Google Play Services library to an existing project

    - by Kapil Kapri
    I'm trying to add new google-play-services_lib in my old project, due to which R.jave file is removed from the project. Also, as soon as i remove google-play-services_lib, i get my R.java file back. minimum sdk version is 11. I'm referring to following link: https://developer.android.com/google/play-services/setup.html I am following these steps to add library as a project == Right-click on My project - Properties In Android-Library section click Add select recently added project - Ok then aapt.exe has stopped working and R.jave file is removed from the project

    Read the article

  • Is jQuery Mobile a lightweight version of original jQuery or jQuery UI?

    - by Jitendra Vyas
    Is jQuery Mobile a lightweight version of original jQuery or jQuery UI? Is it a mobile version of jQuery? Whatever we can do with jQuery all possible with jQuery mobile? Will all jQuery selectors work with jQuery mobile? And if I want to use according like this http://www.mix26.com/demo/accordion/index.htm on latest mobiles. Is it possible to make same effect with "jQuery Mobile" library? or I will have to use desktop version of jQuery? On mobile web development, When we should use jQuery and when jQuery Mobile?

    Read the article

  • how to display image in MFMailComposer?

    - by Rahul Vyas
    Hello all i want to display an image in mfmailcomposer it shows when i add it to attachment but not at the exact place where i want to show it how do i show image in mfmailcomposer. also does someone knows how to launch safari when click on a url in mfmailcomposer?

    Read the article

  • how to add hours in a nsdate?

    - by Rahul Vyas
    i have a date converted to double value and saved in database.now i want to compare if cureentdate myDataBaseDate+8 hours. means i want to get 8 hours more added in my database date. i'm converting date into double values.so how do i get 8 hours later time from my database saved date. how do i compare if(currentDateTimeDateFromdatabaseValue+DateByAdding8HoursInDataBase)

    Read the article

  • why AVAudioplayer doesn't stop/pause when viewWillDisappear?

    - by Rahul Vyas
    I am using avaudioplayer in my app. on viewwilldisappear i want to pause/stop the sound and on viewwill appear i want to play sound again.how do i do this? i'm using this code on viewWillAppear:- if(self.TickPlayer) { [self.TickPlayer play]; } if(self.TickPlayer.volume<0) { self.TickPlayer.volume=1.0; } and this on viewWillDisAppear if(self.TickPlayer) { [self.TickPlayer stop]; } here is the method which plays the sound -(void)PlayTickTickSound:(NSString*)SoundFileName { //Get the filename of the sound file: NSString *path = [NSString stringWithFormat:@"%@%@",[[NSBundle mainBundle] resourcePath],[NSString stringWithFormat:@"/%@",SoundFileName]]; //Get a URL for the sound file NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO]; NSError *error; if(self.TickPlayer==nil) { self.TickPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:filePath error:&error]; // handle errors here. self.TickPlayer.delegate=self; [self.TickPlayer setNumberOfLoops:-1]; // repeat forever [self.TickPlayer play]; } if(self.TickPlayer) { [self.TickPlayer play]; } } and i'm calling it in method which fires every second using a timer in viewDidLoad- self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateCountdown) userInfo:nil repeats:YES]; -(void) updateCountdown { [self PlayTickTickSound:@"tick.caf"]; } i'm also playing a beep sound using avaudioplayer at a specific condition when alert appears.that works fine but this is not working as expected

    Read the article

  • strange MPMoviePlayer problem

    - by Rahul Vyas
    I am using mpmovieplayer in my application.I have a button for playing movie witch has an image of play.But when mpmovieplayer plays movie i can see that button on movie player's overlying controlls like when i pause movie i see my play button instead of movie player's default button.Also i have customized navigation bar and i can see that navbar when movie plays instead of default nav bar.I tried hiding button when playing movie but it didn't worked.Does Someone knows about this issue? also i am having cropping of video issues does someone knows about how to handle video orientation i mean i want full video in any orientation recorded video.Thanks

    Read the article

  • UIImagepickerController strange bug

    - by Rahul Vyas
    Hi, I'm doing something with UIImagePickerController. It works fine and the Picture browser does open, however, I get this message. "Failed to save the videos metadata to the filesystem. Maybe the information did not conform to a plist." What could be causing that? That is caused by this line [self presentModalViewController:self.imgPicker animated:YES]; which is activated on a button click Snippets of the code that I have below. - (void)viewDidLoad { self.imgPicker = [[UIImagePickerController alloc] init]; self.imgPicker.allowsImageEditing = YES; self.imgPicker.delegate = self; } - (IBAction)grabImage { [self presentModalViewController:self.imgPicker animated:YES]; } it's also removing images from documents directory and from resources folder. I can not understand why? does someone found the solution to this?

    Read the article

  • how to run my iphone 2.0 app in iphone os 2.0 and also 3.0 and above os

    - by Rahul Vyas
    i have iphone with os ver. 2.0 i read that for app store all appplication must be run 3.0 os.so how could i make my application to run in both firmware.is there a way i can detect if os ver.3.0 then run different statments alse run statments for lower than 3.0 os.currently i am using this. #if __IPHONE_3_0 cell.textLabel.text=cellValue; [cell.textLabel setFont:[UIFont systemFontOfSize:15.0]]; [cell.textLabel setLineBreakMode:UILineBreakModeTailTruncation]; #else cell.text=cellValue; [cell setFont:[UIFont systemFontOfSize:15.0]]; [cell setLineBreakMode:UILineBreakModeTailTruncation]; #endif will it run on both firmware i want to make my app to be run on =3.0 os and lower than this...please help me how do i check my application for deprecated methods...i can only see this line as deprecated cell.text=cellValue; is there anything to change.i have installed new sdk named iphone_sdk_3.0__leopard__9m2736__final.dmg

    Read the article

  • How to remove NSString Related Memory Leaks?

    - by Rahul Vyas
    in my application this method shows memory leak how do i remove leak? -(void)getOneQuestion:(int)flashcardId categoryID:(int)categoryId { flashCardText = [[NSString alloc] init]; flashCardAnswer=[[NSString alloc] init]; //NSLog(@"%s %d %s", __FILE__, __LINE__, __PRETTY_FUNCTION__, __FUNCTION__); sqlite3 *MyDatabase; sqlite3_stmt *CompiledStatement=nil; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *MyDatabasePath = [documentsDirectory stringByAppendingString:@"/flashCardDatabase.sqlite"]; if(sqlite3_open([MyDatabasePath UTF8String],&MyDatabase) == SQLITE_OK) { sqlite3_prepare_v2(MyDatabase, "select flashCardText,flashCardAnswer,flashCardTotalOption from flashcardquestionInfo where flashCardId=? and categoryId=?", -1, &CompiledStatement, NULL); sqlite3_bind_int(CompiledStatement, 1, flashcardId); sqlite3_bind_int(CompiledStatement, 2, categoryId); while(sqlite3_step(CompiledStatement) == SQLITE_ROW) { self.flashCardText = [NSString stringWithUTF8String:(char *)sqlite3_column_text(CompiledStatement,0)]; self.flashCardAnswer= [NSString stringWithUTF8String:(char *)sqlite3_column_text(CompiledStatement,1)]; flashCardTotalOption=[[NSNumber numberWithInt:sqlite3_column_int(CompiledStatement,2)] intValue]; } sqlite3_reset(CompiledStatement); sqlite3_finalize(CompiledStatement); sqlite3_close(MyDatabase); } } this method also shows leaks.....what's wrong with this method? -(void)getMultipleChoiceAnswer:(int)flashCardId { if(optionsList!=nil) [optionsList removeAllObjects]; else optionsList = [[NSMutableArray alloc] init]; sqlite3 *MyDatabase; sqlite3_stmt *CompiledStatement=nil; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *MyDatabasePath = [documentsDirectory stringByAppendingString:@"/flashCardDatabase.sqlite"]; if(sqlite3_open([MyDatabasePath UTF8String],&MyDatabase) == SQLITE_OK) { sqlite3_prepare_v2(MyDatabase,"select OptionText from flashCardMultipleAnswer where flashCardId=?", -1, &CompiledStatement, NULL); sqlite3_bind_int(CompiledStatement, 1, flashCardId); while(sqlite3_step(CompiledStatement) == SQLITE_ROW) { [optionsList addObject:[NSString stringWithUTF8String:(char *)sqlite3_column_text(CompiledStatement,0)]]; } sqlite3_reset(CompiledStatement); sqlite3_finalize(CompiledStatement); sqlite3_close(MyDatabase); } }

    Read the article

  • is there a way to show Uitableviewcell selection on limited frame?

    - by Rahul Vyas
    i have a uitableview cell added some labels something like this - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; UIImage* myImage = [UIImage imageNamed:@"AccessoryForDealsMain.png"]; UIImageView *MyimageView = [[UIImageView alloc] initWithImage:myImage]; MyimageView.contentMode=UIViewContentModeScaleToFill; cell.accessoryView=MyimageView; [MyimageView release]; UILabel *BluePatti = [[UILabel alloc] init]; BluePatti.frame=CGRectMake(0,0,4,44); BluePatti.backgroundColor = BLUEPATTI;//[UIColor blueColor]; UILabel *BlackLine = [[UILabel alloc] init]; BlackLine.frame=CGRectMake(3,0,1, 45); BlackLine.backgroundColor = BLACK_LINE; [BluePatti addSubview:BlackLine]; [BlackLine release]; [cell.contentView addSubview:BluePatti]; [BluePatti release]; UILabel *Seperator = [[UILabel alloc] initWithFrame:CGRectZero]; Seperator.backgroundColor = [UIColor colorWithRed:234/256.0 green:234/256.0 blue:234/256.0 alpha:1.0]; //[UIColor lightGrayColor]; Seperator.frame = CGRectMake(4,43,316,1); [cell.contentView addSubview:Seperator]; [Seperator release]; } if(indexPath.section==5) { cell.textLabel.text=[self.GenderCellData objectAtIndex:indexPath.row]; cell.textLabel.textColor=CELL_TEXT_COLOR; cell.textLabel.font=CELL_FONT; } else { cell.textLabel.text=@"Cells"; cell.textLabel.font=CELL_FONT; } return cell; } now when i touch cell it shows blue selection above all subviews.How do i change selection frame and colour?

    Read the article

  • getting error when using mapkit in xcode?

    - by Rahul Vyas
    'NSInvalidUnarchiveOperationException', reason: '*** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (MKMapView)' i am getting this error.am i missed something.i don't know from where to add MApkit.framework first i tried with target-getInfo and then from the bottom + sign added framework but that did not wrked.then i search in spotlight and added another framework.by adding this it removed previous error but gives the above one.what is the exact location of mapkit framework. i want to test it in simulator.

    Read the article

  • Play Sound while UIImageView animating crashes the app?

    - by Rahul Vyas
    Hello all, I am having a strange problem in my app. I am creating a app in which i have 9 buttons on the view i want to play sound and animation same time. I am using UIImageview for this but i am having starnge behaviour sometimes sound play early and then animation runs.So how do i play them at same time? I am also having crash on device on a specific animation in which i have 60 jpg files. So what's the best way to do this?

    Read the article

  • strange xcode error Could not compile reconstructed dtrace script:

    - by Rahul Vyas
    Hello all , i am getting this error when i try to compile an iPhone app. error: Could not compile reconstructed dtrace script: provider CorePlot { probe layer_position_change(char *,int,int,int,int); }; #pragma D attributes PRIVATE/PRIVATE/UNKNOWN provider CorePlot provider #pragma D attributes PRIVATE/PRIVATE/UNKNOWN provider CorePlot module #pragma D attributes PRIVATE/PRIVATE/UNKNOWN provider CorePlot function #pragma D attributes PRIVATE/PRIVATE/UNKNOWN provider CorePlot name #pragma D attributes PRIVATE/PRIVATE/UNKNOWN provider CorePlot args ld: error creating dtrace DOF section collect2: ld returned 1 exit status

    Read the article

  • CodeContracts: ccrewrite fails with Object reference not set to an instance of an object

    - by Vyas Bharghava
    The below code makes ccrewrite blow up! Ideas? BTW, If you comment out the ActualClass, ccrewrite succeeds... [ContractClass(typeof(TestContracts))] interface ITestInterface { bool IsStarted { get; set; } void Begin(); } class ActualClass : ITestInterface { public bool IsStarted { get; set; } public void Begin() { this.IsStarted = true; } } [ContractClassFor(typeof(ITestInterface))] class TestContracts : ITestInterface { ITestInterface Current { get; set; } private TestContracts() { Current = this; } #region ITestInterface Members bool ITestInterface.IsStarted { get; set; } void ITestInterface.Begin() { Contract.Requires(!Current.IsStarted); Contract.Ensures(Current.IsStarted); } Thanks in advance!

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >