Search Results

Search found 6941 results on 278 pages for 'drupal views'.

Page 27/278 | < Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >

  • Rails: show some examples of code from controllers, models and views

    - by Totty
    Hy, my controller example: class FriendsController < ApplicationController before_filter :authorize, :except => [:friends] ############## ############## ## REQUESTS ## ############## ############## ################## # GET MY FRIENDS # ################## # Get my friends. def friends @friends = @my_profile.friends.paginate({:page => params[:page], :per_page => 3}) @profile = @my_profile end ################### # REMOVED FRIENDS # ################### # Get my deleted friends. def removed_friends @removed_friends = @my_profile.friends('removed_friends', params[:page]) end ################### # PENDING FRIENDS # ################### # Friend requests made by other profiles to me. def pending_friends @pending_friends = @my_profile.friends('pending_friends', params[:page]) end ############################ # REJECTED PENDING FRIENDS # ############################ # Rejected friend requests made by other profiles to me. def rejected_pending_friends @rejected_pending_friends = @my_profile.friends('rejected_pending_friends', params[:page]) end ##################### # REQUESTED FRIENDS # ##################### # The friend requests I've sent to others profiles. def requested_friends @requested_friends = @my_profile.friends('requested_friends', params[:page]) end ############################# # DELETED REQUESTED FRIENDS # ############################# # The requests I've sent to others # profiles and then canceled. def deleted_requested_friends @deleted_requested_friends = @my_profile.friends('deleted_requested_friends', params[:page]) end ############# ############# ## ACTIONS ## ############# ############# ########################## # ADD FRIENDSHIP REQUEST # ########################## # Add a friendship request. def add_friendship_request friendship = @my_profile.add_friendship_request(params[:profile_id]) render :json => friendship end ############################# # REMOVE FRIENDSHIP REQUEST # ############################# # Removes a friendship request I've done. def remove_friendship_request friendship = @my_profile.remove_friendship_request(params[:profile_id]) render :json => friendship end ###################### # PROCESS FRIENDSHIP # ###################### # Process friendship: accept or reject a friend. # This will make a new friend or # will make a new rejected pending friend. def process_friendship friendship = @my_profile.process_friendship(params[:profile_id].to_i, params[:accepted].to_i) render :json => friendship end ################### # REMOVE A FRIEND # ################### # Remove a friend from my friends by id. def remove_friend friendship = @my_profile.remove_friend(params[:profile_id]) render :json => friendship end end

    Read the article

  • Advice on optimzing speed for a Stored Procedure that uses Views

    - by Belliez
    Based on a previous question and with a lot of help from Damir Sudarevic (thanks) I have the following sql code which works great but is very slow. Can anyone suggest how I can speed this up and optimise for speed. I am now using SQL Server Express 2008 (not 2005 as per my original question). What this code does is retrieves parameters and their associated values from several tables and rotates the table in a form that can be easily compared. Its great for one of two rows of data but now I am testing with 100 rows and to run GetJobParameters takes over 7 minutes to complete? Any advice is gratefully accepted, thank you in advanced. /*********************************************************************************************** ** CREATE A VIEW (VIRTUAL TABLE) TO ALLOW EASIER RETREIVAL OF PARMETERS ************************************************************************************************/ CREATE VIEW dbo.vParameters AS SELECT m.MachineID AS [Machine ID] ,j.JobID AS [Job ID] ,p.ParamID AS [Param ID] ,t.ParamTypeID AS [Param Type ID] ,m.Name AS [Machine Name] ,j.Name AS [Job Name] ,t.Name AS [Param Type Name] ,t.JobDataType AS [Job DataType] ,x.Value AS [Measurement Value] ,x.Unit AS [Unit] ,y.Value AS [JobDataType] FROM dbo.Machines AS m JOIN dbo.JobFiles AS j ON j.MachineID = m.MachineID JOIN dbo.JobParams AS p ON p.JobFileID = j.JobID JOIN dbo.JobParamType AS t ON t.ParamTypeID = p.ParamTypeID LEFT JOIN dbo.JobMeasurement AS x ON x.ParamID = p.ParamID LEFT JOIN dbo.JobTrait AS y ON y.ParamID = p.ParamID GO -- Step 2 CREATE VIEW dbo.vJobValues AS SELECT [Job Name] ,[Param Type Name] ,COALESCE(cast([Measurement Value] AS varchar(50)), [JobDataType]) AS [Val] FROM dbo.vParameters GO /*********************************************************************************************** ** GET JOB PARMETERS FROM THE VIEW JUST CREATED ************************************************************************************************/ CREATE PROCEDURE GetJobParameters AS -- Step 3 DECLARE @Params TABLE ( id int IDENTITY (1,1) ,ParamName varchar(50) ); INSERT INTO @Params (ParamName) SELECT DISTINCT [Name] FROM dbo.JobParamType -- Step 4 DECLARE @qw TABLE( id int IDENTITY (1,1) , txt nchar(300) ) INSERT INTO @qw (txt) SELECT 'SELECT' UNION SELECT '[Job Name]' ; INSERT INTO @qw (txt) SELECT ',MAX(CASE [Param Type Name] WHEN ''' + ParamName + ''' THEN Val ELSE NULL END) AS [' + ParamName + ']' FROM @Params ORDER BY id; INSERT INTO @qw (txt) SELECT 'FROM dbo.vJobValues' UNION SELECT 'GROUP BY [Job Name]' UNION SELECT 'ORDER BY [Job Name]'; -- Step 5 --SELECT txt FROM @qw DECLARE @sql_output VARCHAR (MAX) SET @sql_output = '' -- NULL + '' = NULL, so we need to have a seed SELECT @sql_output = -- string to avoid losing the first line. COALESCE (@sql_output + txt + char (10), '') FROM @qw EXEC (@sql_output) GO

    Read the article

  • Passing Variables between views / view controllers

    - by Dan
    Hi I'm new to ObjectiveC / IPhoneSDK and I'm informally trying to study it on my own. What I'm basically trying to do is from one view there are 12 zodiac signs. When a user clicks one, it proceeds to the second view (with animation) and loads the name of the zodiac sign it clicked in a UILabel, that's it. Here are my codes: Lovescopes = 1st page Horoscopes = 2nd page Lovescopes4AppDelegate.h #import <UIKit/UIKit.h> #import "HoroscopesViewController.h" #import "Lovescopes4AppDelegate.h" @class Lovescopes4ViewController; @interface Lovescopes4AppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; Lovescopes4ViewController *viewController; HoroscopesViewController *horoscopesViewController; } -(void)loadHoroscope; -(void)loadMainPage; @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet Lovescopes4ViewController *viewController; @property (nonatomic, retain) HoroscopesViewController *horoscopesViewController; @end Lovescopes4AppDelegate.m #import "Lovescopes4AppDelegate.h" #import "Lovescopes4ViewController.h" @implementation Lovescopes4AppDelegate @synthesize window; @synthesize viewController; @synthesize horoscopesViewController; -(void)loadHoroscope { HoroscopesViewController *aHoroscopeViewController = [[HoroscopesViewController alloc] initWithNibName:@"HoroscopesViewController" bundle:nil]; [self setHoroscopesViewController:aHoroscopeViewController]; [aHoroscopeViewController release]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:window cache:YES]; [viewController.view removeFromSuperview]; [self.window addSubview:[horoscopesViewController view]]; [UIView commitAnimations]; } -(void)loadMainPage { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:window cache:NO]; [horoscopesViewController.view removeFromSuperview]; [self.window addSubview:[viewController view]]; [UIView commitAnimations]; [horoscopesViewController release]; horoscopesViewController = nil; } - (void)applicationDidFinishLaunching:(UIApplication *)application { // Override point for customization after app launch [window addSubview:viewController.view]; [window makeKeyAndVisible]; } - (void)dealloc { [viewController release]; [window release]; [super dealloc]; } @end Lovescopes4ViewController.h #import <UIKit/UIKit.h> #import "HoroscopesViewController.h" @interface Lovescopes4ViewController : UIViewController { HoroscopesViewController *hvc; } -(IBAction)loadAries; @property (nonatomic, retain) HoroscopesViewController *hvc; @end Lovescope4ViewController.m #import "Lovescopes4ViewController.h" #import "Lovescopes4AppDelegate.h" @implementation Lovescopes4ViewController @synthesize hvc; -(IBAction)loadAries { NSString *selected =@"Aries"; [hvc loadZodiac:selected]; Lovescopes4AppDelegate *mainDelegate = (Lovescopes4AppDelegate *) [[UIApplication sharedApplication] delegate]; [mainDelegate loadHoroscope]; } HoroscopesViewController.h #import <UIKit/UIKit.h> @interface HoroscopesViewController : UIViewController { IBOutlet UILabel *zodiacLabel; } -(void)loadZodiac:(id)zodiacSign; -(IBAction)back; @property (nonatomic, retain) IBOutlet UILabel *zodiacLabel; @end HoroscopesViewController.m #import "HoroscopesViewController.h" #import "Lovescopes4AppDelegate.h" @implementation HoroscopesViewController @synthesize zodiacLabel; /* // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { // Custom initialization } return self; } */ /* // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; } */ /* // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); } */ -(void)loadZodiac:(id)zodiacSign { zodiacLabel.text = [NSString stringWithFormat: @"%@", zodiacSign]; } -(IBAction)back { Lovescopes4AppDelegate *mainDelegate = (Lovescopes4AppDelegate *) [[UIApplication sharedApplication] delegate]; [mainDelegate loadMainPage]; }

    Read the article

  • asp.net MVC Partial Views how to initialise javascript

    - by Simon G
    Hi, I have an edit form that uses an ajax form to submit to the controller. Depending on the data submitted I redirect the user to one of two pages (by returning a partial view). Both pages rely on javascript/jquery and neither use anything common between the pages. What is the best way to initialise these javascripts on each page? I know there is the AjaxOption OnComplete but both pages are quite dynamic depending on the Model passed and I would rather keep the javascript for both pages seperate rather than having a common method. Thanks

    Read the article

  • Loading Views dynamically

    - by Dann
    Case 1: I have created View-based sample application and tried execute below code. When I press on "Job List" button it should load another view having "Back Btn" on it. In test function, if I use [self.navigationController pushViewController:jbc animated:YES]; nothing gets loaded, but if I use [self presentModalViewController:jbc animated:YES]; it loads another view haveing "Back Btn" on it. Case 2: I did create another Navigation Based Applicaton and used [self.navigationController pushViewController:jbc animated:YES]; it worked as I wanted. Can someone please explain why it was not working in Case 1. Does it has something to do with type of project that is selected? @interface MWViewController : UIViewController { } -(void) test; @end @interface JobViewCtrl : UIViewController { } @end @implementation MWViewController (void)viewDidLoad { UIButton* btn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btn.frame = CGRectMake(80, 170, 150, 35); [btn setTitle:@"Job List!" forState:UIControlStateNormal]; [btn addTarget:self action:@selector(test) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:btn]; [super viewDidLoad]; } -(void) test { JobViewCtrl* jbc = [[JobViewCtrl alloc] init]; [self.navigationController pushViewController:jbc animated:YES]; //[self presentModalViewController:jbc animated:YES]; [jbc release]; } (void)dealloc { [super dealloc]; } @end @implementation JobViewCtrl -(void) loadView { self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; self.view.backgroundColor = [UIColor grayColor]; UIButton* btn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btn.frame = CGRectMake(80, 170, 150, 35); [btn setTitle:@"Back Btn!" forState:UIControlStateNormal]; [self.view addSubview:btn]; } @end

    Read the article

  • Switching Views

    - by Stephen
    I have two XIb files and I need to switch between them with the swipe of a finger, like the native iphone weather app. does anyone know how to do this. please give some sample code if possible. thank you. P.S I am programming in Objective-C.

    Read the article

  • How can I count my facebook application post views

    - by Kalisky
    Hi, I have a Facebook application with which my users can post and friends can view in their news feed. I would like to know how many people have seen, or maybe even interacted or "liked" the posts my users posted using my application. Does Facebook give such statistics? Is there any other way to know it? Thanks.

    Read the article

  • iPhone switching views without first view being reset

    - by user298261
    Heya! I'm making a role-playing game, and I want to have a Map View and a Battle Screen. With the possibility of other screens as well. I thought the best way to achieve this was to use multiple NIB files. When I prototyped this by have one view that creates content, switches to the next view, and then back, the content on the original view was reset. How do I make it so that the first view doesn't reset the data each time it's loaded? Thanks!

    Read the article

  • Do MySQL Locked Tables affect related Views?

    - by CogitoErgoSum
    So after reading http://stackoverflow.com/questions/1415602/performance-in-pdo-php-mysql-transaction-versus-direct-execution in regards to performance issues I was thinking about I did some research on locking tables in MySQL. On http://dev.mysql.com/doc/refman/5.0/en/table-locking.html Table locking enables many sessions to read from a table at the same time, but if a session wants to write to a table, it must first get exclusive access. During the update, all other sessions that want to access this particular table must wait until the update is done. This part struck me particularly becuase most of our queries will be updates rather than inserts. I was wondering if one created a table called foo on which all updates/inserts were carried out and then a view called foo_view (A copy of foo, or perhaps foo and a linkage of several other tables plus foo) on which all selects occured, would this locking issue still occur? That is, would SELECT quries on foo_view still have to wait for an update to finish on foo?

    Read the article

  • Issue Displaying/Hiding Views (Obj-C iPhone Programming)

    - by roswell
    All right all, So I've got a UITableView that is inited in applicationDidFinishLaunching like so: [self showForumList]; Said method does this: -(void)showForumList { ForumList *fl = [ForumList alloc]; [fl initWithNibName:@"ForumList" bundle:[NSBundle mainBundle]]; self.ForumList = fl; [window addSubview:[self.ForumList view]]; [fl release]; }where self.ForumList is previously defined in the interface as ForumList *ForumList;, etc. Now, in ForumList (itself an extension of UITableViewController obviously), I've got didSelectRowAtIndexPath: -- within it I have the following code: Forum *f = [Forum alloc]; NSArray *forums = [f getForumList]; NSDictionary *selectedForum = [forums objectAtIndex:[indexPath row]]; NSString *Url = [selectedForum objectForKey:@"url"]; NSString *Username = [selectedForum objectForKey:@"username"]; NSString *Password = [selectedForum objectForKey:@"password"]; NSLog(@"Identified press on forum %@ (%@/%@)", Url, Username, Password); [self.globalDelegate showForumListFromForumUsingUrl:Url username:Username password:Password]; [self.globalDelegate closeForumList]; NSLog(@"ForumListFromForum init"); Both of the NSLog calls in this function are executed and perform as they should. Now, here is where the issue starts. self.globalDelegate is defined as AppDelegate *globalDelegate; in the Interface specification in my header file. However, [self.globalDelegate showForumListFromForumUsingUrl:username:password] and and [self.globalDelegate closeForumList] are never actually called. They look like so: -(void)closeForumList { NSLog(@"Hiding forum list"); [[self.ForumList view] removeFromSuperview]; } -(void)showForumListFromForumUsingUrl:(NSString *)Url username:(NSString *)Username password:(NSString *)Password { NSLog(@"Showing forum list from forum"); ForumListFromForum *fl = [ForumListFromForum alloc]; [fl initWithNibName:@"ForumListFromForum" bundle:[NSBundle mainBundle]]; [fl initFromForumWithUrl:Url username:Username password:Password]; self.ForumListFromForum = fl; [window addSubview:[self.ForumListFromForum view]]; [fl release]; } The app does not respond to my press and neither of these NSLog calls are made. Any idea where I've gone wrong?

    Read the article

  • Expose DB2 data as XML / Query DB2via XML

    - by Anthony Gatlin
    I have a client who has a sort of data warehouse stored in DB2. For a variety of reasons, the data must remain on this platform. The client is considering implementing an open-source CMS (Drupal) which runs in MySQL. The client needs to be able to execute a bunch of pre-defined queries against the DB2 database from the remote application. Drupal appears to interact well with XML data from other systems. It was suggested that we use something like XML-RPC to execute the queries against DB2. I am very familiar with SQL Server and pretty familiar with MySQL, but I have no experience with DB2 and no understanding of its capabilities or limitations. Is there any way that we can use something like XML, XML-RPC, or even http to initiate queries against a DB2 database? Any ideas are appreciated! Thank you!

    Read the article

  • Handling images in Drupal

    - by Vivek Chandraprakash
    I have a drupal website. I want users to create pages that sometime has images in it. Is there is a module that can integrate with the ck editor lets the user upload images lets the user to browse uploaded images and select and include it in the page they create? Thanks -Vivek

    Read the article

  • 'on the web' drupal module showing images on localhost but not remote host

    - by Andrew Welch
    Hi, the simple little module titled 'on the web' for drupal shows social network links. It links to some images on the directory. on my localhost install they are showing but in the remote install the img tags aren't even appearing. I looked in the module's files and the path isn't hard-coded or anything so it's not to do with that. any ideas? the module is here: http://drupalmodules.com/module/on-the-web cheers andy

    Read the article

  • recipe for adding Drupal node records.

    - by bert
    I am looking for a recipe for adding Drupal node records. I have identified three tables. node_revisions nid=249 - vid + 1? vid=248 - auto-increment node: nid=250 - vid + 1? vid=249 - auto-increment content_type_my_content vid=248 - from node_revisions table? nid=249 - from node table? Am I on right track? Is there some helper functions for this?

    Read the article

  • How to get form elements from one form to another form in drupal

    - by ugesh.gali
    I have two forms in drupal and the form values is stores in DB.The first form contanins some fields related to company by default like id conpany,name etc.The second form consists of attributes .If I add attributes to the second form the attribute field should be visible in first form. Ex If i add loaction or any other field it should visible in first form as location field.

    Read the article

  • 'add another item' in non-CCK Drupal forms

    - by ceejayoz
    CCK for Drupal has the handy feature of allowing a single CCK field to accept multiple values via a "add another item" button that results in an array of data in the node. I'm wondering if there's any easy way of adapting this for a non-CCK form that I'd be calling by drupal_get_form. I'd rather not have to re-invent the wheel with multi-step form techniques. Anyone done this?

    Read the article

  • Drupal taxonomy multi-select default value

    - by msindle
    I'm using drupal 6.16 and have a set of taxonomy terms that are set up as a multi-select box. I would like for the first item to be selected when the user loads the page. I dont know if I need to add code to a file or just simply change a setting. I should warn you I do not have a lot of experience, but would rate myself as a low intermediate level programmer. Thanks in advance msindle

    Read the article

  • Drupal - get program name

    - by ernie
    I would like to get program name in Drupal (actually name in URL that calls program or function). example: http://localhost/drupal6/my_widget This works: $myURL = (basename($_SERVER['REQUEST_URI'])); // $myURL=my_widget but not when I have additional parameters: http://localhost/drupal6/my_widget/parm1/parm2

    Read the article

  • Drupal location autosuggest doesn't recognize provinces

    - by harry_T
    I am using Drupal Location module in CCK to retreive longitude & latitude based on location (stree/city/state). There is an automatic autosuggest for State, but unfortunately recognizes only US states. I set default country to Canada, but autosuggest still only recognized US states. Is there a way to get autosuggest function to recognize Canadian provinces or to disable this feature. thanks!

    Read the article

< Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >