Search Results

Search found 8 results on 1 pages for 'michaelmichael'.

Page 1/1 | 1 

  • Mapping a Piped Shell Command in Vim

    - by michaelmichael
    In a previous question I asked about mapping evaluated code to a new window in MacVim. I got a great solution, but it presented another question: How can I map a key command in my .vimrc that involves piping output in the shell? As a simple example, let's say I wanted to pipe the results of ls -a to a new MacVim window. From the Vim command line I can enter !ls -a | mvim -, and the results will appear in a new window. Great! Now, I add that to my .vimrc: nmap <Leader>r :w !ls | mvim<CR> Vim now throws an error every time I try to source my .vimrc, which reads as follows: E492: Not an editor command: mvim<CR> Any ideas on how to overcome this?

    Read the article

  • Bash Shell Hangs on ?+Tab-complete

    - by michaelmichael
    I often use tab completion in Bash when completing directories, but I find that it hangs for an unacceptable amount of time if I accidentally include a question mark in the directory. I'd like to know why and how to prevent it if possible. Here's the scenario: I start a command and use the ~ key to represent home: ls ~?Desktop/co Oops! I held down the Shift for a split-second too long. I had intended for ? to be /. But (oh no!) muscle memory has already kicked in. I've hit the Tab before I noticed the mistake. Now I'm stuck waiting for the shell to beep angrily at me. Usually a minute or two. What happened? Why did the question mark cause it to hang and eventually beep? Any way to stop it from hanging?

    Read the article

  • Excel - Dynamic row reference based on the row I paste a formula into?

    - by michaelmichael
    I have a simple, oft-used formula that I paste as plain text into spreadsheets I receive. It looks something like this: =IF(D8="FOO", "BAR", "BAZ") It looks in D8 for the word "FOO". If it finds it it will show "BAR". If it doesn't it will show "BAZ" It works great. The problem is I have to paste this formula as plain text into many spreadsheets. It should ALWAYS look in column D for "FOO", however I don't always want it to look in row 8. I'd like it to look at whatever row I'm pasting it into. For example, if I pasted the above formula into row 25, say, I would like it to automatically change to this: =IF(D25="FOO", "BAR", "BAZ") Is there any way to achieve this?

    Read the article

  • Excel - Dynamic reference based on the row I paste into?

    - by michaelmichael
    I have a simple, oft-used formula that I paste into spreadsheets I receive. It looks like this: =IF(AND(D8="COMPLETE",E8=""),A8,"") It looks in D8 for the word "COMPLETE" and checks that E8 is blank. If both conditions are fulfilled it grabs the contents of A8. It works fine. The only problem with this is that I don't always paste it into row 8. Every spreadsheet is different. I usually end up spending a few seconds making the formula fit the current spreadsheet I'm working on by dragging the cell references to the appropriate row. Hence, my question: Is there a way to make an absolute row reference based on whatever row I paste into? For example, if I paste the above formula into a cell in row 25, the formula would automatically look like this: =IF(AND(D25="COMPLETE", E25=""), A25, "")

    Read the article

  • Basic Array Iteration in Ruby

    - by michaelmichael
    What's a better way to traverse an array while iterating through another array? For example, if I have two arrays like the following: names = [ "Rover", "Fido", "Lassie", "Calypso"] breeds = [ "Terrier", "Lhasa Apso", "Collie", "Bulldog"] Assuming the arrays correspond with one another - that is, Rover is a Terrier, Fido is a Lhasa Apso, etc. - I'd like to create a dog class, and a new dog object for each item: class Dog attr_reader :name, :breed def initialize(name, breed) @name = name @breed = breed end end I can iterate through names and breeds with the following: index = 0 names.each do |name| dog = Dog.new("#{name}", "#{breeds[index]}") index = index.next end However, I get the feeling that using the index variable is the wrong way to go about it. What would be a better way?

    Read the article

  • Interacting With Class Objects in Ruby

    - by michaelmichael
    How can I interact with objects I've created based on their given attributes in Ruby? To give some context, I'm parsing a text file that might have several hundred entries like the following: ASIN: B00137RNIQ -------------------------Status Info------------------------- Upload created: 2010-04-09 09:33:45 Upload state: Imported Upload state id: 3 I can parse the above with regular expressions and use the data to create new objects in a "Product" class: class Product attr_reader :asin, :creation_date, :upload_state, :upload_state_id def initialize(asin, creation_date, upload_state, upload_state_id) @asin = asin @creation_date = creation_date @upload_state = upload_state @upload_state_id = upload_state_id end end After parsing, the raw text from above will be stored in an object that look like this: [#<Product:0x00000101006ef8 @asin="B00137RNIQ", @creation_date="2010-04-09 09:33:45 ", @upload_state="Imported ", @upload_state_id="3">] How can I then interact with the newly created class objects? For example, how might I pull all the creation dates for objects with an upload_state_id of 3? I get the feeling I'm going to have to write class methods, but I'm a bit stuck on where to start.

    Read the article

  • What's the Difference Between These Two Ruby Class Initialaztion Definitions?

    - by michaelmichael
    I'm working through a book on Ruby, and the author used a slightly different form for writing a class initialization definition than he has in previous sections of the book. It looks like this: class Ticket attr_accessor :venue, :date def initialize(venue, date) self.venue = venue self.date = date end end In previous sections of the book, it would've been defined like this: class Ticket attr_accessor :venue, :date def initialize(venue, date) @venue = venue @date = date end end Is there any functional difference between using the setter method, as in the first example vs. using the instance variable in the second? They both seem to work. Even mixing them up seems to work: class Ticket attr_accessor :venue, :date def initialize(venue, date) @venue = venue self.date = date end end

    Read the article

  • What's the Difference Between These Two Ruby Class Initialization Definitions?

    - by michaelmichael
    I'm working through a book on Ruby, and the author used a slightly different form for writing a class initialization definition than he has in previous sections of the book. It looks like this: class Ticket attr_accessor :venue, :date def initialize(venue, date) self.venue = venue self.date = date end end In previous sections of the book, it would've been defined like this: class Ticket attr_accessor :venue, :date def initialize(venue, date) @venue = venue @date = date end end Is there any functional difference between using the setter method, as in the first example, vs. using the instance variable as in the second? They both seem to work. Even mixing them up works: class Ticket attr_accessor :venue, :date def initialize(venue, date) @venue = venue self.date = date end end

    Read the article

1