Daily Archives

Articles indexed Thursday March 18 2010

Page 4/133 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • IE Not Picking up Blur Event (jQuery)

    - by Jascha
    I did a quick search, but couldn't find a specific solution to this (I'm sure it HAS been answered) but, I need to figure this out... Anyone know why this won't work in IE? $(document).ready(function() { $(document).blur(function() { window.close(); }); }); And what to do instead? Thanks.

    Read the article

  • Get rid of wasted/unused space in a JMenu

    - by Trevor Harrison
    In my app, I've got a menu bar with a File menu. In the submenus, each JMenuItem is wasting a lot of white space to the left of the text for a checkbox (I think), even though I'm not including any JCheckBoxMenuItems. I'm seeing lots of other java/swing apps who's menus don't waste this space. How do I do it in my app?

    Read the article

  • Are there any C++ tools that detect misuse of static_cast, dynamic_cast, and reinterpret_cast?

    - by chrisp451
    The answers to the following question describe the recommended usage of static_cast, dynamic_cast, and reinterpret_cast in C++: http://stackoverflow.com/questions/332030/when-should-static-cast-dynamic-cast-and-reinterpret-cast-be-used Do you know of any tools that can be used to detect misuse of these kinds of cast? Would a static analysis tool like PC-Lint or Coverity Static Analysis do this? The particular case that prompted this question was the inappropriate use of static_cast to downcast a pointer, which the compiler does not warn about. I'd like to detect this case using a tool, and not assume that developers will never make this mistake.

    Read the article

  • Any good books out there for advanced concepts like lambdas, delegates, events etc?

    - by they_soft
    I've read about these features but I don't think I've seen enough to consistently apply them in my coding, eg "This would be better done with a delegate than with my other, outdated approach". I know what they do, but I want more examples of use cases, or want some heuristic to help me think in terms of such features. All the books I've seen either focus only on the basics or just mention the features as part of the language. Is there any book out there that deals with this? Preferably C# or language agnostic.

    Read the article

  • Is generating real random numbers this easy in C#?

    - by JL
    I found this code using Google. private int RandomNumber(int min, int max) { Random random = new Random(); return random.Next(min, max); } Is this really all there is to generating REAL random numbers in C#? I intend to generate on a small scale between values 1-10. Thanks

    Read the article

  • Lawler's Algorithm Implementation Assistance

    - by Richard Knop
    Here is my implemenation of Lawler's algorithm in PHP (I know... but I'm used to it): <?php $jobs = array(1, 2, 3, 4, 5, 6); $jobsSubset = array(2, 5, 6); $n = count($jobs); $processingTimes = array(2, 3, 4, 3, 2, 1); $dueDates = array(3, 15, 9, 7, 11, 20); $optimalSchedule = array(); foreach ($jobs as $j) { $optimalSchedule[] = 0; } $dicreasedCardinality = array(); for ($i = $n; $i >= 1; $i--) { $x = 0; $max = 0; // loop through all jobs for ($j = 0; $j < $i; $j++) { // ignore if $j already is in the $dicreasedCardinality array if (false === in_array($j, $dicreasedCardinality)) { // if the job has no succesor in $jobsSubset if (false === isset($jobs[$j+1]) || false === in_array($jobs[$j+1], $jobsSubset)) { // here I find an array index of a job with the maximum due date // amongst jobs with no sucessor in $jobsSubset if ($x < $dueDates[$j]) { $x = $dueDates[$j]; $max = $j; } } } } // move the job at the end of $optimalSchedule $optimalSchedule[$i-1] = $jobs[$max]; // decrease the cardinality of $jobs $dicreasedCardinality[] = $max; } print_r($optimalSchedule); Now the above returns an optimal schedule like this: Array ( [0] => 1 [1] => 1 [2] => 1 [3] => 3 [4] => 2 [5] => 6 ) Which doesn't seem right to me. The problem might be with my implementation of the algorithm because I am not sure I understand it correctly. I used this source to implement it: http://www.google.com/books?id=aSiBs6PDm9AC&pg=PA166&dq=lawler%27s+algorithm+code&lr=&hl=sk&cd=4#v=onepage&q=&f=false The description there is a little confusing. For example, I didn't quite get how is the subset D defined (I guess it is arbitrary). Could anyone help me out with this? I have been trying to find some sources with simpler explanation of the algorithm but all sources I found were even more complicated (with math proofs and such) so I am stuck with the link above. Yes, this is a homework, if it wasn't obvious. I still have few weeks to crack this but I have spent few days already trying to get how exactly this algorithm works with no success so I don't think I will get any brighter during that time.

    Read the article

  • Software to simplify displaying build status on a big visible monitor for team?

    - by MikeJ
    I had a little bit of budget left at year end and I wanted to start a little skunk works project to display build status what everyone was working on (our team is aobut 10 folks all told). I am thinking to buy a 47" LCD HD TV and drive it from a small pc via a browser/.NET web application. I was going to build the software over the christmas break since we are closed for 2 weeks starting this Friday. I thought I would solicit advise/feedback on what other teams had done. a lot of the tools we use SVN, Mantis have RSS feeds that I was thinking to render. Is this the way to go ? Thanks for any feedback in advance.

    Read the article

  • Turn class "Interfaceable"

    - by scooterman
    Hi folks, On my company system, we use a class to represent beans. It is just a holder of information using boost::variant and some serialization/deserialization stuff. It works well, but we have a problem: it is not over an interface, and since we use modularization through dlls, building an interface for it is getting very complicated, since it is used in almost every part of our app, and sadly interfaces (abstract classes ) on c++ have to be accessed through pointers, witch makes almost impossible to refactor the entire system. Our structure is: dll A: interface definition through abstract class dll B: interface implementation there is a painless way to achieve that (maybe using templates, I don't know) or I should forget about making this work and simply link everything with dll B? thanks Edit: Here is my example. this is on dll A BeanProtocol is a holder of N dataprotocol itens, wich are acessed by a index. class DataProtocol; class UTILS_EXPORT BeanProtocol { public: virtual DataProtocol& get(const unsigned int ) const { throw std::runtime_error("Not implemented"); } virtual void getFields(std::list<unsigned int>&) const { throw std::runtime_error("Not implemented"); } virtual DataProtocol& operator[](const unsigned int ) { throw std::runtime_error("Not implemented"); } virtual DataProtocol& operator[](const unsigned int ) const { throw std::runtime_error("Not implemented"); } virtual void fromString(const std::string&) { throw std::runtime_error("Not implemented"); } virtual std::string toString() const { throw std::runtime_error("Not implemented"); } virtual void fromBinary(const std::string&) { throw std::runtime_error("Not implemented"); } virtual std::string toBinary() const { throw std::runtime_error("Not implemented"); } virtual BeanProtocol& operator=(const BeanProtocol&) { throw std::runtime_error("Not implemented"); } virtual bool operator==(const BeanProtocol&) const { throw std::runtime_error("Not implemented"); } virtual bool operator!=(const BeanProtocol&) const { throw std::runtime_error("Not implemented"); } virtual bool operator==(const char*) const { throw std::runtime_error("Not implemented"); } virtual bool hasKey(unsigned int field) const { throw std::runtime_error("Not implemented"); } }; the other class (named GenericBean) implements it. This is the only way I've found to make this work, but now I want to turn it in a truly interface and remove the UTILS_EXPORT (which is an _declspec macro), and finally remove the forced linkage of B with A.

    Read the article

  • sIFR3: controlling a and a:hover styles inside replaced through CSS rather than JS

    - by sneeuwitje
    For graceful degrading and minimal coding for the sIFR feature on my websites I would want to define styles in CSS as much as possible. Here's what I do: Define a H3 tag to be replaced by sIFR3. H3 comes in varying colors by CSS depending on it's container, say body.blue-txt h3{ color: #009CDA; } body.white-txt h3{ color: #FFFFFF; } body.etc... H3 might contain an anchor (I'm aware of semantical issues, but that's just how it is ... sorry) With setting sIFR.useStyleCheck = true; sIFR3 will show replaced normal H3 text with correct color, but when it contains a link, it shows the Flash default #0000FF .... All fine; I can tweak e.g. blue text in sifr-config.js by using the css-parameter for sIFR.replace(): sIFR.replace(futura, { selector: 'body.blue-txt h3', css: 'a {color: #009CDA; }, a:hover { color: #009CDA; text-decoration: underline; }' }); But that would have to be coded for every single text-color in my sIFR replacements in both JS and CSS. So I would want to make the sIFR.useStyleCheck setting just respect the CSS in sifr-config.css like: body.blue-txt h3{ color: #009CDA; } body.blue-txt h3 a{ color: #009CDA; } body.blue-txt h3 a:hover{ color: #009CDA; text-decoration: underline; } Only this doesn't seem to work ... the link text keeps popping up as #0000FF and the hover is not underlined. Is this just Not A Feature (Yet), or am doing something wrong?

    Read the article

  • Weird Javascript Regex Replace Backreference Behavior

    - by arshaw
    why does the following js expression: "test1 foo bar test2".replace(/foo.bar/, "$'") result in the following string? "test1 test2 test2" is the $' in the replace string some sort of control code for including everything after the match??? this behavior was screwing with me most of the day. can anyone explain this? thanks a lot ps- this is the case in all browsers i've tested

    Read the article

  • How can I see Bash history from more than one terminal session in Ubuntu?

    - by Sanoj
    I use Ubuntu 9.10 and I would like to be able to see my bash history for more than one terminal sessions. I.e. my last 200 commands or so, even if I have been logged out in between. When I use the history I just see all commands from my actual terminal session. How can I see more command history from Bash? Is there any specific settings for bash that I should change from the default values in Ubuntu?

    Read the article

  • Rank Source Control Optionsl-VSS vs CVS vs none vs your own hell

    - by Roman A. Taycher
    It seems like a lit of people here and on many programmer wikis/blogs/ect. elsewhere really dislike VSS. A lot of people also have a serious dislike for cvs. In many places I have heard a lot of differing opinions on whether or not using vss or cvs is better or worse then using no source control, please rate the worst and explain why!!!!! you rated them this way. Feel free to throw in your own horrible system in the rankings. If you feel it depends on the circumstances try to explain the some of the different scenarios which lead to different rankings. (note:I see a lot of discussion of what is better but little of what is worse.) second note: while both answers are nice I'm looking less for good replacements and more for a comparison of which is worse and more importantly why!!!!!

    Read the article

  • Tomcat 5.5, Is there a max upload speed per request?

    - by maclema
    I am having an issue when uploading files to tomcat. It seems that tomcat (or something else?) will not handle the upload as fast as I can send it. When uploading multiple files concurrently I can max out my local connection upload speed (2.1MB/s). However, when uploading only one file at a time, no matter how small or large the file, the upload will max out around 400KB/s. I have tried setting the appReadBufSize higher but it makes no difference. Is there something else that would be limiting the upload speed per request? Proxy Server: CentOS 4 Apache 2 SSL Tomcat Server: CentOS 4 Tomcat 5.5.25 (Tomcat Native Library Is Installed) Java 6 Thanks! Matt

    Read the article

  • Launch Program from IE

    - by webertron
    Is it possible to launch a program from an anchor in IE? For example, iTunes had links like itms:blahblah that would open up iTunes and go directly to the appropriate page. If so, what is the best way to do this?

    Read the article

  • Csharp component which generates fragments with highlights for diffs for 2 strings

    - by MicMit
    I need C# implementation ( ideally open source ) which is similar to Delphi DLL. I am currently using the wrapper ( C# syntax is provided , but it is a call from a different language ) zdiff( string ref str1, string ref str2, int range , int trim ) it calls inside str1 = GetHiDiff(@str1,1,trim) str2 = GetHiDiff(@str1,2,trim) where function GetHiDiff(s:pchar; sIndex:integer; wtrim:integer): pchar; stdcall; What it does it returns a left fragment html of str1 and a right html fragment of str2 with diffs highlighted as strings are passed by reference. Range parameter determines the size of html fragment. Not sure what trim 0 does.

    Read the article

  • Outlook 2003 View Control with C#

    - by Eleasar
    I want to embed a custom c# windows form (or WPF) user control into an outlook view. I am using Outlook 2003 and Visual Studio 2008. I did download an example for Outlook 2007 here: http://blogs.msdn.com/e2eblog/archive/2008/01/09/outlook-folder-homepage-hosting-wpf-activex-and-windows-forms-controls.aspx and also here: http://msdn.microsoft.com/en-us/library/aa479345.aspx I tested it and under 2007 it is working, but for 2003 i am getting the following error when i want to open the view: Could not complete the operation due to error 80131509 I can start it from Visual Studio, it is registering the folder just fine, debugging works and all that. It creates an HTML page that contains my type as an object parameter - but the Initialize method that should be called is either not present (not shown via JS) or it has some errors. The breakpoints for RegisterSafeForScripting are also never hit - maybe related to that. Thx in advance!

    Read the article

  • virtual function

    - by hitech
    class a { virtual void foo(void) ; }; class b : public a { public: virtual void foo(void) { cout<< "class b"; } }; int main ( ) { class a *b_ptr = new b ; b_ptr->foo(); } please guide me why the b_ptr-foo() will not call the foo() function of the class b?

    Read the article

  • iPhone: Activate UISlider and set its value to the location of the current touch programatically

    - by carloe
    Is it possible to set an UISlider as first responder and set its current value to the location of the current touch programatically? The way my app is set up I have a UIView container that takes up the whole screen. Inside the container I have another UIView offscreen at the bottom edge (I'll call this bottomBar). Inside the bottomBar there is a UISlider element. Right now, when the user swipes along the bottom edge of the screen the bottomBar the slider it contains slide up. What I am trying to achieve is to activate the UISlider, and set the position of the slider (the value) to the position of the users touch. Is this possible? Could someone please point me in the right direction?

    Read the article

  • jQuery partial page refresh after form submit

    - by heeboir
    When using jQuery to submit a form is it possible to place the resulting page (after the submit) inside another HTML element? I'll try to make this clearer. Up to now I've been using Callback methods that among others do a document.forms['form'].submit(); whenever a form has been updated with new information and needs to be refreshed. However, this results in a full page refresh. I'm implementing Partial Page Refresh using jQuery and thought of using something like var newContent = jQuery('#form').submit(); jQuery('#div').load(newContent); However, that does not seem to work as the page is still fully refreshed. The content is correct, however the behaviour seems to be exactly the same as before - so I'm not really sure if what I want is actually possible with jQuery. Any hints and pointers would be helpful. Thanks.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >