user-experience

Evaluate whether a HEX value is dark or light

喜欢而已 提交于 2019-11-30 04:05:18
The user of the ASP.NET web app I'm building can select colors for use on some of the elements (e.g. buttons/titles) to facilitate some degree of personalisation. The problem is that by default the text on those layers is black...what I'm trying to do is to evaluate the HEX value chosen by the user through a picker, and switch between black and white text programmatically - this can be in JavaScript, or in code behind. The crux of the problem is that I'm just not sure how to evaluate the HEX to make the decision whether the proximity of the chosen color to black is too close to use black text.

Easiest css for Facebook style “red” notifications

廉价感情. 提交于 2019-11-29 19:01:28
I need a facebook style notification, but getting something that looks nice cross browser seems tricky. For example, different browsers seem to treat paddings differently, resulting in weird looking notifications. What is the best cross-browser way of ensuring the notifications show up nicely? Not adverse to using javascript, but pure css is of course preferable Titus The best way to achieve this is by using absolute positioning : /* Create the blue navigation bar */ .navbar { background-color: #3b5998; font-size: 22px; padding: 5px 10px; } /* Define what each icon button should look like */

How to make browser back and forward work on a single page layout?

痞子三分冷 提交于 2019-11-29 15:19:52
问题 As a follow-up question to: Most efficient way to do a horizontal sliding layout, is it possible to make the browser's back and forward button work when using a single page layout like that? 回答1: You can use the history API in HTML5 to achieve that. Here are a few resources to get you started: http://diveintohtml5.info/history.html http://html5demos.com/history https://developer.mozilla.org/en-US/docs/DOM/Manipulating_the_browser_history To get support in older browsers as well, there are

How to specify units in Dialog Units in WPF?

微笑、不失礼 提交于 2019-11-29 14:25:38
i'm trying to figure out how to layout a simple dialog in WPF using the proper dialog units (DLUs). i've come up with a simple r example, that cuts straight to the problem: You can check the Windows UX Guidelines to see where these measurements come from. The short version is: dlu = dialog unit dlu is based on the font size ( items change with user's font size ) a horizontal dlu is different from a vertical dlu ( dlu's are not square ) This comes from the definition of a dialog unit: the average character is 8dlus high by 4dlus wide . Georgia 14pt: If you use a smaller font (i.e. 8pt Tahoma

DNS-based strategies for showing a nice “Currently Offline” page when the server is down

可紊 提交于 2019-11-29 08:27:18
问题 How can I make that a site automagically show a nice "Currently Offline" page when the server is down (I mean, the full server is down and the request can't reach IIS) Changing the DNS manually is not an option. Edit: I'm looking to some kind of DNS trick to redirect to other server in case the main server is down. I can make permanent changes to the DNS, but not manually as the server goes down. 回答1: I have used the uptime services at DNSMadeEasy to great success. In effect, they set the DNS

How long should you debounce text input

寵の児 提交于 2019-11-28 23:02:28
Lets say we have a simple example as below. <input id="filter" type="text" /> <script> function reload() { // get data via ajax } $('#filter').change($.debounce(250,reload)); </script> What we're doing is introducing a small delay so that we reduce the number of calls to reload whilst the user is typing text into the input. Now, I realise that this will depend on a case by case basis but is there an accepted wisdom of how long the debounce delay should be, given an average (or maybe that should be lowest common denominator) typing/interaction speed. I generally just play around with the value

How does Financial Times add a disclaimer when pasting text?

对着背影说爱祢 提交于 2019-11-28 20:48:05
Here is an example of what happens when pasting text from Financial Times, the top paragraph is added. Thanks in advance! Example: Please respect FT.com's ts&cs and copyright policy which allow you to: share links; copy content for >personal use; & redistribute limited extracts. Email ftsales.support@ft.com to buy additional rights >or use this link to reference the article - http://www.ft.com/cms/s/0/792f1aec- >9600-11e0-8256-00144feab49a.html#ixzz1PFrYZiD0 Goldman Sachs gave a paid internship to a top Libyan official’s relative while the bank was carrying >out lossmaking trades on behalf of

Hide traceback unless a debug flag is set

那年仲夏 提交于 2019-11-28 17:27:29
What is the idiomatic python way to hide traceback errors unless a verbose or debug flag is set? Example code: their_md5 = 'c38f03d2b7160f891fc36ec776ca4685' my_md5 = 'c64e53bbb108a1c65e31eb4d1bb8e3b7' if their_md5 != my_md5: raise ValueError('md5 sum does not match!') Existing output now, but only desired when called with foo.py --debug : Traceback (most recent call last): File "b:\code\apt\apt.py", line 1647, in <module> __main__.__dict__[command] (packages) File "b:\code\apt\apt.py", line 399, in md5 raise ValueError('md5 sum does not match!') ValueError: md5 sum does not match! Desired

Characters to avoid in automatically generated passwords

邮差的信 提交于 2019-11-28 17:05:07
I need to generate some passwords, I want to avoid characters that can be confused for each other. Is there a definitive list of characters I should avoid? my current list is il10o8B3Evu![]{} Are there any other pairs of characters that are easy to confuse? for special characters I was going to limit myself to those under the number keys, though I know that this differs depending on your keyboards nationality! As a rider question, I would like my passwords to be 'wordlike'do you have a favoured algorithm for that? Thanks :) Here are the character sets that Steve Gibson uses for his "Perfect

Easiest css for Facebook style “red” notifications

故事扮演 提交于 2019-11-28 13:12:34
问题 I need a facebook style notification, but getting something that looks nice cross browser seems tricky. For example, different browsers seem to treat paddings differently, resulting in weird looking notifications. What is the best cross-browser way of ensuring the notifications show up nicely? Not adverse to using javascript, but pure css is of course preferable 回答1: The best way to achieve this is by using absolute positioning : /* Create the blue navigation bar */ .navbar { background-color