Open Side Menu Go to the Top
Register
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

05-30-2013 , 03:00 PM
Quote:
Originally Posted by well named
Stylistically speaking the thing I would look to correct is that the file you are requiring shouldn't be directly generating output. have whatever code sends output in a function or class and call it.

Also, if you don't think the required file is actually intending to output anything, check for extra white space after the closing PHP tag in the included file:

--- start of file ---
<?php

function stuff_is_here($blah)
{

}
?>

----- end of file ---

because it will end up sending that extra newline as output which will prevent header() from working.
If this is the standard / custom for php I would like to know. However as of currently my prof is requiring me do what you say I should not do. For instance i need a displayForum.php script that prints the entire form to the page and i need to include it on my webpage file where i want the forum to be. Also, ill look for a white-space finding site b/c i dont want to check all my files. thanks tho
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-30-2013 , 03:10 PM
I guess I have no idea what is standard. I tend to only write PHP within app frameworks like CodeIgniter anymore which sort of changes things. But here is what I would think about it: if you're including a file that outputs something, that's a very different kind of usage than including a file that contains class definitions like a data model, or some library functions, or anything like that. The latter make sense to include immediately, but the former pretty much have to be inline where you actually want the output to occur. So if what you are including is actually something like a view, i.e it outputs HTML, then it makes sense that it can't occur prior to outputting headers.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-30-2013 , 03:34 PM
Re: CSS, if all of the tables are in the same container, and the tables themselves are set to fill the width of that container, and they all have the same margins/padding, then if you set % widths on the td tags they should come out the same. Or, you could use fixed widths

It would probably be better HTML to eschew the use of tables at all though. I'm not really an HTML/CSS guru by any stretch, but I would think something like this would work (I haven't tested it, but I'm more or less just simplifying the way the bootstrap row-fluid and spanN classes work.)

Code:
<!-- this class sets the width to whatever you want, however you want -->
<div class="container">

<!-- this is a post -->
<div class="post">
    <div class="post-column column-one">column 1</div>
    <div class="post-column column-two">column 2</div>
</div>

</div>

# styles
.post {
    display: block;
    width: 100%
    margin: 10px 0;
    padding: 0;
}

.post:after {
    clear: both;
}

.post-column {
    display: block;
    float: left;
    margin: 0;
    padding: 8px;
}

.column-one {
    width: 30%;
}

.column-two {
    width: 70%;
}
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-30-2013 , 03:55 PM
not to be that guy but

divs are block by default.

block items are 100% width by default.

the proper format for a pseudoelement clearfix is:
content: '';
display: block;
clear: both;

and only works for IE8+. If you're not setting heights (which you shouldn't) just use overflow: hidden.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-30-2013 , 04:22 PM
Quote:
Originally Posted by Grue
not to be that guy but

divs are block by default.

block items are 100% width by default.

the proper format for a pseudoelement clearfix is:
content: '';
display: block;
clear: both;

and only works for IE8+. If you're not setting heights (which you shouldn't) just use overflow: hidden.
it doesnt have something to do with "border-collapse:"?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-30-2013 , 05:08 PM
edit: sorry. the problem was i had a colspan of 2 at the top of my table and that was stopping this from working. any way to keep that colspan?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-30-2013 , 05:51 PM
grue: thanks for being that guy. I'm trying to learn CSS better. I did not know block items were 100% by default.

re: colspan: make the width half of what you want the "combined" column to be for those two td cells, if the colspan=2?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-30-2013 , 06:35 PM
I just set-up a personal website in Drupal (Wordpress was my first choice but the install kept failing on my server, so I gave up) with some basic background/contact info and a blog, but now I'm thinking I'd like to try building a few simple web apps to learn Ruby on Rails, which I'd like to host on my website as well. What would be the best way to do that? Can I run the Rails apps within the Drupal framework, or should I build the whole thing in Rails, or...?

Edit: Is Heroku free for hosting simple apps like this? That would probably be easier, just host the apps elsewhere and link to them from my site.

Last edited by n00b590; 05-30-2013 at 06:43 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-30-2013 , 06:51 PM
Quote:
Originally Posted by n00b590
Edit: Is Heroku free for hosting simple apps like this? That would probably be easier, just host the apps elsewhere and link to them from my site.
Heroku essentially lets you decide how many resources they devote to your app and charge you based on that. There is a free tier.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-30-2013 , 07:00 PM
Quote:
Originally Posted by n00b590
I'm thinking I'd like to try building a few simple web apps to learn Ruby on Rails, which I'd like to host on my website as well. What would be the best way to do that? Can I run the Rails apps within the Drupal framework, or should I build the whole thing in Rails, or...?.


Rails is a ruby framework for building web apps. Drupal is CMS built with php.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-30-2013 , 11:20 PM
For one, I don't think you can dependably deploy Drupal on Heroku or AWS.

Second, mixing RoR with Drupal sounds like a disaster.

Third, Drupal has a steep learning curve (Mount Drupal). I'm personally of the opinion that the reward is not worth the effort.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-31-2013 , 01:10 AM
I have ~10 days off from the job due the boss going on vacation. What project can I cook up that is semi-interesting?

If anyone needs a bit of (free) code done in .Net / C#, feel free to toss me a pm. It's free because I'm not super duper, I don't have too much time this week so I can't promise any LOC, and I need some practice. FWIW, I can tie to a database, build Repeaters, do <asp:<tab><tab>, and semi-build LineViews (I learned this today).

I feel like this is where I'd post a bunch of incredibly wrong and laughable posts I found on the internet, including SO, giving code advice on how to program C#. I'm seriously mystified, shocked, and frustrated by the poor code examples I constantly stumble across.

I would expect that most people who do C# were... well, I don't know, better than the average Python programmer, but it seems like 80% of the people out there are lost with the language.

Why?

- Are the really good programmers open-source only?

- Is C# too complicated and convoluted?

- Does <tab> programming make you a bad programmer?

- Is it the effect of the so-called Java schools, where many people are just programming in C# since it is a "better" Java?

- Is the community just too small? I think that finding good Python code is much easier because there are so many people to learn from and so many people to put other people into check.

I understand that part of it is that it is very difficult to describe or drill down into a specific problem that is asked, since many of the questions that I am searching for deal with web-building issues, and that I can get over. It is the other stuff I described up-thread that bothers me, plus many other things. I've seen people say straight up that xyz can't be done in C#, so use JavaScript instead, and have a green check next to the post. I'm thinking: "what? I'm doing that very thing right now!"
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-31-2013 , 05:35 AM
I think the issue is that C# is used a lot in intro level university classes (and maybe HS these days) whereas Python is still a language people pick up and learn for themselves for the most part.

C# also has a bunch of "let me quickly hax this together in VB" converts.

Python also probably has a community that is more of the "let's post a cool bit of code on SO" breed whereas C# has by and large a more "corporate" fellowship.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-31-2013 , 09:39 AM
There's maybe a difference between people writing C# for ASP.NET stuff (more likely to come from having uses VB ASP in the past?) and people writing non-web apps? For example I've worked on a C# client that's not ASP for 6? years or so and I have no idea what repeaters, asp<tab><tab>, or lineviews are.

Although it seems like around here the trend is basically that the C# codebase looks more and more like it was written by java developers, except for all the LINQ stuff

I guess it wouldn't shock me if the superstars of open source are in general better programmers than your average corporate c# developer though (i.e me :P)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-31-2013 , 10:15 AM
Drupal's problem isn't the learning curve, it's that it's overengineered and underfeatured in its core.

The results are the Drupal version of DLL Hell, and a reliance on third party plugins documented in broken English.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-31-2013 , 12:32 PM
Quote:
Originally Posted by daveT
I have ~10 days off from the job due the boss going on vacation. What project can I cook up that is semi-interesting?
set up your poker bot so it can play itself. then alter the strategy slightly on one of the bots like having it check raise and barrel every oesd if the board doesn't pair but fold to aggression unless given direct pot odds. simulate a hundred million hands or so and have it output the data. run some stats on the data to find the EV and variance of the hyper aggro strategy vs your bot and post results.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-31-2013 , 01:55 PM
Dave, try to reproduce some of the 6.00x psets in c# and make them web capable? Maybe use the web aspect of .net to build an api server that lets you play hangman, then code up the UI with html5 stuff?

Or if you're feeling adventurous try to build a native windows app and learn the win32 api. I fooled around with c# once and wrote a helper tool for a game I used to play. It was a fun experiment to learn a bit about .net. It was really rewarding when I finally got a rect of a directx game drawn into my app's form while being zoomed in by x amount.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-31-2013 , 06:36 PM
Quote:
Originally Posted by well named
There's maybe a difference between people writing C# for ASP.NET stuff (more likely to come from having uses VB ASP in the past?) and people writing non-web apps? For example I've worked on a C# client that's not ASP for 6? years or so and I have no idea what repeaters, asp<tab><tab>, or lineviews are.
Yeah, this could be part of it. I think one of the short-comings of ASP is that it attempts to do so much for you and that ultimately abstracts the functionality away from you, so it can be quite difficult to envision what is happening or how it happens. I just wrote something yesterday and I still don't understand why it worked, I just know that it does work if type x here and y there. While it's sort of good in the sense that you can write some powerful stuff with ease, it can be bad because one little misstep creates massive hard-to-find bugs and sometimes figuring what you really do or do not can be a shot in the dark.

I'm getting a lot better at the rhythm of C#. I'm approaching the engineering strictly bottom-up. It is for this reason that the advice can be confusing and all over the place, assuming that many people likely try to go top-up / bottom down.

The asp<tab><tab> comment is basically the auto-fill capabilities:

Code:
<asp:Button ID="" runat="server">
I'm still kind of off-kilter about the tab-completion stuff. Grant it, I don't want to write more than I have to, but it's still a bit strange to me. As you are aware, some of those function names are looooonnng.

Quote:
Although it seems like around here the trend is basically that the C# codebase looks more and more like it was written by java developers, except for all the LINQ stuff

I guess it wouldn't shock me if the superstars of open source are in general better programmers than your average corporate c# developer though (i.e me :P)
LINQ seems to be where its at. Every .net C# book I've looked at lately spends about 50% of their time writing about how to use LINQ. Unfortunately, we aren't using LINQ.

Not sure what the "correct" style of C# coding is yet. The boss has pretty much let me have free reign to struggle and mess up. Mostly, I just ask questions about various approaches, but he really hasn't given me many answers, so he hasn't seen much of my code. He did send me some code he wrote before for guidance on an issue I had. Aside from one thing I totally disagree with, I don't see any real difference between what I wrote and what he wrote, though there are some things I do differently.

I should have been a little less contentious on my coder-quality commentary. I didn't really mean to suggest that C# / Java coders are bad programmers. I was just exploring the possibility that the spilled-ink may have some truth.

Quote:
Originally Posted by Neil S
Drupal's problem isn't the learning curve, it's that it's overengineered and underfeatured in its core.

The results are the Drupal version of DLL Hell, and a reliance on third party plugins documented in broken English.
I've not bothered to look at the source, so I'll take your word for it.

Quote:
Originally Posted by e i pi
set up your poker bot so it can play itself. then alter the strategy slightly on one of the bots like having it check raise and barrel every oesd if the board doesn't pair but fold to aggression unless given direct pot odds. simulate a hundred million hands or so and have it output the data. run some stats on the data to find the EV and variance of the hyper aggro strategy vs your bot and post results.
My first thought was to transcribe the poker bot, but I'm not too keen on doing that at this moment. It makes no sense to rewrite something that isn't even deployed to Average Joe yet. In fact, getting it ready to run on a browser is one of the things I would like to do during this time off, so I don't think I'll have time to rewrite the entire thing to C#.

I ended up with about 500 LOC of C# + 200 LOC of ASP at the end of this week (I guess i really wrote 1500?). When I told the boss he said that was about right. Had I wrote what I wrote this week in Clojure, it would be ~100 LOC and that would take care of the front and back end. Considering the bot is about 450 LOC, I'm a tad concerned.

The plus is that I would learn the C# style of using getters and setters, some stuff about OO design, and a bit more about its data-types. I'm still on the fence about it.

Quote:
Originally Posted by Shoe Lace
Dave, try to reproduce some of the 6.00x psets in c# and make them web capable? Maybe use the web aspect of .net to build an api server that lets you play hangman, then code up the UI with html5 stuff?

Or if you're feeling adventurous try to build a native windows app and learn the win32 api. I fooled around with c# once and wrote a helper tool for a game I used to play. It was a fun experiment to learn a bit about .net. It was really rewarding when I finally got a rect of a directx game drawn into my app's form while being zoomed in by x amount.
This is a good idea, I think. It'll cover all the little things that I'd want to cover and it shouldn't take that long. Don't think I have quite enough time to dive in win32 right now, but I will do that later.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-31-2013 , 08:53 PM
Quote:
Originally Posted by daveT
I would expect that most people who do C# were... well, I don't know, better than the average Python programmer, but it seems like 80% of the people out there are lost with the language.

Why?

- Are the really good programmers open-source only?

- Is C# too complicated and convoluted?

- Does <tab> programming make you a bad programmer?

- Is it the effect of the so-called Java schools, where many people are just programming in C# since it is a "better" Java?

- Is the community just too small? I think that finding good Python code is much easier because there are so many people to learn from and so many people to put other people into check.

I understand that part of it is that it is very difficult to describe or drill down into a specific problem that is asked, since many of the questions that I am searching for deal with web-building issues, and that I can get over. It is the other stuff I described up-thread that bothers me, plus many other things. I've seen people say straight up that xyz can't be done in C#, so use JavaScript instead, and have a green check next to the post. I'm thinking: "what? I'm doing that very thing right now!"
http://paulgraham.com/pypar.html


So I used a Python metaclass today for the first time ever. It was just overriding the metaclass __eq__ to make MyClass == SomeOtherClass return True, but still fun stuff.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-31-2013 , 09:43 PM
daveT,

Here is a current project of mine. I'm by no means a C# expert. But thought you might have some fun browsing the source. It is an app that reads a binary file format and allows editing of the binary file through the UI. All the relevant code is in MainWindow.xaml.cs

https://iccfixtureeditor.codeplex.com/
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-31-2013 , 10:44 PM
Quote:
Originally Posted by ballin4life
http://paulgraham.com/pypar.html


So I used a Python metaclass today for the first time ever. It was just overriding the metaclass __eq__ to make MyClass == SomeOtherClass return True, but still fun stuff.
Heh. PG is definitely influential to me. When I first started learning about Lisp, I obviously asked myself if it was worth the insanity, and he said yeah it is.

With that said, I don't know if I agree or disagree with everything he and Spolsky say about basing programmers on the languages they choose (or not choose) to use, and I'm not certain that I agree with PG's assertion here: http://paulgraham.com/javacover.html

Quote:
I've never written a Java program, never more than glanced over reference books about it, but I have a hunch that it won't be a very successful language.
I do, however, think that the verbosity of certain languages can be a detriment to learning just as hunt-and-peck typing is a detriment to learning. If the idea is to push out a concept as quick as possible for the sake of experimentation and letting your thoughts roam, then less verbosity + reasonable typing speed + minimal compile time is important in the early stages, but I don't know if this has bearing on the quality of a programmer later on.

Quote:
Originally Posted by muttiah
daveT,

Here is a current project of mine. I'm by no means a C# expert. But thought you might have some fun browsing the source. It is an app that reads a binary file format and allows editing of the binary file through the UI. All the relevant code is in MainWindow.xaml.cs

https://iccfixtureeditor.codeplex.com/
When I see stuff like this, I realize how much I have to learn. I think tying in XML and grid is cool work. I'll have to step through all of it get everything that is happening, which I will do this week. So far, it's pretty neat, though.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-31-2013 , 11:36 PM
WPF is the devil's work
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-01-2013 , 08:43 AM
Dave I think your observations apply more to the dotnet framework implementation. I think it would be an interesting and fun thread to post the code you didn't like.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-02-2013 , 04:20 AM
What is the best programming forum that is as active/more active than 2+2 or is the closest thing to it? Currently, I am using Stack Overflow which was recommended to me by someone ITT. Does anyone have any other/better recommendations? Not that Stack Overflow is bad but I am just exploring my options until I decide to jump in.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-02-2013 , 07:41 AM
SO is pretty much the nuts
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m