Jump to content
xisto Community

slu

Members
  • Content Count

    27
  • Joined

  • Last visited

Everything posted by slu

  1. Several options for interactive mode already exists. Perl has a builtin debugger, that enables you to try code (and scripts) interactively. To get an debugging prompt start Perl like this: CONSOLE $ perl -d -e 1 Loading DB routines from perl5db.pl version 1.28 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main:-e:1): 1 DB<1> print "Hello\n"; Hello DB<2> exit; Debugged program terminated. Use q to quit or R to restart, use o inhibit_exit to avoid stopping after program termination, h q, h R or h o to get additional info. DB<3> q $ you can read the man pages "man perldebtut" and "man perldebug" or perldebug and perldebtut to learn more. If the debugger isn't your thing, you can try the Perl Console, that seems to be very similar to the Python interactive mode: http://www.sukria.net/perlconsole.html It looks like this: Another option is The Perl Shell (psh), which is exactly that: a shell aiming at being a replacement of your favorite shell (i.e. bash). It's a bit different fromt the debugger and console, but you might like it: https://sourceforge.net/projects/psh/
  2. ...or let MySQL do the counting: $result = mysql_query("SELECT count(*) as count FROM users WHERE username='$username'");$count = mysql_result($result, 0, "count"); and I would change the compare to $count > 0 in the if statement, just to be sure.
  3. I've never had the need (urge) to write a desktop app. (in any language). My first choice for doing such a thing, would be Perl. My second choice would be Java. Several GUI toolkits exists for Perl: Tk, Gtk, Win32, QT, and wx. Perl/Tk is the oldest and simplest, and it's cross platform. Wx is what I would check out first, unless the app. should only run on Linux or Windows - then I would go for Gtk or Win32... But if it's a game you're doing you have to look at Perl/SDL, which is a toolkit aimed at game. For inspiration check out the great and addictive arcade game Frozon Bubble - written in 100% Perl!
  4. Your code does not work. Depending on the final if-statement $seconds might be undefined. A much simpler version would use the standard localtime() funtion: sub ConvertSeconds { my ($secs, $minutes, $hours, $days) = localtime(shift); return $days-1,$hours-1,$minutes,$secs;}
  5. Check out phpchartPlus and Libchart. They offer similar features for generating charts. Both are free to use.
  6. Your're confusing the terms a bit here. A session really isn't an alternative to using cookies. When using a session, the default behavior is to store the session using a cookie, which will happen automatically. Check out the documentation of start_session(), which you need to call to use sessions: http://dk2.php.net/manual/en/function.session-start.php If you don't want to rely on cookies at all, you either add the Session ID (SID) to all your urls/links or enable automatic url rewriting. You can read more about this here: http://forums.xisto.com/no_longer_exists/
  7. slu

    Searching In Mysql

    I'm guessing that $text = 'First Second'... You need to insert some wild cards, like this $search_text = '%' . str_replace(' ', '%', $text) . '%'; and then do: SELECT * FROM `$table` WHERE `row` LIKE '$search_text' this should search for everything that includes the two words... You might need to put some extra spaces in the $searc_text...
  8. The textarea tag does not use a value attribute. Instead you should place you contents between a start and end tag. Like this: <textarea type="blah" etc... value="><?php echo &_POST['note_wide'] ?></textarea>
  9. Why wouldn't the perl script work? Have you tried ActivePerl? Most perl scripts work across platforms. And if ActivePerl doesn't work you could try installing Cygwin, where you get a more complete UNIX/Linux-like environment (including perl) on a Windows-system. I would suggest using a proper build tool. In the case of Java development Apache Ant is the standard. It has the ability to compile, sign and upload - just what you need...
  10. You can get an excellent Java book for free: Thinking in Java by Bruce Eckel.
  11. No, Opera's appName is Netscape! It might seem weird, but it has been chosen for compatibility reasons.... You need to check the User Agent String to detect whether a Opera browser is used. The User Agent String will include the name "Opera", so your code could be written like this: if ((navigator.userAgent).indexOf("Opera") != -1) { your code etc etc;} If you really want to go in to the gory details of browser detection check out the Browser Capabilities Project.
  12. Yeah, the Evolt browser archive is a nice thing, esp. if you have a user/customer using some old system... But the guys at BrowserCam are a bit smarter. Here you can submit an url and a set of screen dumps are created automatically on several combinations of operating systems and browsers. See https://www.browsercam.com/ Only bad thing: it's a paid service, but you can try it out for free, and the prices are reasonable. Implementing the functionality of BrowserCam yourself wouldn't be impossible. Start by installing some kind of virtualisation system (e.g. qdos or vmware), and you would be able to run several different operating systems on one machine. Alternativly you could make a multi boot machine, but then the machine had to do a reboot everytime a new OS was needed. Now each OS should be set up to do the following when starting (booting): 1. look for an url (or list of urls) on a FTP-server, 2. open the urls in the installed browsers 3. taking screen shots of each browsers, and upload the image to the FTP-server Now the FTP-server could be on the same physical machine, where we are running all the test OS's virtually... the process might take some time, but it would run automatically, and your web design would be tested across several OS'es and browsers! It's not rocket science, but it will proberly take some trial and error.
  13. That would be print. Here's the most simple perl/cgi-script: #!/usr/local/bin/perlprint "Content-Type: text/plain\n\n";print "hello";Notes: * You might need to change the path in the first (shebang) line, it depends on your platform... * Change text/plain to text/html if you want to return HTML * print is standard perl and has nothing to do with CGI/LWP - everything sent to standard out is send to the users browser.
  14. An Apache webserver can not run servlets/jsp's... you need an servlet engine for that, for example Apache Tomcat - http://tomcat.apache.org/ The Apache Tomcat has its own built-in webserver, but can also be used in conjunction with the Apache webserver. For developmet I deploy and run applications directly on the tomcat server. There's some ok documentation on the tomcat website. After having installed tomcat try the Application Developer's Guide - it's short and pretty east to follow: http://tomcat.apache.org/tomcat-5.5-doc/appdev/ JSP and Servlets are not the same from a logical point of view, but when Tomcats "sees" a JSP-file it converts it into Java code which is compiled into a Servlet.
  15. You're trying to run Java code compiled with 1.5 SDK on an earlier VM (e.g. 1.4). Version 49 => Java 1.5 and 48 => Java 1.4 By default compiling code with a 1.5 Java compiler will generate bytecode that only runs on a 1.5 VM, but you can set flags to make the bytecode backwards compatible. Tomcat 5.5.x is (AFAIK) buildt with 1.5 SDK, but with backwards compability enabled. Thus Tomcat can run on an 1.4 VM... You could either upgrade the VM Tomcat is running on, or compile your code with the "-target 1.4" option, e.g. javac -target 1.4 MyCode.java
  16. I'll second that, but (not to start a flamewar) my favorites are: 1. GNU Emacs - spend more than 6 hours daily using this (development, web design, etc.) 2. Mozilla Firefox - a fantastic browser made even better with great extension like Adblock, Aardvark, Web Developer and Greasemonkey! 3. Perl - this is the programming language I would take with me on a deserted island - it's just so versatile. And luckly all three products works on everything I use : Linux, Unix and Windows...
  17. You migth be able to solve this by changing settings in your BIOS. A friend of mine had a machine that didn't work (with linux) until he turn on USB Legacy support...
  18. I've been working with professional web development for more than five years, and in my experience very few solutions/customers have the need for "real enterprise components" (e.g. EJB's) - it's a bit overkill.That doesn't mean you should completely ignore the principles of multi tier development - it's just a question of the right balance.My instinct says that your setup (apache, tomcat, struts, hibernate, and sql server) is adequate.
  19. If doing a redesign of a complete site PHP-Mesh is the way to go. You can change the layout without changing your original files! PHP-Mesh inserts code before and after all php/html pages and takes the html apart and puts it together again. You describe how to put your page back together again (i.e. the (new) layout) with one or more Decorator classes. A simple decorator would look like this: <html> <head> <title>MySite :: <?php $page->title(); ?></title> <?php $page->head(); ?> </head> <body> <h1><?php $page->title(); ?></h1> <?php $page->body(); ?> </body></html> In the above example all pages will get a title that starts with "MySite :: " and the title of the page is repeated in a H1 at the beginning. There's an $page object available in all Decorators, it contains methods corresponding to html-tags. Each method returns the contents from the original page. As the Decorators are just php files you can do all kinds of coding (like switching designs on certain pages). It's awesome and seems like magic... See http://forums.xisto.com/no_longer_exists/ The concept is based on SiteMesh, which does a similar thing for Java-based web sites.
  20. I justed skimmed your code, and one thing I would suggest is using a template system. This would make your blog more flexible and maintainable (getting rid of all the ugly echo "<...>" lines). I've used Smary for several projects, and it's really cool - fast and simple. See http://forums.xisto.com/no_longer_exists/
  21. HTMLDOC comes to mind, see http://www.msweet.org/projects.php?Z1 - haven't used it myself, so I can't say how reliable it is... You might consider FPDF which is a library that enables you to create PDF from PHP. But then you would have to change you're design and perhaps use a form/wizard approach...
  22. For the past three years most of my programming has been done in Java. But i also use Perl almost every day - mainly for smaller stuff: scripts and quick-and-dirty hacks.The very first language I learned was COMAL. Later I got a C64 and played with BASIC and Assembler. My first "real" language was C. I can't remember I what order I learned the rest of the languages I know, but Java is the latest addition to the list.If I had to select only one language (to take with me on an deserted island) it would be Perl.How about an programming language alphabet? Here's mine (letters in paranthesis indicates that I don't know (or recall) any language starting with that letter):Awk, Brainf*ck, C/C++, (D), E (great language on the good old Amiga), FORTRAN, (G), HTML, (I), Java, (K), Lisp, M4, (N), Oberon, Perl, QBasic, REXX, SQL, Tcl/Tk, UML, Visual Basic/VBScript, (W), XML, (Y), (Z)I could add more to the list, like PHP and Pascal, but that wouldt fill out any emty slots...Does anybody have a full alphabet?
  23. Just make sure that GD-support is enabled in the PHP you're using (it usually is, but you can always try a call to phpinfo()). Here's a small example that does what the OP is asking for: <?phpif (isset($_REQUEST['img'])) { header("Content-type: image/png"); $image = imageCreateFromPng("background.png"); $black = imageColorAllocate($image, 0, 0, 0); imageString($image, 5, 10, 10, $_REQUEST['img'], $black); imagePng($image); imageDestroy($image); exit;}?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <title>Add text to image</title> </head> <body> <form action="<?=$_SERVER['PHP_SELF']?>" method="post"> Text: <input name="text" type="text" value="<?=$_REQUEST['text']?>"> <input type="submit" value="OK"> </form> <br> <img src="<?=$_SERVER['PHP_SELF']?>?img=<?=$_REQUEST['text']?>"> </body></html> save the above somewhere your webserver can find it and place a png image called background.png in the same directory. For more information and examples check http://php.net/manual/en/ref.image.php
  24. I found Xisto on http://forums.xisto.com/no_longer_exists/ - I was looking for a free host with Java Servlet/JSP capabilities... Few hosts (both free and not free) offers a servlet engine, so I was happily surprised when I found Xisto.
  25. My favorite client is Mutt - it's a text-based console app. which means that,1. I can control everything with my keyboard2. it's fast3. only shows the text (ignoring anoying colors and fonts)besides that it is highly customizable, handles threaded messages very good, and supports both POP3, IMAP and PGP/GPG.I also have Thunderbird installed, and it's is my absolute favorite of the non-console-based clients.Of the web-based email clients I think Yahoo and GMail are both very good. In contrast to Hotmail, which really sucks: it's very limited in both message/inbox size and functionallity.
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.