Posts

ios - How can I animate the height of a CALayer with the origin coming from the bottom instead of the top? -

i want animate simple calayer move , down in response incoming data (bars on graphic equaliser) the calayer should remain fixed along bottom , move , down height animated. can advise on best way achieve without having animate origin y coord height? if want layer grow , shrink bottom, should set own anchorpoint on layer bottom. anchor point specified in layers unit coordinate space both x , y range 0 1 inside of bounds, no matter size. yourlayer.anchorpoint = cgpointmake(0.5, 1.0); then animation, animate bounds (or better, can animate "bounds.size.height" , since height changing): // set new bounds of yourlayer here... cabasicanimation *grow = [cabasicanimation animationwithkeypath:@"bounds.size.height"]; grow.fromvalue = @0; // no height grow.tovalue = @200; // height of 200 grow.duration = 0.5; // add additional animation configuration here... [yourlayer addanimation:grow forkey:@"grow height of layer"]; you can read m...

Copy constructor in polymorphism in C# -

please first take @ simple code; this base class: public class baseclass { public baseclass() { } public baseclass(baseclass b) { } public virtual string getmsg() { return "base"; } } and derived one: public class drivenclass : baseclass { public string msg { get; set; } public drivenclass(string msg) { msg = msg; } public drivenclass(drivenclass d) { msg = d.msg; } public override string getmsg() { return msg; } } and test: public partial class form1 : form { public form1() { initializecomponent(); } public baseclass b { get; set; } public drivenclass d { get; set; } private void button1_click(object sender, eventargs e) { d = new drivenclass("driven"); b = new baseclass(d); messagebox.show("b:" + b.getmsg() + "\nd:" + d.getmsg()); } } now question sh...

html - Bootstrap form formatting not applying -

i trying add form subscription emails instance variable @premail in embedded ruby for reason form not have bootstrap styling when load on localhost. i've tried several things can't form bootstrap input form. here code form: <div class="container-form"> <%= form_for @premail, html: {class: "form-horizontal home-form", role: "form"} |f| %> <% if @premail.errors.any? %> <h2><%= pluralize(@premail.errors.count, "error") %> prohibited link being saved:</h2> <ul> <% @premail.errors.full_messages.each |msg| %> <li><%= msg %></li> <% end %> </ul> <% end %> <div class="form-group"> <p> stay updated our launch! </p> ...

c# - asp.net edit text and save it to database -

so got text in div box on page. want make editable , save changes button click. i know how make text in div box editable how save changes database? , put it? $("#bearbeiten").click(function() { $("#beschreibung").attr("contenteditable", "true");)} to data use ajax , tried data , post database either did wrong or not right way post data. var versionid = $(this).data("versionid"); $.ajax({ datatype: "json", url: "api/beschreibung/gettext?xversionid=" + versionid, type: "get" hope can me. summarized: how data , how change it? you should: create form ; post data webserver (you can use jquery that, suggest simple form submit button; handle post data on server. seems using mvc. there tutorials all on internet ; get posted data , send database. can use entity framework that, or ado.net.

java - What is difference between Collection.stream().forEach() and Collection.forEach()? -

i understand .stream() , can use chain operations .filter() or use parallel stream. difference between them if need execute small operations (for example, printing elements of list)? collection.stream().foreach(system.out::println); collection.foreach(system.out::println); for simple cases such 1 illustrated, same. however, there number of subtle differences might significant. one issue ordering. stream.foreach , order undefined . it's unlikely occur sequential streams, still, it's within specification stream.foreach execute in arbitrary order. occur in parallel streams. contrast, iterable.foreach executed in iteration order of iterable , if 1 specified. another issue side effects. action specified in stream.foreach required non-interfering . (see java.util.stream package doc .) iterable.foreach potentially has fewer restrictions. collections in java.util , iterable.foreach use collection's iterator , of designed fail-fast , throw concurrentmodific...

php - how to add posts with image programmatically in wordpress -

this code add post programmatically in wordpress require(dirname(__file__) . '/wp-load.php'); global $user_id; $new_post = array( 'post_title' => 'table tennis', 'post_content' => 'table tennis or ping-pong sport in 2 or 4 players hit lightweight ball , forth using table tennis racket. game takes place on hard table divided net. except initial serve, players must allow ball played toward them 1 bounce on side of table , must return bounces on opposite side. points scored when player fails return ball within rules.', 'post_status' => 'publish', 'post_date' => date('y-m-d h:i:s'), 'post_author' => $user_id, 'post_type' => 'post', 'post_category' => array(2), ); $post_id = wp_insert_post($new_post); how add image post? i new wordpress,thanks in advance.. this upload file using wordpress , insert on post featured imag...

java - @Transactional in the controller -

first of want mention agree make service layer transactional, world not perfect, , right i´m in middle of situation. have been assigned wonderful project legacy code of 4+ years. thing developers did not follow pattern introduce bussines logic can image multiples services call controller , after call private method controller. no budget refactor, , have many issues acid solution found make controllers transactional , @ least have full rollback if in middle of request/response go wrong. problem cannot make works. describe configuration see if can me out guys. have dispatcherservlet invoke webmvc-config.xml have declaration of controllers <context:component-scan base-package="com.greenvalley.etendering.web.controller**" use-default-filters="false"> <context:include-filter expression="org.springframework.stereotype.controller" type="annotation"/> </context:component-scan> then contextconfiguration invoke ...