Search Results

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

Page 162/332 | < Previous Page | 158 159 160 161 162 163 164 165 166 167 168 169  | Next Page >

  • Django: How to create a model dynamically just for testing

    - by muhuk
    I have a Django app that requires a settings attribute in the form of: RELATED_MODELS = ('appname1.modelname1.attribute1', 'appname1.modelname2.attribute2', 'appname2.modelname3.attribute3', ...) Then hooks their post_save signal to update some other fixed model depending on the attributeN defined. I would like to test this behaviour and tests should work even if this app is the only one in the project (except for its own dependencies, no other wrapper app need to be installed). How can I create and attach/register/activate mock models just for the test database? (or is it possible at all?) Solutions that allow me to use test fixtures would be great.

    Read the article

  • Constructor in a Interface?

    - by Sebi
    I know its not possible to define a constructor in a interface. But im wondering why, because i think i could be very useful. So you could be sure that some fields in a class are defined for every implementaiton of this interface. For example consider the following message class: public class MyMessage { public MyMessage(String receiver) { this.receiver = receiver; } private String receiver; public void send() { //some implementation for sending the mssage to the receiver } } If a define a Interface for this class so that i can have more classes which implement the message interface, i can only define the send method and not the constructor. So how can i assure that every implementation of this class really has an receiver setted? If i use a method like setReceiver(String receiver) i can't be sure that this method is really called. In the constructor i could assure it.

    Read the article

  • How to create a container that holds different types of function pointers in C++?

    - by Alex
    I'm doing a linear genetic programming project, where programs are bred and evolved by means of natural evolution mechanisms. Their "DNA" is basically a container (I've used arrays and vectors successfully) which contain function pointers to a set of functions available. Now, for simple problems, such as mathematical problems, I could use one type-defined function pointer which could point to functions that all return a double and all take as parameters two doubles. Unfortunately this is not very practical. I need to be able to have a container which can have different sorts of function pointers, say a function pointer to a function which takes no arguments, or a function which takes one argument, or a function which returns something, etc (you get the idea)... Is there any way to do this using any kind of container ? Could I do that using a container which contains polymorphic classes, which in their turn have various kinds of function pointers? I hope someone can direct me towards a solution because redesigning everything I've done so far is going to be painful.

    Read the article

  • Silverlight - Disabling Item Selection from ListBox

    - by Villager
    Hello, I have a ListBox defined in Silverlight. Each item in this ListBox has a CheckBox. Based on some rules when the ListBox is populated, some of the items in the ListBox get selected. This is used just for the sake of highlighting certain rows. When a user clicks an item in the ListBox, I want to check or uncheck the CheckBox in the item. However, I want to leave the item as appeared as selected because of the highlighting. Is there a way to do this? If not, is there a repeater control where I can highlight certain rows but not others when items are loaded? Thank you,

    Read the article

  • Generate links for routes with non-parameter url segments on ASP.NET MVC 2

    - by spapaseit
    I have a route defined with several hardcoded (non-parameter) segments: routes.MapRoute(null, "suggestion/list/by/{tag}", new { controller = "Suggestion", action = "List", tag = UrlParameter.Optional }); Suppose I'm in the Index view of SuggestionController, which has a Suggestion object for Model, how can I create a link that matches that route? I'd rather use one of the provided helpers and keep the route name as null in order to avoid hard-coding to much on my views, but I can't figure out how to user these non-parameter segments in Html.ActionLink or RouteLink methods. I've even tried to render the link using plain ol' html <a href="/suggestion/list/by/<%=Model.Tag %>"><%=Model.Tag %></a> but this somehow didn't match the route either. There's probably a very simple solution and I might be over-complicating things in mi mind, but I'm at a loss. Any ideas? Thanks in advance.

    Read the article

  • Problem using ScriptManager.RegisterStartUpScript in user control - Script Error "function is not de

    - by poojad
    I have a aspx page which contains a User Control uc1 ans within uc1, there is another user control uc2. Now I need to call a javascript function in the uc2's page load. (I understand that the Pages are not properly designed, but I am sorry as this is an old application, I am not supposed to make any changes in the design) I am doing this using ScriptManager.RegisterStartUpScript as I have an update panel, but the function is not being called and the script error "load is not defined" is fired. (load is the javascript function in uc2) Can anyone help me out with this? Thank you.

    Read the article

  • Using Server side method from Javascript without AJAX

    - by Aswin Ramakrishnan
    I have a tricky problem. I am in a situation where I need to use a method defined in a .cs file from a javascript function. The problem is we are using .NET 1.1 and AJAX cannot be used for the application. Also, I will need to pass a string from the javascript to the server side method. The page where I am implementing the javascript is a .as Any ideas? I have tried doing a post back and creating a RaisePostBack event handler method (both in the .aspx page and the .ascx user control) but no luck. It will be greatly appreciated if someone could help me out with the problem.

    Read the article

  • Link errors loading a Python extension for i386 MacOS that was compiled on a PPC

    - by deekoo
    I'm trying to compile a Python extension (written in C) on a PPC mac (running OS X 10.4, XCode 2.5), to run under Ren'Py on both PPC and i386 MacOS. The PPC version works; the i386 version fails to load with ImportError: dlopen(./fasttint_macos_i386.dylib, 2): Symbol not found: _PyType_GenericNew Referenced from: /Applications/Games/Demos/CuteKnightKingdom-demo-0.9.25.1-mac/CuteKnightKingdom-demo.app/Contents/Resources/autorun/game/fasttint_macos_i386.dylib Expected in: /Applications/Games/Demos/CuteKnightKingdom-demo-0.9.25.1-mac/CuteKnightKingdomdemo.app/Contents/Resources/autorun/game/fasttint_macos_i386.dylib As best I can tell, _PyType_GenericNew should be defined by Ren'Py's python - why is it trying to find an internal declaration for the symbol instead of the external one?

    Read the article

  • how to set breakpoint on function in a shared library which has not been loaded in gdb

    - by pierr
    Hi, I have a shared library libtest.so which will be loaded into the the main program using dlopen. Function test() reside in libtest.so and will be called in the main program through dlsym. Is there any way I could set up a break point on test? Please note that the main programm has not been linked to libtest.so during linking time. Otherwise , I should be able to set the break point although it is a pending action. In my case, when I do b test, gdb will tell me Function "test" not defined.

    Read the article

  • problem in adding data to an array in Objective-C!!!

    - by anurag
    I am grappling with adding an NSData object to a NSMutable array. The code is executing fine but it is not adding the objects in the array.The code is as follows: NSData * imageData = UIImageJPEGRepresentation(img, 1.0); int i=0; do{ if([[tempArray objectAtIndex:i] isEqual:imageData]) { [tempArray removeObjectAtIndex:i]; } else { [tempArray addObject:imageData]; //NSLog(@"ANURAG %@",[tempArray objectAtIndex:0]); } }while(i<[tempArray count]) ; The NSLog statement shows the object added is null however the value of imageData is not null. I have defined the tempArray as a static memeber of the class in which this code is written. Is it because of the size of the data object as it is the data of an image????

    Read the article

  • Why & When should I use SPARSE COLUMN? (SQL SERVER 2008)

    - by priyanka.sarkar
    After going thru some tutorials on SQL SERVER 2008's new feature SPARSE COLUMN, I have found that it doesn't take any space if the column value is 0 or null but when there is a value, it takes 4 times the space a regular(non sparse) column holds. If my understanding is correct, then why I will go for that at the time of database design? And if I use that, then at what situation so I be? Also out of curiosity, how come no space get's reserve when a column is defined as sparse column(I mean to say, what is the internal implementation for that) Thanks in advance

    Read the article

  • Proper way in MVVM to drive visual states.

    - by firoso
    Given a content presenter that can display one of 4 different application pages, and I want to fade/otherwise animate a transition between pages based on view model state. Ideally I'd like to have these all defined within a DataTemplate, and then trigger transitions based on an enum from the view model, so that when some enum representing state changes, the transitions trigger to the appropriate page. Is there a known best practice to handle things like this? Immediately coming to mind is the possibiltiy to use Enter and Exit actions on data triggers to play storyboards, but this definately doesn't use the parts and states model, so I'd like to shy away from that. I've also tried using the DataStateSwitchBehavior from the codeplex Expression project, but found it to be incompatable with the latest builds of WPF 4.0/Blend 4 RC's SDK. Does anyone have any ideas on how to handle this elegantly? I'm using the MVVM-Light framework. Also I'd like to point out that as long as this resides on a DataTemplate in a Resource Dictionary, code-behind is not an option without refactoring.

    Read the article

  • How to GetGuiResources for all system processes?

    - by Krzysztof
    Hello, I need to measure all used GDI objects in a Windows xp system. I found a GetGuiResources(__in HANDLE hProcess, __in DWORD uiFlags) method (with the GR_GDIOBJECTS flag). I call it for the process which I get from the method GetCurrentProcess() defined in WinBase.h. I don't know how to call it for other system processes, which I get by System::Diagnostics::Process::GetProcesses(), because that function returns an array of Process pointers, and GetGuiResources takes a HANDLE. Does anybody know a solution for that? How can I transform Process pointer to a Handle or get HANDLEs for all running system processes? thanks for help in advance!

    Read the article

  • In OpenRasta is it possible to Pattern match multiple key/value pairs?

    - by Scott Littlewood
    Is it possible in OpenRasta to have a Uri pattern that allows for an array of values of the same key to be submitted and mapped to a handler method accepting an array of the query parameters. Example: Return all the contacts named Dave Smith from a collection. HTTP GET /contacts?filterBy=first&filterValue=Dave&filterBy=last&filterValue=Smith With a configuration of: What syntax would be best for the Uri string pattern matching? (Suggestions welcome) ResourceSpace.Has.ResourcesOfType<List<ContactResource>>() .AtUri("/contacts") .And.AtUri("/contacts?filterBy[]={filterBy}[]&filterValue[]={fv}[]") // Option 1 .And.AtUri("/contacts?filterBy={filterBy}[]&fv={fv}[]") // Option 2 Would map to a Handler method of: public object Get(params Filter[] filters) { /* create a Linq Expression based on the filters using dynamic linq query the repository using the Linq */ return Query.All<Contact>().Where(c => c.First == "Dave" && c.Last == "Smith").ToResource() } where Filter is defined by public class Filter { public string FilterBy { get; set; } public string FilterValue { get; set; } }

    Read the article

  • python object AttributeError: type object 'Track' has no attribute 'title'

    - by ccwhite1
    I apologize if this is a noob question, but I can't seem to figure this one out. I have defined an object that defines a music track (NOTE: originally had the just ATTRIBUTE vs self.ATTRIBUTE. I edited those values in to help remove confusion. They had no affect on the problem) class Track(object): def __init__(self, title, artist, album, source, dest): """ Model of the Track Object Contains the followign attributes: 'Title', 'Artist', 'Album', 'Source', 'Dest' """ self.atrTitle = title self.atrArtist = artist self.atrAlbum = album self.atrSource = source self.atrDest = dest I use ObjectListView to create a list of tracks in a specific directory ....other code.... self.aTrack = [Track(sTitle,sArtist,sAlbum,sSource, sDestDir)] self.TrackOlv.AddObjects(self.aTrack) ....other code.... Now I want to iterate the list and print out a single value of each item list = self.TrackOlv.GetObjects() for item in list: print item.atrTitle This fails with the error AttributeError: type object 'Track' has no attribute 'atrTitle' What really confuses me is if I highlight a single item in the Object List View display and use the following code, it will correctly print out the single value for the highlighted item list = self.TrackOlv.GetSelectedObject() print list.atrTitle

    Read the article

  • How to define enum in as3?

    - by Nava Carmon
    Is there a way to define an enum in AS3 in a way we do it in other languages? I can define constants with defined values like that: private const CONST_1:int = 0; private const CONST_2:int = 1; private const CONST_3:int = 2; and so on. If I want to insert some other constant between 3 these I need to move all values like that: private const CONST_1:int = 0; private const CONST_2:int = 1; private const CONST_2A:int = 2; private const CONST_3:int = 3; while in other language I would end up with only adding a new member to enum closure like that: enum { CONST_1 = 0, CONST_2, CONST_2A, CONST_3 } MyConstEnum; Does AS3 has something similar? Thanks

    Read the article

  • using document() function in .NET XSLT generates error

    - by Simon
    I'd like to use embedded resources in my XSLT file, but while invoking 'document(...)' C# complains that "Error during loading document ..." I'd like to use defined resources in XSLT file and get them by this: "document('')//my:resources/"... How can i do that?? ex xsl: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:my="xslt-gruper-v1.2.xsl" exclude-result-prefixes="my"> <my:resources> <one>tryb</one> </my:resources> <xsl:variable name="res" select="document('')/*/my:resources/("/> </xsl:stylesheet> How can i get access to such structure without exceptions in C#? I'll add that during static transform via ex. Opera everything works fine.

    Read the article

  • git-svn branching

    - by slayerIQ
    Hello, I am using git with an svn repository everything is going fine I did all my branching with git so I did not branch on svn but I branched with git and pushed those branches to a separate location. Then I commited changed from the branch when needed. But now I want to create some branches that actually exist on svn I tried: $ git svn branch someFeature -m "message" ,and I got this: $ git svn branch someFeature -m "message" Multiple branch paths defined for Subversion repository. You must specify where you want to create the branch with the --destination argument. How should I specify the destination I cant figure this out and the man page isn't that clear also.

    Read the article

  • Variable as numeric sent to stored procedure (SQL Server 2005)

    - by TimCarrett
    I see that with SQL Server 2005 you can pass a parameter as numeric e.g. create procedure dbo.TestSP @Param1 numeric as But what does this equate to? E.g. Numeric(10,0), Numeric(9,2), etc? We have some Developers here who are using this instead of the correct definition for the field that this parameter is going to be used against e.g. instead of using Numeric(10, 0) for the parameter @Param1. Also are there any underlying performance issues with using Numeric instead of the data type defined against the field in the table? Many thanks.

    Read the article

  • Adding Java packages to GWT

    - by Organiccat
    I've tried searching but couldn't come up with a defined way on how to add your own packages to a GWT project. My tree structure looks like this: -com.mycompany -public MyApplication.html MyApplication.gwt.xml -com.mycompany.client MyApp.java -com.mycompany.gui TableLayout.java The answer I've seen out there says to add the packages relative to the root directory of the gwt.xml file, like so: <module> <inherits name="com.google.gwt.user.User" /> <entry-point class="com.mycompany.client.MyApp" /> <source path="client" /> <source path="gui" /> </module> It then complains: Unable to find type 'com.technicon.client.MyApp' Hint: Previous compiler errors may have made this type unavailable Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly Can anyone tell me what I'm doing wrong and how to fix this?

    Read the article

  • Joining two tables using a count

    - by Dave
    I have two tables as defined below: EMAILS ID SUBJECT BODY 1 Test1 blah blah 2 Test2 blah blah blah 3 Test3 more blah ATTACHMENTS ID EMAIL_ID ATTACHMENT NAME 1 2 TEST.DOC 2 2 TEST.XLS I'm trying to perform a select to get back all of the emails and a count of how many attachments (if any) for each row in the EMAILS table -- preferably in a single query where the results would resemble something like: EMAIL_ID SUBJECT NUM_ATTACHMENTS BODY 1 Test1 0 blah blah 2 Test2 2 blah blah blah 3 Test3 0 more blah I've tried everything but the "right way" and if anyone has a few minutes to help me create the right SQL to build this, I'd greatly appreciate it. Thanks.

    Read the article

  • Django save, column specified twice

    - by realshadow
    Hey, I would like to save a modified model, but I get Programming error - that a field is specified twice. class ProductInfo(models.Model): product_info_id = models.AutoField(primary_key=True) language_id = models.IntegerField() product_id = models.IntegerField() description = models.TextField(blank=True) status = models.IntegerField() model = models.CharField(max_length=255, blank=True) label = models.ForeignKey(Category_info, verbose_name = 'Category_info', db_column = 'language_id', to_field = 'node_id', null = True) I get this error because the foreign key uses as db_column language_id. If I will delete it, my object will be saved properly. I dont quite understand whats going on and since I have defined almost all of my models this way, I fear its totally wrong or maybe I just missunderstood it... Any ideas? Regards

    Read the article

  • Proper NSArray initialization for ivar data in a method

    - by Joost Schuur
    I'm new to Objective-C and iPhone development and have been using Apress' Beginning iPhone 3 Programming book as my main guide for a few weeks now. In a few cases as part of a viewDidLoad: method, ivars like a breadTypes NSArray are initialized like below, with an intermediate array defined and then ultimately set to the actual array like this: NSArray *breadArray = [[NSArray alloc] initWithObjects:@"White", @"Whole Weat", @"Rye", @"Sourdough", @"Seven Grain", nil]; self.breadTypes = breadArray; [breadArray release]; Why is it done this way, instead of simply like this: self.breadTypes = [[NSArray alloc] initWithObjects:@"White", @"Whole Weat", @"Rye", @"Sourdough", @"Seven Grain", nil]; Both seem to work when I compile and run it. Is the 2nd method above not doing proper memory management? I assume initWithObjects: returns an array with a retain count of 1 and I eventually release breadTypes again in the dealloc: method, so that wraps things up nicely. I'm guessing 'self.breadTypes = ...' copies the data to the new array, which is why the original array can be safely released, correct?

    Read the article

  • Using Library files in Linux

    - by paultop6
    Hi Guys, Im trying to use some of the functions that are in the /lib/libproc-3.2.6.so library in my Ubuntu Distribution. I have downloaded and installed the header files and they are defined in my source files. Currently this is all im trying to do, just for starters... proc_t **read_proc = readproctab(0); But i get the following compiler error: /tmp/cclqMImG.o: In function `Sysmon::initialise_sysmon()': sysmon.cpp:(.text+0x494): undefined reference to `readproctab' collect2: ld returned 1 exit status Im aware im probably doing some wrong with the command im using to compile it, but due to lack of experience im not sure what im doign wrong. This is the g++ command im using to compile my cpp file: g++ -o sysmon.o sysmon.cpp `pkg-config --libs --cflags gtk+-2.0` Can someone please give me some pointers as to where im going wrong Regards Paul

    Read the article

  • Most Efficient Way of calling an external webservice in Java?

    - by Sudheer
    In one of our applications we need to call the Yahoo Soap Webservice to Get Weather and other related info. I used the wsdl2java tool from axis1.4 and generated th required stubs and wrote a client. I use jsp's use bean to include the client bean and call methods defined in the client which call the yahoo webservice inturn. Now the problem: When users make calls to the jsp the response time of the webservice differs greatly, like for one user it took less then 10 seconds and the other in the same network took more than a minute. I was just wondering if Axis1.4 queues the requests even though the jsps are multithreaded. And finally is there an efficient way of calling the webservice(Yahoo weather). Typically i get around 200 simultaneous requests from my users.

    Read the article

< Previous Page | 158 159 160 161 162 163 164 165 166 167 168 169  | Next Page >