sergiogarcianinja
Posts
-
Astronomy software? -
Astronomy software?The best software I think is Celestia, it can be expanded with plugins and accept script. I used it some years ago. Here you can get plugins, new textures, maps, objects, etc. Celestia Motherlode[]
-
Special CaseI a very humble opinion, I think the original developer cared about performance. There is a big and ugly monster living in or closes that will eat us if we write less performing code. The problem is, that almost all developers don't understand about performance and do wrong things. Here, I think he/she are trying to avoid a sum using a comparison. In some cases, like division, it will be a great code.
-
Special CaseI just tried your method, and my compiler is generating a error about a method must return a value, so I fixed it. There is a version without bugs, hope it helps:
if (i < 0)
return 1 - abs(i);
else if (i == 0)
return 1;
else if (i > 0)
return 1 + abs(i); -
10 Reasons Why Visual Basic is Better Than C#I understand your point, but I think that we should define papers. I'm not a good designer, if I need a graphic, maybe I can draw, using some easier softwares than photoshop, but I never will point myself as a professional in this or that Paint.net or Gimp is better than Photoshop. I'm can do really cool videos using Movie Maker, but I can't use Premiere, After Efects or Sony Vegas, again, is movie maker better than these tools only because anyone can use? If a person who doesn't is a developer, can solve some of his problem using a VB program, cool, it is easy, but don't point himself as a professional developer or say that VB is better because is easier. Again, it's just my point of view, and as I said, as a experienced VB.net and C# developer, I can say that, because I needed to make some really poor software run in enterprise enviroments that that software wasn't created to run, and these kind of jobs make me hate VB and the kind of programmers I described. It is very common case with PHP developers, who actually are designer who learned the basic of coding and started selling programs. Again, I also developed a lot of programs in PHP and I know what I'm talking about.
-
10 Reasons Why Visual Basic is Better Than C#You can use the as operator:
object a = "test";
(a as string).Trim(); -
10 Reasons Why Visual Basic is Better Than C#VB has a very useful typecasting.
Dim num As Integer = "one"
Very useful. Any VB programmer who thinks it can criticizes any other language, MUST use Option Strict.
-
10 Reasons Why Visual Basic is Better Than C#Actually, they aren't the same. VB.net was created with backwards compatibility with VB 6.0, with in mind, some ugly things happens (some of these VB programmers like), like the automatic type conversion, the rounding of integers, the internal VB functions, and the list goes long. The first version of .net, come in times when the Java are becoming popular between desktops and Delphi are going to be the most used language to desktop programming. Microsoft created "a plus" for the VB 6 programmers and introduced its brand new language, the C#. As a experienced VB.net and C# programmer (and ok, Delphi too), I rather say that VB is one of the worst languages I know. His apparently easy syntax do any people think they can develop, and almost all programmers that use VB.net as his primary languages aren't good programmers at all. This is my opinions, you can start offending my mother now. :D
-
10 Reasons Why Visual Basic is Better Than C#Totally agreed.
-
Changes goes whongThe original code has a infallible validation using Javascript. It never fails. Except when you change you server locale, or disable javascript, oh shit, I remember now, I had fixed this too.
-
Changes goes whongThis is the original code:
DateTime dtInput;
DateTime.TryParse(txtInputDate.Text, out dtInput);
document.InputDate = dtInput;Lets do a change request: * Input date always will be the current date.
DateTime dtInput;
DateTime.TryParse(DateTime.Now.ToString(), out dtInput);
document.InputDate = dtInput;What is wrong with these people? They start coding and stop thinking?
-
Connectivity testSometimes you have network but not internet. The better way to test it, is to use a well know network host or IP. If you only want to check if you have network connection and it is good, check for a host like Google is the better choice. Or, you can check for a Registrar, like 'registro.br' here in Brazil. But I rely more on Google than an Registrar, 'cause I never saw and never heard someone speaking that Google was down.
-
Strictly Short CircuitI can develop in more than 10 language (actually, I don't know exactly how much languages I now, I always forgot some) and I have no preference for the best language. Almost all the time I use C#, but I use others as needed if the moment needs and it pays my bills. But, I really don't like VB at all. I know VB since VB 5.0 (or 3.0, I don't remember, the year was 98) and these syntax flaws are really annoying. The VB (also VB .net) rounding is also terribly, all languages that I know truncate integer division and VB round it. The backwards compatibility of VB .net with VB 6 projects made VB .net a horrible language. I'm really experienced with VB (and VB .net) and it's a pain to correct legacy code in this language, so good luck!
-
VB 6Rob, You should consider more two VB features: 8. Automatic type conversions like:
Dim a As Integer = "1"
9. Not assigment or type checking at compile type:
Dim c As Object
Select Case c
Case 1
' do something 1
Case "horror"
' its really bad
Case Color.Green
' its even worst
End SelectThis code generates a warning for use of c before its assignment, a incredible error, because it will never run. And it happens in modern VB.Net versions. --- We could assume that you like VB and we could accept it. Every programmer have your "perfect" language and consider it best as no one other. I know VB since version 5.0 and even today I use this language in a lot of legacy projects, but never in a new project. I know a lot of other languages (C, C++, C#, Python, Perl, PHP, Javascript, Bash, Java, Delphi) and each time I will start a new project, I never consider VB, because its problems. Fact is Basic and VB are extremely easy to start programming but they "easiness" are really complicated for the real programmer. A real programmer should be able to run a program and it need to be deterministic. Same input, same output. Some time a go, a friend mine was asking why a simple sum operation became wrong. She was using ASP 3.0, which uses VBScript, and 1 + 1 are equal to 11. As I saw that, I told her, perfect normal, what was you expecting? I told her simple to type her variables
Dim a As Integer = 1
, problem solved. As me, and probably you, use VB along time both of us know that its evolution is really impressive. In version 5 and 6 its is a really poor in resource for type checking and compile time checking. Today it is more impressive, today 1 + 1 is really 2. The easiness of VB 1, 2, 3, 4, 5 and we can consider version 6 to create and deploy windows applications are amazing, because your RAD and "good" (for the time) IDE. Even with creation of Delphi, VB had evangelized his people. But again, today, we can consider VB a good choice in real big and important projects. Project which requires use of good patterns, use o interfaces, a lot of modules, etc. VB can't handle this. But again, it's my opinion. I consider VB a easy language not a good one. -
String.Format???I think in that case you can use a in code SQL, but using SQL parameters. Then, in you SQL command you add the parameters. Something like this:
string query = "select * from table where column = @value";
SqlCommand cmd = new SqlCommand(query);
cmd.Parameters.Add("@value", textBox1.Text);This SQL statments are cached (so if you execute it in short time intervals the SQL plan will be computed) and aren't vunerable to SQL injection.
-
Put your right paren in, take your right paren out...Guys, If you look careful, you will discover that the problem is not actually the HTML table, but the wrong usage of parenteses which make the code very dificult to understand. In each line, the guy put a open parenteses to separate the function call, and not close it in time. So, at the end of code block, you have a lot of parenteses. In time, the parenteses aren't need it this case and don't change the return of expression.
-
Windows 4, 5 and 6?From my Windows 7 (not really seven after that) system.
C:\>ver
Microsoft Windows [versão 6.1.7600]
-
A new way to create a DateTime from the year!Yeah, it's the objective of this post. Some programmer use a lot of code because they don't know a easier way to do that.
-
A new way to create a DateTime from the year!I now that. But as you can see, the developer forced a CultureInfo to ensure a date format valid to parse his string. In the case explaned this is not necessary because the developer only need to create a datetime object instace from a int value representing a year.
-
A new way to create a DateTime from the year!Looking for a error in a project, I saw this code.
IFormatProvider culture = new System.Globalization.CultureInfo("en-US", true);
string year = itemDT["YEARBARRIER"].ToString();string dateYear = "01" + "/" + "01" + "/" + year;
DateTime convertedDate = DateTime.Parse(dateYear, culture, System.Globalization.DateTimeStyles.AssumeLocal);
objBarrierFacade.YearBarrier = convertedDate;
That can be writed with only one line.
objBarrierFacade.YearBarrier = new DateTime((int)itemDT["YEARBARRIER"], 1, 1);
But I think that my solution is so easy and so obviuos to be used and other programmers need a good reason to spend more than a week in some easy use cases.