Jump to content

proggR

Members
  • Posts

    431
  • Joined

  • Last visited

    Never

Everything posted by proggR

  1. Can I have my name changed from hopelessX to proggR. I use proggR for everything else online and hopelessX is just a silly name.
  2. Good to know. Thanks for the answers.
  3. I'm curious if anyone has information on how much overhead there is with creating an object in PHP. I've tried finding some benchmarks but haven't really been able to find anything solid to use for reference. Also, when dealing with objects what optimizations can be done to improve performance. I ask because my project I've been working on is entirely OO. Everything, including views, are objects (though their state and behaviour is really just the model they're representing and a show() function that has the HTML used to display the model). This makes development very easy and clean but I'm trying to figure out how much of a difference I can expect in production and in what ways I can limit any negative side effects. What things could be cached, and what things can't? For example, is it possible to cache the class definition without caching instances of that definition (since they'd be different from page view to pageview)? Would that be helpful. Any pointers would be great. I haven't had a lot of time with performance tweaking so I'm not sure of any known pitfalls. I know objects and function calls use a bit more overhead but I've never found out how much more. Thanks in advance.
  4. Good to know, thanks. The place I work has a nightmare of a deployment strategy right now which got me thinking about how I will do it with my own projects. In the past I've just used FTP to copy my "staging" files to production but if I'm using git anyway during development I figured using the master branch for production made sense.
  5. I'm trying to think of the best way to deploy production updates for a website I'm working on. Right now I'm toying with the idea of using the master branch of a git repo for production. I would develop from a development branch and when it comes time to roll the updates into production I would make a staging branch from production and merge the develop branch into that, test and merge that into the master branch. With that said, does anyone see any issues with this strategy? What security measured should be taken if this is the process that gets used? I would limit read/write access to known computers using an ssh key. Are there any other things to take into account if I were to use git over ftp for deployment? Any thoughts would be appreciated.
  6. Thank you for the insight Gizmola. I work at a university so I may see if I can get some free advice from an accounting/legal prof. I did get a reply from FreshBooks and they said they don't have anything explicitly like this but I could collect the information and save it as a draft invoice and on the successful completion of the project, loop through each drafted invoice and process the payment. The thing I can see not working with this is NSF at the time of the processing. I know that Amazon FPS allows for this type of model because its what Kickstarter uses. But I don't want to limit myself to only US customers.
  7. Ya I do intend to arrange a meeting with my bank. It would be convenient if they have some kind of ability to handle this. I have been looking around at other processors. They all seem to do the payments upfront which doesn't exactly work. Since I only want to commit the transaction if the project reaches 100% of its requested funding, if people donated to it and it didn't reach the funding I'd be paying transaction fees for taking the money and transaction fees for returning the money and wouldn't have actually made any money in the first place so it would be a loss for me for every failed project. I did just stumble across FreshBooks and sent them a message explaining what I'm looking for. They're more of an invoicing app but it may work still for what I need. We'll see. I'll keep checking back and update if I find anything as well.
  8. I have a kind of strange need from a payment processing service. If you look at Kickstarter.com you'll have a better idea of what I mean since the payment model is similar. Users donate money to a project, but their donation only actually gets taken if the project gets 100% of the funding they requested. Even though that's the case, I need to process the user's donation up front so at the time the project is finished the transaction can be completed all at once. If the project doesn't get 100% of the funding they need, none of the users pay anything and I would hope that I wouldn't be stuck with transaction fees for what wasn't a transaction as well. I'm wondering if anyone knows of any services that allow something like this. Kickstarter uses Amazon but that limits you to only US customers. I'm hoping for something that doesn't have that limitation and obviously the lower the transaction fees the better, especially since some of the donation amounts could be only $5. Any pointers would be great. I've done very little with online transactions before so taking a stab at such an unusual model makes it tricky to find what I need.
  9. Just a drop in the ocean. If one extra database request per signup was bad then you'd have more problems than just efficient code. True enough. The same thing happens on signin and one other type of content creation but nothing major. And ya, one extra request isn't the end of the world, I just figured if there was a more efficient way to do it I'd like to do it that way. Thanks again
  10. Not a problem. I thought this may be the case. Its unfortunate since its an extra database request that otherwise wouldn't need to be made but if I must I must I suppose. Thanks for clearing that up.
  11. I'm wondering if there's any alternatives to redirecting. For example, after the registration process, I have a fully loaded User object with all of the information I need to load the user's profile (the place that logging in/registering takes you to). I can call the profile action of the user controller and pass in the User object and it will display just fine. The problem is that since the URL is still pointing to the register action if the user refreshes their page its going to try sending the previous form again. Alternatively I could redirect to the profile and have it load that way, but then I'm fetching data from the database seemingly unnecessarily since I had all of the data I needed already fetched prior to redirecting. Is there anyway that I could do the first process but change the url and forget the previous form data so that if they refresh its just refreshing the profile and not resending the previous request? Thanks in advance for any help.
  12. Nevermind, that was my fault entirely. It was running when the page initially ran and I didn't realize so when I called the Ajax.Updater and it passed in the users that were already displayed it skipped a part of the script above. The code showing up in the source was from the initial page loading, not from the call I was making. Its working now. That took far too long to figure out. :\
  13. Ok this has been driving me absolutely crazy. I have a script that gets called by Prototype's Ajax.Updater() class which should then update a div. It does update the div but a portion of what gets outputted doesn't render. if (is_array($PROCESSED["associated_proxy_ids"]) && count($PROCESSED["associated_proxy_ids"])) { foreach ($PROCESSED["associated_proxy_ids"] as $student) { if ((array_key_exists($student, $STUDENT_LIST)) && is_array($STUDENT_LIST[$student])) { ?> <li class="user" id="audience_student_<?php echo $STUDENT_LIST[$student]["proxy_id"]; ?>" style="cursor: move;"><?php echo $STUDENT_LIST[$student]["fullname"]; ?><img src="<?php echo ENTRADA_URL; ?>/images/action-delete.gif" onclick="removeAudience('student_<?php echo $STUDENT_LIST[$student]["proxy_id"]; ?>', 'students');" class="list-cancel-image" /></li> <?php } } } I've echoed from within the foreach and the following if and the $student variable does have a value, however I'll point out that it also doesn't render but that may be because its not a <li>, I'm not sure. Now, if I take that li element lin end output it outside of the foreach loop it renders just fine(once I substitute the $student variable for a known index of course). Inside the loop it doesn't. I can see it in the source code of the page but for some reason its not rendering. I'll put the output from the source of the page below, the top is the code output from within the loop and the bottom is from outside of the loop. The bottom renders as expected, the top doesn't. <!--foreach li element:doesn't render--> <li class="user" id="audience_student_2" style="cursor: move;">Hudson, Tom<img src="http://localhost/entrada/www-root/images/action-delete.gif" onclick="removeAudience('student_2', 'students');" class="list-cancel-image" /></li> <!--non foreach li element:renders--> <li class="user" id="audience_student_2" style="cursor: move;">Hudson, Tom<img src="http://localhost/entrada/www-root/images/action-delete.gif" onclick="removeAudience('student_2', 'students');" class="list-cancel-image" /></li> They're identical. I can't figure out for the life of me why this isn't working. Any help would be great.
  14. I'm working on a website for my sister. She has a font and wants a stroke around the text. the -webkit-text-stroke property works wonderfully but obviously not in any non-webkit browsers. I have a text-shadow for the others but it doesn't look anywhere near as good and in webkit browsers it adds the shadow outside of the stroke which makes it too thick. I was wondering if anyone knows of a text-stroke hack that I could use so I don't resort to using pngs :\ Thanks in advance.
  15. I've always been similar. I've written a blog engine 3 times now I think just because I refused to use WP or MovableType. I can honestly say I've learned the most by doing things the hard way and it definitely makes you appreciate the work people have put into the frameworks to make it easier for people. I personally wouldn't ever try to make my own javascript framework but that's because I'm far less comfortable with it and I've grown fond of jQuery. That doesn't mean that you shouldn't if you feel its something you're capable of. The hiccups you'll experience along the way will be what makes you a better developer. That's my 2 cents.
  16. Its been pushed to a remote repository where only my colleagues have write access to. It is possible for anyone to clone it with read only access, but only we have access to write to it. This mistake was made almost a month ago and there are tons of commits that have been pushed to the repo since then by both me and my colleagues. I've been reading about rebase but I don't really understand it well enough to find a fix. One fix I've come across is to checkout a new branch based on the bad commit, remove the file that's bad, checkout the main branch and rebase from the new branch. I've tried this just not but it seems to come into a lot of conflicts that I don't understand why they would exist. Also, I don't want to delete the file, I just want to undo the changes that were made to it during that commit. I hope this helps. The developer that usually takes care of anything git related is in the middle of preparing for an update and doesn't have time to sort this out and since its my fault I've been tasked with the cleanup. Thanks again.
  17. Apparently I made a commit a while back that included some vital login information that shouldn't have been committed. Obviously the username and password are in the process of being changed but I still need to remove that change from the history. I have the commit numbers but how can I delete the changes to the history without affecting the rest of of the commits? The file in question was included in a commit that also changed another file. Those changes I would like to keep, just not the changes to the settings file. I've been searching for an answer but I'm not overly familiar with git except what I use in my day to day development. Any help or guidance would be appreciated. thanks in advance.
  18. I really shut setup my environment to format the way I'm asked. It would make things a lot easier. I've had it autoformat a file once but it wasn't setup the same way so I stopped using it. I used to use it before every save when I worked with Java in Eclipse/RAD. There were no formatting guidelines to follow there though.
  19. I started working at a job a couple months ago and the boss really stresses "proper" spacing. I do it because I have to and its not really that different from how I normally code but it is strange to get used to. I was wondering how everyone else spaces their code. How I normally space my code: if(condition){ //code } How I space my code at work: if (condition) { //code } As I said, its not that different but getting used to those extra spaces is actually harder than I thought it would be. I'd be interested in seeing what other people use.
  20. I noticed that since all the models I have need access to the database so rather than including the same code in all of them I could just pull that into a class they all derive from. After thinking more about it using a Mapper makes a lot more sense so I'll be changing my code to use that approach.
  21. Currently my models all derive from a base Model class which instantiates the database adapter when it gets instantiated. This works just fine but the problem I have with it is that each instance of the model has its own reference to the database adapter. Even making it static, the models will all have a reference to the adapter, it'll just be the same one. I was thinking about loading the database adapter at the application level and passing it into the model when it gets instantiated but this doesn't really seem to fix the issue since each instance of the model will still have a reference to the adapter. This may not be a big deal at all but it is definitely a lot more ugly when I print_r the model. Any suggestions on ways around this? I'm not completely familiar how other frameworks handle this so I'm not sure where they're handling their database. **edit** Apparently Zend uses a mapper to map the model to the database. I'll ponder that for a bit and see if that's something I can do as well. I'd still appreciate any feedback if anyone feels obliged.
  22. The AlbumRepository being the model in this case? And is the assign pairing the values within the model with the view labeled album? I think I understand what you mean. The code is much cleaner the way you have it. Thanks for that. *edit* Also, I'm not sure why I wrote the example as if it were static since I have no static functions in my code :\
  23. In my last project I had the controller doing more than a lot of people make controllers do. It took the request, made basic checks (check that an id is specified if its required, used the SessionModel to make sure the user is logged in), then made the call to the appropriate model(s) and finally, instantiated the view with various modules (my term for them, basically a representation of specific information in HTML). The models handled form validation and whatnot via a Validation class since they have a better understanding of what each bit of information they are expecting in each case would be. With my current project, would it be better to have these modules(read as views) make the requests of the model themselves as is the norm with MVC design? The project is music related so lets say a module(view) was supposed to be the html used to display information for an album. Would it be best to have the album_info module call Album::getById()? Or is it acceptable practice to have the controller do something like $album = Album::getById(); $this->ui->addModule(Modules::album_info($album)); In the former example I would still need to instantiate the module and add it to the ui class, the difference is where the information is being retrieved. Also that isn't exactly how the code would be written but its close enough for the examples. I'm positive there are tons of unconventional things with my approach and I welcome any feedback if anything seems wrong to anybody. I'm looking to build this application better than I have built other ones since it's one I'm actually excited to work on for a change (the rest have more or less been practice/application style projects). Another quick question (may as well get them all out now). What is the standard approach for models requesting information from other models. To stick with the album example, the Album model has all the information specific to the Album, including an array of songs which are represented by a Song model. Is it appropriate to have a function within the Song model similar to ::getAllForAlbum() that can be called from the Album model to return an array for the particular album? Also, as far as the relation to the band is concerned, would the Album also have an instance of the Artist or the Artist instances of Album (which doesn't seem right to me). As I'm sure you can tell I haven't used MVC too much and I've been teaching myself but seem to have confused terms and practices along the way. Hoping to get all that sorted out. Also I'm aware frameworks exist to alleviate a lot of this headache but I like to work from my own codebase as much as possible. Thanks in advance for any help. Sorry if I'm way off base with all this.
  24. I'm sad that I'm considered a mature gamer
  25. Its not the end of the world if it can't be done. I have the working queries to do it the other way but I was hoping to not have to spam the ldap server over and over since these lists are going to be rather large and there will be a lot of them.
×
×
  • 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.