Search Results

Search found 8286 results on 332 pages for 'defined'.

Page 180/332 | < Previous Page | 176 177 178 179 180 181 182 183 184 185 186 187  | Next Page >

  • Python: Why Does a Method Behave Differently with an Added Parameter?

    - by SteveStifler
    I have a method in a Pygame Sprite subclass, defined as such: def walk(self): """move across screen""" displacement = self.rect.move((self.move, 0)) if self.rect.left < self.area.left or self.rect.right > self.area.right: self.move = -self.move displacement = self.rect.move((self.move, 0)) self.rect = displacement I modified it, adding a parameter speed_x, and now the program is broken. def walk(self, speed_x): """move across screen""" displacement = self.rect.move((speed_x, 0)) if self.rect.left < self.area.left or self.rect.right > self.area.right: speed_x = -speed_x displacement = self.rect.move((speed_x, 0)) self.rect = displacement Before I called the method like this: def update(self): self.walk() Now I do: def update(self): self.walk(self.move) Why doesn't this work?

    Read the article

  • Change MS Patch custom language

    - by nelusan
    How can I change the default UI language when installing a patch/update? The problem is that the patch takes the initial language in which the setup to be patched was installed and not the current system language (defined in Reginal Settings/Advanced Options). I wonder if there is a property or switch that I can pass to a msp file to change its UI language. Example: I created 'setup_v00.exe' (english and french) and a patch 'update_v00_v01.exe' (english and french); with system language = english, 'setup_v00.exe' installs in english; change system language in french; with system language = french, 'update_v00_v01.exe' still installs in english but I want it to install with a french interface;

    Read the article

  • Restrict violation of architecture - asp.net MVP

    - by Srikanth
    If we had a defined hierarchy in an application. For ex a 3 - tier architecture, how do we restrict subsequent developers from violating the norms? For ex, in case of MVP (not asp.net MVC) architecture, the presenter should always bind the model and view. This helps in writing proper unit test programs. However, we had instances where people directly imported the model in view and called the functions violating the norms and hence the test cases couldn't be written properly. Is there a way we can restrict which classes are allowed to inherit from a set of classes? I am looking at various possibilities, including adopting a different design pattern, however a new approach should be worth the code change involved.

    Read the article

  • WPF - Get combobox checked property from ListBox

    - by Chris Klepeis
    I have a listbox, which is defined like so: <ListBox ItemsSource="{Binding Source={x:Static local:ResourceCollection.resourceList}}" Height="143" HorizontalAlignment="Left" Margin="6,6,0,0" Name="assignmentLB" VerticalAlignment="Top" Width="287" FontSize="12" FontWeight="Normal" IsEnabled="True" Grid.Column="0"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <CheckBox /> <TextBlock Text="{Binding Content}" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> How can I loop through this listbox and retrieve the TextBlock.Text value for only items whose Checkbox has been checked?

    Read the article

  • WCF Web/ServiceHost - Singletons and initialisation

    - by Kyle
    I have some Service class which is defined as InstanceContextMode.Single, and is well known in the hosting application. (The host creates an instance, and passes that to the WebServiceHost) Hosting app:WebServiceHost host = null; SomeService serviceInstance = new SomeService("text", "more text"); host = new WebServiceHost(serviceInstance, baseUri); Problem: When I go to use the variables initialised when the service is created (ie, when a call is made to the service), they are either null or empty... Am I wrong in assuming that as the instance being initialised in the hosting application is used for each request to the WebServiceHost? Any pointers here would be great.

    Read the article

  • android html download and parse error

    - by Brahadeesh
    I am trying to download the html file using the ul of the page. I am using Jsoup. This is my code: TextView ptext = (TextView) findViewById(R.id.pagetext); Document doc = null; try { doc = (Document) Jsoup.connect(mNewLinkUrl).get(); } catch (IOException e) { Log.d(TAG, e.toString()); e.printStackTrace(); } NodeList nl = doc.getElementsByTagName("meta"); Element meta = (Element) nl.item(0); String title = meta.attr("title"); ptext.append("\n" + mNewLinkUrl); When running it, I am getting an error saying attr is not defined for the type element. What have I done wrong? Pardon me if this seems trivial.

    Read the article

  • Saving XML in UTF-8 with MSXML

    - by stung
    I'm trying to load a simple Xml file (encoded in UTF-8): <?xml version="1.0" encoding="UTF-8"?> <Test/> And save it with MSXML in vbscript: Set xmlDoc = CreateObject("MSXML2.DOMDocument.6.0") xmlDoc.Load("C:\test.xml") xmlDoc.Save "C:\test.xml" The problem is, MSXML saves file in ANSI instead of UTF-8 (despite the original file being encoded in UTF-8). The MSDN docs for MSXML says that save() will write the file in whatever encoding the XML is defined in but this is clearly not working at least on my machine. How can MSXML save in UTF-8?

    Read the article

  • creational pattern for instances depending on multiple subclass instances

    - by markusw
    I have a problem, for that I was not able to identify a suitable design pattern. I want to create instances depending on a given type that has been passed to a factory method. What I am doing until now is the following: T create(SuperType x) { if (x instanceof SubType1) { // do some stuff and return a new SubType extends T } else if (x instanceof SubType2) { // do some stuff and return a new SubType extends T } else if ... } else { throw new UnSupportedOperationException("nothing defined for " + x); } } It seems not to be best pratice for me. Has anybody an idea how to solve this in a better way?

    Read the article

  • Visual C++ 2010 solution-wide macros with parameters

    - by OregonGhost
    I'm trying to compile some source code with Visual C++ 2010 Express. The code was written for GCC, and contains attributes like this: struct something { ... } __attribute__((packed)); Since this is not standard C++ syntax, Visual C++ doesn't recognize it. With this macro prior to the struct declaration, it works fine: #define __attribute__(p) But I don't want to alter the files. I created a new property sheet (GccCompat), and went to Preprocessor Definitions, and added the macro, like this: __attribute__(p) or like this: __attribute__(p)= But it doesn't work. It's simply not called. If I define just __attribute__ (without parameters) in the same location, the macro is correctly defined. Note that the command line that is generated looks fine (the macros with parameters are passed exactly the same as the ones without), but the compiler seems to ignore it. So, how can I globally define my macro with a parameter?

    Read the article

  • Objetive C - Calling Methods in objects.

    - by Mace
    I'm new to Objective C, and I seem to be struggling with accessing a method of an object I created. I'm checking out the documentation , but I'm not entirely sure tha tthis is a job for a delegate. For example I have an object (1) that creates another object (2). I can access a method of the object (2) after I create it, but I can't access it from a method of object (1). I get a error that the object was not defined in this scope. If anyone can help I greatly appreciate it. I just need a nudge in the right direction so that I can at least get a grasp on how to think about the interaction between the objects.

    Read the article

  • UISegemnted COntrol - selecting 3rd segment activates second segment

    - by diggers25
    I have a segmented control with 3 defined segments. i am looking to capture the segment index so I can use it in an if statement to update variables accordingly as such: -(IBAction)numPlayers:(id)sender; { numPlayersSegment = [(UISegmentedControl *)sender retain]; if (numPlayersSegment.selectedSegmentIndex == 0) { numOfPlayers = 2; } else if (numPlayersSegment.selectedSegmentIndex = 1) { numOfPlayers = 3; } else if (numPlayersSegment.selectedSegmentIndex = 2) { numOfPlayers = 4; } else if (numPlayersSegment.selectedSegmentIndex = -1) { numOfPlayers = 0; } NSLog(@"Players selected = %d", numPlayersSegment.selectedSegmentIndex); However whenever I press the third segment (index 2) it returns the value of the second segment (index 1) and also highlights the 2nd segment. I can see nothing untoward in IB. Has anybody seen this and have any suggestions. I am using xcode 3.2.1 on snow leopard thanks

    Read the article

  • Confusion about Nullable<T> constraints

    - by n535
    Greetings everybody. I am sorry, if this was already asked before (searched in vain) or is really very simple, but i just can't get it. The MSDN definition of a Nullable type, states, that it is defined in a following manner: [SerializableAttribute] public struct Nullable<T> where T : struct, new() So the question is quite straightforward: How is this definition possible? Or this is just a typo? Every value type already has a default constructor. Indeed, when i try to compile something like this, the compiler reasonably says, that it is illegal to apply both constraints at the same time, because the second one is implicitly included in a first one. Thanks in advance.

    Read the article

  • What's the proper way to fork() in FastCGI ?

    - by eugene y
    I have an app running under Catalyst+FastCGI. And I want it to fork() to do some work in background. I used this code for plain CGI long ago: defined(my $pid = fork) or die "Can't fork: $!"; if ($pid) { # print response exit 0; } die "Can't start a new session: $!" if setsid == -1; close STDIN or die $!; close STDOUT or die $!; close STDERR or die $!; # do some work in background I tried some variations on this under FastCGI but with no success. How should forking be done under FastCGI?

    Read the article

  • How to delete refClass record in Doctrine?

    - by terrani
    Hi all! I have many-to-many relations with the following tables. post tag post_tag I created three classes with Doctrine, so I have the following classes as well. BasePost BaseTag BasePostTag in the setUp() method, I defined relations. I like to delete tag record when I delete post record. So I simply put cascade as descirbed on Doctrine document. $this->hasMany("Tag as Tags",array( 'refClass' => 'PostTag', 'local'=>'object_id', 'foreign'=>'tag_id', 'cascade'=> array('delete') )); it works without a problem. My questions is, how do I delete a record from post_tag table? Do I need to create a query myself?

    Read the article

  • List method creation

    - by Jonathan D
    I'm creating a list of my defined objects like so List<clock> cclocks = new List<clocks>(); for each object in the list i'm calling a method moveTime, like so foreach(clock c in cclocks) { c.moveTime(); } is the a way i can write some cleaver thing so i can call cclocks.moveTime(); it would then go though the list doing that method I guess I want to create a collection method? I'm guessing there must be some thing I can do I just don't know what. thanks for your help

    Read the article

  • A better way to do XML in Java

    - by jboyd
    There are a lot of questions that ask the best XML parser, I am more interested in what is the XML parser that is the most like Groovy for Java? I want: SomeApiDefinedObject o = parseXml( xml ); for( SomeApiDefinedObject it : o.getChildren() ) { System.out.println( it.getAttributes() ); } The most important things are that I don't want to create an object for every type of filed, I'd rather just deal with them all as strings, and that building the XML doesn't require any converters or anything, just a simple object that is already defined If you have used the Groovy XML parser, you will know what I'm talking about Alternatively, would it be better for me to just use Groovy from Java?

    Read the article

  • Is it good practice to put private API in the .m files and public API in .h files in Cocoa?

    - by Paperflyer
    Many of my classes in my current project have several properties and methods that are only ever called from within the class itself. Also, they might mess with the working of the class depending on the current state of the class. Currently, all these interfaces are defined in the main interface declaration in the .h files. Is it considered good practice to put the “private” methods and properties at the top of the .m files? This won't ever affect anything since I am very likely the only person ever to look at this source code, but of course it would be interesting to know for future projects.

    Read the article

  • Validation errors from Google App Engine Logout link

    - by goggin13
    I am making a web page using the Google App Engine. I am validating my pages, and found that the logout link that is generated by the call to the users api (in python) users.create_logout_url(request.uri) does not validate as XHTML 1.0 Strict. The href in the anchor tag looks like this: /_ah/login?continue=http%3A//localhost%3A8080/&action=Logout Including a link with this anchor text throws three different validation errors: *general entity "action" not defined and no default entity *reference to entity "action" for which no system identifier could be generated *EntityRef: expecting ';' Here is a dummy page with the anchor tag in it, if you want to try it on w3c validator.Dummy Page. The logout link wont work, but you can see how the page is valid without it, but the actual text inside the href tag breaks the validation. Any thoughts on whats going on? Thank you!

    Read the article

  • Adding Colours (Colors) Together like Paint (Blue + Yellow = Green, etc)

    - by glenstorey
    I'm making an iOS game using cocos2d libraries. Lets say you have two objects that have two separate colours - defined in RGB as Blue: 0,0,255 Yellow: 255,255,0 I want to add blue and yellow to make green. To over complicate things, let's say that the Blue object is bigger than the Yellow object (for the sake of argument let's say that the ratio is 2:1), I'm adding twice as much blue as yellow - how to I calculate this new (light green) colour correctly. I understand LAB * Color Space is useful for this sort of 'natural colour' kind of thing, but I'm not sure how to use it - especially in the context of a cocos2d object which (AFAIK) is limited to using RGB in its colour schemes. I'd really appreciate practical help on how to implement this. Thanks heaps!

    Read the article

  • pull down notification panel in iOS help for iPad

    - by Priya Chhabra
    I have developed an iPad application. In which I am using left/right swipes from corner of screen. The problem is when device is in landscape mode, (though the application is always in portrait orientation) and user wants to swipe left, it opens the notification panel instead of going to swipeAction that I had defined. Note that it works fine when device is kept in portrait mode. Is there any way to make pull down notification panel application orientation specific ? Any kind of help will be appreciated.

    Read the article

  • Javascriptlibrary more efficient than Rickshaw for realtime visualizations

    - by dan kutz
    I want to visualize data as time-series graphs on mobile devices(tablets) and therefore stumbled upon rickshaw, which is based on D3. First I must say I was a little bit confused when I realized that realtime in web design is defined totally different to realtime in engineering which has fixed(and often very short) timeframes. Anyway my aim is to visualize the data as fast as possible, and on older tablets visualization with rickshaw is quite slow. Can anybody recommend another library, which may be more efficient in rendering? Or is there no way out and I have to go native? regards Dan.

    Read the article

  • Referring to a non-final variable data inside an inner class

    - by shoaibmohammed
    Im doing a program in GWT. Here is the snippet where Im having problem private String[] populateRSSData() { 1==>> String[] data = null; try { new RequestBuilder(RequestBuilder.GET, "../database.php?action=populaterss").sendRequest(null, new RequestCallback() { @Override public void onResponseReceived(Request request, Response response) { 2==>> data=response.getText().split("~"); } @Override public void onError(Request request, Throwable exception) { Window.alert(exception.getMessage()); } }); } catch (RequestException e) { Window.alert(e.getMessage()); } return data; } Now the problem arises that I get an error that the variable 1==>> data should be declared final. But if I declare it as final then i cannot store the datas in 2==>> The error i get Cannot refer to a non-final variable data inside an inner class defined in a different method RSS_Manager.java Please suggest

    Read the article

  • In datastore, confused on how to pass a list of key_names as an argument to somemodel.get_or_insert(

    - by indiehacker
    Are there examples of how to pass a list of key_names to Model.get_or_insert() ? My Problem: With a method of ParentLayer I want to make the children. The key_names of the new (or editable) entities of class Child will come from such a list below: namesList = ["picture1","picture2"] so I should be able to build a list of key_names with method from the parent class as follows: class ParentLayer(db.Model): def getOrMakeChildren(self, namesList): keyslist = [ db.Key.from_path( 'Child' , name , parent = self.key() ) for name in namesList ] the problem is next where I simply want to get_or_insert entities based on keylist defined above: childrenEntitiesList = Child.get_or_insert(keyslist) # no works? also none of the below attempts worked: #childrenEntitiesList = Child.get_or_insert(keyslist, parent = u'TEST') #childrenEntitiesList = Child.get_or_insert(keyslist, parent=self.key().name() ) #childrenEntitiesList = Child.get_or_insert(keyslist, parent=self.key()

    Read the article

  • C Pointer Question: &(*struct->struct)

    - by NTek
    I have a struct defined with the structure as follows (names are different) struct str1 { int field1; struct str2; } And I have a *str1 in a function. I'd like to get a pointer to str2. So I tried &(str1->str2) and was hoping this would return a pointer to str2. Is this incorrect? It doesn't seem to be working. How would I get a pointer to str2 if given a pointer to str1?

    Read the article

  • Is it possible to set ContentType for a WCF WebGet method?

    - by James Cadd
    I'm working with a WCF restful/http method that returns a stream of image data. I want to make sure that the content type is marked as "image/png". The method is defined as: [ServiceContract] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)] public class TileImageService { [WebGet(UriTemplate = "{id}")] public Stream GetTileImage(string id) { Bitmap bmp = new Bitmap(173, 173); Graphics g = Graphics.FromImage(bmp); g.Clear(Color.Blue); g.DrawString(DateTime.Now.ToLongTimeString(), new Font("Chiller", 20), Brushes.White, new PointF(10, 10)); g.Flush(); MemoryStream ms = new MemoryStream(); bmp.Save(ms, ImageFormat.Png); ms.Seek(0, SeekOrigin.Begin); return ms; } } In Firefox it looks like the content type is marked as application/octet stream. Is there a way to change the content type?

    Read the article

< Previous Page | 176 177 178 179 180 181 182 183 184 185 186 187  | Next Page >