Posts

Showing posts from February, 2012

Kivy: Kivy Launcher Crash Android -

i'm tyring launch app on android using kivy launcher can see happens widgets pos/size on smaller screen. when launch, crashes. so... i'm guessing i've done illegal in app...which runs fine on windows desktop. my code book i'm looking at: paths when loading images screen configuration i using windows style paths , figured that's bad. used abspath+"\rest of path" , got crash. next used local paths "my data\sprite" , got crash. i'm new kivy don't know things valid while running on pc vs android. as far screen configuration, no code written , kivy runs in window mode on desktop. does know possibly cause kivy launcher crash on loading without warning? kivy 1.9.0 my code python...i don't use kv files. ------update----- log: https://drive.google.com/file/d/0b84acty-m0oxwtfacm1tzxfhzda/view?usp=docslist_api looks it's paths when loading resources. error says path doesn't exist path , file exist....

Ruby - fastest way to select items that belong to two arrays by nested attribute -

my ruby query slow. i'm looking faster way select items belong 2 arrays lista list of objecta attribute name listb list of objectb attribute name there can multiple items in lista have same name , nothing in listb same name . there items in lista name s not in listb . want function (loop) return items in lista name in listb . this current solution, it's slow. how can make faster ? z = 0 new = [] while z < listb.length hold = lista.select{|obj| obj.name == listb[z].name} new += hold z += 1 end you want maximise lookup speed. best speed can reach lookup o(1) using hashes. method described below 1000x faster code , 350x faster loop include? n=10000 edit 2 : this link explains more in detail why hash lookup fast. names = {} listb.each{|item| names[item.name] = true} result = lista.select{|item| names[item.name]} edit : updates benchmark. 03/08/2015 - added user12341234 set method benchmark code class myobject def i...

ios - Dynamically increase/decrease height of custom UINavigationBar -

Image
i followed blog post explains how can implement custom uinavigationbar has increased height, if example wanted put additional ui elements in nav bar underneath rest of bar content persist between navigation on stack. code works in case want increased height. in app, need start navigation bar @ default height, increase later, adding more content, after user performs given action. similar song info , controls in itunes store: so put checks in place not reposition if bool property no . when set yes , call [self setneedsdisplay] call layoutsubviews position appropriately based on boolean value. sizethatfits called , return proper height. the problem is, can't call [self settransform:cgaffinetransformmaketranslation(0, -(navigationbarheightincrease))]; in initialize . instead call @ same time change boolean value yes . because of this, of elements moved amount. if don't call settransform , elements in nav bar in proper position, bar positioned far down, custom vie...

mongodb http interface authentication -

i have little problem mongodb: when connect http interface have no problems, if try connect after enabling authentication browser ask me username , password. far it's correct, if try log in users have created (one root on admin db, 1 useradminanydatabase on admin , 1 dbowner on personal db) neither of them allows me access! know why? thanks i'll start usual caveat should not use http interface on production system, ever - turn off prod. said, using mongodb 3.0 (and in particular scram sha-1 credentials)? the http interface not support auth method, per page linked: neither http status interface nor rest api support scram-sha-1 challenge-response user authentication mechanism introduced in version 3.0. hence, use auth interface have make sure using 2.6 or @ least 2.6 style credentials .

Set timeout for Python socket when sending data out -

i set timeout python socket client. means, socket client connects server sends data within 1 second. if takes more 1 second, method raise kind of exception or error. here source code: def senddatatelnet(iptmp, strtmp): # try send data <iptmp> try: s = socket.socket(socket.af_inet, socket.sock_stream) writelog("connecting %s" % (iptmp)) s.settimeout(1.0) s.connect((iptmp, 4242)) writelog("connected %s, start send data" % (iptmp)) s.sendall(strtmp) s.close() s = none writelog("done writing %s" % (iptmp)) return true except socket.timeout: writelog("timed out when connecting %s" % (iptmp)) s.close() s = none return false except socket.error: writelog("error when communicating %s" % (iptmp)) s.close() s = none return false this doesn't work me. works when "...

html - align divs horizontally inside another div -

i trying append divs horizontally existing div. giving float:left property , added overflow-x:auto . expect parent div width < width of child divs horizontal scroll should appear.but not working desired. want divs in horizontal line div1 div2 div1 div2 div1 div2 div1 div2 here code <div style="overflow-x:auto;width:100px;height:100px"> <div style="background-color:lavender;float:left"> div1 </div> <div style="background-color:lavenderblush;float:left"> div2 </div> <div style="background-color:lavender;float:left"> div1 </div> <div style="background-color:lavenderblush;float:left"> div2 </div> <div style="background-color:lavender;float:left"> div1 </div> <div style="background-color:lavenderblush;float:left"> div...

c# - How to auto-rotate an uploaded image -

i have site i'm allowing users upload photos. these files uploaded webapi endpoint httppostedfile . after performing validation on uploaded file, stream: var stream = httppostedfile.inputstream; and resize: var instructions= new instructions { width = 80, height = 80, outputformat = outputformat.jpeg, mode = fitmode.crop, autorotate = true }; var smallresizedimage = new memorystream(); var imagejob = new imagejob(stream, smallresizedimage, instructions); imagejob.build(); notice how in instructions, specify image should rotated. image not rotated, resized correctly. i've tried setting key, same results: instructions.add("autorotate", "true"); i using imageresizer version 3.4.3 without plugins or changes configuration settings. based on previous comment nathanael jones, not copying stream bitmap or image, don't think exif information being...

Python: Changing indivividual elements in a list of bool -

i have list of bool below: [false, false, false, false, false, false] i wish change last 2 elements (or indices of choice) true: [false, false, false, false, true, true] per comment, given arbitrary indices i , j (where i <= j ) want set list[i:j] = true can following: list = list[:i] + [true] * (j-i) + list[j:]

postgresql - Rails database changing boolean into true -

hi using devise database name user. now got parameter in database admin , type boolean. so concern how can make true , when made user not true, default false right , want turn on admin parameters true. i know need use console how can it? before forget using postgresql bit new here dont know how edit before using php, , using phpmyadmin so, rails console bit weird me. any appreciated using postgresql database assuming have model user attribute admin , want set user id 1 admin true, in rails console can this: user.find(1).update(admin: true) find return instance corresponding id provided. you can learn more active record in this rails guide . if going need more once, might consider using rails database seeding described here .

How to get banking transactions from Quickbooks using PHP SDK? -

Image
how banking transactions quickbooks using php sdk? i created code oauth. create servicecontext object , dataservice object. should next? due sensitivity of user's banking data, not supported qbo v3 services api , it's available in qbo ui.

mysql - Error in nested case query using SQL -

trying convert below query sql , query works fine on mysql . problem seems case when area field same error. show msg 102, level 15, state 1, line 44 incorrect syntax near '='. msg 156, level 15, state 1, line 47 incorrect syntax near keyword 'and'. msg 156, level 15, state 1, line 49 incorrect syntax near keyword 'else'. when t.[statusid] = 3 case when (((select count(ta1.[approver_id]) [qestorm].[dbo].[cr_ticketapproval] ta1 inner join [qestorm].[dbo].[cr_controlflow_subroute] cfsr1 on ta1.[subroute_id] = cfsr1.[id] ta1.[ticket_id]= @itkid , ta1.active=1 , cfsr1.active=1 , cfsr1.[sequence] =(select cfsr2.[sequence] [qestorm].[dbo].[cr_ticket] t2 inner join [qestorm].[dbo].[cr_controlflow_subroute] cfsr2 on t2.[subrouteid] = cfsr2.[id] t2.[id] = @itkid))<(select count(distinct cfsr1.[id])from [qestorm].[dbo].[cr_ticket] t1 inner join [qestorm]....

moodle - How to implement a next button for a forum in php? -

currently trying implement next button take next topic in forum have no idea start. assuming forum updated in terms of time of last post. if have autoincrementing primary key in database, current id, bump , create link pointing next 1 (provided quick check make sure valid, e.g., next post wasn't deleted previously). edit: if forums sorted last update (and want "next" post mean next updated, you'll need little querying. $sql = "select postid, postname forum_posts last_updated < '$thispostslastupdate' order last_updated desc limit 1"; $result = mysqli_query( $dbconn , $sql ); $fetch = $result->fetch_array(); $fetch should contain array of values want (the id generating link next post , postname link's text).

Does the AWS SQS connector for Mule (Anypoint) need to be configured to read from a specific region? -

i have simple flow read queue in aws sqs using mule's sqs connector: <sqs:config name="amazon_sqs__configuration" accesskey="${aws.readonly.accesskey}" secretkey="${aws.readonly.secretkey}" doc:name="amazon sqs: configuration"/> <flow name="status-io-integrationflow"> <sqs:receive-messages config-ref="amazon_sqs__configuration" queueurl="< my-url-to-sqs-queue >" preservemessages="true" doc:name="amazon sqs (streaming)"/> <logger message="#[payload]" level="info" doc:name="logger"/> </flow> however, can work queues deployed in u.s. east (n. virginia). there way change region sqs connector using find queue? in west (oregon), example, following error: caused by: com.amazonaws.1.9.39.shade.services.sqs.model.queuedoesnotexistexception: specified queue not exist wsdl version. (service: amazonsqs; status code: 40...

r - Could not compute QR decomposition of Hessian CFA/SEM -

i using sem package build sem model. model can run however, there warning message this: warning message: in eval(expr, envir, enclos) : not compute qr decomposition of hessian. optimization did not converge. if run summary(cfa1.test), warning error message this: error in summary.objectiveml(cfa1.test) : coefficient covariances cannot computed in addition: warning message: in vcov.sem(object, robust = robust, analytic = analytic.se) : singular hessian: model underidentified. my model relationships among market orientation (mo), government incentives(gvincent), entreprenuerial orientation(eo) , firm performance(firmp). these 4 second order constructs. under each of them there number of constructs, example, responsiveness (resp), proactiveness (proa), economic performance(econp), government financial incentives (gvfin) , under sub constructs, there observed variables such resp3,4, 5 , econp(1-12). below codes of model: model.1<-specifymodel() gvinfo->gvinfo1, na, 1...

java - Playframework ad-hoc form validation is executed but does not work as it supose -

i have login class validate method follow: public static class login { /** customer. */ @manytoone @constraints.required public customer customer; /** password. */ public string password; public string getpassword() { return password; } public void setpassword(string password) { this.password = password; } public customer getcustomer() { return this.customer; } public void setcustomer(customer c) { this.customer = c; } /** * validate. * * @return string */ @transactional public string validate() { return "global error"; } } code form binding: form<login> filledloginform = form(login.class); filledloginform.bindfromrequest(); when validate form follow: if (filledloginform.hasglobalerrors()) { return badr...

python - Get the value of variables passed in the url -

hi using mandrill send few emails system(mandrill designed applications or websites need send transactional email password resets, order confirmations, , welcome messages.) preparing url , attaching emails.when user clicks on link in these emails redirected particular section in web page. the url have attached : " https://mysite/account/subs/#manage_contacts " if user logged application,he ll redirected specific url,if not redirected login page site , target variables set redirect him url clicked. in login page url : " https://mysite/authenticate/?site=xyz&target=/account/subs/#manage_contacts " but after login user redirected 'mysite/account/subs/'. leaving out "#manage_contacts".how entire url in target. checked value of target, had mysite/account/subs/ a part of views responsible redirection after successful login : site = request.get.get('site', '') logger.debug('site:' + st...

amazon s3 - Reading SequenceFiles from S3 with PySpark on EMR causes RACK_LOCAL locality -

i trying use pyspark on emr analyze data stored sequencefiles on s3, running performance issues due data locality. here simple sample doesn't work well: seqrdd = sc.sequencefile("s3n://<access>:<secret>@<bucket>/<table>/day=2015-07-04/hour=*/*") seqrdd.count() the issue count action, works fine distribution of tasks poor. reason in spark logs see 2 ips of cluster doing actual work while rest sits idle. tried 5 node cluster , 50 nodes cluster , it's 2 ips appearing in logs. also strange these 2 ips have locality of rack_local. i'm presuming it's because data in s3 it's not local, how can make spark use whole cluster instead of 2 instances? i didn't specific spark configuration on emr, installing on emr via native app , believe takes care automatically of optimizing configs. i saw in logs, allowlocal=false issue couldn't find on that: 15/07/17 23:55:27 info spark.sparkcontext: starting job: count @ :1 15/07/...

java - About the value range of "Assignment Branch Condition" -

in work, have rule has limit abc (assignment branch condition) value. know what's best value metric , reason? the abc metric is counting number of assignments, branches , conditions section of code. counting rules in original c++ report article c, c++ , java languages, , defined as: assignment -- explicit transfer of data variable, e.g. = *= /= %= += <<= >>= &= |= ^= >>>= ++ -- branch -- explicit forward program branch out of scope -- function call, class method call, or new operator condition -- logical/boolean test, == != <= >= < > else case default try catch ? , unary conditionals. a scalar abc size value (or "aggregate magnitude") computed as: |abc| = sqrt((a*a)+(b*b)+(c*c)) this question tagged java c# , ruby have different syntax , coding styles don't think there 1 size fits metric this. in general think want keep number in "goldilocks" range of not low , not high. high...

c# - DependencyProperty compiles and works but Intellisense doesn't think so -

Image
i have 2 custom controls/visuals , need orientation property on both. in both cases, default should "horizontal" user of control/visual should able specify orientation="vertical" arrange components of control/visual vertically. have works great on imagebutton control, not on headeredlabel visual. although both of them compile fine, intellisense doesn't 1 of them. here's example of use... <visuals:imagebutton image="icons/ok.png" content="normal content"/> <visuals:imagebutton image="icons/ok.png" content="vertical content" orientation="vertical"/> <visuals:headeredlabel header="normal header" content="normal content"/> <visuals:headeredlabel header="vertical header" content="vertical content" orientation="vertical"/> ...which produces following when rendered inside vertical stackpanel: so want, problem this: while intelli...

Access private methods variables in another java class in same package. -

this question has answer here: in java, difference between package private, public, protected, , private 25 answers i new java. can please tell me best way access private method variables in class. thank u private variables private reason- you're not supposed able access them directly. many classes have getter methods though allow access private variables not change them. if need access private variables in program, need rethink design.

python - Twisted on Python3: Install fails with a series of "File Not Found" errors -

i having problem described here: https://twistedmatrix.com/trac/ticket/6539#comment:12 however, ticket closed, , seems think huge subset of twisted runs on python 3. when install twisted python 3, errors listed on ticket emitted, , experience following: in [1]: import twisted in [2]: dir(twisted) out[2]: ['version', '__builtins__', '__cached__', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__file__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__loader__', '__lt__', '__name__', '__ne__', '__new__', '__package__', '__path__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__spec__', '__str__', '__...

algorithm - Minimum number of steps to flip cards deck -

this contest problem not home work. given n cards facing down, have flip n cards facing up. if flipping ith card then, i-1,i,i+1 flipped. eg: if n = 3, minimum no of steps 1 . given n cards, have calculate minimum no of steps flip cards up. initially thought kind of fibonacci, let n = 2,3,4 , minimum steps min = 1,1,4 if n = 6 , minimum steps 2 . struck here, please ? the cases n=1, 2, , 3 easy. for n = 3k, easy. flip on k cards starting second one. for n = 3k+1, first flip both cards on ends, flips on 4 cards. have 3k-3 cards left over, divisible 3, can flipped in k-1 moves. for n = 3k+2, first choose first card, flips 2 cards. have 3k cards left flip, done in k flips.

html - Save Map Instance outside of Google Maps -

i've made google maps api (html) script created markers when user clicks on map. i've integrated google+ login functions users unique , have profiles. want make users can create markers on desired positions , save map can come later. don't want them use " https://developers.google.com/maps/documentation/javascript/examples/save-widget " provided function because markers synched google+. in other words want markers save website, not personal google maps. how go saving state of map on site? heres fiddle of code: https://jsfiddle.net/hgvsurt5/ heres code: <head> <style> #map-canvas { width: 900px; height: 600px; } .controls { margin-top: 16px; border: 1px solid transparent; border-radius: 2px 0 0 2px; box-sizing: border-box; -moz-box-sizing: border-box; height: 32px; outline: none; box-shadow: 0 2px ...

java - Sending PNGs via PHP web to an Android App -

what's best way pass png image php android app in java? i tried in php: $archi=file_get_contents("bar.png"); $archi2=base64_encode($archi); print($archi2); and in java: string img= base64.decode(str); byte[] bytearray = img.getbytes(); bitmap mybitmap=bitmapfactory.decodebytearray(bytearray,0,bytearray.length); but get: skimagedecoder::factory returned null solved, de base64 decoding string , bytearray. decoding directly bytearray using following class worked: class: https://grizzly.java.net/docs/2.3/xref/org/glassfish/grizzly/http/util/base64utils.html java code: byte[] bytea = base64.decode(downloadedstr); imagen=bitmapfactory.decodebytearray(bytea,0,bytea.length);

javascript - Execute $.ajax when HTML form submitted -

i want call $.ajax when html form submitted. using .submit() determine when form submitted. $.ajax , when placed within .submit() function, not executing. however, when not within .submit() function, $.ajax executes perfectly. here form: <form id="searchform"> <input type="text" id="search"> <input type="submit" value="submit"> </form> and here jquery: baseurl = 'http://...'; $("#searchform").submit(function() { $.ajax({ type: 'get', url: baseurl, datatype: 'xml', success: function(xml){ // code here } }); }); simply need prevent default browser submit process. a submit handler not override default process, intercepts , allows whatever need before submits ... or in case gets prevented $("#searchform").submit(function(event) { event.preventdefault(); // aj...

sql server - Max() function not returns the max value -

i used max() retrive max value column. returns wrong output. here max() returns . kindly suggest select seq_no appltype app_no = '01' output : 1,2,3,4,5,6,7,8,9,10 select max(seq_no) appltype app_no = '01' output : 9 can't able attach image new stack overflow. the field seq_no not numeric type. please try query: select max(cast(seq_no int)) appltype app_no = '01'

unit testing - How to mock java methods of superclass using powermock or any mock tool? -

super class public class basicdao { public object createquery() { return new object(); } } implementation public class mydao implements basicdao { public object getmydata() { object obj = createquery(); // more code... return ...; } } i need test getmydata() method , want mock/suppress createquery() method cos fail on test env. thanks! don't tests way. called partial mocking , wrong, means code have been written not using object oriented design. 1 should favor composition on inheritance . nevertheless dao object represents boundary of system, i.e. one side object oriented one side relational in case should write integration tests, insert data in db, actual instance or in-memory instance ( h2 , hsqldb , ...) prepare data, there's plenty possibilities here ( dbunit , dbsetup , ...) configure , run dao tests on database it may require more setup , more time run better in long run. more ro...

sql server - Connecting to SQL from client-side javascript -

is possible connect sql database, e.g. sql server database , javascript (client-side). preferably using odbc or oledb connection. i know isn't recommended, , should connect server-side, want people connect own sql databases on own local machines. i have found examples using activex objects, works in internet explorer, , don't want restricted this. i don't know of browser-side database drivers, perhaps check out postgrest: https://github.com/begriffs/postgrest wraps postgresql in simple rest api, don't need additional server software.

java - Text area's Font family is not changing -

in java program, created textarea menubar , unable change font family of textarea only ta.setfont(new font(font.serif,font.plain,14)); is working since here used font class constants. but not working... ta.setfont(new font("arial",font.plain,14)); after statement font in textarea still default. neither "comic sans ms" working.. try: textarea.setfont(new font("arial", font.plain, 14));

c# - Show only a section of an image in WPF Datagrid rows? -

i have images (on local drive) of 200x275 in dimension , i'm filling 1 row in data grid them using following code: xaml : datagrid.columns <datagridtemplatecolumn header="img" width="sizetocells"> <datagridtemplatecolumn.celltemplate> <datatemplate> <image width="200" height="275" margin="0,0,0,-100" source="{binding path=img}" /> </datatemplate> </datagridtemplatecolumn.celltemplate> </datagridtemplatecolumn> in xaml.cs file have img property of type bitmapimage (stores uri bitmapimage) , using collectionviewsource update changes list of includes column images. displaying them fine, want display section of each image sort of preview (same width of 200px, 10px top, , 50px in height - later i'll have full image display when small preview of clicked). from above bit of code can see tried changing margin values (-100 bottom) - ki...

android - Multiple APKs or single APK for different API levels? -

i have apk file contains application running on minimum of api 21 can best support material design functions. since android lollipop (api 21) runs on 12.4% of devices , naturally want support lower apis. best way me create application different layouts both api v21 , less v21? should create 2 different apps, 1 optimized v21 , 1 less v21, or there easier way go it? thanks! look, can create multiple apps & can use androids support library.(the android support library 1 of best resources accomplishing taking care of little things you).it's choice choose.

java - Iterative Depth First Search To Find A String (2D Array) -

i'm trying create iterative approach boggle game. class contains fields 2d array of strings called "board" , has 2d array of booleans called "havevisit". method calls test 2 loops through whole board, finding positions of first character of target string, passes coordinates test2 method, returning list holding coordinates. the return1index method takes 2d array coordinate @ creates int representative of coordinates corresponding 1d array it. return2dindex opposite , returns int array holding 2 coordinates. public list<integer> test2(int row1, int row2, string findme){ string temp = findme; list<integer> output = new arraylist<integer>(); if (board[row1][row2].charat(0) != findme.charat(0)) return output; havevisit = new boolean[size][size]; int row = row1; int column = row2; output.add(return1dindex(row, column)); havevisit[row][column] = tru...

javascript - Microsoft Edge not accepting hashes for Content-Security Policy -

the problem content-security-policy should blacklist script , style parsing default , allow based on various instructions of 1 verified hash of expected output. browser must fail implement javascript or css has not been given matching hash in advance. code matching hash should executed normal. microsoft edge refusing js/css in-page blocks. instructions visit live demonstration link below in microsoft edge, , in other browser. live demonstration: http://output.jsbin.com/biqidoqebu demonstration original source code <!doctype html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="content-security-policy" content="default-src 'self'; style-src 'sha256-jtuhvm7uqo2kx5iegwxn+rheyzzsyfelfo2gxvyeuwa='; script-src https://ajax.googleapis.com 'sha256-izzrsbzugxfoatdnb/e6rqbssyxqrp7w8ytzd2wg/rc=';" /> <meta http-equiv="x-content-security-policy" content="default-src '...

ruby on rails - Integrate facebook login for already registered users -

i integrating facebook login in application using example code omniauth documentation https://github.com/plataformatec/devise/wiki/omniauth:-overview def self.from_omniauth(hash) where(email: hash.info.email).first_or_create |user| user.email = hash.info.email user.password = devise.friendly_token[0,20] user.username = hash.info.name # assuming user model has name end end class users::omniauthcallbackscontroller < devise::omniauthcallbackscontroller def facebook # render :text => request.env['omniauth.auth'].to_yaml # need implement method below in model (e.g. app/models/user.rb) @user = user.from_omniauth(request.env["omniauth.auth"]) if @user.persisted? sign_in_and_redirect @user, :event => :authentication #this throw if @user not activated set_flash_message(:notice, :success, :kind => "facebook") if is_navigational_format? else session["devise.facebook_data"] = req...

.properties file that contains spring-messages encoding error -

in web application(built on spring tool suite) maintain 2 .properties files keep website messages in greek , english language. face following problem. in file containing greek messages, messages loose encoding , represented question marks, following sample .properties file depicts: valid.telephone.number=? ??????? ??? ???????? ?????? ?????????? ?????? valid.email=?? ?????? ????????? ???????????? ???????????? valid.url=?? ?????? ????????? ???????????? ?????????? valid.afm=?? ?????o ??? the problem occurs @ random times, of times without adding new message file. messages on jsp's correctly presented though. haven't found solution problem , everytime occurs replace file our repository. if have not set encoding, try set utf-8.

javascript - Issue with onclick function -

hi have written gsp , javascript code perform on click remove file functionality. javascript code function remove(attachmentid) { $(document).ready(function(){ $('.glyphicon-remove').click ( function(e){ e.preventdefault(); $(this).parent().parent().remove(); $.ajax({ url: "${g.createlink(controller: "landing", action: "deleteselectedfile")}", data: { attachmentid: attachmentid }, success: function(data){ alert("success"); } }); }); }); } gsp code <g:each in="${filelist}" var="file"> <div> <a href=...

salt stack - Mysql Grant root permission for any host -

i trying install mysql using salt-stack on ec2 instance. add grant root user. should accessible host using password. here's state file: mysql-server: pkg: - installed - pkgs: - mysql-server - python-mysqldb service: - running - name: mysql - enable: true - require: - pkg: mysql-server - watch: - file: /etc/mysql/my.cnf mysql_user: - present - name: root - password: {{ pillar['mysql']['server']['root_password'] }} - require: - service: mysql /srv/.my.cnf: file: - managed - source: salt://files/mysql/app-my.cnf - user: app - group: app - mode: 0600 - template: jinja - require: - user: app /root/.my.cnf: file: - managed - source: salt://files/mysql/root-my.cnf - user: root - group: root - mode: 0600 - template: jinja {{pillar.default_database.name}}: mysql_database.present mysql-app-user: mysql_user.presen...

angularjs - Inject config/constant from html -

i have problem, easier me inject configuration angular app html. i'm thinking like: in html: <body ng-app="myapp" my-config="abc"> </body> so later convert it constant, can easier reuse value across rest of app. like: angular .module('myapp', []) .constant('my_config', /** value become set in html */); would possible? help! i've solved differently. in end of <body> , after js files loaded i'm setting value: <body ng-app="myapp"> <!-- [...] --> <script> angular .module('myapp') .constant('my_config', 'testing.config'); </script> </body>

Increase Joomla 3 responsive menu collapse point using only CSS -

i built joomla 3.4.3 custom template using standard css, no less or sass or custom javascript. my menu has quite few items , last items overflow second line long before standard collapse point of around 980px. is possible use standard css increase collapse point 1310px? any appreciated.

ruby on rails - Thinking Sphinx - undefined method `klass' -

i have artwork model associated models subject , location , keyword , style , , medium habtm. have association artist model one-to-many. here's error keep getting: >rake ts:index generating configuration /users/<user>/developer/jtodd/jtoddgalleries/config/development.sphinx.conf rake aborted! nomethoderror: undefined method `klass' nil:nilclass here's indices file: thinkingsphinx::index.define :artwork, :with => :active_record indexes title, :sortable => true has jtg has width has height has subject.id, :as => :subject_ids has location.id, :as => :location_ids has keyword.id, :as => :keyword_ids has artist.first_name, :as => :artist_first has artist.last_name, :as => :artist_last has style.id, :as => :style_ids has medium.id, :as => :medium_ids end i can't figure out why keep getting different errors. may not have firm grasp on fields vs. attributes , maybe that's i...

tortoisesvn - SVN merge: Is there a way to avoid having "tree conflicts" flagged for identical files? -

this happens me time when merging, , i'm not sure why (i saw several answers detailing several possible causes) cause not relevant question, because regardless of causes "tree conflicts" on identical files in identical paths result same: nothing @ needs changed , "conflict" can marked resolved. so every time have "tree conflict" have [checkout source file if it's not there,] use diff tool windiff (because being " tree conflict" no svn client opens diff tool, although both files there), compare 2 files find out whether identical (they are) , if yes mark conflict resolved without making absolutely change "solve" conflict. obviously very time-wasting , feels frustrating , pointless. so i'm wondering if there way - through svn switch or svn client or else - make tree conflicts won't flagged in cases it's 100% sure nothing @ needs changed in order solve conflict - in case of example above. added : interesting...

c++ - Base class unique_ptr to derived class shared_ptr -

i have base class passing unique_ptr reference function , want copy/move derived class shared_ptr (or unique_ptr want guarantee no memory leaked throughout execution). i doing this: std::shared_ptr<derived> f(unique_ptr<base>& b_ptr){ std::shared_ptr<derived> d_ptr= std::make_shared<base>(std::move(b_ptr)); return d_ptr; } this have, know not right way, know how this. you almost correct. std::make_shared creates new object, using perfect forwarding, unless there constructor taking std::unique_ptr& , thats not want. in order this, need std::shared_ptr 's constructor std::unique_ptr use std::static_pointer_cast function: #include <memory> #include <iostream> class parent{ virtual ~parent(); }; class derived : public parent { }; std::shared_ptr<derived> f(std::unique_ptr<parent>&& b_ptr) { auto shared_base = std::shared_ptr < parent > {std::move(b_ptr)}; return std::...

chart.js - How could I skip drawing empty/zero value and its value on tooltip -

Image
i want skip points zero value on line chart of chartjs . how ? expected result sampledata :labels => [ [ 0] "10/01 (thu)", [ 1] "10/02 (fri)", [ 2] "10/03 (sat)", [ 3] "10/04 (sun)", [ 4] "10/05 (mon)", [ 5] "10/06 (tue)", [ 6] "10/07 (wed)", [ 7] "10/08 (thu)", [ 8] "10/09 (fri)", [ 9] "10/10 (sat)", [10] "10/11 (sun)", [11] "10/12 (mon)", [12] "10/13 (tue)", [13] "10/14 (wed)", [14] "10/15 (thu)", [15] "10/16 (fri)", [16] "10/17 (sat)", [17] "10/18 (sun)", [18] "10/19 (mon)", [19] "10/20 (tue)", [20] "10/21 (wed)", [21] "10/22 (thu)", [22] "10/23 (fri)", [23] "10/24 (sat)", [24] "10/25 (sun)", [25] "10/26 (m...

python - Matplotlib hexbin log scale colorbar tick labels as exponents -

Image
when creating 2-d histogram matplotlibs hexbin log scale colours ( bins="log" ), colorbar shows exponents instead of values: how can make show values , exponent tick marks in x , y axes in plot above? a partial answer use norm=matplotlib.colors.lognorm() instead of bins='log' . doesn't show lesser tick marks though

css - How to set width of paper-textarea in Polymer 1.0? -

does knows how set width of paper-textarea ? using css selectors in polymer 1.0 style tags seems not work @ all. paper-textarea element composed paper-input-container . tried following: <style> paper-textarea + paper-input-container { min-width: 324px; width: 324px; margin-right: 24px; } paper-textarea > paper-input-container { min-width: 324px; width: 324px; margin-right: 24px; } paper-textarea paper-input-container { min-width: 324px; width: 324px; margin-right: 24px; } </style> neither of css selectors above worked in custom element. <style> :root { --paper-input-container: { min-width: 324px; width: 324px; margin-right: 24px; }; } </style> will trick. style every polymer element makes use of paper-input-container (like paper-textarea) above width , margin.

github - git local repo caching deleted remotes/origin branches -

i have local repo created git clone i'm on branch master i perform git pull , git branch -a the list of branches includes remotes\origin\branch-x when in fact branch-x has been deleted on github. how can refresh local repo branches cache reflect state on github ? use git fetch --prune prune deleted branches. additionally can set default pull or fetch running git config remote.<remote name>.prune true

javascript - How to rewrite loop to recursion -

i implemented search function , loop search collection. in first iteration need search collection, next iterations result of first iteration. use if-statement if (i >= 1) collection = result; it, it's not safe because need save collection. possible rewrite loop recursion function? how can make or make code elegant? var targets = target.split(' '); // => ['hello', 'world']; (var = 0; < targets.length; ++i) { if (i >= 1) { collection = result; } result = includes(collection, props, targets[i]); } my search function: function includes(collection, props, target) { var result = []; var collection_length = collection.length; var props_length = props.length; var target_length = target.length; (var = 0; < collection_length; ++i) { (var j = 0; j < props_length; ++j) { if (collection[i][props[j]]) { if (collection[i][props[j]].tolowercase().slice(0, target_length...