G'day:
I've not much to say here, but I'm just really pleased how the CFML community - especially Dom Watson and Sean Corfield - have been chipping away and planning out and discussing a ColdFusion enhancement request Alex Skinner raised last night (Allow additional attributes to be added to CFPARAM tags).
I put my usual cynical / jaded oar in (that said, I stand by what I say!), but Dom and Alex have been having a lot of discussion today (not just on the bug tracker, but on the CFML Slack channel too), and it's great work.
Well done, community.
--
Adam
Thursday, 29 October 2015
Tuesday, 27 October 2015
CFSummit: what am I gonna go see?
G'day:
Rightio then, I've had a look at the presentations on offer at CFSummit, and have tentatively decided what I'll probably try to go and see. Note that I always make one of these plans, and it always ends up bearing very little resemblance to what I end up doing. Often I just stay put in a room after one presentation, and check the next one out, or I accidentally walk past the bar and go "ooh! A bar! I wonder if they sell... beer" (in my experience: yes they do, but I need to continue this research, I think).
I have another challenge now that I don't do CFML on a daily basis (well: I do it seems, but I don't do it for a job any more), it gets trickier to pick sessions that are a good fit for my interests. So this time I'm kinda looking at the schedule and wondering less what I'm interested in, and more where there are gaps in my ColdFusion knowledge which I might be able to fill, so as to be able to help out in the community over a broader range of topics. Can you see my halo? ;-)
In reality I'll go "I'm too old for this", and collapse in a heap.
I s'pose in the evening I should lurk around our digs to see if I spy anyone I know doing likewise.
Rightio then, I've had a look at the presentations on offer at CFSummit, and have tentatively decided what I'll probably try to go and see. Note that I always make one of these plans, and it always ends up bearing very little resemblance to what I end up doing. Often I just stay put in a room after one presentation, and check the next one out, or I accidentally walk past the bar and go "ooh! A bar! I wonder if they sell... beer" (in my experience: yes they do, but I need to continue this research, I think).
I have another challenge now that I don't do CFML on a daily basis (well: I do it seems, but I don't do it for a job any more), it gets trickier to pick sessions that are a good fit for my interests. So this time I'm kinda looking at the schedule and wondering less what I'm interested in, and more where there are gaps in my ColdFusion knowledge which I might be able to fill, so as to be able to help out in the community over a broader range of topics. Can you see my halo? ;-)
Saturday
I arrive on Saturday @ 17:45, having flown LHR -> IAH -> LAS, taking 15h30m. That's not so bad... when flying to NZ (around 24-30h) I don't usually start getting stir crazy until we're about 4h from AKL, so I doubt 16h will seems so grim, especially with scope for a quick beer in Houston. My plan is to do something Saturday evening, although this will most likely amount to scouting around the Aria for a low-key bar which sells something at least mildly interesting in the beer dept. I've had a look at what the Aria's website suggests is on offer... and they all look very much like the sort of places one finds in a chain hotel, which is... predictable.In reality I'll go "I'm too old for this", and collapse in a heap.
Sunday
I have identified this outfit, down at the Venetian: "Public House". From the look of the website, this place is as much a proper pub as the pyramid at the Luxor is a proper pyramid, and the various other LV-copy-cat edifices are to their inspiration. Still, it has a list of over 200 beers, and some of them look interesting, so how bad can it be. I have absolutely zero interest in gambling (actually my reaction to it is more one of revulsion), and I've already looked at all the excessive gaudiness of The Strip, last time I was there (got married in Las Vegas in 2009), so I have no need to see any of that stuff again. I think I'll find a post card to write on (and a pen to write with, and a stamp to afix to it), write a postcard to my boy and slurp beer whilst being eyes-glued to my laptop. Oh, and perhaps get trinket shopping out of the way.I s'pose in the evening I should lurk around our digs to see if I spy anyone I know doing likewise.
Labels:
CFSummit
Sunday, 25 October 2015
ColdFusion: new updates for CF10 and 11 available for pre-release testing
G'day:
I'm a day or so behind on this, but in case you're a ColdFusion user but don't follow the Adobe ColdFusion Blog, this is for you.
Adobe have release a pre release version of the latest updates for ColdFusion 10 and ColdFusion 11.
Official word here:
If you're running ColdFusion 10 and/or 11, make sure you go subscribe to those comment threads if nothing else. It's important to know about other people's experiences with the updaters, which often gets reported on these threads.
Here are the bugs fixed in each:
The ColdFusion 10 update seemed to apply fine, but it took me about four goes for the ColdFusion 11 update to "take" on my CF11 Express install. This is par for the course with installing updates on Express, so that's nothing new.
Anyway... there you go... an opportunity to lab-test these updates and report any issues to Adobe.
Cheers Adobe for pre-releasing this!
Righto.
--
Adam
I'm a day or so behind on this, but in case you're a ColdFusion user but don't follow the Adobe ColdFusion Blog, this is for you.
Adobe have release a pre release version of the latest updates for ColdFusion 10 and ColdFusion 11.
Official word here:
- ColdFusion 10 Update 18 is available for early access
- ColdFusion 11 Update 7 is available for early access
If you're running ColdFusion 10 and/or 11, make sure you go subscribe to those comment threads if nothing else. It's important to know about other people's experiences with the updaters, which often gets reported on these threads.
Here are the bugs fixed in each:
ColdFusion 10 update 18
Bug ID | Title | Product Area |
---|---|---|
4034570 | Ehcache with CFQuery: not responsive and stops caching after Query Cache Size reached | Caching |
3982337 | cfinput is not working for some characters with HF5/HF 16 | CFForm |
4010041 | Image Functions All Fail on Mac | CFIMAGE |
3634391 | null pointer exception thrown every now and then | Core Runtime |
3982713 | Through Proxy authentication Hotfixes couldn't be downloaded with update 15 and later/CF 11 also | Hot Fix Installer |
3490112 | SEVERE: Error in getRealPathFromConn persists after Updating Coldfusion | Installation/Config |
3536673 | Problem with empty CGI variables/Windows authentication in CF10/IIS 7.5 | Installation/Config |
3982328 | IIS not displaying content of OnMissingTemplate | Installation/Config |
3987369 | CGI.http_url encoding inconsistent with CF9 | Installation/Config |
4071931 | Same site is getting multiples times if we configure connector multiple times from command prompt in win 10 | Installation/Config |
4072189 | Unable to start colldfusion main instance server after hotfix upgrade to HF18 | Installation/Config |
3598342 | CFHTTP does not work with SNI enabled | SSL Net Protocols |
3980257 | http proxy authentication fail | Net Protocols |
3918758 | System Probe Failing because of csrftoken | Security |
3941059 | Incorrect behaviour of SerializeJSON() on strings that contain U+xxxx in CF10 Update 15 | Serialization |
4027176 | unable to invoke / Register web services | Web Services |
ColdFusion 11 update 7
Bug ID | Title | Product Area |
---|---|---|
3741324 | cfgrid with a boolean type gridcolumn, displaysdropdown listbox outside the confines of the grid control. | AJAX |
4034570 | Ehcache with CFQuery: not responsive and stops caching after Query Cache Size reached | Caching |
3982337 | cfinput is not working for some characters with HF5/HF 16 | CFForm |
3952949 | ColdFusion 11 CFPrint not printing portion of PDF generated by Adobe Central (jetForms) | CFPRINT |
3971083 | cfstoredproc - Last OUTPUT parameter - ColdFusion 11 Update 5 | Database |
4043047 | query of query WHERE filter no longer disregards filler spaces in fixed with data fields | Database |
3822982 | "Report Execution Times" is prohibitively slow on large apps | Debugging |
4031773 | PDFg services break with Update 5 | Document Management |
3982713 | Through Proxy authentication Hotfixes couldn't be downloaded with update 15 and later/CF 11 also | Hot Fix Installer |
3490112 | SEVERE: Error in getRealPathFromConn persists after Updating Coldfusion | Installation/Config |
3536673 | Problem with empty CGI variables/Windows authentication in CF10/IIS 7.5 | Installation/Config |
3982328 | IIS not displaying content of OnMissingTemplate | Installation/Config |
3980257 | http proxy authentication fail | Net Protocols |
3918758 | System Probe Failing because of csrftoken | Security |
3926238 | [ANeff] Bug for: breaks Admin API access | Security |
3941059 | Incorrect behaviour of SerializeJSON() on strings that contain U+xxxx in CF10 Update 15 | Serialization |
4027176 | unable to invoke / Register web services | Web Services |
The ColdFusion 10 update seemed to apply fine, but it took me about four goes for the ColdFusion 11 update to "take" on my CF11 Express install. This is par for the course with installing updates on Express, so that's nothing new.
Anyway... there you go... an opportunity to lab-test these updates and report any issues to Adobe.
Cheers Adobe for pre-releasing this!
Righto.
--
Adam
Saturday, 24 October 2015
RWC: quarters and a semi
G'day:
More "off topic" rugby shite here.
I meant to write something midweek about my experiences with the quarter finals weekend, and predict what would happen in the semis. Well one semi is done, and - spoiler alert - I'm glad this article is not entitled "FFS", and include only a link to the match report of South Africa beating New Zealand. Cos, thankfully, that didn't happen.
But let's wind back a week first.
Last weekend I promised myself a quiet Friday because I had a huge mission on Saturday. So I went to the pub and caught-up with a coupla mates I'd not seen for a bit, and downed a pint or two too many (I think it was six. I was aiming for 2-3). So Saturday started not with a hangover, but with a bit of a malaise. And I needed to meet my mate Lloyd and traipse up to the All Blacks v France quarter final in Cardiff. Anything involving Lloyd also involves a lot of beer. That said, if Lloyd was writing this, he'd be saying "anything involving Cameron...", so fair enough.
We met at the pub at Paddington and basically worked out how all the matches would go, except for the ABs v France once. It was cut and dried. And we had a single pint. Mine was named for NZ rugby hero Zinzan Brooke, and it was actually pretty good: Zinzan’s World Cup Drop (from Windsor & Eton Brewing).
I stuck to my guns and thought Wales could tough it ought against an ordinary South Africa, and no-one outside South Africa would ever will the Springboks to win anyhow. Then Ireland would clean-up a keen but under-qualified Argentina, and Aussie would sort out Scotland.
The train to Cardiff seemed to take an age, and our two-cans-each (me: Guinness-via-widget; Lloyd drinks lager) didn't last. A third covered the rest of the trip.
Cardiff cannot handle the number of people that were there. It had not earlier occurred to me that as well as the ABs v France match on Sat, Ireland was playing Argentina there on early Sunday afternoon as well. So the entire city was full of Kiwis, Frogs and Irish (and occasional but rare Argentine). Oh, and a few Welsh, but they were mostly in London for their own foray against South Africa.
All the pubs were absolutely full already (and I mean all the pubs), so we settled on a restaurant with a bar area, and - key - no TVs. Ergo no rugby mob. We got our pints and used ITV Player to stream the match on my phone (Nexus 5... OK screen but not great). We quickly accumulated four French fellas and a coupla Channel Islanders (supporting bloody France!!!) around our huddle. This is the good thing about rugby camaraderie, btw... the oppo is not the enemy; they're our mates. We had a great time with the lads (and one girl), watching Wales... not win... against South Africa. It got pretty close at a point, but Wales were outplayed and the best they could do was to get close to South Africa. 23 - 19.
So we knew that if the ABs beat France (big "if"), we'd have the Saffers the following week. First things first: we needed to sort-out the French.
We headed off to the ground, trying to find an intermediary pint with little luck. By the time we got in an served anywhere, we had to actually show up for the match. I ended up sneaking a pint out of the pub we got into (and served at after about 20min), only to be caught with it 10min later at the gate of the stadium. I abandoned it.
Our seats were close to the corner again (similar to the Namibia match), and not too bad. As it turned out we saw a lot of traffic down there in the second half. I've enjoyed being at Millennium Stadium in the past, but it was way too manic this time. The queues for beer were at least half an hour long, and... we didn't arrive with 30min spare. There's no way a sports stadium should have any more than a 10min queue for anything. Rugby with no beer. Hmmm.
62 - 13
Sixty-two to bloody thirteen. The All Blacks blew the bleu and the rouge off Les Tricolores, leaving only their traditional blanc on their flag. They're used to waving that standard. What a fricking monstering. We scored nine tries to their one. We destroyed them. I hasten to add that my fairly churlish reaction here is not epicaricacy, but relief. France have always been the team we fear. Not South Africa (in my era of watching rugby, anyhow), not Aussie, not England. France. This was the first time we had beaten them in a play-off match in the elimination stage of the World Cup. Sure we've beaten them twice in the final, but in '99 they thrashes us in the semi, and in 2007 they also sent us packing in the quarters.
More "off topic" rugby shite here.
I meant to write something midweek about my experiences with the quarter finals weekend, and predict what would happen in the semis. Well one semi is done, and - spoiler alert - I'm glad this article is not entitled "FFS", and include only a link to the match report of South Africa beating New Zealand. Cos, thankfully, that didn't happen.
But let's wind back a week first.
Last weekend I promised myself a quiet Friday because I had a huge mission on Saturday. So I went to the pub and caught-up with a coupla mates I'd not seen for a bit, and downed a pint or two too many (I think it was six. I was aiming for 2-3). So Saturday started not with a hangover, but with a bit of a malaise. And I needed to meet my mate Lloyd and traipse up to the All Blacks v France quarter final in Cardiff. Anything involving Lloyd also involves a lot of beer. That said, if Lloyd was writing this, he'd be saying "anything involving Cameron...", so fair enough.
We met at the pub at Paddington and basically worked out how all the matches would go, except for the ABs v France once. It was cut and dried. And we had a single pint. Mine was named for NZ rugby hero Zinzan Brooke, and it was actually pretty good: Zinzan’s World Cup Drop (from Windsor & Eton Brewing).
I stuck to my guns and thought Wales could tough it ought against an ordinary South Africa, and no-one outside South Africa would ever will the Springboks to win anyhow. Then Ireland would clean-up a keen but under-qualified Argentina, and Aussie would sort out Scotland.
The train to Cardiff seemed to take an age, and our two-cans-each (me: Guinness-via-widget; Lloyd drinks lager) didn't last. A third covered the rest of the trip.
Cardiff cannot handle the number of people that were there. It had not earlier occurred to me that as well as the ABs v France match on Sat, Ireland was playing Argentina there on early Sunday afternoon as well. So the entire city was full of Kiwis, Frogs and Irish (and occasional but rare Argentine). Oh, and a few Welsh, but they were mostly in London for their own foray against South Africa.
All the pubs were absolutely full already (and I mean all the pubs), so we settled on a restaurant with a bar area, and - key - no TVs. Ergo no rugby mob. We got our pints and used ITV Player to stream the match on my phone (Nexus 5... OK screen but not great). We quickly accumulated four French fellas and a coupla Channel Islanders (supporting bloody France!!!) around our huddle. This is the good thing about rugby camaraderie, btw... the oppo is not the enemy; they're our mates. We had a great time with the lads (and one girl), watching Wales... not win... against South Africa. It got pretty close at a point, but Wales were outplayed and the best they could do was to get close to South Africa. 23 - 19.
So we knew that if the ABs beat France (big "if"), we'd have the Saffers the following week. First things first: we needed to sort-out the French.
We headed off to the ground, trying to find an intermediary pint with little luck. By the time we got in an served anywhere, we had to actually show up for the match. I ended up sneaking a pint out of the pub we got into (and served at after about 20min), only to be caught with it 10min later at the gate of the stadium. I abandoned it.
Our seats were close to the corner again (similar to the Namibia match), and not too bad. As it turned out we saw a lot of traffic down there in the second half. I've enjoyed being at Millennium Stadium in the past, but it was way too manic this time. The queues for beer were at least half an hour long, and... we didn't arrive with 30min spare. There's no way a sports stadium should have any more than a 10min queue for anything. Rugby with no beer. Hmmm.
62 - 13
Sixty-two to bloody thirteen. The All Blacks blew the bleu and the rouge off Les Tricolores, leaving only their traditional blanc on their flag. They're used to waving that standard. What a fricking monstering. We scored nine tries to their one. We destroyed them. I hasten to add that my fairly churlish reaction here is not epicaricacy, but relief. France have always been the team we fear. Not South Africa (in my era of watching rugby, anyhow), not Aussie, not England. France. This was the first time we had beaten them in a play-off match in the elimination stage of the World Cup. Sure we've beaten them twice in the final, but in '99 they thrashes us in the semi, and in 2007 they also sent us packing in the quarters.
Friday, 23 October 2015
CFSummit 2015: see you there
G'day:
Call it a "fortunate turn of events" (or something), but it so transpires that I will be at CFSummit this year. No-one expected that. Including me. Still: there you go.
So who else is going? What presentations are you going to see?
I have a feeling I owe a number of people a beer (or Coke or whatever if you don't drink), and I will be more than happy to see as many people right as possible on that count. And I'm looking forward to it.
I have not looked at the schedule yet, but I'll do my "what I think I might go see (and why)" article over the weekend.
Cool.
--
Adam
Call it a "fortunate turn of events" (or something), but it so transpires that I will be at CFSummit this year. No-one expected that. Including me. Still: there you go.
So who else is going? What presentations are you going to see?
I have a feeling I owe a number of people a beer (or Coke or whatever if you don't drink), and I will be more than happy to see as many people right as possible on that count. And I'm looking forward to it.
I have not looked at the schedule yet, but I'll do my "what I think I might go see (and why)" article over the weekend.
Cool.
--
Adam
Labels:
CFSummit
ColdFusion 2016: it goes to show you should raise feature requests
G'day:
I'm still under NDA with the ColdFusion 2016 Prerelease Programme, so I need to be circumspect about what I say about CF2016, but once someone from Adobe has talked about something in public, I reckon I am allowed to at least refer back to that, and draw on public information to write some stuff.
Adobe showcased some ColdFusion 2016 features at CFCamp yesterday. It sounds like it was a good presentation, and was more dev-centric than has been the case in the past. Nice one, Rakshith.
A while back I raised this ticket on the bugbase: "?.: safe navigation operator". I gleaned this idea from trawling around other languages to see what they have on offer which might complement CFML. I wrote the results of this in my article "Thinking about operators in CFML".
Well I'm quite pleased that the safe-navigation operator has made its way into ColdFusion 2016.
Yay!
So what's this "safe navigation" thing?
It's an operator which takes two operands, and follows the following rules:
OK, say we have this:
We would get this:
To counter this, we'd need to write this lot:
That's quite a mouthful. And this is only with one chained operation. What if it was this:
And at any point in that, the result of one of the methods might be null? We'd need this:
Yikes.
So this is where the safe navigation operator comes in:
Much better.
I'm still under NDA with the ColdFusion 2016 Prerelease Programme, so I need to be circumspect about what I say about CF2016, but once someone from Adobe has talked about something in public, I reckon I am allowed to at least refer back to that, and draw on public information to write some stuff.
Adobe showcased some ColdFusion 2016 features at CFCamp yesterday. It sounds like it was a good presentation, and was more dev-centric than has been the case in the past. Nice one, Rakshith.
A while back I raised this ticket on the bugbase: "?.: safe navigation operator". I gleaned this idea from trawling around other languages to see what they have on offer which might complement CFML. I wrote the results of this in my article "Thinking about operators in CFML".
Well I'm quite pleased that the safe-navigation operator has made its way into ColdFusion 2016.
Yay!
<-
that's me being pleased. It doesn't happen often, so remember what it looks like for future ref.So what's this "safe navigation" thing?
It's an operator which takes two operands, and follows the following rules:
- if the first operand is null, it returns null;
- if the first operand is not null, it applies the second operand to it using the . operator.
OK, say we have this:
// safeNavigationExample.cfm
function getMaoriNumberById(id){
var numbers = ["tahi", "rua", "toru", "wha"];
if (id <= numbers.len()){
return numbers[id];
}
}
fiveInMaoriInUpperCase = getMaoriNumberById(5).ucase();
We would get this:
Value must be initialized before use. | |
Its possible that a method called on a Java object created by CreateObject returned null. | |
The error occurred in safeNavigationExample.cfm: line 10 | |
8 : } 9 : 10 : fiveInMaoriInUpperCase = getMaoriNumberById(5).ucase(); 11 : </cfscript> |
To counter this, we'd need to write this lot:
fiveInMaori = getMaoriNumberById(5);
if (!isNull(fiveInMaori)){
fiveInMaoriInUpperCase = fiveInMaori.ucase();
}else{
fiveInMaoriInUpperCase = javaCast("null", "");
}
That's quite a mouthful. And this is only with one chained operation. What if it was this:
result = new SomeObject().method1().method2().method3().method4();
And at any point in that, the result of one of the methods might be null? We'd need this:
someObject = SomeObject();
resultOfMethod1 = someObject.method1();
if (!isNull(resultOfMethod1)){
resultOfMethod2 = resultOfMethod1.method2();
if (!isNull(resultOfMethod2)){
resultOfMethod3 = resultOfMethod2.method3();
if (!isNull(resultOfMethod3)){
result = resultOfMethod3.method4();
}
}
}
if (!structKeyExists(variables, "result")){
result = javaCast("null", "");
}
Yikes.
So this is where the safe navigation operator comes in:
result = new SomeObject().method1()?.method2()?.method3()?.method4();
Much better.
Labels:
CFML,
ColdFusion 2016
Saturday, 17 October 2015
RWC: down to the pointy end of things
G'day:
In about an hour I'm heading off to Cardiff to watch something happen between the All Blacks and France. I have no idea what the result will be, as... well... France is a tricky prospect, and they seem to be playing OK so far in the RWC. NZ hasn't really had much of a chance to test their legs yet, other than that early unconvincing 26-16 victory over Argentina. The other pool games for NZ were perfunctory affairs, in which the ABs won, but not particularly spectacularly. I can only hope they are holding back. And unleashing today.
I don't get actually wound-up by much in this world, but this sums up my gut feeling at the moment:
It's been a bloody good World Cup so far - with some unexpected results (but, in all honesty: not that many) - and I hope the only "unexpected" result today is Wales beating South Africa. The Saffers are a bit ordinary this year, but Wales have had a lot of injuries and will need to play a blinder to match the opposition. Still: they could do it. I would really prefer to be playing Wales next week in the semis than the South Africans. Of course I'd prefer either of those to France being the ones to be taking one of those teams on. I shall not think about that.
Am pretty pleased that it's Wales playing South Africa and not England though. My sense of epicaricacy was well fed when England fell short against Wales, seemingly crushing their spirit in the process, meaning they really didn't show up against Aussie. Aussie look bloody good though.
I reckon the rest of the matches this weekend will go according to plan for the match favourites. So we'll see Ireland v Aussie in the other semi final. I dunno if Ireland can beat Aussie now: they've lost too many key players. And by that I mean Paul O'Connell really. I see Sexton is back in the starting XV for the Pumas match, which is good.
I'm still hoping for a NZ v Ireland final.
But we gotta get there first.
And I gotta get to Cardiff. Well: I need to get to the pub at Paddington to meet my mate before heading up there first...
[grimaces with anxiety]
--
Adam
In about an hour I'm heading off to Cardiff to watch something happen between the All Blacks and France. I have no idea what the result will be, as... well... France is a tricky prospect, and they seem to be playing OK so far in the RWC. NZ hasn't really had much of a chance to test their legs yet, other than that early unconvincing 26-16 victory over Argentina. The other pool games for NZ were perfunctory affairs, in which the ABs won, but not particularly spectacularly. I can only hope they are holding back. And unleashing today.
I don't get actually wound-up by much in this world, but this sums up my gut feeling at the moment:
Fuck fuck fuck fuck fuck fuck fuck fuck fuck fuck. Why do I do this to myself [heads to Cardiff wearing Black]
— Adam Cameron (@adam_cameron) October 17, 2015
It's been a bloody good World Cup so far - with some unexpected results (but, in all honesty: not that many) - and I hope the only "unexpected" result today is Wales beating South Africa. The Saffers are a bit ordinary this year, but Wales have had a lot of injuries and will need to play a blinder to match the opposition. Still: they could do it. I would really prefer to be playing Wales next week in the semis than the South Africans. Of course I'd prefer either of those to France being the ones to be taking one of those teams on. I shall not think about that.
Am pretty pleased that it's Wales playing South Africa and not England though. My sense of epicaricacy was well fed when England fell short against Wales, seemingly crushing their spirit in the process, meaning they really didn't show up against Aussie. Aussie look bloody good though.
I reckon the rest of the matches this weekend will go according to plan for the match favourites. So we'll see Ireland v Aussie in the other semi final. I dunno if Ireland can beat Aussie now: they've lost too many key players. And by that I mean Paul O'Connell really. I see Sexton is back in the starting XV for the Pumas match, which is good.
I'm still hoping for a NZ v Ireland final.
But we gotta get there first.
And I gotta get to Cardiff. Well: I need to get to the pub at Paddington to meet my mate before heading up there first...
[grimaces with anxiety]
--
Adam
Friday, 16 October 2015
Code puzzle: getting the next three elements of an array
G'day:
I've got 25min to write this, so it'll be a bit scrappy. There's an interesting question on Stack Overflow at the moment: "Get next three elements in a ColdFusion list". The basic premise is the user has a list of IDs, and - given one of the IDs in the list - wants to get back the next three IDs (or fewer if there aren't three left). Here are some test inputs and expectations:
I didn't want to answer that using lists because they're cack, so I set about answering with arrays instead. This is still relevant as the punter starts with an array anyhow, and is turning it into a list.
I was not happy with my first answer, which was this:
It works, but it has a loop in it and I didn't like that. It also has a shortcoming that it doesn't behave sensibly if
I continued to mull-over the problem and then remembered CFML has an
That works, but it's a lot of code for the task at hand. There must be a better way.
I wanted to use a
How would you do it? If you'd like to submit some code, do so in a gist (not inline in the comment), and feel free to use any language you like.
Cheers!
--
Adam
I've got 25min to write this, so it'll be a bit scrappy. There's an interesting question on Stack Overflow at the moment: "Get next three elements in a ColdFusion list". The basic premise is the user has a list of IDs, and - given one of the IDs in the list - wants to get back the next three IDs (or fewer if there aren't three left). Here are some test inputs and expectations:
IDs | ID | Count | Result |
---|---|---|---|
[7141,6881,5821,8001,7904,6601,7961,6021,4721] | 7141 | 3 | [6881,5821,8001] |
[7141,6881,5821] | 7141 | 3 | [6881,5821] |
[7141] | 7141 | 3 | [] |
[1111] | 9999 | 3 | [] |
I didn't want to answer that using lists because they're cack, so I set about answering with arrays instead. This is still relevant as the punter starts with an array anyhow, and is turning it into a list.
I was not happy with my first answer, which was this:
function nextIds(ids, id, count){
var thisIdIdx = ids.find(id);
var nextIds = [];
for (var i=thisIdIdx+1; i <= ids.len() && nextIds.len() < count; i++){
nextIds.append(ids[i]);
}
return nextIds;
}
It works, but it has a loop in it and I didn't like that. It also has a shortcoming that it doesn't behave sensibly if
id
is not present in ids
. I posted it anyhow.I continued to mull-over the problem and then remembered CFML has an
Array.slice()
method these days, so knocked together a variation using that instead:function nextIds(ids, id, count){
var thisIdIdx = ids.find(id);
var idsLen = ids.len();
if (thisIdIdx == 0 || thisIdIdx == idsLen){
return [];
}
return ids.slice(thisIdIdx+1, min(idsLen-thisIdIdx, count));
}
That works, but it's a lot of code for the task at hand. There must be a better way.
I wanted to use a
filter()
or a reduce()
or something, but couldn't come up with a clean way of doing it.How would you do it? If you'd like to submit some code, do so in a gist (not inline in the comment), and feel free to use any language you like.
Cheers!
--
Adam
Labels:
Code Puzzle
Wednesday, 14 October 2015
CFML: operator overloading
G'day:
A while back I posted my "What I'd like to see in ColdFusion 12 (redux, as is happens)" article, and I provided links to most of the tickets I raised for features to facilitate discussion and input from you lot.
One feature I mentioned in passing but forgot to add the link to was operator overloading. I did actually create the ticket, but I forgot to link to it. The ticket is 4013841.
Now I know a full-fledged operator overloading system would be quite an undertaking, and there's also been some industry push-back on the validity of having too comprehensive a system as it would compromise code clarity. EG: we know what
However this does not mean there aren't really good situations in which this sort of control might be useful.
Here's some examples I provided with the ticket:
Would allow:
Or another example is best demonstrated by PHP's ArrayAccess interface, which allows the definition of a few methods (
Or not even really operator overloading, but just extending built-in CFML processing by permitting a class to implement a
This is all useful, clear stuff. However Adobe have just fed-back with a fairly unthinking response:
This is pretty much the boilerplate response when a naesayer encounters a discussion about operator overloading. It kinda suggests to me that not a great deal of thought went into the reaction, but rather "he said operator overloading: use that stock response".
I did go on to point this out:
But maybe I should not have used the term "operator overloading" as this was only a part of what I was thinking of at the time. And, TBH, I kinda knew it would be a risky suggestion and likely to be dismissed in exactly the way it was.
What do you think? Ought I have taken a more piecemeal approach and suggested individual pieces of functionality which draw from this concept? I thought of that, but was slightly wary that the whole concept needs some thought, rather than just blting bits and pieces on. Dilemma.
Thoughts?
--
Adam
A while back I posted my "What I'd like to see in ColdFusion 12 (redux, as is happens)" article, and I provided links to most of the tickets I raised for features to facilitate discussion and input from you lot.
One feature I mentioned in passing but forgot to add the link to was operator overloading. I did actually create the ticket, but I forgot to link to it. The ticket is 4013841.
Now I know a full-fledged operator overloading system would be quite an undertaking, and there's also been some industry push-back on the validity of having too comprehensive a system as it would compromise code clarity. EG: we know what
2 * 3
means, but what does Apple * Banana
mean? Even if the object types of the operands could meaningfully be multiplied, it doesn't make for clear code.However this does not mean there aren't really good situations in which this sort of control might be useful.
Here's some examples I provided with the ticket:
// Person.cfc
component {
property dateOfBirth;
function compare(p1, p2){
return p1.dateOfBirth.compare(p2.dateOfBirth);
}
}
Would allow:
adam = new Person(createDate(1970,2,17));
zachary = new Person(createDate(2011,3,24));
if (adam > zachary){
writeOutput("Yay! Dad finally wins at something. Being old. Grumble.");
}
Or another example is best demonstrated by PHP's ArrayAccess interface, which allows the definition of a few methods (
offsetExists()
, offsetSet()
, offsetGet()
, offsetUnset()
) which then allows one to treat an object like an array, by overloading the behaviour of the []
syntax (not a true operator in this case). C# also allows for this sort of thing too (then again, C# allows for almost full operator overloading, as far as I recollect).Or not even really operator overloading, but just extending built-in CFML processing by permitting a class to implement a
toString()
method which is then used whenever an object reference is used where a String is expected, eg:// Person.cfc
component {
property dateOfBirth
function toString(){
return dateOfBirth.dateFormat("yyyy-mm-dd");
}
}
writeOutput(zachary); // 2011-03-24
This is all useful, clear stuff. However Adobe have just fed-back with a fairly unthinking response:
Operatore overloading is known to have its own issues because of which it is not supported in many languages.
This is pretty much the boilerplate response when a naesayer encounters a discussion about operator overloading. It kinda suggests to me that not a great deal of thought went into the reaction, but rather "he said operator overloading: use that stock response".
I did go on to point this out:
Well: out of the top ten programming languages (http://spectrum.ieee.org/)I think Adobe needs to spend some time thinking about what they can do to make the CFML language better - especially as they've spent so much time holding it back whilst other languages have passed it by. Using a stock answer of "operator overloading bad" it a bit leaden, IMO.
- Java - no
- C - no
- C++ - yes
- Python - yes
- C# - yes
- R - could not determine
- PHP - limited
- JavaScript - very limited
- Ruby - yes
- Matlab - yes
So more than 50% offer at least some operator overloading.
Another situation relevant language that supports this is Groovy (which is like what CFML could have become had it been stewarded properly).
[After some more investigation of languages that popped into my mind...] Rust does; Go doesn't. Swift does. Scala does. Erlang doesn't seem to (but could not find a definitive source), F# does. Clojure seems to allow it. Haskell seems to. Even blimin' Perl does!
[note: those are all the languages I checked. I did not cherry-pick which ones to check to fortify my position]
I think your observation is based on the position that Java took when it decided not to do operator overloading, which is rather out of date now. Things have moved on.
There are caveats to be considered when providing for operator overloading, but I don't think you are correct in writing them off as "known issues", and I think the knowledge you are basing this on is perhaps out of date, or just mired in "how Java decided to do things". CFML is a more dynamic and forward-thinking language than Java, so you should not let your Java background hold us back.
But maybe I should not have used the term "operator overloading" as this was only a part of what I was thinking of at the time. And, TBH, I kinda knew it would be a risky suggestion and likely to be dismissed in exactly the way it was.
What do you think? Ought I have taken a more piecemeal approach and suggested individual pieces of functionality which draw from this concept? I thought of that, but was slightly wary that the whole concept needs some thought, rather than just blting bits and pieces on. Dilemma.
Thoughts?
--
Adam
Labels:
CFML
Tuesday, 13 October 2015
Survey results: bug tracking software expectations
G'day:
This survey was so devoid of interest even I forgot about it! It took a bloody age for me to gather enough responses to bother writing up, but it seems to have maxed-out at 94 replies, so I'll run with that. Cheers to everyone who replied. And if you read this blog and did not fill it out: you suck. ;-)
As ever, I will preface this "analysis" with observing it's statistically meaningless because the sample size is too small, and is only really measuring the position of people a) reading this blog; b) likely to reply to a survey I create. That's pretty niche. However I got the answer I was after (yes, as I often do, I asked specific questions to demonstrate a specific point).
The questions were as follows:
I had lobbied Adobe to switch the way they list comments in their bug tracker (from last first so one needs to read them upside down), to first first ("Comments displayed in reverse order"). Like reading and writing usually work. Adobe have come back with:
This got me thinking... is my expectation actually as ubiquitous as I think it is? I am used to using Jira, and it lists the comments in reading order, not upside down order, and this is where I level my expectations. Not exactly scientific research there. Hence the survey (also not scientific research, but at least it's not just basing my position on my own person proclivities).
So what did other people think?
The responses were interesting. Not least of all because I had not even heard of a lot of the options. Some people put more than one option, and I've included them all (with how many votes each got, in parentheses).
One observation. Five of you said "None"? What sort of way of conducting your work is that? Blimey. Perhaps you don't actually code in a professional environment.
Oldest first: 57
Newest first: 32 (you're all weirdos ;-)
Other: 5
The "other" options were:
So the bulk of people - UX tweaks aside - prefer reading in chronological order. Not reverse chronological order. And I like the idea about being able to thread and re-sort the list too, so as to accommodate better discussion, and each person's ordering preference is preserved. Tell me though, people who suggested threadability... how would you expect the re-sort toggle to work within a thread which has more than one comment at the same level? Would that re-sort too? That seem weird to me.
This survey was so devoid of interest even I forgot about it! It took a bloody age for me to gather enough responses to bother writing up, but it seems to have maxed-out at 94 replies, so I'll run with that. Cheers to everyone who replied. And if you read this blog and did not fill it out: you suck. ;-)
As ever, I will preface this "analysis" with observing it's statistically meaningless because the sample size is too small, and is only really measuring the position of people a) reading this blog; b) likely to reply to a survey I create. That's pretty niche. However I got the answer I was after (yes, as I often do, I asked specific questions to demonstrate a specific point).
The questions were as follows:
- What bug tracking software do you use?
- When reading comments that have been added to an issue, in which order would you expect them to be listed?
- When voting for an issue would you prefer (out of the listed options)
- How important to you is it to be able to (perform a list of common bug-tracking tasks)
- If you are a user of the Adobe ColdFusion bug tracker, what are your thoughts on it?
I had lobbied Adobe to switch the way they list comments in their bug tracker (from last first so one needs to read them upside down), to first first ("Comments displayed in reverse order"). Like reading and writing usually work. Adobe have come back with:
Currently the logic behind showing the notes in reverse (latest at top) is that:This is actually very good feedback from Kapil, and he is definitely one of the good 'uns at Adobe (like Anit). I don't agree with what he's saying, but it's a well-reasoned and well-articulated case. If it was one of the ColdFusion Team members, I'd expect this ticket to be closed "NotABug/ByDesign" without further comment. So cheers for the feedback Kapil.
- If user wants to go through the comment history they can go all the way to bottom, keep reading notes one by one (could be hard if any note is really huge) upwards. Once gone through all, they reach the point where they can add their comments in the note box.
- If user wants to read latest comment and respond to it, it's right in the top next to the box where new note can be added.
If we change the order then it would only make sense to move "add new note" box also to the bottom which may be confusing as the landing view will not show this box and user may think there's no way to add new comment.
I still believe the way it is shown (if we don't change design of page) is right.
Let me know if you still feel it should be other way around.
This got me thinking... is my expectation actually as ubiquitous as I think it is? I am used to using Jira, and it lists the comments in reading order, not upside down order, and this is where I level my expectations. Not exactly scientific research there. Hence the survey (also not scientific research, but at least it's not just basing my position on my own person proclivities).
So what did other people think?
Q1: What bug tracking software do you use?
The sole "hard-coded" option I offered was "Jira". I was aware of a few others, but didn't know if people took them seriously: Bugzilla, FogzBugz (or whateverTF it is), Trac (chortle: I feel sorry for you if you are stuck with that). It did not occur to me to list GitHub, which would have been another sensible option. Still: I had an "other" option for you to DIY.The responses were interesting. Not least of all because I had not even heard of a lot of the options. Some people put more than one option, and I've included them all (with how many votes each got, in parentheses).
- Jira (48)
- GitHub (7)
- None (5)
- assembla (3)
- Bugzilla (3)
- Redmine (3)
- FogBugz (3)
- In-house solution (3)
- YouTrack (3)
- Bitbucket (2)
- Mantis (2)
- Rally (2)
- Trello (2)
- Asana
- BugBase (what, the Adobe one? I cannot find anything else called this)
- BugLogHQ
- CA Service Desk Manager
- gforge.com
- GitLab
- HP ALM
- Issue ticket (I dunno what this is)
- LANDESK (why so shouty?)
- Lighthouse
- Microsoft OneNote
- OnTime
- Remedy
- Spiceworks
- TestTrack
- unfuddle
One observation. Five of you said "None"? What sort of way of conducting your work is that? Blimey. Perhaps you don't actually code in a professional environment.
Q2: When reading comments that have been added to an issue, in which order would you expect them to be listed?
Oldest first: 57
Newest first: 32 (you're all weirdos ;-)
Other: 5
The "other" options were:
I'm fine either way. If Bugbase becomes oldest-first, it's cool by me. I also now query my local copy of the Bugbase.Oh I do so love people who sit on the fence. You have no preference for which order you like to read things? None? I'm surprised by that.
I actually prefer interfaces that thread comments, from oldest to newest.Good call! I didn't think about threading as an option. Do some issue trackers out there permit this? But - bottom line - this is a vote for reading top-to-bottom.
I like the idea of being able to see the most recent comment first, but if reading through a substantial list of comments, oldest first (chronological order) makes more sense to me.So - if I'm getting you right - you don't care if there's not much to read, but once it because an exercise in reading, then it becomes an issue to deal with, and you prefer top to bottom. That's a good pragmatic way of looking at it.
Newest first. Best if done in a threaded fashion. Also sortable by dateGood idea regarding being able to toggle the ordering.
Configurable at RunTimeThis does not really answer the question. The answer would be based on when you see a list of comments in (some order), then which order would you use the toggling to order them in.
So the bulk of people - UX tweaks aside - prefer reading in chronological order. Not reverse chronological order. And I like the idea about being able to thread and re-sort the list too, so as to accommodate better discussion, and each person's ordering preference is preserved. Tell me though, people who suggested threadability... how would you expect the re-sort toggle to work within a thread which has more than one comment at the same level? Would that re-sort too? That seem weird to me.
Wednesday, 7 October 2015
Survey: getting responses is like pulling teeth
G'day:
(Well: mostly for just this survey). A few days back I posted about "Survey: bug tracking software UX expectations" (direct link: https://www.surveymonkey.com/r/LJDXRNB).
It's still languishing on on 47 responses, which is a bit pox.
So if you haven't answer me five questions, wanna do so? Cheers.
Righto.
--
Adam
(Well: mostly for just this survey). A few days back I posted about "Survey: bug tracking software UX expectations" (direct link: https://www.surveymonkey.com/r/LJDXRNB).
It's still languishing on on 47 responses, which is a bit pox.
So if you haven't answer me five questions, wanna do so? Cheers.
Righto.
--
Adam
Labels:
Survey
Monday, 5 October 2015
Survey results: Jared's CFML text editor usage survey
G'day:
I've got Jared doing the donkey for for me today. Here's his article on the results of the CFML IDE survey he ran last week:
I've got Jared doing the donkey for for me today. Here's his article on the results of the CFML IDE survey he ran last week:
First of all, may I say thank you to Adam Cameron for hosting this post. I've been a ColdFusion developer for too long a time now, and it's only because of people like Adam Cameron and others, that I feel there is a community behind this language.
I have to thank everyone who participated in the survey, 132 of you in about 2 days. That's pretty good going in my opinion. Sadly, those 32 extra responses won't be counted as I have not paid for more than 100 responses. Thank you for your input though.
I wanted to get a sense of what the community were using for their main development purposes. Myself? I started off on Dreamweaver, moved to Eclipse with CfEclipse and about 2 years ago switched to Sublime with community made CF Support. My theory was that many have gone down this path, they started with a heavy IDE and either found their environments were never properly setup to use it, or that they were far too beastly for what they were doing.
As much as I like IDE's, the environment really has to be setup for it to be useful, mine never were, our servers didn't support step debugging, so switching to a lightweight Advanced Text Editor that has allowed the extensibility to be used much in the same way as an IDE made complete sense.
I should say that an Advanced Text Editor is normally a very light weight program that will contain different types of language support for highlighting and closing of brackets and such, but with a plugin extensibility that allows for things like linters. They don't normally allow for debugging unless the community have gone completely out of their way to add it.
With my theory, I wanted to find out if the community was still using IDE's. Adobe and the CF team have invested a lot into ColdFusion Builder. Personally I think we've moved on past these heavyweight tools… Adobe have been investing in their open source community project Brackets. This already has a lot of support for many languages, but none for ColdFusion. I've argued in the Slack channels that I would prefer Adobe to focus development on, or at least put some first class support into, projects like Brackets over ColdFusion Builder. Many have argued against me, claiming there is still a want and need for ColdFusion Builder.
This survey was far from perfect, as some (Adam…) of you pointed out. Yes it was slightly Yoda-ish, maybe I should have used checkboxes instead of Radio Buttons… But I think it gives a first attempt to find out what the community is using day to day. So let's take a look at the results from the first question.
For the first question, I asked: For general purpose development, including ColdFusion, I use as my IDE?
With this, I was trying to get a sense of what people are using for general purpose development. As the world has moved on, platform specific developers have found themselves become more general purpose developers, not to say Jack of all, Master of none… but that most ColdFusion developers will now be Web Developers, expected to write at least JavaScript and HTML if not some other random language as people find themselves in DevOps roles. Keep in mind that 32 results are missing from these responses.
From these responses, we can see that overwhelmingly, Advanced Text Editors are being used for general purpose development (with a ColdFusion edge). Sublime Text appears to be the community favourite, which I can understand as it has a well supported and developed ecosystem of plugins. 21 of you are using IDE's (Dreamweaver, ColdFusion Builder, Eclipse and Eclipse with CFEclipse) which isn't surprising, ColdFusion is still a Enterprise Language, with Enterprise Pricing, so the features offered by these make sense.
There was one IDE that I had forgotten about: IntelliJ iDEA, you made it well known by telling me in the "Other" choice. With the responses from there, IDE's are still behind their more lightweight counterparts.
Labels:
guest author,
Jared Evans,
Survey
Friday, 2 October 2015
CFML: nice work Pete (cfdocs.org)
G'day:
What a productive lunchtime I've had today. Well: blog-wise.
This is timely. Adobe have messed the ColdFusion community around yet again by moving the docs site to a read-only affair, and one that gives a security warning whenever one clicks through from Google.
Pete Freitag has stepped up and is more actively trying to engage the community in helping maintain cfdocs.org: he's gamified it! He's added a leaderboard to the home page:
And also good on that rogue's gallery for helping out & giving back to the community.
I think perhaps it might be an idea for the ColdFusion community to vote with its feet and use cfdocs.org as our home base for CFML doc references.
Right. Back to work for me.
--
Adam
What a productive lunchtime I've had today. Well: blog-wise.
This is timely. Adobe have messed the ColdFusion community around yet again by moving the docs site to a read-only affair, and one that gives a security warning whenever one clicks through from Google.
Pete Freitag has stepped up and is more actively trying to engage the community in helping maintain cfdocs.org: he's gamified it! He's added a leaderboard to the home page:
And also good on that rogue's gallery for helping out & giving back to the community.
I think perhaps it might be an idea for the ColdFusion community to vote with its feet and use cfdocs.org as our home base for CFML doc references.
Right. Back to work for me.
--
Adam
Labels:
Documentation
PHP: a quick question about creating generic objects
G'day:
I Twittered this yesterday, but I got no response. Here's a quick PHP question. I need to group some properties together in a throwaway object. It would be overkill to create a class for it, and I don't like the idea of using arrays to collect key/value pair data together (even though this is a ubiquitous practice in PHP... it just seems wrong to me).
So I have two options:
or:
I like using literals where I can, so I erred towards the former. Plus it's nicely only one statement. However after discussion with the guys here who actually know PHP, they felt happier with the latter. I changed my code.
Doing some reading, the impression I get is stdClass (nce nm, btw, PHP. ? t/ nd to use t/ abbrev thre?) is something that exists to facilitate stuff like JSON deserialisation or other functionality which needs to create an object, but not of a specific type. I'm not so sure the intent is to actually explicitly create stdClass objects? But I dunno, and I only googled for a few minutes.
Anyway, what do you think? I'm interested to hear if people have a well-formed opinion either way, or whether it's "yeah, it doesn't really matter".
Cheers.
--
Adam
BTW: that was "nice name, by the way, PHP. Why the need to use the abbreviation there?"
I Twittered this yesterday, but I got no response. Here's a quick PHP question. I need to group some properties together in a throwaway object. It would be overkill to create a class for it, and I don't like the idea of using arrays to collect key/value pair data together (even though this is a ubiquitous practice in PHP... it just seems wrong to me).
So I have two options:
$mySimpleObj = (object)['foo'=>'bar'];
or:
$mySimpleObj = new stdClass();
$mySimpleObj->foo = 'bar';
I like using literals where I can, so I erred towards the former. Plus it's nicely only one statement. However after discussion with the guys here who actually know PHP, they felt happier with the latter. I changed my code.
Doing some reading, the impression I get is stdClass (nce nm, btw, PHP. ? t/ nd to use t/ abbrev thre?) is something that exists to facilitate stuff like JSON deserialisation or other functionality which needs to create an object, but not of a specific type. I'm not so sure the intent is to actually explicitly create stdClass objects? But I dunno, and I only googled for a few minutes.
Anyway, what do you think? I'm interested to hear if people have a well-formed opinion either way, or whether it's "yeah, it doesn't really matter".
Cheers.
--
Adam
BTW: that was "nice name, by the way, PHP. Why the need to use the abbreviation there?"
Labels:
PHP
PHP 7: anonymous classes
G'day:
I thought it was high time I wrote an article with some code in it. Also one of my (now former ) colleagues - Cisco - asked me to write about this, so here I am.
Another new feature of PHP 7 (see the rest of my bumpf on PHP 7) is the ability to create anonymous classes. An anonymous class is to a named class what a closure (or anonymous function, or function expression) is to a named function. Well it kinda is. Only kinda cos I think they've ballsed-up their implementation.
Here's an example of an anonymous class in action:
Here I use an anonymous class to create an object which is initialised with a property $x with a value of 17, and I then call a method to multiply that by 19. The output is predictable:
This is all well and good, but an anonymous class should create a class, not an object. Obviously here it's creating the class inline, and then creating a new object out of it straight away. But what if I want to use this class again? I should be able to create just the class as a variable:
This should work. Here I'm declaring the class via the anonymous class expression, and then calling new on that class. However this just errors:
I have monkeyed as much as I can with the syntax, but I cannot get an anonymous class expression to actually return a class.
Let's think about this for a second, and here's an equivalent example with a function expression to contrast:
Here I look at both a function declared via a function statement, and another declared via a function expression. In both cases, they return a callable (ie: a function):
I thought it was high time I wrote an article with some code in it. Also one of my (now former ) colleagues - Cisco - asked me to write about this, so here I am.
Another new feature of PHP 7 (see the rest of my bumpf on PHP 7) is the ability to create anonymous classes. An anonymous class is to a named class what a closure (or anonymous function, or function expression) is to a named function. Well it kinda is. Only kinda cos I think they've ballsed-up their implementation.
Here's an example of an anonymous class in action:
// inline.php
$o = new class(17) {
private $x;
function __construct($x){
$this->x = $x;
}
function multiply($y){
return $this->x * $y;
}
};
$result = $o->multiply(19);
echo $result;
Here I use an anonymous class to create an object which is initialised with a property $x with a value of 17, and I then call a method to multiply that by 19. The output is predictable:
>php inline.php
323
>
323
>
This is all well and good, but an anonymous class should create a class, not an object. Obviously here it's creating the class inline, and then creating a new object out of it straight away. But what if I want to use this class again? I should be able to create just the class as a variable:
// classObject.php
$c = class {
private $x;
function __construct($x){
$this->x = $x;
}
function multiply($y){
return $this->x * $y;
}
};
$o = new $c(17);
$result = $o->multiply(19);
echo $result;
This should work. Here I'm declaring the class via the anonymous class expression, and then calling new on that class. However this just errors:
>php classObject.php
PHP Parse error: syntax error, unexpected 'class' (T_CLASS) in classObject.php on line 4
Parse error: syntax error, unexpected 'class' (T_CLASS) in classObject.php on line 4
>
PHP Parse error: syntax error, unexpected 'class' (T_CLASS) in classObject.php on line 4
Parse error: syntax error, unexpected 'class' (T_CLASS) in classObject.php on line 4
>
I have monkeyed as much as I can with the syntax, but I cannot get an anonymous class expression to actually return a class.
Let's think about this for a second, and here's an equivalent example with a function expression to contrast:
// functionExpressionType.php
function add($x, $y){
return $x + $y;
}
$addFunctionName = 'add';
printf('is_callable(add): %d%s', is_callable($addFunctionName), PHP_EOL);
$multiply = function($x, $y){
return $x * $y;
};
printf('is_callable($multiply): %d%s', is_callable($multiply), PHP_EOL);
Here I look at both a function declared via a function statement, and another declared via a function expression. In both cases, they return a callable (ie: a function):
>php functionExpressionType.php
is_callable(add): 1
is_callable($multiply): 1
>
is_callable(add): 1
is_callable($multiply): 1
>
Labels:
Francesco Allara,
PHP,
PHP 7
Bleahck
G'day:
Yeah, NZ colours or no: I was getting sick of that bloody black colour scheme, so I've got rid.
I know at least Dan Skaggs will be pleased about this ;-)
I also fixed up the missing JS I had not realised had gone west at some point, which had broken my code annotations.
And now back to this PHP article I'm trying to write.
Righto.
--
Adam
Yeah, NZ colours or no: I was getting sick of that bloody black colour scheme, so I've got rid.
I know at least Dan Skaggs will be pleased about this ;-)
I also fixed up the missing JS I had not realised had gone west at some point, which had broken my code annotations.
And now back to this PHP article I'm trying to write.
Righto.
--
Adam
Labels:
Blog
Thursday, 1 October 2015
ColdFusion: language-centric stuff flagged for fixing (for ColdFusion 2016?)
G'day:
Adobe have claimed that ColdFusion 2016 will be a developer-centric exercise, which makes a pleasing change from the PHB-oriented CF11 (well: that can be the only basis for <cfclient> to ever have been considered... some muppet from Adobe polling PBHs for what they want in ColdFusion).
Obviously Adobe are never directly forthcoming as to what's going to go into the next version of ColdFusion, but one can make some inferences from status changes in the bug tracker. There are currently 241 open enhancement requests specifically flagged as "language", and also flagged as "to fix". Obviously there's no promise that 100% of these will go into ColdFusion 2016, but generally stuff they can't be arsed dealing with gets closed with some variation of "nuh-uh" as the closure reason. So perhaps we can think of this list as the target for 2016. Even if they only did half of it, it'll be pretty excellent:
Adobe have claimed that ColdFusion 2016 will be a developer-centric exercise, which makes a pleasing change from the PHB-oriented CF11 (well: that can be the only basis for <cfclient> to ever have been considered... some muppet from Adobe polling PBHs for what they want in ColdFusion).
Obviously Adobe are never directly forthcoming as to what's going to go into the next version of ColdFusion, but one can make some inferences from status changes in the bug tracker. There are currently 241 open enhancement requests specifically flagged as "language", and also flagged as "to fix". Obviously there's no promise that 100% of these will go into ColdFusion 2016, but generally stuff they can't be arsed dealing with gets closed with some variation of "nuh-uh" as the closure reason. So perhaps we can think of this list as the target for 2016. Even if they only did half of it, it'll be pretty excellent:
Labels:
ColdFusion 2016
Another survey (not by me this time) about text editor usage when CFML coding
G'day:
More radio buttons for you to click! This time my mate Jared Evans wants to know what manner of app you tend to use for doing your coding (with a CFML bent to it). The survey is here: https://www.surveymonkey.com/r/8X3TMLP. It's nice and short (three questions, from memory), so shouldn't take you long. Get in there.
I'm not sure how Jared will circulate the results, but will let you know when I find out.
Oh, and don't forget to do my one on error tracking system UX, as detailed yesterday: "Survey: bug tracking software UX expectations" (survey link: https://www.surveymonkey.com/r/LJDXRNB).
Righto.
--
Adam
More radio buttons for you to click! This time my mate Jared Evans wants to know what manner of app you tend to use for doing your coding (with a CFML bent to it). The survey is here: https://www.surveymonkey.com/r/8X3TMLP. It's nice and short (three questions, from memory), so shouldn't take you long. Get in there.
I'm not sure how Jared will circulate the results, but will let you know when I find out.
Oh, and don't forget to do my one on error tracking system UX, as detailed yesterday: "Survey: bug tracking software UX expectations" (survey link: https://www.surveymonkey.com/r/LJDXRNB).
Righto.
--
Adam
Labels:
Survey
Subscribe to:
Posts (Atom)