Search Results

Search found 10804 results on 433 pages for 'attribute keys'.

Page 182/433 | < Previous Page | 178 179 180 181 182 183 184 185 186 187 188 189  | Next Page >

  • How to catch this low level MySQL (?) error in PHP/Magento

    - by andnil
    When I'm executing the following statement in Magento with a really large $sku, the execution terminates without any errors thrown what so ever. There are no errors in either Magento's, Apache's or PHP's error logs. Mage::getModel('catalog/product')-loadByAttribute('sku', $sku); Question: How do I catch the error? I've tried to set custom error handlers, and for testing purposes I've also managed to trigger error situations where each of the error handler functions are invoked. But when running the previously mentioned Magento code with a large $sku, none of the error handling functions are executed. error_reporting( -1 ); set_error_handler( array( 'Error', 'captureNormal' ) ); set_exception_handler( array( 'Error', 'captureException' ) ); register_shutdown_function( array( 'Error', 'captureShutdown' ) ); For completeness, this is the $sku I'm passing to loadByAttribute(). (The sku is invalid, but that is not the issue) 1- 9685 0102046|1- 9685 1212100|1- 9685 1212092|1- 9685 1212096|1- 9685 1102100|1- 9685 1102108|1- 9685 1102112|1- 9685 1102092|1- 9685 0102048|1- 9685 0102054|1- 9685 0102056|1- 9685 0102058|1- 9685 1212104|1- 9685 1212108|1- 9685 0212058|1- 9685 0104050|1- 9685 0212050|1- 9685 0212056|1- 9685 0212044|1- 9685 0212048|1- 9685 0212052|1- 9685 0212054|1- 9685 1102104|1- 9685 1102124 Any insight into this matter is much appreciated! Update: Upon further investigation, this is the exact point in the code where execution terminates. when the foreach is executed I guess Magento goes into MySQL world and starts loading up data from the database. \Mage\Catalog\Model\Abstract.php public function loadByAttribute($attribute, $value, $additionalAttributes = '*') { $collection = $this->getResourceCollection() ->addAttributeToSelect($additionalAttributes) ->addAttributeToFilter($attribute, $value) ->setPage(1,1); foreach ($collection as $object) { // <--------------- HERE return $object; } return false; } Note, I'm ONLY interested in finding out how to properly CATCH these kinds of errors, not "fix" the logic. This is so that I can present a proper error message to the user. The example above with the malformed sku is contrived and I have no desire to make my Magento app work with those erroneous skus.

    Read the article

  • How can I make this jQuery plugin chainable after all image load events have completed?

    - by BumbleB2na
    [UPDATE] Solution I decided on: Decided that passing in a callback to the plugin will take care of firing an event once all images have completed loading. Chaining is also still possible. Updated Fiddle I am building a chainable jQuery plugin that can load images dynamically. (View the following code as a JSFiddle) Html: <img data-img-src="http://www.lubasf.com/blog/wp-content/uploads/2009/03/gnome.jpg" style="display: none" /> <img data-img-src="http://buffered.io/uploads/2008/10/gnome.jpg" style="display: none" /> Instead of adding in a src attribute, I give these images a data-img-src attribute. My plugin uses the value of that to fill the src. Also, these images are hidden to begin with. jQuery plugin: (function(jQuery) { jQuery.fn.loadImages = function() { var numToLoad = jQuery(this).length; var numLoaded = 0; jQuery(this).each(function() { if(jQuery(this).attr('src') == undefined) { return jQuery(this).load(function() { numLoaded++; if(numToLoad == numLoaded) return this; // attempt at making this plugin // chainable, after all .load() // events have completed. }).attr('src', jQuery(this).attr('data-img-src')); } else { numLoaded++; if(numToLoad == numLoaded) return this; // attempt at making this plugin // chainable, after all .load() // events have completed. } }); // this works if uncommented, but returns before all .load() events have completed //return this; }; })(jQuery); // I want to chain a .fadeIn() after all images have completed loading $('img[data-img-src]').loadImages().fadeIn(); Is there a way to make this plugin chainable, and have my fadeIn() happen after all images have loaded?

    Read the article

  • Replacing XML in File from "Document" in Java

    - by poeschlorn
    Hi, after processing my first steps in working with XML in java I am now at the point where I want to update some data in my XML/GPX file... Reaplacing it in my "Document" data type works great :) How here comes the question: how can I store the changed "document"-model back to my file? Do I have to do this by using the standart file-functions (via steams and so on) oder is the a more elegant way to do this? ;-) Here's the code I already worked out, maybe that could help. (the method getParsedXML is just puting the conversion from the file into an extra method) Document tmpDoc = getParsedXML(currentGPX); //XML Parsind tests: // Access to tag attribute <tag attribut="bla"> System.out.println(tmpDoc.getElementsByTagName("wpt").item(0).getAttributes().getNamedItem("lat").getTextContent()); // Access to the value of an child element <a><CHILD>ValueOfChild</CHILD></a> System.out.println(tmpDoc.getElementsByTagName("wpt").item(0).getChildNodes().item(5).getTextContent()); // Replacing access to tag attribute tmpDoc.getElementsByTagName("wpt").item(0).getAttributes().getNamedItem("lat").setTextContent("139.921055008"); System.out.println(tmpDoc.getElementsByTagName("wpt").item(0).getAttributes().getNamedItem("lat").getTextContent()); // Replacing access to child element value tmpDoc.getElementsByTagName("wpt").item(0).getChildNodes().item(5).setTextContent("Cala Sant Vicenç - Mallorca 2"); System.out.println(tmpDoc.getElementsByTagName("wpt").item(0).getChildNodes().item(5).getTextContent());

    Read the article

  • Why is my rspec test failing?

    - by Justin Meltzer
    Here's the test: describe "admin attribute" do before(:each) do @user = User.create!(@attr) end it "should respond to admin" do @user.should respond_to(:admin) end it "should not be an admin by default" do @user.should_not be_admin end it "should be convertible to an admin" do @user.toggle!(:admin) @user.should be_admin end end Here's the error: 1) User password encryption admin attribute should respond to admin Failure/Error: @user = User.create!(@attr) ActiveRecord::RecordInvalid: Validation failed: Email has already been taken # ./spec/models/user_spec.rb:128 I'm thinking the error might be somewhere in my data populator code: require 'faker' namespace :db do desc "Fill database with sample data" task :populate => :environment do Rake::Task['db:reset'].invoke admin = User.create!(:name => "Example User", :email => "[email protected]", :password => "foobar", :password_confirmation => "foobar") admin.toggle!(:admin) 99.times do |n| name = Faker::Name.name email = "example-#{n+1}@railstutorial.org" password = "password" User.create!(:name => name, :email => email, :password => password, :password_confirmation => password) end end end Please let me know if I should reproduce any more of my code. UPDATE: Here's where @attr is defined, at the top of the user_spec.rb file: require 'spec_helper' describe User do before(:each) do @attr = { :name => "Example User", :email => "[email protected]", :password => "foobar", :password_confirmation => "foobar" } end

    Read the article

  • IEnumerator seems to be effecting all objects, and not one at a time

    - by PFranchise
    Hey, I am trying to alter an attribute of an object. I am setting it to the value of that same attribute stored on another table. There is a one to many relationship between the two. The product end is the one and the versions is the many. Right now, both these methods that I have tried have set all the products returned equal to the final version object. So, in this case they are all the same. I am not sure where the issue lies. Here are my two code snipets, both yield the same result. int x = 1 IEnumerator<Product> ie = productQuery.GetEnumerator(); while (ie.MoveNext()) { ie.Current.RSTATE = ie.Current.Versions.First(o => o.VersionNumber == x).RSTATE; x++; } and foreach (var product in productQuery) { product.RSTATE = product.Versions.Single(o => o.VersionNumber == x).RSTATE; x++; } The versions table holds information for previous products, each is distinguished by the version number. I know that it will start at 1 and go until it reaches the current version, based on my query returning the proper number of products. Thanks for any advice.

    Read the article

  • Pickled my dictionary from ZODB but i got a less in size one?

    - by Someone Someoneelse
    I use ZODB and i want to copy my 'database_1.fs' file to another 'database_2.fs', so I opened the root dictionary of that 'database_1.fs' and I (pickle.dump) it in a text file. Then I (pickle.load) it in a dictionary-variable, in the end I update the root dictionary of the other 'database_2.fs' with the dictionary-variable. It works, but I wonder why the size of the 'database_1.fs' not equal to the size of the other 'database_2.fs'. They are still copies of each other. def openstorage(store): #opens the database data={} data['file']=filestorage data['db']=DB(data['file']) data['conn']=data['db'].open() data['root']=data['conn'].root() return data def getroot(dicty): return dicty['root'] def closestorage(dicty): #close the database after Saving transaction.commit() dicty['file'].close() dicty['db'].close() dicty['conn'].close() transaction.get().abort() then that's what i do:- import pickle loc1='G:\\database_1.fs' op1=openstorage(loc1) root1=getroot(op1) loc2='G:database_2.fs' op2=openstorage(loc2) root2=getroot(op2) >>> len(root1) 215 >>> len(root2) 0 pickle.dump( root1, open( "save.txt", "wb" )) item=pickle.load( open( "save.txt", "rb" ) ) #now item is a dictionary root2.update(item) closestorage(op1) closestorage(op2) #after I open both of the databases #I get the same keys in both databases #But `database_2.fs` is smaller that `database_2.fs` in size I mean. >>> len(root2)==len(root1)==215 #they have the same keys True Note: (1) there are persistent dictionaries and lists in the original database_1.fs (2) both of them have the same length and the same indexes.

    Read the article

  • How to construct objects based on XML code?

    - by the_drow
    I have XML files that are representation of a portion of HTML code. Those XML files also have widget declarations. Example XML file: <message id="msg"> <p> <Widget name="foo" type="SomeComplexWidget" attribute="value"> inner text here, sets another attribute or inserts another widget to the tree if needed... </Widget> </p> </message> I have a main Widget class that all of my widgets inherit from. The question is how would I create it? Here are my options: Create a compile time tool that will parse the XML file and create the necessary code to bind the widgets to the needed objects. Advantages: No extra run-time overhead induced to the system. It's easy to bind setters. Disadvantages: Adds another step to the build chain. Hard to maintain as every widget in the system should be added to the parser. Use of macros to bind the widgets. Complex code Find a method to register all widgets into a factory automatically. Advantages: All of the binding is done completely automatically. Easier to maintain then option 1 as every new widget will only need to call a WidgetFactory method that registers it. Disadvantages: No idea how to bind setters without introducing a maintainability nightmare. Adds memory and run-time overhead. Complex code What do you think is better? Can you guys suggest a better solution?

    Read the article

  • iOS: Best Way to do This w/o Calling Method 32 Times?

    - by user1886754
    I'm currently retrieving the Top 100 Scores for one of my leaderboards the following way: - (void) retrieveTop100Scores { __block int totalScore = 0; GKLeaderboard *myLB = [[GKLeaderboard alloc] init]; myLB.identifier = [Team currentTeam]; myLB.timeScope = GKLeaderboardTimeScopeAllTime; myLB.playerScope = GKLeaderboardPlayerScopeGlobal; myLB.range = NSMakeRange(1, 100); [myLB loadScoresWithCompletionHandler:^(NSArray *scores, NSError *error) { if (error != nil) { NSLog(@"%@", [error localizedDescription]); } if (scores != nil) { for (GKScore *score in scores) { NSLog(@"%lld", score.value); totalScore += score.value; } NSLog(@"Total Score: %d", totalScore); [self loadingDidEnd]; } }]; } The problem is I want to do this for 32 leaderboards. What's the best way of achieving this? Using a third party tool (Game Center Manager), I can get the following line to return a dictionary with leaderboard ID's as keys and the Top 1 highest score as values NSDictionary *highScores = [[GameCenterManager sharedManager] highScoreForLeaderboards:leaderboardIDs]; So my question is, how can I combine those 2 segments of code to pull in the 100 values for each leaderboard, resulting in a dictionary with all of the leaderboard names as keys, and the Total (of each 100 scores) of the leaderboards for values.

    Read the article

  • Using the JPA Criteria API, can you do a fetch join that results in only one join?

    - by Shaun
    Using JPA 2.0. It seems that by default (no explicit fetch), @OneToOne(fetch = FetchType.EAGER) fields are fetched in 1 + N queries, where N is the number of results containing an Entity that defines the relationship to a distinct related entity. Using the Criteria API, I might try to avoid that as follows: CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<MyEntity> query = builder.createQuery(MyEntity.class); Root<MyEntity> root = query.from(MyEntity.class); Join<MyEntity, RelatedEntity> join = root.join("relatedEntity"); root.fetch("relatedEntity"); query.select(root).where(builder.equals(join.get("id"), 3)); The above should ideally be equivalent to the following: SELECT m FROM MyEntity m JOIN FETCH myEntity.relatedEntity r WHERE r.id = 3 However, the criteria query results in the root table needlessly being joined to the related entity table twice; once for the fetch, and once for the where predicate. The resulting SQL looks something like this: SELECT myentity.id, myentity.attribute, relatedentity2.id, relatedentity2.attribute FROM my_entity myentity INNER JOIN related_entity relatedentity1 ON myentity.related_id = relatedentity1.id INNER JOIN related_entity relatedentity2 ON myentity.related_id = relatedentity2.id WHERE relatedentity1.id = 3 Alas, if I only do the fetch, then I don't have an expression to use in the where clause. Am I missing something, or is this a limitation of the Criteria API? If it's the latter, is this being remedied in JPA 2.1 or are there any vendor-specific enhancements? Otherwise, it seems better to just give up compile-time type checking (I realize my example doesn't use the metamodel) and use dynamic JPQL TypedQueries.

    Read the article

  • Overriding CSS style 'display:none' in javascript

    - by jsarma
    I'm trying to add a checkbox toggle that hides and shows list elements by changing their style display attribute from "none" to "inline", but it's not working. I'm setting the attribute's style to "display:none" in the CSS file. Then I set it to "display:inline" in javascript when someone checks a box. The javascript is successfully changing the element's property to inline, but for some reason the element remains invisible. If I do the opposite, by setting the display to inline in the CSS and overriding it to none in the javascript, it works fine. I don't see why this would work one way but not the other. I'm using chrome. Here is the code. Any feedback is appreciated. CSS file: #tabmenu li[status='disabled'] a, a.active, #disabled { color: #777777; background: #DDDDDD; font: normal 1em Arial; border: 1px solid black; border-radius: inherit; padding: 0px 5px 0px 5px; margin: 0px; text-decoration: none; cursor:hand; display:none; } HTML: <ul id="tabmenu"> <li name='tab' id='tab1' selected='no' status='disabled'></li> </ul> JAVASCRIPT (from command line, or onchange of a checkbox) tab = document.getElementById('tab1'); tab.style.display = 'inline';

    Read the article

  • SQL query select from table and group on other column...

    - by scaryjones
    I'm phrasing the question title poorly as I'm not sure what to call what I'm trying to do but it really should be simple. I've a link / join table with two ID columns. I want to run a check before saving new rows to the table. The user can save attributes through a webpage but I need to check that the same combination doesn't exist before saving it. With one record it's easy as obviously you just check if that attributeId is already in the table, if it is don't allow them to save it again. However, if the user chooses a combination of that attribute and another one then they should be allowed to save it. Here's an image of what I mean: So if a user now tried to save an attribute with ID of 1 it will stop them, but I need it to also stop them if they tried ID's of 1, 10 so long as both 1 and 10 had the same productAttributeId. I'm confusing this in my explanation but I'm hoping the image will clarify what I need to do. This should be simple so I presume I'm missing something.

    Read the article

  • Django - Weird behaviour of sessions variables with Apache

    - by Étienne Loks
    In a Menu class with Section children, each Section has an available attribute. This attribute is initialized during the instance creation. The process of getting the availability is not trivial, so I stock a Menu instance for each user in a session variable. With the Django embedded webserver this works well. But when I deploy the application on an Apache webserver I can observe a very weird behavior. Once authentified, a click on a link or a refreshment of the page and the availability of each Section seems to be forgotten (empty menu but in the log file I can see that all Sections are here) then a new refresh on the page the availability is back, a new refresh the menu disappears once again, etc. There is no cache activated on the web server. The menu is initialized in a context processor. def get_base_context(request): if 'MENU' not in request.session or \ not request.session['MENU'].childs or\ request.session['MENU'].user != request.user: _menu = Menu(request.user) _menu.init() request.session['MENU'] = _menu (...) I have no idea what could cause such a behavior. Any clue?

    Read the article

  • Setting CSS attributes on Change using jQuery

    - by Nick B
    I want to change css visibility and display attributes using jQuery on click when the state of another div's visibility attribute changes. (Many apologies for the obfuscated markup, but needing to manipulate someone else's construction): There are four instances of [data-label="Checkbox"] [data-label="Checked"] in this page. I want to set [data-label="trash"] and [data-label="Sort Options"] to visibility: visible; display: [empty value] when any of the [data-label="Checkbox"] [data-label="Checked"]'s attributes changes to 'visibility', 'visible'. Else, if none of [data-label="Checkbox"] [data-label="Checked"]'s have the attribute 'visibility', 'visible', I want to set [data-label="trash"] and [data-label="Sort Options"] back to their initial states: display: none; visibility: hidden;. Here's the markup: <div data-label="Sort Options" style="display: none; visibility: hidden;"> <div data-label="trash" style="display: none; visibility: hidden;"></div> </div> <div data-label="Checkbox"> <div data-label="Unchecked"></div> <div data-label="Checked" style="display: none; visibility: hidden;"></div> </div> Here is what I have tried unsuccessfully: $('[data-label="Checkbox"]').click(function() { if ('[data-label="Checkbox"] [data-label="Checked"]').css('visibility', 'visible') { $('[data-label="trash"], [data-label="Sort Options"]').css({'display': '', 'visibility': 'visible'}); } else { $('[data-label="trash"], [data-label="Sort Options"]').css({'display': 'none', 'visibility': 'hidden'}); } }); Any help would be greatly appreciated! Thanks

    Read the article

  • Beginnerquestion: How to count amount of each number drawn in a Lottery and output it in a list?

    - by elementz
    I am writing this little Lottery application. Now the plan is, to count how often each number has been drawn during each iteration of the Lottery, and store this somewhere. My guess is that I would need to use a HashMap, that has 6 keys and increments the value by one everytime the respective keys number is drawn. But how would I accomplish this? My code so far: public void numberCreator() { // creating and initializing a Random generator Random rand = new Random(); // A HashMap to store the numbers picked. HashMap hashMap = new HashMap(); // A TreeMap to sort the numbers picked. TreeMap treeMap = new TreeMap(); // creating an ArrayList which will store the pool of availbale Numbers List<Integer>numPool = new ArrayList<Integer>(); for (int i=1; i<50; i++){ // add the available Numbers to the pool numPool.add(i); hashMap.put(nums[i], 0); } // array to store the lotto numbers int [] nums = new int [6]; for (int i =0; i < nums.length; i++){ int numPoolIndex = rand.nextInt(numPool.size()); nums[i] = numPool.get(numPoolIndex); // check how often a number has been called and store the new amount in the Map int counter = hashMap.get numPool.remove(numPoolIndex); } System.out.println(Arrays.toString(nums)); } Maybe someone can tell me if I have the right idea, or even how I would implement the map properly?

    Read the article

  • Rails HTML Table update fields in mongo with AJAX

    - by qwexar
    I'm building a Rails app backed by mongodb using mongoid. It's a one page app, with a HTML table, every field for every row of which, needs to be editable without refreshing the page. This is your usual Rails view ( like many in rails casts ) showing a table with rows and columns containing data. For example. I'm showing cars, and showing their make, model and notes They way I'm doing this is by appending _id of a mongo document to every column and marking it's field name in html id too. Then I pick up the value for $("#id") and send it to rails controller via AJAX and run @car.update_attributes method accordingly. Currently, one of my rows looks like this. <tr> <td id=<%= car.id %>_make> <%= car.make %> </td> <td id=<%= car.id %>_model> <%= car.model %> </td> <td id=<%= car.id %>_notes> <%= car.notes %> </td> </tr> // my function which is called onChange for every column function update_attributes(id){ var id = id.split[0]; var attribute = id.split[1]; $.ajax("sending id and attribute to rails controller"); } Is there any built it Rails magic which would let me update only a field in a model without refreshing the page? or. Is there a Rails plugin for this?

    Read the article

  • What are the potential problems with exposing the Facebook API secret?

    - by genehack
    I'm writing a little web utility that posts status updates to Twitter and/or Facebook. That involved creating 'applications' with both those services in order to get API keys and 'secrets'. My question is how protected I really need to keep those secrets -- in order for this to work at all, you seem to need the secret to interact with the authentication part of the service to grant the app access to your account and/or grant it permission to post updates on your behalf. Facebook's documentation says to protect the secret, but at least one other Facebook utility distributes the API key and secret in the source. It's important to note: this isn't your standard Facebook 'application' that runs within the context of Facebook, nor is it a standard "desktop"-style compiled app -- it's a web-based application intended to be run on your own web server. The audience for this is probably small and somewhat more sophisticated than average -- so, one technical alternative would be to require people to obtain their own API key and secret to use the app. That seems like a lot of work, however, and a fairly large barrier to entry to anybody using this. Anybody know or have any insight on what sort of trouble I'm letting myself in for if I put both the secrets and the API keys in the config for my app and check it into Github for all the world to see?

    Read the article

  • Enums and inheritance

    - by devoured elysium
    I will use (again) the following class hierarchy: Event and all the following classes inherit from Event: SportEventType1 SportEventType2 SportEventType3 SportEventType4 I have originally designed the Event class like this: public abstract class Event { public abstract EventType EventType { get; } public DateTime Time { get; protected set; } protected Event(DateTime time) { Time = time; } } with EventType being defined as: public enum EventType { Sport1, Sport2, Sport3, Sport4 } The original idea would be that each SportEventTypeX class would set its correct EventType. Now that I think of it, I think this approach is totally incorrect for two reasons: If I want to later add a new SportEventType class I will have to modify the enum If I later decide to remove one SportEventType that I feel I won't use I'm also in big trouble with the enum. I have a class variable in the Event class that makes, afterall, assumptions about the kind of classes that will inherit from it, which kinda defeats the purpose of inheritance. How would you solve this kind of situation? Define in the Event class an abstract "Description" property, having each child class implement it? Having an Attribute(Annotation in Java!) set its Description variable instead? What would be the pros/cons of having a class variable instead of attribute/annotation in this case? Is there any other more elegant solution out there? Thanks

    Read the article

  • How can I filter using the current value of a text box in a jQuery selector?

    - by spudly
    I have a validation script that checks for data-* attributes to determine which fields are required. If an element has the 'data-required-if' attribute (which has a jQuery selector as it's value), it checks to see if any elements are found that match that selector. If any are found, the field is required. It does something similar to the following: $('[data-required-if]').each(function () { var selector = $(this).attr('data-required-if'), required = false; if ( !$(selector).length ) { required = true; // do something if this element is empty } }); This works great, but there's a problem. When you use the attribute selector to filter based on the current value of a text field, it really filters on the initial value of the text field. <input type='text' id='myinput' value='initial text' /> <input type='text' id='dependent_input' value='' data-required-if="#myinput[value='']" /> // Step 1: type "foobar" in #myinput // Step 2: run these lines of code: <script> $('#myinput').val() //=> returns "foobar" $('#myinput[value="foobar"]').length //=> returns 0 </script> I understand why it's doing that. jQuery probably uses getAttribute() in the background. Is there any other way to filter based on the current value of an input box using purely jQuery selectors?

    Read the article

  • Is my approach for persistent login secure ?

    - by Jay
    I'm very much stuck with the reasonable secure approach to implement 'Remember me' feature in a login system. Here's my approach so far, Please advice me if it makes sense and is reasonably secure: Logging: User provides email and password to login (both are valid).. Get the user_id from DB Table Users by comparing provided email Generate 2 random numbers hashed strings: key1, key2 and store in cookies. In DB Table COOKIES, store key1, key2 along with user_id. To Check login: If key1 and key2 both cookies exist, validate both keys in DB Table COOKIES (if a row with key1, and key2 exists, user is logged). if cookie is valid, regenrate key2 and update it in cookie and also database. Why re-genrating key: Because if someone steals cookie and login with that cookie, it will be working only until the real user login. When the real user will login, the stolen cookie will become invalid. Right? Why do I need 2 keys: Because if i store user_id and single key in cookie and database, and the user want to remember the password on another browser, or computer, then the new key will be updated in database, so the user's cookie in earlier browser/PC will become invalid. User wont be able to remember password on more than one place. Thanks for your opinions.

    Read the article

  • objectAtIndex:indexPath.row method always causes exception in IOS

    - by kalkin
    Hi I always seem to get exception when I use objectAtInded method to retrieve NSString from an array. I am reading data from a dictionary which is in the "PropertyList.plist" file.My code is - (void)viewDidLoad { [super viewDidLoad]; NSString *path = [[NSBundle mainBundle] pathForResource:@"PropertyList" ofType:@"plist"]; names = [[NSDictionary alloc] initWithContentsOfFile:path]; keys = [[[names allKeys] sortedArrayUsingSelector: @selector(compare:)] retain]; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger section = [indexPath section]; NSUInteger row = [indexPath row]; NSString *key = [keys objectAtIndex:section]; NSArray *nameSection = [names objectForKey:key]; static NSString *SectionsTableIdentifier = @"SectionsTableIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SectionsTableIdentifier]; if(cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SectionsTableIdentifier] autorelease]; } cell.textLabel.text = [nameSection objectAtIndex:row]; return cell; } The exception happens on the method "cellForRowAtIndexPath" in the line cell.textLabel.text = [nameSection objectAtIndex:row]; The error message is Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance 0x6832440 Where ever I use "[nameSection objectAtIndex:row];" type of statement it always get exception.

    Read the article

  • Conditional fieldgroups/fieldsets in Drupal 7

    - by seane
    Background: In Drupal 7, I have created a form with CCK (aka the Field UI). I used the Field group module to create a fieldgroup, but I need it to be conditional, meaning it will only display depending on a previous answer. Previous research: To create a conditional field, you can use hook_form_alter() to edit the #states attribute like so: function MYMODULE_form_alter(&$form, &$form_state, $form_id) { if ($form_id == 'person_info_node_form') { // Display 'field_maiden_name' only if married $form['field_maiden_name']['#states'] = array( 'visible' => array( ':input[name="field_married[und]"]' => array('value' => 'Yes'), ), ); } } However, there seems to be no way to use the States API for fieldgroups. One thing to note is that, while fields are stored in $form, fieldgroups are stored in $form['#groups'] as well as in $form['#fieldgroups']. I don't know how to distinguish between these, and with this in mind, I have tried to apply a #states attribute to a fieldgroup in the same manner as above. However, it only produces server errors. Question: Is there a way to make a fieldgroup display conditionally using the States API or some alternative approach?

    Read the article

  • Are "strings.xml" string arrays always parsed/deserialized in the same order?

    - by PhilaPhan80
    Can I count on string arrays within the "strings.xml" resource file to be parsed/deserialized in the same order every time? If anyone can cite any documentation that clearly spells out this guarantee, I'd appreciate it. Or, at the very least, offer a significant amount of experience with this topic. Also, is this a best practice or am I missing a simpler solution? Note: This will be a small list, so I'm not looking to implement a more complicated database or custom XML solution unless I absolutely have to. <!--KEYS (ALWAYS CORRESPONDS TO LIST BELOW ??)--> <string-array name="keys"> <item>1</item> <item>2</item> <item>3</item> </string-array> <!--VALUES (ALWAYS CORRESPONDS TO LIST ABOVE ??)--> <string-array name="values"> <item>one</item> <item>two</item> <item>three</item> </string-array>

    Read the article

  • Oracle Blob as img src in PHP page

    - by menkes
    I have a site that currently uses images on a file server. The images appear on a page where the user can drag and drop each as is needed. This is done with jQuery and the images are enclosed in a list. Each image is pretty standard: <img src='//network_path/image.png' height='80px'> Now however I need to reference images stored as a BLOB in an Oracle database (no choice on this, so not a merit discussion). I have no problem retrieving the BLOB and displaying on it's own using: $sql = "SELECT image FROM images WHERE image_id = 123"; $stid = oci_parse($conn, $sql); oci_execute($stid); $row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS); $img = $row['IMAGE']->load(); header("Content-type: image/jpeg"); print $img; But I need to [efficiently] get that image as the src attribute of the img tag. I tried imagecreatefromstring() but that just returns the image in the browser, ignoring the other html. I looked at data uri, but the IE8 size limit rules that out. So now I am kind of stuck. My searches keep coming up with using a src attribute that loads another page that contains the image. But I need the image itself to actually show on the page. (Note: I say image, meaning at least one image but as many as eight on a page). Any help would be greatly appreciated.

    Read the article

  • Sorting a Singly Linked List With Pointers

    - by Mark Simson
    I am trying to sort a singly linked list using bubble sort by manipulating ONLY the pointers, no keys. The following gets stuck in the for loop and loops infinitely. I don't understand why this is. Can anybody explain to me why the end of the list is not being found? Node* sort_list(Node* head) { Node * temp; Node * curr; for(bool didSwap = true; didSwap; ) { didSwap = false; for(curr = head; curr->next != NULL; curr = curr->next) { if(curr->key > curr->next->key) { temp = curr; curr = curr->next; curr->next = temp; didSwap = true; } cout << curr->next->key << endl; } } return head; } If I change the code so that the keys (data) are swapped, then the function works properly but for some reason I am not able make it work by manipulating only pointers.

    Read the article

  • Error 1606. Could not access network location %SystemDrive%\inetpub\wwwroot\ while installing on IIS

    - by Mark
    I'm trying to port our software installer which currently supports Windows 2000 and Windows 2003 to a Windows 2008 environment. Currently, the installer gets an error which reads "Error 1606. Could not access network location %SystemDrive%\inetpub\wwwroot." %SystemDrive% is without a doubt C:\, and C:\inetpub\wwwroot\ has the correct accessibility. It is interesting that if I hardcode the path in the following keys in the registry to C:\inetpub\wwwroot\, without using the environment variable, the installer works correctly. • HKLM/Software/Wow6432Node/Microsoft/InetStp/PathWWWRoot • KHLM/Software/Microsoft/InetStp/PathWWWRoot. This seems like a very poor hack. I do not want to tell our clients that they need to hack their registry before they will be able to install our product. Another option is to change the registry behind the scenes, do our install, and revert the registry keys to their original values at the end of the install, but obviously I don't like this solution either. I find it hard to believe that Microsoft would have done this without reason, so there must be an alternate approach to get these installers to work without modifying the registry. Any tips appreciated.

    Read the article

< Previous Page | 178 179 180 181 182 183 184 185 186 187 188 189  | Next Page >