|
Information on file I/O can be found here[^].
/ravi
|
|
|
|
|
hi sir,
i am doing a project for user behaviour models and i would like to make my system learn the classification based on CBR can u please share me code in c#
plz sir thanks...
|
|
|
|
|
If we give you code it's not you doing a project, is it? This is what we call cheating.
modified 5-Sep-12 4:03am.
|
|
|
|
|
Pete O'Hanlon wrote: If we give you cods Is that part of the give him a fish/teach him to fish dichotomy?
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
|
Pete O'Hanlon wrote: Damn phone keyboard.
Isn't that called a keypad on a phone?
|
|
|
|
|
|
hello to all. a newbie needs your help. i am working on a project and i'm stuck with this "cannot add an entity". i followed a tutorial and added the ribbon interface i found in this site. the code is almost the same, but mine is not working. it can't add data in the .mdf file. i uploaded the entire c# solution so you can see the entire project i'm working with.
here's the link to my project:
http://depositfiles.com/files/hlrdb1mne
many tnx.
|
|
|
|
|
kenajelencres wrote: i followed a tutorial and added the ribbon interface i found in this site.
Which one? If you post a question on the forum at the bottom of the article, an email will be sent to the author of the article.
kenajelencres wrote: it can't add data in the .mdf file.
Is the .mdf file write protected? Did you update the connectionstring to reflect your current setup?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
tnx for the reply. the tutorial i found is from another site.
the .mdf is not write protected, i can add records using sql management studio. did you look at the project solution i uploaded? if yes, try to add a record and it will crash. here's the screenshot of the error:
error screenshot
pls help. i need to finish it asap.
|
|
|
|
|
I didn't, don't download "code" that often; most people will not download it, we don't know what's in there. You can post a snippet with the offending code here, including the full text of any exceptions you received.
kenajelencres wrote: pls help. i need to finish it asap.
That's why we usually have flexible deadlines. We're volunteers here, if you needed an answer sooner, you should have posted the question sooner.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
The problem is fairly well defined in that picture. You are trying to insert a duplicate key here; if you put a break point on the SubmitChanges line, take a look at the values in newGradeYear . I'm going to go out on a limb and suggest that your key value is in IDNo (take a look in your database and see if this field is the primary key).
|
|
|
|
|
first, i would like to thank everybody who replied. you really are helping a newbie. i hope one of these days i can become one of you so i can help others too.
yes, the IDNo is the primary key, but i'm not inserting a duplicate. when i add a record, it will add 1 to the last key. i have only one record in the mdf, with IDNo 1. when i add another, it will automatically become 2. the textbox is not enabled, so there's no way you can edit it. but when i clicked on the DONE button, i get that error.
it's really hard to learn programming.
googling for some answer, i found this:
This error typically happens when you are creating a new record in a MetaTable with a foreign key relationship and the foreign key record already exists.
what does that mean?
here's the screenshot of my dbml: dbml screenshot
|
|
|
|
|
Have you done as I suggested and put a breakpoint on SubmitChanges? If you don't know how, simply go to this line and press F9 (a red circle will appear). Do a debug build and then run your application using F5 (start with debugging). Let the application run to this point, and then look at the Locals window in Visual Studio; look for the value in IDNo - make sure it's 2. Let's rule that out first.
|
|
|
|
|
wow that was a nice tip. tnx.
i did what you said and it turns out that IDNo is 1 because at the beginning of my code is
maxIndex = gradeyear.Count() -1;
and because i have only one record which i inserted using SQL management studio, maxIndex value is 0. and at the create new record
newGradeYear.IDNo = newGradeYear.IDNo = maxIndex + 1;
the value of maxIndex is 1 which will result in a duplicate. what i did is i took the value of textbox which has the correct value by using int32.parse. a new error appeared at the database.SubmitChanges():
Cannot insert explicit value for identity column in table 'GradeYear' when IDENTITY_INSERT is set to OFF
any suggestion to fix this?
i wonder why it worked on the tutorial i followed and not on mine when it is almost exactly the same code.
|
|
|
|
|
This is telling you that the field in the database is an identity column. That is a special type of column that you don't have to supply a value follow for. Simply drop the line where you give it a value and that should work.
|
|
|
|
|
I write as a relative novice but have the basics of namespace, class, method, etc. Looking to commence a mobile educational project. Looking for specific guidance on the creation of a mobile start page. Not yet ready to write lines of code out of
my head and so I need to get past the last hurdle. Looking for reading on best pracices and strategies for the creation of a good start page. In my request I would also hope
that this guidance includes links to what are known as snippets. Although I have seen many snippets in my readings I have yet to find a way to selectively search for what I need.
Initially, I would want the start page to allow to enter a name, grade level. Additionally, I would want an entry for a student area of academic difficulty. Getting these items into a start page would be a major advance. Presently
using C# in Visual Studio 2008 Team System but would hope to use Iphone and Android at some later time.
Much thanks as I await a reply
|
|
|
|
|
Try these[^] for size
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I need with this project as =RTD at excel can't trace back what the problem is at my C# code. I am fairly new at C# and working on a trading game application.
At excel I would like to use
1) =RTD("ProgramID",,"SecurityName","price")
2) =RTD("ProgramID",,"SecurityName","volume")
So at my program.cs file
class Program
{
static IDictionary<int, string>; ClientMappingDictionary = new Dictionary<int, string>();
static IList<string> ClientList = new List<string>();
static IDictionary<string, double> AUMDictionary = new Dictionary<string, double>();
static SecurityManager Sec = new SecurityManager();
static Orderbook_Generator OGen = new Orderbook_Generator();
static List<Security> A = Sec.SecGen();
[Guid("E128D214-56EF-4AA5-B5D6-7B2283CE2F79"), ProgId("TradeRTD.OrderRTD"), ComVisible(true)]
public class TradeRTD : MSExcel.IRtdServer
{
#region Data Members
private MSExcel.IRTDUpdateEvent m_callback = null;
private Timer m_timer = null;
private IDictionary<int, double> m_topics = new Dictionary<int, double>();
public IDictionary<string, Security> SecDic = Sec.SecurityMasterDictionary;
public List<string> Data = new List<string>();
#endregion
#region IRtdServer Interface
#region ServerStart
public int ServerStart(MSExcel.IRTDUpdateEvent CallbackObject)
{
m_callback = CallbackObject;
m_timer = new Timer(1000);
m_timer.Elapsed += new ElapsedEventHandler(m_timer_Elapsed);
m_timer.Start();
return 1;
}
#endregion
#region ServerTerminate
public void ServerTerminate()
{
if (null != m_timer)
{
m_timer.Stop();
m_timer.Dispose();
m_timer = null;
}
}
#endregion
#region ConnectData
public object ConnectData(int TopicID, ref Array Strings, ref bool GetNewValues)
{
Data = Strings.OfType<string>().ToList();
GetNewValues = true;
double price = SecDic[Data[0]].Price_History.Last();
double volume = SecDic[Data[0]].Volume_History.Last();
if (Data[1] == "price")
{
if (!m_topics.Keys.Contains(TopicID))
{ m_topics.Add(TopicID, price); }
else { m_topics.Add(TopicID, volume); }
}
return GetData(Data);
}
#endregion
#region DisconnectData
public void DisconnectData(int TopicID)
{
if (m_topics.Keys.Contains(TopicID))
{ m_topics.Remove(TopicID); }
}
#endregion
#region HealthCheck
public int Heartbeat() { return 1; }
#endregion
#region RefreshData
public Array RefreshData(ref int TopicCount)
{
object[,] data = new object[2, m_topics.Count];
int idx = 0;
foreach (string A in SecDic.Keys)
{
data[0, idx] = A;
data[1, idx] = SecDic[Data[0]].Price_History.Last();
++idx;
data[0, idx] = A;
data[1, idx] = SecDic[Data[0]].Volume_History.Last();
}
TopicCount = m_topics.Count;
m_timer.Start();
return data;
}
#endregion
#endregion
#region Supporting Methods
void m_timer_Elapsed(object sender, ElapsedEventArgs e)
{
if (null != m_callback)
{
m_timer.Stop();
m_callback.UpdateNotify();
}
}
private double GetData(List<string> junk)
{
if(junk[1] == "price")
return SecDic[junk[0]].Price_History.Last();
if (junk[1] == "volume")
return SecDic[junk[0]].Volume_History.Last();
else { return 0; }
}
#endregion
}
static void Main(string[] args)
{ .... orderbook generation and Server starting
I would really appreciate some help here as my =RTD is returning N/A all the time
Thanks
|
|
|
|
|
|
Kind of. Microsoft.Office.Interop.Excel provides a built in method for =RTD function of excel.
Where you can =RTD("ProgramID",servername,Topic_1,Topic_2,...) to access data
I was trying to use this. your link explains for static data. My data will be dynamic so I need to update constantly
modified 4-Sep-12 17:25pm.
|
|
|
|
|
yatici wrote: I was trying to use this. your link explains for static data. My data will be dynamic so I need to update constantly
That's quite an advanced topic for someone who "is new". Try the example here[^].
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
In a C# 2008 proxy class for a console application, I am thinking that I want to add code to the production application. I obtained some code from a contract shop that I want to work with. I want to be able to update the sql server 2008 database and change some directory path locations.
Am I allowing to do this in a proxy class? If so, are there certain rules I need to follow to be allowed to change the code?
If I am not allowed to change the code, can you tell me what my alternatitves are and how to code for these alternatives?
|
|
|
|
|
Are you and this[^] person one and the same or do you both work together?
|
|
|
|
|
I asked the other few programmers and one said the post was from them. Thus we work at the same company.
|
|
|
|