Posts

Showing posts from April, 2012

php - array count base on how many it appear -

i newbie in php. i have mysqli_fetch_array looks inside while loop" array(7) { ["id"]=> string(32) "00000000000000000000000000000001" ["name"]=> string(5) "admin" ["product"]=> string(32) "ps4" } array(7) { ["id"]=> string(32) "00000000000000000000000000000001" ["name"]=> string(5) "mike" ["product"]=> string(32) "iphone" } array(7) { ["id"]=> string(32) "00000000000000000000000000000001" ["name"]=> string(5) "mike" ["product"]=> string(32) "imac" } array(7) { ["id"]=> string(32) "00000000000000000000000000000001" ["name"]=> string(5) "mike" ["product"]=> string(32) "lcd monitor" } i want count how many times admin , mike appear in loop: far know how...

eclipse - Java Swing program slows down over time in Ubuntu -

so made solitaire game java swing. tested on windows , mac osx , worked fine. then, installed ubuntu on macbook pro, , when run ubuntu, works gradually slows down, slowing down computer itself. using java 8 openjdk, running eclipse (although running terminal results in same problem). here code: solitaire.java package solitaire; import java.awt.event.keyevent; import java.awt.event.keylistener; import java.awt.event.mouseevent; import java.awt.image.bufferedimage; import java.io.file; import java.util.arraylist; import java.util.hashmap; import java.util.list; import java.util.map; import javax.imageio.imageio; import javax.swing.jframe; import javax.swing.event.mouseinputlistener; import cards.card; import cards.deck; public class solitaire extends jframe implements keylistener, mouseinputlistener { private static final long serialversionuid = -6358510224557653758l; public static solitaire app; public static map<card.suit,map<integer,bufferedimage>...

python - How to inject an object into sqlalchemy session? -

i want use tracking system of sqlalchemy orm. want inject ready model object (which inherited base , can used in sqlalchemy) ready session obejct without connecting database. tried doing session.merge(obj, load=false) no success! complains object state. can't imagine how can seduce it. want inject object , make changes , use session.dirty track changes. when using merge load=true (default) works. refuse connect database via session reason. class alaki(base): __tablename__ = 'alaki' alaki_id = column(integer, primary_key=true) name = column(localizedstring) age = column(integer) children = relationship('alakichildren') model = alaki(alaki_id=5, name='test',age=32) self.db_session.merge(model) # works connects database self.db_session.merge(model, load=false) #fails! item in self.db_session.dirty: print('dirty:' ,item)

unity3d - Unity objects and animation -

i using cinema 4d create objects , animations. there anyway import them unity 3d object formats , animation? 3dsmax? unity3d official docs provide detail guide importing objects cinema 4d

javascript - Filling the data gaps with a gray area using Highcharts, -

Image
i've highcharts line chart. sometimes, there's gap between data , wonder whether it's possible fill these gaps gray area it's better visible there no data. thanks edit: example of want have: you can use xaxis.plotbands fill gaps. note need calculate have null -points in first place, before rendering chart. here simple example you: http://jsfiddle.net/hbzolxnw/

MySQL Lookup Table + Multiple Constraints in one Lookup Table -

i have table called users has around 50 columns , need add constraints around 30 of 50 columns. typically in past create 30 constraint tables , apply each users table foreign key constraint. i wanted see if use 1 table 30 constraints? this 1 table incrementing primary key , 30 columns - 1 each constraint. constraints around 5 entries , around 100 entries there null data in of constraint lists. is realistic way multiple constraints or need use 1 table per constraint? thanks if constraint mean lookup tables, no, not combine them single table. if 1 of fields has 2 possible values , 1 has 3, first 1 still have 3 choices available in lookup table, if 3rd choice linked null. if worried number of lookup tables, consider using mysql's enum data type instead.

php - Getting a syntax error on a comment? Or am I missing something obvious? -

i writing report form weird syntax error. here code: <h2>report <u><?php echo $title; ?></u> machine program error</h2> <p><span class="error">* required field.</span></p> <form action="send_form_email.php?email=yes"> job number: <input type="text" name="jobid" value="<?php print ($jobid) ?>"> <!--<span class="error">* <?phpecho $nameerr;?></span>--> <br><br> part number: <input type="text" name="partid" value="<?php print ($part_id) ?>"> <!--<span class="error">* <?phpecho $emailerr;?></span>--> <br><br> machine: <input type="text" name="mach" value="<?php print ($machcode) ?>"> <!--<span class="error">* <?phpecho $macherr;?></span...

sql server - Your First ASP.NET 5 Web App Using Visual Studio (dnx ef database upgrade) not creating database/cmd error no sql connection -

Image
https://docs.asp.net/en/latest/tutorials/your-first-aspnet-application.html i following instructions link above. works out till dnx ef database update. @ point error. when debug comes up. confused since followed instructions.

php - How do I group products into stores on woocommerce/wordpress? -

i'm attempting create local library store in wordpress using woocommerce. idea have multiple university campus libraries (actual buildings) , when user selects campus library require, store goes show available products in library. closest example of i'm trying achieve just-eat.co.uk model (have @ site if know answer , may need little more clarification). that's pretty it, ability group multiple products different building names. haven't changed of html woocommerce store yet, question i'm asking; html/css needed? html (from archive.php): if ( ! defined( 'abspath' ) ) { exit; // exit if accessed directly } get_header( 'shop' ); ?> <link rel="stylesheet" type="text/css" href="style.css"/> <?php /** * woocommerce_before_main_content hook. * * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs content) * @hooked woocommerce_breadcrumb - 20 */ do_ac...

How to convert phone number format to plain number in android -

how can convert phone number (581)-111-1234 or ever phone format simple plain number format like: 5811111234 in android?? any idea? use phonenumberutils phonenumberutils.stripseparators(phonenumber); phonenumberutils.toafromstring(phonenumber);

ruby on rails - friendlyId won't work correctly -

im trying apply friendlyid gem onto rails app. when have done 1 : installing gem, 2 : , this bin/rails g friendly_id create db/migrate/20150220082838_create_friendly_id_slugs.rb create config/initializers/friendly_id.rb bin/rake db:migrate db:migrate runs okay when go rails s, following message migrations pending. resolve issue, run: bin/rake db:migrate rails_env=development include friendlyid friendly_id :account then when bin/rake db:migrate rails_env=development, console returns error pg::duplicatetable: error: relation "friendly_id_slugs" exists i've tried dropping db gives more more problems solve(since have users data in development.) and when google it, same issues reported in github page been solved bug fix , won't give me hint me solve it.. how work properly??? thank time. following solved problem...! bundle exec rake db:reset

r - Are all dates in order -

i trying apply diff() on series of columns containing dates. interested in difference between date1-date2, date2-date3, etc. i interested in: the actual difference between dates (days) if dates of row in order (diff >= 0, row) i can use diff() on series of dates (e.g. on first row --> diff(unlist(df1[1,])) ). need apply per row, guess using apply(), reason can't work out. dates missing, allowed in study. hopefully easy guys... df <- structure(list(date1 = structure(c(-10871, -13634, -15937, -15937, -290, -2323), class = "date"), date2 = structure(c(16678, na,16037, 16659, 16538, 16626), class = "date"), date3 = structure(c(16685,16688, na, 16659, 16568, 16672), class = "date"), date4 = structure(c(16701, 16695, 16670, 16661, 16582, 16672), class = "date"), date5 = structure(c(16709, 16695, 16661, 16667, 16619, 16692), class = "date")), .names = c("date1","date2", "date3...

c# - If property at session not null or default value, run/print javascript Razor ASP.NET MVC -

how print javascript when accessing model session , property value not empty @ razor? this code: @{ arm.models.lanidmodel lanidmodel = (lanidmodel)httpcontext.current.session["sesslanidmodel"]; }} @if(lanidmodel.lanid!=0 && lanidmodel.name != string.empty && !string.isnullorempty(lanidmodel.email)){ @html.raw("$('.input-switch-disabled').removeattr('disabled');"); } and when run on browser, got this: @if(lanidmodel.lanid!=0 && lanidmodel.name != string.empty && !string.isnullorempty(lanidmodel.email)){ line 98: @html.raw("$('.input-switch-disabled').removeattr('disabled');"); line 99: } is able do? wrap javascript in script tags. @html.raw("<script>$('input-switch-disabled').removeattr('disabled');</script>");

html - How do i style PHP validations -

this first time using php validation , validations working perfectly. how style validation, select echo function or have change validation code able style it. have tried using span , echoing out error function , changing echo's error function e.g $emailerr not luck, validations not work. suggestions? html <!-- <div id="first">--> <input type="email" id="email" name="email" placeholder="email address" value='' required><!--<span class="error"><!--<?php //echo $c_emailerr; ?></span>--> <br> <figure> <input class ="login-field" type="password" id="pass1" name="pass1" value="" placeholder="password" maxlength="30" required><!--<span class="error"><...

ignite - Persistence and Split brains Scenario -

1.how ignite handle split brain scenario in clustered mode ? 2.incase of putall, hit persistent store each entry or put store @ once ? 3.how putall work regard persistent store if set batch size ? 4.in case of partitioned backup , order in data moves ? primary->backup->persistence or primary->backup meantime asynchronously persistence ? 5.if update done in persistence store , has done reflect in cache without reloading?(how handle backend updates) 6.on doing update in backend , reflect changes in cache if reload cache using loadcache, changes not updated in cache or if straightway use get() updates not reflected. updates reflected after clearing cache once , calling loadcache or api . right way reload cache? person p1 = new person(1, "benakaraj", "ks", 11, 26, 1000); person p2 = new person(2, "ashwin", "konale", 13, 26, 10000); connection con = null; statement stmt = null; con = ds.getconnection(); s...

Expand/open a spinner when click on Button in android -

Image
i new android , trying expand spinner when user click on button. example: have spinner values 'ok' button when user click on 'ok' button spinner need expands itself. is possible event expand spinner hen tapped on button? i want show spinner below image when tapped on button xml:- --- <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <button android:layout_margintop="50dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onclick="clickme" android:layout_gravity="center_horizontal" android:text="spinner"/> </linearlayout> activity:- ---- public class spinne...

Visual Studio Standard Style as CSS -

i'm searching correct style configure copysourceashtml change selenitic style default visual studio style when copy , paste e.g. e-mail. know css style(s) need use set correctly? when copy & paste source code e-mail dark background. if set white show text in light colours hard read. need change complete style. how plugin expect css like? if open theme referred in comments above in text editor you'll see lot of lines this: <item name="outlining.collapsehintadornment" foreground="0x00e8ddd7" background="0x00faf7f6" boldfont="no"/> now since don't know how plugin expecting css go ahead , give example of might in css: .outlining-collapsehintadornment { color: #d7dde8; background-color: #f6f7fa; } or: <item name="string" foreground="0x001515a3" background="0x02000000" boldfont="no"/> becomes .string { color: #a31515; background-color: #...

MySQL specific column addition -

i have 3 tables: bank_account(tran_id, pay_id, expense_id, amount, balance) payment(pay_id, client_id, date_payment, amount) expense(expense_id, emp_id, amount, expense) in tran_id primary key bank_account , same pay_id payment , expense_id expense well. in bank_account when pay_id there expense_id null , vice versa. want calculate profit of company using bank_account . how can use sql script calculate (the sum of pay_id based amount - sum of expense_id based amount). i think, should statement, think, miss field group in bank_account table (i.e. company). wants know, amount company, or? select <missingfieldcompany>, sum(payment.amount) payments, sum(expense.amount) expenses, sum(payment.amount) - sum(expense.amount) overall bank_account left join payment on payment.pay_id = bank_account.pay_id left join expense on expense.expense_id = bank_account.expense_id group <missingfieldcompany>

fpga - How to use Quartus to optimize combinational logic? -

Image
i using quartus synthesize combinational circuit fpga. right want best possible maximum frequency without considering resource consumption. current critical path composed sequence of multiplications this: res = * b * c *d i wondering whether possible quartus automatically generate equivalent combinational logic has shorter critical path this: ab = * b cd = c * d res = ab * cd which have 2 multipliers on critical path. found online document quartus mentioned possible without instructions on how it: usingtimequestanalyzer pipelining doesn't work here since don't want change timing of combinational circuitry. a synthesis tool quartus builds initial internal structure based on hdl (vhdl/verilog) code, , reorganize , optimizes structure depending on constrains , area, extend tool has rules manipulating structures. tool timing check see timing adhered resulting design. for implementation of multiplication * operator, appears quartus implements a * b * c *...

angular - How to use a typescript enum value in an Angular2 ngSwitch statement -

the typescript enum seems natural match angular2's ngswitch directive. when try use enum in component's template, "cannot read property 'xxx' of undefined in ...". how can use enum values in component template? please note different how create html select options based upon of values of enum (ngfor). question ngswitch based upon particular value of enum. although same approach of creating class-internal reference enum appears. you can create reference enum in component class (i changed initial character lower-case) , use reference template ( plunker ): import {component} 'angular2/core'; enum celltype {text, placeholder} class cell { constructor(public text: string, public type: celltype) {} } @component({ selector: 'my-app', template: ` <div [ngswitch]="cell.type"> <div *ngswitchcase="celltype.text"> {{cell.text}} </div> <div *ngswitchcase="...

How to let MS C++ compiler to recognize type not defined in #include? -

i have 3 projects a, b, c. c depends on b. b depends on a. has type x defined in x.h. when b uses in useb.h file without include x.h. b project can built in vs2013. however, when maintain project c, cannot build because x type not defined useb.h cannot compile. any ms c++ guru know this? just figure out in stdafx.h of project b includes header includes x.h controlled enabled/disabled preprocessor. there further work enable it. it's not tricky compiler problem.

ios - How to move cursor in Xcode smoothly? -

Image
for example below gif first type ql1("") , cursor's position locate after double quotes then how move cursor's position between double quotes? i know can use arrow key,but don't want move hand on keyboard so there have convenient way move cursor? just can press tab move cursor different parameter you don't need anything. xcode automatically putting that. just put single double quote(") write whatever want write press next arrow key (->) , second single double quote(") automatically added. hope helps!

java - OSGi bundles with OSGi WAB -

i'm kinda new develop osgi bundles , osgi wab. i'm using jboss 7.1 server in should use both osgi bundles , wab together. few of dependencies wab osgi bundles, both bundles , wab inside 'deployments' folder of server. when deploy wab, looks dependencies inside 'web-inf/lib'. how include bundles dependencies outside wab file without adding bundles in 'web-inf/lib'? thanks in advance. edit: followed steps provided in link: http://www.rpgnextgen.com/wiki/doku.php?id=vaadin_7.4_osgi_web_application successful in creating wab file. have necessary vaadin dependencies deployed osgi bundles in server under 'deployments' folder. when deploy wab file, vaadin dependencies under 'deployments' folder not included wab file looking vaadin dependencies inside 'web-inf/lib' path. below pom.xml i'm using. <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance...

smarty variable inside php -

i need call smarty variable inside php tag. added function .. smarty variable {get_video_meta video_id=$video_data.id key='test'} //resut = google my function function smarty_get_video_meta($params, &$smarty) { global $video; if (empty($params['uniq_id']) && empty($params['video_id'])) return ''; $video_id = 0; if ($video['source_id'] == 0) { $sql = "select item_id pm_embed_code, pm_meta pm_embed_code.uniq_id = '". $video['uniq_id'] ."' , pm_embed_code.id = pm_meta.item_id"; if ($result = mysql_query($sql)) { $row = mysql_fetch_assoc($result); mysql_free_result($result); $video_id = $row['item_id']; } } else { $video_id = $params['video_id']; } if ( ! $video_id) return ''; $meta = get_meta($video_id, is_video, $params['key']); return $meta[$params['ke...

r - sharing 2 data tables through sendmailR -

i using below code share data frame "my_data1" friend , code working fine. have data frame "my_data2" want share. please suggest , how should add second table in code library(sendmailr) library(pander) <- "<me@gmail.com>" <- "<friend@gmail.com>" subject <- "important report of day!!" body <- "this result of test:" mailcontrol=list(smtpserver="aspmx.l.google.com") #----------------------------------------------------- #----------------------------------------------------- msg_content <- mime_part(paste('<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="widt...

python - How to make a diagonal matrix with canopy that has a displacement in the diagonal? -

i need create diagonal matrix diagonal displaced left or right center help? as down-votes of question suggest, should try explain question in better way. being said, best guess you're looking superdiagonal , subdiagonal matrices; i.e.: superdiagonal: 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 subdiagonal: 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 if that's case, can use numpy's indices : import numpy np superdiagonal = np.zeros((4, 4)) i, j = np.indices(superdiagonal.shape) superdiagonal[i == j-1] = 1 print(superdiagonal) this give you: array([[ 0., 1., 0., 0.], [ 0., 0., 1., 0.], [ 0., 0., 0., 1.], [ 0., 0., 0., 0.]]) for subdiagonal, have change i == j-1 part i == j+1 .

java - How to append/insert to TextView with retained format -

i have code this: strings.xml <string name="message1">your money: <b>1000</b> <b>2000</b></string> <string name="message2">your money: <b>%1$s</b> <b>%2$s</b></string> and want show in textview mainactivity.java // 1 render 1000 , 2000 in bold correctly textview mtext1 = (textview) findviewbyid(r.id.message1); mtext1.settext(gettext(r.string.message1)); // 1 fail render 1000 , 2000 in bold int val1 = 1000, val2 = 2000; textview mtext2 = (textview) findviewbyid(r.id.message2); mtext1.settext(string.format(gettext(r.string.message2).tostring(), val1, val2)); i want make can format text in bold/italic applying string.format android string resource. you need take @ android string resource guide . section on styling html markup shows how this. first need give string resource follows(html escape opening html tags) <string name="message2">your money: ...

java - Liferay and portlet for talend job -

i have simple talend job. in job try add new article, invoke addarticle() method. build job, import liferay , still have same problem. when click execute job in liferay, jobs have status: failure. when open job history tab see error: java.lang.reflect.invocationtargetexception 2 @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) 3 @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) 4 @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) 5 @ java.lang.reflect.method.invoke(unknown source) 6 @ com.savoirfairelinux.portlet.talend.util.talendprocessthread.run(talendprocessthread.java:119) 7caused by: java.lang.nosuchmethoderror: com.liferay.portlet.journal.service.journalarticlelocalserviceutil.addarticle(jjjjljava/lang/string;zdljava/util/map;ljava/util/map;ljava/lang/string;ljava/lang/string;ljava/lang/string;ljava/lang/string;ljava/lang/string;iiiiiiiiiiziiiiizzzljava/lang/string;ljava/io/file;ljava/util/map;ljava/lang/string...

php - SSL connect error error 35 in paypal curl request -

when making payment in paypal, throws "ssl connect error (35)", have enabled tls. , have tested " https://tlstest.paypal.com ", return same error. following sample used test tls. $ch = curl_init(); curl_setopt($ch, curlopt_url, 'https://tlstest.paypal.com'); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_failonerror, true); curl_setopt($ch, curlopt_ssl_verifypeer, true); curl_setopt($ch, curlopt_sslversion, 6); // curl_sslversion_tlsv1_2 curl_setopt($ch, curlopt_cainfo, 'cacert.pem'); $result = curl_exec($ch); echo 'result = '.$result.'<br>'; echo 'errno = '.curl_errno($ch).'<br>'; echo 'error = '.curl_error($ch).'<br>'; curl_close($ch); thanks in advance

Opencart-How can I display the flat rate in Delivery details section in Checkout -

in opencart added shipping flat rate 150 via admin panel. in checkout delivery details section wish show flat rate. how can display flat rate in delivery details section in checkout? want display in catalog/view/theme/default/template/checkout/shipping_addres.tpl . my opencart version 2.0.3.1. an alternative solution: $_session contain set of values me find solution. var_dump($_session); //you can see session values echo $_session['shipping_methods']['flat']['quote']['flat']['text']; gives currency symbol , flat rate. result is: inr 150 or eur 2.01 or usd 2.25 (depends currency) any other answer(if any) welcome..

PHP: Trying to send an email form with variables and an IF statement -

i trying make email change depending on variables available. there total of 6 operation id's, 20 (the 1 shown below in code) requires machine code unlike other operations. $email = if ($operationid == 20) { 'machine: '.$machcode."\r\n". } "jobid: ".$jobid."\r\n" . "partid: ".$part_id."\r\n" . "\nnote: ".$message."\r\n"; @mail($email_to, $email_subject, $email); if ' if statement' not there email can sent looks following machine: jobid: 123456789 partid: 123456789 note: test i not want there blank space next 'machine'. want machine line removed unless, obviously, operationid 20. email looks following: jobid: 123456789 partid: 123456789 note: test how make machine line activated when operation equal 20? i error `parse error: syntax error, unexpected t_if in /var/www/ps_t/send_form_email.php on line 21 call stack: 0.0004 656768 1. {main}() /var/ww...

html - Black background for text -

Image
i getting black background text inside div. don't know why. code , style div is. <div class="intro_div"> <div>intro text goes here</div> </div> the style div is .intro_div{ color: #fff; font-size: xx-large; text-align: center; height: 500px; vertical-align: middle; line-height: 500px; } the output you need use background-color, not color: .intro_div{ background-color: #fff; color:black; font-size: xx-large; text-align: center; height: 500px; vertical-align: middle; line-height: 500px; } also, try using known names in css, more readble. instead of background-color: #fff; try using background-color: white;

salesforce - Need to Access Managed Package Objects and fields in Apex trigger -

i have write apex trigger on managed packaged insttalled object , access in field new , old values inside apex trigger. please see below piece of code using in here: trigger emailscorecalculator on sendgrid4sf__sendgrid_email_status__c (after update ) { sendgrid4sf__sendgrid_email_status__c oldopp = trigger.oldmap.get(sendgrid4sf__sendgrid_email_status__c.id); object name : sendgrid4sf__sendgrid_email_status__c(object installed manage package) but getting invalid key in map error: please suggest because of manage-package object or wrong doing here,thanks. note: not able see object "sendgrid4sf__sendgrid_email_status__c" in workbench. can use trigger.old.keyset() keys , iterate on list of keys , access values particular key. per knowledge can not use objectname.id access id of record. think doing mistake @ line sendgrid4sf__sendgrid_email_status__c oldopp = trigger.oldmap.get(sendgrid4sf__sendgrid_email_status__c.id); so if ...

autoplay - I want to add auto play media in android -

i working on integrating video 1 of activities. plays fine, have click play play. searched forums , developer site , cannot find relating autoplay or autostart. suggestions? mainactivity.java ... protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); floatingactionbutton fab = (floatingactionbutton) findviewbyid(r.id.fab); fab.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { snackbar.make(view, "replace own action", snackbar.length_long) .setaction("action", null).show(); } }); videoview mvideoview = (videoview) findviewbyid(r.id.videoview); mvideoview.setvideopath("file:///android_asset/video1.mp4"); mvideoview.setmediacontroller(new mediacontroller(t...

linux - Why I'm getting unexpected EOF while looking for matching `'' for my cron job? -

/bin/sh: -c: line 0: unexpected eof while looking matching `'' /bin/sh: -c: line 1: syntax error: unexpected end of file here's cron job: */1 * * * * aide --check | echo "start timestamp: `date +'%y-%m-%d %h:%m:%s'`" > /var/log/aide/aide2.log this because % sign treated specially in crontab. those, if needed literally have escaped \ here quote manpage: the ``sixth'' field (the rest of line) specifies command run. entire command portion of line, up newline or % character , executed /bin/sh or shell specified in shell variable of crontab file. percent-signs (%) in command, unless escaped backslash (\), changed newline characters, , data after first % sent command standard input. there no way split single command line onto multiple lines, shell's trailing "\". however, wrar pointed, pipe makes no sense. wanted || there instead of | .

dask df.col.unique() vs df.col.drop_duplicates() -

in dask difference between df.col.unique() and df.col.drop_duplicates() both return series containing unique elements of df.col . there difference in index, unique result indexed 1..n while drop_duplicates indexed arbitrary looking sequence of numbers. what significance of index returned drop_duplicates ? is there reason use 1 on other if index not important? dask.dataframe has both because pandas has both, , dask.dataframe copies pandas api. unique holdover pandas' history numpy. in [1]: import pandas pd in [2]: df = pd.dataframe({'x': [1, 2, 1], 'y': [1., 2., 3.]}, index=pd.index(['a', 'b', 'a'], name='i')) in [3]: df.x.drop_duplicates() out[3]: 1 b 2 name: x, dtype: int64 in [4]: df.x.unique() out[4]: array([1, 2]) in dask.dataframe deviate , choose use dask.dataframe.series rather dask.array.array because 1 can't precompute length of array , can't act lazily. in practice there...

google maps - maxWidth for infowindow in googlemaps? -

the part of google maps code creates info windows this: google.maps.event.addlistener(marker, 'click', function () { infowindow.setcontent(this.html); infowindow.open(map, this); }); i need set max width of 250px infowindow cant work. there syntax error following: google.maps.event.addlistener(marker, 'click', function () { infowindow.setcontent(this.html); infowindow.maxwidth(250); infowindow.open(map, this); }); working: google.maps.event.addlistener(marker, 'click', function () { // have added .html marker object. infowindow.setcontent(this.html); infowindow.setoptions({maxwidth:250}); infowindow.open(map, this); });

Very strange behaviour in PHP -

this question has answer here: comparing string integer gives strange results 5 answers i have code: $test = 0; if ($test == "on"){ echo "true"; } result of code be: true why??? version of php: 5.4.10. if compare number string or comparison involves numerical strings, each string converted number , comparison performed numerically. these rules apply switch statement. type conversion not take place when comparison === or !== involves comparing type value. $test = 0; if ($test === "on"){ echo "true"; } php convert string number compare. using === , compare value type of data. var_dump(0 == "a"); // 0 == 0 -> true var_dump("1" == "01"); // 1 == 1 -> true var_dump("10" == "1e1"); // 10 == 10 -> true var_dump(100 == "1e2"); // 100...

javascript - Knockout.js - Sum table, add row and fill the table with AJAX -

im using table add materials , using knockoutjs-3.4.0.js add row , sum it. problem when try edit code want populate table ajax request. problem don't know how fill table ajax response. if use code below error: referenceerror: unable process binding "click: function (){return addmaterial }" message: can't find variable: addmaterial <table class="table table-bordered"> <thead> <tr> <th>moment</th> <th>antal </th> <th>kostnad</th> <th>totalt</th> <th></th> </tr> </thead> <tbody data-bind="foreach: materials"> <tr> <td><input data-bind="value: name" /></td> <td><input data-bind="value: quantity" /></td> <td><input data-bind="value: rate" /></td...

wordpress - PHP Warning: POST Content-Length of 8978294 bytes exceeds the limit of 8388608 bytes in Unknown on line 0 -

i getting error when trying upload import on wordpress on xampp local dev environment: warning: post content-length of 8978294 bytes exceeds limit of 8388608 bytes in unknown on line 0 i changed upload_max_filesize 2m 1000m , didn't seem anything. any ideas? 8388608 bytes 8m, default limit in php. update post_max_size in php.ini larger value. upload_max_filesize sets max file size user can upload while post_max_size sets maximum amount of data can sent via post in form. so can set upload_max_filesize 1 meg, mean biggest single file user can upload 1 megabyte, upload 5 of them @ once if post_max_size set 5.

javascript - How to get the current slide no in Glide.js -

hi how can current slide no when click next , previous button in glide.js http://glide.jedrzejchalubek.com/docs.html#intro . var carousel = $('#carousel').glide({ type: 'carousel', startat: 1, touchdistance: 2, afterinit:function(){console.log("paintslider")}, autoplay: 0 }); console.log(carousel.current()); for reason, function carousel.current() not working. you can use code's callback , events instead. example: var carousel = $('#carousel').glide({ type: 'carousel', ... aftertransition : function(event) { console.log(event.index); // current slide number } }); also, carousel.index() works too!

javascript - How to get nth child value using jquery -

i have following html: <div id="buildyourform"> <div class="fieldwrapper" id="field1"> <input type="text" placeholder="co-author name" class="fieldname m-wrap medium"> <input type="text" placeholder="co-author affiliation/organization" class="fieldtype m-wrap medium"> </div> <div class="fieldwrapper" id="field2"> <input type="text" placeholder="co-author name" class="fieldname m-wrap medium"> <input type="text" placeholder="co-author affiliation/organization" class="fieldtype m-wrap medium"> </div> </div> i want value of input boxes each of div of buildyourform <script> $('#buildyourform > div:nth-child(i) > input.fieldname').val() </script> i tried above code it's...

Execution time using time.time() in Python -

i wrote code hackerrank problem ( https://www.hackerrank.com/challenges/acm-icpc-team ). import time itertools import combinations start_time = time.time() n,m = raw_input().strip().split(' ') # n = no of people , m = no of topics n,m = [int(n),int(m)] topic = [] topic_i = 0 topic_i in xrange(n): topic_t = str(raw_input().strip()) topic.append(topic_t) # populate topic[] list topics counts = [] list1, list2 in combinations(topic, 2): if list1 != list2: count = 0 in xrange(m): if int(list1[i]) | int(list2[i]): count += 1 counts.append(count) print max(counts) print counts.count(max(counts)) print time.time() - start_time when try run code, execution time of 8.37576699257 seconds. program got on in jiffy. have read timeit() function, default, runs function passed million times. similar happen here? you counted time when program waited user input too. may want move first time.time() invocation below raw_inp...

python - Function being called even though Matplotlib button hasn't been clicked -

i have program shows image (fig 1). when image clicked shows colour in image clicked in separate matplotlib window (fig 2). fig 2 has buttons call different functions when clicked. my problem functions meant called in fig 2 being called when fig 1 clicked. the code looks this: def show_fig1(img): # plot image plt.figure(1) ax = plt.gca() fig = plt.gcf() implot = ax.imshow(img) # detect click on image cid = fig.canvas.mpl_connect('button_press_event', on_pixel_click) plt.show(block=true) # called when fig1 clicked def on_pixel_click(event): if event.xdata != none , event.ydata != none: # computation here gets image fig2 img = get_fig2_img() show_fig2(img, event) def show_fig2(img, event): plt.figure(2) plt.imshow(img) # specify coordinates of button ax = plt.axes([0.0, 0.0, 0.2, 0.1]) # add button button = button(ax, 'button') # detect click on button button.on_clicked(test()) plt.show(block=true) def t...