Daily Archives

Articles indexed Monday May 31 2010

Page 7/98 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • "Invalid assignment" error from == operator

    - by Tom
    I was trying to write a simple method: boolean validate(MyObject o) { // propertyA && propertyB are not primitive types. return o.getPropertyA() == null && o.getPropertyB() == null; } And got a strange error on the == null part: Syntax error on token ==. Invalid assignment operator. Maybe my Java is rusty after a season in PLSQL. So I tried a simpler example: Integer i = 4; i == null; // compile error: Syntax error on token ==. Invalid assignment operator. Integer i2 = 4; if (i == null); //No problem How can this be? I'm using jdk160_05. To clarify: I'm not trying to assign anything, just do an && operation between two boolean values. I don't want to do this: if (o.propertyA() == null && o.propertyB() == null) { return true; } else { return false; }

    Read the article

  • how to show the right word in my code, my code is : os.urandom(64)

    - by zjm1126
    My code is: print os.urandom(64) which outputs: > "D:\Python25\pythonw.exe" "D:\zjm_code\a.py" \xd0\xc8=<\xdbD' \xdf\xf0\xb3>\xfc\xf2\x99\x93 =S\xb2\xcd'\xdbD\x8d\xd0\\xbc{&YkD[\xdd\x8b\xbd\x82\x9e\xad\xd5\x90\x90\xdcD9\xbf9.\xeb\x9b>\xef#n\x84 which isn't readable, so I tried this: print os.urandom(64).decode("utf-8") but then I get: > "D:\Python25\pythonw.exe" "D:\zjm_code\a.py" Traceback (most recent call last): File "D:\zjm_code\a.py", line 17, in <module> print os.urandom(64).decode("utf-8") File "D:\Python25\lib\encodings\utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode bytes in position 0-3: invalid data What should I do to get human-readable output?

    Read the article

  • Coding for fun

    - by Klelky
    I would describe myself as a career coder - i.e. a developer at work but never really coded for fun. Early in my career I've hit the management track though. I really like my current job and can't see me going back to coding anytime soon so: Whats the best way to develop my coding skills and learn new languages in my spare time?

    Read the article

  • How set panel Default Button that is inside a details view in asp.net?

    - by Avinash
    <asp:panel ID="Panel1" runat="server"> <asp:DetailsView ID="DetailsView1" .... <asp:templatefield ShowHeader="False"> <insertitemtemplate> <asp:Button ID="btnAdd" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert"></asp:Button> ... <asp:DetailsView> </asp:panel> and i write the code for setting the panels default button in details view's DataBound event Button btnAdd = new Button(); btnAdd = DetailsView1.Rows[indexNumber].FindControl("btnAdd") as Button; Panel1.DefaultButton = btnAdd.UniqueID; but I get the error : The DefaultButton of 'Panel1' must be the ID of a control of type IButtonControl.

    Read the article

  • How can I create a canned reply with the CKEditor toolbar?

    - by Tur0k
    Hello, Is it possible to create configurable quick replies within an html page using cookies or session tracking with Javascript/php and the CKEditor toolbar. Do I have to create a custom plugin or button for this? Example: button1 -Good job 2 1/2 points. Close ticket. button2 -Great job 5 points. Close ticket. button3 -Awesome job 10 points. Close ticket. Any advise would be awesome! Thanks.

    Read the article

  • .NET Lambda Pass Method Parameter

    - by RM
    Hi All, I hope i'm missing something obvious, but I'm having some troubles defining a method that takes a parameter of a method to fetch the method information for the passed method. I do NOT want actually execute the method. I want to be able to do: busObject.SetResolverMethod<ISomeInterface>(x=>x.GetNameById); Where GetNameById is a method defined on the interface ISomeInterface. In this case, an example of the method being passed in's signature would be: MyVarA GetNameById(int id){ .... } In the above example, the SetResolverMethod's body should be able to return / store the string "GetNameById". There is no standard signature the method being passed in will conform to (except that it will always return an object of some kind). Currently I'm setting the method as a string (i.e. "GetNameById"), but I want it to be compile time checked, hence this question.

    Read the article

  • Develop Print Driver

    - by Otávio Décio
    I need to develop a print driver to print from any application into a TIFF file. Does someone know of resources or a good SDK vendor that would enable me to do that? Environment is Windows, any language.

    Read the article

  • DotnetNuke redirect

    - by X-Dev
    our client needs to shortcuts to particular pages We need to redirect non existent urls like http://site.com/promotion1 to the actual URL similar to http://site.com/promotions/promotion1/tabid/799/language/en-AU/Default.aspx ... I've sent a list of appropriate DNN modules to our client but it may take them forever to get back to me. In the mean time they still submitting requests to us to create redirects for them. if there's no cost involved then i wont have to wait for them to get back to me. so I'm looking for a Quick and free way to enable the clients to set these up on this own. I've looked at: http://www.snowcovered.com/snowcovered2/Default.aspx?tabid=242&PackageID=3302 http://www.ventrian.com/Resources/Projects/FriendlyUrls.aspx http://www.codeproject.com/kb/aspnet/dnn2url_rewrite.aspx But haven't had much luck in the small amount of time i have available. Has anyone got some suggestions on how to achieve our goal with either the above resources or maybe some additional resource i haven't found yet? (DNN v4.9)

    Read the article

  • How much trust can I put behind a computer system? How can I measure trust?

    - by danmine
    How much trust can I put in a standard computer running windows? To what certainty can I be sure it will run my code the way I wrote it? How can I be sure that if I declare something like "int j = 5;", j will alway be 5? Is there a way to measure trust in a standard x86 computer system? What kind of protections are there to make sure that j = 5? I'm thinking about critical systems where nothing can be off even by one bit and everything must run exactly the way it was written to run.

    Read the article

  • Colors in Instruments when hunting down memory leaks

    - by Structurer
    Hi I'm currently hunting down a memory leak in my app for iPhone. I'm using Instruments to track down the code that is causing the leak (becoming more and more a friend of Instruments!). Now Instruments show two lines: one in dark blue (row 146) and one in a lighter blue (150). From some trial and error I get that they are connected somehow, but not good enough at Objective-C and Memory Management yet to really understand how. Does anyone know why different colors are used and what could be my problem? I have tried to release numberForArray but the the app crashes when showing the last line in a picker view. All ideas appreciated! (Posting this I also realize that line 139 is redundant! Se there, already an improvement ;-)

    Read the article

  • Do you ever make a code change and just test rather than trying to fully understand the change you'v

    - by Clay Nichols
    I'm working in a 12 year old code base which I have been the only developer on. There are times that I'll make a a very small change based on an intuition (or quantum leap in logic ;-). Usually I try to deconstruct that change and make sure I read thoroughly the code. However sometimes, (more and more these days) I just test and make sure it had the effect I wanted. (I'm a pretty thorough tester and would test even if I read the code). This works for me and we have surprisingly (compared to most software I see) few bugs escape into the wild. But what I'm wondering is whether this is just the "art" side of coding. Yes, in an ideal world you would exhaustively read every bit of code that your change modified, but I in practice, if you're confident that it only affects a small section of code, is this a common practice? I can obviously see where this would be a disastrous approach in the hands of a poor programmer. But then, I've seen programmers who ostensibly are reading the code and break stuff left and right (in their own code based which only they have been working on).

    Read the article

  • What is it about DataTable Column Names with dots that makes them unsuitable for WPF's DataGrid cont

    - by Tom Ritter
    Run this, and be confused: <Window x:Class="Fucking_Data_Grids.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <StackPanel> <DataGrid Name="r1" ItemsSource="{Binding Path=.}"> </DataGrid> <DataGrid Name="r2" ItemsSource="{Binding Path=.}"> </DataGrid> </StackPanel> </Window> Codebehind: using System.Data; using System.Windows; namespace Fucking_Data_Grids { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); DataTable dt1, dt2; dt1 = new DataTable(); dt2 = new DataTable(); dt1.Columns.Add("a-name", typeof(string)); dt1.Columns.Add("b-name", typeof(string)); dt1.Rows.Add(new object[] { 1, "Hi" }); dt1.Rows.Add(new object[] { 2, "Hi" }); dt1.Rows.Add(new object[] { 3, "Hi" }); dt1.Rows.Add(new object[] { 4, "Hi" }); dt1.Rows.Add(new object[] { 5, "Hi" }); dt1.Rows.Add(new object[] { 6, "Hi" }); dt1.Rows.Add(new object[] { 7, "Hi" }); dt2.Columns.Add("a.name", typeof(string)); dt2.Columns.Add("b.name", typeof(string)); dt2.Rows.Add(new object[] { 1, "Hi" }); dt2.Rows.Add(new object[] { 2, "Hi" }); dt2.Rows.Add(new object[] { 3, "Hi" }); dt2.Rows.Add(new object[] { 4, "Hi" }); dt2.Rows.Add(new object[] { 5, "Hi" }); dt2.Rows.Add(new object[] { 6, "Hi" }); dt2.Rows.Add(new object[] { 7, "Hi" }); r1.DataContext = dt1; r2.DataContext = dt2; } } } I'll tell you what happens. The top datagrid is populated with column headers and data. The bottom datagrid has column headers but all the rows are blank.

    Read the article

  • Where does "foo" come from in coding examples? [closed]

    - by ThePower
    Possible Duplicates: Using “Foo” and “Bar” in examples To foo bar, or not to foo bar: that is the question. Possible Duplicates: Using "Foo" and "Bar" in examples To foo bar, or not to foo bar: that is the question. Bit of a general question here, but it's something I would like to know! Whenever I am looking for resolutions to my C# problems online, I always come across "foo" being used as an example. Does this represent anything or is it just one of those unexplained catchy object names, used by many people in examples?

    Read the article

  • selecting href not starting with http

    - by sushil bharwani
    using jQuery i am trying to find out all the URLS that user has entered which are not starting with http or https and finally i want to prepend http to all such URLs so that when user clicks on them they are taken to a proper site instead of broken link caused due to entry of URLs without http or https. Also like to mention that User have a field "Websites they Like" where they enter websites of their interest. So if they like stackoverflow, they may end up writing www.stackoverflow.com which will be considered a relative link without http. Also my requirments are such that i cant prompt user to enter http or https before there urls

    Read the article

  • How to reference another project in Eclipse with Google appengine project?

    - by virsir
    I am trying to extract some common classes out to be a common jar, and I want to reference it by the appengine project in Eclipse. It compiles well but could not run. The console just told that some classes from the common jar project could not be found. I know I can just export the project into a jar, but I may want to change it sometimes, so I prefer keep it dynamic. And I know maven may be an option but there is no official maven support for appengine, and I will not try to learn it. Then how can I make it work?

    Read the article

  • How can I display locally stored images on an internet website?

    - by ropstah
    Hi, i would like to display images on my website that are stored on a visitors local filesystem. Assuming I have the location of the image on the visitors drive (e.g. c:\Documents And Settings\Ropstah\image.png), is it then possible for me to display this image in my internet website (e.g. www.website.com)? The images won't seem to load when i use the following syntax (Internet Explorer 7, Firefox 3 etc..): <img src="file://c:\Documents and Settings\Ropstah\image.png" /> The images DO display if the .html file (which i use on website.com/index.html) is located on my local pc...

    Read the article

  • Why doesn't WebBBS work now that I've migrated to a new server?

    - by Roy Peleg
    Hello, I've moved a WebBBS board from one server to another. Ever since the board doesn't work. I'm getting an Apache error whenever I try to access the board. Don't even know where to start the debugging, I'm not a Perl person. The file paths remained the same and there isn't any DB involved. http://gammonline.com/members/board/ Any ideas? After a bit of testing I believe that the problem has something to do with the index.cgi which is located in that folder (not getting the error when renaming it). Thanks, Roy.

    Read the article

  • Convert ieee 754 float to hex with c - printf

    - by Michael
    Ideally the following code would take a float in IEEE 754 representation and convert it into hexadecimal void convert() //gets the float input from user and turns it into hexadecimal { float f; printf("Enter float: "); scanf("%f", &f); printf("hex is %x", f); } I'm not too sure what's going wrong. It's converting the number into a hexadecimal number, but a very wrong one. 123.1443 gives 40000000 43.3 gives 60000000 8 gives 0 so it's doing something, I'm just not too sure what. Help would be appreciated

    Read the article

  • Alternative to Page_Load in ASP.NET (and a good WTF story)

    - by Jason
    Woo, I have a doozy of a problem (might even be one for the Daily WTF) and I'm hoping there's a solution. (My apologies for the long post...) I have been working on a website that I inherited about a month ago. One of the parts I have been working on is fixing one of the controls (essentially a dynamic header bar) so that it displays additional information as requested by my users. As part of doing this project, I created a Site.master file so that I wouldn't have to recode the header bar into every single page. When I first started doing this, it seemingly worked very well. All the pages I had developed looked great and the bar updated as it should displaying the information as it should. Well, when I dropped the Site.master (and this control) into older site pages (ones I did not specifically develop) I noticed that it looked bad on some of them, but not all of them. When I say it looked bad, basically, the control would left-align itself to the page rather than center as it should. I spent a couple hours debugging to no avail - CSS looked correct, the HTML appeared to be okay, I didn't see anything in the Javascript (although, I did miss something as I'll point out in a second), and even the old code looked correct (to the best that it could - it's not very well written). Another coworker took a look at the site and couldn't find anything at first, either. It wasn't until I just thought to look at the rendered source code of the page (I had been working in the developer view up to this point in IE8) that it became clear what was wrong. The original developer performs searches on many of the pages. To accomplish this, he queries the database for ALL the data and then loads them into Javascript arrays within the page so he can get access to them. This in itself is a huge problem because we're talking about thousands of items, and it obviously isn't scalable (and, yes, the site is slow). However, it finally clicked what was screwing up the Site.master - when he loads the data into the Javascript arrays, he writes out the data to the HTML upon Page_Load using numerous Response.Write(string) calls. The WTF (and what was messing me up) is that he inserts the Javascript before the DOCTYPE causing IE to go into quirks mode! So, because I need to at least get this release out (I'll fix the real problem later), I was wondering: is there a way I can force this Javascript to be inserted elsewhere into the HTML—after the DOCTYPE at the very least? Right now, all the Response.Write() calls are being done in the Page_Load method. I just need them to be inserted later.

    Read the article

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