Search Results

Search found 2013 results on 81 pages for 'matt lewis'.

Page 62/81 | < Previous Page | 58 59 60 61 62 63 64 65 66 67 68 69  | Next Page >

  • Minutia on Objective-C Categories and Extensions.

    - by Matt Wilding
    I learned something new while trying to figure out why my readwrite property declared in a private Category wasn't generating a setter. It was because my Category was named: // .m @interface MyClass (private) @property (readwrite, copy) NSArray* myProperty; @end Changing it to: // .m @interface MyClass () @property (readwrite, copy) NSArray* myProperty; @end and my setter is synthesized. I now know that Class Extension is not just another name for an anonymous Category. Leaving a Category unnamed causes it to morph into a different beast: one that now gives compile-time method implementation enforcement and allows you to add ivars. I now understand the general philosophies underlying each of these: Categories are generally used to add methods to any class at runtime, and Class Extensions are generally used to enforce private API implementation and add ivars. I accept this. But there are trifles that confuse me. First, at a hight level: Why differentiate like this? These concepts seem like similar ideas that can't decide if they are the same, or different concepts. If they are the same, I would expect the exact same things to be possible using a Category with no name as is with a named Category (which they are not). If they are different, (which they are) I would expect a greater syntactical disparity between the two. It seems odd to say, "Oh, by the way, to implement a Class Extension, just write a Category, but leave out the name. It magically changes." Second, on the topic of compile time enforcement: If you can't add properties in a named Category, why does doing so convince the compiler that you did just that? To clarify, I'll illustrate with my example. I can declare a readonly property in the header file: // .h @interface MyClass : NSObject @property (readonly, copy) NSString* myString; @end Now, I want to head over to the implementation file and give myself private readwrite access to the property. If I do it correctly: // .m @interface MyClass () @property (readonly, copy) NSString* myString; @end I get a warning when I don't synthesize, and when I do, I can set the property and everything is peachy. But, frustratingly, if I happen to be slightly misguided about the difference between Category and Class Extension and I try: // .m @interface MyClass (private) @property (readonly, copy) NSString* myString; @end The compiler is completely pacified into thinking that the property is readwrite. I get no warning, and not even the nice compile error "Object cannot be set - either readonly property or no setter found" upon setting myString that I would had I not declared the readwrite property in the Category. I just get the "Does not respond to selector" exception at runtime. If adding ivars and properties is not supported by (named) Categories, is it too much to ask that the compiler play by the same rules? Am I missing some grand design philosophy?

    Read the article

  • Is there a way to give a subquery an alias in Oracle 10g SQL?

    - by Matt Pascoe
    Is there a way to give a subquery in Oracle 11g an alias like: select * from (select client_ref_id, request from some_table where message_type = 1) abc, (select client_ref_id, response from some_table where message_type = 2) defg where abc.client_ref_id = def.client_ref_id; Otherwise is there a way to join the two subqueries based on the client_ref_id. I realize there is a self join, but on the database I am running on a self join can take up to 5 min to complete (there is some extra logic in the actual query I am running but I have determined the self join is what is causing the issue). The individual subqueries only take a few seconds to complete by them selves. The self join query looks something like: select st.request, st1.request from some_table st, some_table st1 where st.client_ref_id = st1.client_ref_id;

    Read the article

  • Format Text Field While User Enters Data

    - by Matt
    Hello, so here is what I am trying to do. I have a birth date text field, while the user in puts text i want the field to automatically put it in the form YYYY-MM-DD. Basically while the user types it replaces the Y's M's and D's but leaves the hyphen. I am not sure how to go about this i may need a mask or something. I know this is where some of the formatting can be done - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{ Any help would be of much help

    Read the article

  • Build Path issue with Java Android project when starting Eclipse

    - by Matt Smith
    I booted up eclipse to start on a project, and without typing in a word I already have several errors. package department.namespace; import android.app.Activity; import android.os.Bundle; public class DepartmentActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } } At package department.namespace, it says: multiple marks at this line and the type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files The import android.os cannot be resolved. Override cannot be resolved as a type The method OnCreate(Bundle) is undefined for the type Activity R. cannot be resolved as a variable. Since this JUST came up when I started Eclipse, how do I fix this?

    Read the article

  • WinForm-style Invoke() in unmanaged C++

    - by Matt Green
    I've been playing with a DataBus-type design for a hobby project, and I ran into an issue. Back-end components need to notify the UI that something has happened. My implementation of the bus delivers the messages synchronously with respect to the sender. In other words, when you call Send(), the method blocks until all the handlers have called. (This allows callers to use stack memory management for event objects.) However, consider the case where an event handler updates the GUI in response to an event. If the handler is called, and the message sender lives on another thread, then the handler cannot update the GUI due to Win32's GUI elements having thread affinity. More dynamic platforms such as .NET allow you to handle this by calling a special Invoke() method to move the method call (and the arguments) to the UI thread. I'm guessing they use the .NET parking window or the like for these sorts of things. A morbid curiosity was born: can we do this in C++, even if we limit the scope of the problem? Can we make it nicer than existing solutions? I know Qt does something similar with the moveToThread() function. By nicer, I'll mention that I'm specifically trying to avoid code of the following form: if(! this->IsUIThread()) { Invoke(MainWindowPresenter::OnTracksAdded, e); return; } being at the top of every UI method. This dance was common in WinForms when dealing with this issue. I think this sort of concern should be isolated from the domain-specific code and a wrapper object made to deal with it. My implementation consists of: DeferredFunction - functor that stores the target method in a FastDelegate, and deep copies the single event argument. This is the object that is sent across thread boundaries. UIEventHandler - responsible for dispatching a single event from the bus. When the Execute() method is called, it checks the thread ID. If it does not match the UI thread ID (set at construction time), a DeferredFunction is allocated on the heap with the instance, method, and event argument. A pointer to it is sent to the UI thread via PostThreadMessage(). Finally, a hook function for the thread's message pump is used to call the DeferredFunction and de-allocate it. Alternatively, I can use a message loop filter, since my UI framework (WTL) supports them. Ultimately, is this a good idea? The whole message hooking thing makes me leery. The intent is certainly noble, but are there are any pitfalls I should know about? Or is there an easier way to do this?

    Read the article

  • Can any language potentially be used to create any program?

    - by Matt
    I've heard that given a programmer with enough time and skill in any particular language and enough lines of code, then any program could be created with any given language. I know its certainly not going to be cost-efficient, for instance, to rewrite Adobe Photoshop in BASIC, but could a good enough and patient enough programmer potentially create any program in any language?

    Read the article

  • Java Class<T> static method forName() IncompatibleClassChangeError

    - by matt
    Hi, i have this code: private static Importable getRightInstance(String s) throws Exception { Class<? extends Importable> c = Class.forName(s).asSubclass(Importable.class); Importable i = c.newInstance(); return i; } which i can also write private static Importable getRightInstance(String s) throws Exception { Class<? extends Importable> c = (Class<? extends Importable>)Class.forName(s); Importable i = c.newInstance(); return i; } or private static Importable getRightInstance(String s) throws Exception { Class<?> c = Class.forName(s); Importable i = (Importable)c.newInstance(); return i; } where Importable is an interface and s is a string representing an implementing class. Well, in any case it gives the following: Exception in thread "main" java.lang.IncompatibleClassChangeError: class C1 has interface Importable as super class Here is the last snippet of the stack trace: at java.lang.Class.forName(Class.java:169) at Importer.getRightImportable(Importer.java:33) at Importer.importAll(Importer.java:44) at Test.main(Test.java:16) Now, class C1 actually implemens Importable and i totally don't understand why it complaints. Thanks in advance.

    Read the article

  • How would I implement separate databases for reading and writing operations?

    - by Matt
    I am interested in implementing an architecture that has two databases one for read operations and the other for writes. I have never implemented something like this and have always built single database, highly normalised systems so I am not quite sure where to begin. I have a few parts to this question. 1. What would be a good resource to find out more about this achitecture? 2. Is it just a question of replicating between two identical schemas, or would your schemas differ depending on the operations, would normalisation vary too? 3. How do you insure that data written to one database is immediately available for reading from the second? Any further help, tips, resources would be appreciated. Thanks.

    Read the article

  • How is this inupt tag linking to another page?

    - by Matt
    Response.Write("<div><input type='submit' name='submit' value='Update Cart' /></div>") Response.Write("<div><input type='submit' name='submit' value='Shop More' /></div>") Response.Write("<div><input type='submit' name='submit' value='Checkout' /></div>") that is some example code from my teacher, but he hasn't answered my email in a couple days so I need some help. When you click the Update Cart button it just updates the cart page it's on, but when you click the Shop More button it links to Shop.aspx a different page, and the Checkout links to another page as well. I can't figure out how it is linking just from that code, anybody have any insights?

    Read the article

  • IPhone: different system timers??

    - by matt
    I have been using mach_absolute_time() for all my timing functions so far. calculating how long between frames ect. I now want to get the exact time touch input events happen using event.timestamp in the touch callbacks. the problem is these two seem to use completely different timers. sure, you can get them both in seconds, but their origins are different and seemingly random... is there any way to sync the two different timers? or is there anyway to get access to the same timer that the touch input uses to generate that timestamp property? otherwise its next to useless.

    Read the article

  • JQuery Toggle which disables other links

    - by Matt Jameson
    Is there a way of disabling another link, the re-enabling them with the toggle function. here is my script so far. I would like to disable 'military' when I've clicked on 'Entertainment', but then re enable the link when the toggle returns. $("[href='#Entertainment']").click(function () { $("#Entertainment").toggle("slow"); }); $("[href='#Military']").click(function () { $("#Military").toggle("slow"); }); Is there anyway of doing this?

    Read the article

  • Turn off Jquery UI Accordion animation only during page load

    - by Matt H
    I'd like to turn off the accordian animation during page load, and then turn it back on after the page is loaded. Basically I've got multiple forms inside the accordion sections and when submitted the page gets reloaded and the relevant section is reloaded. But during the reload the animation is triggered which looks a little ugly. But I like it when the page is not being loaded. How do I achieve this effect?

    Read the article

  • In C# how can I serialize a List<int> to a byte[] in order to store it in a DB field?

    - by Matt
    In C# how can I serialize a List to a byte[] in order to store it in a DB field? I know how to serialize to a file on the disk, but how do I just serialize to a variable? Here is how I serialized to the disk: List<int> l = IenumerableofInts.ToList(); Stream s = File.OpenWrite("file.bin"); BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(s, lR); s.Close(); I'm sure it's much the same but I just can't wrap my head around it.

    Read the article

  • Safe to cast pointer to a forward-declared class to its true base class in C++?

    - by Matt DiMeo
    In one header file I have: #include "BaseClass.h" // a forward declaration of DerivedClass, which extends class BaseClass. class DerivedClass ; class Foo { DerivedClass *derived ; void someMethod() { // this is the cast I'm worried about. ((BaseClass*)derived)->baseClassMethod() ; } }; Now, DerivedClass is (in its own header file) derived from BaseClass, but the compiler doesn't know that at the time it's reading the definition above for class Foo. However, Foo refers to DerivedClass pointers and DerivedClass refers to Foo pointers, so they can't both know each other's declaration. First question is whether it's safe (according to C++ spec, not in any given compiler) to cast a derived class pointer to its base class pointer type in the absence of a full definition of the derived class. Second question is whether there's a better approach. I'm aware I could move someMethod()'s body out of the class definition, but in this case it's important that it be inlined (part of an actual, measured hotspot - I'm not guessing).

    Read the article

  • JQuery SimpleModal

    - by Matt
    I've got a submit button inside my modal, and when it's pressed nothing happens! How do I make my form submit when the push my submit button? I don't want to use $('form').submit(); because then php doesn't detect that my button was clicked. <script type="text/javascript" language="javascript"> $(document).ready(function () { $('#btnAdd').click(function (e) { //clicking the button shows the modal popup up e.preventDefault(); $('#AddCareerItem').modal(); }); $('#btnCancelCareerContent').click(function (e) { //close the modal with the cancel button $.modal.close(); }); }); </script>

    Read the article

  • How do you tell if a string contains another string in Unix shell scripting?

    - by Matt
    Hi all, I want to write a Unix shell script that will do various logic if there is a string inside of another string. For example, if I am in a certain folder, branch off. Could someone please tell me how to accomplish this? If possible I would like to make this not shell specific (i.e. not bash only) but if there's no other way I can make do with that. #!/bin/sh CURRENT_DIR=`pwd` if [ CURRENT_DIR contains "String1" ] then echo "String1 present" elif [ CURRENT_DIR contains "String1" ] then echo "String2 present" else echo "Else" fi

    Read the article

  • Play local video with an HTML/Javascript based Adobe Air application

    - by Matt Wood
    I'm trying to add some video playback (that will be used for a tutorial) to my Adobe Air application. I'm not a Flex or Flash developer and my application is HTML/Javascript based, so I'm having trouble with some of the video solutions I've been able to find. Here is one of the examples I've found that is flex based: Playing local files with Air I've looked for a free flash video player that I could just embed. But the only one I've found I was unable to coerce to play files from my Air application directory. I was exited at the prospect of using the HTML5 video tag which I thought Air supported, but that also seems to not work. Can anyone recommend a free flash video player that I can embed? Or a solution that doesn't have to be built completely from flex?

    Read the article

  • Calling function after .load (Jquery)

    - by Matt
    Having a little difficulty getting a function to call after a .load: $(function(){ $('a.pageFetcher').click(function(){ $('#main').load($(this).attr('rel')); }); }); The page loads, but the functions don't fire: $(function(){ var $container = $('#container'); $container.imagesLoaded(function(){ $container.masonry({ itemSelector: '.box', }); }); $container.infinitescroll({ navSelector : '#page-nav', nextSelector : '#page-nav a', itemSelector : '.box', loading: { finishedMsg: 'Nothing else to load.', img: 'http://i.imgur.com/6RMhx.gif' } }, function( newElements ) { $.superbox.settings = { closeTxt: "Close this", loadTxt: "Loading your selection", nextTxt: "Next item", prevTxt: "Previous item" }; $.superbox(); var $newElems = $( newElements ).css({ opacity: 0 }); $newElems.imagesLoaded(function(){ $newElems.animate({ opacity: 1 }); $container.masonry( 'appended', $newElems, true ); }); } ); }); I've attempted to combine them so that the 2nd functions are called after .load (after doing some searching on this site and looking at given answers/examples) but nothing seems to work properly. Suggestions?

    Read the article

  • Get local network interface addresses using only proc?

    - by Matt Joiner
    How can I obtain the (IPv4) addresses for all network interfaces using only proc? After some extensive investigation I've discovered the following: ifconfig makes use of SIOCGIFADDR, which requires open sockets and advance knowledge of all the interface names. It also isn't documented in any manual pages on Linux. proc contains /proc/net/dev, but this is a list of interface statistics. proc contains /proc/net/if_inet6, which is exactly what I need but for IPv6. Generally interfaces are easy to find in proc, but actual addresses are very rarely used except where explicitly part of some connection. There's a system call called getifaddrs, which is very much a "magical" function you'd expect to see in Windows. It's also implemented on BSD. However it's not very text-oriented, which makes it difficult to use from non-C languages.

    Read the article

  • Java: Generating distribution of values in an ArrayList

    - by Matt
    Hi all, I have a sorted ArrayList of values. I would like to get the distribution of the values. For example: Say I have 500 values, ranging from 1-100. I want to break them up into groups, say 10 groups: values 1-10, 11-20, 21-30, etc... I want the counts of each of the 500 values that fall into each category. For example, 5 of the 500 are valued at 1-10, 20 between 11-20, etc... However, I do not know the ranges of values in my ArrayList, it could be ranging from 1-30 or 1-200, but I want to break it up into, for example, 10 groups. Does anyone know how to do this?

    Read the article

  • Is there a way to give a subquery an alias in Oracle 11g SQL?

    - by Matt Pascoe
    Is there a way to give a subquery in Oracle 11g an alias like: select * from (select client_ref_id, request from some_table where message_type = 1) abc, (select client_ref_id, response from some_table where message_type = 2) defg where abc.client_ref_id = def.client_ref_id; Otherwise is there a way to join the two subqueries based on the client_ref_id. I realize there is a self join, but on the database I am running on a self join can take up to 5 min to complete (there is some extra logic in the actual query I am running but I have determined the self join is what is causing the issue). The individual subqueries only take a few seconds to complete by them selves. The self join query looks something like: select st.request, st1.request from some_table st, some_table st1 where st.client_ref_id = st1.client_ref_id;

    Read the article

  • xml schema ........

    - by matt
    ive made an xml schema all the code basically and was wonder is there a way that the code genarates something like this http://www.novell.com/documentation/extend52/Docs/help/Director/books/PGImages/novell_portlet_xml_schema.gif and if i can then how do you do it?

    Read the article

< Previous Page | 58 59 60 61 62 63 64 65 66 67 68 69  | Next Page >