Posts

Showing posts from June, 2015

jquery ui - How react works with javascript ui components that modifies html -

most javascript ui components, jquery ui, bootstrap or kendo ui takes html element , renders dynamically. someting this: $('#someselect').autocomplete(); i wonder if these frameworks can used react. let's say, wrap such component react component. when component state changes, e.g. selectedvalue, react rerenders html. since html container javascript ui components renders itself(e.g autocomplete), it's not effective. can react used javascript ui components or have built react-like rendering in mind this article "working browser" react documentation discusses this. using operating on dom directly using jquery not considered practice few reasons: react intentionally discourages using dom attributes selectors rationale tracing props down through component hierarchy more scalable. these plugins don't make use of react's event lifecycle. have functionality dependent on dom being mutated, , others regular react components. stil...

Google Drive returns 503 Error when uploading a file with non-ASCII title -

recently our app tries upload file google drive, server have started returning 503 (service unavailable) error. looked problem , have found out if note title written in ascii, error won't occurred korean, japanese, chinese includes russian, of them ends same error. of course. why occurring , how resolve this?

python - Convert nested iterables to list -

is there easy way in python (using itertools, or otherwise) convert nested iterable f corresponding list or tuple? i'd save f can iterate on multiple times, means if nested elements of f generators, i'll in trouble. i'll give example input/output. >>> g = iter(range(2)) >>> my_input = [1, [2, 3], ((4), 5), [6, g]] >>> magical_function(my_input) [1, [2, 3], [[4], 5], [6, [0, 1]]] it fine if output consisted of tuples, too. issue iterating on g "consumes" it, can't used again. this seems best checking if each element iterable, , calling recursive function on if iterable. quick draw-up, try like: import collections g = iter(range(2)) my_input = [1, [2, 3], ((4), 5), [6, g]] def unfold(iterable): ret = [] element in iterable: if isinstance(element, collections.iterable): ret.append(unfold(element)) else: ret.append(element) return ret n = unfold(my_input) pr...

When there are illegal characters in properties names after dynamic-deserializing of a JSON in C# -

i trying deserialize json contains dash (-) characters in of properties names, using dynamic types: string json = mywebclient.downloadstring("http://api.crossref.org/works/10.1093/brain/75.2.187"); dynamic result = jsonconvert.deserializeobject<dynamic>(json); string title = result.message.title[0]; string journal = result.message.container-title[0]; i cannot "container-title" value due use of illegal character. , don't want use "replace()" remove dash characters. there way? since message jobject can access properties dictionary result.message["container-title"]

oracle11g - Oracle 11g: Need to get the longest matching string that starts with another string -

i have 2 tables data: create table tbl1 ( id number, label varchar2(50) ); create table tbl2 ( id number, src varchar2(400) ); insert tbl1 values (1, 'foobar'); insert tbl1 values (2, 'foo'); insert tbl1 values (3, 'bar'); insert tbl2 (src) values ('foo: yeah'); insert tbl2 (src) values ('foobar: nope'); i trying update id field of tbl2 match longest matching string tbl1. intention 'foo: yeah' entry should id 2, , 'foobar: nope' entry should id of 1: update tbl2 t2 set t2.id = (select t1.id tbl1 t1 t2.src t1.label || '%'); doing results in error: "single-row subquery returns more 1 row". makes sense me, tried this: update tbl2 t2 set t2.id = (select t1.id tbl1 t1 t2.src t1.label || '%' , rownum=1 order length(t1.label) desc); but error: "missing right parenthesis". don't understand error i...

php - laravel - blank page generated on call to view -

i have following routes: <?php /* |-------------------------------------------------------------------------- | application routes |-------------------------------------------------------------------------- | | here can register of routes application. | it's breeze. tell laravel uris should respond | , give controller call when uri requested. | */ route::get('/', 'pagescontroller@index'); route::get('item', 'itemcontroller@index'); route::get('item/create', 'itemcontroller@create'); route::get('item/{id}', 'itemcontroller@show'); route::get('welcome', function() { return view('welcome'); }); route::group(['middleware' => 'web'], function () { route::auth(); route::get('/home', 'homecontroller@index'); }); and item controller looks like: @section('content'); <h1>add new item</h1> <hr /> <content> ...

matlab - Get complex results of ODE equations solved by Runge-Kutta -

i've written runge-kutta code solve odes in matlab, got undesired complex results. function dy = fctrl(t,y) dy = zeros(2,1); % parameter settings syms vd rdc tt = 300; kb = 8.6173324*10^(-5); e = 211; rou = 2; b = 0.148; g = 82; nu = 0.290; r0 = 15; sigmay = 0.13; n = 0.12; ch = sqrt(2.5*(2-n)/(4+n))*10^9; kapa = 2.65; ct = 3.24*10^12; beta0 = 2.5*10^(-14); d = 2; hdot = 10; epsilond = 8*160.2176487*10^(-3)/b; sigmap = 1.2; = 3.71*10^12; epsilons = 0.136*0.16021766208; % normalized parameters sigmayb = sigmay/e; beta0b = beta0*ct; % ode functions = (0.75*r0*y(2)*(1-nu^2)/e)^(1/3); rc = a*(0.25*e*a/(r0*sigmay))^(1/3); rbm = (0.1*n*kapa*(rc^2)*(sigmayb...

version control - SVN Automated Replication -

we've set subversion on our centos server. our end goal complete of our work on development subdomain has own repository. once satisfied on whatever doing, replicate development repository 'live code' repository automatically. i've read on post-commit hooks, don't want commits development repo automatically moved live repo. unfortunately, our head guy not comfortable having root access run svn replicate command through console. otherwise, wouldn't issue. is possible create script run web run svn replicate command? or can post-commit hook script written in such way can specify when replicate live server? thanks help!

json - how to access javascript object from a function? -

let's have: var test = {}; test.data1 = { ...json objects here... }; test.data2 = { ...json objects here... }; , on... i access these json objects followed set of calls by: this.scope.testdata = test['data1']; however, may data test getting larger wanted pass whatever data want function , processing like: this.scope.setupdata = function(data) { var fdata = test[data]; // line correct? ... ... return fdata; }; but it's not working. i'm getting :cannot set property "fdata" of undefined "[object object]" ... i'm new javascript, appreciated. the problem scope inside this.scope.setupdata . access variables relate this.scope need use this again: /** * @ current scope, "this" refers object * let's object named "parent" * * "this" contains property: "scope" */ this.scope.setupdata = function(data) { /** * @ current scope, "this...

javascript - jquery - colorbox - adding a function to the popup -

i have "quick view" feature captures dynamic url known "qvurl" , creates colorbox via: <script type="text/javascript"> $(function(){ $(".quickview_btn").click(function(e){ e.preventdefault(); var qvurl = $(this).attr("href"); $.colorbox({"href": qvurl}) }); $.colorbox.resize(); }); </script> now. need make changes in child window - seems ajax or whatever wiping out entire dom , load parent window doesn't reflect. for instance - let's want add div says qwerty! [i'm wanting create mbox around call action] any insight appreciated! please note - urls it's loading content can not manipulate - has done in parent window. thanks! please see below full snippet: <script> $( document ).ready(function() { $('.quickview_btn').click(function(){ //quickview tracking $('.quickview').attr(...

grails - Custom databinding for collection of abstract classes in command object -

in grails 3.x project, have command object, habitatcommand , has parameterized collection of animals: class habitatcommand { set<animal> animals = [] } animal abstract class , there many concrete animal classes: abstract class animal { string name integer height integer weight } class bird extends animal { integer wingspan } class cat extends animal { integer lives } i'm sure databinding works fine if we're selecting existing animals , submitting ids (as dropdown), problems arise when trying create new animal instances in form. take following form data: animals[0].name: 'animal1' animals[0].height: 4 animals[0].weight: 75 animals[0].wingspan: 7 animals[1].name: 'animal2' animals[1].height: 3 animals[1].weight: 45 animals[1].lives: 9 when databinding occurs, grails loops on each animals[i] indexed form property , attempts create new instance of parameterized type, in case, animal . doesn't work since animal ab...

javascript - Which chart framework is used on findthebest.com -

i have been looking beautiful charts , graphs on http://smartphones.findthebest.com/ i curious framework these guys used. if created own, there similar opensource framework available these type of graphs , charts? thanks asking- question flattering. build our visualizations scratch, since don't want deal overhead of external libraries , have specific needs. can learn d3.js , pretty in terms of visualizations. good luck!

ruby on rails - How to limit one value to appear at most once in a column in Postgresql? -

how add constraint or unique index position column in staff entity value master can appear @ once while other values can appear many times? is possible? i using postgres database, ruby on rails , schema.rb . i'm not sure postgres enforces kind of constraint. alternative solution set custom validation on model along lines of class somemodel validate :one_master_permitted private def one_master_permitted errors.add(:position, "some error message") if somemodel.find_by(position: "master") end end

python - Spyder crashes on startup and the reset command doesn't work because it cannot find spyderlib.spyder -

i have been using spyder until crashed today. on startup, said please use python spyder --reset if problem persists. when run command following error: c:\program files\python27\scripts>python spyder --reset traceback (most recent call last): file "spyder", line 2, in <module> spyderlib import start_app importerror: no module named spyderlib i tried suggestion , got similar results c:\program files\python27\scripts>python -c "from spyderlib.spyder import main; main()" --reset traceback (most recent call last): file "<string>", line 1, in <module> importerror: no module named spyderlib.spyder any suggestions?

Specifying ID in Mysqli query in php -

Image
i'm working on cms site, i've got blog posts store in database. can create, edit , delete them. there's issue though when want edit them. can't specify clause in update query match id of blog post i'm trying edit! suppose i've got blog post id of '5'. if write code it, works way should. $sqledit = "update paginas set message='$_post[message]' id= $_post[id]"; but don't want edit blog post #5, want edit blog post i'm updating. seems me should work, where id= $_post[id]"; ... doesn't. that throws me undefined id error. shouldn't because can delete blog posts exact same way particular code: $sqldel = "delete `paginas` id= $_post[id]"; this allow me to. the code below on blog page, edit query in own edit.php page if (isset($_post['edit'])) // if pressed, execute { echo '<br><br> <div class="blogscript"> ...

wordpress - Normal corners on select boxes - css -

all select boxes have rounded corners, want normal corners. think theme using on wordpress site overwrites normal boxes. this site see select boxes rounded corners! http://www.fernwehreisen.de/reiseanfrage/ can point me in right direction? how normal corners via css ? have tried changing border radius , on, nothing helps, because can't find class manages this. thanks. border-radius governing css name of issue. different browsers, has different manifestations, , -webkit-border-radius 1 of them. in addition current code, can add border-radius:0px , should take care of modern browsers. if still doesn't work, means selector .wpcf7 select overridden theme's other css rules. blindly overcome them, can add !important after css rule. .wpcf7 select { -webkit-border-radius: 0px !important; border-radius:0px !important } or can try refine selector yours override them. if still don't understand, google css selector , read first link.

jquery - Simulate and fire enter keypress in JavaScript -

i trying run number of automated (simple) js tests on website , simulate , trigger enter key press on input field (its not in form , not use form, not wish edit code). i've been trying stuff along lines of: $('#inputfield').trigger($.event('keypress', { which: 13, keycode: 13 })); i've gone through countless answers on internet, none have helped , wondering if suggest why should trivial matter. using chrome v. 49 can use jquery thanks.

ios - Can I see a Facebook post's reach from my app? -

i'm new facebook api, , wondering if can see user's facebook post's reach. example, ios app contains photo, photo shared facebook. can (the developer) see how many likes , shares (ie. reach) photo has? work links? possible if user shares web app? thanks! simple answer: no, can´t. you can likes , shares if authorize user user_posts permission. after that, can read posts user token.

sql - Select SCOPE_IDENTITY not executing after insert statement; -

i try id of last inserted t ouristin table put selct scope_identity; after insert query. the problem when try show id of inserted tourist in label - nothing happens. (only insert query executed); string insertsql = "insert tourist (excursion_id, excursion_date_id, name_kir,midname_kir, lastname_kir)"; insertsql += "values (@excursion_id, @excursion_date_id, @name_kir,@midname_kir, @lastname_kir);select scope_identity()"; string connectionstring = "data source = localhost\\sqlexpress;initial catalog=excursion;integrated security=sspi"; sqlconnection con = new sqlconnection(connectionstring); sqlcommand cmd = new sqlcommand(insertsql, con); cmd.parameters.addwithvalue("@excursion_id", convert.toint32(mynew2)); cmd.parameters.addwithvalue("@excursion_date_id", convert.toint32(mynewnewstring)); cmd.parameters.addwithvalue("@nam...

php - Enqueueing IE conditional stylesheets in WordPress correctly -

i've been trying follow tutorial shows how correctly enqueue stylesheets in wordpress functions folder, , how set internet explorer stylesheets overwrite/ add necessary components compatibility older browsers. there 2 methods of doing tutorial, second of update first method, has since become outdated. here's link: https://gist.github.com/wpscholar/4947518 the first method uses global styles, , can 1 work using code below: function enqueue_my_styles_and_scripts() { global $wp_styles; if (is_page_template('page-templates/full-page.php')) { wp_enqueue_style( 'theme-full-page' , get_template_directory_uri() . '/css/full-page.css'); } else { wp_enqueue_style( 'theme_style', get_stylesheet_uri() ); wp_enqueue_style( 'theme_style_ie8', get_stylesheet_directory_uri() . '/css/ie8.css', array( 'theme_style' ) ); $wp_styles->add_data( 'theme_style_ie8', 'conditional', 'ie...

Why does php 'use' fail when I put example code into a function? -

having started example code, don't understand why these scenarios don't work. script of example code called script.php file works when run command line <?php //script in standalone file: script.php //...define stuff require required_file; use aws\ses\sesclient; //now stuff ?> when inline contents of script large program fails on 'use' part. <?php //class-of-bigger-program.php //function called other part of program function foo(){ //paste contents of same script above //...define stuff require required_file; use aws\ses\sesclient;//crash here // stuff } ?> however when including script in same place of larger program works fine. <?php //function called other part of program function foo(){ //paste contents of same script above include 'script.php'; } ?> why case? miss using 'use' command? have found differences between 'use' , 'include' , namespaces hard understand. ...

python - ScipyOptimizer gives incorrect optimization result -

i running non-linear optimization problem in openmdao , know optimal solution of (i want verify solution). using slsqp driver configuration of scipyoptimizer openmdao.api . i have 3 design variables a, b , c, respective design-spaces (a min a max , on) , single objective function z. said, know optimal values 3 design variables (let's call them a sol , b sol , c sol ) yield minimum value of z (call z sol ). when run problem, value z larger z sol , signifying not optimal solution. when assign c sol c , run problem , b design variables, value of z closer z sol , lesser got earlier (in 3 design variable scenario). why observing behavior? shouldn't scipyoptimizer give same solution in both cases? edit: adding code.. from openmdao.api import indepvarcomp, group, problem openmdao.api import scipyoptimizer class rootgroup(group): def __init__(self): super(rootgroup, self).__init__() self.add('desvar_f', indepvarcomp('f', 0.08)...

angularjs - bootstrap star rating in angular js -

i able number database , display in .html as <tr ng-repeat="review in reviews "> <td>{{review.reviewer}}</td> <td>{{review.comment}}</td> <td>{{review.rating}}</td> here, {{review.rating}} given number. how use bootstrap display star rating given number? you can use angularjs bootstrap ui directive: https://angular-ui.github.io/bootstrap/ -> rating (ui.bootstrap.rating) example: http://plnkr.co/edit/wpfxg0zqslhptqvbhdgi?p=preview index.html <div ng-controller="ratingdemoctrl"> <h4>rating</h4> <uib-rating ng-model="rate" max="max" read-only="isreadonly" on-hover="hoveringover(value)" on-leave="overstar = null" titles="['one','two','three']" aria-labelledby="default-rating"></uib-rating> <span class="label" ng-class...

javascript - Meteor: Accessing another collection with an id in an #each block -

so have 2 collections, appliers & profiles, appliers = {_id,idappliersprofile} & profile = {_id,profilename} so question if #each appliers, how access profile collection profile instead of id? thanks. assuming both sets of docs published client, 1 solution looks this: html <template name="mytemplate"> {{#each appliers}} {{#with getprofile idappliersprofile}} <div>{{profilename}}</div> {{/with}} {{/each}} </template> js template.mytemplate.helpers({ appliers: function () { return appliers.find(); }, getprofile: function (id) { return profile.findone(id); } });

Store audio signal into array using matlab -

i recorded audio signal (.wav) , need convert signal matrix or array using matlab, can add one. [x,fs] = wavread('c:\users\amira\desktop\test222.wav'); fs=44100 length(x) = 339968 how can sample signal , covert matrix of (n,1) n=40. if want first 40 samples of audio signal, can index x : [x,fs] = wavread('c:\users\amira\desktop\test222.wav'); first40 = x(1:40);

When logged in show content in PHP -

i saw lot of examples login scripts in php language , examples different... want ask if got idea, how make log in script, right or no. safe use way? here code: the page login index.php : <!doctype html> <html> <head> <title>login page</title> </head> <body> <form action="login.php" method="post"> login: <br> <input name="login" type="text" /><br> password: <br> <input name="pass" type="text" /><br> <br> <input type="submit" value="log in!" /> </form> </body> </html> second page check if username/password correct , set $_session['logged'] true (if it's ok ofcourse....) login.php <?php if($_post['login'] == 'user' && $_post['pass'] = 'demo'){ session_start(); $_session['logged']...

html - Flexbox wrap issue - Aligning two scrollable divs next to each other in a container of height 100vh -

i want following flex box layout to: have individual scrolling sidebar , content area when content in them overflows content area appear next sidebar height of main container remain 100vh , neither sidebar or content area should exceed this. the alert alerting users issues. should on top , should occupy 100% of width. the user can choose use sidebar. if sidebar not used, content occupies 100% width. alert appear when wrong. if not alert not shown i not sure why content area appears below sidebar , sidebar , content areas don't activate scrolling after overflow. can see height of sidebar exceeds height of main container (the background color of main area cyan). .main { display: flex; flex-wrap: wrap; height: 100vh; background: cyan; } .main .alert { flex: 1 1 100%; background: yellow; height: 30px; order: -2; } .main .content { flex: 1 1 auto; background: blue; overflow-y: auto; } .main .sidebar { flex: 0 0 auto; ...

r - Most efficient way to create matrix of averages -

this question has answer here: calculate mean each column of matrix in r 4 answers very basic question here! on 10 x 2 data frame, want calculate average of each column , place result in new 1 x 2 matrix. colmeans calculates averages, places result in 2 x 1 vector. attempting transpose vector gives error message "error in transpose(averagex) : l must list." as workaround, created empty 1 x 2 matrix (filled nas), used rbind merge averages vector empty matrix, , deleted nas. it works bet same 2 lines of code rather four. have better way achieve this? help. df <- data.frame(price = c(1219, 1218, 1220, 1216, 1217, 1218, 1218, 1207, 1206, 1205), xxx = c( 1218, 1218, 1219, 1218, 1221, 1217 , 1217, 1216, 1219, 1216)) average <- colmeans(df, na.rm = true) #result vector => turn 1xm matrix averagematrix <- matrix(nrow = 1, ncol = 2) averagem...

javascript - How to disable an input box using angular.js -

i using field edit view , create view <input data-ng-model="userinf.username" class="span12 editemail" type="text" placeholder="me@example.com" pattern="[^@]+@[^@]+\.[a-za-z]{2,6}" required /> in controller have code disable input element: function($rootscope, $scope, $location, userservice) { //etc $(".editemail" ).attr("disabled", disable); // no idea how in angular } please help. use ng-disabled or special css class ng-class <input data-ng-model="userinf.username" class="span12 editemail" type="text" placeholder="me@example.com" pattern="[^@]+@[^@]+\.[a-za-z]{2,6}" required ng-disabled="{expression or condition}" />

java - Is there a way to concatenate strings with a delimiter that a user will never be able to enter across languages and keyboard types? -

i have 5 strings want concatenate storage. can not store them separately, can not serialize object contains them. can store 1 string variable. is there way add these strings together, separated character programmer enter said string can split using character later? there unique escape code or of sort? this may bad design, , changing system completely, curious if possible. if can not control input, can't guarantee anything. it's simple. instead, should pick delimiter, escape delimiter. consider, ubiquitous tab. to escape tabs, using \ escape character: field1 = field1.replace("\\", "\\\\").replace("\t", "\\\t"); then have parse line back, straight forward. here's complete example. use string builders , more interesting println fields. public class x { public static void main(string args[]) { string field1 = "field\t1"; string field2 = "field\\2"; strin...

postgresql - python peewee multiprocessing pool error -

stack: python3.4, postgresql 9.4.7, peewee 2.8.0, psycopg2 2.6.1 (dt dec pq3 ext lo64) i have need able talk(select, inserts, update) postgresql database in each worker. using pythons multiprocessing pool create 10 workers , each 1 makes curl call talks database based on finds. after reading few threads on internets thought connection pool way go. placed code below atop models.py file. have doubts connections pools because understanding reusing database connections across threads no no. db = pooledpostgresqlextdatabase( 'uc', max_connections=32, stale_timeout=300, # 5 minutes. **{'password': cfg['psql']['pass'], 'port': cfg['psql']['port'], 'register_hstore':false, 'host': cfg['psql']['host'], 'user': cfg['psql']['user']}) on question now. getting random sql errors when talking database workers. before introduced pee...

Android - Google Play Store closes app for update and not opening it afterwards -

i've got following situation: app running on android device. because want able update automatically i've activated google play store auto-updates. when play store recognizes new version closes app (what ok) , updates (great!). unfortunately afterwards app not opened again. does know solution or has idea how can tell app, store or device open app again? btw: app starts on system start-up. rebooting devide possibility well. how catch update-finished event? thanks! edit: build app. has listener system startup started on boot. post honeycomb, apps have started manually user after installation or upgrade. if need app run continuously, need turn off auto update , manually update can launch manually after updating.

bitwise operators - Python NOR Returning Odd Values -

i trying nor of 2 values a = 0b1010 b = 0b0101 print(~ (a | b)) the current output -16 , if hand 1010 or 0101 -------- 1111 not 1111 -------- 0000 so, should give value of 0 , not -16 . why this? how can fix this? these operations being done 32-bit integers (or 64-bit integers in 64-bit version of python). 0000 0000 0000 0000 0000 0000 0000 1010 or 0000 0000 0000 0000 0000 0000 0000 0101 ------------------------------------------ 0000 0000 0000 0000 0000 0000 0000 1111 not 0000 0000 0000 0000 0000 0000 0000 1111 ------------------------------------------- 1111 1111 1111 1111 1111 1111 1111 0000 which, taken signed integer, two's complement representation of -16, because have add 16 reach 0 (and carry). to fix it, explicitly xor 0b1111 instead of using ~ . print((a | b) ^ 0b1111)

ffmpeg - How to decode frames from MDAT atom extracted from mp4 video -

i new video codecs , learning video file format specifications. have read quicktime file format specifications here , , mp4 file format (which similar) here . there atoms such ftype, moov, mdat etc. mdat atom contains actual audio , video data. moov atom contains information how extract data mdat, gives references chunks (samples). i want extract video samples in mdat atom video file without using tool such ffmpeg, or juggler etc. can write own code this. problem is, if can locate video data (samples) in mdat using information moov, these samples compressed. , need uncompress these frames. question can uncompress samples extracted mdat , actual video frames ? tools such xuggler, ffmpeg etc used extract frames video files. here want extract samples(for video data) mdat writing own code, want uncompress using tool. don't want write codecs. can please me this....! thanks... ffmpeg collection of libraries. libavformat used read , write files(what doing own code), ...

Magento cant make an order -

i have installation of magento 1.9.2. using custom theme, , anytime try , place order kicks off ajax on page , stops no error messages, leave log: err (3): user error: transactions have not been committed or rolled in /html/lib/varien/db/adapter/pdo/mysql.php on line 4039 i have spent 2 days trying bottom of no joy. doesnt matter payment method use same. any gratefully appreciated you should try log mysql queries see wrong here. lib/varien/db/adapter/pdo/mysql. open file lib/varien/db/adapter/pdo/mysql.php , change value of protected property $_debug true . can change value of $_logquerytime handy when debugging slowdowns. once make change queries logged in file var/debug/pdo_mysql.log hope you. please put corrupted query here if fixed it.

Pause Spark Streaming Job -

i have simple spark streaming application reads data kafka , send data after transformation on http end point (or kafka - question let's consider http). submitting jobs using job-server . i starting consumption source kafka "auto.offset.reset"="smallest" , interval=3s. in happy case looks good. here's excerpt: kafkainputdstream.foreachrdd(rdd => { rdd.foreach(item => { //this throw exception if http endpoint isn't reachable httpprocessor.process(item._1, item._2) }) }) since "auto.offset.reset"="smallest", processes 200k messages in 1 job. if stop http server mid-job (simulating issue in posting) , httpprocessor.process throws exception, job fails , whatever unprocessed lost. see keeps on polling every 3 seconds after that. so question is: is assumption right if in next 3 second job if got x messages , y processed before hitting error, rest x-y not processed? is there way pause stream/consumption kafk...

ios - Custom UIButton doesn't show up -

i'm making game , everything's working fine. there seems problem custom button made: let button = uibutton(type: uibuttontype.custom) uibutton let image = uiimage(named: "blueplaybutton") button.setimage(image, forstate: uicontrolstate.normal) button.frame = cgrectmake(self.size.width/2, self.size.height * 0.15, 300, 200) button.layer.zposition = 1 self.view?.addsubview(button) when run application, button doesn't appear. what's wrong code, there missing? i integrating ui elements inside sprite-kit scene, , have bit tricky. if give me more information other elements of class, if uiview or skscene (skview), or sknode . when mixing both approaches pain. but information gave can tell have same problem , solved changing method added ui elements on skscene. before on viewdidload should on viewdidappear . example (objective-c): the icarousel ui element (not skview or sknode). ` -(void)didmovetoview:(skview *)view { //your code in o...

ruby - Rails update before save the model -

Image
following section of controller methods: class productattachmentscontroller < applicationcontroller def create @product_attachment = productattachment.new(product_attachment_params) session[:product_id] --> return product_id respond_to |format| if @product_attachment.save format.html { redirect_to @product_attachment, notice: 'product attachment created.' } # format.json { render :show, status: :created, location: @product_attachment } format.json {render :json => @product_attachment} else format.html { render :new } format.json { render json: @product_attachment.errors, status: :unprocessable_entity } end end end end model relationships: class product < activerecord::base has_many :product_attachments, dependent: :destroy end class productattachment < activerecord::base mount_uploader :attachment, attachmentuploader belongs_to :product end once user upload pictu...