« first day (745 days earlier)      last day (4194 days later) » 

12:03 PM
hi all how do u give a gridview a text value in codebehind?
 
@SaiefAl-Faour You want to populate the text that will be displayed in your gridview in the codebehind?
 
okay i can explain in another way
i retreive data from a database using linq
and many of the data are empty
so i want to give them a value
an example here:
 
hey guys, help me out with this
i want to save a PrintDocument instance as a PDF instead of printing it
how can i do it??
 
@SamyS.Rathore Without paying for an adobe indesign license, I don't know that you can.
 
12:08 PM
@SamyS.Rathore well, I guess you can roll your own pdf maker. I imagine that is not the easiest thing to do.
 
var result = (from query in data
select new
{

Latitude = query.Latitude,
Longitude = query.Longitude if empty then text "No location" else "link",

}).Take(50);
this.GridDisplayData.DataSource = result;
this.GridDisplayData.DataBind();
Billdr this is my example. But remember i do not display latitude in my gridview i use datafield with a hyperlink
 
i did find this iTextSharp API, but i couldn't fit it to my use
:(
 
12:30 PM
Hi all...
I am using Crystal Reports with MSSQL 2008 Express... Got stuck due to some problem, need help>..
 
@SamyS.Rathore its annoying api.. far worse than its java counter-part
why do you even need it? can't you just print the PrintDocument to a free pdf printer?
And has anybody ever had to bridge MSSQL with MySQL ? by bridging, I mean a way to keep them in sync
 
client wants to update MSSQL and have the changes replicated to MySQL
 
For the east coast
 
Its not about PDF only, need to generate reports...
 
12:34 PM
@SamarthAgarwal well iTextSharp isn't going to be free for your either, just FYI
 
everytime i load the form will the crytal report viewer, I get a dialog saying i need to login to the database..
 
since you're going commercial.. but I have worked with iTextSharp about a year back
wait a second!!
i think i just mixed up!
shoot - i was replying to @SamyS.Rathore
 
My question is strictly restricted to Visual Studio 2010, c# and MS SQL 2008 Exppress
 
no sorry it wasn't for you.. i got confused cos you replied to a reply that was for SamarthAgarwal
 
@Maverik... Please help me, I can't get my crystal report to work...
 
12:39 PM
@Maverik can't do that
the client machine may not have a free pdf printer
 
@SamyS.Rathore and you can't install one as part of your package? (kinda like how sage does it)
 
i doubt my lead would let me do that..
i have to ask, but lets say if odds turn out against me
 
@SamyS.Rathore well its a lot easier solution than trying to wade through iTextSharp.. you'll take a lot longer to get it to work the way you want
@SamarthAgarwal sorry can't help you
 
I have generated the report n all after watching tutorials, but i just cannot evade the login dialog. It pops out everytime, even though I dont have any username and password set for my server!
I just need to "by-pass" the login dialog.'
 
12:43 PM
u know any free pdf printer that might not need an exclusive installation??
 
Installation is required for each pdf printer, we have primo pdf, bullzip!
they are free!
 
I was wondering : why
`var dtTemp1 = dt1.AsEnumerable().OrderBy(c => c["a"].ToInt()).Select(c => c["a"].ToInt());`

is working but

var dtTemp1 = dt1.AsEnumerable().Select(c => c["a"].ToInt()).OrderBy(c => c["a"].ToInt());

says : (pic)
I thought that in fluent syntax you can do what ever you want ( in the order of elements)
 
@Maverik considering?
 
@RoyiNamir Select<int> ?
 
Well, each method produces different output than the input.
 
12:46 PM
@KendallFrey it shouldnt
@LewsTherin still no.
 
The first produces the same data in a different order, then selects from it.
 
I want just to get elements into Ienumerable but sorted by int.
 
The second produces different data in the same order, then tries to use that data as if it was still formatted like the origin.
 
I dont want to use sortedDATATYPE
just ienumerable which containse elements.
 
var dtTemp1 = dt1.AsEnumerable().Select(c => c["a"].ToInt()).OrderBy(c => c);
Use that.
 
12:49 PM
@KendallFrey +1. Still dont understnad why
whats the problem with
dt1.AsEnumerable().Select(c => c["a"].ToInt()).OrderBy(c => c["a"].ToInt());
 
You start with an IEnumerable of some complex data type.
Then you call Select and select an int.
Thus you have an IEnumerable<int>
 
Select(c => c["a"].ToInt()) yields int .
Also
[int].ToInt() doesnt suppose to fail
 
Then you do OrderBy on the IEnumerable<int>.
 
ok
...
 
But since int doesn't have an indexer, it fails.
You're essentially doing:
 
12:51 PM
doesn't have an indexer ?
 
Ah yeah
Lol
 
WTF ?
 
int i = 42;
int j = i["a"].ToInt();
How could that work?
 
OrderBy(c => c["a"].ToInt()); c is an int.
 
oh shi**
the c in order by is already int
you right
 
12:52 PM
Yep
 
so i'm like 95% done my project.
feels so good to almost be complete
 
@KendallFrey Can I have your brain? :P
 
@KendallFrey thanks.
( i should do eye check)
 
@rlemon Which means you have 85% left.
@LewsTherin How much?
 
All
For free
 
12:54 PM
All what?
 
@KendallFrey no seriously. I have to add some save functionality to the logger (outputs straight text file) and then some testing then by golly I think i'm done.
 
@KendallFrey Your whole juicy medulla oblongata for free.
 
ahhh nvm, there is an entire properties form I just remembered I put off
so like 60% done
 
why we cannot add app_code folder in web application project?
any idea?
 
can someone tell me how i can do this correctly please:

var result = (from query in data
select new
{
Latitude = query.Latitude == null THEN gridview.coulmn.Text("No Location"});
 
12:56 PM
@KendallFrey I'm still trying to figure out if 85% is a typo
 
@LewsTherin lol
There's a famous quote that says something about when the first 90% is done, then you need to finish the other 90%.
 
Ah ok :)
 
@SaiefAl-Faour First you need to tell us what you want.
 
10% of the code takes 90% of the effort
 
yea
or is it 80/20?
usually is
 
12:59 PM
@KendallFrey i want to change the value on my gridview cells if latitude is empty from the database
or has no value
 
Sounds like a simple if statement.
 
hey, as printDocument has e.Graphics() in the print_page event
to draw things
 
@KendallFrey well i want the if statement withing the "select new" in my LINQ query
 
how can i draw simillarly in a Document object
??
 
@SaiefAl-Faour Oh, then you should have a where clause.
@SamyS.Rathore Before printing? I don't know if you can. Isn't the event where you are supposed to do your drawing?
 
1:03 PM
@KendallFrey can u give me in example what u mean? why would i use a where clause?
 
i am trying to save the contents as pdf instead of printing
using this dll, isharptext
 
@SaiefAl-Faour You don't want to return all items, right? You only want some of them?
 
it takes a Document object and creates a pdf out of it, but i could'nt figure out how to add anything but text in that
 
Or are you not trying to return anything?
 
if (isWriting)
{
    writeGridView.ReadOnly = true;
    btnRevertSelected.Enabled = false;
    btnSelectAll.Enabled = false;
    btnSelectNone.Enabled = false;
    btnWriteSelected.Enabled = false;
}
else
{
    writeGridView.ReadOnly = false;
    btnRevertSelected.Enabled = true;
    btnSelectAll.Enabled = true;
    btnSelectNone.Enabled = true;
    btnWriteSelected.Enabled = true;
}
is there a button group control?
not toolstrip
then I can just disable the group of buttons and not all individually
 
1:10 PM
you could store them in an array and loop
 
No i want to return everything in the search result. What im doing is retreivng "Latitude" from the database and some of them has no value in the database, som it's just empty. I don't want to view that in gridview so that's why I want to do a query that checks if the value is empty and if it is empty then put the following text in the grindview Cell "No location Found".
If u look at my example here u will understand what I mean:

var result = (from query in data
select new
{
Latitude = query.Latitude == null THEN gridview.coulmn[9].Text("No Location"});
 
can i attach a custom event handler to a document object to do the printing
 
@SaiefAl-Faour You can't do assignment in a LINQ query. perhaps you should RTFM.
 
@KendallFrey It's an if statement in a select new statment similar to query.Latitude ?"this result" : query.Latitude "Result 2"..........
 
Can some1 explain me, that how in an event like this:
private void pd_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs ev)
 
1:18 PM
@KendallFrey yea I was hoping for a more elegant solution than that. There are only four buttons so that seems overkill
 
how are the two parameters related??
 
@SamyS.Rathore The same as 99.99% of events in the framework.
 
and yes u can do assignments in LINQ perhaps u should RTFM?
 
i want to create something simillar for my purpose, i have no idea how any of them work :(
 
@SaiefAl-Faour You technically can, but if you do then the whole world will hate you, because LINQ is specifically designed to work in a functional manner.
 
1:20 PM
like if i call ev.graphics.draw(), the changes are reflected in the caller object
 
Hello there!
 
Hello all
 
@SamyS.Rathore may be this is what you're looking for:
 
string filename = @"\ACOSTA\thumbs\4011\1212\22.11.jpg";
i need to get only file name from this path'
 
@Chets use LastIndexOf method
 
1:31 PM
Or the built-in IO methods
 
Yeah, way better
 
Path.GetFileName(filename);
 
without using IO
?
 
@Maverik looking into it....thanxx...:)
 
you dont wanna use IO?
 
1:33 PM
@Chets It doesn't perform IO. I just was referring to classes in the IO namespace
 
@WileyMarques how can i use that for file name
 
@SamyS.Rathore no problem. looks a lot cleaner than iTextSharp. and if I'm given a chance to change my library now in my old project.. I'll likely go with this one.
 
@KendallFrey i mean without using FileInfo
 
Use Path.GetFileName
 
& its methods
 
1:35 PM
hmm string.LastIndexOf("\") gets the last index of "\"
 
@KendallFrey It only gives me file name, i need whole path
 
That's not what you said.
 
then use GetFullPath
 
Suppose my input is like "\ACOSTA\thumbs\4011\1212\22.11.jpg" & i need output as "\ACOSTA\thumbs\4011\1212\22.11" @KendallFrey
 
1:37 PM
That's not what you said.
Try this:
Path.ChangeExtension(filename, null)
 
@Chets -> Use yourstring.Substring(LastIndexOf("\") + 1);
this will work
 
No it won't.
He changed the question twice since then.
 
it will give right output..,but is there any another way to do same @KendallFrey
 
i don't exactly have an iimage to print ther,
 
Of course there is another way! Why would you want another way!?
 
1:39 PM
he just wants to remove the file extension
 
i am printing a datagridview contents,
 
yes I would like to have 3 possible solutions for my problem
thank you
 
and i have this really neat code for doing that with printdocument
 
@SamyS.Rathore I just linked an image sample, but you can pretty much "draw" anything into the document.
I was under the assumption that you could take a printpreview image from printdocument and drop it into the pdf page but you could create structured document as well
(i haven't really used PrintDocument class)
 
well, seems like i would be using this class u gave
 
1:43 PM
@KendallFrey it will not working for some files like if my file name is "test.12" it will remove 12 from it..
 
but imma going to draw my own graphics...O-O
 
@SamyS.Rathore pdfs are never trivial matter >.< i dread working with them
 
@Chets That's what you asked for. You wanted to remove the extension.
 
@KendallFrey yes but in above example it dont have any extension its just a file name having a dot(.)
 
@Chets :) it is an extension by convention
 
1:45 PM
Sheesh man, it does have an extension.
the extension is "12"
all an extension is is a "file name having a dot(.)"
 
@KendallFrey in my db these is the file name..
 
Can you give a list of inputs and expected outputs?
 
Err, so you have to say somewhere to just remove the extension if its "valid"
 
goodday all
 
Inputs : "\ACOSTA\thumbs\4011\1212\22.11.jpg" Output : "\ACOSTA\thumbs\4011\1212\22.11"
 
1:48 PM
perhaps go through registry and see if it is a registered extension?
 
"\ACOSTA\thumbs\4011\test.12"
 
lol, somebody tell that to my lead
 
@LeClerq goodday !
 
@Chets My answer does that.
 
@SamyS.Rathore I hear ya! in my project I not only had to make pdfs, I had to expose a noob-friendly api on top!
 
1:49 PM
@KendallFrey but for the files having (.) in its name it fails
 
@Chets That's impossible. You need to change the question to add more information about which extensions are valid.
 
fortunately the licensing cost became prohibitive and I never had to see the entire thing through
 
A file named test.12 has the name test and the extension 12. Always
 
(the license for iTextSharp went from webserver to SaaS because of API thing)
 
hi
a method running in more than one thread will write into a field of an instance . i want to lock that while a thread write into it. here it wont be read. if multiple instances atempt to write on static filed i know to lock with same object
but how to share a instance field among the method(of same instance) running in different threads
 
1:51 PM
@KendallFrey yes but when i have a file name like this then i need to take it as it is
without removing its extension'
 
@Chets -> try this:
string str = @"\ACOSTA\thumbs\4011\1212\22.11.jpg";
str = str.Substring(str.LastIndexOf(@"\") + 1, str.LastIndexOf(".") - (str.LastIndexOf(@"\") + 1));
this will work
 
@Chets Well, you need to decide how to decide whther to remove an extension.
 
@KendallFrey exactly
 
You could hardcode/softcode a list of valid extensions, or read the registry.
Or, an even better solution:
Fix the goddamn problem that allows you to enter file names without the extension.
 
@MRS1367 it fails if file name is like 'test.12'
 
1:54 PM
no
for this reason
 
@MRS1367 it will gives me only 'test' not "test.12"
 
@KendallFrey answered to U
So with this problem you can try this:
string str = @"\ACOSTA\thumbs\4011\1212\22.11.jpg";
str = str.Substring(str.LastIndexOf(@"\") + 1);
and make an If condition for select right choice.
 
@MRS1367 it fails for "22.11.jpg"
 
Your file names may be like following:
22.11.jpg and 22.11
Right?
With 1 dot and two dot?
 
yes
 
1:57 PM
so You can do the following
 
it can be one or two dots
 

« first day (745 days earlier)      last day (4194 days later) »