Posts

Showing posts from May, 2010

python - Ignore null/blank cells with filter -

i'm trying filter 22nd column numbers between 0.10 , 1.00 day.csv . of cells blank no number @ , cause error: valueerror: not convert string float: here tried: reader = csv.reader(open("alldata.csv"), delimiter=',') filteredday = filter(lambda p:0.10 <= float(p[23]) <= 1.00, reader) csv.writer(open(r"{}\day.csv".format(queue),'w',newline =''), delimiter=',').writerows(filteredday) presumably therefore need filter return false when cell in question contains no value? try: filteredday = filter(lambda p: p[23] != "" , 0.10 <= float(p[23]) <= 1.00, reader)

twitter bootstrap - Insert File.php inside another Page.php -

here bootstrap using in .php file <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>example of bootstrap 3 accordion</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <style type="text/css"> .bs-example{ margin: 20px; } </style> </head> <body> <div class="bs-example"> <div class="panel-group" id="accordion"> <div class="panel panel-default"> ...

javascript - .load() method to load .html file from parent directory -

i have following structure: folder1 index folder2 page load is possible load page load in div in index page, using div.load() ? i've tried possible path , doesn't work. ( ../folder2/page , ./ , / , .. ) it's different question: dynamically load web components / html imports? i think, directory index folder1 then, not accessible, if using virtualhost or that, may can move directory 'folder2' in 'folder1', not expert seems that. hope help!!

swift - I'm getting in this program stack or it stops to work -

this program i'm beginner build succeeded running stop. import uikit class viewcontroller: uiviewcontroller,uitableviewdelegate,uitableviewdatasource { var items = [string]() @iboutlet var textfield: uitextfield! @iboutlet weak var tableview: uitableview! @ibaction func addbutton(sender: uibutton) { let newitem = textfield.text items.append(newitem!) textfield.resignfirstresponder() } override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return items.count } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablece...

javascript - Getting wrong length on dialog -

i'm working jquery , i'm trying listen how may there open after close dialog, i'm getting how many open. example: if have 4 , close 1 returns 4 when expect 3, , @ end when have 1 open returns 2, , @ end when close last 1 return 1. am doing right? try in docs , try afterclose there not. $( ".test" ).dialog({ autoopen: false, height: "auto", width: "auto", modal: true, close: function(e){ $(this).destroy(); // returns wrong lenght console.log($('.test').length); if($('.test').length === 1) { console.log($('.test a').text()); } } }); how getting numbers? unless destroying dialogs calling $('.test').length is going return number of classes of test on dom. using .remove() or remove dialogs? more information needed. when close di...

java - JavaFX format SimpleLongProperty in TableView -

i'm stuck trying format long values in tableview javafx. i have following class store rows want display on table: import java.text.decimalformat; import javafx.beans.property.simpledoubleproperty; import javafx.beans.property.simplelongproperty; import javafx.beans.property.simplestringproperty; public class databycurrencypairrow { private decimalformat integerformat = new decimalformat("#,###"); private simplestringproperty currencypair = new simplestringproperty(""); private simpledoubleproperty shareoftotalvolume = new simpledoubleproperty(0); private simplelongproperty totalvolume = new simplelongproperty(0); private simplelongproperty currencybought = new simplelongproperty(0); private simplelongproperty currencysold = new simplelongproperty(0); private simplelongproperty monthlyaverage = new simplelongproperty(0); public databycurrencypairrow() { ...

c# - How to Upgrade to the new Yahoo weather API? -

for time have been using yahoo weather api current day temperature , forecasts statistics in .net application in c#. apparently yahoo updated api , application fails data. i using xml document data xmldocument doc = new xmldocument(); doc.load("http://xml.yahooapis.com/forecastrss?w=" + woeid + "&u=c"); xmlnamespacemanager ns = new xmlnamespacemanager(doc.nametable); ns.addnamespace("yweather", "http://xml.weather.yahoo.com/ns/rss/1.0"); xmlnode nod = doc.selectsinglenode("/rss/channel/link", ns); link = nod.innertext; ....more nodes selected.... and xml nodes , values store them in database. what changes have make application work new api? first of need change url asking forecast from doc.load("http://xml.yahooapis.com/forecastrss?w=" + woeid + "&u=c"); to query="select%20*%20from%20weather.forecast%20where%20woeid%20%3d%20"+ woeid ...

java - How to create runnable jar from multiple eclipse files? -

title; have 2 different classes/java files, 1 driver , 1 class. how can create runnable jar both of these files? when tried exporting runnable jar in eclipse, let me choose 1 file "launch configuration" (not sure means). when tried run .jar wouldn't work. thanks! sadly, can't. in order create runnable jar, meta-inf/manifest.mf file must created inside jar. , file specification allows 1 main class jar. the best approach can give (to resolve this) create in conjunction jar file, 2 scripts. each of them, calling 1 of main classes through command console. or see if can define 2 launching configuration file same project eclipse...

excel - Using Python to download files from Box -

i'm trying use python download excel file local drive box. using boxsdk able authenticate via oauth2 , file id on box. however when use client.file(file_id).content() function, returns string, , if use client.file(file_id).get() gives me boxsdk.object.file.file . does know how write either of these excel file on local machine? or better method of using python download excel file box. (i discovered boxsdk.object.file.file has option download_to(writeable_stream here have no idea how use create excel file , searches haven't been helpful). you use python csv library , along dialect='excel' flag. works nice exporting data microsoft excel. main idea use csv.writer inside loop writing each line. try , if can't, post code here.

reactjs - React router Unexpected token -

i'm trying implement react router app looks this import react "react"; import reactdom "react-dom"; import { router, route, link, browserhistory } 'react-router'; import login './login'; import signin './signin'; import chat './chat'; require("../../view/style.less"); const app = document.getelementbyid('app'); reactdom.render(( <router history={browserhistory}> <route path="/" component ={login} /> <route path="signin" component ={signin} /> <route path="chat" component ={chat} /> </router> ), app); and when @ console gives error unexpected token here console error output. problem? reactdom.render(( > 14 | <router history={browserhistory}> | ^ 15 | <route path="/" component ={login} /> 16 | <route path="signin" component ={signin} /> 17 | ...

windows - How to print lpEnvironment got from CreateEnvironmentBlock() -

see createenvironmentblock written in c++. bool winapi createenvironmentblock( _out_ lpvoid *lpenvironment, _in_opt_ handle htoken, _in_ bool binherit ); lpenvironment [out] type: lpvoid* when last function returns, receives pointer new environment block. environment block array of null-terminated unicode strings. list ends 2 nulls (\0\0). i able call createenvironmentblock() successfully, need know how print content of lpenvironment (i mean want print environment variables). it list of strings, terminated empty string. sample code created win32 console application project template in vs: #include "stdafx.h" #include <windows.h> #include <userenv.h> #include <assert.h> #pragma comment(lib, "userenv.lib") int main() { handle htoken = null; bool ok = openprocesstoken(getcurrentprocess(), token_read, &htoken); assert(ok); wchar_t* penv = l""; ok = createenvironmentblock((vo...

cmake invoking dynamic macro name -

i have 2 macro names, example: macro(my_macro1) # stuff use in macro endmacro() macro(my_macro2) # stuff use in macro endmacro() i'd dynamic call macros based variable name, example: if (...) set (ver 1) else () set (ver 2) endif () my_macro${ver} # idea any help? as @tsyvarev has commented cmake doesn't support dynamic function names. here alternatives: simple approach macro(my_macro ver) if(${ver} equal 1) my_macro1() elseif(${ver} equal 2) my_macro2() else() message(fatal_error "unsupported macro") endif() endmacro() set(ver 1) my_macro(ver) set(ver 2) my_macro(ver) a call() function implementation building on @fraser work here more generic call() function implementation: function(call _id) if (not command ${_id}) message(fatal_error "unsupported function/macro \"${_id}\"") else() set(_helper "${cmake_binary_dir}/helpers/macro_helper_${_id}.c...

mongodb - PHP Mongo - find last object in collection -

how full php block of code return last inserted object in collection? function doesn't return proper object. # create connection instance $this->mongo = new mongoclient($connection_string); # select database $this->database = $this->mongo->selectdb($database_name); public function get_last($given_collection){ $collection = $this->database->selectcollection($given_collection); $data_object = $collection->find()->sort(array("id"=>1)); return $data_object; } try: $collection->find()->sort(array("_id"=>-1))->limit(1); this mongodb query working fine show data in descending order. db.collection.find().sort({"_id":-1}).limit(1);

javascript - Event capturing namespace -

somewhere in app have tabs component , tabs use specific component must use event capturing on window (because d3...), anyway, question how namespcae these specific events run "cleanup" them when switching between tabs (because window shared between them). for example: (should fired on own tab) window.addeventlistener("mouseup", function(e){ console.log(1); // simplified code }); i cannot remove mouseup event listeners in cleanup method because knows else relies on event somewhere else. want clean specific ones. jquery namespacing events easy, jquery doesn't support event capturing.

adobe - How do I anchor a text field at the top of a page and have expanding fields from a previous page pass over it? -

Image
i create .pdf document has set text field @ top of each page (page 2 , on), , have expanding user entered text fields previous pages begin below set text field @ top of each page. thank assistance! i way: i create 2 master pages, 1 1st page , 1 2nd , following i place desired textfield in 2nd master page seen here , add height , y-position - in case 0.9cm + 0 now go design-view on 2nd page , cut layout border top calculated value - 0.9cm in case - nothing can placed on our created textfield master page in end put bunch of textfields on page 2 , test out - works - whenever there're many of them, page breaks , next textfield below master textfield again :) just make sure set master pages correctly , layout type ("flow" or - don't know english translation in lcd) edit: works expanding textfield:

php - WhereNotExists Laravel Eloquent -

little bit of trouble eloquent framework laravel. i need replicate query : select * repairjob not exists (select repair_job_id dismissedrequest repairjob.id = dismissedrequest.repair_job_id); right have $repairjobs = repairjob::with('repairjobphoto', 'city', 'vehicle')->where('active', '=', 'y')->wherenotexists('id', [dismissedrequest::all('repair_job_id')])->get(); anyone idea? need repairjobs there no record in dismissed requests table i error when using query above argument 1 passed illuminate\database\query\builder::wherenotexists() must instance of closure, string given try doesnthave() method. assuming 'dismissedrequests' relation name in repairjob model. $jobs = repairjob::with('repairjobphoto', 'city', 'vehicle') ->where('active', 'y')->doesnthave('dismissedrequests')->get();

json - Spring security 4. Architect structure for user management page -

spring security uses userdetailsmanager manage users & authorities. want use same implementation jdbcuserdetailsmanager manage user page admin (user crud, managing groups, pagination). unfortunately there no implementation paging, manage groups , on. so i've got issues: user crud because of json convertation rest. group crud because of json convertation rest. user paging because of userdetailsmanager has no correspond implementation. group paging - no implementation. user json pojo (for create\update operations used userdetails has implementations inetorgperson , person , user but... i've got json convertation issue, can not mark classes @jsonignore ). user pojo json (for read operation can not remove data important fields (for example: password)). all of issues have few solution ways: 1.1. create 1 more user object similar user , add expected json annotations or in rest controller create builder build user object input parameter map (builder p...

Marklogic (Nodejs API) - Search documents that match 2 (or more) conditions in object array attribute -

my documents stored in json in marklogic (i remove useless attributes case): { documentid: '', languages: [{ locale: 'en_uk', content: { translated: 'true', } }, { locale: 'de_de', content: { translated: 'false', } }, {...}], } edit: seem 'useless' attributes cause problems. here detailed object. { documentid: '', /* 4 attrs */, languages: [{ locale: 'en_uk', attr: '', content: { /* 14 attrs */, translated: true, /* 2 or 4 attrs */, } }, { locale: 'de_de', attr: '', content: { /* 14 attrs */, translated: false, /* 2 or 4 attrs */, } }, {...} ], /* 0 or 2 attrs */ } i try find documents have @ least 1 object in languages locale = 'en_uk' , content.translated = true with var query = qb.where( qb.directory('mydocu...

javascript - How do I use Vue.js v-for to iterate over a Number variable? -

for example, have positive integer variable, rating . the documentation http://vuejs.org/guide/list.html#range-v-for lists using number directly, switching number out variable doesn't work expected. i doing this: <i v-for="i in rating" class="fa fa-2x fa-star">{{ rating }}</i> but unfortunately it's showing once, through ratings value 4 . missing in documentation? i figured out issue was, passing rating value in via property, being passed in string. see non-working example here: <rating-component value="rating"></rating-component> vs <rating-component :value="rating"></rating-component"> by switching out value property :value , use literal variable instead of string variable fixed issue.

java - Lwjgl texture edges issue -

Image
i have issue when try bind texture 3d model in opengl ( don't have issue blender). texture correctly placed on model except regions. problem visible on edges of model: in blender can see problem tight model cut: i verified read correctly vt fields in .obj file, face lines link each vertex appropriate texture coordinates. the code use bind texture is: glbindtexture(gl_texture_2d, _texture.gettextureid()); gl11.gltexparameteri(gl11.gl_texture_2d, gl11.gl_texture_wrap_s, gl12.gl_clamp_to_edge); gl11.gltexparameteri(gl11.gl_texture_2d, gl11.gl_texture_wrap_t, gl12.gl_clamp_to_edge); gl30.glgeneratemipmap(gl11.gl_texture_2d); gl11.glcolor3d(0, 0, 0); gl11.glmaterial(gl_front_and_back, gl_ambient, _ambiant.getfloatbuffer()); gl11.glmaterial(gl_front_and_back, gl_diffuse, _diffuse.getfloatbuffer()); gl11.glmaterial(gl_front_and_back, gl_specular, _specular.getfloatbuffer()); gl11.glmaterialf(gl_front_and_back, gl_shininess, _shininess);...

c# - Selenium dotnet Signed Assembly location? -

selenium dotnet signed assemblies? was wondering if selenium downloads have signed assemblies? need them integrate within 3rd party application requiring strong types assemblies. i though had seen list in google code of archives can't seem find it... redirected github. per jim evans, located here: (including signed assemblies) http://selenium-release.storage.googleapis.com/index.html

Large list FlatMap Java Spark -

i have large list in javapairrdd<integer, list<string>> , want flatmap possible combinations of list entries end javapairrdd<integer, tuple2<string,string>> . if have like (1, ["a", "b", "c"]) i want get: (1, <"a","b">) (1, <"a", "c">) (1, <"b", "c") the problem large lists have done created large list of tuple2 objects having nested loop on input list. list not fit in memory. found this, not sure how implement in java: spark flatmap function huge lists you may want flatmap list , join rdd on before filtering equal values: javapairrdd<integer, list<string>> original = // ... javapairrdd<integer, string> flattened = original.flatmapvalues(identity()); javapairrdd<integer, tuple2<string, string>> joined = flattened.join(flattened); javapairrdd<integer, tuple2<string, string>> filtered = ...

nltk - Using Stanford nlp's sentiment engine with python parser? -

i working on project planning use stanford's sentiment analysis model sentiment analysis. i have tried nltk's stanford parser couldn't sentiment analysis module in it. can point me module, , if possible give working example. if not nltk there other wrapper should looking into. any answer working example great. (from same question here ) i facing same problem : maybe solution stanford_corenlp_py uses py4j pointed out @roopalgarg. stanford_corenlp_py this repo provides python interface calling "sentiment" , "entitymentions" annotators of stanford's corenlp java package, current of v. 3.5.1. uses py4j interact jvm; such, in order run script scripts/rungateway.py, must first compile , run java classes creating jvm gateway.

mysql - Split text under few conditions (PHP) -

i have form input field 'text' , want create different query depending on value put in field user if there phrase - search each word (f.e. 'hello world'): select (...) x '%hello%' , x '%world%' etc... if phrase in quotation marks - search whole phrase (f.e. '"hello world"'): select (...) x '%hello world%' and that's cool - can that. but problem starts when have mix above functionality - f.e. if phrase 'hello world "my name is" john' - should search this: select (...) x '%hello%' , x '%world%' , x '%my name is%' , x '%john%' how implement such functionality , manage in php? you use preg_match_all(...): $text = 'lorem ipsum "dolor sit amet" consectetur "adipiscing \\"elit" dolor'; preg_match_all('/"(?:\\\\.|[^\\\\"])*"|\s+/', $text, $matches); print_r($matches); which produ...

typescript - Angular2 nested components and template hierarchy -

iv'e started new project , decided give angular 2 chance. former backbone developer, facing types of work new me. i trying build simple app: want have class room object, , within list of students. in point of view, each of them (classroom, student) should different components, such each component has it's own template. i wish have templates separated, , on classroom template loop through students , render student template. for instance: classroom component like that: import {component, oninit} '@angular/core'; import {student} 'app/student.component'; @component({ selector : 'classroom', templateurl : 'app/classroom.component.html', directives : [classroom] }) export class maincontainer implements oninit { students : student[]; // assume have array of students here constructor() {} } the classroom template look: <div> <student *ngfor="let student of students"></studen...

Sql Query information -

what in sql query? can explain? .5- represent? where scheduleentry.scheduledate >= getdate() , scheduleentry.scheduledate <= getdate() +.50 think of date unit 1 day. 0.50 of day 1/2 of day. returns has scheduledate within half day getdate() time forward.

c# - connect entity framework directly to Microsoft Dynamics CRM -

we working on project using sql server on end , setup through entity framework. asked explore possibility of using dynamics crm. issues arose caused not use crm completely, business use hold data, though uses sql server behind scenes. thought connecting our existing code directly database dynamics crm had created , updating data way. reads believe should fine, has tried updates? crm seems have lot of tables , i'm sure updating 1 through crm has impacts on others, weren't sure if updating directly through entity framework follow same path, or things might missing later down road. from list of crm's unsupported customizations : data (record) changes in microsoft dynamics crm database using sql commands or technology other described in microsoft dynamics crm sdk. which rules out being supported when reaching out msft assistance, performing upgrades, etc. outside of being supported, going through api enforces lot of business rules (such security, plugi...

SQL Group result with specific criteria -

i need select , group id's of conditionid values 1 id conditionid 2 0 2 1 2 0 3 0 3 0 4 1 4 1 the result should be: id conditionid 4 1 how can this? this can done checking if row count per id equals row count of conditionid = 1 per id, in table. select id tablename group id having count(*) = count(case when conditionid = 1 1 end)

python - How to filter a pandas series with a datetime index on the quarter and year -

i have series, called 'scores', datetime index. i wish subset quarter , year pseudocode: series.loc['q2 of 2013'] attempts far: s.dt.quarter attributeerror: can use .dt accessor datetimelike values s.index.dt.quarter attributeerror: 'datetimeindex' object has no attribute 'dt' this works (inspired this answer ), can't believe right way in pandas: d = pd.dataframe(s) d['date'] = pd.to_datetime(d.index) d.loc[(d['date'].dt.quarter == 2) & (d['date'].dt.year == 2013)]['scores'] i expect there way without transforming dataset, forcing index datetime, , getting series it. what missing, , elegant way on pandas series? import numpy np import pandas pd index = pd.date_range('2013-01-01', freq='m', periods=12) s = pd.series(np.random.rand(12), index=index) print(s) # 2013-01-31 0.820672 # 2013-02-28 0.994890 # 2013-03-31 0.928376 # 2013-04-30 ...

ruby on rails - How to find nested attribute ID? -

how can show :user_id of dueler in edit page? edit.html.erb <%= simple_form_for(@duel) |f| %> <%= @dueler.user_id %> <% end %> rails c duel.last id: 11, consequence: "bad", reward: "good", dueler.find(15) id: 15, user_id: 78, # want id challenge_id: 179, duel_id: 11, dueler.last id: 16, user_id: 15, challenge_id: 190, duel_id: 11, duels_controller @dueler = dueler.find(params[:user_id]) # gives error: activerecord::recordnotfound in duelscontroller#edit couldn't find dueler 'id'= by request full duels_controller class duelscontroller < applicationcontroller before_action :set_duel, only: [:show, :edit, :update, :destroy] respond_to :html def index @duels = duel.joins(:duelers).all respond_with(@duels) end def show respond_with(@duel) end def new @duel = duel.new respond_with(@duel) end def edit @dueler = dueler.find_by(user_id: params[:dueler][:user_...

javascript - how to detect when the file get loaded with async attribute of script tag -

with reference mdn , async :- set boolean attribute indicate browser should, if possible, execute script asynchronously. has no effect on inline scripts (i.e., scripts don't have src attribute). the issue facing that, want call method corresponding js file loaded using async. how detect whether fill loaded or not.

javascript - Having trouble adding row to DataTable -

i building jquery datatable javascript object. table builds fine. then, on user's imput, need add row. having problem. have researched on datatables.net , on so. have read indicates doing should work, doesn't. no row added. here code when datatable initialized. $("#partslist").datatable({ data: data, "order": [[1, "asc"]], "scrolly": "800px", "scrollcollapse": true, "paging": false, columns: [ {stitle: "invtid", data: "invtid", "defaultcontent": '', 'classname': 'invtid'}, {stitle: "line nbr", data: "linenbr", 'classname': 'linenbr', "defaultcontent": 'test'}, {stitle: "bf", data: "bfval", "defaultcontent": ''}, {stitle: "bu", data: "buval", ...

java - Javers audit a custom delete -

what way javers audit custom 'delete'? using spring-boot integration, example: @transactional @modifying @query(" delete executepayment exep " + " exep.customer = :customer " + " , exep.status = 'executed' ") void deletependingexecutionsfromcustomer(@param("customer") customer customer); javers doesn't support jpa query language. need wrap method , call javers.commitshallowdelete() manually.

c# - PDFsharp 1.50 beta 3: Empty owner password error when adding password to PDF -

i'm exploring pdfsharp library , having issues password protecting pdfs. following example on website http://www.pdfsharp.com/pdfsharp/index.php?option=com_content&task=view&id=36&itemid=47 , here code try { string filename = "hi.pdf"; file.copy(path.combine("c:/user/ichigo/desktop", filename), path.combine(directory.getcurrentdirectory(), filename), true); pdfdocument document = pdfreader.open(filename, "some text"); pdfsecuritysettings securitysettings = document.securitysettings; securitysettings.userpassword="user"; securitysettings.ownerpassword="owner"; securitysettings.permitaccessibilityextractcontent = false; securitysettings.permitannotations = false; securitysettings.permitassembledocument = false; securitysettings.permitextractcontent = false; securitysettings.permitformsfill = true; securitysettings.permitfullqualityprint = false; securitysettings.per...

javascript - Responding to click event on <canvas> (Moving object) -

i new javascript (2 weeks) apologise of obvious question: i have managed 2 red 'balls' bounce around canvas. attach sort of onclick event them if 1 clicked changes colour, pretty simple stuff.. i tried add onlick event - p.onclick="gogreen(this, 'green')";** which triggers function - function gogreen(elmnt,clr) { elmnt.style.color = clr; document.getelementbyid("demo").innerhtml = "ok clicked ball"; } but doesn't work. no errors or nothing happens when objects clicked. i have tried add listener wasn't successful either. advice can give me appreciated have been banging head against few hours now. html: <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>changing red green</title> <style type="text/css"> </style> </head> <body> <p id="demo"></p>...

aurelia - Bundling looking for text.js in dist directory -

Image
using gulp tasks yeoman generated aurelia app i'm trying bundle custom application. when run gulp bundle following error reported. where can find log track down file or reference file? double check config.js i've seen time time, , it's issue of config.js . you'll want make sure: the github , npm , or wherever text plugin located above '*' line. the text plugin mapped. the plugin files located (1) , (2) pointing. so, this: config.js paths: { "github:*": "jspm_packages/github/*", "npm:*": "jspm_packages/npm/*", "*": "dist/*" }, map: { "text": "github:systemjs/plugin-text@0.0.4" } and jspm_packages/github/systemjs/plugin-text@0.0.4 exists. if else fails, try deleting jspm_packages folder, , typing jspm install text .

linux - Unix find command directory hints -

i active user of find command, similar below format: find . -name '*servername*' -exec zgrep -l 'identifier' {} \; suppose have hint target file may in directory named abc, possible in find command or of combinations accept hints? for example, if search first searches in subdirectories named abc there more chances find results, , can break search operation if needed. i looking similar command: find --hint dir1|pattern1 . -name '*servername*' -exec zgrep -l 'identifier' {} \; perhaps want: find $(find . -type d -name abc ) -name '*servername*' -exec zgrep -l 'identifier' {} + demo: $ mkdir /tmp/demo $ cd /tmp/demo $ mkdir -p a/b/abc $ echo identifier | gzip > a/b/abc/one_servername.gz $ find $(find . -type d -name abc ) -name '*servername*'-exec zgrep -l 'identifier' {} + ./a/b/abc/one_servername.gz

Pseudo-class in html -

i have in css file: a:active { color: purple; } p { color: pink; } and want incorporate solely html. for p easy, have <p style = "color: pink">foo</p> my question how incorporate pseudo-classes actual html you can't. css pseudo-classes can assigned either css or javascript events (click, mouseover, etc), not directly html. however, with, example, onmousedown="func()" , , set styles func() ; same setting via css :active pseudo-class).

r - How to make an object from a class table print as a table in stargazer? -

i'm using markdown document write text r. @ point, want add table calculated using table() function. it's not working. library(stargazer) x=structure(c(2075l, 49l), .dim = 2l, .dimnames = structure(list( c("0", "1")), .names = ""), class = "table") stargazer(x) error in objects[[i]]$zelig.call : $ operator invalid atomic vectors what's going on , how fix it? how this? stargazer(as.data.frame(x), type = 'text', summary = false, rownames = false)

javascript - Google Maps - Cannot read property 'offsetWidth' of null -

i've read few articles on this, can't figure out. one tried initialize killed map, white screen appeared. the error appears in console on page except contact page, page map. this code in javascript : var latlng = new google.maps.latlng(0, 0); var myoptions = { zoom: 14, center: latlng, scrollwheel: false, disabledefaultui: true, draggable: false, keyboardshortcuts: false, disabledoubleclickzoom: false, noclear: true, scalecontrol: false, pancontrol: false, streetviewcontrol: false, styles: [{"featuretype":"landscape","stylers":[{"hue":"#ffbb00"},{"saturation":43.400000000000006},{"lightness":37.599999999999994},{"gamma":1}]},{"featuretype":"road.highway","stylers":[{"hue":"#ffc200"},{"saturation":-61.8},{"lightness":45.59...

javascript - jQuery If .hasClass, then enable .hover -

i have 2 divs: .left , .right . what want, when .active class isn't linked these divs, enable .hover function. if: if (!($("#panel-left").hasclass("active") || $("#panel-right").hasclass("active"))) {} but doesn't work, if change condition true, or false, script doesn't realize . looks remembers value of condition page load, not changes after that. if (!($("#panel-left").hasclass("active") || $("#panel-right").hasclass("active"))) { $(".left").hover(function(){ $(".left").css("margin-left", "-10%"); }, function(){ $(".left").css("margin-left", "-50%"); }); $(".left").hover(function(){ $(".right").css("margin-left", "90%"); }, function(){ $(".right").css(...

arrays - Edit & save Json with php -

i'm trying change value in json file. want remove part of string after dot items in 'merchant' key. example, "amazon.com" should replaced "amazon". here code: $file = 'myfile.json'; $jsonstring = file_get_contents($file); $data = json_decode($jsonstring, true); foreach ($data $key => $field){ $data[$key]['merchant'] = (explode(".",$data[$key]['merchant'])); } $newjson = json_encode($data); file_put_contents($file, $newjson); here json file: (i want replace after .[dot]) [ { "0": { "code": "no voucher code", "merchant": "amazon.com", "title": "upto 70% off on toys, kids apparel , stationary" }, "1": { "code": "no voucher code", "merchant": "ebay.com", ...

Django aggregate by field with no related name -

given these models: class user(models.model): pass class reward(models.model): user = models.foreignkey(user, related_name='+') i trying obtain queryset contains similar: | user | reward__count | | 1 | 103 | | 2 | 50 | | 3 | 67 | conventional wisdom recommend query looking like user.objects\ .annotate(reward__count=count('reward_set'))\ .values_list('user', 'reward__count') unfortunately, because related name + , neither reward_set nor rewards (if name it) qualify valid parameter count() . given situation, there no way other python loop obtain desired queryset? for user in user.objects.all(): user_rewards = reward.objects.filter(user=user).count() # store (user.pk, user_rewards) somewhere. i trying obtain queryset contains similar: | user | reward__count | | 1 | 103 | | 2 | 50 | | 3 | 67 | ...

"Object doesn't support property or method 'messageParent'" After login redirect in Office js -

i trying dialog open in order enter login credentials, after being redirected login authority no longer able message parent of dialog window authorization codes or tokens. if not redirect away page, can message parent, otherwise error in title. how can message parent (in case task pane) window information dialog? below code have open , handle dialog window: var dialog; function authenticate() { hideall(); office.context.ui.displaydialogasync('mydomain/login', { height: 50, width: 25 }, dialogcallback); } function dialogcallback(asyncresult) { if (asyncresult.status === 'failed') { console.log(asyncresult.error.message); } else { dialog = asyncresult.value; dialog.addeventhandler(microsoft.office.webextension.eventtype. dialogmessagereceived, messagehandler); dialog.addeventhandler(microsoft.office.webextension.eventtype. dialogeventreceived, eventhandler); } } function messagehandler(arg) { ...

javascript - Image hosted on AWS is not displayed in Gmail -

i'm sending email node js using node-mailer. html format includes image hosted on aws s3, when open this, shown great, including image. shown fine when see email in hotmail, when check same email in gmail, image not shown, white space. have tried few things, don't know happening. appreciate help!

MATLAB offset when plotting integration of sin -

Image
i have question, because work many functions, have trouble when trying plot integral of sine (i using matlab 2010): clear close clc x = linspace(-10, 10, 100); f = @(x) sin(x); = arrayfun(@(x) quad(f, 0, x), x); plot(x, f(x),'r', x, i, 'b') i expect having -cos(x), instead offset of 1, why happening? how should fix problem? the fundamental theorem of calculus says indefinite integral of nice function f ( x ) equal function's antiderivative f ( x ), unique up-to additive constant. further, definite integral has form: in form, constant of integration cancel out, , integral equal desired antiderivative only if lower bound evaluation vanishes . however, -cos(0) not vanish , has value of -1 . in order calculate desired antiderivative f ( x ), lower bound evaluation should added right-hand side. plot(x, f(x),'r', x, i+ (-cos(0)), 'b'); this equivalent of assigning initial value solution of odes la ode45 .

api - C# webapi POST via console program -

i have web api can access through browser :- https://127.0.0.1:8443/ncrapi i trying create simple console program in c# using vs2015 send data , receive response using http post. here have far:- using system; using system.net.http; using system.net.http.headers; using system.threading.tasks; namespace websample { class apisenddata { public string userid { get; set;} // username public string password { get; set;} // password webapi public string apifunction { get; set; } public string dppname { get; set; } public string cleardata { get; set; } public string dppversion { get; set; } } class program { static void main(string[] args) { // main function calls async method named runasync // , blocks until runasyncc completes. runasync().wait(); } static async task runasync() { using (var client = new httpclient()) ...

android - Unable to download .apk file from async task -

i trying download apk url inside async task not working , .apk not or partially downloading here, don't know why. progress bar dialog doesn't show progress , stuck @ 0. please me solve issue. thank in advance! here code : public class mainactivity extends appcompatactivity implements view.onclicklistener{ interstitialad minterstitialad; progressdialog pdialog; private button downloadbutton; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); pdialog = new progressdialog(this); downloadbutton = (button) findviewbyid(r.id.button_download); downloadbutton.setonclicklistener(this); minterstitialad = new interstitialad(this); minterstitialad.setadunitid(getstring(r.string.interstitial_full_screen)); adrequest adrequest = new adrequest.builder().build(); minterstitialad.loadad(adrequest); minterstitialad.setadlistener(new adlistener() { ...