Search Results

Search found 85 results on 4 pages for 'ivar'.

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

  • Flush mod_pagespeed cache in Debian

    - by Ivar
    I need a way to flush the mod_pagespeed cache while developing. According to mod_pagespeed documents, I should run the following command: sudo touch /var/mod_pagespeed/cache/cache.flush In Debian it's "su" instead of "sudo". However, it doesn't work for me; there's no "touch" command, nor is there any "cache.flush" file in the defined directory. Have I missed something? You kick-ass Linux users, please be humble - I'm pretty new to these stuff. Thank you in advance!

    Read the article

  • howto install firefox + dependencies on debian without root privileges

    - by Ivar Lugtenburg
    I have a problem installing Firefox without root privileges. Mozilla says the following: Firefox will not run at all without the following libraries or packages: * GTK+ 2.10 or higher * GLib 2.12 or higher * Pango 1.14 or higher * X.Org 1.0 or higher Of course i need to install all these dependencies without root privileges as well, but the thing is i don't know exactly how to do this. I've tried a few things i found on the internet, but to no avail.

    Read the article

  • Subclass not seeing superclass' instance variable

    - by hyn
    I have a situation where my subclass is not seeing the superclass' instance variable x. The ivar is obviously @protected by default, so why do I get a compiler error "x undeclared"? If I make this ivar a property then I can access it by self.x. What's worse is sometimes the error disappears, so something in my code is obviously causing this error but I cannot figure it out.

    Read the article

  • Java NullPointerException. Why?

    - by user292844
    I am new to Java. I just read that class variables in Java have default value. I tried the following program. I was expecting to get the output as 0, which is the default value on an integer, but I get the NullPointerException. What am I missing? class Test{ static Integer iVar; public static void main(String...args) { System.out.println(iVar.intValue()); } }

    Read the article

  • SSRS 2008 export to MS Word A4 issue

    - by Knut Ivar
    I have a simple report maid in bids 2008 and deployed to a ssrs2008 server. it has this report properties: page unit : Centimeters page size : Orientasion: Landscape paper sise: A4 width : 29,7cm Height: 21cm all margins ar 2,5cm Showing and printing this report works fine making it perfekt on a A4 paper. exporting to difrent formats works also grate exept the format i made the report for. The word files ither end up whit an letter paper size or a A3 size. Do enyone have a solution for this problem?

    Read the article

  • Insertions into Zipper trees on XML files in Clojure

    - by ivar
    I'm confused as how to idiomatically change a xml tree accessed through clojure.contrib's zip-filter.xml. Should be trying to do this at all, or is there a better way? Say that I have some dummy xml file "itemdb.xml" like this: <itemlist> <item id="1"> <name>John</name> <desc>Works near here.</desc> </item> <item id="2"> <name>Sally</name> <desc>Owner of pet store.</desc> </item> </itemlist> And I have some code: (require '[clojure.zip :as zip] '[clojure.contrib.duck-streams :as ds] '[clojure.contrib.lazy-xml :as lxml] '[clojure.contrib.zip-filter.xml :as zf]) (def db (ref (zip/xml-zip (lxml/parse-trim (java.io.File. "itemdb.xml"))))) ;; Test that we can traverse and parse. (doall (map #(print (format "%10s: %s\n" (apply str (zf/xml-> % :name zf/text)) (apply str (zf/xml-> % :desc zf/text)))) (zf/xml-> @db :item))) ;; I assume something like this is needed to make the xml tags (defn create-item [name desc] {:tag :item :attrs {:id "3"} :contents (list {:tag :name :attrs {} :contents (list name)} {:tag :desc :attrs {} :contents (list desc)})}) (def fred-item (create-item "Fred" "Green-haired astrophysicist.")) ;; This disturbs the structure somehow (defn append-item [xmldb item] (zip/insert-right (-> xmldb zip/down zip/rightmost) item)) ;; I want to do something more like this (defn append-item2 [xmldb item] (zip/insert-right (zip/rightmost (zf/xml-> xmldb :item)) item)) (dosync (alter db append-item2 fred-item)) ;; Save this simple xml file with some added stuff. (ds/spit "appended-itemdb.xml" (with-out-str (lxml/emit (zip/root @db) :pad true))) I am unclear about how to use the clojure.zip functions appropriately in this case, and how that interacts with zip-filter. If you spot anything particularly weird in this small example, please point it out.

    Read the article

  • Lazy Sequences that "Look Ahead" for Project Euler Problem 14

    - by ivar
    I'm trying to solve Project Euler Problem 14 in a lazy way. Unfortunately, I may be trying to do the impossible: create a lazy sequence that is both lazy, yet also somehow 'looks ahead' for values it hasn't computed yet. The non-lazy version I wrote to test correctness was: (defn chain-length [num] (loop [len 1 n num] (cond (= n 1) len (odd? n) (recur (inc len) (+ 1 (* 3 n))) true (recur (inc len) (/ n 2))))) Which works, but is really slow. Of course I could memoize that: (def memoized-chain (memoize (fn [n] (cond (= n 1) 1 (odd? n) (+ 1 (memoized-chain (+ 1 (* 3 n)))) true (+ 1 (memoized-chain (/ n 2))))))) However, what I really wanted to do was scratch my itch for understanding the limits of lazy sequences, and write a function like this: (def lazy-chain (letfn [(chain [n] (lazy-seq (cons (if (odd? n) (+ 1 (nth lazy-chain (dec (+ 1 (* 3 n))))) (+ 1 (nth lazy-chain (dec (/ n 2))))) (chain (+ n 1)))))] (chain 1))) Pulling elements from this will cause a stack overflow for n2, which is understandable if you think about why it needs to look 'into the future' at n=3 to know the value of the tenth element in the lazy list because (+ 1 (* 3 n)) = 10. Since lazy lists have much less overhead than memoization, I would like to know if this kind of thing is possible somehow via even more delayed evaluation or queuing?

    Read the article

  • Cross-reference js-object variables when creating object

    - by Ivar Bonsaksen
    Summary: I want to know if it is possible to do something like this: {a: 'A',b: this.a} ...by using some other pointer like {a: 'A',b: self.a} or {a: 'A',b: own.a} or anything else... Full question: I'm trying to extend MyBaseModule using Ext.extend, and need to cross-reference values in the extension object passed to Ext.extend(). Since I'm not yet in context of MyModule, I'm not able to use this to reference the object (See example below line 12). Is there any other way to reference values like this without creating the object first? 1 MyModule = Ext.extend(MyBaseModule, { 2 dataStores: { 3 myDataStore: new Ext.data.Store({...}) 4 }, 5 6 myGridDefinition: { 7 id: 'myGridDefinitionPanel', 8 bodyBorder: false, 9 items: [{ 10 xtype: 'grid', 11 id: 'myGridDefinitionGrid', 12 store: this.dataStores.myDataStore 13 }] 14 } 15 }); Or is the following the only solution? I would like to avoid this if possible, as I find it less readable for large extension definitions. 1 var extensionObject = { 2 dataStores: { 3 myDataStore: new Ext.data.Store({...}) 4 }, 5 6 myGridDefinition: { 7 id: 'myGridDefinitionPanel', 8 bodyBorder: false, 9 items: [{ 10 xtype: 'grid', 11 id: 'myGridDefinitionGrid' 12 }] 13 } 14 }; 15 16 extensionObject.locationsGrid.items[0].store = extensionObject.dataStores.locations; 17 18 MyModule = Ext.extend(MyBaseModule, extensionObject);

    Read the article

  • apache tiles ordering problem

    - by ivar
    I have a problem with the order of rendering tiles. The menu gets rendered first and then the body of our webpage gets rendered. Each tile has it`s own controller that handles everything that tile needs to do. There are two forms. One in the menu and one in the body. Each one changes something in the menu and in the body. The problem is that if a form in the body changes something the menu gets rendered first and then the body controller handles form things and puts data to session, but menu is already done and the session was empty. I cant turn body and menu around becaouse there are other forms that work the other way around. How to deal with this problem? I do want every tile to have its own controller that deals with everything that tile does.

    Read the article

  • How to send exceptions to exceptionController?

    - by ivar
    <bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> <property name="mappedHandlers"> <set> <ref bean="exceptionController" /> </set> </property> <property name="defaultErrorView" value="tiles/content/error" /> </bean> I'm trying to send exceptions to a controller so I can create a redirect. If I comment out the mappedHandlers part then the error tile is displayed but it is only a tile. The rest of the tiles load normally. I need to make a redirect in the controller so I can show an error page not just an error tile. I can't find enough information or an example how the exception invokes some method in exceptionController.

    Read the article

  • SQL SERVER 2008 – 2011 – Declare and Assign Variable in Single Statement

    - by pinaldave
    Many of us are tend to overlook simple things even if we are capable of doing complex work. In SQL Server 2008, inline variable assignment is available. This feature exists from last 3 years, but I hardly see its utilization. One of the common arguments was that as the project migrated from the earlier version, the feature disappears. I totally accept this argument and acknowledge it. However, my point is that this new feature should be used in all the new coding – what is your opinion? The code which we used in SQL Server 2005 and the earlier version is as follows: DECLARE @iVariable INT, @vVariable VARCHAR(100), @dDateTime DATETIME SET @iVariable = 1 SET @vVariable = 'myvar' SET @dDateTime = GETDATE() SELECT @iVariable iVar, @vVariable vVar, @dDateTime dDT GO The same should be re-written as following: DECLARE @iVariable INT = 1, @vVariable VARCHAR(100) = 'myvar', @dDateTime DATETIME = GETDATE() SELECT @iVariable iVar, @vVariable vVar, @dDateTime dDT GO I have started to use this new method to assign variables as I personally find it very easy to read as well write. Do you still use the earlier method to declare and assign variables? If yes, is there any particular reason or just an old routine? I am interested to hear about this. Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: Pinal Dave, PostADay, SQL, SQL Authority, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • Silly Objective-C inheritance problem when using property

    - by Ben Packard
    I've been scratching my head with this for a couple of hours - I haven't used inheritance much. Here I have set up a simple Test B class that inherits from Test A, where an ivar is declared. But I get the compilation error that the variable is undeclared. This only happens when I add the property and synthesize declarations - works fine without them. TestA Header: #import <Cocoa/Cocoa.h> @interface TestA : NSObject { NSString *testString; } @end TestA Implementation is empty: #import "TestA.h" @implementation TestA @end TestB Header: #import <Cocoa/Cocoa.h> #import "TestA.h" @interface TestB : TestA { } @property NSString *testProp; @end TestB Implementation (Error - 'testString' is undeclared) #import "TestB.h" @implementation TestB @synthesize testProp; - (void)testing{ NSLog(@"test ivar is %@", testString); } @end

    Read the article

  • object_getInstanceVariable works for float, int, bool, but not for double?

    - by Russel West
    I've got object_getInstanceVariable to work as here however it seems to only work for floats, bools and ints not doubles. I do suspect I'm doing something wrong but I've been going in circles with this. float myFloatValue; float someFloat = 2.123f; object_getInstanceVariable(self, "someFloat", (void*)&myFloatValue); works, and myFloatValue = 2.123 but when I try double myDoubleValue; double someDouble = 2.123f; object_getInstanceVariable(self, "someDouble", (void*)&myDoubleValue); i get myDoubleValue = 0. If I try to set myDoubleValue before the function eg. double myDoubleValue = 1.2f, the value is unchanged when I read it after the object_getInstanceVariable call. setting myIntValue to some other value before the getinstancevar function above returns 2 as it should, ie. it has been changed. then I tried Ivar tmpIvar = object_getInstanceVariable(self, "someDouble", (void*)&myDoubleValue); if i do ivar_getName(tmpIvar) i get "someDouble", but myDoubuleValue = 0 still! then i try ivar_getTypeEncoding(tmpIvar) and i get "d" as it should be. So to summarize, if typeEncoding = float, it works, if it is a double, the result is not set but it correctly reads the variable and the return value (Ivar) is also correct. I must be doing something basic wrong that I cant see so I'd appreciate if someone could point it out.

    Read the article

  • How are declared private ivars different from synthesized ivars?

    - by lemnar
    I know that the modern Objective-C runtime can synthesize ivars. I thought that synthesized ivars behaved exactly like declared ivars that are marked @private, but they don't. As a result, come code compiles only under the modern runtime that I expected would work on either. For example, a superclass: @interface A : NSObject { #if !__OBJC2__ @private NSString *_c; #endif } @property (nonatomic, copy) NSString *d; @end @implementation A @synthesize d=_c; - (void)dealloc { [_c release]; [super dealloc]; } @end and a subclass: @interface B : A { #if !__OBJC2__ @private NSString *_c; #endif } @property (nonatomic, copy) NSString *e; @end @implementation B @synthesize e=_c; - (void)dealloc { [_c release]; [super dealloc]; } @end A subclass can't have a declared ivar with the same name as one of its superclass's declared ivars, even if the superclass's ivar is private. This seems to me like a violation of the meaning of @private, since the subclass is affected by the superclass's choice of something private. What I'm more concerned about, however, is how should I think about synthesized ivars. I thought they acted like declared private ivars, but without the fragile base class problem. Maybe that's right, and I just don't understand the fragile base class problem. Why does the above code compile only in the modern runtime? Does the fragile base class problem exist when all superclass instance variables are private?

    Read the article

  • UITableView: Juxtaposing row, header, and footer insertions/deletions

    - by jdandrea
    Consider a very simple UITableView with one of two states. First state: One (overall) table footer One section containing two rows, a section header, and a section footer Second state: No table footer One section containing four rows and no section header/footer In both cases, each row is essentially one of four possible UITableViewCell objects, each containing its own UITextField. We don't even bother with reuse or caching, since we're only dealing with four known cells in this case. They've been created in an accompanying XIB, so we already have them all wired up and ready to go. Now consider we want to toggle between the two states. Sounds easy enough. Let's suppose our view controller's right bar button item provides the toggling support. We'll also track the current state with an ivar and enumeration. To be explicit for a sec, here's how one might go from state 1 to 2. (Presume we handle the bar button item's title as well.) In short, we want to clear out our table's footer view, then insert the third and fourth rows. We batch this inside an update block like so: // Brute forced references to the third and fourth rows in section 0 NSUInteger row02[] = {0, 2}; NSUInteger row03[] = {0, 3}; [self.tableView beginUpdates]; state = tableStateTwo; // 'internal' iVar, not a property self.tableView.tableFooterView = nil; [self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObjects: [NSIndexPath indexPathWithIndexes:row02 length:2], [NSIndexPath indexPathWithIndexes:row03 length:2], nil] withRowAnimation:UITableViewRowAnimationFade]; [self.tableView endUpdates]; For the reverse, we want to reassign the table footer view (which, like the cells, is in the XIB ready and waiting), and remove the last two rows: // Use row02 and row03 from earlier snippet [self.tableView beginUpdates]; state = tableStateOne; self.tableView.tableFooterView = theTableFooterView; [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects: [NSIndexPath indexPathWithIndexes:row02 length:2], [NSIndexPath indexPathWithIndexes:row03 length:2], nil] withRowAnimation:UITableViewRowAnimationFade]; [self.tableView endUpdates]; Now, when the table asks for rows, it's very cut and dry. The first two cells are the same in both cases. Only the last two appear/disappear depending on the state. The state ivar is consulted when the Table View asks for things like number of rows in a section, height for header/footer in a section, or view for header/footer in a section. This last bit is also where I'm running into trouble. Using the above logic, section 0's header/footer does not disappear. Specifically, the footer stays below the inserted rows, but the header now overlays the topmost row. If we switch back to state one, the section footer is removed, but the section header remains. How about using [self.tableView reloadData] then? Sure, why not. We take care not to use it inside the update block, per Apple's advisement, and simply add it after endUpdates. This time, good news! The section 0 header/footer disappears. :) However ... Toggling back to state one results in a most exquisite mess! The section 0 header returns, only to overlay the first row once again (instead of appear above it). The section 0 footer is placed below the last row just fine, but the overall table footer - now reinstated - overlays the section footer. Waaaaaah … now what? Just to be sure, let's toggle back to state two again. Yep, that looks fine. Coming back to state one? Yecccch. I also tried sprinkling in a few other stunts like using reloadSections:withRowAnimation:, but that only serves to make things worse. NSRange range = {0, 1}; NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:range]; ... [self.tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationFade]; Case in point: If we invoke reloadSections... just before the end of the update block, changing to state two hides the first two rows from view, even though the space they would otherwise occupy remains. Switching back to state one returns section 0's header/footer to normal, but those first two rows remain invisible. Case two: Moving reloadSections... to just after the update block but before reloadData results in all rows becoming invisible! (I refer to the row as being invisible because, during tracing, tableView:cellForRowAtIndexPath: is returning bona-fide cell objects for those rows.) Case three: Moving reloadSections... after tableView:cellForRowAtIndexPath: brings us a bit closer, but the section 0 header/footer never returns when switching back to state one. Hmm. Perhaps it's a faux pas using both reloadSections... and reloadData, based on what I'm seeing at trace-time, which brings us to: Case four: Replacing reloadData with reloadSections... outright. All cells in state two disappear. All cells in state one remain missing as well (though the space is kept). So much for that theory. :) Tracing through the code, the cell and view objects, as well as the section heights, are all where they should be at the opportune times. They just aren't rendering sanely. So, how to crack this case? Clues welcome/appreciated!

    Read the article

  • What is the standard for naming variables and why?

    - by P.Brian.Mackey
    I'm going through some training on objective-c. The trainer suggests setting single character parameter names. The .NET developer in me is crying. Is this truly the convention? Why? For example, @interface Square : NSObject { int size; } -(void)setSize: (int)s; I've seen developers using underscores int _size to declar variables (I think people call the variable declared in @interface ivar for some unknown reason). Personally, I prefer to use descriptive names. E.G. @interface Square : NSObject { int Size; } -(void)setSize: (int)size; C, like C# is case sensitive. So why don't we use the same convention as .NET?

    Read the article

  • How to create a view controller that supports both landscape and portrait, but does not rotate between them (keeps its initial orientation)

    - by Joshua J. McKinnon
    I want to create a view controller that supports both landscape and portrait orientations, but that can not rotate between them - that is, the view should retain its original orientation. I have tried creating an ivar initialOrientation and setting it in -viewDidAppear with initialOrientation = self.interfaceOrientation; then - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == initialOrientation); } But that causes confusing problems (presumably because -shouldAutorotateToInterfaceOrientation is called before -viewDidAppear). How can I lock the orientation to its original orientation?

    Read the article

  • Few iPhone noob questions

    - by mshsayem
    Why should I declare local variables as 'static' inside a method? Like: static NSString *cellIdentifier = @"Cell"; Is it a performance advantage? (I know what 'static' does; in C context) What does this syntax mean?[someObj release], someObj = nil; Two statements? Why should I assign nil again? Is not 'release' enough? Should I do it for all objects I allocate/own? Or for just view objects? Why does everyone copy NSString, but retains other objects (in property declaration)? Yes, NSStrings can be changed, but other objects can be changed also, right? Then why 'copy' for just NSString, not for all? Is it just a defensive convention? Shouldn't I release constant NSString? Like here:NSString *CellIdentifier = @"Cell"; Why not? Does the compiler allocate/deallocate it for me? In some tutorial application I observed these (Built with IB): Properties(IBOutlet, with same ivar name): window, someLabel, someTextField, etc etc... In the dealloc method, although the window ivar was released, others were not. My question is: WHY? Shouldn't I release other ivars(labels, textField) as well? Why not? Say, I have 3 cascaded drop-down lists. I mean, based on what is selected on the first list, 2nd list is populated and based on what is selected on the second list, 3rd list is populated. What UI components can reflect this best? How is drop-down list presented in iPhone UI? Tableview with UIPicker? When should I update the 2nd, 3rd list? Or just three labels which have touch events? Can you give me some good example tutorials about Core-Data? (Not just simple data fetching and storing on 2/3 tables with 1/2 relationship) How can I know whether my app is leaking memory? Any tools?

    Read the article

  • obj-c, how do I create a property and synthesize an NSUInteger ?

    - by Jules
    I'm having some trouble using an NSUInteger, I've tried various things and googled, but not found the answer ? I have... I also tried ... nonatomic, retain @property (readwrite, assign) NSUInteger *anAmount; @synthesize anAmount; error: type of property 'anAmount' does not match type of ivar 'anAmount' Also when I release it in dealloc I get a warning.. warning: invalid receiver type 'NSUInteger'

    Read the article

  • iPhone dev - viewDidUnload subviews

    - by Mk12
    I'm having a hard time undestand a couple of the methods in UIViewController, but first I'll say what I think they are meant for (ignoring interface builder because I'm not using it): -init: initialize non view-related stuff that won't need to be released in low memory situations (i.e. not objects or objects that can't be recreated easily). -loadView: create the view set the [self view] property. -viewDidLoad: Create all the other view elements -viewDidUnload: Release objects created in -viewDidLoad. didReceiveMemoryWarning: Low-memory situation, release unnecessary things such as cached data, if this view doesn't have a superview then the [super didReceiveMemoryWarning] will go on to release (unload) the view and call -viewDidUnload. -dealloc: release everything -viewWillAppear:, -viewDidAppear:, -viewWillDisappear:, -viewDidDisappear: self-explanatory, not necessary unless you want to respond (do something) to those events. I'm not sure about a couple of things. First, the Apple docs say that when -viewDidUnload is called, the view has already been released and set to nil. Will -loadView get called again to recreate the view later on? There's a few things I created in -viewDidLoad that I didn't make a ivar/property for because there is no need and it will be retained by the view (because they are subviews of it). So when the view is released, it will release those too, right? When the view is released, will it release all its subviews? Because all the objects I created in -viewDidLoad are subviews of [self view]. So if they already get released why release them again in -viewDidUnload? I can understand data that is necessary when the view is visible being loaded and unloaded in these methods, but like I asked, why release the subviews if they already get released? EDIT: After reading other questions, I think I might have got it (my 2nd question). In the situation where I just use a local variable, alloc it, make it a subview and release, it will have a retain count of 1 (from adding it as a subview), so when the view is released it is too. Now for the view elements with ivars pointing to them, I wasn't using properties because no outside class would need to access them. But now I think that that's wrong, because in this situation: // MyViewController.h @interface MyViewController : UIViewController { UILabel *myLabel; } // MyViewController.m . . . - (void)viewDidLoad { myLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 10)]; [myLabel setText:@"Foobar"]; [[self view] addSubview:myLabel]; } - (void)viewDidUnload [ // equivalent of [self setMyLabel:nil]; without properties [myLabel release]; myLabel = nil; } In that situation, the label will be sent the -release message after it was deallocated because the ivar didn't retain it (because it wasn't a property). But with a property the retain count would be two: the view retaining it and the property. So then in -viewDidUnload it will get deallocated. So its best to just always use properties for these things, am I right? Or not? EDIT: I read somewhere that -viewDidLoad and -viewDidUnload are only for use with Interface Builder, that if you are doing everything programmatically you shouldn't use them. Is that right? Why?

    Read the article

  • Objective-C: how to prevent abstraction leaks

    - by iter
    I gather that in Objective-C I must declare instance variables as part of the interface of my class even if these variables are implementation details and have private access. In "subjective" C, I can declare a variable in my .c file and it is not visible outside of that compilation unit. I can declare it in the corresponding .h file, and then anyone who links in that compilation unit can see the variable. I wonder if there is an equivalent choice in Objective-C, or if I must indeed declare every ivar in the .h for my class. Ari.

    Read the article

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