« first day (18 days earlier)      last day (4931 days later) » 

3:32 AM
I have a question and am not sure how to solve this using regular expressions..
i have input like this: "<str1>;<str2>;!"
I am not sure how to construct the regular expression to extract str1 and str2 out of the input
could anyone please help me with that ?
 
@brainydexter: it is too unspecified
you want to clean your string out of any tags?
what result do you expect
 
@zerkms result should be str1 and str 2
 
<anything>
like this?
 
so the input is coming in as 1 long string
let me cite it with an example
input: <hello>;<world>;!
 
well, to catch <anything> - you can use regex: <[^>]+>
 
3:36 AM
output=>
string1 in input: hello
string2 in input: world
i need to extract the two strings from the given input
 
i gave a sample regex that will work
 
let me try it out
i got the two strings
but they have < and > attached
i dont want them
 
sure ;-) add parenthesis around the needed part only
<([^>]+)>
 
this regular expression makes me feel dizzy
:P
 
it can be another one regex, with positive lookup, but it will be a bit more complex
 
3:40 AM
na, that didnt fix it
 
show the code you used
 
nope, in this case you should use instance of regex clas
s
var regex = new Regex(@"<([^>]+)>");
var matches = regex.Match(string);
and after there inspect matches variable
 
ok
let me give that a shot
 
err, Matches()
@brainydexter
i was a little wrong
Matches() can be used statycally as well
 
3:46 AM
im still getting the same out[put
*output
 
:-S
 
ah, i was using that as a reference only before :D
 
it should work
 
but, i am still getting the output as <hello> and <world>
i just want hello and world
 
have you looked at Groups match property?
 
3:48 AM
i am trying to find myself some references.
 
its been a while since i did regex and I don't remember the meaning of these special paranthesis
 
each match has Value, that refers to the complete match
and Groups, which represents (...)
m.Groups[1].Value should give you what you want
 
each match in my case would be a group
 
:-S
match is a match, group is a group
match can contain 0..N groups
in your case - match contains 1 group, which represents the tag name without braces
 
3:51 AM
gotcha
makes sense
@zerkms i appreciate the help. Thanks a ton!
 
;-)
 
i know about regular expressions, but its been a while since I have used them
would you have a handy resource where I can read about all these different paranthesis
id like to figure out how the regex is working here
 
hmmmmm...... i don't know where to start learning them
this site is always referenced at SO answers
 
cool
thanks again :)
 
4:04 AM
@zerkms is there any way I can add one more constraint ..
the end of my input is always marked by a !
 
?
i don't get
 
so yeah..
 
<blabla!> ?
 
let me paste a sample
1 sec
<hello>;<world>;!
this is one input
the other:
<hello>;<world>;
I have a requirement that the input should always be ended with a !
 
so what are the expected results for 1 and 2?
you have to check it with another code
 
4:07 AM
now, when i process inp 1, everything is kosher
 
not with that regex
if (str.EndsWith("!")) ...
 
but when i process inp 2, i need a way to identify that the string is not ended with !
:D "zikes" !
 
check it with another IF as i showed above
 
i overlook simple things
yea, that would work
 
just FYI, the regex that checks that string ends with ! is: !$
 
4:10 AM
is there any way i can integrate that in the regex you mentioned earlier
 
nope
 
Rob
I just wrote something neat in C# I want to show off... where should I upload it? Rather, are there there any good project hosting sites that happen to be free?
 
codeproject ?
 
pastebin.com?
ah, the whole project
i like github and bitbucket
 
4:12 AM
please help me to do this
 
there is one by microsoft
 
1
Q: How to add data to a Listview from an XmlFile using LINQ to XML

Pramodhi'm having a ListView like and an Xml file (foo.xml) <root> <RowDetails RowName="A" ColumnSize="1"> <ColumnDetails ColumnName="A1" /> </RowDetails> <RowDetails RowName="B" ColumnSize="2"> <ColumnDetails ColumnName="B1" /> <ColumnDetail...

 
Rob
Yea definitely a whole project
 
cant remember the name..it offers versioning also
its open source though
 
Rob
I'll try codeproject
 
4:13 AM
sourceforge
 
waitup
 
it depends on what SCM you like... as I am mercurial adept - i choose bitbucket for myself ;-)
 
thats what I had meant :P
true
 
any body there....
 
I am beginning to like git myself
 
4:14 AM
hello
 
Rob
Ah
 
@Pramodh: no one
 
@zerkms , ??@
 
@Pramodh: O_o
 
@zerkms , funny..........
hey jusy look at my questioon
do you have any idea?
 
4:16 AM
i have not worked with winforms much
 
@zerkms , ok friend.... fine
 
 
3 hours later…
7:08 AM
Hello everyone :)
 
 
2 hours later…
9:31 AM
Morning all!
 
what is XML
Jamie: morning..
 
ok
 
10:01 AM
Hello all :D
 
Howdy
 
a quiet morning I see
 
Yup
Same old, same old.
 
Hello everyone :)
can any body tel me how to create dataset object dynamically ?
 
as in System.Data.DataSet?
DataSet.Tables.Add() will add tables to it
I'd then assume you'd need to add columns add rows to the datatable it returns
etc
 
10:18 AM
how to create multiple dataset object ex : think tat im using a lood so whenever the lood execute i need to create new dataset object
sory not lood its loop
 
do you need access to the dataset outside the loop?
 
no
for(i=0; i<10; i++)
{
//Here I want to create Dataset Object
}
 
for(i=0; i<10; i++)
{
DataSet ds = new DataSet();
}
 
can it be possible
 
I'd assume you'd want to add tables and rows to the tables in the data set so it might look more like this:
for(i=0; i<10; i++)
{
DataSet ds = new DataSet();
}
megh
how do you get it to not post on hitting enter
ah shift-enter
it shouldn't
 
10:22 AM
second time it throws an Error cos an object name ds already created
 
ds is being created in the loop, the variable shouldn't exist outside the loop, so it drops out of scope and then gets recreated each loop
however if the compiler is complaining, you've probably used ds somewhere else in the method so try calling it something else
 
hello
 
@masoudramezani hi :)
 
I have a problem with write permission to a created directory that I create it in my application
 
10:24 AM
for example, heres a test app I just wrote, which works. But doesn't perform anything useful :P

static void Main(string[] args)
{
for (int i = 0; i < 10; i++)
{
DataSet ds = new DataSet();
}

}
 
I want to upload a file in it but i get this error
Access to the path 'my path' is denied.
 
is it a web app?
 
yes
asp.net
 
is it running using anonymous authentication
?
 
Thnks will try it
 
10:25 AM
no
 
What authentication scheme have you got set in IIS then?
 
I work in my computer and don't publish that in my web server
I'm debugging it
 
ah. So it's likely running under your current user?
You using Vista or Win 7?
 
yes
no
XP
also in 7
 
does the folder the app creates get created?
 
10:29 AM
yes
 
permissions look fine on the folder?
 
but it is read only
I set ASPNET permission to my folder
 
you can try unticking read-only. But I doubt it would make a difference.
I've just had a though. Does your web.config set any user impersonation?
 
when I untick read only it doesn't work
 
though that wouldn't make sense. Because the impersonated user would be automatically given access to the folder.
 
10:31 AM
no
 
Meh. I dunno then. Sorry I can't be of more help.
 
tanx very much
2
Q: How we can add write access to a directory programmaticaly in C#?

masoud ramezaniI have a asp.net page that create directories and in another page I upload some files in these folders, but when I upload a file in a directory, the below error appears : Access to the path 'my path' is denied.

any help?
 
10:48 AM
anybody help me to write a simple xml reader and writer
 
@vishnu If you don't want to do it for educational purposes, you're much better off using the XML-Classes (XMLTextReader/Writer etc) that ship with the .NET-Framework
 
@Christian: check this article. codeproject.com/KB/cpp/XMLReadWrite.aspx
 
11:11 AM
@vishnu Anything wrong with using XmlDocument, XDocument, XmlReader or XmlWriter? Or are you just doing it for fun?
 
11:23 AM
@Sekhat wait i will tell the error text.
can i paste the full code of a class here ?
 
@vishnu dunno, never tried
 
@Sekhat does the SO has any pastebin like feature ?
posting some Interested code here
objXmlTextReader = new XmlTextReader(m_sXMLFileName);
objXmlValidatingReader = new XmlValidatingReader(objXmlTextReader);
objXmlValidatingReader.Schemas.Add(m_objXmlSchemaCollection); //ERROR IS ON THIS LINE
code inside the class constructor.
m_objXmlSchemaCollection = new XmlSchemaSet();
 
@vishnu whats the error?
error pretty much states the problem
let me see if I can whip up what the non-obsolete way would be
 
11:41 AM
@Sekhat ok
 
that's probably because your trying to add a XmlSchemeSet to a collection of XmlSchema's
instead you should be adding an XmlSchema
which would probably be best loaded from an xsd
 
@Sekhat what is the use of xsd file ? The data is in xml file
 
and xsd file is a XML schema. It's contains the definitions that should exist inside the XML file and can be used to validate that the xml file confirms to the format specified in the XSD
if your not using XML schemas however, you have no reason to use them at all.
So if your not using a schema then your code should be dead easy to open an xml file for reading
string myXmlFile = "Hello.xml";

XmlReader reader = XmlReader.Create(myXmlFile);
However, if you are using schema's it'd be along the lines of:
// Load the schema
XmlSchema mySchema = null;

using (StreamReader reader = new StreamReader("mySchema.xsd"))
{
mySchema = XmlSchema.Read(reader, null);
}

XmlReaderSettings myReaderSettings = new XmlReaderSettings();
myReaderSettings.Schemas.Add(mySchema);

XmlReader xmlReader = XmlReader.Create("Hello.xml", myReaderSettings);
hope that helps :)
 
11:57 AM
ok
@Sekhat here is the code pastebin.com/pVjuHzKW
checked my code ?
 
yep, just fixing it up
 
12:16 PM
ok
 
I would also note, but this is only a style thing so it's your call. The whole hungarian notation, the prefixing variables and names with their type, is usually frowned upon these days. Especially in C#.
 
ok
It worked .....
[offtopic] where are you from ?
can you explain the code changes ?
 
3
Q: Exception raised when using a Linq query with Entity Framework [SOLVED but don't know why?!].

SergI removed a substantial amount of text from this question because I feel it needed to be more succinct. - Serg Here's what I'm trying to do. User selects a State, then a ComboBox loads with Cities in that State, then when user selects a City a Listbox loads all projects from that City. When run...

So I figured out the problem, but I don't know WHY it's fixed. Maybe someone can solve this puzzle?
See the last edit on the question at the bottom.
 
12:33 PM
@vishnu As for the code changes. MS made XmlValidatingReader obsolete. You just need to create an XmlReader. However, XmlReader has no public constructor, but they exposed a static Create() method. The Create() method accepts the xml file to read and some XmlReaderSettings to configure the XmlReader on how it should behave when reading the xml file
 
@Serg how is the question send in this chat
 
@vishnu, paste the link to the question on its own
 
@Sekhat Yes. Just asked. I said it is OffTopic.
 
Just copy and paste the question here. It'll "onebox" it.
 
@Benjol paste the link like 'http://stackoverflow.com/q/4061447/452202'
 
12:36 PM
@vishnu as you can probably tell, the XmlReaderSettings are setup to use the XmlSchemas, which in turn configures the XmlReader to validate the xml as it reads it :)
 
@Serg ok. found it
 
thx
 
@Sekhat ok.
 
@vishnu Makes sense?
 
@Sekhat yes, but little. So XmlReaderSettings configures the XmlReader to validate xml. is this wrong ?
 
12:42 PM
@vishnu in this case, yes, it's right. XmlReaderSettings can be used to change lots of things about how the created XmlReader behaves. Using it to configure validation is only one such use.
 
0
Q: Should I save images to the database itself as binary information or as a path on the FS?

Serg Background information: This application is .NET 4/C# Windows Forms using SQLite as it's backend. There is only one user using the database and in no way does it interact through a network.interact through a network. My software needs to save images associated to a Project recor...

 
i have a question can it be asked on SO ? the question is for example take the word abcd

it has 4 charcters. by adding the ' . ' in between the characters you can write it as a.b.c.d

rules
can use only 1 dot between characters
can use multiple dots in the word
cannot use dot at the beginning or end of the word ie .abcd or abcd. are false

some of the answers
a.b.c.d
a.bcd
ab.cd
abc.d
a.b.cd
a.bc.d
ab.c.d
abc.d

how many word are possible to make. how to write a program to find it in c# ?
 
1:13 PM
0
Q: C# program to find no of words that can be generated from a word by adding ' . ' in between characters ??

vishnuI asked this question in the chat room. but no answer so i am posting the question here. The question is, for example take the word abcd it has 4 charcters. by adding the ' . ' in between the characters you can write it as a.b.c.d rules can use only 1 dot between characters can use multip...

 
1:27 PM
up 3 dots, either on or off, it's like binary = 100, 010, 001, 110, 101, 011, 111. Number of words available = 2^3
if you want to work it on the size of the word
2 ^ (SizeOfWord - 1)
oh and 000 :P
 
2:07 PM
hello
anybody there?
 
/me is.
 
2:47 PM
did somebody replace all the C# compiler error messages with "see stackoverflow.com/questions/ask";?
bah
 
@TimRobinson eh?
hi all o/
 
@TimRobinson that seems like a good addin for Visual Studio!
 
you know what add-in I want for VS, a back button
so when you do 'go to definition' or something like that, you can instantly hop back to exactly what you were seeing
even if it's in the same file
 
@shogun i think ctrl-= does that
 
:O
 
2:54 PM
@entens Vingy has SO search from within VS2010
 
nope
i hit ctrl = and it selected a bunch of code
 
@shogun use CTRL-SHFT-8
when you use f12, ctrl-shift-8 goes backwards
(in vs2010)
the non-numeric-pad 8, btw
 
SWEET
what do you mean about f12
im in vs08 btw
 
f12 = go to definition
 
2:56 PM
ohh nice
 
works on 2008
 
that is really great
 
but to go backwards (where you were before you hit f12) you use ctrl-shift-8 on vs2010
 
@gmagana yeah, but i want to show SO links inline with the exceptions & warnings toolbox
 
@entens hmm closest thing I can see is the community comments when you go to online help for a particular error
 
3:04 PM
@shogun it was established that this feature exists, right? Just making sure
 
yeah
i just learned the shortcut key from gmagana
thanks
 
ok, cool
I use it off and on, but I know there's in icon on one of the toolbars too, that I see my coworkers use obsessively :p
I'm like, lern2keyboard!!!!
 
haha yeah
so out of everyone here who is 30-40 and been programming since their 20s (i understand this may be nobody) how many of you have caprul tunnel
i kind of think its not a for sure thing, maybe a little bit genetic
combined with habits obviously..
 
I type with my wrists at 90° angles and my face an inch or so from the screen. It gives me super strong wrists and 40/40 vision
 
not carpal tunnel here, been typing and coding for about 15 years
 
3:13 PM
40/40 vision is terrible
 
I've also built houses and dug ditches and slung burlap 100lb sacks of potatoes and 50lb boxes of potatoes and 50lb sacks of onions and I play sports recreationally and I waterski and so I think the trick is to get up off your duff ;) :p
 
you should say 5/5 or 10/10
 
I'm like the mole man from the simpsons
 
lower the better :)
oh
you meant worse
 
No I didn't :( just covering my ass
 
3:14 PM
oh haha :)
i think the best possible measurement in the medical industry is like 10/10
 
umm... I think you mean 20/10....
10/10 is the exact same as 20/20.
 
Looks like we both got locked down. I'm hanging up my optometry hat
 
oh
yeah i think you're right
haha yeah i'll stick to codeometry
 
Visual acuity (VA) is acuteness or clearness of vision, which is dependent on the sharpness of the retinal focus within the eye and the sensitivity of the interpretative faculty of the brain. Visual acuity is a measure of the spatial resolution of the visual processing system and is usually tested in a manner to optimise and standardise the conditions. To this end black symbols on a white background are used (for maximum contrast) and a sufficient distance allowed to approximate infinity in the way the lens attempts to focus. Twenty feet is essentially infinity from an optical perspecti...
 
20/10 means "what can be expected to be read at 20 feet, can be read at 10 feet" (I think, IANAO)
 
3:16 PM
so is 40/20 the same as 20/10?
oh
 
20 is chosen for consistency
 
i should ask my cousin he is an optomestrist for the navy
 
So he's a See Man?
 
but i'll never remember so wikpedia ftw
 
Corny.
 
3:17 PM
the number should always be given with a 20 first
 
groan
 
@Pete I was gonna let it go myself ;)
 
oh i get it
yeah exactly soundsolider, it's always 'eye eye captain' when he's around....
 
Bazinga
 
brb i was just given a hardware task <3
 
3:35 PM
Finally! Firefighting is done, time to get back to GreatPlains integration hell
 
3:46 PM
Nice to see we are talking about optometry in the c# chat.. ;)
 
when in doubt, talk about random topics that have pressing technological importance!
 
i needed a way to see around a dark corner for my task, so I made a flash light for my iphone: ryancalderoni.com/free-iphone-flashlight (lolz)
just couldn't help myself :D
 
lulz
 
4:42 PM
you guy will appreciate the cleverness of this: labs.codecomputerlove.com/FlashVsHtml5
guys*
 
@shogun nice...
 
not sure how they did that
probably just some javascript sending the coords back and forth
 
that's actually really cute
 
i know that's what i thought, especially since at first you're like oh here we go again with flash vs html5
but it's literal this time haha
 
@lnluis did you get some rest last night?
 

« first day (18 days earlier)      last day (4931 days later) »