Jump to content
Larry Ullman's Book Forums

Antonio Conte

  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Antonio Conte

  1. Glad you are improving Edward. Making things work is always the most important point. Refactoring can happen later and bit by bit.
  2. Soap was very nice some time ago, but most web services are luckily going RESTful these days. I suggest you look into building a rest Api rather than work with Soap.
  3. This error occurs when you try to call a method on something that is not an object. In this case, the variable that should hold an object is actually a boolean. Make sure you actually create an object. An example can be the MySQLi functions.If you look at MySQLi::query(), the function returns either false (on error) or an object of the type mysql_result. A bad SQL query will make the query fail and the function to return false. The next call to $result->fetch_all(); would therefor return the error above. In you case, the error occurs when you try to call setFetchMode. It probably me
  4. Just like an array is traversable a closure is callable. The traversable part is why you can foreach an array, as foreach expects something implementing Traversable. You can actually implement Traversable directly on any object and foreach it directly. The same principle applies to anonymous functions. It's just another type of structure PHP provides you with. Functions in PHP normally provides you encapsulation and execution of a set of logic. A closure is a reference to a function's definition, and behaves more like objects in PHP. When you have a closure, you can do stuff to it, just li
  5. I can really recommend PuPHPet. It takes most of the work out of server configuration.
  6. To add to that, .NET just went open source and is available for UNIX systems. That happend very recently. My advance is to look at Jobs in your community. Also, keep in mind that programming pilars such as algorithms and data structures is appliable to any language. Learn that. Also, learn HTTP if you want to work with the web.
  7. What are your needs here? If this is a read-only (only GET-operations) API, you don't need strict authentication or might not need it at all. Tokens can be used to make sure only those with a valid key can fetch data, you can throttle their calls and build statistics. You could also consider leaving it out completly. If the API is read only, a simple token emailed to users are enough. You can add this token to a GET param or insert into a header in your calls. 1. Seems like a good idea. That way you can also retract tokens. 2. Probably. How important is security? The tokens generated shou
  8. It's quite normal to build the REST api alongside your site. It seems api.domain.com or domain.com/api/ are pretty normalt structures. While that is the most common, I myself prefer the sort of structure Rails use. This has the added benefit of allowing you to build everything once only. I don't know how easy this is to do with YII, but that's how I build in Symfony. Looking quickly at YII, the same should be possible there. Some of the reason why this is so easy are some incredible bundles like the FOSRestBundle and JMSSerilizerBundle. By defining core configuration for you app, you're co
  9. The biggest issue I had was understanding "the flow" of git. If you have get an error, you are doing something wrong. Some typical error cases: 1. You try a git pull origin master (or similar) and get an error. Your local branch is probably not clean. Do a "git status". If you have any changes, do one of two things. - If you don't care about saving your changes, you can do something like "git checkout .". That will remove any changes to tracked files. (git checkout file/to/checkout will remove single files) If you've added files using 'git add file/to/add", you can unstage them by doing "
  10. Apply some debugging. If you look at your source code, you'll see that the data you try to echo to var date is not correct. Creating JSON out of $_POST will never get you a date. You are looking for a date on the form "YYYY-MM-DD". To get that, you'll need something more like this: var date = "<?php echo $_POST['date_looking']; ?>"; Some tips. Check you source HTML code and use the Firefox/Chrome debug console to catch any errors.
  11. We use Git Flow on our projects. We also use post-receive hooks and deploy the same way as Larry does. The big difference is that the master branch only have published released, and is thus always stable. We branch out of develop using feature-branches, and merge with develop, perform staging and then goes live when our customers accept new functionality. The stage-enviroment is therefor based on develop, not master. This means we can very easily rollback to a working version if anything stops working and master is always stable. The actual development is performed on our development server th
  12. Yeah, I've both used and installed Solr at work the last few months. It's pretty amazing. Happy holliday to you, Edward.
  13. Perform a new query. Query for the new info you need and limit the result to a single result.
  14. Because IE is shit... On the more serious side, that sounds more like an header issue. I know IE can be a bit weird about headers, so that is nothing new. I experienced the same kind of problem you got a couple of weeks ago. You can find some info here: http://stackoverflow.com/questions/1218925/php-script-to-download-file-not-working-in-ie If that doesn't work, keep searching Stack Overflow. I used the google term "pdf download php internet explorer". Good luck and merry Christmas to you guys.
  15. Possibly an PHP error/warning? Try setting PHP error_reporting to off and set display_errors to false.
  16. Seems like you are outputting something before you serve the pdf. Because of that, the headers for the PDF file doesn't get taken into account. Remove any echo statements before serving the pdf, and all should be good.
  17. This might be a good fit for http://ux.stackexchange.com/ if you're still having problems. User interface design is tricky business.
  18. I agree on the notion of following standards. With that said, there are no rules without exceptions. I think one-liner if statements are far more readable when you need to assert on state. public function someMethod( SomeClass $something ) { if ( ! $this->assertSpecificState($something) ) return; // No need to worry about the unwanted state. } While the above could be written on several lines, it's very expressive yet keeps the noise ratio down.
  19. Happy Holiday, Americans. We don't celebrate thanksgiving here, but it seems like a nice holiday. I've been employeed for around six months in my first job now. It's a small and stable company with a total of five developers. We got way to much to do, and the business is fantastic. There I mainly work with development in PHP, but also have other tasks related to server management. eZ Publish and Magento is historically the platforms we work with, but we are moving more and more in the direction of Symfony. With that we build multi-language company sites, eCommerce website and totally cust
  20. Beautiful, lindsd1111. It seems very much like a one-time task, so solving the problem is all that matters. Glad you worked it out.
  21. You problem is that you are not escaping quotes. The sentence in bold I''m confused about normalization uses an apostrophe of the same type as your string declaration. You can't mix and max apostrophes of the same type in strings. "I'm confuced" and 'I "Love" spinach' will work because, while 'I'm confused' and "I "Love" spinach" will break. You need to escape you input using mysqli_real_escape_string() or by using prepared statements. (Which is recommended. An hour spent googling is worth it) Also, you'd have problems using these strings in PHP too. Keep that in mind.
  22. Man. It's right there in the Faq. I know you are a beginner, but being able to look for information is perhaps on of the most important skills of any programmer. There's simple to much to know in the programming world to remember it all, so start getting into a habit of at least looking for the answer. I'll quote the FAQ: If you can't get that link working, make sure you've found the Xampp control panel and have started Apache and Mysql. You'll find info on that in the FAQ too. Also, that said. Keep you spirits up and don't be afraid to ask on the board. There's a lot of awesome
  23. Of course. It all depends on your needs, really. Do these accounts need to have specific details or can they have random data? Do you have the password in plain text? You don't give us to much to work with here. Non-the-less, creating the users should happen inside a loop. In that loop, you'd build all the data you'll need to insert for each user. This can happen trough building a custom query or using PDO. $dsn = 'mysql:dbname=YOUR_DATABASE;host=localhost'; $user = 'dbuser'; $password = 'dbpass'; try { $dbh = new PDO($dsn, $user, $password); } catch (PDOException $e) { echo 'Conn
  24. Xampp is a local development stack (think server - with Apache, PHP and Mysql). You'll find a utility inside xampp where you can start both apache and PHP. Depending on your OS, look for a something like xampp-controll.exe on windows or in the xampp folder in applications if your OS X. When that is done, you should be able to hit your local server using http://localhost. This will give you a general XAMPP page with links to PHPMyAdmin (a MySQL web client) and settings such as for admin password. Google is also always your friend: https://www.apachefriends.org/faq_osx.html As Xampp is
  25. if you have access to both, a Mac would be preferable in most cases. Being familiar with Unix is a huge plus in that regard. That said, it all depends on your needs. If you are a beginner trying the learn PHP, it does not matter. It matters more when you have production ready code and needs to do more advanced tasks. Being able to use Git for source control is nice, and almost all servers runs on Unix. As tools go, check out both Sublime and one of Netbeans or Eclipse. All tools are available for both platforms. In the end, if you need to ask the question, I'm inclined to say it do
  • Create New...