Search Results

Search found 332 results on 14 pages for 'jash jacob'.

Page 10/14 | < Previous Page | 6 7 8 9 10 11 12 13 14  | Next Page >

  • NSMutableSet addObject question

    - by Jacob Relkin
    I've got a class that wraps around an NSMutableSet object, and I have an instance method that adds objects (using the addObject: method) to the NSMutableSet. This works well, but I'm smelling a performance hitch because inside the method i'm explicitly calling containsObject: before adding the object to the set. Three part question: Do I need to be calling containsObject: before I add an object to the set? If so, then what actual method should I be using, containsObject or containsObjectIdenticalTo:? If that is not so, what contains method gets invoked under the hood of addObject:? This is important to me because if I pass an object to containsObject: it would return true, but if I pass it to containsObjectIdenticalTo: it would return false.

    Read the article

  • How to improve efficiency in loops?

    - by Jacob Worldly
    I have the following code, which translates the input string into morse code. My code runs through every letter in the string and then through every character in the alphabet. This is very inefficient, because what if I was reading from a very large file, instead of a small alphabet string. Is there any way that I could improve my code, Maybe using the module re, to match my string with the morse code characters? morse_alphabet = ".- -... -.-. -.. . ..-. --. .... .. .--- -.- .-.. -- -. --- .--. --.- .-. ... - ..- ...- .-- -..- -.-- --.." ALPHABET = "abcdefghijklmnopqrstuvwxyz" morse_letters = morse_alphabet.split(" ") result = [] count_character = 0 def t(code): for character in code: count_letter = 0 for letter in ALPHABET: lower_character = code[count_character].lower() lower_letter = letter.lower() if lower_character == lower_letter: result.append(morse_letters[count_letter]) count_letter += 1 count_character += 1 return result

    Read the article

  • SQL Time(2) to Array in C#?

    - by Jacob Huggart
    Hello all, I am using ASP MVC and SQL Server and I have a database that is updated intermittently with expected wait times for some event. Also, I am using some ajax and jquery. I need to display the average and maximum wait times. How can I take the entire list of time from the server and get the average time? Also, what would be the best method to simply grab a new time from the server when it is updated without having to pull the whole list again? Thanks!

    Read the article

  • Clean way to combine multiple jars? Preferably using ant

    - by Jacob
    I have runtime dependencies on some external jars that I would like to "rejar" into a single jar. These external dependencies are stored in a external_jars directory, and I'd like to be able to not have to list each one out (e.g., to not need to change my build scripts if my dependencies change). Any thoughts? Google gave me a good answer on how to do this if you don't mind listing out each jar you want as a dependency: http://markmail.org/message/zijbwm46maxzzoo5 Roughly, I want something along the lines of the following, which would combine all jars in lib into out.jar (with some sane overwrite rules). jar -combine -out out.jar -in lib/*.jar

    Read the article

  • Create a dynamic control and AddHandle WITH Values/Brackets

    - by Jacob Kofoed
    Hi, it seems that adding for example a button Dim myButton as New Button and then addHandler to mySub("lol", 255) is not possible. Where mySub is Shared Sub MySub(byRef myString as string, myInteger as Integer) So: addHandler myButton.click, addressOf mySub("lol", 255) - returns an error saying it does not work with parentheses or whatever. I somehow see why this might not be possible, so I'm looking for a work-around on this problem. Please help _jakeCake

    Read the article

  • Function pointers to member functions

    - by Jacob
    There are several duplicates of this but nobody explains why I can use a member variable to store the pointer (in FOO) but when I try it with a local variable (in the commented portion of BAR), it's illegal. Could anybody explain this? #include <iostream> using namespace std; class FOO { public: int (FOO::*fptr)(int a, int b); int add_stuff(int a, int b) { return a+b; } void call_adder(int a, int b) { fptr = &FOO::add_stuff; cout<<(this->*fptr)(a,b)<<endl; } }; class BAR { public: int add_stuff(int a, int b) { return a+b; } void call_adder(int a, int b) { //int (BAR::*fptr)(int a, int b); //fptr = &BAR::add_stuff; //cout<<(*fptr)(a,b)<<endl; } }; int main() { FOO test; test.call_adder(10,20); return 0; }

    Read the article

  • Learning JavaScript - What is the BEST ONLINE RESOURCE?

    - by Chris Jacob
    The Goal: Use votes to rank nominated sites. The first answer to reach 100+ votes will be accepted. Please answer following these 5 simple rules: ONE SITE per answer. Link to each page if nominating a "series" of resources on a SITE. No "offline" books. Only online resources (tutorials, API references, blogs, screencasts, etc). Don't add "subjective" details/notes in your answer. Add them as a comment to the answer. Don't post duplicates. If your favourite is already listed Up Vote It! Example Answer: Site Name http://www.example.com Example Answer (site with a series of resources): Site Name http://www.example.com Series Name A http://www.example.com/video/a/1 http://www.example.com/video/a/2 Series Name B http://www.example.com/video/b/1

    Read the article

  • Can I create many tables according to the same entity?

    - by jacob
    What I want to do is that I want to make the many tables dinamically which are the same entity structures. And then I want to refer to the dinamically created tables according to the table name. What I understood from hibernate reference is that I can only create only one table and it should be matched exactly with entity. So I can't find any solution to my problem. If you know any relevent open source related to my problem or any tip or web site, let me know. Thanks allways

    Read the article

  • Open + Save .exe file in notepad makes it corrupted

    - by Jacob Kofoed
    Hi, I just published this simple console application that is supposed to show a textbox with the value of a setting called "userID" with value 1001. This works like a charm. Now what I need is to change this value outside the editor, from notepad etc. When I open the application a lot in there is non-sence (& o! -å Þþþ,o" Ü+) etc. but with a quick (ctrl + F) I found the value 1001, and changed this to some other integer. I ran the application again, and it failed, didn't even give any userful error-message. At a point I tried just opening a newly published non-corrupted version of the application, didn't change anything, then saved from notepad, and it were also corrupted. It seems like notepad can't open some characters or something. Do I need to publish the application in some specific text-unicode language or something? Help much appreciated :) I know it sounds like a stupid application, but it is just a test of concept :) I use vb.net for this

    Read the article

  • Creating an object in the loop

    - by Jacob
    std::vector<double> C(4); for(int i = 0; i < 1000;++i) for(int j = 0; j < 2000; ++j) { C[0] = 1.0; C[1] = 1.0; C[2] = 1.0; C[3] = 1.0; } is much faster than for(int i = 0; i < 1000;++i) for(int j = 0; j < 2000; ++j) { std::vector<double> C(4); C[0] = 1.0; C[1] = 1.0; C[2] = 1.0; C[3] = 1.0; } I realize this happens because std::vector is repeatedly being created and instantiated in the loop, but I was under the impression this would be optimized away. Is it completely wrong to keep variables local in a loop whenever possible? I was under the (perhaps false) impression that this would provide optimization opportunities for the compiler. EDIT: I use VC++2005 (release mode) with full optimization (/Ox)

    Read the article

  • What real life bad habits has programming given you? [closed]

    - by Jacob T. Nielsen
    Programming has given me a lot of bad habits and it continues to give me more everyday. But I have also gotten some bad habits from the mindset that I have put myself in. There simply are some things that are deeply rooted in my nature, though some of them I wish I could get rid of. A few: Looking for polymorphism, inheritance and patterns in all of God's creations. Explaining the size of something in pixels and colors in hex code. Using code related abstract terms in everyday conversations. How have you been damaged?

    Read the article

  • UITextfield check if its a number

    - by Jacob
    Hi, How can I check if a user enters a number in my UITextField. Basically its a mark im accepting between 0-100 and it can be a decimal....I heard i can try to convert it to a NSNumber type and see if it returns null. Not suree Any help would be appreciated. I have tried if(grade.text doubleValue] == 0){ //Not a number } but then it still can accept "23f". Thanks

    Read the article

  • Global mouseMove

    - by Jacob Kofoed
    I have made the following javascript to be used in my jQuery based website. What it does, is to move a slider up/down, and scale the item above higher/smaller. Everything works fine, but since the slider is only a few pixels in height, and the move event is a bit slow (it does not trigger for every pixel) so when I move the mouse fast, the slider can't hold on and the mouse get's out of the slider item. The mouseMove event won't be triggered no more since it is bound to the slider. I guess everything could be fixed by setting the mouseMove global to the whole site, but it won't work, or at least I don't know how to make that work. Should it be bound to document, or body? here is my current code for the slider: $.fn.resize = function (itemToResize) { MinSize = 100; MaxSize = 800; pageYstart = 0; sliderMoveing = false; nuskriverHeight = 0; this.mousedown(function(e) { pageYstart=e.pageY; sliderMoveing = true nuskriverHeight = parseFloat((itemToResize).css('height')); }); this.mouseup(function() { sliderMoveing = false }); this.mousemove(function(e) { if (sliderMoveing) { (itemToResize).css('height', (nuskriverHeight + (e.pageY - pageYstart))); if (parseFloat( (itemToResize).css('height')) > MaxSize) { (itemToResize).css('height', MaxSize) }; if (parseFloat( (itemToResize).css('height')) < MinSize) { (itemToResize).css('height', MinSize) }; }; }); }; Thanks for any help, is much appreciated

    Read the article

  • Fast (de)serialization on iPhone

    - by Jacob Kuypers
    I'm developing a game/engine for iPhone OS. It's the first time I'm using Objective-C. I made my own binary format for geometry data and for textures I'm focusing on PVRTC. That should be the optimal approach as far as speed and space are concerned. I really want to keep loading time to a minimum and - if possible - be able to save very fast as well. So now I'm trying to make my "Entity" stuff persistent without sacrificing performance. First I wanted to use NSKeyedArchiver. From what I've heard, it's not very fast. Also, what I want to serialize is mostly structs made of floats with some ints and strings, so there isn't really a need for all that "object graph" overhead. NSArchiver would have been more appropriate, but they kicked that off the iphone for some reason. So now I'm thinking about making my own serialization scheme again. Am I wrong in thinking that NSKeyedArchiver is slow (I only read that, haven't tested it myself)? If so, what's the best way to encode/decode structs (with no pointers, mostly floats) without sacrificing speed?

    Read the article

  • Using jQuery, how to modify text outside of tags?

    - by Jacob
    Given a string of text that is both adjacent to a span and inside of a div, what are some methods to modify just that text, leaving the surrounding HTML intact? For example: <div id="my-div">modify this text<span id="my-span"></span></div> I have tried things like $('#my-div').html(function(i, elem){blah;}); but this seems to cause the span to be deleted and a new span to be added, because some styling is lost. I realize that it would be best to wrap the text string in its own HTML tags before applying client-side code, but that is out of my control.

    Read the article

  • "Right" way to deallocate an std::vector object

    - by Jacob
    The first solution is: std::vector<int> *vec = new std::vector<int>; assert(vec != NULL); // ... delete vec; An alternative is: std::vector<int> v; //... vec.clear(); vec.swap(std::vector<int>(vec)); The second solution's a bit of a trick --- what's the "right" way to do it?

    Read the article

  • C++ and C#, "Casting" Functions to Delegates, What's the scoop?

    - by Jacob G
    In C# 2.0, I can do the following: public class MyClass { delegate void MyDelegate(int myParam); public MyClass(OtherObject obj) { //THIS IS THE IMPORTANT PART obj.SomeCollection.Add((MyDelegate)MyFunction); } private void MyFunction(int myParam); { //... } } Trying to implement the same thing in C++, it appears I have to do: MyDelegate del = gcnew MyDelegate(this, MyFunction); obj-SomeCollection-Add(del); Obviously I can create a new instance of the delegate in C# as well instead of what's going on up there. Is there some kind of magic going on in the C# world that doesn't exist in C++ that allows that cast to work? Some kind of magic anonymous delegate? Thanks.

    Read the article

  • Learning HTML - What is the BEST ONLINE RESOURCE?

    - by Chris Jacob
    The Goal: Use votes to rank nominated sites. The first answer to reach 100+ votes will be accepted. Please answer following these 5 simple rules: ONE SITE per answer. Link to each page if nominating a "series" of resources on a SITE. No "offline" books. Only online resources (tutorials, API references, blogs, screencasts, etc). Don't add "subjective" details/notes in your answer. Add them as a comment to the answer. Don't post duplicates. If your favourite is already listed Up Vote It! Example Answer: Site Name http://www.example.com Example Answer (site with a series of resources): Site Name http://www.example.com Series Name A http://www.example.com/video/a/1 http://www.example.com/video/a/2 Series Name B http://www.example.com/video/b/1

    Read the article

  • arrayListOutOfBoundsException... Please Help?

    - by Jacob
    This is my class Debugger. Can anyone try and run it and see whens wrong? Ive spent hours on it already. :( public class Debugger { private String codeToDebug = ""; public Debugger(String code) { codeToDebug = code; } /** * This method itterates over a css file and adds all the properties to an arraylist */ public void searchDuplicates() { boolean isInside = false; ArrayList<String> methodStorage = new ArrayList(); int stored = 0; String[] codeArray = codeToDebug.split(""); try { int i = 0; while(i<codeArray.length) { if(codeArray[i].equals("}")) { isInside = false; } if(isInside && !codeArray[i].equals(" ")) { boolean methodFound = false; String method = ""; int c = i; while(!methodFound) { method += codeArray[c]; if(codeArray[c+1].equals(":")) { methodFound = true; } else { c++; } } methodStorage.add(stored, method); System.out.println(methodStorage.get(stored)); stored++; boolean stillInside = true; int skip = i; while(stillInside) { if(codeArray[skip].equals(";")) { stillInside = false; } else { skip++; } } i = skip; } if(codeArray[i].equals("{")) { isInside = true; } i++; } } catch(ArrayIndexOutOfBoundsException ar) { System.out.println("------- array out of bounds exception -------"); } } /** * Takes in String and outputs the number of characters it contains * @param input * @return Number of characters */ public static int countString(String input) { String[] words = input.split(""); int counter = -1; for(int i = 0; i<words.length; i++){ counter++; } return counter; } public static void main(String[] args) { Debugger h = new Debugger("body {margin:;\n}"); h.searchDuplicates(); } }

    Read the article

  • Apply [ThreadStatic] attribute to a method in external assembly

    - by Sen Jacob
    Can I use an external assembly's static method like [ThreadStatic] method? Here is my situation. The assembly class (which I do not have access to its source) has this structure public class RegistrationManager() { private RegistrationManager() {} public static void RegisterConfiguration(int ID) {} public static object DoWork() {} public static void UnregisterConfiguration(int ID) {} } Once registered, I cannot call the DoWork() with a different ID without unregistering the previously registered one. Actually I want to call the DoWork() method with different IDs simultaneously with multi-threading. If the RegisterConfiguration(int ID) method was [ThreadStatic], I could have call it in different threads without problems with calls, right? So, can I apply the [ThreadStatic] attribute to this method or is there any other way I can call the two static methods same time without waiting for other thread to unregister it? If I check it like the following, it should work. for(int i=0; i < 10; i++) { new Thread(new ThreadStart(() => Checker(i))).Start(); } public string Checker(int i) { public static void RegisterConfiguration(i); // Now i cannot register second time public static object DoWork(i); Thread.Sleep(5000); // DoWork() may take a little while to complete before unregistered public static void UnregisterConfiguration(i); }

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14  | Next Page >