Change page layout dynamically depending on url parameter

The standard layout of my categories are 2-columns-left, so that the layered navigation is visible in my shop. What I want is, to use the same categories to display a content.

This is an example for my shop link: products/chemicals.html IfI click this link my products are shown in my list.phtml

This is an example for my “cms” link: products/chemicals.html?cms_id=123 If I click this link my “cms” content is displayed in my list.phtml

What I want now, is to display my content without the left sidebar. By css I can set the sidebar display:none, that works, but the page loads my products.

I would prefer to change the page layout when i call my “cms” category page.

Any idea?


Playing a sound depending on the currently displayed flash card image

I’ve developed a fully working flash card app for kids. It has a UIImageView that cycles through 26 cards (abcs) via a gesture click and a music button that will play a sound for each image. Right now I have this 100% working, but the sound plays in an IF statement that has added an additional 400 lines of code.

How I load each card into the UIImageView from a gesture tap:

        // if the tapped view is a UIImageView then set it to imageview         if (gesture.view as? UIImageView) != nil {             if segControl.selectedSegmentIndex == 0 && segControl2.selectedSegmentIndex == 0 {                 imageView.image = UIImage(named: "card\(number)")                 number = number % 26 + 1             }             else if segControl.selectedSegmentIndex == 0 && segControl2.selectedSegmentIndex == 1 {                 imageView.image = UIImage(named: "upper\(number)")                 number = number % 26 + 1             } 

Music button:

    if (imageView.image?.isEqual(UIImage(named: "card1")))! {         do { audioPlayer = try AVAudioPlayer(contentsOf: URL(fileURLWithPath: aSound))            } catch {             print("Couldn't load sound file")         }     }     else if (imageView.image?.isEqual(UIImage(named: "card2")))! {         do { audioPlayer = try AVAudioPlayer(contentsOf: URL(fileURLWithPath: bSound))            } catch {             print("Couldn't load sound file")         }     }     else if (imageView.image?.isEqual(UIImage(named: "card3")))! {         do { audioPlayer = try AVAudioPlayer(contentsOf: URL(fileURLWithPath: cSound))            } catch {             print("Couldn't load sound file")         }     } 

I know i could set a sound array with the sound files in it, but how would i tie it back to the card? I cant set a tag property on an asset image can i?

Looking for a way to shorten the current code i have.

Cast to boolean, for integer linear programming depending on the sign

I have an integer variable Si. The objective function I have depends on the sign of Si.

Logically I can do it by creating a boolean variable bi, which is true when Si is not negative, and false if it is negative.

My objective function would be Max{sum(100*bi*Si-200*(1-b)*Si)}

How do I make it in Linear programming?

How to show menu items depending on the user’s roles and the node type?

I would like to show some menu items (merged with the main navigation menu) when viewing a node (full content) of a custom content type. Also, this menu items depend on user’s roles. It could be something like contextual menu, but with the main menu. For example, I have a custom content type “invoice” and when an user is viewing an invoice, some new menu items should be shown, like “send by email”, “pay”,…

Change main screen/section of product depending on user progression with product

Is it possible to create a product where the main section (where users land after login) changes depending on the progresses made by the users with the product?

I’m currently working on a career development product, which main goal is to provide supports from mentors for enterpreneurs. This support will be provided in a “Progress dashboard”, where users add long-term goals and mentors will evaluate the progresses of the enterpreneur towards these goals.

Users (enterpreneurs) don’t have mentors by default; in order to create a “Mentors panel” they can browse a network of mentors (with which they’re matched depending on profile preferences/details collected during the signup).

Users can use the progress dashboard even without having added a mentor in such dashboard, but ideally they would firstly find the mentors, and THEN start using the progress dashboard.

Here’s a simplified flow of the journey (first use): Flow diagram

It seems to me that this product will have two distinct life cycles:

  1. “Browse mentors” is primary section: finding mentors in an “Explore mentors” section, and then adding them to their dashboard; this may take from 1 to 3 week averagely;
  2. Progress dashboard becomes primary section (they will always land here after login): weekly/monthly use of progress dashboard, where the selected mentors can provide feedback and will evaluate users progresses towards their goal.

Is there any best practice or real life example of products where a so-called “Main section” changes depending on the position of the user in the product life cycle? Is it too confusing to have the “Browse mentors” section as the primary one, and then make the “Progress dashboard” the primary one? Is it ever been done?

I’m not excluding that this necessity demonstrates an underlying issue with the overall product life cycle and user journey.

Modify string that stored in clipborad depending on random value

I wrote simple program, that will make string ‘noisy’ if clipboard contains one. What disappoints me, that i should manually check what i got from getClipboardString — in the Nothing case we just simply returning from program, otherwise we modifying string. Is there a better way to do this kind of check?

import Data.Char (toUpper) import System.Random (randomIO) import System.Clipboard (setClipboardString, getClipboardString) import Control.Monad (join)  main :: IO () main = do   join $   fmap (test doNoise) getClipboardString  where  test :: (String -> IO ()) -> (Maybe String) -> IO ()  test _ Nothing = return ()  test f (Just s) = f s   doNoise :: String -> IO ()  doNoise s = do   capsed <- (sequence $   map randCap s)   setClipboardString capsed   randCap :: Char -> IO Char  randCap x = fmap ($   x) $   fmap choice (randomIO :: IO Bool)   choice :: Bool -> (Char -> Char)  choice x = if x then toUpper else id 

Different public IP depending on which device is connected to the internet?

I am wondering why my router has one public IP, and if disconnect the router and connect my laptop directly into the wall, I get another public IP, and if I connect my other laptop, I get yet another public IP.

I am using DHCP on all devices.

I tried releasing and renewing the DHCP lease, but I keep getting the same IP (3 different ones) on all devices.

I thought that my ISP would give the same IP to all my devices if they connect to the same outlet in the wall, but that does not seem to be the case. They do not seem to care either that I release and renew the lease.

Do they store the MAC adress connected and give that device a DHCP lease, and then keep that for however long they want? Or how do they know to give the same IP to my different devices every time? Is this normal practice by an ISP?

I took a couple of screenshots from 2 of my devices, to illustrate my point.

I searched on google, but found mostly posts about how someone’s router’s public IP differs from the public IP you find when you run curl for example, which is not the case here.

laptop1 pic1

laptop1 pic2

router pic1

router pic2