I'm jumping into Python/Django, and have been hitting some speed bumps. I'm a somewhat novice programmer. I know the basics, but haven't done anything more than create a PHP webform, and build very simple websites. I have a thousand questions about Django (most centering around Views and customizing the Admin, specifically as they relate to querying the DB), but I'll start with this seemingly simple one, and hopefully someone can help me out. In views.py, I begin with 'from django.http import HttpResponse'. I then create a boring function: def hello(request) return HttpResponse("Hello world") Seems simple enough, right?. While reading [the …

Member Avatar
Member Avatar
+0 forum 2

Okay so I have a class `Student`, which takes a number and a vector as a parameter for the constructor. Everything works well, until I output the values of the vector for every instance. The problem is that the same vector is being shared with EVERY instance I create, but I want it to be unique for every single one! //Student.h #ifndef __Grade_calculator__Student__ #define __Grade_calculator__Student__ #include <iostream> #include <vector> using namespace std; class Student { private: string name; int score; int class_count; int test_count; vector <Student> students; vector <int> Scores; public: Student(); Student(string n,vector<int> &s); ~Student(); int getScore(){return score;} void …

Member Avatar
Member Avatar
+0 forum 8

Hello everyone, In my wpf application i have user conrtols like button,rectangle,image etc.. in one side of the window(whole window is divided into 2 canvas panels) i need to implement the functionality where, if i drag any user control and drop it in other area of the window, a new instance of that user control has to be created (put simply, duplicate it). Please help me with the code if possible. thanks in advance.

Member Avatar
Member Avatar
+0 forum 1

Hello everyone, I am working on a VB project which implements a number of custom controls. So far I have had no issue with the controls I have been writing; until now. Every time I add the control to the form it appears like a normal control, however when I run the application, it throws a very vague "An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object" error. This is the code for my object (I don't think you need to read through all of it): …

Member Avatar
Member Avatar
+0 forum 3

Just a little fun with Python's named tuple, behaves like a class but is much leaner.

Member Avatar
Member Avatar
+2 forum 6

I get error #91 at line 114 (Object reference not set to an instance of an object). What do I need to do to correct that. (I get the error either pre-declaring X or as it is now) Thanks Dim iterAAA As Single = 1 54: 55: Dim arraydciP(3) As String Dim quantosDCIa1nosP As Single 59: Dim quantosDCIa2nosP As Single 60: Dim quantosDCIa3nosP As Single 61: Dim quantosDCIa4nosP As Single 62: 72: Dim arrayoa(3) As Object 73: arrayoa(0) = oa1 74: arrayoa(1) = oa2 75: arrayoa(2) = oa3 76: arrayoa(3) = oa4 77: Dim arrayop(3) As Object 78: arrayop(0) = …

Member Avatar
Member Avatar
+0 forum 1

Hi, Can anyone tell me how to create a class in C++ such that, the instance of that class cannot be created on stack? Am not able to figure out how to do it. Thank-you in advance, Sri

Member Avatar
Member Avatar
+1 forum 2

I have a warning that I can;t get rid of: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated. I am pretty sure it is becasue I have not dimentioned the variable but how do you dimention an IO.memorystream. Here is the code: Photograph1.Image = Photograph1.Image.FromStream(New IO.MemoryStream(arr)) Any help would be greatfull. The programms runs and works, its just got those annoying warnings.

Member Avatar
Member Avatar
+0 forum 5

i have a problem when updating database. i need to update stock value in other table and count it and update to another table again. here the code : 'in every row on 'SalesDetailBindingSource' For Each SalesDetailData In SalesDetailBindingSource MsgBox("SalesDetailData : " & SalesDetailBindingSource.Count) 'dim use to take parameter Dim SalesDetailDataRow = CType(CType(SalesDetailData, DataRowView).Row, myDataSet.SalesDetailRow) Dim paramTransactionNumber = TransactionNumberTextBox.Text 'parameter need : (paramProductId) Dim paramProductId = SalesDetailDataRow.ProductId 'row to find in table 'SalesDetail' Dim SalesDetailRow As myDataSet.SalesDetailRow SalesDetailRow = myDataSet.SalesDetail.FindByTransactionNumberProductId(paramTransactionNumber, paramProductId) 'in every row found For Each SalesDetailRowToFind In SalesDetailRow.Table.Rows 'here is the problem (i think) 'update to 'Stock' table …

Member Avatar
Member Avatar
+0 forum 1

This snippet shows you how to create a list of class instances. The class itself cannot be pickled, but the list of instances can. To use the pickled data file in another program, you have to recode the class in that program.

Member Avatar
+3 forum 0

Hi i m trying to connect with .mdf database file from vs2005. it gives error failed to create user instance .....i hv installed visual studio managemant express2005

Member Avatar
Member Avatar
+0 forum 2

Thanks for the support! I have been working on a program with 7 classes, one the main and one starts the program, and I have been troubleshooting for a few hours trying to see why for one of the output constructors I'm not getting the classes to update the output. A class called OfficeVisit calls the class Appointment, which then calls the classes MyDate and MyTime to output their data input by the user back through OfficeVisit's output cosntructors. But I'm not getting the right output for some detail(s) that I can't find. While other classes that use MyDate and …

Member Avatar
Member Avatar
+0 forum 1

Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick frmDisplayLockerInfo.Show() frmDisplayLockerInfo.TextBox2.ReadOnly = False frmDisplayLockerInfo.TextBox3.ReadOnly = False frmDisplayLockerInfo.TextBox4.ReadOnly = False frmDisplayLockerInfo.TextBox5.ReadOnly = False frmDisplayLockerInfo.TextBox6.ReadOnly = False frmDisplayLockerInfo.TextBox7.ReadOnly = False frmDisplayLockerInfo.TextBox8.ReadOnly = False frmDisplayLockerInfo.TextBox9.ReadOnly = False frmDisplayLockerInfo.TextBox10.ReadOnly = False frmDisplayLockerInfo.TextBox11.ReadOnly = False frmDisplayLockerInfo.TextBox12.ReadOnly = False frmDisplayLockerInfo.TextBox13.ReadOnly = False frmDisplayLockerInfo.TextBox15.ReadOnly = False frmDisplayLockerInfo.TextBox14.ReadOnly = False Dim i As Integer Dim ds As New DataSet i = DataGridView1.CurrentRow.Index Label1.Text = i frmDisplayLockerInfo.TextBox1.Text = DataGridView1.Item(0, i).Value frmDisplayLockerInfo.TextBox13.Text = DataGridView1.Item(1, i).Value frmDisplayLockerInfo.TextBox15.Text = DataGridView1.Item(2, i).Value frmDisplayLockerInfo.TextBox12.Text = DataGridView1.Item(3, i).Value frmDisplayLockerInfo.TextBox2.Text = DataGridView1.Item(4, i).Value frmDisplayLockerInfo.TextBox3.Text = DataGridView1.Item(5, i).Value 'Dim DS As New DataSet 'If …

Member Avatar
Member Avatar
+0 forum 5

Hi Guys I am trying to create a global object instance and am currently running into a segmentation fault while accessing a member variable. I have a capture.h file and a capture.cpp file //In capture.h struct ringinfo { // a simple struct }; class capture_manager{public: func1(); func2(); ringinfo ringinf ; }; extern capture_manager* capture_man ; //in capture.cpp { capture_manager* capture_man = NULL ; // all function definitions including a default constructor that initializes the ringinf = NULL ; } I include the capture.h file in a different .h/.cpp file and I can use the capture_man object and all of its …

Member Avatar
Member Avatar
+0 forum 5

Hi all, I got the error in design window "Object reference not set to an instance of an object." Instances of this error occurs at two cs files one.cs value = UIHelperConfig.GetSelectedPaymentTypeCode("CreditCard"); two.cs public static string GetSelectedPaymentTypeCode(string paymentType) { return ConfigurationManager.AppSettings.GetValues(paymentType)[0]; } How to make my design window viewable?? Any help??

Member Avatar
Member Avatar
+0 forum 2

Does anyone know how to resolve this other than a complete reboot? I'm restarting both my work desktop and personal laptop on an almost daily basis, which is irritating, to put it politely: **Couldn't register com.your.App with the bootstrap server. Error: unknown error code. This generally means that another instance of this process was already running or is hung in the debugger.** Thanks, Matt

Member Avatar
+0 forum 0

Hey all, I have been busy building my own chess game and as of now im a bit stomped. Well you see i have an object Board, this object will be initiated and it will create a new frame with various panels one of them being the panel which holds the squares of the board, inside that panel i create a grid of panels, with pictures as backgrounds(blocks for the chess board either black or white), and to each of those panels i add a jlabel, which in the future will hold the image of the piece on the board. …

Member Avatar
Member Avatar
+1 forum 2

Hi Ive got an error message saying "Object reference not set to an instance of an object." It doesnt make sense to me and the troublshooting tips says to make a new keyword, but since Im new to C# I dont fully understand it. Heres the bit of code thats making the problem. I think I know why the errors coming up because Ive linked two classes together so I might not have done it right. Can someone help me with this please? I just can't seem to figure it out. [CODE]class Athletes { private Event myEventParticipating; public Event EventPart …

Member Avatar
Member Avatar
+0 forum 6

Is there a way to call a visiblox chart that created with c# code in wpf? Let's say that i have created a chart like : [CODE]private Chart CreateNewChart(int num_chart, string chartName) { Chart newChart = new Chart(); newChart.Name = "Chart_"+num_chart; newChart.Title = chartName; newChart.Width = 600; newChart.Height = 120; newChart.Background = Brushes.Transparent; newChart.HorizontalAlignment = HorizontalAlignment.Left; newChart.VerticalAlignment = VerticalAlignment.Top; newChart.Margin = new Thickness(0, (num_chart * 110), 0, 0); BehaviourManager behaviour = new BehaviourManager(); behaviour.AllowMultipleEnabled = true; TrackballBehaviour track = new TrackballBehaviour(); ZoomBehaviour zoom = new ZoomBehaviour(); behaviour.Behaviours.Add(track); behaviour.Behaviours.Add(zoom); newChart.Behaviour = behaviour; return newChart; }[/CODE] And when i import some date …

Member Avatar
+0 forum 0

Hey dear Friends... I'm developing a code for an assignment given that find a solution for a modified Dining philosophers problem.. For that problem I had to create four classes. [ICODE]Philosopher[/ICODE] , [ICODE]chopStick[/ICODE] , [ICODE]samllBowl [/ICODE] and [ICODE]bigBowl[/ICODE].. I implemented the class [ICODE]philosopher[/ICODE] as Runnable.. And the problem is this.. As far as I know I have to write whatever I need to do with the thread within the [ICODE]run[/ICODE] method.. I want to call methods of other classes which I created.. but I haven't created any objects of those class in the philosophers class.. all objects are created within …

Member Avatar
Member Avatar
+0 forum 10

Can someone help...this used to be so easy in C++ and VB6 :) I am dynamically creating multiple instances of a fairly simple class, tracking them via the Collections class in vb.net. I loop through the collection if I need to get to a particular instance to set some property, for example. Everything is fine, and works ok until I try to destroy the instances that I created ([I]largely because I am probably not doing it right[/I]). What I am doing setting the instance to "nothing". That is, here is the portion of the code: [CODE] Dim node As mini_node …

Member Avatar
Member Avatar
+0 forum 1

When I declare a class or an instance of the class, I get the error, error: redefinition of 'class player' then after, I get, error: previous definition of 'class player' by the way, I am using gc++. If you want to see the source, just ask. thanx, JT

Member Avatar
Member Avatar
+0 forum 16

I have created a UserControl Popup window and called that xaml file into another file. Imported the namespace. When I am trying to build this project an error at this below given code: [code=xaml] <Popup x:Name="POP" IsOpen="False" PlacementTarget="{Binding}" Placement="Center" AllowsTransparency="True"> <a:PopUpWindow x:Name="pp" /> </Popup> [/code] Error at [code=xaml] <a:PopUpWindow x:Name="pp" /> Could not create an instance of type 'PopUpWindow'. [/code]

Member Avatar
Member Avatar
+0 forum 1

I was reading an SCJP book by Khalid Mughal and I came across a statement [QUOTE]Enum constants are static members[/QUOTE] and another [QUOTE]Enum constant is an instance of its enum type[/QUOTE]. I am unable to reconcile the 2 statements. Are the constants static members or are they instances ? (Instances means using new, though we can't ourselves create instances of the enum type)

Member Avatar
Member Avatar
+0 forum 5

Hi! I designed a class in Python to do stuffs related to genetic algorithms. I have a method in this class, which should provide a sort of log to keep the track of the populations during the evolution. I mean, I provide the filename as a string argument to this method, and the method should create the log and place things in it. What I want to do is that in the case of setting the filename argument as an optional one (with the default value equal to None) to be able to use the name of the instance of …

Member Avatar
Member Avatar
+0 forum 6

Yes, you can merge two class instances in this simple manner.

Member Avatar
+0 forum 0

I have a class, and create 4 instances of this class as per below: [code=PYTHON]class AuctionList: def __init__(self): self.Clear_Auction_List() # Data auctionList = [] #Functions .... [/code] [code=PYTHON]currentAuctionList = AuctionList() previousCurrentAuctionList = AuctionList() finishedAuctionList = AuctionList() successfulAuctionList = AuctionList()[/code] The class has a list variable and a few functions to manipulate it. When I add something to the first list, for some reason it also adds it to all the other instances also. [code=PYTHON]currentAuctionList.AddToList("Tree")[/code] I then call a method in the class that returns the length of the list for each instance of the class, and they all say they …

Member Avatar
Member Avatar
+0 forum 4

hi, I am new to c# and I am working on an application which has a main menu with an open dialog which enables users to select picture files, when the user has selected the picture file I then want this to be displayed in a new form called picture_viewer. I have created a new instance of the picture viewer on the main menu but I am stuck on how to get the picture into the picture box on the picture viewer form.

Member Avatar
Member Avatar
+0 forum 1

Create New instance of a class, but use a variable value as name..Possible? And yes, I've searched everywhere, but haven't found any useful. So i'll start by asking here. example code.. Error message: A local variable named 'className' cannot be declared in this scope because it would give a different meaning to 'className', which is already used in a 'parent or current' scope to denote something else [CODE] namespace IsThisPossible { class Program { static void Main(string[] args) { string name = "olaf"; newClass(name); } static void newClass(string className) { Stuff className = new Stuff(); } } class Stuff { …

Member Avatar
Member Avatar
+0 forum 5

The End.