Thoughts Just4Qyx..."Live each day like it's your last..."
Just4Qyx
read my profile
sign my guestbook

Visit Just4Qyx's Xanga Site!

Name: Henry
Country: United States
State: New York
Metro: New York City


Interests: Dance2XS, Film, Bball, Ultimate, Blading, SC
Expertise: Professional Dancer/Web & Application Systems Developer
Occupation: Artist
Industry: Entertainment


Message: message me
Website: visit my website


Member Since: 8/21/2002

SubscriptionsSites I Read

Blogrings
LIALC Salt n Light
previous - random - next

Dance2XS Family
previous - random - next

EverybodyDance!!!
previous - random - next


Posting Calendar

|<< oldest | newest >>|
view all weblog archives

Get Involved!

Suggest a link

Recommend to friend

Create a site


Tuesday, June 16, 2009

Exporting DataTable to Excel

.NET C#

TIPS:
1.
I decided to try and programmatically store the SqlDataSource control of my Gridview into a DataTable.  This way I could save a call to the database, and also guarantee that whatever data I was exporting would be the same data the GridView was displaying!

Solution: OnRowDataBound Gridview event.
e.Row.DataItem exposes the data held in the control as a DataView, then use dv.ToTable(). I store this into session.

2.
For the Button OnClick event, I call 2 methods, one to modify the DataTable to my liking (remove or rename columns, etc.), another to actually export the DataTable in session to my response stream.

After iterating the DataTable and converting it to CSV format using a StringBuilder variable (plenty of algorithms to do this if  you google), I write the data to the Response stream like so:

response.Clear();
response.ContentType = "application/vnd.ms-excel";
response.Charset = "";
response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}.csv", FileName));
response.Write(sb.ToString());
response.Flush();
response.End();


Debug Timewaster #1

http://stackoverflow.com/questions/679070/imagebutton-event-does-not-fire-if-imagebutton-does-not-have-image

Debug Timewaster #2

Make sure your file name doesn't include spaces or else Firefox will NOT know how to handle the file!
  • the file name will be truncated after the first word
  • the .csv extension will be missing
  • firefox may append .xls to your file name automatically
  • and when the file opens in Excel it will NOT be formatted into nice columns!
IE handles the spaces in the file name just fine.


Firefox CSV file extension issue

http://forums.mozillazine.org/viewtopic.php?f=38&t=661368&start=0&st=0&sk=t&sd=a
From: vipworld (guest)
Posted July 20th, 2008, 11:20 pm
"I was searching and looking for a solution as to why firefox would not assign a .csv extension to my csv files. It turned out that a space in the filename was causing the problem. Hope this can help some developer..."

Well brother, you did indeed help out a developer!  If you ever read this, thanks man! 

Such a stupid issue that wasted 30 minutes of reading through site after site regarding mime types and what not when the real problem was Firefox's inability to handle spaces in the file name.  Come on Mozilla, I know you can do better =P

Funny fact that made me laugh was that his entry was on July 20th haha.


Wednesday, September 10, 2008

MTV A"B"DC

This is a response to Al's post:

http://weblog.xanga.com/albie81/673253831/beef-between-supreme-soul-and-jabbawockeez--nope.html

MTV's ABDC Season1 Casting Special was just one of MANY experiences that has jaded me towards TV shows in general.  It's not a competition of talent, it's a competition of viewership, sponsorship, and Nielson Ratings PERIOD.  The entire time Dance2XS competed, the producers and directors tried to get us to spin fabricated 2XS:NYC vs 2XS:Chicago plotlines.  After each round that we made it through, the director had to cut and request that we give more drama in our reactions.  Even Kayla would ask us "So who's better? Chicago or NYC?" and when we refused to answer the question straight out, they would push even more for some type of drama.

After Season1, the final straw was KabaModern losing to Status Quo. I lost all respect for the show.  I apologize to MnM everytime she wants to watch Season2 and I delay b/c I feel torn between wanting to see the performances yet not want to deal with the fabricated drama, crap judging, rigged voting, and the occasional group that doesn't even deserve to be on the same show as Jabba and FannyP etc. 

Supreme Soul getting ousted early is just another long string of disappointments over a show I have come to despise despite the talents of Jabba, Kaba, & FannyP.

Even HipHopInternational (the sponsors of ABDC) isn't necessarily "real" competition.  The judges can never be completely impartial, unbiased, & objective. It's not possible.  Plus the crews that win are just the "best" amongst the ones that competed, not the best in the "world", "country", or whatever the title they give away. What about all the crews that don't have the budget to compete?  Or have a style that the judges for THAT particular competition didn't appreciate?

True dance "competition"?  Go to the clubs, the battles, and underground spots dancers go to and let the crowds judge.  That's all that matters anyway... dance is expression, not competition.


Wednesday, June 18, 2008

Can a man who finds a woman attractive ever JUST be friends? Harry's Wisdom.

This entry is a response to datingish's http://weblog.xanga.com/datingish/662056828/can-men-and-women-ever-just-be-friends.html post:

Can men and women ever just be friends?

Harry: [N]o man can be friends with a woman that he finds attractive. He always wants to have sex with her.
Sally: So, you're saying that a man can be friends with a woman he finds unattractive?
Harry: No. You pretty much want to nail 'em too.
Sally: What if THEY don't want to have sex with YOU?
Harry: Doesn't matter because the sex thing is already out there so the friendship is ultimately doomed and that is the end of the story.
Sally: Well, I guess we're not going to be friends then.
Harry: I guess not.

-------------------------------------------------
Most of the comments here that disagree with Harry's wisdom, are neglecting the  "that he finds attractive"  part.  The followup about wanting to "nail" the unattractive ones too was more of a quip that he was saying to be funny.

with that in mind, it has been my EXTENSIVE observation from friends, acqaintances, and myself, that when a guy finds a girl attractive, it is IMPOSSIBLE to have a purely platonic friendship, which is what Harry is talking about. 

Harry's not talking about the evolved definition that "friendship" has turned into with the younger generations... ie. "friends with benefits", "comfort friends", "booty calls", etc. And he's not talking about acquaintances, or just random guys you chill with. We're talking FRIENDS that you invest in, because if you don't invest in friends, then they simply aren't one. 

ALL friendships need limits, including sexual limits, and it's those limits that are vulnerable to be broken WHEN a guy finds a girl attractive.  You are placing these limits on these types of friendship BECAUSE Harry is absolutely correct.  If he wasn't, then why the careful attention to limits? Because without them, then Harry's wisdom proves itself true.

If you're one of the people disagreeing with Harry, then either A. The other isn't attracted B. The other is biding their time or C. Your friendship isn't actually platonic.

Bottomline, we're all human.  If we didn't have sexual thoughts & desires about people we're attracted to, we wouldn't be normal.  And it's those sexual desires, no matter how small, given the right chance, the right moment, or a weak one, that friendship instantly becomes "more than just friends". 

Don't worry, you were right the first time. Harry IS a genius, and has saved many relationships because of it; and has explained the doomed ones.  If only everyone could believe.


Saturday, March 11, 2006

T_T     Today is a sad day in Chicago. Thanks for always having a smile and a laugh to give, being the first to teach me how to break, being ever faithful as a dancing buddy, and for being a true and loyal friend. I'll miss you Cory.  God bless and Rest in Peace.



Next 5 >>