I have this code in codeigniter to redirect older browsers to the upgrade page. It works in every browser except Safari, where a user with version 5.1 can view the site. Any ideas what is different with this one?
Thanks
$this->load->library('user_agent');
if (($this->agent->browser() == 'Internet Explorer' and $this->agent->version() <= 9) or ($this->agent->browser() == 'Firefox' and $this->agent->version() <= 24) or ($this->agent->browser() == 'Chrome' and $this->agent->version() <= 23) or ($this->agent->browser() == 'Safari' and $this->agent->version() <= 6) or ($this->agent->browser() == 'Opera' and $this->agent->version() <= 12.1) ){
redirect('/app/upgrade');
}
I got it to work. All I did was change the 6, to '6' (wrapped in single quotes), and it worked.
Related
I have created one POPUP in Oracle Forms (Custom PLL - Oracle EBS R12)
fnd_message.set_name ('XX', 'CASCADE_SHIPPING_METHOD');
-- fnd_message.show;
n_button_selection :=
fnd_message.question ('Yes',
'No',
'',
1,
2,
3);
IF n_button_selection = 1
THEN
Procedure1();
ELSIF n_button_selection = 2
THEN
Procedure2();
ELSE
NULL;
END IF;
This code is working fine But, If the User CLOSE the form(by clicking the 'X' mark), then ELSIF condition is executed and calling the procedure2. I expect the control goes to ELSE and do nothing.
Kindly help.
I modified the code as
fnd_message.set_name ('XX', 'CASCADE_SHIPPING_METHOD');
n_button_selection :=
fnd_message.question ('Yes',
'No',
'Cancel',
1,
2,
3);
--If user select "Yes" option to cascade, then enter inside if and call the proc to cascade
IF n_button_selection = 1
THEN
MESSAGE('Pressed Yes-For Lines Cascading');
shipping_method (l_header_id,
ship_method,
'Lines');
ELSIF n_button_selection = 2
THEN
MESSAGE('Pressed No-For Header Cascading');
shipping_method (l_header_id,
ship_method,
'Header');
ELSE
MESSAGE('Inside ELSE Condition');
NULL;
END IF;
but still If I close the form the control Goes to Button Selection 2 that is ELSIF.
Try this:
fnd_message.set_name ('XX', 'CASCADE_SHIPPING_METHOD');
-- fnd_message.show;
n_button_selection :=
fnd_message.question ('Yes',
'No',
'Cancle',
1,
3);
IF n_button_selection = 1
THEN
Procedure1();
ELSIF n_button_selection = 2
THEN
Procedure2();
ELSE
NULL;
END IF;
I am learning Ruby with Rubymonk.com
Below is the project description:
Hiring Programmers - Boolean Expressions in Ruby
Let us say you are trying to recruit team-members for your new startup! Given a candidate, you need an expression that will tell you whether they fit into certain types. This is how a candidate object would look:
candidate.years_of_experience = 4
candidate.github_points = 293
candidate.languages_worked_with = ['C', 'Ruby', 'Python', 'Clojure']
candidate.applied_recently? = false
candidate.age = 26
We are looking to hire experienced Ruby programmers. Our ideal candidate has 2 or more years of experience, but some programmers become really good even before that. We'll consider their Github points (a nice indicator of a good programmer), and even if they are not experienced, candidates with 500 Github points or more can apply. And there is one more catch: Ruby being a cool and awesome language, a lot of smart youngsters are very good at it. We love those kids, but for this particular job we'd rather have them study at school than work. Let us filter out candidates who are younger than 15. Also we don't want to consider candidates who applied recently for this opening.
Base on above description, I conclude that items listed below must be true:
candidate.languages_worked_with.include?('Ruby')
candidate.years_of_exprience >= 2 || candidate.github_points >= 500
candidate.age > 15
candidate.applied_recently? == false
And my answer is:
is_an_experienced_programmer = (candidate.years_of_exprience >= 2
|| candidate.github_points >= 500) && candidate.languages_worked_with.include? 'Ruby'
&& (candidate.age > 15) && !(candidate.applied_recently?)
but then answer is:
is_an_experienced_ruby_programmer = (candidate.years_of_experience >= 2
|| candidate.github_points >= 500) && (candidate.languages_worked_with.include? 'Ruby')
&& ! (candidate.age < 15 || candidate.applied_recently?)
The only difference between my answer and the answer is:
(candidate.age > 15) && !(candidate.applied_recently?)
above saying candidate must older than 15 and haven't applied recently.
and the answer:
! (candidate.age < 15 || candidate.applied_recently?)
above code basically saying, candidate can not younger than 15 and haven't applied recently.
Aren't they the same? Or something flawed in my logic?
Its almost same only thing you are missing is >=
(candidate.age >= 15) && !(candidate_applied_recently?)
and that's why you might be getting the wrong answer.
Hope it helps.
I conclude that there is something wrong in the Testing Logic with the project on RubyMonk:
When I use the code below, I passed the test:
is_an_experienced_ruby_programmer = (candidate.years_of_experience >= 2 || candidate.github_points >= 500) && (candidate.languages_worked_with.include? 'Ruby') && !candidate.applied_recently? && (candidate.age > 15)
And when I use below, I failed the test:
is_an_experienced_programmer = (candidate.years_of_exprience >= 2 || candidate.github_points >= 500) && (candidate.languages_worked_with.include? 'Ruby') && (candidate.age > 15) && !(candidate.applied_recently?)
So
!(candidate.applied_recently?) && (candidate.age > 15)
is different to
(candidate.age > 15) && !(candidate.applied_recently?)
in Rubymonk's mind?
I have found this old piece of code, which seems to work just perfectly in Magento 1.6.2.
My problem is, that it is not showing the value with Tax, and it's showing the value as ex. 60.0000
Would it somehow be possible to get it to show with tax and as a currency?
Or maby just somehow (I've already tried this with no luck, no matter how I put together the if statement..) build an if statement so that if it's 60.000 then it will echo 75$ ?
$totals = Mage::getModel('checkout/session')->getQuote()->getTotals();
if(isset($totals['shipping']))
print $totals['shipping']->getData('value');
To get your cart total (assuming that the customer is log in or enter the shipping info)
$cart = Mage::getModel('checkout/session')->getQuote();
echo Mage::helper('core')->currency($cart->getGrandTotal(),true,false);
To get Shipping amount
$shippingMethod = $cart->getShippingAddress();
echo Mage::helper('core')->currency($shippingMethod['shipping_amount'],true,false);
Source http://www.magentocommerce.com/boards/viewthread/278544/
I made this crude solution, it's ugly, but it's working, if there's any suggestions to minimize this then please come with suggestions :) .
<?php $fragt = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingAmount();
if (($fragt >= 0) && ($fragt <= 60))
echo $this->__('Fragt: 75 DKK ');
else
if (($fragt >= 75) && ($fragt <= 78))
echo $this->__('Fragt: 95 DKK ');
else
if (($fragt >= 79) && ($fragt <= 99))
echo $this->__('Fragt: 100 DKK ');
else
if (($fragt >= 100) && ($fragt <= 110))
echo $this->__('Fragt: 120 DKK ');
else
if (($fragt >= 120) && ($fragt <= 151))
echo $this->__('Fragt: 150 DKK ');
else
if (($fragt >= 200) && ($fragt <= 301))
echo $this->__('Fragt: 300 DKK ');
?>
</span>
I am creating one component for managing leads[leads or client leads are submitted from front end],in this component i want to implement a ACL like this.
My client requirement...
SuperAdmin
|— Manager
|—|— Administrator
consider Administrator is under Manager.Please dont compare with joomla default ACL.
All leads are show to superadmin.Superadmin will assign the leads to other users.
If the logged in user is a Manager,he able to see all user leads those who are under Manager group & Administrator group.
If the logged in user is a Administrator,he have no permission for to see others leads because administrator haven't any sub groups,its the last group.
I am using the following query
$query->select( 'c.id as groupid,c.title AS group_name');
$query->from('#__usergroups AS c');
$query->join('LEFT', '#__usergroups AS s ON (s.lft <= c.lft AND s.rgt >= c.rgt) OR (s.lft > c.lft AND s.rgt < c.rgt)' );
$query->where('s.id = "'.$UG.'"');
$query->order('c.lft');
$db->setquery($query);
$gids = $db->loadResultArray();
$gids = implode(",",$gids);
$UG => logged in user groupid.
If logged in user is Manager,$UG is 6
OUTPUT
groupid group_name
1 Public
6 Manager
7 Administrator
If logged in user is Administrator,$UG is 7.Its also return same answer....I want the output as
If the Manager logged in
OUTPUT Will be
groupid group_name
6 Manager
7 Administrator
If the Administrator logged in
OUTPUT Will be
groupid group_name
7 Administrator
or empty
Any one please help me....
Finally i found the answer
Added line AND s.lft <= c.lft AND s.rgt >= c.rgt in where condition
$query->select( 'c.id as groupid,c.title AS group_name');
$query->from('#__usergroups AS c');
$query->join('LEFT', '#__usergroups AS s ON (s.lft <= c.lft AND s.rgt >= c.rgt) OR (s.lft > c.lft AND s.rgt < c.rgt)' );
$query->where('s.id = "'.$UG.'" AND s.lft <= c.lft AND s.rgt >= c.rgt ');
$query->order('c.lft');
$db->setquery($query);
$gids = $db->loadResultArray();
I'm trying to construct a Linq statement to be used from a client with the Sharepoint (2010) object model.
This is the problematic piece of code:
var result = news.Where(n => (bool)n["Online"]
&& ((DateTime)n["StartDate"] <= DateTime.Now && (DateTime)n["StopDate"] >= DateTime.Now));
if (currentUser.IsAgUser())
result = result.Where(n => (string)n["Role"] != "AG-ADMIN");
var filteredNews = sharepointContext.LoadQuery(result);
When the if parte is executed and so another Where is added to result, I get the followin error when LoadQuerying it.
The query expression 'value(Microsoft.SharePoint.Client.ListItemCollection).Where(n => (Convert(n.get_Item("Online")) AndAlso ((Convert(n.get_Item("StartDate")) <= DateTime.Now) AndAlso (Convert(n.get_Item("StopDate")) >= DateTime.Now)))).Where(n => (Convert(n.get_Item("Role")) != "AG-ADMIN"))' is not supported.
Where is the error coming from? Thanks
It seems like SharePoint doesn't support several wheres.
Cheap solution:
var result = currentUser.IsAgUser()
? news.Where(n => (bool)n["Online"]
&& ((DateTime)n["StartDate"] <= DateTime.Now && (DateTime)n["StopDate"] >= DateTime.Now) && (string)n["Role"] != "AG-ADMIN")
: news.Where(n => (bool)n["Online"]
&& ((DateTime)n["StartDate"] <= DateTime.Now && (DateTime)n["StopDate"] >= DateTime.Now));
var filteredNews = sharepointContext.LoadQuery(result);