Search Results

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

Page 132/3662 | < Previous Page | 128 129 130 131 132 133 134 135 136 137 138 139  | Next Page >

  • Static source code analysis with LLVM

    - by Phong
    I recently discover the LLVM (low level virtual machine) project, and from what I have heard It can be used to performed static analysis on a source code. I would like to know if it is possible to extract the different function call through function pointer (find the caller function and the callee function) in a program. I could find the kind of information in the website so it would be really helpful if you could tell me if such an library already exist in LLVM or can you point me to the good direction on how to build it myself (existing source code, reference, tutorial, example...). EDIT: With my analysis I actually want to extract caller/callee function call. In the case of a function pointer, I would like to return a set of possible callee. both caller and callee must be define in the source code (this does not include third party function in a library).

    Read the article

  • How to condense onclick code to be dynamic

    - by opbeta
    I am trying to get this onclick function code to be dynamic. I do not want to have 50 blocks of code for all the states. He is a quick snippet of the code var Ohio=function(){ document.getElementById('texas').style.display='none'; document.getElementById('florida').style.display='none'; document.getElementById('ohio').style.display='block'; } and so on and so forth..... How would I go about condensing this to make it smaller and dynamic?

    Read the article

  • VS 2010: Can't insert snippet using shortcut - incompatibility with resharper 5???

    - by mark smith
    Hi there, i recently installed some snippets that come with a framework i am using. And sure enought i checked via Tools > Code Snippet Manager and they are installed under "My Code Snippets". If i do insert Snipper (right click in code window) or CTRL K + CTRL X then i can search within all available snippets.... But i do believe its possible to just type the shortcut key (in this case it is mvvmlocatorproperty) and pressing tab inserts the snippet BUT when i type the shortcut key it is not recognizing anything... What am i doing wrong?? This is not an incompatibility with resharper 5? - which i have installed Any ideas really appreciated

    Read the article

  • javascript getting complete code of element when mouseover or onclick

    - by oimoim
    Hi, How can I get the complete html code of the element i'm mouseovering or clicking ? Using document.onmouseover = function(e){ can I get the full underlying html code of the element which triggered the event ? Right now, I am able to get the tag name or id or whatever. What I would like is the whole code. For example; if I'm mouseovering a table, I would like to get the string : <table><tr><td></td></tr></table> Is this possible ?

    Read the article

  • Why do I get CA1811 when I call a private method from a public method in C++/CLI?

    - by brickner
    I've recently upgraded my project from Visual Studio 2008 to Visual Studio 2010. By enabling Code Analysis and building on Release, I'm getting warning CA1811: Avoid uncalled private code. I've managed to reduce the code to this: .h file: public ref class Foo { public: virtual System::String^ ToString() override; private: static System::String^ Bar(); }; .cpp file: String^ Foo::ToString() { return Bar(); } String^ Foo::Bar() { return "abc"; } The warning I get: CA1811 : Microsoft.Performance : 'Foo::Bar(void)' appears to have no upstream public or protected callers. It doesn't matter if Bar() is static or not. I've tried to reproduce it in C# but I can't. I can only reproduce it in C++/CLI. Why do I get this warning? Is this a Visual Studio 2010 bug?

    Read the article

  • modx revo snippet variable in query

    - by Meddie
    I noticed something weird when using a query in a snippet. When I have a query like this: $sql = 'SELECT * FROM table WHERE colomn = ' . $variable; And I echo $sql, the query reads: SELECT * FROM table WHERE colomn = <code class="php plain">2</code> .. wich will result in an error because the sql is no longer valid. So for now I use strip_tags to remove the code tag, but I find it not a very clean method. I couldnt find anything about this, so maybe someone can shed some light on this for me?

    Read the article

  • Execute jQuery code when images have loaded from external resource

    - by Nick Swan
    Hi all, I'm getting users profile pictures from Facebook so their loading time varies quite a lot. When they have loaded I want to resize them. I have the resizing code working OK, but cannot get the actual code to execute reliably at the right time. According to the info I've found this should work: $('.userPic').load(function () { ... code to resize pictures }); But it doesn't seem 100% reliable. Any other hints or tips? Thanks Nick Swan

    Read the article

  • Compiling a class using Java code using process

    - by Noona
    I have this piece of code that compiles a class called tspClassName, when I compile using this code: Process compileProc = null; try { compileProc = Runtime.getRuntime().exec("javac -classpath ." + File.separator + "src" + File.separator + File.separator + "generated." + tspClassName + ".java -d ." + File.separator + "bin"); // catch exception if (compileProc.exitValue() != 0) { System.out.println("Compile exit status: " + compileProc.exitValue()); System.err.println("Compile error:" + compileProc.getErrorStream()); it outputs this: "Compile exit status: 2 Compile error:java.io.FileInputStream@17182c1" The class tspClassName.java compiles without errors otherwise, so I am guessing it has to do with the path,and in my eclipse project, the tspClassName.java resides in package homework4.generated inside src, is there something wrong with the path that I use in the code? thanks

    Read the article

  • Are QR codes guaranteed to work?

    - by Kiz
    Not sure if this will get closed as "not a real question" but I asked this on Superuser and it was closed for that very reason. We are thinking of implementing a QR code which will be sent to a number of users via an email which links through to a webpage. Now I'm aware that you can just Google 'QR codes' and there are a plethora of options that allow you to make a QR code. My question is thus; if we do go with this solution can we guarantee that it would work cross platform? I.e. on Android, iOS, Symbian etc? Once a QR code is generated will it work on ANY app on ANY platform? Thanks and apologies if this is not really a 'programming question' Thanks Kiran

    Read the article

  • Writing shorter code/algorithms, is more efficient (performance)?

    - by Carlos
    After coming across the code golf trivia around the site it is obvious people try to find ways to write code and algorithms as short as the possibly can in terms of characters, lines and total size, even if that means writing something like: n=input() while n>1:n=(n/2,n*3+1)[n%2];print n So as a beginner I start to wonder whether size actually matters :D. It is obviously a very subjective question highly dependent on the actual code being used, but what is the rule of thumb in the real world. In the case that size wont matter, how come then we don't focus more on performance rather than size?

    Read the article

  • Multi-Threaded Application - Help with some pseudo code!!

    - by HonorGod
    I am working on a multi-threaded application and need help with some pseudo-code. To make it simpler for implementation I will try to explain that in simple terms / test case. Here is the scenario - I have an array list of strings (say 100 strings) I have a Reader Class that reads the strings and passes them to a Writer Class that prints the strings to the console. Right now this runs in a Single Thread Model. I wanted to make this multi-threaded but with the following features - Ability to set MAX_READERS Ability to set MAX_WRITERS Ability to set BATCH_SIZE So basically the code should instantiate those many Readers and Writers and do the work in parallel. Any pseudo code will really be helpful to keep me going!

    Read the article

  • rails code within javascript

    - by Jesse
    I am trying to use some rails code withing a javascript and need to have that rails code be dynamically changed. Here's the line of code: $(this).replaceWith("<%= escape_javascript(render(:partial => 'shared/products')) %>"); The 'shared/products' is the part I want to change based off information passed earlier in the javascript. How do I insert a value from javascript so that instead of 'shared/products' the products portion can be a variable? Hope this makes sense. I'm not the most experienced jQuery/javascript programmer, so any help is very much appreciated. Thanks in advance!

    Read the article

  • Parenthesis operator in C. What is the effect in the following code

    - by Andre
    Hi everyone, I was playing with a macro to enable/disable traces when I came out with the following code when the macro is disabled: int main { ("Hello world"); } This code is valid and I got the desired effect (nothing happens when the macro is disabled) but I couldn't figure out what exactly is happening. Is the compiler seeing the parenthesis as a "nameless" method declaration? To make it clearer the code is : #ifdef TRACE #define trace printf("%s %d -> ",__FILE__, __LINE__);printf else #define trace #endif int main { trace("Hello world"); } Thanks in advance.

    Read the article

  • what is the meaning of this code

    - by spific
    i have this code : use strict; use LWP::UserAgent; use warnings; my $ua = new LWP::UserAgent(agent => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5'); $ua->proxy([qw(http https)] => 'http://59.39.92.148:1080'); my $response = $ua->get("http://www.google.com"); print $response->code,' ', $response->message,"\n"; is the mean of code " open www.google.com with sock proxy"? pls explain for me .

    Read the article

  • Is code clearness killing application performance?

    - by Jorge Córdoba
    As today's code is getting more complex by the minute, code needs to be designed to be maintainable - meaning easy to read, and easy to understand. That being said, I can't help but remember the programs that ran a couple of years ago such as Winamp or some games in which you needed a high performance program because your 486 100 Mhz wouldn't play mp3s with that beautiful mp3 player which consumed all of your CPU cycles. Now I run Media Player (or whatever), start playing an mp3 and it eats up a 25-30% of one of my four cores. Come on!! If a 486 can do it, how can the playback take up so much processor to do the same? I'm a developer myself, and I always used to advise: keep your code simple, don't prematurely optimize for performance. It seems that we've gone from "trying to get it to use the least amount of CPU as possible" to "if it doesn't take too much CPU is all right". So, do you think we are killing performance by ignoring optimizations?

    Read the article

  • Simple and efficient distribution of C++/Boost source code (amalgamation)

    - by Arrieta
    Hello: My job mostly consists of engineering analysis, but I find myself distributing code more and more frequently among my colleagues. A big pain is that not every user is proficient in the intricacies of compiling source code, and I cannot distribute executables. I've been working with C++ using Boost, and the problem is that I cannot request every sysadmin of every network to install the libraries. Instead, I want to distribute a single source file (or as few as possible) so that the user can g++ source.c -o program. So, the question is: can you pack the Boost libraries with your code, and end up with a single file? I am talking about the Boost libraries which are "headers only" or "templates only". As an inspiration, please look at the distribution of SQlite or the Lemon Parser Generator; the author amalgamates the stuff into a single source file which is trivial to compile. Thank you.

    Read the article

  • Validating/Allowing YouTube Embed Code

    - by mellowsoon
    Hi, hopefully this is a simple question. I have a simple custom forum on my site written in PHP. For security reasons I don't allow any HTML in the forum posts. I only allow certain BBCode tags. I would however like to allow embedded YouTube videos. So my question is this: What's the best (most secure) way to validate the YouTube embed code? YouTube is currently using iframes to embed videos, but obviously I can't just allow the iframe tag. I also need to ensure the src of the iframe is a YouTube URL, and ensure there's no other malicious bits of code in the iframe code.

    Read the article

  • View code inside Javascript file on Rails

    - by SpyrosP
    Hello, previously i had javascript code right in the top of my view and it would work. Then, i learned that you can include the js file using yield and i did just that. I had rails view code inside my javascript code like : $( "#exp-progressbar" ).progressbar({ value: <%= ((@quest.end_time - Time.now).to_i * 100 ) / (@quest.duration * 60) %> }); Now, after i do it with yield, i get an error when i do that in the separate js file. How can i do it now ?

    Read the article

  • Shared static classes between AppDomains in loaded library code

    - by Christian Stewart
    I'm working on a program in which I want to do something similar to what the Photon Server system does: Offer a common "API" class library, which contains common data classes, enumerations, and interfaces for working with the host program. Have client programs (class libraries) reference this DLL and implement interfaces listed within it. Have the "host" application load built DLL client libraries into separate AppDomains and reference the interfaces that lie within to have polymorphic client code from within a dll file. I have something like this worked out: a class library that contains common code, but I've run into the following question How should I handle static classes? Should I add a method that is called by the host program to synchronize data? How do I keep a static class the same between AppDomains? Should I discard these classes in favor of better interfaces between the code levels? And in general, how do I share data between these loaded AppDomains?

    Read the article

  • latex and listings : highlighting some parts of the code

    - by Jérôme
    I'm using Latex and the listings package to display some C++ code (with syntax highlighting) inside a document. I need to highlight some parts of the code. This specific highlight has nothing to do with syntax highlighting, it's just some parts of the code I'd like to highlight so that the reader can focus on it. I wish I could make some variable name, for instance, displaying in bold, and on a yellow background. Here is something I did with MSWord I'd like to reproduce with Latex (of course, not the red and green underlining) : . I haven't found a way to do it with the listings package. Is it possible ?

    Read the article

  • Windows Installer (C#) error code 2869

    - by KP
    I have a project, in VS 2005, which has a console application and a setup project associated to install the application. I also have an installer class in the console application that the setup project will use to do some validation before installation. Those tasks are checking the database connection string and checking some directory locations to make sure they exist prior to installation. I am getting an error code of 2869 when I try to install the application. All the code is written in C#. I have googled for this error code on Windows XP, but only found articles that deal with Vista and Windows 7. Any ideas what might be happening? Is there a workaround?

    Read the article

  • Manually Dispatching a DocumentEvent for testing UI element validation code

    - by Bassam
    Hi. I'm testing a Swing GUI application using the UISpec4J testing framework. I'm testing validation code on a JTextField, but the framework does not support focus-change events, as it runs the application in a headless fashion. The text field has a DocumentEvent attached to it that activates the validation code. I'm trying to figure out how to dispatch the document event manually to activate the validation code. Trying to dispatch focus or mouse events manually haven't been working for me. Thanks for any help!

    Read the article

  • Unreachable code detected in case statement

    - by alex
    I have a code: protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { switch (keyData) { case Keys.Alt|Keys.D1: if (this._condition1) { return true; } else { return base.ProcessCmdKey(ref msg, keyData); } break; case Keys.Control |Keys.U: if (this._condition2) { return true; } else { return base.ProcessCmdKey(ref msg, keyData); } break; default: return base.ProcessCmdKey(ref msg, keyData); } return true; It gives me "unreachable code detected" warning on breaks. Is it good practice not to use break operator here ? I don't want to turn off "unreachable code detected" warning. PS: There are many case in my ProcessCmdKey method.

    Read the article

  • Server-side Javascript (aspx.cs) Attributes.Add Code to Change a Label's text

    - by DFM
    I am trying to change a label's text by using server-side javascript (onclick) and C# within the page_load event. For example, I would like to write something like the following: Label1.Attributes.Add("onclick", "Label2.text='new caption'") Does anyone know the correct code for this? Also, what is this type of code referred to; is it just javascript or javascript in C# or is there a specific name? Lastly, does a book or online resource exist that lists the choices of control.attributes.add("event", "syntax") code to use with C#? Thank you, DFM

    Read the article

  • alternatives to eval for running remote code.

    - by Raynos
    Are there any alternatives to using eval to immediatly run remote & trusted javascript code. function load(filePath) { var o = $.ajax({ url: filePath, dataType: 'html', async: false }); eval(o.responseText); } load("somePath"); // run a function that relies on the code from o.responseText being loaded doSomethingWithCode(); I'm aware that synchronous loading of javascript is adviced againts. But if there is no choice are there any cross browser alternatives for the use of eval above. [Edit] To clarify in more detail the code being loaded is a self executing function. Which needs to execute before doSomethingWidthCode. It's also being loaded from the server on the same domain hence its trusted.

    Read the article

< Previous Page | 128 129 130 131 132 133 134 135 136 137 138 139  | Next Page >