hi,thanks.
you know my problem is I want to get details to memory management and usage of stack and heap memory in unmanaged codes and compare it with the managed code,any idea from were can I start?any web resources.
regards
hi,thanks.
you know my problem is I want to get details to memory management and usage of stack and heap memory in unmanaged codes and compare it with the managed code,any idea from were can I start?any web resources.
regards
Hi,code anyone could tell me what is the difference between these two I know that the C# compiler makes a managed code and C and C++ compilers make unmanaged codes but what is the exact difference?
hey,I was very confused with this at first,I was thinking that:"how cud I just replace one the characters in a string that has duplicates of that character",cuz replace method replaces all the characters,then I thought maybe "I have to use power set algorithm",then I realized I needed the index,so lastly I did it like this and it works,:)
it wasn't that hard but I don't know why didn't come to my mind at the first place.
private void Form1_Load(object sender, EventArgs e)
{
string str="SbSA";
ArrayList arr_set=new ArrayList();
arr_set.Add("A");
arr_set.Add("S");
ArrayList result =new ArrayList();
result=combination(arr_set, str);
label1.Text = Environment.NewLine;
for(int i=0;i<result.Count;i++)
label1.Text += result[i].ToString() + Environment.NewLine;
}
private ArrayList combination(ArrayList arr_get,string str_get)
{
ArrayList arr_result = new ArrayList();
arr_result.Add(str_get);
for(int count=0;count<arr_result.Count;count++)
{
string str = (string)arr_result[count];
for (int i = 0; i < str.Length; i++)
{
if (arr_get.Contains(str[i].ToString()))
{
string str_rmv = str.Remove(i, 1);
if(!arr_result.Contains(str_rmv))
arr_result.Add(str_rmv);
}
}
}
return arr_result;
}
what do you think?!
you know this is working with sets and the combinations of it,
I'm using it for my Automat project that I have to replace the variables that go to epsilon with the right production of these combinations,
the picture attached might describe it better then me,
but the duplicates have to be removed,
thanks
finito:
AbbaSAbbast
What should this print?
if we assume that the only character existing in the arraylist is just the string
"A"
so the the arraylist is {"A"},the input string is "AbbaSAbbast",
the result would be:
"bbaSAbbast" and
"AbbaSbbast" and
"bbaSbbast" and
"AbbaSAbbast"
if we have a string "SbSA" and the arraylist contains {S,A}
the result shold be:
one of them doesn't come:
"bSA"
"SbA"
"SbS"
two of them doesn't come:
"bA"
"bS"
"Sb"
all of them come
"SbSA"
none of them comes
"b"
I hope that you understand me.
thanks finito.
I have a arraylist showing the characters that cud come or not to come in the string,
I have made a post for this on this link but I forgot to talk about the duplicates,
so still my problem remains,
http://www.daniweb.com/forums/thread284139.html
thanks
hi,
I have a string that has duplicates like "SbS"I want to replace one the first "S" and the other time,the other "S",so the output for it would be:
"Sb" and "bS"
but as I do it with Replace to just get one result that is :
"b"
what is the ways I cud solve this problem.
regards
thanks apegram,
TValue type of the dictionary is a string
yes thats the problem I noticed that the Tvalue is a list of string,
Dictionary<string, List<string>> dict = new Dictionary<string, List<string>>();
so how am i going to directly get to the contains of that list with these code lines?I cudn't figer it out,I think we need another list!?
Contains is an extension method belonging to IEnumerable<T> and is part of Linq.
can you explain this more.
regards:)
I really do believe that I’m not asking a good question, but I’m new newbie
When I’m programming for example I try to use the contain method for finding a value in the dictionary data type:
I cud do it in my mind by two way:
dict.Values.Contains(str)(however I had an error using it)
or
dict.ContainsValue(str)
i'm confused
thank you
thanks Ramy Mahrous
would you plz explain the parameters that you passed to the methed,
and explain a bit about Regular Expression .
regards
Input: aABD and set{A,B}
output:"aABD" "aBD" and "aAD" and "aD"
I mean I once ignor the charcter in the set,and once mention it,
and once don't meantion any of them.like("aD")
ok,
our input string is "aABD",
my set contians two strings "A" and "B",
the characters which are in the set,I mean "A" and "B",cud come or not come in the input string so(like the roles for epsilon in Automata lectures)
the result string are all these strings:
"A" doesn't come:"aBD"
"A" comes:"aABD"
"B" doesn't come:"aAD"
"B" comes:"aABD"(we had this before so we ignor it)
"A" and "B" don't come:"aD"
"A" and "B" both come:"aABD"(we had this)
this is it:)
No;
Input: aABD and set{A,B}
output:"aABD" "aBD" and "aAD" and "aD"
I mean I once ignor the charcter in the set,and once mention it,
and once don't meantion any of them.like("aD")
thanks
Hi,
I have a string and set (I not really using a set, it cud be a arraylist or array of string)
I want to have the following results:
{A, B}
If I have any character that does not contain in the in the set then just concat(concatenate)them to the rest but if it is in the set write the string once with the character and once without it
So for:
aAB -----> aAB aA aB a
what is the best way to do this?
thanks
hi,
I solved the remove problem but now the problem is when I remove a key or value from the Dictionary in a foreach loop,I get a error that the dictinary has changed Enumerator is not avaliable,....
so how can I remove?!
thank you
Thanks to adatapost and others everything is going well here,
but the problem is now I'm trying to remove a value from the Dictionary from a special key but it deletes the key also,
how can i sove this one?
I ask my question in another way,
how can I make different arraylists(different names)in a loop for my hashtable,
now they all point to one arraylist
S--------->arraylist1
A-------->arraylist1
I want it to be
S------->arraylist1
A------->arraylist2
work out which strings go in which array list.
No,at first all arraylist are empty so it's not important which string goes to the arraylist.
the strings here are used to fill the keys of the hashtable and
after that I have to fill the arraylist in another loop,but there i'm just filling one arraylist.(cuz all the keys have the same arraylist)
thanks Ketsuekiame
another problem that I'm having is that I make the hashtable in a loop,so what I did wrong is that gave the same arraylist to all the keys.
for (int i = 0; i < sSplit.Length; i++)
{
arrV.Add(sSplit[i]);
ArrayList arr = new ArrayList();
hshTable.Add(sSplit[i], arr);
}
so how can I make a different arraylists for every key?:)
Sorry guys ,I don’t know why I didn’t concentrated very well,
I just was looking for something like tostring and cudn’t find methods like GetType ,GetHashCode,..
string name = hshTable["Author1"].ToString();
it is done by this code:
arr= (ArrayList)hshTable[str];
I don't know how to make this post as solved?!
thanks
Hi nick,
thanks for helping I did post it,
here is it also with notepad.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.IO;
namespace Context_Free_Grammar
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
StreamReader objReader = new StreamReader("c:\\CFG.txt");
////////////////////declaration//////////
string sLine = "";
ArrayList arrText = new ArrayList();
//////////////////////////////
while (sLine != null)
{
sLine = objReader.ReadLine();
if (sLine != null)
arrText.Add(sLine);
}
objReader.Close();
//////////////////////////declaration/////////////////
Hashtable hshTable = new Hashtable();
ArrayList arrV = new ArrayList();
ArrayList arrT = new ArrayList();
//ArrayList Wrkarrlist=new ArrayList();
ArrayList arr = new ArrayList();
string s = "";
string[] sSplit;
////////////////////////////////////
for (int line = 0; line < arrText.Count; line++)
{
if (line == 0)
{
s = arrText[0].ToString();
sSplit = s.Split(',');
for (int i = 0; i < sSplit.Length; i++)
{
arrV.Add(sSplit[i]);
// ArrayList arr = new ArrayList();
hshTable.Add(sSplit[i], "");
}
}
else if (line == 1)
{
s = arrText[1].ToString();
sSplit = s.Split(',');
for (int i = 0; i < sSplit.Length; i++)
{
arrT.Add(sSplit[i]);
}
}
else
{
s = arrText[line].ToString();
sSplit = s.Split('>');
IDictionaryEnumerator en = hshTable.GetEnumerator();
while (en.MoveNext())
{
string str = en.Key.ToString();
if (sSplit[0] == str)
arr = (ArrayList)hshTable[str];
((ArrayList)hshTable["arr"]).Add(sSplit[1]);
// Wrkarrlist = hshTable["str"].;
// s = hshTable["str"].ToString();
}
// }
}
}
}
}
}
It looks like I’m not describing it very well,
I don’t know the listname,I going to access it from my hashtable key
So after I found out that this is the key,I want to access the arraylist of that key,and add stuff to that array,
It doesn’t work right with these codes,I’m mixed up:(
here is the code and the file is something like this
S,A,B
a,b
S>AB
S>a
A>b
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.IO;
namespace Context_Free_Grammar
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
StreamReader objReader = new StreamReader("c:\\CFG.txt");
////////////////////declaration//////////
string sLine = "";
ArrayList arrText = new ArrayList();
//////////////////////////////
while (sLine != null)
{
sLine = objReader.ReadLine();
if (sLine != null)
arrText.Add(sLine);
}
objReader.Close();
//////////////////////////declaration/////////////////
Hashtable hshTable = new Hashtable();
ArrayList arrV = new ArrayList();
ArrayList arrT = new ArrayList();
//ArrayList Wrkarrlist=new ArrayList();
ArrayList arr = new ArrayList();
string s = "";
string[] sSplit;
////////////////////////////////////
for (int line = 0; line < arrText.Count; line++)
{
if (line == 0)
{
s = arrText[0].ToString();
sSplit = s.Split(',');
for (int i = 0; i < sSplit.Length; i++)
{
arrV.Add(sSplit[i]);
// ArrayList arr = new ArrayList();
hshTable.Add(sSplit[i], "");
}
}
else if (line == 1)
{
s = arrText[1].ToString();
sSplit = s.Split(',');
for (int i = 0; i < sSplit.Length; i++)
{
arrT.Add(sSplit[i]);
} …
I think the best choose is the hashtable with the arraylist because all my values are string,
but now I'm having problem with retrieving the arraylist from the hashtable
for exmple I have a string that matches with the key of the hashtable and then I want to add some other strings to the arraylist of that key,
how should I do it?
regards
hi,thanks for replying
you know I have something like the image below,the column that has "s" points to the column that has an arraylist and so on for the other keys,the keys are unique,
I don't know what data structure is the best,
and I haven't worked with List<T>, Dictionary
Hi,
we have all seen hashtable with a values of string but I want to make a hashtable that
accepts the value as an arraylist,and add items to that array,delete from it,
how can I do that and is it possible?
thank you
thanks for your help,
I look at these pages,so the implementation is with a tree,
I'll read all,nice information,
hi there everybody,
I have to make a program that gets a string and then finds out if it is accepted by the CFG(cintext free grammer),
I want to first do the Simplification of CFG but I really don't know what data structure I have to use,
for example I want to get rid of useless symbols(those that do
not participate in any derivation of a terminal string.)
here i have the file that keeps the grammer for example
S>AB
S>a
A>b
then I have to get ride of B cuz not genarating termenals so the grammer would be :
S>a
A>b
then get rid of A cuz not reachable from S,so:
S>a
so how cud I do this with coding?
thank you
the problem is that line 32 should be changed like this:
rsSearch.open sqlstring,objConn,, adLockOptimistic, adCmdText
hello everybody;
this is my code
<%
Dim sqlstring
dim objConn
set objConn = server.CreateObject("ADODB.Connection")
'objConn.ConnectionString ="DSN=ostad.dsn"
objConn.open("ostad")
sqlstring = "SELECT * FROM ostad"
If Request.Form("TypeSearch") = "lname" Then
sqlstring = sqlstring & " WHERE lname LIKE '%"& Request.Form("DaInBox") & "%'"
End If
If Request.Form("TypeSearch") = "skill" Then
sqlstring = sqlstring & " WHERE skill LIKE '%"& Request.Form("DaInBox") & "%'"
End If
If Request.Form("TypeSearch") = "study_paper" Then
sqlstring= sqlstring & " WHERE study_paper LIKE '%"& Request.Form("DaInBox") & "%'"
End If
dim rsSearch
set rsSearch = server.CreateObject("ADODB.Recordset")
line 32rsSearch.open sqlstring,objConn,, adLockOptimistic, adCmdTable
and this is the error i get
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
/asatid/search.asp, line 32
plz help me to fiz it.whats wrong!?
nob,this did not work,anything else that can help,anyone?
hi,
I'm new to asp codes.I'm making my pages with Dreamweaver and using the simple Recordset dialog box options.i have gone ok with all that...
but when i try to see my pages on the first run i have no problems but when i push the back button on IE and try to test the page with other data on the "access database" i get this messege:
HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services
--------------------------------------------------------------------------------
Technical Information (for support personnel)
Error Type:
Provider (0x80004005)
Unspecified error
/university/moshahadaUI.asp, line 15
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Page:
POST 23 bytes to /university/moshahadaUI.asp
POST Data:
classid=5&Submit=Submit
can anyone help me plz.
hi there,
when I try to install office I have this error,can someone plz tell what should I do?
hi,
I have a ER Diagram about the pharmacy database.
but I have problems understanding the relastionships between the patient and the doctor,Idon't understand what "priphys" means in the diagram and why does it have a relastion with prescription(shown with number 3 in the image)
also what does the arrow mean in the diagram(shown with number 2 in the image).
what does the number 1 in the image mean.
my fan's power was making a lot of noise and damaged .when i changed it i don't have that problem any more.thx for helping me.
After i downloaded the whole file and almost was compliting the installation,i got this message:
thx for helping ,but can u tell what should i do now?
when my computer goes to stand by it doesn't come up with my mouse signals ,and not even with the keybords keys till i push the windows start button,and then my computer restarts .and i get this massege:
computer restarted after an unexpected shutdown.
microsoft windows detected a possible device failure.
the diriver for the display device was unable to complete a drawing operation.
what should i do?
I have installed a firewall and I not having any troble now.
thx Alvein. :)
thx,I have disabled the Startup Type,and I don't get any Windows Messenger service.
BUT I still think that my send and receive is unsual.
I scaned my pc with Ad-Aware SE and attached the resultes here so that it may help you to sovle my problem.
thx again
hi,
could someone plz tell me why do I get this messege when I'm connected to the intenet.
"Message from SySTEM to ALERT
microsft windows has encountered an internal Error your windows registry is corrupted
we recommend a complete sysytem scan"
what kind of virus is this and what should i do?
I think i my send and receive is not usual and my computer is sendind a lot of data.
forgot to say
i'm using win xp and turbo c++ and saved my program with the extension CPP.i compiled my program and it doesn't have any errors!
appreciate your help
i would be plzed that some1 tells me why doesn't my program run?and gives this massege "could not creat process!"
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
struct list {
char alph;
int freq;
};
struct list a[256];
///////////////////////////////////////////////////////////////
int main(){
int j,m,f,k;
FILE *fin;
char ch;
clrscr();
fin=fopen("a:test.txt","wt");
printf("\n enter characters($ for end):");
do{
ch=getchar();
putc(ch,fin);
}while(ch!='$');
fclose(fin);
fin=fopen("a:test.txt","rt");
for(j=0,m=0;j<256;j++)
{ f=0;k=0;
while((ch=getc(fin))!=EOF)
{
if(ch==j)
{ f=1;
a[m].alph=ch;
k++;
}
}
if(f==1){
a[m].freq =k;
m++;
}
rewind(fin);
}
fclose(fin);
getch();
return 0;
}