Search Results

Search found 91526 results on 3662 pages for 'clean code'.

Page 210/3662 | < Previous Page | 206 207 208 209 210 211 212 213 214 215 216 217  | Next Page >

  • How to check code is compatible with Windows 7

    - by Julen
    Hello, We are developing using Visual C# 2008 Express a program based on WPF under Windows XP machines (32 bits). The thing is that we have tried to run the program in two Windows 7 machines, one is 32 bits Windows 7 and the other is 64 bits Windows 7. Under Windows XP everything is fine. In Windows 7 machine, it launches in the 32 bits version altough there is an error when running one functionality (it does not happen in XP). In W7 64 bits it even does not launch. Is this normal? Is not possible to run 32 bit programs under W7 64-bits,even if they execute slower?? How can we check the code is compatible with Windows 7? Thank you very much in advance. Julen.

    Read the article

  • Is it bad practice to have a long initialization method?

    - by Paperflyer
    many people have argued about function size. They say that functions in general should be pretty short. Opinions vary from something like 15 lines to "about one screen", which today is probably about 40-80 lines. Also, functions should always fulfill one task only. However, there is one kind of function that frequently fails in both criteria in my code: initialization functions. For example in an audio application, the audio hardware/API has to be set up, audio data has to be converted to a suitable format and the object state has to properly initialized. These are clearly three different tasks and depending on the API this can easily span more than 50 lines. The thing with init-functions is that they are generally only called once, so there is no need to re-use any of the components. Would you still break them up into several smaller functions would you consider big initialization functions to be ok?

    Read the article

  • How can I simplify this redundant code?

    - by Alix Axel
    Can someone please help me simpling this redundant piece of code? if (isset($to) === true) { if (is_string($to) === true) { $to = explode(',', $to); } $to = array_filter(filter_var_array(preg_replace('~[<>]|%0[ab]|[[:cntrl:]]~i', '', $to), FILTER_VALIDATE_EMAIL)); } if (isset($cc) === true) { if (is_string($cc) === true) { $cc = explode(',', $cc); } $cc = array_filter(filter_var_array(preg_replace('~[<>]|%0[ab]|[[:cntrl:]]~i', '', $cc), FILTER_VALIDATE_EMAIL)); } if (isset($bcc) === true) { if (is_string($bcc) === true) { $bcc = explode(',', $bcc); } $bcc = array_filter(filter_var_array(preg_replace('~[<>]|%0[ab]|[[:cntrl:]]~i', '', $bcc), FILTER_VALIDATE_EMAIL)); } if (isset($from) === true) { if (is_string($from) === true) { $from = explode(',', $from); } $from = array_filter(filter_var_array(preg_replace('~[<>]|%0[ab]|[[:cntrl:]]~i', '', $from), FILTER_VALIDATE_EMAIL)); } I tried using variable variables but without success (it's been a long time since I've used them).

    Read the article

  • iphone: Accessing Code for Elements Created in Interface Builder

    - by user362685
    I am attempting to create a basic tab-bar application using interface builder. I create a new project in Xcode selecting tab bar application. My question is how can I access the code that instantiates and pushes each of the views when the tab bar buttons are pressed? I would imagine that would be done by the tab bar controller, however when I write the class file from interface builder (filewrite class files), it just creates a blank generic TabBarController.h/TabBarController.m without the methods for pushing each of the views associated with the tab bar elements. I ask this because I would like to pass each view controller a reference to the data model when they are instantiated. Any help would be greatly appreciated, thanks.

    Read the article

  • Updating label using jquery and code behind

    - by Zaps
    Hi, I have a label on a page and I'm updating the text property of the label when text is changed in a textbox. I'm updating the label like so: $myLabel.text("hello"); The text is being displayed correctly on the screen butwhen I try to save the text value to an object in the code behind (When I press a button) the text property of the label is "" and not "hello". var myLabel = myLabel.Text; //the var myLabel is "" when it should be "hello" Any ideas as to why this would be? Thanks in advance, Zaps

    Read the article

  • import existing source code as referenced library in eclipse

    - by user555174
    I have some source codes from a friend that I would like to use as referenced library in my BlackBerry project. I'm not sure about how to package the source codes into a .jar file. I tried exporting the source to a JAR file and import it as external JAR in my project, it's giving me missing stack map error. I tried to preverify the .jar file generated from the source using the provided preverification tool from BlackBerry JDE, it didn't give me any output folder. In fact, I'm not sure if the way I export the source is correct. Can anyone provide step-by-step instructions on how to package existing source code into a valid JAR file that can be imported into my project as a referenced library? Again, I'm using eclipse. Thanks very much in advance.

    Read the article

  • What's the best way to format long strings of HTML in PHP?

    - by dclowd9901
    I know it's really a subjective question, but for best-practices (and readability), I can't seem to get a fix on the best way to format long strings of HTML. I typically do it like this: echo ' <div> <p>Content Inside</p> <div class="subbox"> <ul> <li>etc.</li> <li>etc.</li> <li>etc.</li> <li>etc.</li> </ul> </div> </div> '; But I still don't like the outcome, especially if this appears in the middle of a large block of code. It just feels messy.

    Read the article

  • Cannot see response body in ie8 when response http status code is set to some error code(422)

    - by Deewendra Shrestha
    I am making a requset to a web service that sends custom error with proper HTTP header when I notice some validation error, this works fine in chrome and mozilla as things always do and then it broke in ie8 as it always does! After checking the network activity, I see that ie8 is not able to get response body when HTTP code is other that 200(or at-least it seems so). In groovy I am returning error like : render(status: 422, contentType: 'TEXT', text: ((errors as JSON) as String)) Is there a way I could somehow get ie8 to read in the response body, or as an alternative I might be able to set response header but before trying that I was wondering if you guys have already seen this issue and know a solution to it. Thanks, Dee

    Read the article

  • I have a problem with the following Java code

    - by Sanjeev
    public class b { public static void main(String[] args) { byte b = 1; long l = 127; // b = b + l; // 1 if I try this then it does not compile b += l; // 2 if I try this then it does compile System.out.println(b); } } I am using this code but I have problem: I don't understand why b=b+l; is not compiling but if I write b+=l; then it compiles and runs. Please explain why this happens.

    Read the article

  • Simple javascript document.write isn't working...

    - by Jascination
    Here's the code in question I'm trying to create a simple application - each of the three men has a rel="x" attribute attached them. I'm using var regionId = $('img.selected-region').attr('rel'); to make the rel of the currently selected item the value of reginId. I want to test this out by performing a simple document.write(regionId) command in a div under the pictures of the men. However, it's not working. Have I put the var regionId definition in the right place in the script window? I'm completely new to javascript so the syntax is confusing to me - and help would be greatly appreciated.

    Read the article

  • Proxy object references in MVC code

    - by krystan honour
    Hi there, I am just figuring out best practice with MVC now I have a project where we have chosen to use it in anger. My question is. If creating a list view which is bound to an IEnumerable is this bad practise? Would it be better to seperate the code generated by the WCF Service reference into a datastructure which essentially holds the same data but abstracts further from the service, meaning that the UI is totally unaware of the service implementation beneath. or do people just bind to the proxy object types and have done with it ? My personal feeling is to create an abstraction but this seems to violate the DRY principle.

    Read the article

  • How to handle Clean URIs in Classic ASP using PATH_INFO?

    - by Mario
    I'm trying to handle Clean URIs in a Classic ASP application. In PHP, I was able to use URIs like http://example.com/index.php/foo/bar/baz and have /foo/bar/baz available in the PATH_INFO environment variable. (I usually add a rewrite rule so I do not need the index.php segment) However, I don't seem to be able to mimic this in Classic ASP. If I try http://example.com/index.asp/foo/bar/baz, I get a 404 error. Is there a way to add a path after the index.asp segment and get the PHP like behaviour in ASP? Note: I'm currently using the workaround of rewriting URLs of the form: http://example.com/foo/bar/baz/ to index.asp?path=/foo/bar/baz since I can't seem to get index.asp/foo/bar/baz to work.

    Read the article

  • Code optimization - Unused methods

    - by Yochai Timmer
    How can I tell if a method will never be used ? I know that for dll files and libraries you can't really know if someone else (another project) will ever use the code. In general I assume that anything public might be used somewhere else. But what about private methods ? Is it safe to assume that if I don't see an explicit call to that method, it won't be used ? I assume that for private methods it's easier to decide. But is it safe to decide it ONLY for private methods ?

    Read the article

  • TeamCity Multi-Part Build - How to checkout the code just once

    - by Jeff D
    I am trying to create 1 package with multiple build configurations. The first will checkout the code, build it (Solution File configuration), and run nunit tests. If that succeeds, another will then build in release mode. If that succeeds, a final script witll package up the output, and mark it as an artifact. The problem I'm having is that I don't know how to tell TeamCity not to create new directories for each step, and as a result, the steps are failing. Is there a setting for this? It seems like the dependencies tab would be an appropriate place to look, but I don't seem to understand the instructions, and my tinkering so far has been fruitless.

    Read the article

  • VS2010 is removing code from designer without warning - causing issues

    - by schmoopy
    I have a WinForm with a pretty complex layout (has lots of controls, panels, etc.) Whenever i open the form the file is automatically checked out from source control and it removes anything in the designer file that refereces my menustrip or statusstrip ie: the following get removed (w/o warning) Me.MyMenuStip.SuspendLayout() Me.MyStatusStrip.SuspendLayout() Me.MyMenuStrip.ResumeLayout(False) Me.MyMenuStrip.PerformLayout() Me.MyStatusStrip.ResumeLayout(False) Me.MyStatusStrip.PerformLayout() The code still builds, but there are no Menu or Status items rendered. Any ideas on what i can do? I do not want to just remove/add the menustrip for instance cause i would loose all of my menu items (and there are a lot) Thanks in advance!

    Read the article

  • Eclipse Java code Format

    - by Jayesh
    I am not that much aware of Eclipse Shortcuts. I copied code from some link and I pasted in Eclipse Indigo but it is coming like "public String doLogin() throws ApplicationException{ long executionStartTime = System.cu... }" I want to format it in java style like public String doLogin() throws ApplicationException{ long executionStartTime = System.cu... } I google it and found few shortcuts like, "Shift + Tab" , "Ctrl + I", "Ctrl + Shift + F". but is not giving me the behavior I want. is there I need to add custom formatter or I am expecting more.

    Read the article

  • Help me understand Dispose() implementation code from MSDN

    - by Benny
    the following code is from MSDN: Idisposable pattern protected virtual void Dispose(bool disposing) { // If you need thread safety, use a lock around these // operations, as well as in your methods that use the resource. if (!_disposed) { if (disposing) { if (_resource != null) _resource.Dispose(); Console.WriteLine("Object disposed."); } // Indicate that the instance has been disposed. _resource = null; _disposed = true; } } why the following statement: _resource = null; _disposed = true; are not enclosed by if (disposing) statement block? for me i would probably write like this: if (disposing) { if (_resource != null) { _resource.Dispose(); _resource = null; _disposed = true; } Console.WriteLine("Object disposed."); } anything wrong with my version?

    Read the article

  • C++ Code Clarification Needed..

    - by ke3pup
    Hi guys I'm trying to understand what the code below says: struct compare_pq; struct compare_pq { bool operator() (Events *& a, Events *& b); }; std::priority_queue<Events *, std::vector<Events *>, compare_pq> eventList; i looked at what priority_queue is and how its declared but can't quit understand what compare_pq is doing in the priority_queue eventList. Also what does operator() do since i've never seen *& before and empty operator overloading operator()! any help would be appreciated. Thank you

    Read the article

  • Misc. Naming: Can I place underscores instead of camel casing in modern languages?

    - by Bubba88
    Hi! I would like to ask some kind of permission (I hope that doesn't sound strange) from the people who have influence on the naming conventions in modern languages like F#, Scala, etc. My problem is - I just can't read camelCased code and wish I could write underscored_names at least in my internal implementations (not in API interface). This applies to just everything - local var names, method names, params.. (Not class names I think) It seems that now the camel-casing is preferred for example for the names of object methods, but could that be not the only way? What would you say; Can I go with underscored names in languages like I mentioned (F#, Scala)?

    Read the article

  • Security / Protecting code in JavaScript

    - by Evans
    With all the recent hype about JavaScript and HTML5 replacing Flash, I wanted to know - How would it be possible to protect client-side js code? Of course, it is possible to obfuscate it, but that would only make it a little harder. Also, for games which submit high scores to the server, wouldn't it be incredibly easy to modify those scores before they are sent to the server? I know even Flash files can be decompiled, but they can be obfuscated and flash decompilation is not as easy as modifying data in JS - could be done easily using a plugin such as Firebug. I'd like to know everyone's views on this.

    Read the article

  • Json return code to simplify if possible.

    - by pirzada
    Can you simplify this code?. Is there anything we can do to make it more simple. I am not sure but it looks ugly to me. [HttpPost] public JsonResult UserDetailById(int userId, string username) { IQueryable<Company> repository = companyRepository.GetGridCompanies(); Employee emp = companyRepository.GetEmployee(userId); //Drop down fill var a = (from c in repository .OrderBy(c => c.companyName) select new { Id = c.companyID, Name = c.companyName }).ToArray(); var data = new { Id = emp.companyID.ToString(), Name = emp.employeeFirstname + " " + emp.employeeLastname, Fn = emp.employeeFirstname, Ln = emp.employeeLastname, Dept = emp.employeeDepartment, Sup = emp.employeeSup.ToString(), HireDate = String.Format("{0:MM/dd/yyyy}", emp.employeeHiredate), CompVm = a }; return Json(data); }

    Read the article

  • Convert the code from PHP to Ruby on rails

    - by theband
    public function getFtime() { $records=array(); $sql="SELECT * FROM `finishedtime`"; $result=mysql_query($sql); if(!$result){throw new Exception(mysql_error());} if(mysql_num_rows($result)==0){return $records;} while($row=mysql_fetch_assoc($result)){$records[]=$row;} return $records; } I am in the process of learning Ruby, can anyone convert this code into Ruby. This will make me construe on how to run a query and thrown the fetched result back.

    Read the article

  • iPython in Emacs. Quick code evaluation

    - by AmV
    Hi all, I would like to "send" code snippets to a iPython interpreter in Emacs 23.2 (Linux). I have two related questions about this: Q1: I have learned that Emacs provides ('shell-command-on-region') to run selected regions in a shell. I have set setq shell-file-name to my iPython path, but when I run M-| after selecting a region, Emacs prompts me the following: Shell command on region: and if I then type RET, I get the iPython man page on the *Shell Command Output* buffer, without the region being executed. Why? Q2: Assuming that I have already started an iPython shell in some other buffer in Emacs, is there a way of selecting a region in another buffer and "sending" this region to the already-started iPython shell? Thanks!

    Read the article

  • What does this code means? Odd & Even

    - by Rodolfo Contreras
    <?php $Odd = "even"; $query = $MySQLi->query("SELECT id, look, username, motto FROM users WHERE rank = '7'"); if($query->num_rows > 0): while($UserRow = $query->fetch_assoc()) { $Odd = ($Odd == "even") ? "odd" : "even"; ?> I'm using a CMS for some web. But i can't stand this code exactly. Well i do know what does it do. But im not sure how to work with it. Mostly this line: $Odd = ($Odd == "even") ? "odd" : "even"; Can you guys help me?

    Read the article

  • problem with drupal view and php code

    - by czuroski
    Hello, I have a view set up in drupal and I am using some jquery code within the view which hides some data based upon a text box value. Everything is working fine for me when I am logged in. When I log out and access the block anonymously, it doesn't work correctly. I am somewhat new to drupal, and don't know where to begin troubleshooting. I assume it is a permissions issue, but on the view, on the content type, where? If anyone could give me some direction on where to start looking, I would greatly appreciate it. Thanks

    Read the article

< Previous Page | 206 207 208 209 210 211 212 213 214 215 216 217  | Next Page >