this is yet another reason why I hate M$, if M$ had of stuck to the standard, we wouldn't have as much compatibility issues and we wouldn't need to reinvent the wheel every time M$ hasn't stuck to the standard.
Posts made by brendan
-
RE: Web 3.0 brainstorming
-
RE: Any X WHERE X eid WTF
check out the following (yet another WTF on that site) Link
-
RE: A New Person Programming
@jrwr00 said:
I want to learn a programming language, but i don't know where to start, now i do like PHP and i've fiddled around with it, any ones out there NOT for websites,
I would go with C(learn pointers), Java(learn Object Oriented programming) or PASCAL(don't know, but it's a good language to learn, because some languages have similar syntax).
Really It doesn't matter which language you start with, as long as you can get comfortable programming in the language and learn how to solve problems (i.e using data structures and basic constructs such as while loops, do...while loops, for loops, ifs and recursion). the post 110813, has a very good explanation.
-
RE: Modern compiled language? Good GUI toolkit?
If your wanting to learn the same think a lots of times and be restricted to only running on a M$ system than learn WTL or a .NET based language (i.e C#.NET, J#.NET, C++.NET), but if you looking to learn once use many than use wxWidget (which will work on MAC, Unix and Windows). C/C++ are cross platform languages which means unlike C# will never become outdated.
-
RE: Php pdf creation
@DaBookshah said:
Hi. I currently have the task of maintaining a mamoth php program, which involves pdf generation(using fpdf). The first time i saw the pdf generation code I looked like the guy pictured top-left. And there's LOTS of code like this, the entire(long) document is created from scratch in php.
$pdf->AddPage();
$pdf->HeadingFont();
$pdf->SetLeftMargin(15);
$pdf->SetY(30);
$pdf->AnswerFont();
$pdf->Cell(0,5, '');
$pdf->Ln();$today_date = date("d M Y");
$pdf->Cell(0,5, $today_date);
$pdf->Ln();
$pdf->Heading2Font();
$pdf->Cell(0,5, "Text", 0, 0, 'R');
$pdf->Ln();
$pdf->Cell(0,5, "More Text", 0, 0, 'R');
$pdf->AnswerFont();
$pdf->Ln();
$pdf->Ln();
$pdf->Ln();Seriously, there has GOT to be a better way. Is there a better library? Can I perhaps use some sort of template and just insert in the bits that change? As you can see I'm new to this php/pdf thing.
yeah, try PDFlib . also you could try using '\n' in the original text in order to remove the Ln() calls (note this is only in theory, as I could not be bothered installing the fpdf library).
-
RE: New Software is Here!
@iwpg said:
@Alex Papadimoulis said:
My bad -- I meant, 50 Articles, sorted by Last Comment Date -- kinda like how you could do it in the forums.
Yeah, that sounds great, thanks. Would it keep track of read/unread for each thread for the current logged in user? I could live without that, but it would be nice.
this should be already maintained by the RSS feed reader (well mine does).
-
RE: New Software is Here!
I like this new forum software, it's quicker than the last. I do like the fact that on the front page, the articles are now truncated, which increases the speed of load time and also consumes less bandwidth.
-
RE: My WTF coding or not?
I just did a quick Google search and found the following article which may be of any help
http://support.microsoft.com/?kbid=265879
-
RE: My WTF coding or not?
I'd say you making a invalid request to the driver when you shutdown you application. Maybe you haven't handle the request correctly(i.e haven't returned the correct value).
Another reason could be because M$ has change it's specifications without anyone knowing and is sending a different request to the driver (somehow display a little message or log one. This is first to see if your handler is being called and second test where about it is getting up to before it crashes (which means that you can narrow down the possibilities as to where the problem could be)).
Or you haven't shut the driver down at all and the OS is trying to shut it down for you (which your not handling the shutdown properly).
-
RE: "I think I'll use AJAX and PHP and generated images as a background to fake support for a CSS3 element"
I'd hate to be a maintainer of this code. 681 lines for something very simple like this.
-
RE: Figuring out your next birthday (SQL)
But this will
CREATE FUNCTION NextBirthDay(BirthDate Date) RETURNS Date
BEGIN
RETURN DATE_ADD(BirthDate, INTERVAL (YEAR(NOW()) - YEAR(BirthDate) + 1) YEAR);
END; -
RE: Figuring out your next birthday (SQL)
Just relised that it won't work (and can't delete it because of the time limit).
-
RE: Figuring out your next birthday (SQL)
wouldn't it be more simpler to do (this works in mysql but, not 100% sure that it will work with MsSQL. Where's the online documentation for SQL server?) :
CREATE FUNCTION NextBirthDay(BirthDate Date) RETURNS Date
BEGIN
RETURN DATE_ADD(BirthDate, INTERVAL 1 YEAR);
END;
-
RE: Any WTF's?
[quote user="kaamoss"]Tster, Angstrom clearly states he worked on the app for "fun" until he got bored, not until he met your error checking spec. The day I check my own code I write for fun for retarded user input for "fun" is the day I kill myself. He wrote this for his own edification, and I think it's asinine to check for insane user input when you're the only one intending to ever use the app. Seriously, why would I ever worry that I might enter a letter instead of a number in my own program, unless I was fsking retarded. You sound like a BAD highschool programming teacher and I hate you.
[/quote]Angstrom, also said that he wanted the same type of criticism , as the original poster.
-
RE: Function pointers?
[quote user="makito"]
What is the proper usage of the new and delete operators? I understand how they work, but why is
char* PointerToString = new char[10];
any better than,
char ActualString[10];
Thanks for all your help
[/quote]
The second one consumes 10 bytes of the stack whereas the first one only consumes 4 bytes(8 bytes if 64-bit). The problem is if a function that uses the the second one is recursive(directly/indirectly calls itself), then it is likely that it will cause a stack overflow.
-
RE: Any WTF's?
here's a how I would implement such a program:
import java.io.BufferedReader;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
public class TowerOfHanMain {
/**
* Get input from a stream
*
* @param in - Stream to read
* @param msg - message to show to user
* @param Valid - regular expression to use for validating
* @return a valid string, that was read from the stream
* @throws IOException - when an error occured when reading the stream
*/
private static String getInput( BufferedReader in, String msg, String Valid)
throws IOException{
String UserInput;
do {
System.out.println(msg);
UserInput = in.readLine();
}while (!UserInput.matches(Valid));
return UserInput;
}
/**
* Start Of execution
*
* @param args - args past in at prompt
*/
public static void main (String[] args)
{
try{
String Query;
BufferedReader in =
new BufferedReader( new InputStreamReader(System.in));
do{
Query = getInput(in, "\nChoose from these options\n" +
"| ENTER | SEARCH | QUIT |", "[\\p{Alpha}]+").toUpperCase();
if(Query.equals("ENTER"))
EnterRecord(in);
else if(Query.equals("SEARCH"))
SearchRecord(in);
else if(!Query.equals("QUIT"))
System.out.println("Invalid selection.\n");
}while(!Query.equals("QUIT"));
System.out.println("END OF LINE.");
}catch (IOException e){
System.out.println("Error: " + e.getMessage());
}
}
/**
* Create a new record
*
* @param in - where to get the data from
* @throws IOException - if an error occures while reading in writting to the file
*/
public static void EnterRecord(BufferedReader in)throws IOException{
String Name = getInput(in,
"Enter Name(Last, First):",
"[\\p{Alpha} ]+[\\,]{1}[\\p{Alpha} ]+");
String Address = getInput(in, "Enter Address:", "[\\p{Alnum} \\\\]+");
String Job = getInput(in, "Enter Job:","[\\p{Alpha}]+");
double MatCost = Double.parseDouble(getInput(in,
"Enter Material Cost:",
"[0-9]+[\\.]{0,1}[0-9]*"));
double LabCost = Double.parseDouble(getInput(in,
"Enter Labor Cost:",
"[0-9]+[\\.]{0,1}[0-9]*"));
double TotalCost = (MatCost*1.0825)+LabCost;
try{
FileOutputStream fout;
fout = new FileOutputStream (Name + ".txt");
new PrintStream(fout).println ("NAME: "+ Name + ";" + "ADDRESS: " + Address + ";" +
"JOB: " + Job + ";" + "MATERIAL COST:" + MatCost + ";" +
"LABOR COST: " + LabCost + ";" + "TOTAL COST: " + TotalCost);
fout.close();
System.out.println("\nInformation Stored.\n");
}catch(IOException e){
System.out.println("\nCould not store information.\n");
throw e;
}
}
/**
* Search for a record
*
* @param in - input stream
* @throws IOException - if an error occures while reading in or while reading a file
*/
public static void SearchRecord(BufferedReader in)throws IOException
{
String Name = getInput(in,
"Enter Name(Last, First):",
"[\\p{Alpha} ]+[\\,]{1}[\\p{Alpha} ]+");
try{
FileReader fin = new FileReader(Name + ".txt");
String[] SplitInfo = new BufferedReader(fin).readLine().split(";");
for (int i=0; i<SplitInfo.length; i++)
System.out.println(SplitInfo[i]);
fin.close();
}catch(IOException e){
System.out.println("\nCould not locate client.\n");
throw e;
}
}
}@Angstrom: your solution is too complex for a simple application like this.
-
RE: Any WTF's?
there's no WTFs that I can see. However there is one thing, I would like to introduce you to a new concept called commenting. It helps others read and understand your code.
Also split long line up across multiply lines. i.e
new PrintStream(fout).println ("NAME: "+ Name + ";" + "ADDRESS: " + Address + ";" +
"JOB: " + Job + ";" + "MATERIAL COST:" + MatCost + ";" +
"LABOR COST: " + LabCost + ";" + "TOTAL COST: " + TotalCost);