Search Results

Search found 39 results on 2 pages for 'swapnil narendra'.

Page 2/2 | < Previous Page | 1 2 

  • Spree customize/extend user roles and permissions

    - by swapnil
    I am trying to specify some custom roles in Spree for example role 'client' and extend the permissions to access the admin section for this role. This user will be able to access only those Product created by that user. Concept is letting a user with role 'client' manage only products and other certain Models. To start with I added CanCan plugin and defined a RoleAbility Class in role_ability.rb Just following this post : Spree Custom Roles Permissions class RoleAbility include CanCan::Ability def initialize(user) user ||= User.new if user.has_role? 'admin' can :manage, :all elsif user.has_role? 'client_admin' can :read, Product can :admin, Product end end end Added this to an initializer : config/initializers/spree.rb Ability.register_ability(RetailerAbility) Also extended admin_products_controller_decorator.rb :app/controllersadmin_products_controller_decorator.rb Admin::ProductsController.class_eval do def authorize_admin authorize! :admin, Product authorize! params[:action].to_sym, Product end end But I am getting flash message 'Authorisation Failure' Trying to find some luck, I referred following links A github gist for Customizing Spree Roles : https://gist.github.com/1277326 Here's a similar issue what I am facing : http://groups.google.com/group/spree-user/browse_thread/thread/1e819e10410d03c5/23b269e09c7ed47e All efforts in vain... Any pointers of what is going on here highly appreciated ? Thanks in advance.

    Read the article

  • Is it possible to use dex2jar converted jar file into your project

    - by swapnil adsure
    i want to use ffmpeg decoder for my android project but i am having lots of error and config problem to compile it. but today i read about apk recompiling by dex2jar. so My question is " it is possible to use that dex2jar.jar file into your project ?. Like is it possible for me to use ffmpeg decoder into my project by importing that jar file into my project?. and same case with vitamio plugin . so if it is possible than i just need to add that plugin jar into my project and link with code and user dont need to download extra plugin. waiting for reply thank you

    Read the article

  • iPod library song path access

    - by Narendra Kumar
    I studied a lot but did not find any good answer. My problem is i am calculating beats per minute of song.I used Bass api for that, now problem is i am able to get bpm of a file which i have in my resource folder but i have to get bpm of all songs of iPod library. I am getting path of song from MPMediaItemPropertyAssetURL property of MpMediaItem but when passing this one in api api is saying stream cant load BASS_StreamCreateFile(). In my point of view i am not getting right path of song. How can we access valid path? Did any one access ipod library song with external api? Please help me . Thanks CODE IS THIS NSURL *assetURL = [song valueForProperty:MPMediaItemPropertyAssetURL]; NSString *respath = [NSString stringWithFormat:@"%@",[assetURL absoluteString]]; BASS_SetConfig(BASS_CONFIG_IOS_MIXAUDIO, 0); // Disable mixing. To be called before BASS_Init. if (HIWORD(BASS_GetVersion()) != BASSVERSION) { NSLog(@"An incorrect version of BASS was loaded"); } // Initialize default device. if (!BASS_Init(-1, 44100, 0, NULL, NULL)) { //textView.text = [NSString stringWithFormat:@"%@ CAN'T Load Stream",textView.text]; } DWORD chan1; if(!(chan1=BASS_StreamCreateFile(FALSE, [respath UTF8String], 0, 0, BASS_SAMPLE_LOOP))) { NSLog(@"Can't load stream!"); textView.text = [NSString stringWithFormat:@"%@ not loading...",textView.text]; } mainStream=BASS_StreamCreateFile(FALSE, [respath cStringUsingEncoding:NSUTF8StringEncoding], 0, 0, BASS_SAMPLE_FLOAT|BASS_STREAM_PRESCAN|BASS_STREAM_DECODE); float playBackDuration=BASS_ChannelBytes2Seconds(mainStream, BASS_ChannelGetLength(mainStream, BASS_POS_BYTE)); NSLog(@"Play back duration is %f",playBackDuration); HSTREAM bpmStream=BASS_StreamCreateFile(FALSE, [respath UTF8String], 0, 0, BASS_STREAM_PRESCAN|BASS_SAMPLE_FLOAT|BASS_STREAM_DECODE); //BASS_ChannelPlay(bpmStream,FALSE); BpmValue= BASS_FX_BPM_DecodeGet(bpmStream,0.0, playBackDuration, MAKELONG(45,256), BASS_FX_BPM_MULT2| BASS_FX_BPM_MULT2 | BASS_FX_FREESOURCE, (BPMPROCESSPROC*)proc); textView.text = [NSString stringWithFormat:@"%@ %f",textView.text,BpmValue];

    Read the article

  • How to increase SOAP ENVELOPE size in android?

    - by Narendra
    In my project I am calling a web-service which giving response back as thousands of records from SQL server but as default size of SOAP ENVELOPE is 64KB I am getting only first 15 records in my logcat...Will please somebody tell me to increase my SOAP ENVELOPE size to 10 MB so that I can fetch all the results....I have searched over internet but didn't get any answer regarding this, my code is as below... SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.setOutputSoapObject(request); envelope.dotNet = true;

    Read the article

  • ClassCastException in webclient

    - by narendra
    I am using web client for getting page source. First time i am getting page source. After i use the same object for getting page source for different URL it's showing an Exception like: java.lang.ClassCastException: com.gargoylesoftware.htmlunit.UnexpectedPage cannot be cast to com.gargoylesoftware.htmlunit.html.HtmlPage This is the code which i am using. HtmlPage firstPage = webClient.getPage("firsturl"); HtmlPage downloadPage = null; try { webClient.setJavaScriptEnabled(true); downloadPage = (HtmlPage) webClient.getPage("secondurl"); } catch (Exception e) { e.printStackTrace(); } Thx in advance

    Read the article

  • Creating a Dynamic Image using Friends pictures

    - by Narendra Rajput
    I am working on a Facebook for which I need to get all the Profile Pictures of Friends of the users. Which I did using FQL query. I need these images for creating a poster of all the Friends Profile pics along tags in them. For that I need to create a Dynamic poster for every user with their Friends tagged in them. I tried using the GD Library for PHP. I tried with the imagecreatefromjpeg() function of php for which I can use one image and pass it to the main image. But here I have more than 1 images (average about 100 images) depending on the number of friends the user has. What function do I need to create this dynamic poster ? Please any help would be appreciated !!

    Read the article

  • how to create a particle system on iphone and retain the created particles?

    - by lukya
    Hi all, I need to create a particle system and retain the created particles. I need to shake / move the created particles with the iphone accelerometer. Also, the number of particles needs to be very high (I need to show sand!). I do not have any OpenGLES programming experience. After initial search, I found Cocos2D can be used for particle generation. But there is no way of retaining the particles in the CCParticle system. As a work around, I tried creating many sprites at the end of particle generation and shown them as particles. But moving few number of sprites with accelerometer drops the frame rate considerably. Please suggest how this can be achieved and whether I should look for some other framework or if some kind of similar demo code is available. Thanks, Swapnil

    Read the article

  • Convert my aspx page to png image

    - by Izabela
    I am generating an aspx page which then I need to convert to png and store it somewhere. A similiar situation with mine was asked before here but got still no response. I tried also the code that the Swapnil Fegade has asked but the code is looping continually making request to loading page and no conversion is actually being done. I found some solutions on the web also but they require WebBrowser control which i understood can be used in windows form but i am building a web project. Can you give me any hint or suggest any article that shows a full example doing this task. Thank you guys in advance.

    Read the article

  • Using iphone accelerometer AND UIEventSubtypeMotionShake event simultaneousluy.

    - by lukya
    Hi, I am using accelerometer to move/change things on the screen in my app. I also need to detect UIEventSubtypeMotionShake in the view controller for some other animations. As my app is a simple view based app, there is just one view controller which acts as UIAccelerometerDelegate AND FirstResponder (for detecting the shake event). After the first Shake gesture is detected, I don’t need accelerometer inputs through [accelerometer didAccelerate] method so I set the accelerometer delegate to nil. -(void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { if (motion == UIEventSubtypeMotionShake) { NSLog(@"shake"); [[UIAccelerometer sharedAccelerometer] setDelegate:nil]; //my shake handling code } } The problem is that the first shake motion is not being detected correctly. I have to shake 2 3 or more times to trigger the UIEventSubtypeMotionShake event, while the subsequent shakes, after the accelerometer delegate is made nil, are being detected perfectly. This must be happening because UIEventSubtypeMotionShake in turn depends on the accelerometer didAccelerate events which are being overridden by my code. But I need to use both the events. Are there any apps or code samples which use both accelerometer and UIEventSubtypeMotionShake simultaneously? Thanks Swapnil

    Read the article

  • working with large sprite sheets on iphone

    - by lukya
    Hi All, I am trying to use sprite sheet animation in my application. The first POC with a small sprite sheet worked fine but as i change the sprite sheet to a bigger one, i get "check_safe_call: could not restore current frame" warning and the application quits. A quick search revealed that this problem meant my app is taking too much memory or the image is too huge in dimension. My image is 4.9 Mb and dimensions are 6720 * 10080 (oops!!). i read that iphone allows maximum 3 Mb image with dimensions up to 1024 * 1024. Also that the sprite sheet image dimensions should be a power of two. So please let me know how i can use a sprite sheet this big. One approach could be to cut the sprite sheet into many smaller sprite sheets and use them one at a time. Please suggest if you know any other/better approach to accommodate bigger sprite sheets and whether the problem with my sprite sheet is size (4.9 Mb) OR dimensions (6720 * 10080). (Just FYI, i am not trying to play a movie so using MP4 file instead is not an option for me. i need to animate the sprite sheet based on accelerometer input and i have been able to achieve that in my POC with smaller sprite sheet.) Thanks, Swapnil

    Read the article

  • UIIMageView, warning: check_safe_call: could not restore current frame

    - by lukya
    Hi, I am changing the image in UIImageView based on accelerometer input. The images are stored in an array. The application runs fine for a while and then crashes. warning: check_safe_call: could not restore current frame I am not using "UIImage ImageNamed" method when populating the array. The total size of all images is around 12 Mb. But individual images are very light (<100 kb) and i am using only one image at a time from the array. Just in case there are any autoreleases, I have allocated a NSAutoreleasePool in view did load and am draining it in the didReceiveMemoryWarning method (which does get called 2, 3 times before the app crashes?). Following is the code that creates images array: //create autorelease pool as we are creating many autoreleased objects NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSMutableArray *finalarr = [[NSMutableArray alloc] initWithCapacity:9]; NSLog(@"start loading"); for(int y = 0; y < 100; y+=10) { NSMutableArray *arr = [[NSMutableArray alloc] initWithCapacity:10]; for(int x = 0; x < 10; x++) { NSString *imageName = [[NSString alloc] initWithFormat:@"0%d",y + x]; UIImage *img = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:imageName ofType:@"png"]]; [arr addObject:img]; [imageName release]; [img release]; } [finalarr addObject:arr]; [arr release]; } NSLog(@"done loading"); // Override point for customization after app launch viewController.imagesArray = finalarr; [finalarr release]; //retain the array of images [viewController.imagesArray retain]; //release the aurtorelease pool to free memory taken up by objects enqued for release [pool release]; As the app runs smoothly for a while, which means array creation is definitely not the problem. After this the following method is called from [accelerometer didAccelerate] -(BOOL)setImageForX:(int)x andY:(int)y { [self.imageView setImage:(UIImage*)[(NSArray*)[self.imagesArray objectAtIndex:y] objectAtIndex:x]]; return TRUE; } So the only code being executed is the "UIImageView setImage". But no objects are being created here. Please let me know if the code seems to have any leaks or i am doing something wrong. Thanks, Swapnil

    Read the article

< Previous Page | 1 2