由买买提看人间百态

topics

全部话题 - 话题: decorator
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
g**********y
发帖数: 14569
1
来自主题: JobHunting版 - 说说Decorator那个题
原帖见:http://www.mitbbs.com/article_t/JobHunting/32015883.html
说实在,那个主函数是一个很糟糕的写法,没有错误,但是awfully done。
现代软件工程的核心就是:代码易读易改。要做到这点,你的写法就不能违反直觉。
sneaker.Decorate(Alice); <-------------------------
trouser.Decorate(sneaker); 就是这一段看不明白!!!!!
tshirt.Decorate(trouser); 虚函数+覆写函数 咋有递归的感觉
tshirt.Show(); <-------------------------
code里用了英文单词,但是表达的完全不是那个意思,那就是对后来维护的人一种折磨。
Decorator的核心就是一个operation, 经过一条链来处理。这条链是可以动态增加的。
从结果看,你希望达到的效果就是:
decoratedOb... 阅读全帖
r******r
发帖数: 700
2
来自主题: Java版 - Decorator pattern in java
Anyone is good at Design Pattern in Java here? Thanks.
As for the decorator pattern, what's the real benefit of using it? In this
example, why not simply let the specific classes, like "Milk/Whip/Sprinkle",
directly extend from the base class or interface "Coffee"?
Thanks.
// The Coffee Interface defines the functionality of Coffee implemented by
decorator
public interface Coffee {
public double getCost(); // returns the cost of the coffee
public String getIngredients(); // returns the ... 阅读全帖
f*******e
发帖数: 289
3
Halloween decorations中发现中国劳改营的信
Halloween decorations carry haunting message of forced labor
http://www.oregonlive.com/happy-valley/index.ssf/2012/12/hallow
The letter came in a box of Halloween decorations purchased at Kmart, but
for a year Julie Keith never knew. It gathered dust in her storage, a
haunting plea for help hidden among artificial skeletons, tombstones and
spider webs.
Keith, a 42-year-old vehicle donation manager at a southeast Portland
Goodwill, at one point considered donating ... 阅读全帖
i**********b
发帖数: 77
4
来自主题: JobHunting版 - Design Pattern Question - Decorator
Thank you. Still I don't understand how this can be implemented. I had
understood how it's used though.
A typical Decorator design pattern is implemented using composition. The
Decorator and the Component (to be decorated) shall have the same interfaces
. The decorated component can be treated as an original component.
However, in this case, BufferedInputStream and DataInputStream both added
additional functions to FilterInputStream. If a FilterInputStream is
decorated by BufferedInputStream fir
i*****f
发帖数: 578
5
来自主题: Programming版 - python decorator 调用问题
This decorator definition seems not make sense to me.
From your dec. definition, it's obvious it takes two arguments: func, aa. So:
@decorator
def f():
...
is transformed to:
decorator(func, aa)(f)
Your decorator is **got** to take exactly two arguments. If this is the case
, seems that the wrapper is not doing what you want.
Are you trying to do something like:
def decorator(aa):
def outer_wrapper(func):
def wrapper(*args, **argd):
if
d****e
发帖数: 251
6
来自主题: Programming版 - python decorator 调用问题
如果要用@decorator调用,我觉得不能这么写decorator。这种写法你只能
直接
>>>new_func = decorator(func,aa)
这个tutorial写的挺清楚的,
http://www.artima.com/weblogs/viewpost.jsp?thread=240845
看最下面的Decorator Functions with Decorator Arguments.
w*******y
发帖数: 60932
7
How To Decorate A Cake:
http://www.amazon.com/How-Decorate-Cake-ebook/dp/B006WEVPKM
Product Description
Cake decorating is really a modern-age art form, and one that until recent
years was very often overlooked.
There is nothing as sure to garner you the approval, and the admiring "oohs
and ahs", of your guests than a beautifully decorated cake. People love to
marvel at them as much, or more, than they love to eat them!
Just picture a multi-tiered wedding cake, overflowing with smooth and snowy
... 阅读全帖
p*****o
发帖数: 222
8
不建议交易打印胖子;胖子是免费的,收费的是服务:
Get up to $20 by mail with the purchase of at least $80 worth of Groceries
OR YOU CAN CHOOSE:
Get up to $15 by mail with the purchase of a Christmas Tree and/or Holiday
Decorations worth $20 or more
***No Alcohol Purchase Required for Residents of the Following 13 States:
AL AR CT HI IN KY ME MO NC NJ NY UT WV***
Ebay上有详情:
http://cgi.ebay.com/1-Up-20-Heineken-Rebate-Groceries-Tree-Decor-1-4-11-/260699507262?pt=LH_DefaultDomain_0&hash=item3cb2e6ca3e
http://cgi.ebay.com/... 阅读全帖
J*******n
发帖数: 2901
9
来自主题: JobHunting版 - Design Pattern Question - Decorator
FileInputStream is the component that's being decorated. It gives a base
component
from which to read bytes.
BufferedInputStream is a concrete decorator. It adds behavior / decorates in
two
ways. It buffers input to improve performance, and also augments the
interface
with a new method readLine() for reading character-based input, a line at a
time.
DataInputStream is also a concrete decorator. It adds the ability to let an
application read primitive java data types from an underlying input strea
p*****o
发帖数: 222
10
不建议交易打印胖子;胖子是免费的,收费的是服务:
Get up to $20 by mail with the purchase of at least $80 worth of Groceries
OR YOU CAN CHOOSE:
Get up to $15 by mail with the purchase of a Christmas Tree and/or Holiday
Decorations worth $20 or more
***No Alcohol Purchase Required for Residents of the Following 13 States:
AL AR CT HI IN KY ME MO NC NJ NY UT WV***
Ebay上有详情:
http://cgi.ebay.com/1-Up-20-Heineken-Rebate-Groceries-Tree-Decor-1-4-11-/260699507262?pt=LH_DefaultDomain_0&hash=item3cb2e6ca3e
http://cgi.ebay.com/... 阅读全帖
j*****k
发帖数: 1198
11
来自主题: Programming版 - python decorator 调用问题
比如有下面一个decorator, 怎么调用?
def decorator(func,aa):
def wrapper(*args, **argd):
if aa:
func(*args, **argd)
return wrapper
@decorator
def myfunc(a1,a2)
or
@decorator(True)
def myfunc(a1,a2)
都不行。
谢谢
w*******y
发帖数: 60932
12
First ever post here! Enjoyed all the deals for years, now posting one!
Originally $99.99, now $7.99 + $1 shipping, use code SMS7873 for 20% off and
$0.99 shipping
Peanuts Snoopy Pre-Lit Animated Outdoor Decor
Link:
http://www.kohls.com/kohlsStore/clearance/sports_fanshop/mens/P Snoopy PreLit Animated Outdoor Decor.jsp
Peanuts Animated Mailbox Decor
Link:
http://www.kohls.com/kohlsStore/clearance/sports_fanshop/mens/P Animated Mailbox Decor.jsp
Z*****Z
发帖数: 723
13
来自主题: JobHunting版 - Design Pattern Question - Decorator
They both have the same interface for inputting dada. They both need to perf
orm decoration for the input stream. Since they are both subclasses of Filte
rInputStream, they can be chained together. Their neighbor is specified in t
he constructor. So each of them need to get data from the underlying (or nei
ghbor) input stream and do the specific decoration. Then wait the data to be
read by the next neighbor.

anyone familiar with Decorator design pattern?
Java I/O is using this pattern. Buffered
x******n
发帖数: 8550
14
【 以下文字转载自 gardening 讨论区 】
发信人: xianyunn (little devil), 信区: gardening
标 题: Fall decoration-ranch home with nature touch
发信站: BBS 未名空间站 (Wed Nov 10 12:20:36 2010, 美东)
http://www.bhg.com/decorating/decorating-style/contemporary/ranch-home-with-natural-touches/?
sssdmh=dm17.484542&esrc=nwdc&email=2593012241
e********t
发帖数: 9607
15
装浴室要买的东西:
Shower的防水底盘,下水和墙壁防水膜,比较受推崇的Schluter的整套kerdi系统在本
地经销商只要$420。4尺的底盘和108尺的防水膜。
类似的系统在floor and decor outlet最便宜的一款要$499,而且是3尺的底盘和53尺
的防水膜。
装墙壁的玻璃马赛克,8毫米厚度的在floor and decor outlet要$8.55一尺,同样8毫
米厚度的在costco订购只有$3.99一尺,不过在costco还要付运费。
所以最后我估计只有地板的大理石会在floor and decor outlet买。
r******8
发帖数: 26
16
Rose Bowl decoration, 装饰玫瑰花车 Fri, Dec 27, 2013 6 pm-10:30 pm
地点: Rose Bowl in Pasadena, Brookside Pavilion Tent in Parking Lot I
1001 Rose Bowl Dr, Pasadena, CA
组织: PowerMixer.co
时间: Fri, Dec 27 2013 6-10:30 pm, 4 hour slots
停车: FREE
Lot I of the Rose Bowl (just south of the South entrance of the Rose Bowl,
just east of the intersection of Seco and Arroyo). Parking is available in
the surrounding Rose Bowl parking lot. Please follow the signs and parking
lot attendants for available lots.
着装: 穿厚... 阅读全帖
x******n
发帖数: 8550
17
来自主题: gardening版 - Natural Elements for Fabulous Fall Decor
http://www.bhg.com/decorating/seasonal/autumn/natural-fabulous-fall-decor/?
sssdmh=dm17.480950&esrc=nwdc16_11ta&email=2593012241
Fill your home with fall color to last all season with these quick and easy
nature-inspired decorating ideas.
借花献给版上。顺便问有没有很好的gardening园艺杂志,网站?
r****t
发帖数: 10904
18
来自主题: Programming版 - python decorator 调用问题
这个不是 decorator, 只是一个名字叫 decorator 的function,语法上看是一个
closure,
decorator is invoked with the function object as the only argument.

发帖数: 1
19
A decorated former Marine was attacked and robbed by at least four people at
a Washington D.C. McDonald's last week, according to local police.
Christopher Marquez, 30, an Iraq War vet, told the Washington Post he was
eating in a back corner of the restaurant when a group of teens and young
men approached his table.
"They saw me and crowded around ... and they started asking me if I believed
black lives matter,” Marquez told the paper. “I was ignoring them, then
they started calling me racist."
... 阅读全帖
r*******u
发帖数: 185
20
天 这就叫胡乱 decorate啊?
我用超市蛋糕粉做完 花了一小时 涂上面的cream 还是要多丑有多丑
而且就这样 还是我做了好几次以后的水平 最后lg干脆不让我decorate,说是直接吃就
好啦
g**********y
发帖数: 14569
21
来自主题: JobHunting版 - 说说Decorator那个题
Finery就是Decorator的基础类,作为基础类,必须实现原来class里想要做成链式传递
的function, extend Person就是最容易的选择。如果你用use的关系,链象这个样子:
Decorator1() -> Decorator2() -> Decorator3() -> ....
Decorator1显然只能接受Person, Decorator2和其它的,要接受Finery, 而Finery不继
承Person, 那这条链形式上就不是完全一致的,就没办法随便交换Decorator的次序。
i******d
发帖数: 565
22
小学有活动,要求decorate自己的车子,到时候让小孩们来trick or treat。请问如何
decorate自己的vinivan。有没有什么彩灯直接插到车内插座上。谢谢。
a*****0
发帖数: 3319
23
Marble is beautiful, but it takes time and effort for maintenance. So I will
choose big porcelain tiles for shower stall and tub wall surroundings.
For the decorative trim, if installed a little below the shower head (so not
in the spray line), would it almost maintenance free if they are marble (or
travertine)? Handheld shower head will be installed, so I cannot guarantee
that the decorative area is always dry, because my daughter sometimes takes
off the showerhead.
Thank you very much.
h******f
发帖数: 92
24
最近买的二手自住房很快就要过户了,由于现在木地板老旧,开始请thumbtack和home
advisor上找的contractor来quote。每次都是还没来就告诉我说千万不要用LL或者home
decor的木地板,说那些地板都是garbage crap。然后说contractor他们自己提供的地
板才是最棒的最好的。我能够理解contractor们可以在自己提供的地板上再多赚些钱,
但我同时也想问问大伙,是不是LL和Floor Decor的地板就真的那么不堪?最后再问下
一般3000sqft的面积,加上30节楼梯,还有handrail。大概铺地板labor的费用。。。
nail down or glue down
谢谢!!!
r*****6
发帖数: 5063
25
【 以下文字转载自 PennySaver 讨论区 】
发信人: rain716 (雨), 信区: PennySaver
标 题: where to buy infant's birthday party decoration stuff at good price?
发信站: BBS 未名空间站 (Mon Aug 2 11:22:36 2010, 美东)
RT, like 1st birthday part decorations, such as cups, dinner plates, table
cloth, napkins, ballons, invitation and thank you postcards, and so on.
thansks.
r*****6
发帖数: 5063
26
【 以下文字转载自 PennySaver 讨论区 】
发信人: rain716 (雨), 信区: PennySaver
标 题: where to buy infant's birthday party decoration stuff at good price?
发信站: BBS 未名空间站 (Mon Aug 2 11:22:36 2010, 美东)
RT, like 1st birthday part decorations, such as cups, dinner plates, table
cloth, napkins, ballons, invitation and thank you postcards, and so on.
thansks.
r*****6
发帖数: 5063
27
Thank you for your response.
the party theme is "Thomas the Train"
I would like all the decorations stuff having Thomas on it.
I checked Diapers.com. It has birthday party stuff but no Thomas stuff.
On the website, orientaltrading.com, it has Thomas decoration stuff, but too
expensive.
Does anyone know other websites? thanks.
c**********n
发帖数: 13712
28
禁止交易pdf/打印coupon、CVS/Staples/Kohl's coupon:
胖子是免费的,收费的是服务:
所求物品名称:
12.30以前的10.50及以上snack、soda、holiday decor收据一张
1.5之前的$20及以上 worth of holiday decorations收据2张
物品类别(coupon: mfc 等;血糖仪等):
物品来源(报纸夹页,厂家邮寄等):
可接受的价格(必须明码标价,必填):
8包子each+shipping
邮寄损失方式哪方承担(若需邮寄,必填):
付款方式说明:
本贴有效期(必填):
联系方式(例: 站内):
x******n
发帖数: 8550
m**k
发帖数: 290
30
来自主题: Java版 - 求解释一下java decorator
对java的decorator一直不理解。网上搜了很多还是没概念。
我把程序中的@行删掉之后,还是可以编译运行的。
求解释这个decorator到底是干什么的?
g*****g
发帖数: 34805
31
来自主题: Java版 - 求解释一下java decorator
You mean decorator pattern? Java IO is a bunch of decorator patterns.
m**k
发帖数: 290
32
来自主题: Java版 - 求解释一下java decorator
对java的decorator一直不理解。网上搜了很多还是没概念。
我把程序中的@行删掉之后,还是可以编译运行的。
求解释这个decorator到底是干什么的?
g*****g
发帖数: 34805
33
来自主题: Java版 - 求解释一下java decorator
You mean decorator pattern? Java IO is a bunch of decorator patterns.
s*****w
发帖数: 1527
34
来自主题: Programming版 - c# decorator pattern question
Hi cogt,
thanks for reply 1st.
your solution is kind of against decorator pattern.
if i have DecoratorA/B/C/D/E/F/..., the code will be very complicated.
basically i'm looking for the correct/efficient way to do decorator in
c#.

((ConcreateDecoratorA)component).localComponent.
c**t
发帖数: 2744
35
来自主题: Programming版 - c# decorator pattern question
solution:
class ConcreteDecoratorA : Decorator
{
public override void Operation()
{
base.Operation();
Console.WriteLine("ConcreteDecoratorA.Operation()");
localComponent.var *= 2;
var = localComponent.var;
localComponent.get();
}
}
class ConcreteDecoratorB : Decorator
{
public override void Operation()
{
base.Operation();
AddedBehavior();
Console
S*******s
发帖数: 13043
36
来自主题: Programming版 - python: how to import a decorator?
I got an error if I want to run test.py:
@singleton
NameError: name 'singleton' is not defined
if I combine the two files, it would be fine.
what is right way to import decorator?
#in module Singleton.py
def singleton(theClass):
""" decorator for a class to make a singleton out of it """
classInstances = {}
def getInstance(*args, **kwargs):
""" creating or just return the one and only class instance.
The singleton depends on the parameters used in __init__ """... 阅读全帖
q****x
发帖数: 7404
37
来自主题: Programming版 - Proxy, Decorator, Adapter, and Bridge
这个帖子的描述还是抽象。谁能给些例子啊?
http://stackoverflow.com/questions/350404/how-do-the-proxy-deco
Proxy, Decorator, Adapter, and Bridge are all variations on "wrapping" a
class. But their uses are different.
Proxy could be used when you want to lazy-instantiate an object, or hide the
fact that you're calling a remote service, or control access to the object.
Decorator is also called "Smart Proxy." This is used when you want to add
functionality to an object, but not by extending that object's type. This
allo... 阅读全帖
z****e
发帖数: 54598
38
来自主题: Programming版 - Proxy, Decorator, Adapter, and Bridge
decorator的话
如果你有一个现成的类,然后你想继续开发
但是又不想破坏这个现有的类
怎么办?在这个基础之上额外加一个类
并把新增方法放到这个新增的类里面去
这样就保证了原有类的独立,又新增了额外的部分
这就是decorator,装饰
s*****w
发帖数: 1527
39
就是这个decorator class去decorator别的class,没找到好的例子。
谢谢!
w*******y
发帖数: 60932
40
LINK:
http://www.amazon.com/Hunter-90053-Decorative-Brushed-Frosted/dp/B001FVH6QO/ref=pd_ms_hi_3?ie=UTF8&s=hi
$36.24
Next lowest on google shopping:
http://www.google.com/products/catalog?hl=en&q=Hunter Fan Saturn 90053&cid=10957341111225331939&ei=UI2BTKOHMaD6ygWHmrXQBg&sa=button&ved=0CAkQgggwADgA#p
#p" rel="nofollow" target="_blank" onclick="try{pageTracker._trackEvent('
thread', 'click', '2218652 - hunter-decorative-brushed-nickel-bathroom-fan-$
36');} catch(err) {return true;}">google shopp
w*******y
发帖数: 60932
41
Skeleton in Trunk Halloween Decor:
http://www.everydaysource.com/product/skeleton-in-trunk-halloween-decor-ar211/HDDLHALOWN01/
$7.99 w/ free shipping
Coupon code: S10STHW
Limit 1000 uses
w*******y
发帖数: 60932
w*******y
发帖数: 60932
43
Amazon:
http://www.amazon.com/gp/coupon/c/ASCOQSZPAH57B?ie=UTF8&plgroup
currently has a Band-Aid products on sale with $1.00 Clipping Coupon with
Save and Subscribe.
*Note: You may cancel Save & Subscribe anytime after your order has shipped.
Price are with 5% Save & Subcribe + $1.00 Clipping Coupon.
Band-aid Adult Mickey, 20 Assorted - $1.48 + Free Shipping
Band-aid Disney Faries, Assorted, 20-Count:
http://www.amazon.com/Band-aid-Disney-Faries-Assorted-20-Count/
- $1.48 + Free Shipping
Ba... 阅读全帖
l****z
发帖数: 29846
44
11:55 AM 03/31/2015
While secretary of state, Hillary Clinton accidentally replied to an email
about a fallen U.S. drone in Pakistan with her thoughts about decorations.
“I like the idea of these,” she wrote in response to the email containing
an Associated Press story about a tussle between Pakistani soldiers and
Taliban fighters for the U.S. drone. “How high are they? What would the
bench be made of?”
“And I’d prefer two shelves or attractive boxes/baskets/containers on one,
” she continued. “... 阅读全帖
c****i
发帖数: 921
45
来自主题: Automobile版 - VSP & Decor 是CRV的什么options?
询价CR-V EX AWD (华州),有个dealer报价比别人便宜1000刀 ($24,3xx before $750
coupon),但给我的email里加了这些个东西,加上以后,就要$25,xxx(也就比别人便
宜200刀), 我在honda的官网上查不到这些东西,标配里面不带这些吗?
+++++++++++
Decor (3M Package) $399.00
VSP (Window Etch): $329.00
++++++++++
谢谢!
i*******u
发帖数: 1065
46
我倒,胡乱decorate一下都可以这么漂亮?
我只是不喜欢糖霜,好看不好吃。
我贴一个在国内休假时为父母订的鲜奶蛋糕。我及其想拥有这样的技术。
s*u
发帖数: 2240
47
这还是胡乱decorate。。。。
g****d
发帖数: 3461
48
来自主题: Food版 - Cake Decorating: Buttercream Basics
https://www.creativelive.com/courses/cake-decorating-buttercream-basics-
lucinda-larson
这两天免费直播
过期不候啊
g****d
发帖数: 3461
i**********b
发帖数: 77
50
来自主题: JobHunting版 - Design Pattern Question - Decorator
anyone familiar with Decorator design pattern?
Java I/O is using this pattern. BufferedInputStream and DataInputStream
are all subclasses of FilterInputStream.
they are supposed to work fine when used in any order on an InputStream
This (1):
fis = new FileInputStream(file);
bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);
And this (2):
fis = new FileInputStream(file);
dis = new DataInputStream(bis);
bis = new Buffered
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)