Search Results

Search found 15316 results on 613 pages for 'coding style'.

Page 71/613 | < Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >

  • How to modify style for an asp:textbox in codebehind ?

    - by Fahad
    Hi all, I am trying to set the style of an asp:TextBox in codebehind, the textbox is style is set initially to style="display:none" when I set the dispaly to block in codebehind the textbox appears for a moment and then it's gone. I don't know what this problem is, when it's done in javascript it works fine Here is the code: asp.net code: <asp:TextBox ID="txtError" style="display:none" runat="server" ReadOnly="True" Width="95%"></asp:TextBox> codebehind: txtError.Style["display"] = "block"; Am I doing anything wrong? Thanks in advance.

    Read the article

  • Addind the sum of numbers using a loop statement

    - by Deonna
    I need serious help diving the positive numbers and the negative numbers. I am to accumulate the total of the negative values and separately accumulate the total of the positive values. After the loop, you are then to display the sum of the negative values and the sum of the positive values. The data is suppose to look like this: -2.3 -1.9 -1.5 -1.1 -0.7 -0.3 0.1 0.5 0.9 1.3 1.7 2.1 2.5 2.9 Sum of negative values: -7.8 Sum of positive values: 12 So far I have this: int main () { int num, num2, num3, num4, num5, sum, count, sum1; int tempVariable = 0; int numCount = 100; int newlineCount = 0, newlineCount1 = 0; float numCount1 = -2.3; while (numCount <= 150) { cout << numCount << " "; numCount += 2; newlineCount ++; if(newlineCount == 6) { cout<< " " << endl; newlineCount = 0; } } **cout << "" << endl; while (numCount1 <=2.9 ) { cout << numCount1 << " "; numCount1 += 0.4; newlineCount1 ++; } while ( newlineCount1 <= 0 && newlineCount >= -2.3 ); cout << "The sum is " << newlineCount1 << endl;** return 0; }

    Read the article

  • The "is" in JUnit 4 assertions

    - by Space_C0wb0y
    Is there any semantic difference between writing assertThat(object1, is(equalTo(object2))); and writing assertThat(object1, equalTo(object2))); ? If not, I would prefer the first version, because it reads better. Are there any other considerations here?

    Read the article

  • Cocoa Key Value Bindings: What are the explanations of the various options for Controller Key?

    - by Elisabeth
    When I bind a control to an NSArrayController using Interface Builder, there are a variety of options under the "Controller Key" field in the bindings inspector. I understand what "arrangedObjects" is, and I semi-understand what "selection" is, but I'd love to see a really nice explanation of all the options and when to use each one. The list includes: selectionIndexes, selectionIndex, selectedObject, sortDescriptors, etc. I haven't been able to find a good explanation of these options. I'm having trouble with a button that's bound to target selection, so I'm hoping a much deeper understanding of these Controller Keys might help me debug my issue. Thanks!!!

    Read the article

  • Pythonic reading from config files

    - by Adam Matan
    Hi, I have a python class which reads a config file using ConfigParser: Config file: [geography] Xmin=6.6 Xmax=18.6 Ymin=36.6 YMax=47.1 Python code: class Slicer: def __init__(self, config_file_name): config = ConfigParser.ConfigParser() config.read(config_file_name) # Rad the lines from the file self.x_min = config.getfloat('geography', 'xmin') self.x_max = config.getfloat('geography', 'xmax') self.y_min = config.getfloat('geography', 'ymin') self.y_max = config.getfloat('geography', 'ymax') I feel that the last four lines are repetitive, and should somehow be compressed to one Pythonic line that would create a self.item variable for each item in the section. Any ideas? Adam

    Read the article

  • Methods for Lazy Initialization with properties

    - by Stuart Pegg
    I'm currently altering a widely used class to move as much of the expensive initialization from the class constructor into Lazy Initialized properties. Below is an example (in c#): Before: public class ClassA { public readonly ClassB B; public void ClassA() { B = new ClassB(); } } After: public class ClassA { private ClassB _b; public ClassB B { get { if (_b == null) { _b = new ClassB(); } return _b; } } } There are a fair few more of these properties in the class I'm altering, and some are not used in certain contexts (hence the Laziness), but if they are used they're likely to be called repeatedly. Unfortunately, the properties are often also used inside the class. This means there is a potential for the private variable (_b) to be used directly by a method without it being initialized. Is there a way to make only the public property (B) available inside the class, or even an alternative method with the same initialized-when-needed? This is reposted from Programmers (not subjective enough apparently): http://programmers.stackexchange.com/questions/34270/best-methods-for-lazy-initialization-with-properties

    Read the article

  • Java: repetition, overuse -- problem?

    - by HH
    I try to be as minimalist as possible. Repetition is a problem. I hate it. When is it really a problem? what is static-overuse? what is field-method overuse? what is class-overuse? are there more types of overuse? Problem A: when it is too much to use of static? private static class Data { private static String fileContent; private static SizeSequence lineMap; private static File fileThing; private static char type; private static boolean binary; private static String name; private static String path; } private static class Print { //<1st LINE, LEFT_SIDE, 2nd LINE, RIGHT_SIDE> private Integer[] printPositions=new Integer[4]; private static String fingerPrint; private static String formatPrint; } Problem B: when it is too much to get field data with private methods? public Stack<Integer> getPositions(){return positions;} public Integer[] getPrintPositions(){return printPositions;} private Stack<String> getPrintViews(){return printViews;} private Stack<String> getPrintViewsPerFile(){return printViewsPerFile;} public String getPrintView(){return printView;} public String getFingerPrint(){return fingerPrint;} public String getFormatPrint(){return formatPrint;} public String getFileContent(){return fileContent;} public SizeSequence getLineMap(){return lineMap;} public File getFile(){return fileThing;} public boolean getBinary(){return binary;} public char getType(){return type;} public String getPath(){return path;} public FileObject getData(){return fObj;} public String getSearchTerm(){return searchTerm;} Related interface overuse overuse of static in a Game

    Read the article

  • not able to get cscope working with vim

    - by hiren panchasara
    Hi all, I am trying to setup cscope to work with vim, following http://cscope.sourceforge.net/cscope_vim_tutorial.html. When I get into a C file, I am not able to do what is described in bullet 5 of the link. Do I need to setup ctags? Is there something not mentioned here on the page that I should be doing? Thanks in advance.

    Read the article

  • Am I immoral for using a variable name that differs from its type only by case?

    - by Jason Baker
    For instance, take this piece of code: var person = new Person(); or for you Pythonistas: person = Person() I'm told constantly how bad this is, but have yet to see an example of the immorality of these two lines of code. To me, person is a Person and trying to give it another name is a waste of time. I suppose in the days before syntax highlighting, this would have been a big deal. But these days, it's pretty easy to tell a type name apart from a variable name. Heck, it's even easy to see the difference here on SO. Or is there something I'm missing? If so, it would be helpful if you could provide an example of code that causes problems.

    Read the article

  • PHP Line Indentation

    - by Tower
    Hi, I'm curious to know, how many spaces of indentation do you prefer in PHP code? function one() { $one; function space() { $space; } } function two() { $two; function spaces() { $spaces; } } function three() { $three; function spaces() { $spaces; } } function four() { $four; function spaces() { $spaces; } } Let's not make multiple answers for same identation, but use the +1 for answers that fit your preferences.

    Read the article

  • Looking for a good WTF story involving SSL

    - by lindelof
    I'm preparing a talk on SSL to our local Java user group, and I would like to introduce it with some story on how NOT to use it. I've searched through the DailyWTF archives but couldn't find anything really good. Do you know such a story, or do you have some pointers where I could go looking for one?

    Read the article

  • IDisposable: is it necessary to check for null on finally {}?

    - by BlackTigerX
    In most examples that you find on the web when explicitly not using "using", the pattern looks something like: SqlConnection c = new SqlConnection(@"..."); try { c.Open(); ... } finally { if (c != null) //<== check for null c.Dispose(); } If you do use "using" and look at the generated IL code, you can see that it generates the check for null L_0024: ldloc.1 L_0025: ldnull L_0026: ceq L_0028: stloc.s CS$4$0000 L_002a: ldloc.s CS$4$0000 L_002c: brtrue.s L_0035 L_002e: ldloc.1 L_002f: callvirt instance void [mscorlib]System.IDisposable::Dispose() L_0034: nop L_0035: endfinally I understand why the IL gets translated to check for null (doesn't know what you did inside the using block), but if you're using try..finally and you have full control of how the IDisposable object gets used inside the try..finally block, do you really need to check for null? if so, why?

    Read the article

  • Why is it assumed that send may return with less than requested data transmitted on a blocking socke

    - by Ernelli
    The standard method to send data on a stream socket has always been to call send with a chunk of data to write, check the return value to see if all data was sent and then keep calling send again until the whole message has been accepted. For example this is a simple example of a common scheme: int send_all(int sock, unsigned char *buffer, int len) { int nsent; while(len 0) { nsent = send(sock, buffer, len, 0); if(nsent == -1) // error return -1; buffer += nsent; len -= nsent; } return 0; // ok, all data sent } Even the BSD manpage mentions that ...If no messages space is available at the socket to hold the message to be transmitted, then send() normally blocks... Which indicates that we should assume that send may return without sending all data. Now I find this rather broken but even W. Richard Stevens assumes this in his standard reference book about network programming, not in the beginning chapters, but the more advanced examples uses his own writen (write all data) function instead of calling write. Now I consider this still to be more or less broken, since if send is not able to transmit all data or accept the data in the underlying buffer and the socket is blocking, then send should block and return when the whole send request has been accepted. I mean, in the code example above, what will happen if send returns with less data sent is that it will be called right again with a new request. What has changed since last call? At max a few hundred CPU cycles have passed so the buffer is still full. If send now accepts the data why could'nt it accept it before? Otherwise we will end upp with an inefficient loop where we are trying to send data on a socket that cannot accept data and keep trying, or else? So it seems like the workaround, if needed, results in heavily inefficient code and in those circumstances blocking sockets should be avoided at all an non blocking sockets together with select should be used instead.

    Read the article

  • Java operator overloading

    - by nimcap
    Not using operators makes my code obscure. (aNumber / aNother) * count is better than aNumber.divideBy(aNother).times(count) After 6 months of not writing a single comment I had to write a comment to the simple operation above. Usually I refactor until I don't need comment. And this made me realize that it is easier to read and perceive math symbols and numbers than their written forms. For example TWENTY_THOUSAND_THIRTEEN.plus(FORTY_TWO.times(TWO_HUNDERED_SIXTY_ONE)) is more obscure than 20013 + 42*261 So do you know a way to get rid of obscurity while not using operator overloading in Java? Update: I did not think my exaggeration on comments would cause such trouble to me. I am admitting that I needed to write comment a couple of times in 6 months. But not more than 10 lines in total. Sorry for that. Update 2: Another example: budget.plus(bonusCoefficient.times(points)) is more obscure than budget + bonusCoefficient * points I have to stop and think on the first one, at first sight it looks like clutter of words, on the other hand, I get the meaning at first look for the second one, it is very clear and neat. I know this cannot be achieved in Java but I wanted to hear some ideas about my alternatives.

    Read the article

  • Winforms: calling entry form function from a different class

    - by samy
    I'm kinda new to programming and got a question on what is a good practice. I created a class that represents a ball and it has a function Jump() that use 2 timers and get the ball up and down. I know that in Winforms you got to call Invalidate() every time you want to repaint the screen, or part of it. I didn't find a good way to do that, so I reference the form in my class, and called Invalidate() inside my ball class every time I need to repaint to ball movement. (this works but I got a feeling that this is not a good practice) Here is the class I created: public class Ball { public Form1 parent;//----> here is the reference to the form public Rectangle ball; Size size; public Point p; Timer timerBallGoUp = new Timer(); Timer timerBallGDown = new Timer(); public int ballY; public Ball(Size _size, Point _p) { size = _size; p = _p; ball = new Rectangle(p, size); } public void Jump() { ballY = p.Y; timerBallGDown.Elapsed += ballGoDown; timerBallGDown.Interval = 50; timerBallGoUp.Elapsed += ballGoUp; timerBallGoUp.Interval = 50; timerBallGoUp.Start(); } private void ballGoUp(object obj,ElapsedEventArgs e) { p.Y++; ball.Location = new Point(ball.Location.X, p.Y); if (p.Y >= ballY + 50) { timerBallGoUp.Stop(); timerBallGDown.Start(); } parent.Invalidate(); // here i call parent.Invalidate() 1 } private void ballGoDown(object obj, ElapsedEventArgs e) { p.Y--; ball.Location = new Point(ball.Location.X, p.Y); if (p.Y <= ballY) { timerBallGDown.Stop(); timerBallGoUp.Start(); } parent.Invalidate(); // here i call parent.Invalidate() 2 } } I'm wondring if there is a better way to do that? (sorry for my english)

    Read the article

  • Why use semicolon?

    - by Art
    Are there any reasons, apart from subjective visual perception and cases where you have multiple statements on the same line, to use semicolon at the end of statements in Javascript?

    Read the article

  • How can I enable Vista/Win 7 theming/style for a ToolTip control?

    - by Joakim Hårsman
    In Windows Vista and Windows 7, ToolTips have a new visual style or theme, they are shiny grey metallic. How can I enable the new style for a ToolTip control? Some controls, like ListViews and ToolBars, use the new tooltips automatically, but other tooltips are rendered with the old yellow XP style. I've tried sending an TTM_SETWINDOWTHEME message but nothing happens and I'm not sure what string I am supposed to use for the visual style name. SetWindowTheme doesn't work either, I've used it successfully on ListViews and TreeViews to set the "Explorer" style (see http://www.danielmoth.com/Blog/TreeViewVista.aspx), but that doesn't seem to work on ToolTips. I'm using the plain win32 C API.

    Read the article

  • PHP beautifiers (libraries for formatting code)

    - by takeshin
    Previously, my intention was to ask: Do you know any open source SQL formatter/beautifier library for PHP projects? But I think, I'd better ask: Which code formatting libraries written in PHP are the best? Let's list them all in one place. My types: for CSS syntax: Css Tidy for PHP: PEAR's PHP_Beautifier for HTML syntax: Tidy

    Read the article

  • Styling a result set

    - by aepheus
    Perhaps this is not the proper place to ask this question, if that is the case, please direct me to the correct venue. I'm looking for research, guides, any kind of information pertaining to the structuring and styling of results sets; data which comes back from a search, or when looking at content in a list view. Links would be appreciated, but opinion and commentary are also valued.

    Read the article

  • Revision histories and documenting changes

    - by jasonline
    I work on legacy systems and I used to see revision history of files or functions being modified every release in the source code, for example: // // Rev. No Date Author Description // ------------------------------------------------------- // 1.0 2009/12/01 johnc <Some description> // 1.1 2009/12/24 daveb <Some description> // ------------------------------------------------------- void Logger::initialize() { // a = b; // Old code, just commented and not deleted a = b + c; // New code } I'm just wondering if this way of documenting history is still being practiced by many today? If yes, how do you apply modifications on the source code - do you comment it or delete it completely? If not, what's the best way to document these revisions? If you use version control systems, does it follow that your source files contain pure source codes, except for comments when necessary (no revision history for each function, etc.)?

    Read the article

  • CSS button not styling

    - by o-logn
    Hey, I must be missing something obvious, but can someone explain what I'm doing wrong with my CSS? I would like all buttons to have a certain format, except a few. I was expecting to use CssClass in order to override the few that should be different, but they all seem to use the standard one. My CSS: .btn { border:none; background-color:red; } input[type="submit"] { border: 2px solid black; background-color:green; } All the buttons take the second value (green background, with a border). However, I have this button: <asp:Button ID="btnAdd" CssClass="btn" runat="server" Text="Add" /> I was expecting this to have no border, and a red background, but it's the same as every other button. Any ideas what I'm doing wrong? Thanks

    Read the article

< Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >