Jump to content

twsowerby

Members
  • Posts

    79
  • Joined

  • Last visited

    Never

Everything posted by twsowerby

  1. Hi Guys, I have a query regarding best practice for performance on a web application I'm developing. I am retrieving data via an API that I then need to display on a website. The data retrieved all relates to a product ID. The issue I am having is that each product has a UniqueID, but also a GroupID. The GroupID is used to display the same products but of different colour/size combinations. ie. UniqueID GroupID Size Colour 1 1 n/a n/a 2 2 Small Red 3 2 Medium Blue 4 2 Large Green I need to display the products in a list, but where there are multiple products in a group, I need to provide a dropdown selector for size and a dropdown selector for colour. I'm struggling a bit with how to structure it with just the array spat out by the API, so I was considering saving the data to a MySQL database and then querying that to get what I need. Is this a good way to go or is the double query hit going to be horribly inefficient? Cheers!
  2. It may be a little bit of a heavy handed approach, but Drupal has a module called Webform that allows users to create forms on the fly. It then stores the form results for you and has the facility to add additional processing such as email confirmation on form completion.
  3. Hi guys, I'm trying to develop a 'silent' install script for Drupal. Ideally what I would like is to be able to define the database host/name/password as variables and then also pass in the admin username and password so that the initial drupal installation form is no longer needed. Has anyone tried this before or have any ideas on the best way to do it? Cheers!
  4. Hi All, I've searched around for the answer to this and can't find anything useful. I have a virtual private server that runs apache. I manage it via webhost manager. F every new website I create for a client, I set up a hosting package for them which gives them some file space, emails and a Cpanel login. I want to set it up so that I can run all of the website from a single drupal codebase and also share the database. I know you can set this up using Drupal's multisite functionality, but that requires all the sites to use a single CPanel account. I need to be able to share the single codebase between multiple Cpanel accounts. If that doesnt make sense then please ask questions, happy to try and elaborate! Cheers!
  5. Ah yes I see the difference now. Thanks for your help!
  6. Excellent thanks, thats pretty much what I figured, just wondered of there was a different way that might be better. Cheers
  7. I ahve a call referral system that allows a user to log in and view referral records one at a time. The user looks at the record, makes a call, adds a note and clicks submit. The record is then updated. I am fast approaching a situation where I will have more than one user. Given the way the system retrieves records it is possible that two people using the system at the same time may be shown the same record and attempt to edit the same record at the same time. To get around this I was planning on implementing a random selection function. The function would randomly select a record and display it. Upon selection, a 'currently being edited' marker would be placed against that record. The next time a user calls the random selection function, it will do a check to see if the 'currently being edited' marker exists for that record. If it does then call the random select function again and so on until it gets one with no marker. Is there a better way of doing this? Cheers!
  8. Hi, In order to develop in php you will need to set up some sort of development environment. Your best bet for this is possibly to take a look at something like XAMPP which will allow you to set up a local installation of apache and mysql. Once installed correctly you will be able to browse to http://localhost and see a page that should indicate you have set up your local development environment correctly. After you've wrapped your head around this you could then look at setting up a separate server that will serve files to the computer you are developing on, but for now you may be better just getting it all running on one computer.
  9. This is the function that apiGetD() connects to: Function GetDashboard($sessionID, $user, $dbc, $api, $dataBase){ $userChars = GetAPIKeys($sessionID, $user, $dbc); if(!count($userChars) < 1){ foreach($userChars as $key => $value){ if($value["info"]["skilllevel"] > 0){ $value["info"]["skilllevel"] = SkillLevel($value["info"]["skilllevel"]); $tqTime = strtotime($value["info"]["evetime"]); $endTime = strtotime($value["info"]["skillTime"]); $timeLeft = TimeLeft($endTime, $tqTime); $value["return"]["name"] = $value["details"]["name"]; $value["return"]["skillintraining"] = $api->GetTypeName($value["info"]["skillintraining"], $dataBase); $value["return"]["skilllevel"] = $value["info"]["skilllevel"]; if($ft < 0){ $value["return"]["skillTime"]["note"] = "Finished"; $value["return"]["skillTime"]["days"] = abs($timeLeft['days']); $value["return"]["skillTime"]["hours"] = abs($timeLeft['hours']); $value["return"]["skillTime"]["minutes"] = abs($timeLeft['minutes']); $value["return"]["skillTime"]["seconds"] = abs($timeLeft['seconds']); } else { $value["return"]["skillTime"]["note"] = ""; $value["return"]["skillTime"]["days"] = $timeLeft['days']; $value["return"]["skillTime"]["hours"] = $timeLeft['hours']; $value["return"]["skillTime"]["minutes"] = $timeLeft['minutes']; $value["return"]["skillTime"]["seconds"] = $timeLeft['seconds']; } $value["return"]["WalletAmount"] = number_format($value["details"]["balance"],2)." ISK"; $returnArray[$key] = $value["return"]; } } } return $returnArray; }
  10. Ok, how would i change it to return an array? I know that the function that it connects to with fsockopen returns an array so somewhere along the line its becoming a string but im not sure where.
  11. I thought that too but keep getting an error. The code im using to connectt o the access class and return the array is as follows: <?php $vars = array('user'=>'demo', 'password'=>'demo', 'skey'=>'abc123', 'request'=>'Dashboard', 'userID'=>'2'); $data = apiGetD($vars); function apiGetD($vars) { $accessURL = 'www.eve-tool.com'; $apiURL = '/api/class/class.access.php'; $poststring = http_build_query($vars, '', '&'); $fp = fsockopen($accessURL, 80); fputs($fp, "POST " . $apiURL . " HTTP/1.0\r\n"); fputs($fp, "Host: " . $accessURL . "\r\n"); fputs($fp, "Content-Type: application/x-www-form-urlencoded\r\n"); fputs($fp, "User-Agent: PHPApi\r\n"); fputs($fp, "Content-Length: " . strlen($poststring) . "\r\n"); fputs($fp, "Connection: close\r\n\r\n"); if (strlen($poststring) > 0) fputs($fp, $poststring . "\r\n"); $contents = ""; while (!feof($fp)) { $contents .= fgets($fp); } fclose($fp); $start = strpos($contents, "\r\n\r\n"); if ($start !== false) { return substr($contents, $start + strlen("\r\n\r\n")); } } foreach($data as $key=>$value) { echo $key.": ".$value; } Warning: Invalid argument supplied for foreach() in E:\xampp\htdocs\test.php on line 50 is what i get. If I remove the foreach at the bottom and just print $data i get the array data back fine. any ideas?
  12. Hey guys, I would like to take an array returned from an access class and style the data so it looks good. Currently I get this: Array ( [576113096] => Array ( [name] => Nobues [skillintraining] => Fighters [skilllevel] => IV [skillTime] => Array ( [note] => [days] => 2 [hours] => 5 [minutes] => 53 [seconds] => 40 ) [WalletAmount] => 65,508,812.57 ISK ) [1404986087] => Array ( [name] => Lireil Crow [skillintraining] => Astrometric Triangulation [skilllevel] => IV [skillTime] => Array ( [note] => [days] => 1 [hours] => 3 [minutes] => 21 [seconds] => 32 ) [WalletAmount] => 9,177,531.37 ISK ) [217317000] => Array ( [name] => Hansoloo [skillintraining] => Amarr Carrier [skilllevel] => V [skillTime] => Array ( [note] => [days] => 60 [hours] => 22 [minutes] => 26 [seconds] => 33 ) [WalletAmount] => 65,100.15 ISK ) [689240734] => Array ( [name] => Mung Lore [skillintraining] => Torpedoes [skilllevel] => V [skillTime] => Array ( [note] => [days] => 8 [hours] => 9 [minutes] => 30 [seconds] => 3 ) [WalletAmount] => 194,399.22 ISK ) ) Obviously that isnt very nice to look at, how would i go about separating each bit of data to style and position?
  13. Hmmm the sitekey variable I'm using is just used for passing a value into the class which sits on another server, surely it cant be conflicting with any Drupal sitekeys? The error message im getting is nothing to do with drupal, its an array that is returned from a standalone function when it cant reference the value being passed in.
  14. Hi all, Ok I cant figure something out. I have this code: <?php $vars = array('user'=>'demo', 'password'=>'demo', 'skey'=>'abc123', 'request'=>'Dashboard', 'userID'=>'2'); $data = apiGetD($vars); function apiGetD($vars) { $accessURL = 'www.eve-tool.com'; $apiURL = '/api/class/class.access.php'; $poststring = http_build_query($vars); $fp = fsockopen($accessURL, 80); fputs($fp, "POST " . $apiURL . " HTTP/1.0\r\n"); fputs($fp, "Host: " . $accessURL . "\r\n"); fputs($fp, "Content-Type: application/x-www-form-urlencoded\r\n"); fputs($fp, "User-Agent: PHPApi\r\n"); fputs($fp, "Content-Length: " . strlen($poststring) . "\r\n"); fputs($fp, "Connection: close\r\n\r\n"); if (strlen($poststring) > 0) fputs($fp, $poststring . "\r\n"); $contents = ""; while (!feof($fp)) { $contents .= fgets($fp); } fclose($fp); $start = strpos($contents, "\r\n\r\n"); if ($start !== false) { return substr($contents, $start + strlen("\r\n\r\n")); } } print_r($data); ?> Which is meant to connect to a class on another server and return an array. When I run it in a standalone "test.php" file on the same server as my drupal installation it works perfectly and I get the correct return. If I then take that exact same code and insert it into a drupal block with the php filter on, it doesnt seem to be sending the "skey" variable and I get this pre-programmed error array back: Array ( [0] => Array ( [message] => Authorization fail. [user] => demo [request] => [iP] => 74.208.43.153 [stamp] => 1232445084 ) [1] => Array ( [message] => No siteKey found. [user] => demo [request] => [iP] => 74.208.43.153 [stamp] => 1232445084 ) ) Note the "No siteKey found" error. Does anyone have any idea what might be messing this up? Or a way around it that I could try? Cheers, Tom
  15. Ok ill elaborate a bit, its an API basically. This: http://www.eve-tool.com/api/class/class.access.php?user=demo&password=demo&skey=abc123&request=Dashboard&userID=127 Returns an array of values based on the variables passed in. How do I get the array created by the functions in that class so that I can manipulate them in my code?
  16. Hi Guys, I'm writing a little app and I've reached a stumbling block and could do with you clearing something up for me. I'm passing some variables through a URL to a function on another server. That function then does its business and outputs an array of values. Is there any way of getting the values out of that array back to my server to do with as I please? Apologies if its a stupid question, let me know if you need more details. Cheers
  17. Hi Guys, I think I'm being a bit dim here but I can't get this to work how I want it to. I've got this code: $sql = "SELECT villas.*,resorts.* FROM villas, resorts WHERE villas.resortID = resorts.resID AND villas.ID = $recVilla"; $query = mysql_query($sql); $time = date("Y/m/d G:i:s"); while ($row = mysql_fetch_array($query)) { $Name=$row["Name"]; $Resort=$row["resortName"]; $Price=$row["price"]; $ID=$row["ID"]; $IDarray[] = $row["ID"]; echo "<a href=\"incVillaDesc.php?id=$ID&rec=1\">$Name</a>, $Resort, £$Price <br />"; $insertsql = "INSERT INTO recommendations (userID, villaID, useful, used, dateTime) Values ($user, $ID, '', '', '$time')"; $query2 = mysql_query($insertsql); } I need the INSERT to insert every result returned from the select query but it is only inserting 1 result. Any help would be great! Cheers, Tom
  18. awesome, thank you very much. Been working on this project for over 12 hours straight now, think my brains beginning to fry! Regards, Tom
  19. Hi all, I have the following code: $viewselectsql = "SELECT admin_tracking.*, admin_tracking.userLoginID as user, admin_tracking.villaID as villa, count(admin_tracking.villaID) as idcount, userDetails.userClass as class FROM admin_tracking, userDetails WHERE admin_tracking.userLoginID = userDetails.userLoginID AND userDetails.userClass = $class group by admin_tracking.villaID order by admin_tracking.villaID"; $query3 = mysql_query($viewselectsql); while ($row3 = mysql_fetch_array($query3)) { if ($row3["idcount"] >= 3) { echo "villa ".$row3["villa"]." viewed ".$row3["idcount"]." times by users in category $class <br />"; } } and the echo outputs: villa 24 viewed 13 times by users in category 4 villa 27 viewed 16 times by users in category 4 villa 48 viewed 10 times by users in category 4 villa 51 viewed 9 times by users in category 4 villa 53 viewed 12 times by users in category 4 villa 54 viewed 6 times by users in category 4 How would I go about only echoing the top three highest "idcount" values? so instead of the above it would only show: villa 27 viewed 16 times by users in category 4 villa 24 viewed 13 times by users in category 4 villa 53 viewed 12 times by users in category 4 Any help would be great! Regards, Tom
  20. Unfortunately the website is still a work in progress, still programming the back end at the moment. I can send you a link when its up and running though if you like. I share your views on user rating systems regarding their inaccuracy, but I am still going to include a rating system simply for the community/interactivity element. I plan to work on a system that will gather less statistical information on users which can be analyzed for trends with the ultimate and somewhat lofty goal of being able to almost preempt what the user is looking for. However I'm going to have to be wary of doing it too obtrusively, often recommendations can be more annoying than helpful. I am very interested in developing a system that can be applied to many scenarios, I would imagine a truly accurate system would greatly increase profits for a lot of businesses. Definitely something to look into in the future.
  21. Thank you for your interesting and well thought out reply. I actually used to be an avid user of Pandora before they got shut down over here due to licensing issues and I liked the way their system worked a lot. I had no idea they needed that amount of resources to pull it all together though. Unfortunately I don't have the manpower or the hardware to create a system capable of handling up to 100 billion combinations, but it is something to work towards possibly in the future. Just out of interest do you have any idea what the hardware requirements of a system capable of 100 billion combinations would be? If such a system was created and made to be applicable to more than, say, a villa rental scenario, do you think it would have good commercial aspects? ie do you think it could be sold effectively? Or would it just be one of many? Going back to my particular scenario, I was also having a look at the "weighted slope one algorithm" which would base recommendations on users ratings. Not exactly what I was looking for but it may present some possibilities, especially as it doesn't require the user receiving the recommendation to have actually rated anything to start with. http://en.wikipedia.org/wiki/Slope_One Regards, Tom
  22. Hmmm and automatically run the classification script on every field each time the database is updated...yeah that seems like the easiest option actually. Thanks for your help guys. Regards, Tom
  23. This may not be on the right board, let me know if it isn't. Hey All, I've got a bit of a conundrum on my hands so was wondering if you could help. I'm building a recommendation system for a holiday villa booking website. Rather than just being a rating based recommender, I am doing it based on the link between similar users and their villa interests. So a recommendation could be made by looking at user 1's personal details and the villas they have shown an interest in on the website, and then comparing their profile to user 2 and 3. To do this I need to find a way of classifying the users based on their attributes, but I'm struggling to think of a good way to classify them. I would like the classification to take into account more than one attribute, so I don't want them to just be classified by age, for example. What I need to end up with is different user classifications that each user can be put into. I'm open to any suggestions or ideas, and feel free to ask me for more information. Regards, Tom
  24. Hey All, I've got a bit of a conundrum on my hands so was wondering if you could help. I'm building a recommendation system for a holiday villa booking website. Rather than just being a rating based recommender, I am doing it based on the link between similar users and their villa interests. So a recommendation could be made by looking at user 1's personal details and the villas they have shown an interest in on the website, and then comparing their profile to user 2 and 3. To do this I need to find a way of classifying the users based on their attributes, but I'm struggling to think of a good way to classify them. I would like the classification to take into account more than one attribute, so I don't want them to just be classified by age, for example. What I need to end up with is different user classifications that each user can be put into. I'm open to any suggestions or ideas, and feel free to ask me for more information. Regards, Tom
  25. Awesome, I love it when I have to find a way around seemingly impossible things when I'm working to a deadline. I'll try and figure something out, but if any of you come up with any brilliant ideas then please post! Thanks, Tom
×
×
  • Create New...

Important Information

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.