Jump to content

FrancisChung

Members
  • Posts

    472
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by FrancisChung

  1. Hi @BitPoet, if you've got a spare moment do you mind sharing what you've done? I am quite intrigued. (Perhaps in a separate thread and not hijack this one) When you say it's really fast, I assume you don't mean XDebug but some other methodology/tools for debugging.
  2. You're right about XDebug slowing everything to a crawl. Have you tried these tricks involving the profiler and remote host? http://www.sinaru.com/2015/09/25/improving-php-xdebug-speed/
  3. Great work TPR, I wrote some JS code to do this a while back, and it wasn't pretty ... at all. Thanks for this
  4. FrancisChung

    Need a new mouse

    @Robin S , I haven't forgotten .... just been flat out recently. As you can see, I've programmed the side mouse buttons accordingly to my own usage patterns. The commands you see are for PHP Storm. Most/All of them are commands i use for debugging. I also have other profiles for different programs / IDEs as you can see on the top menu (Visual Studio, Diablo3 etc) Another interesting thing is there is a right mouse button you can click (G-Shift) which you can press to get an alternative set of comma. I've grouped out IDE editor commands here seperately. Also, it lets you have 3 different modes according to Colour which you can customise. You can see above that I'm currently in the default mode of Purple. There's a button at the top of the mouse that lets you cycle through other modes. Following picture shows the commands for the Red mode. I've put in some Web Browser commands in the Red mode for example. So it's a bit of work to program the commands you use and lay it out the way that's useful to you. I am happy to provide the profiles if anyone needs it, save you hours! The huge advantage of going through this process is you can just learn 1/2 set of layouts and you can use it on multiple IDEs , enviroments. My Visual Studio layout is almost identical to PHPStorm layout (bar some unique commands) so I know exactly where the StepOver or StepThrough commands are exactly. Perhaps overkill if you just use 1 IDE or program in 1 environment but if you're jumping around, then I don't know of a better solution than this. The only issue you might have if you're intrigued is sourcing the mouse. I think I've seen some go on sale on eBay still ...
  5. I stumbled across this on Github ... just breathtaking .... piece of history right there. A good place to brush up on your Assembly Language https://github.com/chrislgarry/Apollo-11 By the way, Margaret Hamilton who worked on the module is considered a programming genius. https://www.wired.com/2015/10/margaret-hamilton-nasa-apollo/
  6. FrancisChung

    Need a new mouse

    @Robin S, Just realised it might be better if I uploaded some sample configurations and screenshots to better illustrate my points. I can do it once my laptop returns from repairs.
  7. FrancisChung

    Need a new mouse

    3-4+ years I think. It took me a while and it was a bit of a stop/start journey, but I now have converted and can't go back. Ah fatigue & RSI. Luckily I've rarely suffered from it so far from coding touch wood. Only incidents I can think of late are after some epic FPS sessions involving Doom, Shadow Warrior & Killing Floor 2. Yes it is unavoidable and one shouldn't avoid it. Trouble for me was, I was switching back and forth between IDEs every few months and I would forget all the shortcut keys after a while, and some of them involve complex key strokes like multiple ctrl + key combos. If you take the time to setup a layout that reflects your workflow and usage pattern that is IDE agnostic or independent, then you can free yourself from remembering all the short cuts. Even if you do, it's much easier to look up what the button is then some obscure keyboard short cut hidden away in the layered menu structure. Great thing is it is programmable so you can program it to do anything. Funny enough you're the first person that showed any interest in it. I remember when I first saw the mouse, I got a sudden brainstorm and thought for using it to aid with my IDE situation. Certainly my MMO playing friends thought I was mad for getting a MMO mouse for that. I also recall people calling me mad for deciding to use Processwire for my first Website
  8. FrancisChung

    Need a new mouse

    Haha, I might as join in too I use the Logitech G600 MMO Mouse exclusively. Why? Because of its programmable feature, you can program your most go-to keyboard shortcuts into it. It takes a little time to program it in, and more time to find a layout that suits you but just take your time with it. It's definitely worth it IMHO as you can eliminate all keyboard shortcuts making you more efficient. https://www.logitechg.com/en-us/product/g600-mmo-gaming-mouse The best thing is you can upload someone else's mouse profile and use it so if anyone is interested in my PHPStorm layout, give me a shout. Before the MMO mouse was released, I used a Logitech G13 Keyboard for the same. http://support.logitech.com/en_us/product/g13-advanced-gameboard
  9. I was expecting some juicy gossip about Brad Pitt & Jennifer Aniston under those headlines .... 320 stars
  10. @szabesz, It's something that takes a long time to be really fluent with it. And don't try and fit every problem or situation into a Design Pattern as most people who start off with this topic inevitably get excited and try and fit every problem into one. The trick is to learn to identify when a problem seems like it can elegantly be solved by applying a suitable design pattern to it if one exists at all.
  11. Mastering PHP Design Patterns book from Packt Publishing is free for the next 22 hrs (as of time of posting) https://www.packtpub.com/packt/offers/free-learning
  12. Try using a foreach loop if you're bad with arrays and loops. It will iterate through each member of a collection (or arrays) and you don't have to worry about setting it up initially or its exit conditions. The article I posted previously has an example of it. For further reading : http://php.net/manual/en/control-structures.foreach.php
  13. @SamC Slightly off topic, but here's a good one for JS. http://www.leerichardson.com/2015/02/an-illustrated- gude-to-parameter.html P/S : the spelling mistake in the URL is as is. As you learn other languages, this is another area where there might be subtle differences between languages that could come back and bite you. (e.g. Java only does pass by value)
  14. An alternative could be to export to an XML format for Excel. But without knowing your exact requirements, it's hard to tell if it solves your problem. There's a detailed discussion here with sample code.
  15. I've managed to get Google display our meta description correctly again today in their search results. Not sure which of the following corrected it, but the steps are took were : 1) Not to cache Robots.txt (.htaccess) <filesMatch "^robots.(txt|php)$"> Header Set Cache-Control "max-age=0, public" </filesMatch> 2) Removed other test sites from access-control-allow-origin 3) Created a sitemap-category.xml file where it listed the homepage plus important category pages and uploaded it to Google. 4) Uploaded sitemap.xml to Google again after fixing 1) & 2) I initially tried 3) but it didn't fix the problem initially (Google initially indexed 0 pages ... then 1 page today ). I tried 2) 3) 4) today and it seems to have fixed it. Process 1) I tried when I first posted this thread. It's also quite possible it "organically" fixed itself today by coincidence and none of my steps was actually effective. As for the canonical meta-name issues, I'm using MarkupSEO module so it possibly is an issue with that. I'll post any updates here. Thanks again to @dragan , @Christophe & @teppo for responding.
  16. Just a quick note. Whilst it's ok to do a "Select * from ..." query whilst you're debugging or developing, you shouldn't use the * clause in your final production version. Why? 1) Efficiency. You may not need all the fields from the table(s) you're selecting from. Reducing the fields will make your query return quicker. 2) If 1 of the underlying tables change in the future, "Select *" might be masking some unintended consequences. Listing individual fields would have made it easier for future maintenance and spot any potential bugs. I've definitely had to fix a few stored procedures in my lifetime where a structural change to a table resulted in tracking down why the stored procedures stopped working suddenly.
  17. @bernhard, I'm a bit confused with the following SQL (SELECT month_$i FROM demo WHERE year = $year) Is there a missing "AND month = $i" in the WHERE clause or do you actually have 12 fields called (month_1 .... month_12). Asking because it's not your usual normalised database table structure. Was there a reason for going the denormalised route rather than say having a field called Month with values 1 to 12? So your query would look like : (SELECT month FROM demo WHERE year = $year and month=$i) AS month_$i Normally you might denormalise if you have too much data or reducing the number of joins in your query dramatically improves performance.
  18. @bernhard, have you tried using another tool like MySQLWorkBench for example? Perhaps it has inbuilt formatting that is better? Did you create the views inside phpMyAdmin? If you go down the view / stored procedure route, the normal workflow is to use DB scripts that create the views / stored procedures on the DB. So if you need to make a change to the logic, you would edit the view / stored proc. logic on the script and then run the script on the DB. These scripts can be generated using the generate script/schema functionality of these DB Management tools like MySQLWorkbench etc. They normally have the following structure. (Following is pseudo code) IF <DB Object> Exists Then Drop <DB Object> CREATE <DB Object> ...<Business Logic here> ... GRANT <DB Object> Permissions Having these scripts will allow you make automated deployment easier later on. Also, if you create your objects this way, this may solve your issue with the formatting because you have a direct hand in formatting the SQL that's being used.
  19. @bernhard, you might also consider using Views or Stored Procedures to encapsulate the logic in the DB rather than code. I'm guessing that the user might be filtering on the dataset returned, but that's mainly done on the client side, not the server/db side?
  20. I'm very well versed in MS SQL Server but not as much in MySQL. But the underlying principles are the same. Pretty succinct explanation here https://www.sitepoint.com/using-explain-to-write-better-mysql-queries/ And to get in deeper https://dev.mysql.com/doc/refman/5.5/en/using-explain.html It may also beneficial to create indexes for some of the fields you're joining with (e.g.efforts.data, pages_id) but best to verify with a query plan using the Explain command as above to verify your mileage. Indexes with low cardinality (i.e. low number of unique values) usually perform worse than not having any indexes at all.
  21. @bernhard , have you looked at the query plan for both SQL statements using a profiling tool or SQL Management tool? I had a quick look at your SQL and the type of select query you're doing (lots of fields from lots of tables), an inner join is (almost) always going to be faster than subqueries . There are instances where subqueries can be quicker than a join. If the subset of data returned by a Subquery is much smaller than if the table was used in a join query, (1000 rows vs a million row table for example) than this is where Subqueries can really shine. I'm guessing your tables are not? If you can also use EXISTS, NOT EXISTS statements with a subquery, it's probably a good candidate as well because of the aforementioned reasons. Normally, I'm a big advocate of readability of code but I draw the line on SQL because very often this is the place for bottlenecks for entire applications & workflows and it's the one place where a poorly optimised query can really cause issues down the line in too many ways. More readable code which is less optimised might only cost you a ms or a few seconds. Poorly optimised queries can cost you hours and even days depending on the dataset. Proper indenting, good (SQL) coding standards and concise & detailed commenting can go a long way to improve readability of those yucky joins
  22. @Dragan, the other two domains are our test server / test domains. In theory, Google or any other crawlers shouldn't be indexing them because robots.txt for those other sites instructs it not to. Surely this isn't a frowned upon practice? In fact, the reason why I'm in such a pickle is because I migrated the code + contents from our UAT site to our live site including the robots.txt file from the UAT. I'm aware of what Google does to punish sites that circumvent around Seach Engine rules and I thought it's pretty hard to circumvent them these days. And I assure you that's not our intention here to cannibalise our own SEO rankings. Perhaps I need to fix the access-control-allow-origin to have only one domain? I wasn't sure listing all our domains would have a negative impact?
  23. I run the robots.txt file through this http://www.webconfs.com/http-header-check.php It says : Cache-Control => max-age=2592000 Expires => Wed, 21 Feb 2018 18:21:44 GMT Which is a bit baffling. The Homepage and Main Category pages are showing Cache-Control : No Cache at the moment. I do have Procache installed but currently, it's off at the moment. This is our current Cache-Control settings. <ifModule mod_headers.c> # Ignore comments, everything is set to 8 days atm. # 1 week for fonts <filesMatch "\.(ico|jpe?g|jpg|png|gif|swf)$"> Header set Cache-Control "max-age=691200, public" </filesMatch> <filesMatch "\.(eot|svg|ttf|woff|woff2)$"> Header set Cache-Control "max-age=691200, public" </filesMatch> # 1 day for css / js files <filesMatch "\.(css)$"> Header set Cache-Control "max-age=691200, public" </filesMatch> <filesMatch "\.(js)$"> Header set Cache-Control "max-age=691200, private" </filesMatch> <filesMatch "\.(x?html?|php)$"> Header set Cache-Control "private, must-revalidate" </filesMatch> </ifModule> I will add a separate filesMatch module for Robots.txt and see what happens ... <filesMatch "^robots.(txt|php)$"> Header Set Cache-Control "max-age=0, public" </filesMatch>
×
×
  • Create New...