Posts

html - How would I make background of slideshow more opaque -

this question has answer here: how give text or image transparent background using css? 26 answers i kinda want make black background little transparent unfortunately making image within slide transparent well. code: #slideshow { float:left; width: 810px; height: 360px; margin: 10px 0 0 10px; background-color: rgb(0,0,0); -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; } #slideshow img { margin: 5px 5px; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; } you can use rgba() set background color opacity. example: #div { background-color: rgba(0,0,0,.4); } this make background black 40% opacity.

java - Can jackson deserialize from different JSON string to same object? -

i have json string, this: { ... "token": "abc123" ... } then reason, have update new structure, expected incoming json string becomes: { ... "token": {"property01":"true", "property02":"false", "value": "abc123"} ... } originally, token field in string type, now, becomes object, additional properties. i need handle both format backward compatibility, can jackson handle case? you creating own deserializer: class foojsondeserializer extends jsondeserializer<foo> { @override public foo deserialize(jsonparser jp, deserializationcontext ctxt) throws ioexception, jsonprocessingexception { foo foo = new foo(); //deserialize data here return foo; } } and don't forget add deserializer class @jsondeserialize(using = foojsondeserializer.class) class foo { ... }

python - performance generating combinations of objects with combinations of attr -

i looking advice on how can better approach couple of functions. i have set of 5 objects 6 attributes on each, number of objects can change amount of attributes. i need iterate on each possible combination of attribute, on each possible combination of object. no object in set can feature same value within set. , each objects attributes there n possible values ( n set size ). values applicable attributes cannot applicable attribute. ie. attributea's value, never value attributeb. at moment have objects represented list of lists. eg. [[obj1attr_a, obj1attrb], [obj2attr_a, obj2attr_b]] etc the problem itertools.combinations returns many redundent combinations not valid ( ie. values appear more once ). if use generator return valid combinations slow never yields correct combination. there way filter results in itertools.combinations efficiently? #keywords list of possible values each attribute solver.get_unique_combinations( itertools.combinations(itertools.produc...

caching - Couchbase warmup strategies -

we have memcached cluster running in production. replacing memcached couchbase cluster persistent cache layer. question how implement cut-over , how warm couchbase bucket. can't switch on cold couchbase since starting old cache bring whole site down. one option thinking warm couchbase memcached node first. means couchbase using (non-persistent) memcached bucket, , getting cache set/get traffic other memcached node. thing there minimum code changes (what's needed configure moxi proxy take memcached traffic, , register node memcached node). later convert memcached buckets couchbase. not sure couchbase supports conversions between these 2 types of buckets. the 2nd option set persistent couchbase bucket (as opposed non-persistent memcached bucket) @ beginning. change production cache client replicate traffic both memcached , coucbase clusters. monitor couchbase bucket , once cache items reach size, complete cut-over. small drawback complexity change cache client. thoughts...

Calculating exact change with JavaScript -

i'm attempting solve algorithm challenge on @ freecodecamp. here prompt problem: design cash register drawer function checkcashregister() accepts purchase price first argument (price), payment second argument (cash), , cash-in-drawer (cid) third argument. cid 2d array listing available currency. return string "insufficient funds" if cash-in-drawer less change due. return string "closed" if cash-in-drawer equal change due. otherwise, return change in coin , bills, sorted in highest lowest order. my solution works of parameters, except following: checkcashregister(19.50, 20.00, [["penny", 1.01], ["nickel", 2.05], ["dime", 3.10], ["quarter", 4.25], ["one", 90.00], ["five", 55.00], ["ten", 20.00], ["twenty", 60.00], ["one hundred", 100.00]]) should return: [["quarter", 0.50]] checkcashregister(3.26, 100.00, [["penny...

php - How to get back a Header in Wordpress once removed? -

at first wanted remove header on few pages. used code: /* hide header menu ()/ */ .page-id- #header-space, .page-id- #header-outer { display: none; } .page-id- #header-secondary-outer { display: none; } .page-id- #footer-outer { display: none; } i can't figure out how bring header these pages, deleted code 'appearance - editor) didn't seem work. can help? display: block should it. display: block opposit of display: none.

python - Making 1 milion requests with aiohttp/asyncio - literally -

i followed tutorial: https://pawelmhm.github.io/asyncio/python/aiohttp/2016/04/22/asyncio-aiohttp.html , works fine when doing 50 000 requests. need 1 milion api calls , have problem code: url = "http://some_url.com/?id={}" tasks = set() sem = asyncio.semaphore(max_sim_conns) in range(1, last_id + 1): task = asyncio.ensure_future(bound_fetch(sem, url.format(i))) tasks.add(task) responses = asyncio.gather(*tasks) return await responses because python needs create 1 milion tasks, lags , prints killed message in terminal. there way use generator insted of pre-made set (or list) of urls? thanks. asyncio memory bound (like other program). can not spawn more task memory can hold. guess hit memory limit. check dmesg more information. 1 millions rps doesn't mean there 1m tasks. task can several request in same second.