Posts

Showing posts from August, 2014

cakephp - Where/What is "Remainder" in New Relic -

Image
i have cake php project , trace report " remainder " cosuming 25% of server time. remainder don't exist in project. what " remainder " ?where " remainder "? any help? i found it! hi again @gguirand just further clarify have bit more of addendum above response. the transaction trace summary chart shows top 6 components contributed transaction time trace in question. all other components bundled "remainder". in other words, transaction trace summary chart ever show 7 components, 1 being "remainder". "trace details" tab list instrumented components, including bundled remainder.

iOS In-App-Purchase Sandbox restoring consumable purchase -

my app contains consumable iaps. attempting buy same consumable iap second time in row in sandbox environment, 3 seconds after transaction screen pops saying purchase has been bought , restored free. since iap defined consumable in itunes connect, don't see how app store wants restore it. sandbox bug , work when submitted? make sure iap marked consumable in itunes connect. should solve problem... http://i.stack.imgur.com/mhrll.png

Python Defining Lists in Lists -

i trying define table colors contains various other tables containing tuples represent colors. title_label = [ text = (236, 218, 51), background = (125, 142, 246) ], start_button = [ text = (32, 40, 145), background = (236, 235, 136), pressed = (44, 51, 112) ], quit_button = [ text = (166, 21, 13), background = (48, 61, 188), pressed = (31, 40, 129) ] however, gives invalid syntax error. why that? lists don't take name-value pairs. want dictionaries here instead: definitions = { 'title_label': { 'text': (236, 218, 51), 'background': (125, 142, 246) }, 'start_button': { 'text': (32, 40, 145), 'background': (236, 235, 136), 'pressed': (44, 51, 112) }, 'quit_button': { 'text': (166, 21, 13), 'background': (48, 61, 188), 'pressed': (31, 40, 129) } } i'm not sure found syntax, not valid py...

ios - how can I increase the size of cell in UITableViewController at run time when the text to be entered in the cell is large? -

i loading data uitableviewcell server , problem text returned large , less . problem when large text returned , tableview cell not able display whole data , , when text returned small , there blank space in cell not good. can me in matter please ? don't own height calculations. let auto layout (and self-sizing cells) work. here's an excellent walkthrough covering do , similar question.

c# - Dollar Object intricacies -

i reading kent beck's book "test driven development: example." in book, there coding example: public class dollar { public int _amount; public dollar(int amount) { _amount = amount; } public dollar times(int multiplier) { return new dollar(_amount *= multiplier); } } [testmethod] public void testmethod2() { dollar 5 = new dollar(5); dollar product = five.times(2); assert.areequal(10, product._amount); product = five.times(3); assert.areequal(15, product._amount); } according kent, second dollar object: "product," necessary in order preserve original "five" dollar object; however, second assertion returns false because product._amount equal 30. have been unable find errata on text. how kent's code above need change in order have second assertion equal true or 15 == 15? book's example flawed? why product._amount in second assertion not equal 15? ...

how to install logstash on windows 7 -

how install logstash on windows 7? i install zip file size 90 mb , version logstash-1.5.0 , extract file , move bath c:\logstash when run: c:\logstash\logstash-1.5.0\bin\logstash i have following message: io/console not supported; tty not manipulated no command given usage: logstash [command args] run command --help flag see arguments. example: logstash agent --help available commands: agent - runs logstash agent version - emits version info logstash any thank you the simple way started , verify logstash working start following command logstash -e 'input { stdin { } } output { stdout {} }' this means logstash echo type in console out console, example: c:\logstash\bin>logstash -e 'input { stdin { } } output { stdout {} }' io/console not supported; tty not manipulated settings: default filter workers: 4 logstash startup completed typed 2015-12-11t09:22:22.349z my_pc typed , typed 2015-12-11t09:22:26.218z my_pc , typed the next ...

caching - Can Redis use disk as part of a LRU cache? -

we have need distributed lru cache, 1 can use both memory , disk. have large dataset, stored on disk permenantly. dataset, create other calculated datasets, when clients need them. since these secondary datasets derived data persistent, never need permanently save derived data. i thought redis have ability use disk secondary lru cache, have not been able find documentation points that. seems redis uses disk persist entire cache. envisioned we'd able scale out horizontally bunch of redis instances. if redis can not this, there system does? if data not fit memory, os can swap out disk. called virtual memory. here find explanation: http://redis.io/topics/virtual-memory remark: want retrieve data, stuff on , have intermediate results. please check whether may want distribute processing, not data. take @ apache hadoop , apache spark.

FlexSlider affected -

when use 2 flexslider instance manual control of second flexslider affect first slider enter code here this.contenttabs.each((index: number, element: element) => { var slider: jquery = $(element); $('.flexslider', element).flexslider({ animation: "fade", overflow: "hidden", slideshow: false, smoothheight: true, directionnav: false, selector: '.content > .panel', controlscontainer: ".flexslider", manualcontrols: " .tabs >.tab", }) ; are both sliders using same class? makes sense controls react both sliders. if want them not interfere each other use different class each individual slider. (".flexslider1", ".flexslider2" example.)

actionscript 3 - AS3 Game spawn mechanics -

Image
i working on game friend, , need some code... in game want make balls appear on screen, in specific order, have created lists decide spawn balls, , color. example: var a:array = [["green", "red", "blue", "purple"], ["orange", "red", "yellow", "black"], ["green", "green", "blue", "pink"]] the inter dimensional arrays because of order want them spawn in(starting bottom). have figured out how spawn balls when spawn spawn on top of each other. can please me this? thanks! (i making in flash btw) code have: import flash.events.event; stage.addeventlistener(event.enter_frame, main); // variabels var row1:number = 92.25; var row2:number = 243.30; var row3:number = 394.30; var row4:number = 547.35; var pattern:array = pattern1; /* var array:array = pattern.reverse(); var rows:number = pattern1.length; */ //trace(pattern.re...

android - Creating an intent -

Image
i'm trying send intent photoshop express accepts raw images. in example i'm sending canon cr2 file. regardless of how specify action, data, or type can't seem pse pop option. pse manifest: <activity android:configchanges="orientation|screensize" android:launchmode="singletask" android:name="com.adobe.psmobile.psxeditactivity"> <meta-data android:name="android.support.parent_activity" android:value="com.adobe.psmobile.mainactivity"/> <intent-filter> <action android:name="android.intent.action.edit"/> <category android:name="android.intent.category.default"/> <data android:mimetype="image/jpeg"/> <data android:mimetype="image/png"/> </intent-filter> <intent-filter> <action android:name="andr...

javascript - How to get AngularJS to update the DOM on ng-repeat array splice? $scope.$apply() returns an error -

solved - have plunkr demonstrates issues facing. simple image uploader uses filereader display image (thanks angular-file-uploads ). have placed in dynamic form can added , removed. issues: in plunkr , dataurl not displayed until after add image clicked. may plunkr issue since image displayed nicely in site. --solved if upload image onto first form, click add image , , click first tab, delete first tab, data deleted in $scope.images dom not updated. adding $scope.$apply() results in digest in progress error. the old file name displayed in upload input input empty. my question is: how can dom updated when image removed? update: issue #1 solved, issues #2 , #3 remain. update2: i've tried attaching $scope.$apply <input type="file" onchange="..." removing image splice() not fire onchange event. update3: i've added simple text input ng-model="image.caption" see if the dom update appropiately. does. dom updates...

rename - How to use Python to replace all filenames that contain Chinese characters in several folders? -

the directory names , file names both contain chinese characters. i'd able convert english version. can make dictionary of {chinese:english}, have difficulties in getting file names os.walk. can help? new python. thanks. when you're having trouble mean? use os.walk() such: for root, dirs, files in os.walk('path/to/directory'): [logic within each directory] os.walk() creates generator of tuples of form (dirpath, dirnames, filenames) walk recursively through current folder , subsequent folders. can use elements of files filenames, dirs directory names in current directory, , root root directory both files , directories. use os.rename(). see: docs

html - Separately adjusting the height of 2 span elements in div -

my code <div id="open-toolkit"> <span class="glyphicon glyphicon-briefcase" style="margin-right: 4px; font-size: 18px;"></span> <span class="glyphicon glyphicon-chevron-right" style="font-size: 12px"> </span> </div> here jsfiddle https://jsfiddle.net/danielyaa5/m2q9aloa/2/ want move right-chevron icon upward cant seem so, adding margin top seems move whole row down, same adding padding. https://jsfiddle.net/m2q9aloa/6/ method=1 <div> <span id="open-toolkit" class="glyphicon glyphicon-briefcase" style="margin-right: 4px; font-size: 18px;"></span> <span class="glyphicon glyphicon-chevron-right" style="font-size: 18px;"></span> </div> method=2 <div> <span id="open-toolkit" class="glyphicon glyphicon-briefcase" style=...

MPI Fortran compiler optimization error -

this question has answer here: mpi_recv changes value of count 1 answer despite having written long, heavily parallelized codes complicated send/receives on 3 dimensional arrays, simple code 2 dimensional array of integers has got me @ wits end. combed stackoverflow possible solutions , found 1 resembled issue having: boost.mpi: what's received isn't sent! however solutions seem point looping segment of code culprit overwriting sections of memory. 1 seems act stranger. maybe careless oversight of simple detail on part. problem below code: program main implicit none include 'mpif.h' integer :: i, j integer :: counter, offset integer :: rank, ierr, stval integer, dimension(10, 10) :: passmat, prntmat !! passmat contains values passed prntmat call mpi_init(ierr) call mpi_comm_rank(mpi_comm_world, rank, ierr) counter = 0 offset = (rank + 1)...

C# how do i make it so when i type there are just stars -

this question has answer here: password masking console application 13 answers i'm using program made myself, it's program requires password open w/e application i've assigned too. don't know how make text * instead of regular text. it's console program. //read here private void form1_load(object sender, eventargs e) { //changes whatever type textbox asterisk textbox1.passwordchar = '*'; } private void textbox1_textchanged(object sender, eventargs e) { //ignore method } private void button1_click(object sender, eventargs e) { //just validate text want string text = textbox1.text; messagebox.show(text); }

ios - UITableViewController - TableView wider than screen -

Image
i'm having problem whole day. i'm using uitableviewcontroller. tableview has 5 static cells. put label inside cell , gave constraints. cell: every time when change screen different version of iphone, gives me warning width of label 600 (default in storyboard) , goes of screen on right side. why tableviewcontroller not setting tableview screen size? missing here? subview of viewcontroller , if so, how tell proper size of tableview inside storyboard constraints? just place table view controller storyboard , configure static cells. no constraints needed step. labels need different set of constraints: from picture i'm assuming want label on left side of table view in table view cells. in case don't need expand width that. drag label table view cell, place on left side, , a) center vertically b) pin right side of screen shown in screenshot (ignore value , make sure uncheck constrain margin. hope helps!

f# - Generate reports for all invalid data - Csv file data type validation? -

the following code defined schema of csv file , used load lot csv files. however, there data error, example, date not in correct format, missing data required fields, etc. how generate reports files using schema invalid data. , load executed if there no error. type mycsvtype = csvprovider<schema = "a (int), b (string), c (date)", hasheaders=true> mycsvtype.load(myfile) // execute when there no data error a proposed error report example: rows missing values: 20, 40, 60, ... rows invalid values: 30(nan), 31(xyz), .... b c rows invalid values: 200 (2015q1), .... there no built-in support - 1 option have explicitly make types of columns optional , check none values in data set. way, can list of rows missing or no data: type mycsvtype = csvprovider<schema="a (int option), b (string option), c (date option)", hasheaders=false> let c = mycsvtype.parse(""", hi, 1/1/2001 1, hi, foo""") printfn "ro...

regex - Regular expression string in java -

i want explain problem command string submitted client server. through specific command have login database managed server. according project's guide lines, command's formatting is: login@username;password. string sent server through socket. user inserts credentials , these sent server putting them command. server has split user , password command , has check, in database, if user exists. here problem, given fact in user , in password can present ; (the same character of separator), don't understand (server side) how can divide user , psw command user , psw same of ones inserted in client. have got ideas about? thinking use regular expression, right way? i split string user/pass string this: string userpass = "user;pass"; string[] parts = userpass.split(";"); string user = parts[0]; string pass = parts[1];

javascript - Initialize Angular Service (factory) when application start -

in angular application adding tracing functionality, should work separate plugin, if script included html angular should create service , initialize (run) it. plugin service because has mandatory dependency on $rootscope . implementation select use angular factory, (code in myservice.js ): angular.module('app').factory('mysevice', ['$rootscope', '$interval', servicefunc]); function servicefunc($rootscope, $interval) { return { run: function () { ... } } } and have problem how initialize it. solution enhance angular app run function (code in myservice.js): window.app.run(['mysevice', function (srvc) { srvc.run(); }]); where app defined in separate main app.js file like: var app = window.app = angular.module('app', [...]); app.run(['$state', 'breeze', ..., function ($state, breeze, ...) { ..real initialization.. } the code working fine. both main run , run myservice calls ...

SQL Server: extremely slow results when increasing top by 1 -

i've query joins several views , 1 table using inner joins. no sub-queries involved, joined fields indexed, , joins on int fields. using "top 342" in select clause results in query executes in ~2 seconds. if use same query , "top 343", query doesn't finish executing within 7 minutes. tried several other values below 342 worked expected. removing joined table query causes query complete within few seconds no matter value used top. i tried updating statistics on table using full-scan, didn't change anything. within same context of sql execution use: dbcc freeproccache go checkpoint; go dbcc dropcleanbuffers; go what types of things might cause slow execution? changing value of top alter row goal . this can have significant effect on rest of plan. might find top 342 happens produce plan non blocking operators such nested loops favoured top 343 sql server's costing model reckons cheaper use blocking operator such hash join ...

multithreading - What is the correct approach to write multiple small pieces to a temp file in c, in multithreads? -

i simulating multithreads file downloading. strategy in each thread receive small file pieces( each file piece has piece_length , piece_size , start_writing_pos ) and each thread writes same buffer. how realize ? have worry collisions ? //=================== follow ============// so write small demo follows: #include <stdio.h> int main(){ char* tempfilepath = "./testing"; file *fp; fp = fopen(tempfilepath,"w+");//w+: reading , writing fseek( fp, 9, seek_set);//starting in 10-th bytes fwrite("----------",sizeof(char), 10, fp); fclose(fp); } and before execution let content in "./testing" "xxxxxxxxxxxxxxxxxxx", after above "^@^@^@^@^@^@^@^@^@----------" wonder problem .... do torrent clients do. create file final size having extension .part . allocate non-overlapping parts of file each thread, shall have own file-descriptors. collisions avoided. rename final name when finished.

perl - How to put parameters into finds "wanted function" and get a return -

i rather new perl. have find function travers directory structure has "wanted function" called each found file. i want put in parameters "wanted function" , return value. i solved global variables , works, don´t code ;-) $param1 = "value"; $param2 = "value2"; find(\&wantedfunction , $directory); print $returnvalue; sub wantedfunction { #do $param1 , $param2 $returnvalue = f1($param1);"; } is there better way that? people have asked returning values file::find::find before; it's easy enough use anonymous subroutine or closure ikegami , sobrique described, common suggestion use module file::finder , think has cleaner interface. the following creates hash of paths inside /tmp corresponding levenshtein distance fixed string: use strict; use warnings; use 5.010; use data::dump; use file::find; use file::finder; use text::levenshtein qw(distance); $start = '/tmp/foo'; %distances = file::finder-...

php - How can I add a Submenu to the WordPress Admin Bar -

i need add dropdown menu wordpress in admin bar include multiple links. best solution? i looking answer question while , couldn't find solution on here thought help! found great blog post , perfect solution question: http://davidwalsh.name/add-submenu-wordpress-admin-bar like adding functionality theme , other admin area, directives go in theme's functions.php file. code should self explanatory: function create_dwb_menu() { global $wp_admin_bar; $menu_id = 'dwb'; $wp_admin_bar->add_menu(array('id' => $menu_id, 'title' => __('dwb'), 'href' => '/')); $wp_admin_bar->add_menu(array('parent' => $menu_id, 'title' => __('homepage'), 'id' => 'dwb-home', 'href' => '/', 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => $menu_id, 'title...

javascript - Input tag file value jquery -

i used bootstrap 3 model upload image, when value in file field in console got $('input[type="file"]').val(); // = "c:\fakepath\maxresdefault.jpg" but after send data time value in console $('input[type="file"]').val(); // = "" i got bad result. whats problem, selected image .and can see image name in file field result empty.how can fix it try this: <input type="file" name="uploader" id="uploader"> $(function(){ $('#uploader').change(function(){ console.log(this.value); }); });

string - Parse command line args to process a list of files in bash? -

i want create script optional inputs parsed similar how this respone explains containing list of files extension. example usage ./myscript.sh -s 25 -q 0.2 *.txt and script store 25 s variable, 0.2 q varable, , list of txt files individually processed. have far #!/bin/bash -f # set default values qmax=0.2 profilesize=50 while [[ $# > 0 ]] key="$1" case $key in -q|--max_q) qmax="$2" shift # past argument ;; -s|--profile_size) profilesize="$2" shift # past argument ;; esac shift # past argument or value done var in "$@" if [[ $var == *".txt" ]] # on real on each file here echo $qmax $profilesize $var fi done as is, can run default values commenting out while loop. without commenting out, reads through inputs , there none left for loop compare. think best option create list of files in while loop, use in for loop. ideas of how that? just appen...

c# - How to use mouseleave with if -

when checkbox checked , mouseleave-enter events false, when unchecked mouseleave-enter events true. how can them ? sorry bad language as stated @icemanind, have add business logic (i.e. if condition pertinent case) mouse enter/leave event handler. .net c#/wpf checkbox implemented shown in following sample code snippet: private void checkbox_mouseenter(object sender, mouseeventargs e) { checkbox chk = sender checkbox if((bool)chk.ischecked) { // code here } } private void checkbox_mouseleave(object sender, mouseeventargs e) { checkbox chk = sender checkbox if((bool)chk.ischecked) { // code here } } also, can combine these 2 event handlers 1 if logic both mouse enter/leave events similar. hope may help. best regards,

neo4j - How to create a relationship to existing nodes based on a condition of matching properties -

in neo4j, trying load csv file whilst creating relationship between nodes based on condition property matched. my cypher code is: load csv headers "file:c:/users/george.kyle/simple/simple scream v3.csv" csvline match (g:simplepages { page: csvline.page}),(y:simplepages {pagekeyword: csvline.keyword} ) match (n:sensitiveskin) g.keyword = n.keyword create (f)-[:_]->(n) you can see trying create relationship between 'simplepages' , 'sensitiveskin' based on keyword properties being same. the query executing relationships won't form. what hope when execute query such match (n:sensitiveskin) return n limit 25 you see nodes (both sensitive skin , simple pages) auto-complete switched on. create (f)-[:_]->(n) using f variable not defined, creating new node (with no label or properties) instead, , creating relationship new node. think meant use either g or y instead of f . (probably y , since don't otherwise use it?)

vba - How to populate listbox of MS access on Button Click Event -

i have sub in vba fetching data database on button click event below public sub getnearestpfk(runnr integer) dim db dao.database dim rs dao.recordset dim sqlstring string dim record object dim objpfk pfk dim integer = 0 set db = currentdb sqlstring = " select top 5 t_temp_destance_cal.* t_temp_destance_cal runid = " & runnr & " order distance " msgbox (sqlstringgetnearestpfk) set rs = db.openrecordset(sqlstring) until rs.eof objpfk.id = rs!id objpfk.fistname = rs!firstname objpfk.lastname = rs!lastname objpfk.distance = rs!distance objpfk.duration = rs!duration objpfk.address = rs!address arrayobjpfk(i) = objpfk rs.movenext = + 1 loop rs.close set rs = nothing set db = nothing end sub now have data want display how should display data in listbox on button click listbox populate you can set list box property called row source type table/query , row source property sql statement. if want update list box, update row sourc...

Need help on "this" in Javascript -

when each button in div clicked, want parent div disappear. instead of writing onclick="this.parentnode.style.display='none'" each button, want call function done() make code cleaner, syntax did not work in done(). ideas? <div id="arms_1" class="col_1"> <p></p> <p></p> <p></p> <button type="button" onclick="this.parentnode.style.display='none'">done</button> </div> <div id="arms_2" class="col_2"> <p></p> <p></p> <p></p> <button type="button" onclick=done()>done</button> </div> <div id="arms_3" class="col_3"> <p></p> <p></p> <p></p> ...

java - Why is this a Boolean and how do i solve it? -

ok, aswitch object .status() method true or false i want check each individual switch along column, , if on store column number of "on" columns in array count. tried variation of following no avail. private aswitch[10][10] grid; public arraylist<integer> checkcol() { arraylist<integer> count = new arraylist<integer>(); int j =0; (int = 0; i<10; i++) if(grid[i][j].status()){ j++; if ( j == 9) { count.add(i); j=0; } } return count; } its halting on if (j == 9) line , think somehow thinks boolean value while think index value j. any appreciated. you correct in noting j not boolean value, if statements require boolean expression test true or false , (j == 9) 1 such boolean expression. it's no different if had string s , typed if(s.length() > 0) .

sql server - Sum sale amount from one table and update the total to another table -

using sql server compact edition (2008 r2) tables ( customer , orders ) pk (customer : sid , orders : customer_sid ) i want sum orders.sales_amount , write totals customer.sales_total based on sid s. i must using inner join statement incorrectly error in from statement. update customer set sales_total = aggr.sales_total customer inner join ( select sid ,sum(sales_amount) sales_total customer inner join orders on (customer.sid = orders.customer_sid) group customer.sid ) aggr on customer.sid = aggr.sid; there simpler way of accomplishing update after: update customer set sales_total = (select sum(sales_amount) orders orders.customer_sid = customer.sid) demo here

ios - check for specific gesture recognizer -

i have uipageviewcontroller contains vcs. in pageviewcontroller can swipe left, right change vcs. everytime animation finish add gesturerecognizer it. question how check view have specific recognizer or not? need code this: if check view has specific recognizer == false { add recognizer }else{ skip. } i doing because have sidebarmenu. when sidebarmenu appears want add gesture current index pagecontentviewcontroller. so, code works fine, dont want add gesture everytime animation finishes. i adding code. problem gestures created in other class(not current). first creating instance of class keep gestures: let transtionmanger = transitionmanger() after add var of class named exitpangesture: pagecontentviewcontroller.view.addgesturerecognizer(transtionmanger.exitpangesture3) the problem add everytime view appears. want check existence of gesture before adding it. dont want add everytime. is looking for? please see comments explanation: // if gesture recogniser ...

apache - htaccess /index.php extensions shows after redirected from old domain -

i have redirect issue occurring, far, i've redirected non-www www, , old domain new domain. i've remove /index.php extension works unless redirecting old domain. ideally i'd not occur. shot in dark me, don't understand of means (htaccess code), got working part far. what trying do: i'm attempting remove .php extensions ( some of pages on old domain use .html extension, .php pages. there's redirect in there ) , have routed new www.domain.com (not domain.com). is there specific order execute redirects in? or missing entirely. .htaccess isn't strong suite. additionally, should have these in separate <ifmodules> ? (they are, combined them 1 less code in post) <ifmodule mod_rewrite.c> directoryindex index.php adddefaultcharset utf-8 options +followsymlinks -multiviews -indexes rewriteengine on rewritebase / # redirect new domain rewritecond %{http_host} !newdomain.com$ [nc] rewriterule ^(.*)$ http://w...

How can I pass data between GSP and controller in Grails without storing in the database? -

is possible enter data in gsp view , use data in controller inside program operations without storing data in domain. example have g:textfield , enter name. want able use name enter in controller manipulate. none of data passed view controller has line particular domain. there couple of ways this. the view: <g:textfield name="name" /> the controller: class somecontroller { def someaction() { def name = params.name // name } } you use command object . the command object: @validateable class somecommand { string name static constraints = { name nullable: false } } the controller: class somecontroller { def someaction(somecommand somecommand) { if (!somecommand.haserrors()) { def name = somecommand.name // name } } }

Sql to Hql query in grails for a very large assosiation -

in app there's following relation: page hasmany paragraphs , need create query returns pages number of paragraphs less limit. problem pages created in app approximately 2 per second , paragraphs table contains more 2 million rows . standard grails approaches, dynamic finders , criteria queries hang create not optimal sql. in database console following query job: select * ( select a.id, count(b.page_id) count page left join paragraph b on a.id = b.page_id group 1) sub sub.count <= 10 limit 1000 and couln't translate query hql. know there's groovy sql available, it's rows method returns list of groovyresult, not list of domain classes. there better approach issue? if query gets complicated tend this: def results = new sql(datasource).rows(sql)*.id*.astype(integer).colect(domainclass.&get) i know doesn't great , you'd probable no kudos gets job done. if you'd use more expressive give try jooq ( http://www.jooq.org/ ) ...

javascript - Defining custom css attributes and changing any value with animate() -

i'm trying make result screen in javascript displays animated scores. specific field in example it's supposed go value 0 in 2 seconds, 2 seconds after screen appears. since it's easy change css values animate() thought assign values custom css property, have element's value take there. according this article have place -- in front of custom css attributes , this one shows me how use animate() method. tried doing this $elementsuccess.css('--value', scoreplus); and turns out --value 's value undefined . when display scoreplus somewhere appears, it's defined. there way define custom value? here entire code element. there errors if custom attribute defined correctly? $elementsuccess.html(scoreplus); $elementsuccess.css('--value', scoreplus); settimeout(function(){ $elementsuccess.animate({ '--value': 0 }, { duration: 2000, progress: function(){ $elements...

How to fix canvas seo limits? -

i'm designer noob developer. know basic html/css/javascript/python. part design sites using canvas element since i'm vector art , can make kick ass sites that. didn't know seo crawlers cant read text in canvas elements practically making site invisible google. on thread here mentioned fixed if 1 "programmatically move html elements text using css". can please explain simple way this? display: none; this remove element flow of page (and sight) still allow google index it . display property documentation

Calculating shadow values for all Material Design elevations -

in latest material design documentation ( https://www.google.com/design/spec/what-is-material/elevation-shadows.html#elevation-shadows-elevation-android- ) exhaustive set of ui elements referenced respective elevation (z-index in dp). example switch elevated 1dp , while dialog elevated 24dp . google's list of ui elements uses 10 different elevation levels. since elevation decides shadow of element, we'll need 10 different shadows. , that's i'm lost. how calculate/deduce right shadow values (color, x-offset, y-offset, blur, spread) each elevation level? i've found different sources have calculated shadow values 5 different elevations ( https://news.layervault.com/stories/42319-calculating-shadow-values-for-material-design ). however, 5 elevation steps not enough, nor give explanation how got these respective values. here's function came gives result, believe: (javascript) function getshadow(object, dp) { if (dp <= 0) { pa...

php - CodeIgniter clone database -

how clone database in codeigniter? have databases: clockin_admin clockin_template the database clockin_template 1 want clone, different name. there function this? can't find on documentation. i'm creating new database way: $this->load->dbforge(); $this->dbforge->create_database('clockin_' . randomstr());

java - Google Drive Api result.getStatus().isSuccess() always true -

i'm managing callback way result success when shouldn't. example: i search file doesn't exist , doesn't show log i search file when disconnected internet , still doesn't show log even if create file on drive when disconnected internet , set callback creation, result success. here callback code resultcallback<driveapi.drivecontentsresult> searchcallback = new resultcallback<driveapi.drivecontentsresult>() { @override public void onresult(driveapi.drivecontentsresult result) { if (!result.getstatus().issuccess()) { log.e(tag, "cant open file"); } } }; what doing wrong? the android api has offline support, performing operation while offline not fail. instead, changes queued occur when device comes online. similarly, searching doesn't exist doesn't fail, returns empty result. you handling of success ...

c# - Sorting a dynamic object list based on another list -

i have 2 lists. 1 dynamic list of objects. list of strings. want sort object list based on other list. list<dynamic> list1; // object1,object2,object3,object4 list <string> list2; //"abc","bcd","da" these objects has 1 of attributes "alphabets" on basis has sorted. the objects may not equal number of elements in second list. something might work, if indexes of 2 lists align how want them to. you'd have ensure lists have same length work correctly though. var result = list1 .select((item, index) => new { item = item, order = list2[index] }) .orderby(x => x.order) .select(x => x.item); if aren't same length, criteria order? undefined problem. 1 approach put them @ end of list. var result = list1.take(list2.length) .select((item, index) => new { item = item, order = list2[index] }) .orderby(x ...

How can I create an iMacros that autopost on facebook? -

i have facebook page business. want able write , save posts of 1 day in 10 minutes , lunch imacro post them 1 one every 30 minutes . searched in google , found out imacros easiest way. how can create imacros autopost on facebook ? should start ? thank you. var contents = null, images = null, groups = null; var codedefault1="tab closeallothers\n set !extract_test_popup no\n set !timeout_page 10\n set !errorignore yes\n set !timeout_step 0.1\n"; var codedefault2="set !extract_test_popup no\n set !timeout_page 10\n set !errorignore yes\n set !timeout_step 0.1\n"; var wm = components.classes["@mozilla.org/appshell/window-mediator;1"].getservice(components.interfaces.nsiwindowmediator); var window = wm.getmostrecentwindow("navigator:browser"); function random(a,b){var c= b-a; return math.floor((math.random()*c)+a);} function playpost(groups,contents,images,time1,time2){ for(key in groups){ if(typeof(gr...

configuration - Nginx: setting the error page to a static file -

i have following nginx configuration: server { listen 80; server_name default; location / { proxy_set_header host $host; proxy_pass http://127.0.0.1:8080/; } } when internal service @ http://127.0.0.1:8080/ not responding nginx return 502 bad gatway error . my question : how can configure nginx returning static html file, e.g. /var/www/error.html , when such error occurs? what tried taking cue from here tried this: server { listen 80; server_name default; location / { proxy_set_header host $host; proxy_pass http://127.0.0.1:8080/; } error_page 404 502 /error.html; location = /error.html { internal; root /var/www; } } it's working fine if service (on port 8080 ) down, when service , try access url /error.html nginx match last location (returning me static file) , avoid it. well, if don't want expose error page, use named location. server { listen 80; serve...

java - How do I define only scheduler attribues in the deploymnet descriptor, not the whole bean? -

i have following bean: @stateless public class newsessionbean { public void myjob() { system.out.println("run"); } } and have myjob running every 10 seconds, have deployment descriptor: <ejb-jar xmlns = "http://java.sun.com/xml/ns/javaee" version = "3.1" xmlns:xsi = "http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation = "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"> <enterprise-beans> <session> <ejb-name>newsessionbean</ejb-name> <ejb-class>org.test.newsessionbean</ejb-class> <session-type>stateless</session-type> <timer> <schedule> <second>*/10</second> <minute>*</minute> <hour>*</hour> <month>*</month> <year>*</year> </schedul...

python - Efficient way to do math in elements of a numpy array according to condition -

i trying optimize python code. 1 of bottlenecks comes when tried apply function numpy array according each element value. instance, have array thousand elements , apply function values greater tolerance , function (taylor series) rest. masking still slow, @ least i'm calling following functions 64 millions times. epsilonzeta = 1.0e-6 zeta1_12 = 1.0/12.0 zeta1_720 = 1.0/720.0 def masked_condition_zero(array, tolerance): """ return indices values lesser (and greater) tolerance """ # search indices array values < tolerance indzeros_ = np.where(np.abs(array) < tolerance)[0] # create mask mask_ = np.ones(np.shape(array), dtype=bool) mask_[[indzeros_]] = false return (~mask_, mask_) def bernoulli_function1(zeta): """ returns bernoulli function of zeta, vector version """ # indices according condition zeros_, others_ = masked_condition_zero(zeta, epsilonzeta) ...

svn - All libraries are showing error after updating SDK version to 24.3 in Android -

Image
all libraries ware fine before updating sdk. update sdk through sdk manager , out of control now. libraries showing 1 cross mark on folder , no error inside. have taken images show here. v7 lib: unfortunately couldn't found issue inside library. google-play-service-lib: same issue. fortunately have found errors in error log, not sufficient me resolve. android sdk manager: the main issue deleted r.java classes projects in these libraries involved. can knows how resolve problem. happened me .. somehow files ( r.java ) got corrupted after latest sdk update, that's why can observe support library name changed appcompat_v7 android-support-v7-appcompat . solution worked me remove libraries workspace have error & re-import them workspace. for example - importing support library appcompat_v7 , re-import sdk location: (\adt-bundle-windows-x86-20140702\sdk\extras\android\support\v7\appcompat) likewise re-import other corrupted libr...

angular ui bootstrap - AngularJS ui modal not working properly -

i'm building application on angularjs , i'm using ui-modal, instead of creating separete views edit , create (which identical) want 2 instances of modal operating on same view. did i have 1 main controller has functions create , edit, both of them opens own instance of modal : (function() { 'use strict'; angular.module( 'app.projects' ) .controller('projectscontroller', projectscontroller ); projectscontroller.$inject = ['$scope', '$modal']; function projectscontroller( $scope, $modal ) { $scope.edit = function( projectid ) { var modalinstance = $modal.open( { templateurl: 'modules/projects/view/modal/project.html', controller: 'editprojectmodalinstcontroller', size: 'lg', resolve: { projectid: function(){ return projectid; } ...

ios - How can I add a vibrancy effect to a subview? -

the code below works fine simple: uivisualeffectview *blurview but, when try add label has vibrancy effect breaks down in tears , errors. :( uiblureffect * effect = [uiblureffect effectwithstyle:uiblureffectstylelight]; _blurview = [[uivisualeffectview alloc] initwitheffect:effect]; _blurview.backgroundcolor = [uicolor colorwithwhite:0.8 alpha:0.5]; [self addsubview:_blurview]; uivisualeffectview * vibrancyview = [[uivisualeffectview alloc] initwitheffect:effect]; [_blurview.contentview addsubview:vibrancyview]; _titlelabel = [[uilabel alloc] init]; _titlelabel.font = [uifont boldsystemfontofsize:17.0]; _titlelabel.textcolor = [uicolor colorwithwhite:0.1 alpha:0.5]; _titlelabel.text = @"title"; [vibrancyview.contentview addsubview:_titlelabel]; custom set frame method: #pragma mark - - (void)setframe:(cgrect)frame { [super setframe:frame]; _blurview.frame = cgrectmake(0, 0, frame.size.width, frame.size.h...

Jquery UI Sortable width is incorrect when dragging an element with a inline width percentage -

i using jquery ui sortable sort group of divs percentage widths not known before run time. therefore setting them via inline style. the issue when sortable div dragged it's width not calculated , set accordingly stretches percentage of wrong element. is bug in jquery ui or missing something? here simplified html <div id="container"> <div id="maincolumn"> <div style="width:80%;" class="sortableitem"> item 1 needs 80% width </div> <div style="width:100%;" class="sortableitem"> item 2 needs 100% width </div> <div style="width:50%;" class="sortableitem"> item 3 needs 50% width </div> </div> here fiddle shows issue https://jsfiddle.net/qkunja68/ when dragging 3 items not keep width. you can set forcehelpersize property of sortable object true when call sortable() i cha...

C#: Cannot locate System libraries -

i have looked in regedit , found running .net version 4.5.1 , therefore libraries after should available me. i try include namespaces: using system.io.memorystream; using system.media.soundplayer; however vs complains namespaces not exist. the reference pages memorystream , soundplayer dictate these should available in version of .net. how can fix this? you confusing class names , namespaces , possibly using directive using statement. system.io namespace. it's grouping construct used logically group classes , structs , avoid name clashes. system.io.memorystream class inside system.io namespace. if want use memorystream can either: var ms = new system.io.memorystream(...); or, avoid verbosity of specifying namespace (a full qualified name), can use using directive: using system.io; and can use class name: var ms = new memorystream(...); you can think of using directive telling compiler search paths use when looking class. if ask memor...

c++ - Geometry rounding problems: object no longer convex after simple transformations -

Image
i'm making little app analyze geometry. in 1 part of program, use algorithm has have convex object input. luckily, objects convex, barely (see image). after apply transformations, algorithm fails work (it produces "infinitely" long polygons, etc), , think because of rounding errors in image; top vertex in cylinder gets "pushed in" because of rounding errors (very exaggerated in image) , no longer convex. so question is: know of method "slightly convexify" object? here's 1 method tried implement didn't seem work (or implemented wrong): 1. average vertices create vertex c inside convex shape. 2. let d[v] distance c vertex v. 3. scale each vertex v center c scale factor 1 / (1+d[v] * convexification_factor) thanks!! have cgal , boost installed can use of library functions (and do). you can make object convex computing convex hull of it. that'll "convexify" anything. if you're sure input has departed bein...