Search Results

Search found 2210 results on 89 pages for 'stupid phil'.

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

  • Why are compilers so stupid?

    - by martinus
    I always wonder why compilers can't figure out simple things that are obvious to the human eye. They do lots of simple optimizations, but never something even a little bit complex. For example, this code takes about 6 seconds on my computer to print the value zero (using java 1.6): int x = 0; for (int i = 0; i < 100 * 1000 * 1000 * 1000; ++i) { x += x + x + x + x + x; } System.out.println(x); It is totally obvious that x is never changed so no matter how often you add 0 to itself it stays zero. So the compiler could in theory replace this with System.out.println(0). Or even better, this takes 23 seconds: public int slow() { String s = "x"; for (int i = 0; i < 100000; ++i) { s += "x"; } return 10; } First the compiler could notice that I am actually creating a string s of 100000 "x" so it could automatically use s StringBuilder instead, or even better directly replace it with the resulting string as it is always the same. Second, It does not recognize that I do not actually use the string at all, so the whole loop could be discarded! Why, after so much manpower is going into fast compilers, are they still so relatively dumb? EDIT: Of course these are stupid examples that should never be used anywhere. But whenever I have to rewrite a beautiful and very readable code into something unreadable so that the compiler is happy and produces fast code, I wonder why compilers or some other automated tool can't do this work for me.

    Read the article

  • A stupid question about wordpress and php

    - by bubdada
    It may seem stupid question, but i've a serious problem... if you could check out orcik.net the thumbnail images does not appear. I figured out the reason but I don't know how to solve.. http://orcik.net/projects/thumb/orcikthumb.php?src=http://orcik.net/wp-content/uploads/2010/05/mac-safari-search-cache.png If you go to the above link you will get page not found error. However, if you go to the link below you'll get the thumbnail version of the image... http://orcik.net/projects/thumb/orcikthumb.php?src=/wp-content/uploads/2010/05/mac-safari-search-cache.png I'm using this piece of code on wordpress and the line appears like <a href="<?php the_permalink() ?>" rel="bookmark"> <img src="<?php bloginfo('template_directory'); ?>/includes/orcikthumb.php?src=<?php get_thumbnail($post->ID, 'full'); ?>&amp;h=<?php echo get_theme_mod($height); ?>&amp;w=<?php echo get_theme_mod($width); ?>&amp;zc=1" alt="<?php the_title(); ?>" /> </a> Thus, I believe I can't change the directory of image. But I could not figure out why I am getting page not found error. Is that might be CHMOD'es??? or something else?? Thanks

    Read the article

  • Cisco ASA bonding/teaming/port-channel capabilities

    - by Antoine Benkemoun
    Hello, This seemed to me like a really simple question that I would be able to answer by myself but I have not been able to find any info on this subject. I have a Cisco ASA 5510 which has 4 FastEthernet interfaces. I was wondering if it would be possible to use 2 or 3 of these interfaces as a port-channel in order to agregate bandwidth for multiple VLANs. I have found no info on the Cisco website nor on Google. Is this just a stupid/crazy idea or am I missing something ? Thank you in advance for your help, Antoine

    Read the article

  • stupid caching in asp.net

    - by kusanagi
    i use such code string.Format("<img src='{0}'><br>", u.Avatar); u.Avatar-it's like '/img/path/pic.jpg' but in this site i can upload new image instead old pic.jpg. so picture new, but name is old. and browser show OLD picture (cache). if i put random number like /img/path/pic.jpg?123 then works fine, but i need it only ufter upload, not always. how can i solve this? ?????????? ??????

    Read the article

  • Django stupid mark_safe?

    - by Mark
    I wrote this little function for writing out HTML tags: def html_tag(tag, content=None, close=True, attrs={}): lst = ['<',tag] for key, val in attrs.iteritems(): lst.append(' %s="%s"' % (key, escape_html(val))) if close: if content is None: lst.append(' />') else: lst.extend(['>', content, '</', tag, '>']) else: lst.append('>') return mark_safe(''.join(lst)) Which worked great, but then I read this article on efficient string concatenation (I know it doesn't really matter for this, but I wanted consistency) and decided to update my script: def html_tag(tag, body=None, close=True, attrs={}): s = StringIO() s.write('<%s'%tag) for key, val in attrs.iteritems(): s.write(' %s="%s"' % (key, escape_html(val))) if close: if body is None: s.write(' />') else: s.write('>%s</%s>' % (body, tag)) else: s.write('>') return mark_safe(s.getvalue()) But now my HTML get escaped when I try to render it from my template. Everything else is exactly the same. It works properly if I replace the last line with return mark_safe(unicode(s.getvalue())). I checked the return type of s.getvalue(). It should be a str, just like the first function, so why is this failing?? Also fails with SafeString(s.getvalue()) but succeeds with SafeUnicode(s.getvalue()). I'd also like to point out that I used return mark_safe(s.getvalue()) in a different function with no odd behavior.

    Read the article

  • What's your favorite stupid error message?

    - by Robusto
    Here's my candidate, just encountered, from an automated Java build. I just had to share it. "Composite step 'master' failed due to unsatisfication of success condition." In other words, it failed because it didn't succeed. Uh, thanks. I feel so much more ... what's the word I'm looking for here? Ah, enlightened. I think it would be fun to hear yours, and I'm sure you have plenty. I really enjoyed the best programmer jokes that appeared here earlier, so maybe this will bring a few smiles and lighten the load in a similar fashion. (I searched for something similar on SO, but didn't find anything.)

    Read the article

  • Stupid problem with Javascript calculations and postbacks

    - by rockinthesixstring
    I'm working on an ASP.NET web app where I'm using a Wizard to take the client through a large series of steps. One of the steps includes calculating a bunch of numbers on the fly... the numbers calculate properly but when I click "next" and then go back again... some of the numbers are not retained. Here is the calculation function function CalculateFields() { txtSellingPrice = document.getElementById('<%=txtSellingPrice.ClientID %>'); txtBalanceSheet = document.getElementById('<%=txtBalanceSheet.ClientID %>'); txtDownPayment = document.getElementById('<%=txtDownPayment.ClientID %>'); txtSusEarn = document.getElementById('<%=txtSusEarn.ClientID %>'); txtSusRev = document.getElementById('<%=txtSusRev.ClientID %>'); txtBalanceMult = document.getElementById('<%=txtBalanceMult.ClientID %>'); txtGoodwillMult = document.getElementById('<%=txtGoodwillMult.ClientID %>'); txtSellingPriceMult = document.getElementById('<%=txtSellingPriceMult.ClientID %>'); txtGoodWill = document.getElementById('<%=txtGoodWill.ClientID %>'); txtBalance = document.getElementById('<%=txtBalance.ClientID %>'); chkTakeBack = document.getElementById('<%=chkTakeBack.ClientID %>'); txtVendorTakeBackPercentage = document.getElementById('<%=txtVendorTakeBackPercentage.ClientID %>'); txtSusEarnPercentage = document.getElementById('<%=txtSusEarnPercentage.ClientID %>'); txtBalanceMultPercentage = document.getElementById('<%=txtBalanceMultPercentage.ClientID %>'); txtGoodwillMultPercentage = document.getElementById('<%=txtGoodwillMultPercentage.ClientID %>'); txtSellingPriceMultPercentage = document.getElementById('<%=txtSellingPriceMultPercentage.ClientID %>'); var regexp = /[$,]/g; //Empty value checks SellingPrice = (SellingPrice == "" ? "$0" : SellingPrice); BalanceSheet = (BalanceSheet == "" ? "$0" : BalanceSheet); DownPayment = (DownPayment == "" ? "$0" : DownPayment); susearn = (susearn == "" ? "$0" : susearn); susrev = (susrev == "" ? "$0" : susrev); balmult = (balmult == "" ? "$0" : balmult); goodmult = (goodmult == "" ? "$0" : goodmult); sellmult = (sellmult == "" ? "$0" : sellmult); //Replace $ with String.Empty SellingPrice = txtSellingPrice.value.replace(regexp, ""); BalanceSheet = txtBalanceSheet.value.replace(regexp, ""); DownPayment = txtDownPayment.value.replace(regexp, ""); susearn = txtSusEarn.value.replace(regexp, ""); susrev = txtSusRev.value.replace(regexp, ""); balmult = txtBalanceMult.value.replace(regexp, ""); goodmult = txtGoodwillMult.value.replace(regexp, ""); sellmult = txtSellingPriceMult.value.replace(regexp, ""); //Set the new values txtGoodWill.value = "$" + (SellingPrice - BalanceSheet); txtBalance.value = "$" + (SellingPrice - DownPayment); txtSellingPriceMult.value = "$" + SellingPrice; txtGoodwillMult.value = "$" + (SellingPrice - BalanceSheet); txtBalanceMult.value = "$" + BalanceSheet; if (chkTakeBack.checked == 1) { txtVendorTakeBackPercentage.value = Math.round((SellingPrice - DownPayment) / SellingPrice * 100); } else { txtVendorTakeBackPercentage.value = "0"; } if (!(susearn == "") && !(susearn == "0") && !(susearn == "$0")) { txtSusEarnPercentage.value = Math.round(susearn / susrev * 100); txtBalanceMultPercentage.value = Math.round(balmult / susearn); txtGoodwillMultPercentage.value = Math.round(goodmult / susearn); txtSellingPriceMultPercentage.value = Math.round(sellmult / susearn); } else { txtSusEarnPercentage.value = "0"; txtBalanceMultPercentage.value = "0"; txtGoodwillMultPercentage.value = "0"; txtSellingPriceMultPercentage.value = "0"; } } all of these calculate properly and retain their value across postbacks txtGoodWill.value = "$" + (SellingPrice - BalanceSheet); txtBalance.value = "$" + (SellingPrice - DownPayment); txtSellingPriceMult.value = "$" + SellingPrice; txtGoodwillMult.value = "$" + (SellingPrice - BalanceSheet); txtBalanceMult.value = "$" + BalanceSheet; These ones however do not retain their value across postbacks if (chkTakeBack.checked == 1) { txtVendorTakeBackPercentage.value = Math.round((SellingPrice - DownPayment) / SellingPrice * 100); } else { txtVendorTakeBackPercentage.value = "0"; } if (!(susearn == "") && !(susearn == "0") && !(susearn == "$0")) { txtSusEarnPercentage.value = Math.round(susearn / susrev * 100); txtBalanceMultPercentage.value = Math.round(balmult / susearn); txtGoodwillMultPercentage.value = Math.round(goodmult / susearn); txtSellingPriceMultPercentage.value = Math.round(sellmult / susearn); } else { txtSusEarnPercentage.value = "0"; txtBalanceMultPercentage.value = "0"; txtGoodwillMultPercentage.value = "0"; txtSellingPriceMultPercentage.value = "0"; } The txtVendorTakeBackPercentage always comes back BLANK and the other three always come back as 0 I'm firing these functions by using the onkeyup event within the form fields. If Not Page.IsPostBack Then txtSellingPrice.Attributes.Add("onkeyup", "CalculateFields()") txtBalanceSheet.Attributes.Add("onkeyup", "CalculateFields()") txtDownPayment.Attributes.Add("onkeyup", "CalculateFields()") txtSusRev.Attributes.Add("onkeyup", "CalculateFields()") txtSusEarn.Attributes.Add("onkeyup", "CalculateFields()") End If any thoughts/help/direction would be greatly appreciated.

    Read the article

  • Simple stupid foreach loop question

    - by user281180
    In the code below i`m trying to read a list of selected projects and a list of all projects available. I want to store the all the projects that have not been selected from the list of all projects. But with the code below, I`m having list of all projects...Where and how to break the second loop incase projectId.Value == selectedProjectId.Value ? public IEnumerable NotselectedProjects; public IEnumerable NotSelectedProjects() { if (this.NotselectedProjects == null) { List<SelectListItem> result = new List<SelectListItem>(); foreach (var selectedProjectId in selectedProjects) { foreach (var projectId in projectLists) { if (projectId.Value != selectedProjectId.Value) { result.Add(new SelectListItem { Selected = false, Text = projectId.Text, Value = projectId.Value }); this.NotselectedProjects = result.AsEnumerable(); } } } } return this.NotselectedProjects; }

    Read the article

  • Stupid newbie c++ two-dimensional array problem.

    - by paulson scott
    I've no idea if this is too newbie or generic for stackoverlflow. Apologies if that's the case, I don't intend to waste time. I've just started working through C++ Primer Plus and I've hit a little stump. This is probably super laughable but: for (int year = 0; year < YEARS; year++) { cout << "Year " << year + 1 << ":"; for (int month = 0; month < MONTHS; month++) { absoluteTotal = (yearlyTotal[year][year] += sales[year][month]); } cout << yearlyTotal[year][year] << endl; } cout << "The total number of books sold over a period of " << YEARS << " years is: " << absoluteTotal << endl; I wish to display the total of all 3 years. The rest of the code works fine: input is fine, individual yearly output is fine but I just can't get 3 years added together for one final total. I did have the total working at one point but I didn't have the individual totals working. I messed with it and reversed the situation. I've been messing with it for God knows how long. Any idea guys? Sorry if this isn't the place!

    Read the article

  • Stupid Facebook Connect question about customizing the share-button

    - by Geuis
    I really hate asking about anything retarded as Facebook Connect on SO, but their own development forums are horrendous. We're implementing a Facebook share button using this: <fb:share-button class="url" href="http://oursite.com/"></fb:shared-button> This is documented(poorly) here: http://wiki.developers.facebook.com/index.php/Fb:share-button I need to be able to change the text from "Share" to something else. I've spent 2 hours looking for an answer to this and have come up short. Thanks a lot for any help, and sorry for asking about something this retarded.

    Read the article

  • .htaccess stupid issue

    - by justnoone
    I have a server where I can only configure httpd using .htaccess, a cannot access global configuration. I want to rewrite almost every non-existing path to index.php, so I did something like: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?path=$1 [L,QSA] And that is ok. But another thing I want to do is to prevent access to path where I keep PHP files (I cannot store them somewhere else) which is for example /php. I would like that anything starting with /php rewrites to index.php?path=php... so I did something like: RewriteCond %{REQUEST_URI} ^/php.* RewriteRule ^(.*)$ /index.php?path=$1 [L,QSA] And that also would work ok if I had access to global configuration. In case of per-directory configuration, when I access /php it rewrites it to index.php?path=php and than puts directory name before that: /php/index.php?path=php. I read documentation and I realize that it uses internal redirects when per-directory confoguration is used. How can I avoid this behavior?

    Read the article

  • Stupid java question: Is it a method?

    - by Stefan
    Hello, I'm no Java guy, so I ask myself what this means: public Button(Light light) { this.light = light; } Is Button a method? I ask myself, because it takes an input parameter light. But if it was a method, why would it begin with a capital letter and has no return data type? Here comes the full example: public class Button { private Light light; public Button(Light light) { this.light = light; } public void press() { light.turnOn(); } } I know, this question is really trivial. However, I have nothing to do with Java and haven't found a description for the Button thing above. I'm just interested.

    Read the article

  • Some stupid warnings

    - by thetna
    I have a number of C source files(both .c and .h files). header files contains a number of functions. Out of those functions, only partially are used in a source .C file.Suppose a.h,b.h are header files and a.c and b.c are .c files. a.h is included in a.c. But only a number of functions those are in a. h are used and rest are not used. After compilation I find following warnings: function XXXX defined but not used. But those XXXX functions which are not used in a.c are used in b.c. So, i can't completely remove those functions too. So , i decided to make a separate file containing only those XXXX functions and included it wherever it is used.Doing this is creating multiple number of header files. Can anybody please suggest me to some effective way to solve this problem.

    Read the article

  • Is this plain stupid: GIT Sharing Via DropBox?

    - by yar
    I realize that there are similar questions, but my question is slightly different. I'm wondering whether sharing a bare repository via a synchronized DropBox folder on multiple computers would work for sharing code via GIT. Really what I want to know is: is sharing a GIT repo via DropBox (the repo gets updated on each person's local drive) the same as sharing it from one centralized location, e.g., via SSH, git or HTTP? Is this the same or different from sharing a GIT repo via a shared network drive? Note: This is not an empirical question: it seems to work fine. I'm asking whether the way a GIT repo is structured is compatible with this way of sharing. EDIT To clarify/repeat, I'm talking about keeping the GIT repository on DropBox as a bare repository. I'm not talking about keeping the actual files that are under source control in DropBox.

    Read the article

  • jquery stupid error

    - by user276640
    here is url http://mrhome.ru/Home/MenuPageContent/41?q=??&pid=39 if click search, it not work (quess it because of param q) but on url http://mrhome.ru/Home/main search is work what the problem?

    Read the article

  • WebMotion, le nouveau framework web libre en Java fondé sur le principe du « Keep It Simple and Stupid »

    WebMotion, le nouveau framework web libre en Java Fondé sur le principe « KISS » du « Keep It Simple, Stupid » WebMotion est un framework de développement d'application web qui repose sur une architecture REST et sur le standard Java EE 6. Ce framework propose 2 fonctionnalités principales: La première est d'assurer la couche présentation par le biais de pages (JSP, HTML, etc.). La seconde est d'exposer ...

    Read the article

  • I am one step closer to installing ubuntu, back is grayed out and I was stupid enough to not make a backup

    - by user283544
    Ok, so yeah, i've been stupid enough not to make a backup and 1 step closer to installing ubuntu. What I need is that is windows totally safe and not gonna be touched I made a new partition from windows, and in ubuntu installer I chose "Something else" Then I chose that partition as an ext4 and mount "/" Device for bootloader is my hard disk, /dev/sda/, that's what keeps me a little aware. So I need a quick answer is my windows 7 gonna be touched?

    Read the article

  • javascript question - onclick

    - by harry_T
    I am trying to get this code to work, but it keeps failing. try this link.. http://tinyurl.com/ye5khug enter Edmonton, click on icon, then on "web site". <script> function newPop(url, myWin, width, height, left, top, scrollbars) { parms = 'toolbar=yes, scrollbars=no, location=no, menubar=no, resizable=no, width= ' + width + ' , height=' + height + ' , left= ' + left + ' , top= ' + top + ' , titlebar=no , scrollbars = ' + scrollbars ; var newwin = window.open(url,myWin, parms); newwin.resizeTo(width,height); newwin.moveTo(0,0); newwin.moveTo(left,top); newwin.focus(); return false; } </script> <a onclick=" return newPop('http://google.com','window', '800','800','100','0','yes')" href="#">Web Site</a>

    Read the article

  • SQL SERVER – Quiz and Video – Introduction to SQL Server Security

    - by pinaldave
    This blog post is inspired from Beginning SQL Joes 2 Pros: The SQL Hands-On Guide for Beginners – SQL Exam Prep Series 70-433 – Volume 1. [Amazon] | [Flipkart] | [Kindle] | [IndiaPlaza] This is follow up blog post of my earlier blog post on the same subject - SQL SERVER – Introduction to SQL Server Security – A Primer. In the article we discussed various basics terminology of the security. The article further covers following important concepts of security. Granting Permissions Denying Permissions Revoking Permissions Above three are the most important concepts related to security and SQL Server.  There are many more things one has to learn but without beginners fundamentals one can’t learn the advanced  concepts. Let us have small quiz and check how many of you get the fundamentals right. Quiz 1) If you granted Phil control to the server, but denied his ability to create databases, what would his effective permissions be? Phil can do everything. Phil can do nothing. Phil can do everything except create databases. 2) If you granted Phil control to the server and revoked his ability to create databases, what would his effective permissions be? Phil can do everything. Phil can do nothing. Phil can do everything except create databases. 3) You have a login named James who has Control Server permission. You want to elimintate his ability to create databases without affecting any other permissions. What SQL statement would you use? ALTER LOGIN James DISABLE DROP LOGIN James DENY CREATE DATABASE To James REVOKE CREATE DATABASE To James GRANT CREATE DATABASE To James Now make sure that you write down all the answers on the piece of paper. Watch following video and read earlier article over here. If you want to change the answer you still have chance. Solution 1) 3 2) 1 3) 3 Now compare let us check the answers and compare your answers to following answers. I am very confident you will get them correct. Available at USA: Amazon India: Flipkart | IndiaPlaza Volume: 1, 2, 3, 4, 5 Please leave your feedback in the comment area for the quiz and video. Did you know all the answers of the quiz? Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: Joes 2 Pros, PostADay, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • Silverlight Cream for March 05, 2010 -- #807

    - by Dave Campbell
    In this Issue: Phil Middlemiss(-2-, -3-), Pencho Popadiyn, John Papa(-2-, -3-), Jim Lynn, and SilverLaw(-2-). Shoutouts: Walt Ritscher has added more shaders and features: Shazzam 1.2 – Feature Overview I hope you're getting as excited as I am about MIX10. You should be reading MIX10 News and checking out the sessions and the directory of attendees. From SilverlightCream.com: Watermarked TextBox Part I Phil Middlemiss's Orb Radio Button hit number two in the Silverlight Cream Skim page, in 2 days... now Phil has a very nice 3-part tutorial up on creating a Watermarked TextBox with lots of cool features. This is part 1 and starts the series off. Watermarked TextBox Part II In Phil Middlemiss's Part II of the Watermarked TextBox tutorial, he's concentrating on visual elements of the control began in the last episode... you're paying attention, right? ... this is a cool control :) Watermarked Textbox Part III In the final part of Phil Middlemiss's tutorial series, he's wiring all the pieces together in the UserControl. Go grab the control, then leave Phil some love on his blog! Using Reactive Extensions in Silverlight Pencho Popadiyn has a great tutorial up on SilverlightShow about Rx ... if you want to get your arms around this... this tutorial is a good place to begin. Silverlight TV 10: Silverlight Hyper Video Platform with Jesse Liberty Running a little behind here, but check out John Papa and THE Silverlight GeekTM Jesse Liberty discussing Jesse's Hyper Video Platform on Silverlight TV Silverlight TV 11: Dynamically Loading XAPs with MEF In Silverlight TV episode 11, John Papa talks to Glenn Block about MEF and partitioning and dynamically loading XAPs ... good stuff. Silverlight TV 12: The Best Blend 3 Video Ever! And the latest Silverlight TV episode, number 12, has John Papa and Adam Kinney giving "The Best Blend 3 Video ever (or at least on Silverlight TV)"... check out the list of topics and you'll want to watch :) InvalidOperation_EnumFailedVersion when binding data to a Silverlight Chart Read Jim Lynn's post about a problem found while deploying his app, the very confusing (long) error, and the workaround. Leather Stamped Style Series For Silverlight Controls - Part 1 SilverLaw contued after his 'leather stamped' textbox and has added TextBlock, Button and some template bindings... check it out then get it at the Expression Gallery Circular Accordion Style Silverlight 3 SilverLaw also built a Circualar Accordian style... interesting idea and once again it, in the Expression Gallery. He's also looking for feedback. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    MIX10

    Read the article

  • I do not write tests. Am I stupid?

    - by Josh Stodola
    I've done a little bit of reading on unit testing and TDD, and I've never seriously considered writing tests to such a precise extent. Granted, I am not working on any projects that are ridiculously huge. If all I build are small apps, am I stupid for not writing tests? Edit: To clarify, when I say "small apps", I mean apps that are not going to control a persons life and/or their belongings. I generally build things that are supposed to make peoples lives easier and to make them more efficient.

    Read the article

  • What is the most stupid coded solution you have read/improved/witnessed?

    - by Rigo Vides
    And for stupid I mean Illogical, non-effective, complex(the bad way), ugly code style. I will start: We had a requirement there when we needed to hide certain objects given the press of a button. So this framework we were using at the time provided a way to tag objects and retrieve all the objects with a certain tag in a complete iterable collection. So I presented the most logically solution given these conditions to my partner: Me: you know, tag all the objects we needed to hide with the same tag, then call the function to get them all, iterate trough them and make them hidden. Partner: I don't know, that is hardcoding for me... Me: So what do you suggest? 20 mins later... Partner: I don't know... let's put a tag to all the objects to be hidden like this, 1, 2, 3, 4, 5, 6, 7 (and so for each object to be hidden), Then we make a for from 1 to n (where n was the number of objects to hide) and we hide them all there!

    Read the article

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