Posts

Bash read file to an array based on two delimiters -

i have file need parse array want brief portion of each line , first 84 lines. line maybe: >mt gi... and want mt entered array. other times might this: >gl000207.1 dn... and need gl000207.1 i thinking might able set 2 delimiters (one being '>' , other being ' ' whitespace) not sure how go it. have read other peoples posts internal field separator not sure of how work. think perhaps might work though? desiredarray=$(echo file.whatever | tr ">" " ") x in $desiredarray echo > $x done any suggestions? how about: head -84 <file> | awk '{print $1}' | tr -d '>' head takes first lines of file, awk strips off first space , after it, , tr gets rid of '>'.

mongoid - Why is 'Delayed::Job.all' not being recognized in the Ruby on Rails console? -

i'm trying check see in delayed job queue when run delayed::job.all in console, nameerror: uninitialized constant delayed error. according readme on github page, should able run normal delayed_job commands. i'm using delayed_job_mongoid gem version 1.0.8. here gemfile: gem 'rails', '3.2.6' gem 'unicorn' gem 'mongoid', '3.0.0.rc' gem 'bson_ext' # mongoid-related gem 'bcrypt-ruby' # encryption gem 'jquery-rails' gem 'haml' gem 'delayed_job_mongoid', :git => 'https://github.com/asavartsov/delayed_job_mongoid.git' group :assets gem 'uglifier', '>= 1.0.3' end group :development gem 'rspec-rails' gem 'guard-rspec' end group :test gem 'cucumber-rails', require: false gem 'capybara' gem 'database_cleaner' gem 'factory_girl_rails' gem 'mongoid-rspec' gem 'spork' gem 'guard-...

iphone - How to set high score and only changes if it is surpassed -

like game helicopter or left 4 dead survival mode want score stay , change if score surpassed. here code have far. ./m file _score = 0; _oldscore = -1; self.scorelabel = [cclabelttf labelwithstring:@"" dimensions:cgsizemake(100, 50) alignment:uitextalignmentright fontname:@"marker felt" fontsize:32]; _scorelabel.position = ccp(winsize.width - _scorelabel.contentsize.width, _scorelabel.contentsize.height); _scorelabel.color = ccc3(255,0,0); [self addchild:_scorelabel z:1]; if (_score != _oldscore) { _oldscore = _score; [_scorelabel setstring:[nsstring stringwithformat:@"score%d", _score]]; } and .h file int _score; int _oldscore; cclabelttf *_scorelabel; i tried put _score = [[nsuserdefaults standarduserdefaults] integerforkey:@"score"]; [[nsuserdefaults standarduserdefaults] setinteger:_oldscore forkey:@"score"]; ...

classpath - Flyway not finding the migrations in a jar file -

i implemented flyway in number of applications support , worked dream. however deployed applications test environment migrations stopped working. after investigation found migrations not being located flyway when loaded jar file, when not zipped (like when working in eclipse or if extract jar classpath) works expected. due plugin architecture of applications not in position use "default" setting , such setting flyway object this: flyway flyway = new flyway(); flyway.setdatasource(datasource); flyway.setbasedir("za/co/company/application/plugin1/db/migration"); flyway.settable(tablename); flyway.setbasepackage("za.co.company.application.plugin1.db.migration"); flyway.init(); flyway.migrate(); if 1 unzip jar file sql files located in: za/co/company/application/db/migration as mentioned know migrations work, not when in jar file. code above executes perfectly, it's there no sql files found run part of migration. although originaly develo...

html output formatting php -

i trying format html output db using php , here's problem: how should formated: ... <li> <div class="row-wrapper"> <div class="some-class-1">array-element-1</div> <div class="some-class-1">array-element-2</div> <div class="some-class-1">array-element-3</div> <div class="some-class-2">array-element-4</div> </div> <div class="row-wrapper"> <div class="some-class-1">array-element-5</div> <div class="some-class-1">array-element-6</div> <div class="some-class-1">array-element-7</div> <div class="some-class-2">array-element-8</div> </div> <div class="row-wrapper"> <div class="some-class-1">array-element-9</div> <div class="some-cl...

html - two div boxes [1st float, 2nd clear], margin on 2nd doesn't seem to push off first -

in code below have 2 div boxes. first float:left, second has clear:left sits below first. question why margin-top:20px not push off first div? <head> <style> div { width:100px; height:100px; background-color:green; } #box1 { float:left; } #box2 { background-color:red; clear:left; margin-top:20px; } </style> </head> <body> <div id="box1"></div> <div id="box2"></div> </body> yeah, it's confusing. read css spec on collapsing margins . specifically, "if top , bottom margins of element clearance adjoining, margins collapse adjoining margins of following siblings resulting margin not collapse bottom margin of parent block." to effect you're looking need apply margin element doesn't have clearance, in case first div, this: http://jsfiddle.net/6bfyu/

jsf - Semantics of "?faces-redirect=true" in <commandlink action=...> and why not use it everywhere -

i understand semantics behind appending "?faces-redirect=true" in action property of <h:commandlink> tag in jsf2.0. whether or out it, application indeed navigates target page specified in action. @ first glance seems effect cosmetic, i.e. provide feedback user (if looking @ browser's visited url) has moved new page. if innocuous , side-effects-free cannot see why not default behaviour. suspect has post-based mechanism of jsf2.0. 've noticed when browsing through jsf application urls 1 sees @ browser (when ?faces-redirect=true not used) ones of "previous" "page". meta-nb. behind firewall , plagued "so requires external javascript domain" issue apologize absence of formatting. provide feedback on answers in few hours, when can access domain. page-to-page navigation should not performed using post @ all. should using normal <h:link> or <h:button> instead of <h:commandlink> or <h:commandbutton...