Search Results

Search found 7418 results on 297 pages for 'argument passing'.

Page 57/297 | < Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >

  • How to use AOP to intercept a method call in super on an argument?

    - by hleinone
    I'm extending a class and overriding a method. All I want to do is to call super, but with a modified argument that gets intercepted upon one of its methods is called. An example makes it more clear: // Foo is an interface and also this method is part of an interface @Override public void foo(Foo foo) { // I want to intercept the call to foo.bar() in super super.foo(foo); } I'd rather use a tool that doesn't require a compiler of its own. What would be the optimal one?

    Read the article

  • How can I identify an argument as a year in Perl?

    - by dexter
    I have created a file argument.pl which takes several arguments first of which should be in form of a year For example: 2010 23 type. Here 2010 is a year my code does something like: use strict; use warning use Date::Calc qw(:all); my ($startyear, $startmonth, $startday) = Today(); my $weekofyear = (Week_of_Year ($startyear,$startmonth,$startday))[0]; my $Year = $startyear; ... ... if ($ARGV[0]) { $Year = $ARGV[0]; } Here this code fills $Year with "current year" if $ARGV[0] is null or doesn't exist. now here instead of if ($ARGV[0]) Is it possible to check that the value in $ARGV[0] is a valid year (like 2010, 1976,1999 etc.)?

    Read the article

  • Python: When passing variables between methods, is it necessary to assign it a new name?

    - by Anthony
    I'm thinking that the answer is probably 'no' if the program is small and there are a lot of methods, but what about in a larger program? If I am going to be using one variable in multiple methods throughout the program, is it smarter to: Come up with a different phrasing for each method (to eliminate naming conflicts). Use the same name for each method (to eliminate confusion) Just use a global variable (to eliminate both) This is more of a stylistic question than anything else. What naming convention do YOU use when passing variables?

    Read the article

  • exclude private property from print_r or object?

    - by Hailwood
    Basically I am using Code Igniter, and the Code Igniter base class is huge, when I print_r some of my objects they have the base class embedded inside them. this makes it a pain to get the information I actually wanted (the rest of the properties). So, I am wondering if there is a way I can hide, or remove the base class object? I have tried clone $object; unset($object->ci); print_r($object); but of course the ci property is private. the actual function I am using for dumping is: /** * Outputs the given variables with formatting and location. Huge props * out to Phil Sturgeon for this one (http://philsturgeon.co.uk/blog/2010/09/power-dump-php-applications). * To use, pass in any number of variables as arguments. * Optional pass in "true" as final argument to kill script after dump * * @return void */ function dump() { list($callee) = debug_backtrace(); $arguments = func_get_args(); $total_arguments = count($arguments); if (end($arguments) === true) $total_arguments--; echo '<fieldset style="background: #fefefe !important; border:2px red solid; padding:5px">'; echo '<legend style="background:lightgrey; padding:5px;">' . $callee['file'] . ' @ line: ' . $callee['line'] . '</legend><pre>'; $i = 0; foreach ($arguments as $argument) { //if the last argument is true we don't want to display it. if ($i == ($total_arguments) && $argument === true) break; echo '<br/><strong>Debug #' . (++$i) . ' of ' . $total_arguments . '</strong>: '; if ((is_array($argument) || is_object($argument)) && count($argument)) { print_r($argument); } else { var_dump($argument); } } echo '</pre>' . PHP_EOL; echo '</fieldset>' . PHP_EOL; //if the very last argument is "true" then die if (end($arguments) === true) die('Killing Script'); }

    Read the article

  • Why does passing arguments to the command in an env invocation not work?

    - by timdisney
    I have a shell script to run node with some arguments like so: #!/usr/bin/env node --harmony_proxies ... This works fine under OS X but in Ubuntu it errors with: /usr/bin/env: node --harmony_proxies: No such file or directory Node is definitely installed and on the PATH since if I remove the --harmony_proxies flag it works fine. Is there some different way of passing arguments when using env in Ubuntu?

    Read the article

  • How to specialize a type parameterized argument to multiple different types for in Scala?

    - by jmount
    I need a back-check (please). In an article ( http://www.win-vector.com/blog/2010/06/automatic-differentiation-with-scala/ ) I just wrote I stated that it is my belief in Scala that you can not specify a function that takes an argument that is itself a function with an unbound type parameter. What I mean is you can write: def g(f:Array[Double]=>Double,Array[Double]):Double but you can not write something like: def g(f[Y]:Array[Y]=>Double,Array[Double]):Double because Y is not known. The intended use is that inside g() I will specialize fY to multiple different types at different times. You can write: def g[Y](f:Array[Y]=>Double,Array[Double]):Double but then f() is of a single type per call to g() (which is exactly what we do not want). However, you can get all of the equivalent functionality by using a trait extension instead insisting on passing around a function. What I advocated in my article was: 1) Creating a trait that imitates the structure of Scala's Function1 trait. Something like: abstract trait VectorFN { def apply[Y](x:Array[Y]):Y } 2) declaring def g(f:VectorFN,Double):Double (using the trait is the type). This works (people here on StackOverflow helped me find it, and I am happy with it)- but am I mis-representing Scala by missing an even better solution?

    Read the article

  • When using membership provider, do you use the user ID or the username?

    - by Chris
    I've come across this is in a couple of different applications that I've worked on. They all used the ASP.NET Membership Provider for user accounts and controlling access to certain areas, but when we've gotten down into the code I've noticed that in one we're passing around the string based user name, like "Ralph Waters", or we're passing around the Guid based user ID from the membership table. Now both seem to work. You can make methods which get by username, or get by user ID, but both have felt somewhat "funny". When you pass a string like "Ralph Waters" you're passing essentially two separate words that make up a unique identifier. And with a Guid, you're passing around a string/number combination which can be cast and made unique. So my question is this; when using Membership Provider, which do you use, the username or the user ID to get back to the user? Thanks all!

    Read the article

  • SHLoadImageFile(L"\\Program Files\\TrainingApp\\background.png"); whats that L in the argument for?

    - by ashishsony
    Hi, ive been working on c++ on linux for the past 2 years,and switched to windows c++ programming recently. can anyone tell me what that L is there in the argument of the function: SHLoadImageFile(L"\\Program Files\\TrainingApp\\background.png"); and on viewing certain sample code in MSVS C++ i came across hundereds of typedefs like.. LPARAM// typedef LONG_PTR LPARAM... here LONG_PTR is again typedef as __w64 long WPARAM// typedef UINT_PTR WPARAM... so there is a lot of chained typedefs.. I never saw this much of typedef chaining on c++ programming on linux using gcc.. what i want to say is that it just creates more confusion in this way for windows application programming.. while ive seen application programming on linux using frameworks like Qt.. there such things are rarely used.. so is there specific purpose in typedefining again and again on MSVSC++?? for eg.. there are typdefs like typedef int BOOL; whats the use of this when normal bool is available already..?? there are hundred other cases ive come across where just to decide what data type to use becomes so difficult.. it becomes difficult to understand a pre written code in this fashion too.. Thanks.

    Read the article

  • Why can't I pass an argument to create this window using wxpython?

    - by somefreakingguy
    I am trying to learn how to make a GUI in python! Following an online tutorial, I found that the following code 'works' in creating an empty window: import wx from sys import argv class bucky(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, parent, id, 'Frame aka window', size=(300, 200)) if __name__=='__main__': app=wx.PySimpleApp() frame=bucky(parent=None,id=-1) frame.Show() app.MainLoop() That gives me a window, which is great. However, what if I want to get an argument passed onto the program to determine the window size? I thought something like this ought to do the trick: import wx from sys import argv script, x, y = argv class mywindow(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, parent, id, 'Frame aka window', size=(x, y)) if __name__=='__main__': app=wx.PySimpleApp() frame=mywindow(parent=None,id=-1) frame.Show() app.MainLoop() But, alas, that does not work! Nor does the raw_input() function pass on the value. I keep getting the following error: C:/Python26/pythonw.exe -u "C:/Documents and Settings/Owner/Desktop/wz.py" File "C:/Documents and Settings/Owner/Desktop/wz.py", line 8 wx.Frame.__init__(self, parent, id, 'Frame aka window', size=(x y)) ^ SyntaxError: invalid syntax Thanks for the help!

    Read the article

  • How can I print the argument value that caused Exception in Java?

    - by Sanoj
    I am writing a parser for csv-files, and sometimes I get NumberFormatException. Is there an easy way to print the argument value that caused the exception? For the moment do I have many try-catch blocks that look like this: String ean; String price; try { builder.ean(Long.parseLong(ean)); } catch (NumberFormatException e) { System.out.println("EAN: " + ean); e.printStackTrace(); } try { builder.price(new BigDecimal(price)); } catch (NumberFormatException e) { System.out.println("Price: " + price); e.printStackTrace(); } I would like to be able to write something like: try { builder.ean(Long.parseLong(ean)); } catch (NumberFormatException e) { e.printMethod(); // Long.parseLong() e.printArgument(); // should print the string ean "99013241.23" e.printStackTrace(); } Is there any way that I at least can improve my code? And do this kind of printing/logging more programmatically?

    Read the article

  • Why can't I pass self as a named argument to an instance method in Python?

    - by Joseph Garvin
    This works: >>> def bar(x, y): ... print x, y ... >>> bar(y=3, x=1) 1 3 And this works: >>> class foo(object): ... def bar(self, x, y): ... print x, y ... >>> z = foo() >>> z.bar(y=3, x=1) 1 3 And even this works: >>> foo.bar(z, y=3, x=1) 1 3 But why doesn't this work? >>> foo.bar(self=z, y=3, x=1) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unbound method bar() must be called with foo instance as first argument (got nothing instead) This makes metaprogramming more difficult, because it requires special case handling. I'm curious if it's somehow necessary by Python's semantics or just an artifact of implementation.

    Read the article

  • What is the meaning of @ModelAttribute annotation at method argument level?

    - by beemaster
    Spring 3 reference teaches us: When you place it on a method parameter, @ModelAttribute maps a model attribute to the specific, annotated method parameter I don't understand this magic spell, because i sure that model object's alias (key value if using ModelMap as return type) passed to the View after executing of the request handler method. Therefore when request handler method executes the model object's name can't be mapped to the method parameter. To solve this contradiction i went to stackoverflow and found this detailed example. The author of example said: // The "personAttribute" model has been passed to the controller from the JSP It seems, he is charmed by Spring reference... To dispel the charms i deployed his sample app in my environment and cruelly cut @ModelAttribute annotation from method MainController.saveEdit. As result the application works without any changes! So i conclude: the @ModelAttribute annotation is not needed to pass web form's field values to the argument's fields. Then i stuck to the question: what is the mean of @ModelAttribute annotation? If the only mean is to set alias for model object in View, then why this way better than explicitly adding of object to ModelMap?

    Read the article

  • What is the mean of @ModelAttribute annotation at method argument level?

    - by beemaster
    Spring 3 reference teaches us: When you place it on a method parameter, @ModelAttribute maps a model attribute to the specific, annotated method parameter I don't understand this magic spell, because i sure that model object's alias (key value if using ModelMap as return type) passed to the View after executing of the request handler method. Therefore when request handler method executes the model object's name can't be mapped to the method parameter. To solve this contradiction i went to stackoverflow and found this detailed example. The author of example said: // The "personAttribute" model has been passed to the controller from the JSP It seems, he is charmed by Spring reference... To dispel the charms i deployed his sample app in my environment and cruelly cut @ModelAttribute annotation from method MainController.saveEdit. As result the application works without any changes! So i conclude: the @ModelAttribute annotation is not needed to pass web form's field values to the argument's fields. Then i stuck to the question: what is the mean of @ModelAttribute annotation? If the only mean is to set alias for model object in View, then why this way better than explicitly adding of object to ModelMap?

    Read the article

  • Should the argument be passed by reference in this .net example?

    - by Hamish Grubijan
    I have used Java, C++, .Net. (in that order). When asked about by-value vs. by-ref on interviews, I have always done well on that question ... perhaps because nobody went in-depth on it. Now I know that I do not see the whole picture. I was looking at this section of code written by someone else: XmlDocument doc = new XmlDocument(); AppendX(doc); // Real name of the function is different AppendY(doc); // ditto When I saw this code, I thought: wait a minute, should not I use a ref in front of doc variable (and modify AppendX/Y accordingly? it works as written, but made me question whether I actually understand the ref keyword in C#. As I thought about this more, I recalled early Java days (college intro language). A friend of mine looked at some code I have written and he had a mental block - he kept asking me which things are passed in by reference and when by value. My ignorant response was something like: Dude, there is only one kind of arg passing in Java and I forgot which one it is :). Chill, do not over-think and just code. Java still does not have a ref does it? Yet, Java hackers seem to be productive. Anyhow, coding in C++ exposed me to this whole by reference business, and now I am confused. Should ref be used in the example above? I am guessing that when ref is applied to value types: primitives, enums, structures (is there anything else in this list?) it makes a big difference. And ... when applied to objects it does not because it is all by reference. If things were so simple, then why would not the compiler restrict the usage of ref keyword to a subset of types. When it comes to objects, does ref serve as a comment sort of? Well, I do remember that there can be problems with null and ref is also useful for initializing multiple elements within a method (since you cannot return multiple things with the same easy as you would do in Python). Thanks.

    Read the article

  • C# 4.0: Named And Optional Arguments

    - by Paulo Morgado
    As part of the co-evolution effort of C# and Visual Basic, C# 4.0 introduces Named and Optional Arguments. First of all, let’s clarify what are arguments and parameters: Method definition parameters are the input variables of the method. Method call arguments are the values provided to the method parameters. In fact, the C# Language Specification states the following on §7.5: The argument list (§7.5.1) of a function member invocation provides actual values or variable references for the parameters of the function member. Given the above definitions, we can state that: Parameters have always been named and still are. Parameters have never been optional and still aren’t. Named Arguments Until now, the way the C# compiler matched method call definition arguments with method parameters was by position. The first argument provides the value for the first parameter, the second argument provides the value for the second parameter, and so on and so on, regardless of the name of the parameters. If a parameter was missing a corresponding argument to provide its value, the compiler would emit a compilation error. For this call: Greeting("Mr.", "Morgado", 42); this method: public void Greeting(string title, string name, int age) will receive as parameters: title: “Mr.” name: “Morgado” age: 42 What this new feature allows is to use the names of the parameters to identify the corresponding arguments in the form: name:value Not all arguments in the argument list must be named. However, all named arguments must be at the end of the argument list. The matching between arguments (and the evaluation of its value) and parameters will be done first by name for the named arguments and than by position for the unnamed arguments. This means that, for this method definition: public static void Method(int first, int second, int third) this call declaration: int i = 0; Method(i, third: i++, second: ++i); will have this code generated by the compiler: int i = 0; int CS$0$0000 = i++; int CS$0$0001 = ++i; Method(i, CS$0$0001, CS$0$0000); which will give the method the following parameter values: first: 2 second: 2 third: 0 Notice the variable names. Although invalid being invalid C# identifiers, they are valid .NET identifiers and thus avoiding collision between user written and compiler generated code. Besides allowing to re-order of the argument list, this feature is very useful for auto-documenting the code, for example, when the argument list is very long or not clear, from the call site, what the arguments are. Optional Arguments Parameters can now have default values: public static void Method(int first, int second = 2, int third = 3) Parameters with default values must be the last in the parameter list and its value is used as the value of the parameter if the corresponding argument is missing from the method call declaration. For this call declaration: int i = 0; Method(i, third: ++i); will have this code generated by the compiler: int i = 0; int CS$0$0000 = ++i; Method(i, 2, CS$0$0000); which will give the method the following parameter values: first: 1 second: 2 third: 1 Because, when method parameters have default values, arguments can be omitted from the call declaration, this might seem like method overloading or a good replacement for it, but it isn’t. Although methods like this: public static StreamReader OpenTextFile( string path, Encoding encoding = null, bool detectEncoding = true, int bufferSize = 1024) allow to have its calls written like this: OpenTextFile("foo.txt", Encoding.UTF8); OpenTextFile("foo.txt", Encoding.UTF8, bufferSize: 4096); OpenTextFile( bufferSize: 4096, path: "foo.txt", detectEncoding: false); The complier handles default values like constant fields taking the value and useing it instead of a reference to the value. So, like with constant fields, methods with parameters with default values are exposed publicly (and remember that internal members might be publicly accessible – InternalsVisibleToAttribute). If such methods are publicly accessible and used by another assembly, those values will be hard coded in the calling code and, if the called assembly has its default values changed, they won’t be assumed by already compiled code. At the first glance, I though that using optional arguments for “bad” written code was great, but the ability to write code like that was just pure evil. But than I realized that, since I use private constant fields, it’s OK to use default parameter values on privately accessed methods.

    Read the article

  • How to embed revision information using mercurial and maven (and svn)

    - by Zwei Steinen
    Our project had a nice hack (although I'm guessing there are better ways to do it) to embed revision information into the artifacts (jar etc.) when we used svn. Now we have migrated to mercurial, and we want to have a similar thing, but before I start working on a similar hack with mercurial, I wanted to know if there are better ways to do this. Thanks for your answers! <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <executions> <execution> <phase>process-classes</phase> <id>svninfo</id> <goals> <goal>exec</goal> </goals> <configuration> <executable>svn</executable> <arguments> <argument>info</argument> <argument>../</argument> <argument>></argument> <argument>target/some-project/META-INF/svninfo.txt</argument> </arguments> </configuration> </execution> </executions> </plugin>

    Read the article

  • HA Proxy Stick-table and tcp-connection configuration

    - by Vladimir
    I am using HA Proxy HA-Proxy version 1.4.18 2011/09/16 I am trying to insert the following into /etc/init.d/haproxy.cfg file # Use General Purpose Couter (gpc) 0 in SC1 as a global abuse counter # Monitors the number of request sent by an IP over a period of 10 seconds stick-table type ip size 1m expire 10s store gpc0,http_req_rate(10s) tcp-request connection track-sc1 src tcp-request connection reject if { src_get_gpc0 gt 0 } # Table definition stick-table type ip size 100k expire 30s store conn_cur(3s) # Allow clean known IPs to bypass the filter tcp-request connection accept if { src -f /etc/haproxy/whitelist.lst } # Shut the new connection as long as the client has already 10 opened tcp-request connection reject if { src_conn_cur ge 10 } tcp-request connection track-sc1 src I get the following error: [ALERT] 256/113143 (4627) : parsing [/etc/haproxy/haproxy.cfg:36] : stick-table: unknown argument 'store'. [ALERT] 256/113143 (4627) : parsing [/etc/haproxy/haproxy.cfg:37] : unknown argument 'connection' after 'tcp-request' in proxy 'http_proxy' [ALERT] 256/113143 (4627) : parsing [/etc/haproxy/haproxy.cfg:38] : unknown argument 'connection' after 'tcp-request' in proxy 'http_proxy' [ALERT] 256/113143 (4627) : parsing [/etc/haproxy/haproxy.cfg:41] : stick-table: unknown argument 'store'. [ALERT] 256/113143 (4627) : parsing [/etc/haproxy/haproxy.cfg:43] : unknown argument 'connection' after 'tcp-request' in proxy 'http_proxy' [ALERT] 256/113143 (4627) : parsing [/etc/haproxy/haproxy.cfg:45] : unknown argument 'connection' after 'tcp-request' in proxy 'http_proxy' [ALERT] 256/113143 (4627) : parsing [/etc/haproxy/haproxy.cfg:46] : unknown argument 'connection' after 'tcp-request' in proxy 'http_proxy' [ALERT] 256/113143 (4627) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg [WARNING] 256/113143 (4627) : Proxy 'http_proxy': in multi-process mode, stats will be limited to process assigned to the current request. [ALERT] 256/113143 (4627) : Fatal errors found in configuration. [fail] Could you please tell me what is wrong with the code? Thanks!

    Read the article

  • ArgumentError: Error #1063: Argument count mismatch on com.flashden::MenuItem(). Expected 1, got 0.

    - by Suzanne
    I keep getting the below error only in firefox ArgumentError: Error #1063: Argument count mismatch on com.flashden::MenuItem(). Expected 1, got 0. at flash.display::Sprite/constructChildren() at flash.display::Sprite() at flash.display::MovieClip() at com.flashden::Preview() Below is my menu script: package com.flashden { import flash.display.MovieClip; import flash.text.; import flash.events.MouseEvent; import flash.events.; import flash.net.URLRequest; import flash.display.Loader; public class MenuItem extends MovieClip { private var scope; public var closedX :Number public static const OPEN_MENU = "openMenu"; function callLink(event:MouseEvent):void { public function MenuItem(scope) { // set scope to talk back to -------------------------------// this.scope = scope; // disable all items not to be clickable -------------------// txt_label.mouseEnabled = false; menuItemShine.mouseEnabled = false; menuItemArrow.mouseEnabled = false; // make background clip the item to be clicked (button) ----// menuItemBG.buttonMode = true; // add click event listener to the header background -------// menuItemBG.addEventListener(MouseEvent.CLICK, clickHandler); } private function clickHandler (e:MouseEvent) { scope.openMenuItem(this); } public function loadContent (contentURL:String) { var loader:Loader = new Loader(); configureListeners(loader.contentLoaderInfo); var request:URLRequest = new URLRequest(contentURL); loader.load(request); // place x position of content at the bottom of the header so the top is not cut off ----// loader.x = 35; // we add the content at level 1, because the background clip is at level 0 ----// addChildAt(loader, 0); } private function configureListeners(dispatcher:IEventDispatcher):void { dispatcher.addEventListener(Event.COMPLETE, completeHandler); dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler); dispatcher.addEventListener(Event.INIT, initHandler); dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); dispatcher.addEventListener(Event.OPEN, openHandler); dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler); dispatcher.addEventListener(Event.UNLOAD, unLoadHandler); } private function completeHandler(event:Event):void { //trace("completeHandler: " + event); // remove loader animation ----------------// removeChild(getChildByName("mc_preloader")); } private function httpStatusHandler(event:HTTPStatusEvent):void { // trace("httpStatusHandler: " + event); } private function initHandler(event:Event):void { //trace("initHandler: " + event); } private function ioErrorHandler(event:IOErrorEvent):void { //trace("ioErrorHandler: " + event); } private function openHandler(event:Event):void { //trace("openHandler: " + event); } private function progressHandler(event:ProgressEvent):void { //trace("progressHandler: bytesLoaded=" + event.bytesLoaded + " bytesTotal=" + event.bytesTotal); } private function unLoadHandler(event:Event):void { //trace("unLoadHandler: " + event); } } } Any idea why this is happening?

    Read the article

  • Error #1063: Argument count mismatch on com.flashden::MenuItem(). Expected 1, got 0.

    - by Suzanne
    I'm creating a new site using the below script embedded in my swf. But I keep getting this error on all the pages: Error #1063: Argument count mismatch on com.flashden::MenuItem(). Expected 1, got 0. package com.flashden { import flash.display.MovieClip; import flash.text.*; import flash.events.MouseEvent; import flash.events.*; import flash.net.URLRequest; import flash.display.Loader; public class MenuItem extends MovieClip { private var scope; public var closedX; :Number public static const OPEN_MENU = "openMenu"; public function MenuItem(scope) { // set scope to talk back to -------------------------------// this.scope = scope; // disable all items not to be clickable -------------------// txt_label.mouseEnabled = false; menuItemShine.mouseEnabled = false; menuItemArrow.mouseEnabled = false; // make background clip the item to be clicked (button) ----// menuItemBG.buttonMode = true; // add click event listener to the header background -------// menuItemBG.addEventListener(MouseEvent.CLICK, clickHandler); } private function clickHandler (e:MouseEvent) { scope.openMenuItem(this); } public function loadContent (contentURL:String) { var loader:Loader = new Loader(); configureListeners(loader.contentLoaderInfo); var request:URLRequest = new URLRequest(contentURL); loader.load(request); // place x position of content at the bottom of the header so the top is not cut off ----// loader.x = 30; // we add the content at level 1, because the background clip is at level 0 ----// addChildAt(loader, 1); } private function configureListeners(dispatcher:IEventDispatcher):void { dispatcher.addEventListener(Event.COMPLETE, completeHandler); dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler); dispatcher.addEventListener(Event.INIT, initHandler); dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); dispatcher.addEventListener(Event.OPEN, openHandler); dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler); dispatcher.addEventListener(Event.UNLOAD, unLoadHandler); } private function completeHandler(event:Event):void { //trace("completeHandler: " + event); // remove loader animation ----------------// removeChild(getChildByName("mc_preloader")); } private function httpStatusHandler(event:HTTPStatusEvent):void { // trace("httpStatusHandler: " + event); } private function initHandler(event:Event):void { //trace("initHandler: " + event); } private function ioErrorHandler(event:IOErrorEvent):void { //trace("ioErrorHandler: " + event); } private function openHandler(event:Event):void { //trace("openHandler: " + event); } private function progressHandler(event:ProgressEvent):void { //trace("progressHandler: bytesLoaded=" + event.bytesLoaded + " bytesTotal=" + event.bytesTotal); } private function unLoadHandler(event:Event):void { //trace("unLoadHandler: " + event); } } }

    Read the article

  • Passing arguments between classes - use public properties or pass a properties class as argument?

    - by devoured elysium
    So let's assume I have a class named ABC that will have a list of Point objects. I need to make some drawing logic with them. Each one of those Point objects will have a Draw() method that will be called by the ABC class. The Draw() method code will need info from ABC class. I can only see two ways to make them have this info: Having Abc class make public some properties that would allow draw() to make its decisions. Having Abc class pass to draw() a class full of properties. The properties in both cases would be the same, my question is what is preferred in this case. Maybe the second approach is more flexible? Maybe not? I don't see here a clear winner, but that sure has more to do with my inexperience than any other thing. If there are other good approaches, feel free to share them. Here are both cases: class Abc1 { public property a; public property b; public property c; ... public property z; public void method1(); ... public void methodn(); } and here is approach 2: class Abc2 { //here we make take down all properties public void method1(); ... public void methodn(); } class Abc2MethodArgs { //and we put them here. this class will be passed as argument to //Point's draw() method! public property a; public property b; public property c; ... public property z; } Also, if there are any "formal" names for these two approaches, I'd like to know them so I can better choose the tags/thread name, so it's more useful for searching purposes. That or feel free to edit them.

    Read the article

  • Passing parameters between interrupt handlers on a Cortex-M3 ...

    - by Captain NedD
    I'm building a light kernel for a Cortex-M3. From a high priority interrupt I'd like to invoke some code to run in a lower priority interrupt and pass some parameters along. I don't want to use a queue to post work to the lower priority interrupt. I just have a buffer and size to pass to it. In the proramming manual it says that the SVC interrupt handler is synchronous which presumably means that if you invoke it from an interrupt that's a lower priority than SVC's handler it gets called immediately (the upshot of this being that you can pass parameters to it as though it were a function call (a little like the BIOS calls in MS-DOS)). I'd like to do it the other way: passing parameters from a high priority interrupt to a lower priority one (at the moment I'm doing it by leaving the parameters in a fixed location in memory). What's the best way to do this (if at all possible)? Thanks,

    Read the article

< Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >