Tutorials
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOtherTutorials

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
  #1  
Old February 20th, 2004, 02:46 PM
goa103 goa103 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Lyon, Rhône Alpes, France
Posts: 24 goa103 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
« Creating a Search Application » feedback

Hello,

After I posted about « Search for XML tutorials : Sorry, no results found », I thought I should take some time to read Matt's tutorial about « Creating a Search Application ». So here are some thoughts, remarks, suggestions, comments... about that tutorial. I hope it will help you to improve your already great writing skills, maybe you will even take some time to update or improve it . Anyway I really enjoyed reading it.

- I reported a SQL syntax error about the « introduction » table SQL.

- I think you could have shortened that tutorial by pointing the readers to other good tutorials about OOP and database design. However I think these little introductions were interesting. It's not that easy to « link » tutorials with each other...

- For my own writing I use « styles », I think that tutorial could really use them. I write my documents with OpenOffice.org and I have styles for everything : PHP function names, PHP argument or variable names, database, UI, ... This can be easily done in PHP by using « BBCode » like tags. You would get something like : « The [span class='PHP_function']similar_text[/span] function calculates the similarity between two strings... » instead of « The similar_text() function... ». The document uses a CSS so you can change the typo, color, everything... Using a PHP script, you can get even transform (XLT ?) the tag contents to a link that directly point to... php.net .

- I think you should specify field names on INSERT. I'm not sure if you omit them to optimize the query but for a beginner it's then easy to make mistakes. I did . For example you may forget if the « last_name » field was before or after the « first_name » field. So specifying « INSERT INTO introduction (first_name, last_name) » avoids these errors. You also specified an empty value for the id... I know I'm picky but it also helps me to see my own mistakes ^^. Maybe I should try to benchmark the 2 queries.

- As an anti-echo guy I thought we could also use the <?= ?> tag to embed PHP into HTML. Specially in your « introduction » example. It avoids using n, quoting strings, escaping... It's even faster (PEAR::Benchmark inside :p).

- We don't really know in which files a script is made to be. What's the file name for the DB_Class class ? You only guess it in the end... To help us I think you should provide the readers with a working example, online and an archive that contains the scripts and SQL structures as .sql files.

- « If a word is found multiple times on a single URL, we will store it multiple times. ». You could also use a table that stores keyword ids. It would avoid storing a keyword multiple times, only its id is stored multiple times. Not sure it's the fastest way as it's an other step into the DB normalization realm . But it may lighten the database. The solution you use gets greedy when it comes to handle thousands of keywords (see Google ^^).

- « By naming your class members appropriately, you create self documenting code. ». I like that one . Specially true when it comes to write a tutorial ! For info I also comment my code with JavaDoc/Doxygen tags. You can then generate a documentation for your projects in no time.

- « words that should not be included in the index, and words that should always be included in the index. »... Hum hum... What bothered me most in the tutorial was the use of arrays... I always try to focus on genericity and IMHO both using arrays and tables is not « the way ». That's why I only use... tables. Here I would convert these arrays to tables. Because when it comes to query, access, specially alter a database, PHP arrays don't take a chance. However as these routines are not « dynamically » on user's searches, it doesn't really matter. I'm just not into array :p. But I use to be .

- The « _getData » function can only handle files smaller that 25,000 bytes. A solution would be to get the URL contents using the « file » function or using the PEAR::File package.

- I also missed « testing » the whole tutorial ride. We never really know if what we're reading or trying to understand actually work. We could use online tests for example.

- Not sure it's a bug but I think you forgot to check if the « _searchterms » array is empty or not. Sometimes you access its first value (0) without checking. An other trick, you can use a single line to build your query instead of building a query before the « for » loop. The trick is to use a greedy « if » statement in the « for » and checking if the index is 0 or not. I know you will check (n - times) useless times if the index is equal to zero... But I can remember dozens of times bugging in the loop when the line before wasn't updated...

- « doFuzzy ». That's the one I was waiting for . I didn't even know about that « similar_text » function. Thanks ! Actually the only search engine I had to develop... Was a « LIKE '%$search%' »-engine . Who said greedy ? ^^.

- « SELECT DISTINCT(keyword) FROM keywords WHERE $match », I think the previous trick I introduced a few lines before would soften the query. You wouldn't need the « DISTINCT » option anymore.

Well I could also point out how interesting the tutorial is or how well some concepts or ideas are introduced but I'm sure you hate compliments .

So keep up the good work with the Codewalkers team, I hope I will find some time to read some other tutorials. But don't worry if you get bored with that whole post, next time I won't post any feedback . Maybe it's the french in me who is just crying for help to improve its english-irish-scottish-US skills .

JM known as the « kitty » box.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOtherTutorials > « Creating a Search Application » feedback


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway