on-internet

If you shouldn't throw exceptions in a destructor, how do you handle errors in it?

Most people say never throw an exception out of a destructor - doing so results in undefined behavior. Stroustrup makes the point that "the vector destructor explicitly invokes the destructor for every element. This implies that if an element destructor throws, the vector destruction fails... There is really no good way to protect against exceptions thrown from destructors, so the library makes no guarantees if an element destructor throws" (from Appendix E3.2). This article seems to say otherwise - that throwing destructors are more or less okay. So my question is this - if throwing from a de

Join the discussion →

Position an element relative to its container

I'm trying to create a horizontal 100% stacked bar graph using HTML and CSS. I'd like to create the bars using DIVs with background colors and percentage widths depending on the values I want to graph. I also want to have a grid lines to mark an arbitrary position along the graph. In my experimentation, I've already gotten the bars to stack horizontally by assigning the CSS property float: left. However, I'd like to avoid that, as it really seems to mess with the layout in confusing ways. Also, the grid lines don't seem to work very well when the bars are floated. I think that CSS positioning

Join the discussion →

PHP DOMDocument stripping HTML tags

I'm working on a small templating engine, and I'm using DOMDocument to parse the pages. My test page so far looks like this: <block name="content"> <?php echo 'this is some rendered PHP! <br />' ?> <p>Main column of <span>content</span></p> </block> And part of my class looks like this: private function parse($tag, $attr = 'name') { $strict = 0; /*** the array to return ***/ $out = array(); if($this->totalBlocks() > 0) { /*** a new dom object ***/ $dom = new domDocument; /*** discard white space ***/ $dom->preserveWhiteSpace = false; /*** load the html into the object ***/ if($strict==1) { $do

Join the discussion →

Displaying build times in Visual Studio

Our build server is taking too long to build one of our C++ projects. It uses Visual Studio 2008, running devenv.com MyApp.sln /Build -- see devenv command-line switches (although that's for a newer version of VS). Is there a way to get devenv.com to log the time taken to build each project in the solution, so that I know where to focus my efforts? Improved hardware is not an option in this case. I've tried setting the output verbosity (under menu Tools → Options → Projects and Solutions → Build and Run → MSBuild project build output verbosity). This doesn't seem to have any effect in the IDE.

Join the discussion →

Deleting a buffer through a different type of pointer

Say I have the following C++ code: char *p = new char[cb]; SOME_STRUCT *pSS = (SOME_STRUCT *) p; delete pSS; Is this safe according to the C++ standard? Do I need to cast back to a char* and then use delete[]? I know it'll work in most C++ compilers, because it's plain-ordinary-data, without any destructors. Is it guaranteed to be safe?

Join the discussion →

Is it worth encrypting email addresses in the database?

I'm already using salted hashing to store passwords in my database, which means that I should be immune to rainbow table attacks. I had a thought, though: what if someone does get hold of my database? It contains the users' email addresses. I can't really hash these, because I'll be using them to send notification emails, etc.. Should I encrypt them?

Join the discussion →

Using bitwise operators for Booleans in C++

Is there any reason not to use the bitwise operators &, |, and ^ for "bool" values in C++? I sometimes run into situations where I want exactly one of two conditions to be true (XOR), so I just throw the ^ operator into a conditional expression. I also sometimes want all parts of a condition to be evaluated whether the result is true or not (rather than short-circuiting), so I use & and |. I also need to accumulate Boolean values sometimes, and &= and |= can be quite useful. I've gotten a few raised eyebrows when doing this, but the code is still meaningful and cleaner than it would be otherwi

Join the discussion →

What's the purpose (if any) of "javascript:" in event handler attributes?

I've been making a concerted effort to improve my javascript skills lately by reading as much javascript code as I can. In doing this I've sometimes seen the javascript: prefix appended to the front of event handler attributes in HTML element tags. What's the purpose of this prefix? Basically, is there any appreciable difference between: onchange="javascript: myFunction(this)" and onchange="myFunction(this)" ?

Join the discussion →

Keep Remote Directory Up-to-date

I absolutely love the Keep Remote Directory Up-to-date feature in Winscp. Unfortunately, I can't find anything as simple to use in OS X or Linux. I know the same thing can theoretically be accomplished using changedfiles or rsync, but I've always found the tutorials for both tools to be lacking and/or contradictory. I basically just need a tool that works in OSX or Linux and keeps a remote directory in sync (mirrored) with a local directory while I make changes to the local directory. Update Looking through the solutions, I see a couple which solve the general problem of keeping a remote direc

Join the discussion →

飯田圭織・前田有紀の“大人の七夕祭り”日帰りバス旅行 - desperate diary

恐らくかおたんが独身最後のFCバスツアーに参加してきました。 無駄に長いレポっぽいものですが、携帯の方は・・・ 去年より集合時間が遅かったから千葉方面だなとは予想してたけど、案の定千葉方面w 会場は千葉県野田市にある清水公園という所でした。 今年はバーベキューの時の座席抽選が無く、どんな席なのかと思ったら...

Join the discussion →

大好評!簡単!ベークドチーズケーキ by みみよりちゃん

ドイツ在住主婦の間では超有名レシピ。焼きたてはスフレみたいにふわふわ、一晩冷やすと濃厚になるよ。クリームチーズの量は200~400gまで同じ型でいけます!(その場合その他の材料も加減してね。) このレシピの生い立ち お友達に教えてもらいましたが、分量は少しずつ変わってきてます。写真はチーズ400g(18c...

Join the discussion →