The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 17, 2019, 12:00:33 AM

Login with username, password and session length


Pages: [1] 2 3
  Print  
Author Topic: gnarlyhat Project 1: Keyword List Management  (Read 11248 times)
gnarlyhat
Journeyman
***
Offline Offline

Posts: 51



View Profile WWW
« on: November 01, 2007, 12:47:25 AM »

As many of you guys know, I just bought a new PHP brain and have been going thru the manual and it's time to put it to good use. I'm gonna be building a little command center for myself and I'm gonna figure out each piece of the puzzle and hopefully have the whole thing done by tying them up all together to complete the project.

I'm no programmer so the terms I use may be alien to you. Please feel free to correct me if you spot anything that should be corrected.

Here's what this module is going to do.

1. Scrape new keywords from Wordze's API and save and clean results as txt in keywords directory.
2. Read txt files from a keyword directory. I can FTP existing keyword lists into the directory.
3. Create a category system to keep keyword lists tidy. The best way to do it?
4. Display the keyword lists on a ListBox and display the selected lists on a text box like below.
http://www.imagebam.com/image/e02009663789

Now here's where I bug you guys for advice Smiley

1. Is there anything I should be aware of first considering my development platform is going to be on WAMP. Any advice so to make sure my codes will run nicely on my server once I upload it.

2. I'm kinda done with the Wordze scraper except for the cleaning part. For it to be usable in my content generator, it can only be alphanumeric. Is this good enough to do the job?
Code:
$keywords = ereg_replace("[^A-Za-z0-9[:space:]]", "", $keywords);
I ripped this from SEObook's keyword stripper.

3. I've figured out step 2 so question for step 3 is "What is the best way to categorise my keywords? Put them in separate dirs? I have different sets of keyword lists for say ... Adult, MFA, Pharma, blah blah blah"

4. Is it possible to do this function from PHP itself as I select each list or I have to rely on javascript?

Thanks so much for your help in advance Smiley
Logged
thedarkness
Lifer
*****
Offline Offline

Posts: 585



View Profile
« Reply #1 on: November 01, 2007, 02:51:04 AM »


4. Is it possible to do this function from PHP itself as I select each list or I have to rely on javascript?

http:// php.net/preg_replace

Cheers,
td
Logged

"I want to be the guy my dog thinks I am."
 - Unknown
taky
Rookie
**
Offline Offline

Posts: 13


View Profile
« Reply #2 on: November 01, 2007, 03:07:34 AM »

like i told you in im man, i would really recommend just starting off with a database for this kind of project. it will make things oodles easier to manage once you get past the syntax.

it really isnt that difficult, and its def worth it to learn how to interact with mysql, especially for blackhat. def invaluable.
Logged

No links in signatures please
freedom1972
Rookie
**
Offline Offline

Posts: 17


View Profile
« Reply #3 on: November 01, 2007, 07:26:17 AM »

I am going to agree with Taky. Dive into MySQL with this one. It may up the learning curve, but will definitely up your development skill and your ideas for projects. Plus, the DB will become a tool that you use for many different types of applications as your programming creativity kicks off.
Logged

No links in signatures please
gnarlyhat
Journeyman
***
Offline Offline

Posts: 51



View Profile WWW
« Reply #4 on: November 01, 2007, 08:28:59 AM »

MySQL .... hmmmm. Looks like I have to rethink and recode what I've done.

Would it slow down everything when I have lists near 10K words? I've been thinking too it's a good idea so I can assign a key to the list to put them into categories.

Can anyone point me to a good hands on MySQL tut? TIA Smiley

http:// php.net/preg_replace
Cheers,
td

td: Yes I understand preg_replace but is it possible to control html form values? What I meant is initially, if no item is selected ... the right textbox will be empty. When I select "credit-repair.txt" ... only credit-repair will appear on the textbox. I will use this to copy to another program for my subdomain creation.
Logged
freedom1972
Rookie
**
Offline Offline

Posts: 17


View Profile
« Reply #5 on: November 01, 2007, 09:10:26 AM »

will the MySQL queries slow your code down? that depends. If you are using them excessively, then hell yeah!  This is really a question of your code relative to your server environment. I try to use as a rule of thumb to make as few possible queries as necessary, and load the results into arrays that I can process with. PHP are great tools when it comes to array and text manipulation.

The balance between DB and speed is relative. Personally, I normally go through a multi stage coding process:

1) prototyping / scripting to get the initial results
2) rethinking the design (OO or functional, how can I generalize the classes/functions)
3) code optimization (could include writing extension in C/C++ if necesary, etc.)

that being said, i think you can lear A LOT in stage 1 and 2. Normally, I seek outside help with #3 as it is not my top skill.
Logged

No links in signatures please
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #6 on: November 01, 2007, 10:03:38 AM »

From the lowest level standpoint, disk/file access is almost 10x as slow as database access. This is because the directory lookup, file open, stream and close systems take time. With MySQL for example, the files are open, indexed and ready to go - you talk to them via TCP/IP which is hugely fast, the lookups are optimized (because that's what a database does) and the return is precisely what you are looking for.

I'd turn the argument around GG... if you'll NEVER have more than say, 5 items in a list, a file is fine - in fact, I'd probably make it a file and cache it for speed.

But if you're going to have 10K items, you are just starting to get to where a database makes the most sense of all. This will be a bit of a learning curve as Freedom mentiones, but as taky notes indirectly, the benefit of you learning this tool will FAR FAR FAR outstrip the time investment to get you there.

Most folks on this board are LAMP, so there's lots of resources here to get you going. Since your WAMP, you can get pre-compiled and executables for MySQL - then you can either download the native tools from the MySQL site (they are OK) or you can download phpMyAdmin and go that route - which is what I recommend, because the exercise of getting a new PHP site working against a MySQL database will in itself be invaluable experience. Additionally, phpMyAdmin (although not the best of the best when it comes to tools, but certainly adequate) is written in PHP (cleverly, they added that to the name Wink ) so it will work regardless of your platform of choice in the future.

Go man! Don't stop now, you're on a roll...you're really only doing WAP not WAMP yet... add the M!
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #7 on: November 01, 2007, 10:10:44 AM »

Would it slow down everything when I have lists near 10K words? I've been thinking too it's a good idea so I can assign a key to the list to put them into categories.

no, it will speed things up. plus it will increase your flexibility for future features. there is almost no circumstance under which a database would not be justified, when you are talking about scaling projects. Sure a contact form for a website that gets 1 form submission a week doesnt need a database, but the minute you start mentioning 10k of something, you should go database. Flat file / directory methods are good for portability, and technically can run anywhere, but, slow.

that being said, if you have never done Database in any language, and are learning php which i would assume is your first language then, you two choices. slow down and learn it all, which will result in many rewrites as you move forward. or just continue the way you have, get it solid, until you run into a problem where you NEED a database, then recode at that point.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #8 on: November 01, 2007, 10:11:12 AM »

LOL perk and I share a brain apparently.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #9 on: November 01, 2007, 10:15:06 AM »

perkiset ... nutballs ... separated at birth?

Enquiring minds want to know!

(If this is the case, then I must also be the smartest human on earth, and you must have an awe-inspiring shwanstooker.)

Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #10 on: November 01, 2007, 12:22:18 PM »

lol
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
gnarlyhat
Journeyman
***
Offline Offline

Posts: 51



View Profile WWW
« Reply #11 on: November 01, 2007, 07:56:44 PM »

Database then I should go. Since I'm learning from scratch might as well learn it right. Got any good MySQL tutorials to point me to? Ones with real examples instead of long ass winded syntax yadda yadda which would make me quit learning after 30 minutes. Also would appreciate recommendations on IDEs to use. I am currently using Notepad++ and switching to my browser pointing to local WAMP. Just before this post, I tried Dreamweaver with ftp setup to connect directly to my Linux server. Have yet to fully test it out. An IDE with autocomplete would definitely help out a lot here.

Here's a problem I have now. Code that used to run fine on my Linux server running PHP 4.xx is not on my WAMP which is running PHP5. I was under the impression that older version code should run on a higher version platform. But obviously I'm wrong. Would you guys suggest I code right on the server itself rather than on my notebook with WAMP?

What are the pitfalls I should avoid in order to make sure my code works on both 4 and 5?

From my questions, you all must know I'm a complete noob so please bear with me Smiley Thanks so much for your help
Logged
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #12 on: November 01, 2007, 08:26:15 PM »

assuming your PC, i use ultraedit, actually UEstudio.
has ftp and localcopy capabilites.

i have looked at a bunch of IDEs and decided that if I have to read a manual to figure out how to use the software to write code that I already know how to write.... i aint gonna use it. Aptana was one of those, as was eclipse. (though they are more for java technically).
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #13 on: November 01, 2007, 11:08:59 PM »

I just posted this list for somebody else a couple days ago:

http://www.perkiset.org/forum/database_discussion_mysql_oracle_and_such/help_out_a_n00b_trying_to_learn_sql-t585.0.html;msg3906#msg3906

... that'll get you started.

Regarding code that worked in 4 but not in 5 - that is exceedingly rare. In fact, I have never personally experienced it. There are very few things that changed such that code is not backwardly compatible. It is more likely that you have different modules compiled into the PHP instance on the WAMP box than on the LAMP box. PHP is compiled with a series of switches and dependencies based on what you want to do with it... you can create an incredibly light and tight instance or an overly bloated huge memory hog of an instance if that's your thing. The way to check what the differences are is to do a phpinfo() on both boxes and print what you get. This screen will tell you all the modules, the compile string etc that was used to make up <that> instance of php. I'm about 98% certain that this is your issue... or that theres a version difference between instances.

/p
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
gnarlyhat
Journeyman
***
Offline Offline

Posts: 51



View Profile WWW
« Reply #14 on: November 02, 2007, 01:06:14 AM »

Ok ... here's the problem. I don't know why it's dumping out the source.

I have an
include("WordzeApiClass.php"); in the wordzescraper.php file and when I run it ...

it dumps out the source of WordzeApiClass.php and this error below

Fatal error: Class 'WordzeApi' not found in C:\wamp\www\mi\wordzescraper.php on line 28

Here is line 28 of wordzescraper.php

Code:
$tmp = new WordzeApi('myapicode', 1, 100, $SearchStyle, $CharLen, $CountLim, $FilterType);
Logged
Pages: [1] 2 3
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!