Search Results

Search found 8 results on 1 pages for 'ernelli'.

Page 1/1 | 1 

  • Have you changed your coding style recently? It wasn't hard wasn't it?

    - by Ernelli
    I've used to write code in C-like languages using the Allman style, regarding the position of braces. void foo(int bar) { if(bar) { //... } else return; //... } Now the last two years I have been working mostly in JavaScript and when we adopted jslint as part of our QA process, I had to adopt to the Crockford way of doing things. So I had to change the coding style into: function foo(bar) { if (bar) { //... } else { return; } //... } Now apart from comparing a C/C++ example with JavaScript, I must say that my JavaScript-Crockford-coding style now has spread into my C/C++/Java coding when I revise old projects and work on code in those languages that for example has no problem with single line statements or ambiguous newline insertion. I used to consider the later format very awkward, I have never had any problems with adapting my coding style to the one chosen by my predecessors, except for when I was a Junior developer mostly being the solve developer on legacy projects and the first thing I did was to change the indenting style. But now after a couple of months I consider the Allman style a little bit too spacious and feel more comfortable with the K&R-like style. Have you changed your coding style during your career?

    Read the article

  • Problem setting up DL360G5 with scsi RAID

    - by ernelli
    I have a problem with reinstalling OS on a DL360G5. The BIOS [F9] do not detect any disc controllers and the HP SmartSetup did not find any compatible controllers. Inside the server, the two SCSI disks are conncted to a RAID controller using BCM8603 chipset. How is disc contoller supposed to be setup? I have tried to do a full BIOS reset. EDIT At the moment we suspect that the Smart Array controller E200i/412205-001 is broken. Are there any status LED's that indicate failure or success during start up? At the moment all LED's are off.

    Read the article

  • Problem with Ctrl key on a hp 2510p

    - by Ernelli
    I have a tricky problem with my corporate Compaq hp 2510p, the ctrl key is not working properly at all times. I belive that it is hooked in some filter chain that processes certain ctrl+[key] combinations which is very annoying. I would like some pointers on how to proceed when analysing what application/setup can can cause this kind of keyboard filtering to happen. Anyway some more background info: Ctrl works together with X, C, V. Both in editors and terminals (Ctrl-C, Z etc) but Ctrl-Shift-Esc and Ctrl-Alt-Del does not work. Very annoying so my only option for logging in us using HP's security app. Shift-Arrow works for selecting text, but not Ctrl-shift arrow to select word by word, but Ctrl-Arrow works when moving the caret word by word. Now the strange thing is that everything works ok with an external USB keyboard so it might be the driver, but still, google yields 0 when searching for the problem description. I have vm-ware player installed (but not running it), HP Protect Tools installed, if any of these could affect the keyboard driver.

    Read the article

  • My Laptop (HP/Compaq 2510p) running ubuntu 10.04 LTS keeps losing the WLAN connection.

    - by Ernelli
    I am using Wicd and can successfully connect to my ADSL router (Thomson TG 787) using WPA PSK. But with regular interval I lose the ability to connect to Internet. I can ping the GW and can actually ping servers on the Internet but not connect to them using HTTP (Tested with both Firefox and wget). I would suspect the router unless for the fact that the problem does not show up when running Windows XP on the same computer and also, when the problem arises, a simple disconnect/connect in Wicd solves the problem, which does not involve the router (Except for the DHCP request). I have searched Ubuntu forums without luck, most problems described relate to specific network drivers or other problems. Does anyone have the same experience with Linux/Ubuntu and WLAN?

    Read the article

  • How to get around the jslint error 'Don't make functions within a loop.'

    - by Ernelli
    I am working on making all of our JS code pass through jslint, sometimes with a lot of tweaking with the options to get legacy code pass for now on with the intention to fix it properly later. There is one thing that jslint complains about that I do not have a workround for. That is when using constructs like this, we get the error 'Don't make functions within a loop.' for (prop in newObject) { // Check if we're overwriting an existing function if (typeof newObject[prop] === "function" && typeof _super[prop] === "function" && fnTest.test(newObject[prop])) { prototype[prop] = (function (name, func) { return function () { var result, old_super; old_super = this._super; this._super = _super[name]; result = func.apply(this, arguments); this._super = old_super; return result; }; })(prop, newObject[prop]); } This loop is part of a JS implementation of classical inheritance where classes that extend existing classes retain the super property of the extended class when invoking a member of the extended class. Just to clarify, the implementation above is inspired by this blog post by John Resig. But we also have other instances of functions created within a loop. The only workaround so far is to exclude these JS files from jslint, but we would like to use jslint for code validation and syntax checking as part of our continuous integration and build workflow. Is there a better way to implement functionality like this or is there a way to tweak code like this through jslint?

    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 regex basic usage problem

    - by Ernelli
    The following code works: String str= "test with foo hoo"; Pattern pattern = Pattern.compile("foo"); Matcher matcher = pattern.matcher(str); if(matcher.find()) { ... } But this example does not: if(Pattern.matches("foo", str)) { ... } And neither this version: if(str.matches("foo")) { ... } In the real code, str is a chunk of text with multiple lines if that is treated differently by the matcher, also in the real code, replace will be used to replace a string of text. Anyway, it is strange that it works in the first version but not the other two versions.

    Read the article

  • Where can I find a proper JavaScript beautifier

    - by Ernelli
    I have used http://jsbeautifier.org/ successfully using Rhino and ant, but the problem is that it is not deterministic. If you run the beautifier twice on a file the result is different from each time, e.g. each pass inserts additional array intendation on some lines. I have spent a lot of time debugging the code in beautify.js and have made some workarounds for comment handling, but the array indentation bug is annoying. Is there a correct and properly working JS code formatter anywhere that can be used as part of a source code indentation verification system? EDIT I have now tested with preserve-array-formating disabled, and it seems that it solves the problem. Too bad, since preserve-array-formating is quite useful with large array constructs.

    Read the article

1