Search Results

Search found 87932 results on 3518 pages for 'code vader'.

Page 120/3518 | < Previous Page | 116 117 118 119 120 121 122 123 124 125 126 127  | Next Page >

  • How to explicitly add a piece of code to a java project

    - by user435245
    Hi there, I’m working with Net beans IDE and I want to add a piece of code to my project in a way that the source code won’t be visible to the user who is running the project, I decided to export that piece of code as a jar file in eclipse and then add that jar file to the project. But unfortunately net beans does not let me import that. It says which it is expecting a . Or when I insert. It goes in to that class and I cannot import that jar file into the project by import instruction. Is there a command in net beans which creates and object from jar file and then makes access to the functions and classes of the jar file? Would you please give the format of that instruction? If you know a better way to do this task I would be so happy if you share it with me

    Read the article

  • PHP: How to check for response code?

    - by Tom
    Hi, I'm a relative PHP newbie implementing a PayPal IPN listener and all seems to be working fine, except I dont really know how to check for a response code. I've tried something ugly with cURL but it doesn't work at all (I'm not understanding cURL). I've tried this piece of code that I grabbed from somewhere on the net: $fp = fsockopen('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); $response_headers = get_headers($fp); $response_code = (int)substr($headers[0], 9, 3); ... but it's not working (returns $response_code = 0). So right now, I'm debugging my IPN code without checking for a Response 200. Can anyone more experienced advise me on what's the proper/simple way to check this? Thanks

    Read the article

  • Exit Try/Catch to prevent code after from being run

    - by coffeeaddict
    I've got for example a try/catch in my method: } catch (OurCustomExceptionObject1 ex) { txtErrorMessage.InnerHtml = "test 1"; } catch(OurCustomExceptionObject2 ex) { txtErrorMessage.InnerHtml = "test 2"; } catch (OurCustomExceptionObject3 ex) { txtErrorMessage.InnerHtml = "test 3"; } ... rest of code here is being executed after the try/catch I do not want the rest of code to run if any of the exceptions are caught. I'm handling the exceptions. I heard do not use Exit Try for some reason. Is that true, it's bad to do this? Is this the right way to halt execution of code thereafter the catch statement?

    Read the article

  • Examples of both beautiful and ugly java code?

    - by tputkonen
    I would like to demonstrate how difficult it is for a layman to identify high quality code from flawed code. I'm thinking of doing this with the help of two java methods. Both of the methods should look like they do the same, pretty simple thing. However one of them should have several kind of flaws, for example: iteration with array off by one error string concatenations causing lots of objects to be created (as opposed to StringBuffer in the "good" code, which looks more complicated) possibly null pointer exception (but it should not be trivial to spot) Those are just some examples, all kinds of other issues including bugs and performance related structures are highly appreciated. Methods should be around 10-20 lines of length, and the task they do should be something simple - preferably printing something in an iteration.

    Read the article

  • How to disable the Input,textarea,selector using this code in the Fieldset

    - by kumar
    Hello friends I am using this code in my view.. $("#Fieldset1").find("input, select,textarea").attr('disabled', 'disabled'); this code i am in one view...for one user only one time...if I select 3 users this view will execute three times.. using this code I can able to disable inputfor one one time. its not doing for second time that is second user on the page. why its happening? I need to disable for how many users I select.... thanks..

    Read the article

  • Strange difference between optimized/non optimized microsoft c++ code

    - by Anders Forsgren
    I have a c++ program with a method that looks something like this: int myMethod(int* arr1, int* arr2, int* index) { arr1--; arr2--; int val = arr1[*index]; int val2 = arr2[val]; doMoreThings(val); } With optimizations enabled (/O2) the first line where the first pointer is decremented is not executed. I assume the compiler believes that the arr1 array is not used since it thinks it can remove the decrement. Am I violating some convention in the above code? What could cause this behavior? It is a very old piece of f2c-translated code, the pointer decrement is due to the 1-based indexing of the original code.

    Read the article

  • Where to put code snippets in Rails?

    - by Nik
    Hello all, I have this code snippets that generates a signature for POSTs. The detail of it is not important, but what I want to know is: since it is not a model-related chunk of code, it really can be use anywhere: in controllers, in models, in view helpers; even in views. So I am unsure where and, even bigger of a problem, how to activate the use of it once I place it in some location. Is it what those "require" statements are all about? That you can acquire some functionality through a "require" statement in the current file you are working on? Just so that we have an example to talk about, say, I have a little snippet of code that does cubing: def cube_it(num) num**3 end I know that I will be using it in various places across the application, so where should I put it? and when I do need to use it, how can I "summon" it? Thank You

    Read the article

  • How do I protect python code?

    - by Jordfräs
    I am developing a piece of software in python that will be distributed to my employer's customers. My employer wants to limit the usage of the software with a time restricted license file. If we distribute the .py files or even .pyc files it will be easy to (decompile), and remove the code that checks the license file. Another aspect is that my employer do not want the code to be read by our customers, fearing that the code may be stolen or at least the "novel ideas". Is there a good way to handle this problem? Preferably with an off-the-shelf solution. The software will run on Linux systems (so I don't think py2exe will do the trick)

    Read the article

  • Marking "example usage" in code documentation

    - by Ross
    What the best practice of placing example usage in code documentation? Is there a standardised way? With an @usage or @notes? For example: /** * My Function * @param object id anObject * @usage a code example here... */ function foo(id) { } or /** * My Function * @param object id anObject * @notes a code example here, maybe? */ function foo(id) { } I know this question should dependent on the documentation generator, but any heads up appreciated... I'm trying to get into the habit of using proper style. When time allow I'll get more into the generators. (I've experimented with Doxygen.) I often use AS3, JS, Obj-C, C++. Thanks

    Read the article

  • What to do when using Contract.Assert(true) and the method must return something?

    - by devoured elysium
    I have a bit of code with the following logic: //pseudo-code foreach (element in elementList) { if (element is whatever) return element; } } In theory, there is always one element that is whatever, so this method should pose no problems. In any case, I've put an assertion on the end of the method just to be sure: //pseudo-code foreach (element in elementList) { if (element is whatever) return element; } } Contract.Assert(true, "Invalid state!"); The problem is that as this method has to return something, and the compiler doesn't understand that the assertion will break the program execution. Before using Contracts, in these kind of situations, I used to throw an Exception, which solved the problem. How would you handle this with Contract.Assert()? Returning null or default(element_type) after the Contract.Assert() call knowing it will never be called and shutting up the compiler? Or is there any other more elegant way of doing this? Thanks

    Read the article

  • A PHP Function that verify code language

    - by tymc
    Hi, I have a form with 2 textareas; the first one allows user to send HTML Code, the second allows to send CSS Code. I have to verify with a PHP function, if the language is correct. If the language is correct, for security, i have to check that there is not PHP code or SQL Injection or whatever. What do you think ? Is there a way to do that ? Where can I find this kind of function ? Is "HTML Purifier" http://htmlpurifier.org/ a good solution ?

    Read the article

  • Optimizing Code

    - by Claudiu
    You are given a heap of code in your favorite language which combines to form a rather complicated application. It runs rather slowly, and your boss has asked you to optimize it. What are the steps you follow to most efficiently optimize the code? What strategies have you found to be unsuccessful when optimizing code? Re-writes: At what point do you decide to stop optimizing and say "This is as fast as it'll get without a complete re-write." In what cases would you advocate a simple complete re-write anyway? How would you go about designing it?

    Read the article

  • how to avoid repeating code?

    - by helloWorld
    I have some technical question, I have repeating code in my work, and I want to get rid of it, so I know that in C++ it is not good idea to use macro, but instead I must use inline function, is it good idea to use this function as inline: list<Data>::iterator foo(int data){ if(dataExists(data)){ list<Data>::iterator i; for(i = Data.begin(); i != Data.end(); ++i){ if(i->getData() == data){ break; } return i; //here I have one more problem, what can I return if data doesn't exist? } I'm beginner, and I think that this function is very unsafe, can somebody please give me advice, how can I improve my code, thanks in advance P.S. what usually do You use to avoid repeating code?

    Read the article

  • Adding packages from different SVN repositories in a single project

    - by shuby_rocks
    Hello all I am trying to create a project whose source code comes from 2 different SVN repositories. When I do the svn co pathToRepoA currentDirectory to checkout all the code from the 1st repo, it runs fine. Now, when I try to checkout some specific packages from the 2nd repo by doing svn co pathToRepoB/src/main/java/somespecificpackage currentDirectory/src/main/java/nameOfNewPackage into the same project, it gives me an error that the current directory is already a working directory of a different URL (which is an obvious error). How do I overcome this problem so that I can integrate code (some specific packages) from different repositories into a single project. Thanks!

    Read the article

  • Parsing C# code to evaluate expressions (basically, implementing Intellisense)

    - by halivingston
    I'm trying to evaluate C# code as it gets typed, think of it as if I'm trying to write an IDE. So a person types code, I want to find out what code did he just write: String x = ""; I want to now register that x is a type of String. And now everytime the user types x again, and I want to show him all the things he can do with x, basically like Visual Studio Intellisense. Will I need some lexers or parsers for this? Will that make it easier? I've heard VS 2010 has some features around this that Microsoft has released. Any ideas?

    Read the article

  • dealing with IO vs pure code in haskell

    - by Drakosha
    I'm writing a shell script (my 1st non-example in haskell) which is supposed to list a directory, get every file size, do some string manipulation (pure code) and then rename some files. I'm not sure what i'm doing wrong, so 2 questions: How should i arrange the code in such program? I have a specific issue, i get the following error, what am i doing wrong? error: Couldn't match expected type [FilePath]' against inferred typeIO [FilePath]' In the second argument of mapM', namelyfileNames' In a stmt of a 'do' expression: files <- (mapM getFileNameAndSize fileNames) In the expression: do { fileNames <- getDirectoryContents; files <- (mapM getFileNameAndSize fileNames); sortBy cmpFilesBySize files } code: getFileNameAndSize fname = do (fname, (withFile fname ReadMode hFileSize)) getFilesWithSizes = do fileNames <- getDirectoryContents files <- (mapM getFileNameAndSize fileNames) sortBy cmpFilesBySize files

    Read the article

  • Tests that are 2-3 times bigger than the testable code

    - by HeavyWave
    Is it normal to have tests that are way bigger than the actual code being tested? For every line of code I am testing I usually have 2-3 lines in the unit test. Which ultimately leads to tons of time being spent just typing the tests in (mock, mock and mock more). Where are the time savings? Do you ever avoid tests for code that is along the lines of being trivial? Most of my methods are less than 10 lines long and testing each one of them takes a lot of time, to the point where, as you see, I start questioning writing most of the tests in the first place. I am not advocating not unit testing, I like it. Just want to see what factors people consider before writing tests. They come at a cost (in terms of time, hence money), so this cost must be evaluated somehow. How do you estimate the savings created by your unit tests, if ever?

    Read the article

  • How can I open another tab in the browser from the Code Behind [duplicate]

    - by Daniel Powell
    This question already has an answer here: Response.Redirect to new window 18 answers I have an ASP.Net project that I am working on that involves opening another tab in the browser from the vb.net (code behind). I have tried to use the WebBrowser control to open the new tab as well as tried to use the Script manager however I have not been able to open the new tab. The button I am using is a custom button in a DevExpress GridView, and I am handling its click with this code: Private Sub ASPxGridView2_CustomButtonCallback(sender As Object, e As DevExpress.Web.ASPxGridView.ASPxGridViewCustomButtonCallbackEventArgs) Handles ASPxGridView2.CustomButtonCallback If e.ButtonID <> "customButton" Then Return End If Dim neededID = ASPxGridView2.GetRowValues(e.VisibleIndex, "target") Dim id = CStr(neededID) Dim url = ("targetPage.aspx" + "?ID=" + id) Dim wb As WebBrowser wb.Navigate(url,True) End Sub I'm not sure why this would not work, any suggestions as to how I should open a new browser tab with or without the WebBrowser works for this project. EDIT: I cannot use javascript with this ASPxGridview So I need an answer that doesn't involve modification to the javascript except through the vb.net code behind

    Read the article

  • Avoiding sub-type selection in view code

    - by John Donoghue
    Hi, I have some code where the model contains some classes like (vb.net pseudocode, but could be any OO language): Enum AttributeType Boolean Date String End Enum MustInherit Class Attibute Must Override Function Type As AttributeType End Class Class BooleanAttribute: Attribute Function Type As AttributeType Return AttributeType.Boolean End Function End Class And the view contains some code like: Select Case AttributeType Case Boolean //Display checkbox control Case Date //Display date picker control Case String //Display textbox control End Select I don't really like the code in the view, for the hopefully obvious reasons (what happens when I get a new attribute type etc). My question is, how should I replace it? I could easily add a method to the concrete classes, but that pollutes the model with UI stuff so that's a horrible idea. I could move the select into a factory, but that seems to be just hiding the problem. Can anybody advise a better approach?

    Read the article

  • Entity Framework 4.0 - Code only Reference

    - by joe
    Hello All, I am trying to learn EF 4 and its code only features. I tried the following great articles and was able to make a sample application. http://blogs.taiga.nl/martijn/2009/11/22/entity-framework-4-0-a-fresh-start-with-demo-application/#reply http://blogs.msdn.com/efdesign/archive/2009/10/12/code-only-further-enhancements.aspx But I am looking for a good reference library / website on Code only feature. I tried searching MSDN but couldn't find it. Please help. Thanks a lot.

    Read the article

  • Windows batch/script code to conditionally process based on date value in text file

    - by CarolinaJay65
    I am using Windows XP. The code can be used in a batch file or vbs script. I intend to use Windows scheduler to run the program. I need code to read a date from a text file (could be the only line in the text file or the date could be included in the filename, I control the process that generates the file) The code would then need to evaluate the text file date against the current date to confirm that the text file date is from the prior month. I'm starting to build a process to be able to run 1st-of-the-month jobs once the monthly data has been refreshed. I'm new to building this kind of process using batch/script files. Thanks for your time

    Read the article

  • is this code correct? [closed]

    - by davit-datuashvili
    hi i have poste this code from this title http://stackoverflow.com/questions/2896363/hi-i-have-question-here-is-pseudo-code-about-sift-up-and-sift-down-on-heaps i have following code of siftup on heap is it correct?i have put here because i have changed at old place my question and it became unreadable so i have posted here public class siftup{ public static void main(String[]args){ int p; int n=12; int a[]=new int[]{15,20,12,29,23,17,22,35,40,26,51,19}; int i=n-1; while (i!=0){ if (i==1) break; p=i/2; if (a[p]<=a[i]){ int t=a[p]; a[p]=a[i]; a[i]=t; } i=p; } for (int j=0;j<n;j++){ System.out.println(a[j]); } } } //result is this 15 20 19 29 23 12 22 35 40 26 51 17 is it correct?

    Read the article

  • WCF service code in window application

    - by Mariya
    Hello, I am using C#.net application code. I require to call service for Window Application and i am using below code to open service Host, using (ServiceHost host = new ServiceHost( typeof(class1), new Uri[] { new Uri("net.pipe://localhost") }) ) { } & Then we have clinet Console application to connect to serviceHost. Problem is, When i create service/Client application Using Conslole Application both are working fine. But if i call servide code form Window application to connect to console client it gives Error for Binding Error like("No End Point/Address found to test") Can any one help me to run service from C# window application ? Thanks

    Read the article

  • Change Text on Landscape mode with Java Code and not XML (Android)

    - by Chowza
    I wrote my layout entirely in java code because it was just more convenient. (I had a lot of textViews and using for statements were more convenient). However, my TextViews require the day of the week and in portrait mode, I would like to cut the day of the week to a short form. For example, I want "Sunday" to show "Sun" for portrait mode, but "Sunday" for landscape mode. I understand how to do this in XML files, but how do I do it in code? I.e. sample code: LinearLayout parent = new LinearLayout(getApplicationContext()); parent.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT)); TextView example = new TextView; example.setLayoutParams(mparams); example.setText("Sunday"); //<--make this "Sun" when in portrait but "Sunday" in landscape parent.addView(example);

    Read the article

  • Ternary operator or chosing from two arrays with the boolean as index

    - by ajax333221
    Which of these lines is more understandable, faster jsPerf, easier to maintain?: arr = bol ? [[-2,1],[-1,2]] : [[-1,0],[-1,1]]; //or arr = [[[-1,0],[-1,1]], [[-2,1],[-1,2]]][bol*1]; I usually write code for computers (not for humans), but this is starting to be a problem when I am not the only one maintaining the code and work for a team. I am unsure, the first example looks neat but are two different arrays, and the second is a single array and seem to transmit what is being done easier. I also considered using an if-else, but I don't like the idea of writing two arr = .... Or are there better options? I need serious guidance, I have never worried about others seeing my code.

    Read the article

< Previous Page | 116 117 118 119 120 121 122 123 124 125 126 127  | Next Page >