Label must be a simple identifier?? Flash/Flex Builder - syntax

I have this code:
public function chooseCategoryDDL_changeHandler(event:IndexChangeEvent):void {
var para:Object = new Object();
para.action = "changecategoryxml";
para.book_class = event:IndexChangeEvent.book_class;
if (event.IndexChangeEvent > -1 ) {
changeCategory.send(para);
}
I keep getting the error message that, 'Label must be a simple identifier'. Ideally, i'm wanting to write the code to state:
... para.book_class = event.selectedItem.book_class;
if (event.selectedItem > -1 ) {
changeCategory.send(para);
}
Though, when I try and use the selectedItem syntax, it gives me an 'Access to undefined property selectedItem'. I'm really tearing my hair out about this and it's been bugging me for ages. If anyone can please shed any light on this I will be eternally grateful :)
Thanks

I had the same error from a dumb typo : some line was terminated by ':' instead of ';'
For the visually impaired (like me), that's colon instead of semicolon.

I didn't really read this, but the syntax of this line looks invalid:
para.book_class = event:IndexChangeEvent.book_class;
Use a dot maybe?
para.book_class = event.IndexChangeEvent.book_class;

Related

if query returning a return error laravel

I need some help with this query, I don't understand why am I getting this error "Parse error: syntax error, unexpected 'return'(T_RETURN)" even though my previous line was working. I checked on other question similar to this error and see if I have similar mistake but I don't think so, I even double checked to see if I am missing any bracket in my query. Can someone please help me? Thanks a lot.
This part of the code work, "if(count($data)>0){" but when I changed to this it doesn't work anymore " if (hire::where('hire_status','Yes'->count($data) > 0){"
Controller:
public function getHire(){
$data['data'] = DB::table('personal_infos')->where('deleted_at',NULL)->get()->sortByDesc('created_at');
if (hire::where('hire_status','Yes'->count($data) > 0){
// if(count($data)>0){
return view('hire',$data);
}else{
return view('hire');
}
Missing closing parenthesis ).
if (hire::where('hire_status','Yes'->count($data) > 0){
if (hire::where('hire_status', 'Yes')->count($data) > 0) {

Typescript 1.4: Arrow function without curly braces, syntax changed?

I am following some tutorials that says you can do this
module testme {
var testmeA = function(num) => num * num;
}
but i am getting an error on the => saying { missing. In the tutorial the above works.
After sometime playing around I got the following to work
var testmeA = (num: number) => {return num*num};
So you will notice i was "forced" to remove the function keyword, although the tutorial says you can but you are not forced to do and i was forced to add curly brakets after the =>
I was hoping for some insight to understand if I am doing something wrong or the syntax has changed ?
If the syntax has changed, where is the change documented ?
The version I am using is
➜ ~ tsc -v
message TS6029: Version 1.4.1.0
Thanks in advance
Remove only the function keyword:
var testmeA = (num: number) => num * num;

typo3 extension formhandler pregmatch

I am trying to validate a iban no for germany, but I cannot get pregMatch to work with formhandler. I cannot find a mistake and compared it with the formhandler documentation, but nothing helped. Maybe somebody has a hint for me.
This is my code:
debitiban.errorCheck {
1 = pregMatch
1.value = ^DE\d{2}\s?([0-9a-zA-Z]{4}\s?){4}[0-9a-zA-Z]{2}$
}
The value is directly passed on to PHPs preg_match function, so it has to be a valid PCRE regex pattern. You are missing a delimiter charater in your expression. Try to surround the expression by slashes:
debitiban.errorCheck {
1 = pregMatch
1.value = /^DE\d{2}\s?([0-9a-zA-Z]{4}\s?){4}[0-9a-zA-Z]{2}$/
}

How to get part of string after some word with Ruby?

I have a string containing a path:
/var/www/project/data/path/to/file.mp3
I need to get the substring starting with '/data' and delete all before it. So, I need to get only /data/path/to/file.mp3.
What would be the fastest solution?
'/var/www/project/data/path/to/file.mp3'.match(/\/data.*/)[0]
=> "/data/path/to/file.mp3"
could be as easy as:
string = '/var/www/project/data/path/to/file.mp3'
path = string[/\/data.*/]
puts path
=> /data/path/to/file.mp3
Using regular expression is a good way. Though I am not familiar with ruby, I think ruby should have some function like "substring()"(maybe another name in ruby).
Here is a demo by using javascript:
var str = "/var/www/project/data/path/to/file.mp3";
var startIndex = str.indexOf("/data");
var result = str.substring(startIndex );
And the link on jsfiddle demo
I think the code in ruby is similar, you can check the documentation. Hope it's helpful.
Please try this:
"/var/www/project/data/path/to/file.mp3".scan(/\/var\/www(\/.+)*/)
It should return you all occurrences.

Replace with use of regular expression result

Let's say I've got some text with a couple tags like this:
[twitter:jpunt]
I want to replace those into something like this:
#Jpunt
How could I do this in Ruby? I've been researching regular expressions for a couple of hours, just with a lot of frustration as a result. Anyone?
This should do the job:
initial = "[twitter:jpunt]"
link = initial.gsub(/\[twitter:(\w+)\]/i, '#\1')
It is one line code (click here to test this code) >>
output = input.gsub(/\[([^:]+):([^\]]+)\]/) {
'#' + $2.capitalize + '' }
The above code works with any tag name. If you want just twitter to be allowed, then go with modification:
output = input.gsub(/\[twitter:([^\]]+)\]/) {
'#' + $1.capitalize + '' }

Resources