Search Results

Search found 10055 results on 403 pages for 'self awareness'.

Page 152/403 | < Previous Page | 148 149 150 151 152 153 154 155 156 157 158 159  | Next Page >

  • problem in presentmodelviewcontroller?

    - by Bala
    i am using tabbarcontroller. In tabbar having one view.In that tab i call one function using Nstimer it open another viewcontroller. First * sVC = [[First alloc] initWithNibName:@"First" bundle:[NSBundle mainBundle]]; [self presentModalViewController:sVC animated:YES]; Opened viewcontrller having one button.when user click that button i want to close the view and call Nstimer. [self dismissModalViewControllerAnimated:NO] The problem is first the view opened and closed but second time view could not open.

    Read the article

  • string or nsstring with string

    - by joels
    Lets assume myProp is @property (retain) NSString * myProp and synthesized for us.... self.myProp = @"some value";//string literal? self.myProp = [NSString stringWithString:@"some value"]; Is there a difference here? Is the first one a string literal that doesnt get autoreleased or is it just in memory for it's current scope and I dont have to worry about it?

    Read the article

  • [solved] call_user_func_array problems

    - by Knarf
    I have a class with this in self::$DB = new PDO("mysql:dbname=$dbname;host:=127.0.0.1" , 'root' , ''); and then this public static function __callStatic($name, $arguments) { return call_user_func_array(array('self::$DB', $name), $arguments); } How does I make it right/work?

    Read the article

  • why use the "!!!"?

    - by lazyanno
    as follow codes: var a = {}; if(!!!a[tabType]){ a[tabType] = []; a[tabType].push([self,boxObj]); }else{ a[tabType].push([self,boxObj]); } i think !!!a[tabType] equals !a[tabType] why use the "!!!" not "!" ? thank you!

    Read the article

  • How do I check the Database type in a Rails Migration?

    - by Shaun F
    I have the following migration and I want to be able to check if the current database related to the environment is a mysql database. If it's mysql then I want to execute the SQL that is specific to the database. How do I go about this? class AddUsersFb < ActiveRecord::Migration def self.up add_column :users, :fb_user_id, :integer add_column :users, :email_hash, :string #if mysql #execute("alter table users modify fb_user_id bigint") end def self.down remove_column :users, :fb_user_id remove_column :users, :email_hash end end

    Read the article

  • rake does not returning anything

    - by CHID
    Hi, I jus created a rails application. I created a model using ruby script/generate model Article next i edited the my articles.rb file by adding these lines in self.up method def self.up create_table :articles do |t| t.string :title t.text :body t.string :published_at t.timestamps end end Now i ran rake db:migrate . But migrate does not work, it simply does no print anything. Anyone knows where i am going wrong?

    Read the article

  • Is there a way to fix the background image of a UITableView

    - by user337174
    Hi I have set the background of my UITable with a custom image. self.tableView.backgroundColor = [UIColor clearColor]; self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]]; The problem im having is the background image is scrolling and doesn't look good at the top and bottom of the screen where you see the image being joined. Is there a way to fix the position of the background image and just have the table scroll over the top of it?

    Read the article

  • Python: How should I make instance variables available?

    - by swisstony
    Suppose I have: class myclass: def __init__(self): self.foo = "bar" where the value of foo needs to be available to users of myclass. Is it OK to just read the value of foo directly from an instance of myclass? Should I add a get_foo method to myclass or perhaps add a foo property? What's the best practice here?

    Read the article

  • How do I achieve virtual attributes in CakePHP (using code, not SQL) as implemented in Ruby on Rails

    - by ash
    Source: http://asciicasts.com/episodes/16-virtual-attributes I'd like to achieve a similar setup as below, but in CakePHP and where the virtual attributes are created using code, not SQL (as documented at http://book.cakephp.org/view/1070/Additional-Methods-and-Properties#Using-virtualFields-1590). class User < ActiveRecord::Base # Getter def full_name [first_name, last_name].join(' ') end # Setter def full_name=(name) split = name.split(' ', 2) self.first_name = split.first self.last_name = split.last end end

    Read the article

  • Load view when button is clicked in Xcodes Storyboard

    - by dooonot
    I just started to use Storyboard in Xcode. I have a starting view that has some buttons inside. Is there a way to load a special view when a button is clicked? I only found this workaround: -(IBAction)loadRegistration:(id)sender { // load registration controller UIStoryboard *storyboard = self.storyboard; RegisterController *svc = [storyboard instantiateViewControllerWithIdentifier:@"RegisterController"]; [self presentViewController:svc animated:YES completion:nil]; }

    Read the article

  • How do I override file.write() under Python 3?

    - by Sorin Sbarnea
    Below works on Python 2.6 but on Python 3.x it doesn't: old_file_write = file.write class file(): def write(self, d): if isinstance(d, types.bytes): self.buffer.write(d) else: old_file_write(d) # ... do something like f = open("x") f.write("...") The problems is that with Python 3.x the first like will generate an error: NameError: name 'file' is not defined How can I make this work on Python 3.x? PS. In fact I'm looking for a solution that will work on both versions.

    Read the article

  • RSpec - mocking a class method

    - by Chris Kilmer
    I'm trying to mock a class method with rspec: lib/db.rb class Db def self.list(options) Db::Payload.list(options) end end lib/db/payload.rb class Db::Payload def self.list(options={}) end end In my spec, I'm trying to setup the expectation Db::Payload.list will be called when I call Db.list: describe Db do before(:each) do @options = {} Db::Payload.should_receive(:list).with(@options) end it 'should build the LIST payload' do Db.list(@options) end end The problem is that I am always receiving the following error: undefined method `should_receive' for Db::Payload:Class Any help understanding this error would be most appreciated :-)

    Read the article

  • Serialize the @property methods in a Python class.

    - by ashchristopher
    Is there a way to have any @property definitions passed through to a json serializer when serializing a Django model class? example: class FooBar(object.Model) name = models.CharField(...) @property def foo(self): return "My name is %s" %self.name Want to serialize to: [{ 'name' : 'Test User', 'foo' : 'My name is Test User', },]

    Read the article

  • UINavigationController's back button disappears?

    - by QAD
    I notice something strange happens to one of my view controller: the back button disappears, yet it's possible to go back to previous view controller by tapping the top left corner (i.e where the button should reside). In my entire file there's no line that set self.navigationItem.hidesBackButton to YES; also NSLog prints 0 as self.navigationItem.hidesBackButton's value in viewDidLoad. This occurs in both the simulator and real device. Any ideas?

    Read the article

  • when to use "willChangeValueForKey" and "didChangeValueForKey"?

    - by Frost Li
    I saw these lines in a demo project, but I couldn't understand why it did that. [self willChangeValueForKey:@"names"]; [self didChangeValueForKey:@"names"]; It called didChangeValueForKey immediately after willChangeeValueForKey. Does it make any sense? Furthermore, when should be the right time to call this two methods? Thanks a lot!! :)

    Read the article

  • MKMapView maptype not changing!

    - by TheLearner
    I cannot understand why my MKMapView does not want to change to satellite view. This method is called and case 1 is called I have stepped over it but it simply does not change to satellite type it always changes to standard. It only works when it goes back to Map type. Anyone have any ideas? - (IBAction)mapSatelliteSegmentControlTapped:(UISegmentedControl *)sender { switch (sender.selectedSegmentIndex) { case 1: //Satellite self.mapView.mapType = MKMapTypeSatellite; default: //Map self.mapView.mapType = MKMapTypeStandard; } }

    Read the article

  • Return NSString from a recursive function

    - by Dave
    Hi, I have a recursive function that is designed to take parse a tree and store all the values of the tree nodes in an NSString. Is the algorithm below correct? NSString* finalString = [self parseTree:rootNode string:@""]; -(NSString*)parseTree:(Node*)currentNode string:(NSMutableString*)myString { [myString appendText:currentNode.value]; for(int i=0;i<[currentNode.children length];i++){ return [self parseTree:[currentNode.children] objectAtIndex:i] string:myString]; } }

    Read the article

  • Exception Handaling in google app engine

    - by Rahul99
    i am raising exception using if UserId == '' and Password == '': raise Exception.MyException , "wrong userId or password" but i want print the error message on same page class MyException(Exception): def __init__(self,msg): Exception.__init__(self,msg)

    Read the article

  • Dynamic class_name for has_many relations

    - by vooD
    I'm trying to make has_many relation with dynamic class_name attribute class Category < ActiveRecord::Base has_many :ads, :class_name => ( lambda { return self.item_type } ) end or class Category < ActiveRecord::Base has_many :ads, :class_name => self.item_type end But i got errors: can't convert Proc into String or undefined method `item_type' for #<Class:0xb62c6c88> Thank you for any help!

    Read the article

< Previous Page | 148 149 150 151 152 153 154 155 156 157 158 159  | Next Page >