Posts

C# Visual Studio 2015 - Automatic jump into brackets -

this first question on stackoverflow, here goes: i've got annoying problem/feature in visual studio 2015. problem every time create if statement, for, while, etc. autocomplete (tab-tab). when go line of end bracket , try create new line (simple press of enter) right after it, text cursor jump brackets, instead of making new line. i've looked far wide trying disable "feature" incredibly annoying. have not been able find information on anywhere, asking question. thank you! how produce problem: anywhere in c# project, make new if statement (while, for, etc. can used too). navigate after end bracket. press enter make new line. the marker have jumped inside of statement, instead of making new line. the 'problem' when using tab key activating snippets feature. after typing tab in 'snippet editing' mode, each tab (and shift + tab ) used navigate placeholders defined snippet. in snippet mode, enter key takes wherever person de...

ruby on rails - Update ElasticSearch mapping in production (Tire) -

i have clear understanding on how deal following scenario: i'm adding or removing attribute activerecord model, want update mapping in elasticsearch, in production. from understood, should... 1- create new index , import mysql is right command? rake environment tire:import class='bow' index='new-bows' create right mapping, should have updated mapping in model, right? 2- delete old mapping , create alias named bows new-bows i that, correct? old_index_name = bow.tire.index.name bow.tire.index.delete alias = tire::alias.new alias.name(old_index_name) alias.index('new-bows') alias.save 3- restart app am missing something, or there simpler way achieve want using tire? at point should delete old index? before creating alias same name, or can after? you should keep old index around until you're sure new index 100% want. can flip alias if not case. there's integration test in tire test suite "flipping aliases...

css - Scaling sprites below 100% alters their position -

i've followed tutorial on scaling sprites http://tobyj.net/responsive-sprites/ - when set images 100% fine when use value of 35% in media queries sprite images displaced. any ideas why? site here http://edharrisondesign.com/pocketpictograms/ here's css: #icon-container { position: absolute; top: 50%; margin-top: -225px; left: 50%; width: 400px; margin-left: -200px; } .icon img{ padding-bottom: 150%; } /*set max-width width of individual sprites:*/ .stretchy { display:block; position:relative; overflow:hidden; width: 100%; max-width:400px; margin: 0 auto; } .stretchy .spacer { width: 100%; height: auto; } .stretchy .sprite { position:absolute; top:0; left:0; max-width:none; max-height:100%; } .stretchy .sprite.s2 {left:-100%;} .stretchy .sprite.s3 {left:-200%;} .stretchy .sprite.s4 {left:-300%;} .stretchy .sprite.s5 {left:-400%;} .stretchy .sprite.s6 {left:-500%;} .stretchy .sprite.s7 ...

javascript - How to get HTML5 Range Slider's value in PHP? -

i have html5 range slider. can send value php? send email value. html: <div class="unit"> <div class="slider-group"> max value: <label id="1-h"></label> </div> <div id="slider-1-h"></div> </div> javascript: $(function() { $( '#slider-1-h' ).slider({ range: "min", min: 0, max: 300, value: 99, slide: function( event, ui ) { $( '#1-h' ).html( ui.value ); } }); $( '#1-h' ).html( $( '#slider-1-h' ).slider( 'value' ) ); }); ok fine. , now, can send this? have no input box. can`t use $_post[""] or? :/ in jquery add: change: function(event, ui) { $('#slidervalue').attr('value', ui.value); } in form add: <input type="hidden" name="slidervalue" id="slidervalue" value=...

c++ - What should I replace num with? -

i'm trying write program determine whether both sum , product of 2 integers either or odd. everything seems fine, except when run program, comes out: "the product of 2 , 3 5 , even." even? why when should odd? understanding, reading num since put (num%2==0) , that's why saying even. how can make read outcome of 2 numbers (sum/product)? #include<iostream> using namespace std; int main () { int num; cout << "please enter integer: "; cin >> num; int num2; cout << "please enter integer: "; cin >> num2; if ( num % 2 == 0 ) { cout << "the product of " << num << " , " << num2 << " " << num*num2 << " , even." << endl; cout << "the sum of " << num << " , " << num2 << " " << n...

Why isn't it possible to use prepared statements (based on ALTER TABLE) to set default values of MySQL fields from PHP? -

i'm writing php code change default value of varchar field in mysql database. in order code secure, use prepared statement, reason seemingly impossible php/mysql accept in particular situation, why that? (i'm using php 5.5.11) here code using prepared statements, not work (the mysqli_stmt_execute() call returns null, , default value of field remains unaltered): $new_field_default_value = 'test'; $field_modification_sql_command = "alter table mytable alter column mycolumn set default ?"; $stmt = mysqli_stmt_init($db_conn_handle); mysqli_stmt_prepare($stmt, $field_modification_sql_command); mysqli_stmt_bind_param($stmt, 's', $new_field_default_value); $temp_db_res = mysqli_stmt_execute($stmt); mysqli_stmt_close($stmt); here (insecure) code using concatenation , pure query execution, work (the mysqli_query() call returns true, , default value of field indeed altered): $new_field_default_value = 'test'; $field_modification_sql_command...

jquery - Javascript Not Running or Working? -

Image
i have project includes login form password meter. followed a tutorial cssdeck , tried copy-pasting code jsfiddle see results. works on demo, not on my jsfiddle . issue password meter not working. have read through javascript , can not see wrong it. suggestions nice. why exact same code not work in fiddle? $(function(){ var pass1 = $('#password1'), pass2 = $('#password2'), email = $('#email'), form = $('#main form'), arrow = $('#main .arrow'); // empty fields on load $('#main .row input').val(''); // handle form submissions form.on('submit', function(e){ // entered correctly? if ($('#main .row.success').length == $('#main .row').length) { // yes! alert("thank trying out demo!"); e.preventdefault(); // remove allow actual submission } else { // no. preven...