Posts

css - Why string assignment in javaScript is case insensitive? -

i have create simple html page 1 button change color when clicked: <!doctype html> <html> <head> <title></title> </head> <body> <button onclick="if (this.style.backgroundcolor == 'red') { this.style.backgroundcolor = 'green' } else { this.style.backgroundcolor = 'red' } alert(this.style.backgroundcolor)"> ok </button> </body> </html> it surprising me alert(this.style.backgroundcolor) return red instead of red . why? there assignment this.style.backgroundcolor = 'red' , in red start capital letter. css styles aren't saved literal strings, they're converted internal, canonical representation of style. color styles case-insensitive, , canonical representation lowercase.

python - Django template with External CSS ; using {%static%} for images in a division -

i using django web app , encountered no image shown problem following code: <div class="hexagon-in2" style="background:url(static/images/gallery/2.jpg)"> please situation. if have defined media_url in settings.py <div class="hexagon-in2" style="background:url("{{ media_url }}/images/gallery/2.jpg)"> // or static_url if use static files storing images , media

javascript - Sencha app build native overwriting our custom code -

we have been working in application quite time developed using sencha touch 2. we test , debug code using chrome , ripple. the problem facing added custom search , grouping logic 1 of our lists views. when tested , debugged using chrome worked expected, used command package in order integrate cordova , generate android , ios applications. used following command: sencha app build native for reason, code generated command overwriting our custom search , grouping javascript code. why happening. thing not sencha tool not working correctly rather doing wrong causing happen. we clueless on reason be. can throw light this? why our custom grouper , filtering functions being overwritten when packaging application? bellow extract on how define grouping method in our store. again, when try in our debug environment works correctly. problem when package using above command, grouper function gets replaced default sencha touch 2 grouping function returns first character of string. ...

Codeigniter array issue -

i'm trying loop through array , insert values database. table looks this: hours_day hours_open hours_close my form enables user select day, opening time , closing time. there plus button adds day below it, user can choose whichever days wish. means select box names arrays, i.e. hours_day[] my model looks this: $hours = array( 'hours_day' => $this->input->post('venue_hours_day'), 'hours_opening' => $this->input->post('venue_hours_open'), 'hours_closing' => $this->input->post('venue_hours_close'), ); so have array ($hours) arrays inside of (hours_day, hours_opening, hours_closing). how loop through add database? you can use : $post_day = $this->input->post('venue_hours_day'); $post_opening = $this->input->post('venue_hours_open'); $post_closing = $this->input->post('venue_hours_closing'); $count = count($post_day); $results = a...

heroku - ckeditor rails gem adds base url to assets -

i using ckeditor gem : rails 4 , assets_sync , heroku following url: http://www.baseurl.com//mybucket.s3.amazonaws.com/assets/ckeditor/config-77c214941cb7b15940a497f28f333f30.js while should be //mybucket.s3.amazonaws.com/assets/ckeditor/config-77c214941cb7b15940a497f28f333f30.js as defined in assets_host config.action_controller.asset_host = "//#{s3_bucket}.s3.amazonaws.com" i defined: var ckeditor_basepath = "http://mybucket.s3.amazonaws.com/assets/ckeditor/"; but doesn't either. why baseurl? thanks lot help. upgrading ckeditor gem version 4.0.11 fix issue.

javascript - addClass("test") give error: TypeError: undefined is not a function -

in console have: $(".mycssclass")[0].parentnode <li><span class="mycssclass">some text</span></li> i want add css class parent span , tag <li> i tried this: $(".mycssclass")[0].parentnode.addclass("test") typeerror: undefined not function i use jquery 1.5.2 addclass method of jquery objects. when use $(".mycssclass")[0] , have real element, not jquery wrapper. then, can: wrap jquery object again: $($(".mycssclass")[0].parentnode).addclass("test") only work jquery objects: $(".mycssclass").eq(0).parent().addclass("test") add class plain javascript (not supported on old browsers): $(".mycssclass")[0].parentnode.classlist.add("test")

ruby - What is the correct Rails association for this design? -

environment: ruby 2.0.0, rails 4.1, windows 8.1, devise i confused how handle issue. have items stored @ location until checked out user. want able query item , determine location or user holds it. so, item belong either location or user. each location , each user can have many items. this large library system book in 1 of several buildings , patron check out books each of buildings. @ point, i'd locate book either in building or patron. my confusion stems fact item associated either of 2 different models @ different points in time. @ location or held user, , should never both. what association or design work this? thanks.... i use polymorphic association this, try this: item.rb belongs_to :check_outer, :polymorphic => true user.rb has_many :items, :as => :check_outer location.rb has_many :items, :as => :check_outer you need proper database columns support this. on items table, add check_outer_type:string , check_outer_i...