Jump to content

Ortix

Members
  • Posts

    39
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Ortix's Achievements

Member

Member (2/5)

1

Reputation

  1. I'm writing a small applications with episodes which contain 10-15 screenshots with each screenshot having 5 different resolutions. Every week there are about 20 new episodes. You can imagine that every week I have a lot of screenshots which have to be somehow linked to their respective episode. Currently the filenames are stored in a MySQL database, but after 5 minutes of testing I already have 100+ rows. Not quite sure if that's a smart way of moving forward. The advantage of having them in the DB is that I can easily grab them using Eloquent ORM without having to finnick around with regeneration of filenames for on the fly loading. Are there any good other alternatives of linking multiple files to database entries? Or should I just stick with the current method? What would be some adverse effects of doing it this way?
  2. I have created a component with ACL which works perfectly fine. However I want to access the component ACL in the quickicon module to hide specific icons from specific usergroups. Example: JFactory::getUser()->authorise('partner.create.order', 'com_partner_portal') This doesn't seem to work in the mod_quickicon module. Any ideas how I can get this to work? I tried joomla forums, stackoverflow and the IRC channel with no success. This is kind of my last resort other than hard coding the usergroup id's in the module
  3. I'm trying to implement a library which was written for PSR-0 compliant autoloading in my joomla project. However joomla 2.5 does not support PSR-0 autoloading so I figured that I would have to write my own implementation. Since I want to use my classes across my entire joomla installation I decided to write a plugin which registers the classes onAfterInitialise() but this is where it goes wrong: it overrides joomla's autoloading methods. The library i'm trying to implement is located at libraries/Zoho/CRM/ZohoClient.php with several subfolders. Everything is namespaced with accordance to PSR-0 so starting with: \Zoho\CRM. How do I register the classes in such a way that I can use them globally across joomla? This is my implementation: public function onAfterInitialise() { spl_autoload_register(function ($className) { $className = ltrim($className, '\\'); $fileName = ''; $namespace = ''; if ($lastNsPos = strripos($className, '\\')) { $namespace = substr($className, 0, $lastNsPos); $className = substr($className, $lastNsPos + 1); $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; } $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; require $fileName; }); } This obviously wont work because it overrides the joomla autoloading function. I'm running php5.3 (5.4 in 3 months)
  4. So I'm rebuilding an existing joomla component in laravel and this time I want to get it right. Hopefully my explanation is not too complicated. I have this situation: I have an order. The order has many products. The product has many parameters in the form of input fields such as radio, select list and text (think of color, size, engraving, logo select). An order also has some parameters such as address etc. My question is how I should structure this considering the following: 1. The parameters of either an order itself or a product can change from time to time. Sometimes I need to add several fields for a certain amount of time. 2. Each product has 1 or more production pages (production steps) where some of the parameters set by the order need to be visible. Each production step has its own set of parameters (3d model, logo file). This means that the step1 page should show its own parameters INCLUDING a predetermined set of product parameters. So the columns could look like this: color - engraving - logo select - 3d model - logo file. 3. Each production page lists all the products belonging to that step. 4. Each product can belong to 1 or more production steps. 5. A product is only visible at 1 step at a time. The steps have a specific ordering. A little note: it's not a usual webshop, but rather we sell custom sports products. Currently we have 3 products where 1 product has 2 production steps and another has 3 production steps. Don't get me wrong, I have a working application for this, but currently it's just a database mess. The application kept growing as per bosses request so thinking it through was not possible at the time.
  5. Thank you! very simple! I figured it would be something like that. Thanks for confirming
  6. Forgot to mention, but no they go through completely different steps so productA can have xyz steps and productB can have uvw steps.
  7. This is a more general schema design question as opposed to specific queries. I'm designing a database which tracks the production status of 2 (and in the future maybe 2 or so more) completely different products. So let's call these products productA and productB. I have a page where the user can see the progress of either of the products. This concerns these 3 tables: productA(id, order_id, status) productB(id, order_id, status) production_status(id, status, ordering, type) The status is number based PER product so that it can move up a chain of statusses in its production process. So if a product is in status with ordering 10 it's done (assuming there are 10 production steps). So at ordering 1 its production just started. The status field contains at which production step it is which will be visible on the page. Now this is where i get stuck. I somehow have to differentiate between statusses so I know which statusses belong to which product. I put type in so it could filter for either productA or productB, but also for future products. But working with strings is not such a smart idea I think. I could make 2 more seperate tables, but I'm not sure how well that would scale. So my question is what a good approach would be. Some background info: I'm building a Joomla component for a small company. Like I said they want to track the status of these products. Every time a production person unpublishes said item on its production view inside the component, the product moves to the next status
  8. Hi guys i'm currently developing a small application with laravel 4 and I have noticed that in its current incarnation it's not functioning as supposed. A quick description of the app. It's kind of a tinder like app but it's only for facebook friends. Basically, you go to the site, login with your facebook account. Your entire facebook friendlist will be loaded from which you can pick 3 friends whom you like. They can then do the same (not knowing you did any of this) and if they click/like you back both will be notified. The way it works is that when you log in, a profile is created in the database in the profiles table. In the table your facebook id is stored. This id is important for matching. Now the way I have it set up is with a clicks table. This contains 3 fields. id, clicker and clickee. In the clicker and clickee fields, facebook id's are stored. Your are the clicker, the persons you click are the clickees. So if you select 3 people, 3 entries will be created in the database. The reason that I'm storing facebook id's is because the user you select most probably does not have a user account on the my application site. Hence the matching must be done with facebook id's. Now i've spammed laravel's forums and irc with my ORM problems. I can't seem to retrieve the profile of the clickee's. (for your matches page). I'll post my code below, but perhaps someone has a better and more efficient way of handling this as far as sql goes. Tables architecture: clicks->id clicks->clicker clicks->clickee profiles->id profiles->name profiles->username profiles->uid (facebook profile id) class Click extends Eloquent { public function profile() { return $this->belongsTo('Profile','clickee','uid'); } class Profile extends Eloquent { public function click() { return $this->hasMany('Click','clickee', 'uid'); } The $clicks variable itself is not empty; that contains the correct rows $clicks = Click::where('clickee', '=', $uid)->get(); $clicks[0]->profile; //returns null $clicks = Click::find(1); var_dump($clicks->profile); // returns null $queries = DB::getQueryLog(); dd(end($queries)); //returns the following: array (size=3) 'query' => string 'select * from `profiles` where `profiles`.`id` = ? limit 1' (length=58) 'bindings' => array (size=1) 0 => string '100000898436106' (length=15) 'time' => float 0.24 /** Note the red "id". That should be uid... Then it will work! */
  9. I eventually managed to convince the big boss with some solid arguments about user friendliness, safety and future complexity. This stupid idea is off the table and I can sleep at night without feeling guilty of bringing such a crippled application to this world. Off to programming
  10. Let me try to explain better. The scanner first of all scans the ankles. These braces are ankle braces. They are custom products which need to be 3D printed once an order has been paid. However let's look at this example. I have created an account on the website from my home PC. I then decide to go to the store to get my ankle scanned. I then need to bind that scan to my account. The big boss wants the only authentication method to be an email address (which is also the username). So what happens now? I go to the store, scan my ankle and then enter my email. I can't possibly log someone in without a password. I could however create the "ghost" account which acts as a temporary bridge. But I know this idea is flawed, because there is a shitload of stuff that can go wrong when trying to merge accounts and it's just a pain in the ass to work this way. I just can't think of any other solution. I'll try to convince the client to have existing users log in with their password and new users can just create an account with only an email.
  11. I said the same thing, but the client insisted on logging in with just an email (ARGHHH). The payment and shipping details are provided then and there in the webshop on the scanners integrated screen, but the user can also finish the order at home and stop anywhere in the process. Perhaps the ordering has to be done at home in the case of a "ghost" account being created. So if the account exists, the customer can only finish the order once the account has been merged? Unless you (or someone else) as a better solution to this problem.
  12. [i asked the exact same question on stackoverflow, but I like the people here better] I have a project i'm working on with a **very** weird request from my client, which I need some help with since i'm not quite sure how to handle it. This is all done in Joomla and PHP 5.3 The company i work for sells ankle braces. They will be placing ankle scanners across stores which scans the ankles. After that the scanner will send you to the online webshop through its integrated screen. The idea is that you simply enter an email address and the system automatically logs you in on the webshop with an automatically generated password. You can run through the customization options and place an order. So there are 2 scenarios. If the email (which is also the username) does NOT exist, it is created and logged in. This works fine. The user can place the order and later on change the automatically generated PW. However what if the user exists? Our "solution" was to create a ghost account with a simple timestamp appended at the end of the email. The user to whom the existing email belongs to will get notified. If it was him/her in the store "logging in", then that user can MERGE the ghost with the existing user. It will basically re-associate everything with the existing user. If it was some prankster, however, the account will be deleted in 48 hours or something along those lines. However I have no idea how to handle this situation. This is so not common and I don't know what to do.
  13. Thanks for your reply .josh! Appreciate it, however the keys competitive set and test are arbitrary. They can can be anything so this isn't a full solution, just for this particular problem.
  14. Hi guys, I'm working on a project and I can't wrap my head around on a calculation that needs to be done on a multidimensional array. Quick background, it's a hotel benchmarking tool and I need to calculate the market penetration index (MPI). I have an array with 3 main arrays. First 2 are the hotels which are being compared and the last one is the MPI array. Each array contains an array for every month the user selects. Inside THAT array is data that needs to be used for calculations. Here is an example: Array ( [Competitive set] => Array ( [sep 11] => Array ( [0] => Array ( [minmonth] => 2011-09-01 [maxmonth] => 2011-09-01 [nrcheck] => 13 [data] => 67.6 ) ) [Oct 11] => Array ( [0] => Array ( [minmonth] => 2011-10-01 [maxmonth] => 2011-10-01 [nrcheck] => 13 [data] => 63.6 ) ) [Nov 11] => Array ( [0] => Array ( [minmonth] => 2011-11-01 [maxmonth] => 2011-11-01 [nrcheck] => 13 [data] => 59.2 ) ) [Dec 11] => Array ( [0] => Array ( [minmonth] => 2011-12-01 [maxmonth] => 2011-12-01 [nrcheck] => 13 [data] => 54.6 ) ) ) [Test] => Array ( [sep 11] => Array ( [0] => Array ( [minmonth] => 2011-09-01 [maxmonth] => 2011-09-01 [nrcheck] => 89 [data] => 71.5 ) ) [Oct 11] => Array ( [0] => Array ( [minmonth] => 2011-10-01 [maxmonth] => 2011-10-01 [nrcheck] => 89 [data] => 67.0 ) ) [Nov 11] => Array ( [0] => Array ( [minmonth] => 2011-11-01 [maxmonth] => 2011-11-01 [nrcheck] => 91 [data] => 63.1 ) ) [Dec 11] => Array ( [0] => Array ( [minmonth] => 2011-12-01 [maxmonth] => 2011-12-01 [nrcheck] => 89 [data] => 57.5 ) ) ) [MPI] => Array ( [sep 11] => Array ( [0] => Array ( [minmonth] => 2011-09-01 [maxmonth] => 2011-09-01 [nrcheck] => 89 [data] => 71.5 ) ) [Oct 11] => Array ( [0] => Array ( [minmonth] => 2011-10-01 [maxmonth] => 2011-10-01 [nrcheck] => 89 [data] => 67.0 ) ) [Nov 11] => Array ( [0] => Array ( [minmonth] => 2011-11-01 [maxmonth] => 2011-11-01 [nrcheck] => 91 [data] => 63.1 ) ) [Dec 11] => Array ( [0] => Array ( [minmonth] => 2011-12-01 [maxmonth] => 2011-12-01 [nrcheck] => 89 [data] => 57.5 ) ) ) ) Currently the 'data' for MPI is wrong. That needs to become the data of the first array divided by the data of the second array and multiplied by 100 (percentage). How would I go about doing that? The foreach loops are a bit too big for me on this one.
  15. I'm not quite sure why it has to be done clientside... The AJAX requests are not the issue here. The PHP job queue is. I did find a solution called gearman, but I can't get that to install (yet) but I want to be able to write this on my own. Basically I need to be able to queue PHP jobs/functions somehow where I use AJAX to request data on progress (but that's a whole other issue)
×
×
  • 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.