Netplan Static IP TRouble

Having trouble understanding why I don’t get a connection on my static ip with netplan.

My ip is My reserved address for my device is Ethernet interface: enp1s0.

This is currently what my 50-cloud-init.yaml file looks like.

network:   version: 2   renderer: networkd   ethernets:     enp1s0:       dhcp4: no       addresses: []       gateway4:       nameservers: [,] 

With this I am not able to ping I get a Temporary failure in name resolution error and when I try to ping I get network is unreachable after applying my netplan. If I revert back to the generated yaml file I am able to ping both just fine after applying it.

After applying the netplan the ethernet interface does show my static ip as the address but I do not see my reserved address attached to it.

The spacing appears correct from my understanding for the yaml file. Only using spaces and no tabs and rebooting am still not able to get a connection.

Any suggestions or recommendations?

Swift code review – static variables?

TLDR: (Sent here from StackOverflow) The code I’ve presented is working. I’m looking for a code review from more experienced devs to know if what I have done is OK, and to learn if there are better practices I should focus on to expand my skills and understanding.

Hello. I have completed version 1 of my first app (thanks to all the Q&A’s on StackOverflow who got me there). For version 2 I’m looking to improve the code. I’m not sure if this is the best place to ask for a code review but being one month into self learning swift I don’t know or have anyone to review my work.

I have listed 2 situations that I think I need to improve. If you have the time I’d like some feedback focusing on my use of static variables for changing data between ViewControllers and subviews.

1.0 Image 1 shows the app flow (Left = HomeController), middle = MenuController, Right = FavouritesController)

In HomeController there is a UIView subview. From this subview the current quote (HomeController.homeControllerCurrentQuote) displayed can be saved to favourites array. This is a static array defined in FavouritesController.

The functions below are called from the subview within HomeController. I made HomeController.homeControllerCurrentQuote static because the subview needs access to it. Likewise for FavouritesController.favourites.

// FavouritesController.favourites is static variable! // HomeController.homeControllerCurrentQuote is static variable! updated as user scrolls  func handleFavourite() {     let favourites = FavouritesController.favourites     if favourites.contains(HomeController.homeControllerCurrentQuote) {      removeFromFavourites()     } else { FavouritesController.favourites.append(HomeController.homeControllerCurrentQuote)         UserDefaults.standard.set(try? PropertyListEncoder().encode(FavouritesController.favourites), forKey:"myKey")     } }  func removeFromFavourites() {     var tempArray: [Quote] = [.init(category: "", quote: "", author: "")]     tempArray = FavouritesController.favourites     let searchString = HomeController.homeControllerCurrentQuote.quote     var filteredArray = [Quote]()     filteredArray = tempArray.filter( { !$  0.quote.contains(searchString) } )     UserDefaults.standard.set(try? PropertyListEncoder().encode(filteredArray), forKey:"myKey") }  // update static variable on HomeController internal override func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { ....     HomeController.homeControllerCurrentQuote = Quote(category: cell.categoryLabel.text ?? "", quote: cell.quoteLabel.text ?? "", author: author) .... } 

On FavouritesController the data contained in FavouritesController.favourites array is used to populate a tableVIew.

Image 1 Image 1

Should I change how this is done? I don’t like the use of static variables but as it’s my first app I was more focused on getting it done rather than how it was done. Is it a good case for using a delegate and protocol to communicate between the views (I’ve never used this before)? If so how would I start to think about implementing it or, as it works, is what I’ve done satisfactory?

2.0 When the app launches on HomeController required data is generated and is stored in a static variable.

                          //  [category : [quote  : author]] static var xQuotesByCategory: [String   : [String : String]] = [:] 

I make this data static because when I instantiate HomeController again from another controller, I don’t want to have to refetch the data. I want to retrieve it once. Then when a new instance of HomeController is called I can make this check which should return false. Is this an appropriate use of a static variable?

if HomeController.xQuotesByCategory.values.isEmpty {     ... fetchJson() } 

Following on from this, as HomeController.xQuotesByCategory is static, on CategoriesController I can call

var categories = Array(HomeController.xQuotesByCategory.keys) 

This get’s only the outer keys (categories) which I use to create the collectionView cells with the text and images shown in image 2. Again, same question, is this appropriate use of a static variable? Is there better way to ensure data is loaded only once and then pass the keys to CategoriesController in a different way when it’s required?

image 2

Sorry in advance if it’s a bad question to ask for a code review on update (StackExchange) StackOverflow, just trying to learn here. Also, to help a beginner out even more there is a test version available on TestFlight. if someone wants to actually see it for themselves and give me some more feedback let me know and I can add you in TestFlight!

Cheers, appreciate any and all help

Ubuntu Server 18.04 is set to static IP and get also DHCP-Address

I had problems to setup up a bond, i decided now to use only on interface without bonding.

But now i have 4 IPs on my two interfaces, 2x static and 2x DHCP. but it is configurated to only have the static addresse. Why is there still a DHCP-Address? All addresses are reachable.

root@gemini:/etc/netplan# cat 01-netcfg.yaml # This file describes the network interfaces available on your system # For more information, see netplan(5). network:   version: 2   renderer: networkd   ethernets:     enp3s0:       dhcp4: false       dhcp6: false       addresses: []       gateway4:       nameservers:         search: [lan]         addresses: [,]      enp2s0:       addresses: []       dhcp4: false       dhcp6: false 


root@gemini:/etc/netplan# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00     inet scope host lo        valid_lft forever preferred_lft forever     inet6 ::1/128 scope host        valid_lft forever preferred_lft forever 2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000     link/ether 00:13:3b:21:bd:35 brd ff:ff:ff:ff:ff:ff     inet brd scope global enp2s0        valid_lft forever preferred_lft forever     inet brd scope global enp2s0        valid_lft forever preferred_lft forever     inet6 2001:16b8:49d:d000:4a0f:31a2:4b9f:34e5/64 scope global dynamic mngtmpaddr noprefixroute        valid_lft 6775sec preferred_lft 3175sec     inet6 2001:16b8:49d:d000:213:3bff:fe21:bd35/64 scope global dynamic mngtmpaddr noprefixroute        valid_lft 6775sec preferred_lft 3175sec     inet6 fe80::213:3bff:fe21:bd35/64 scope link        valid_lft forever preferred_lft forever 3: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000     link/ether d0:50:99:1d:04:46 brd ff:ff:ff:ff:ff:ff     inet brd scope global enp3s0        valid_lft forever preferred_lft forever     inet brd scope global secondary enp3s0        valid_lft forever preferred_lft forever     inet6 2001:16b8:49d:d000:65d1:f7ff:7ccf:111/64 scope global dynamic mngtmpaddr noprefixroute        valid_lft 6775sec preferred_lft 3175sec     inet6 2001:16b8:49d:d000:d250:99ff:fe1d:446/64 scope global dynamic mngtmpaddr noprefixroute        valid_lft 6775sec preferred_lft 3175sec     inet6 fe80::d250:99ff:fe1d:446/64 scope link        valid_lft forever preferred_lft forever 

problem getting pptp vpn running on static ip

My name is mortem and I’m using mxlinux which is a Debian based distro There is a local network with static IP’s in my workplace, and i am using windows network under this conditions: Static IP: 192.168.65.x Netmask: Gateway: 192.168.65.x DNS: 192.168.100.x for linux, gui-tool:network manager and cli-tool:ceni didnt do anything. so I did the traditional thing: $ sudo featherpad /etc/network/interfaces and made it like this:

interfaces file used by ifup and ifdown

The loopback network interface

auto lo iface lo inet loopback

The Primary Network Interface

auto eth0 iface eth0 inet static address 192.168.65.x netmask gateway 192.168.65.x dns-nameservers 192.168.100.x

and I finally can ping my other fellow local network computers but for vpn I had no luck I am told to use a pptp vpn connection to have internet up and running IP: 172.16.0.x UserName: MYVPNUSERNAME Password: MYVPNPASSWORD Conn.Type: PPTP Encryption: optional for windows, you make a vpn connection and put that info and you are good to go for linux, making a pptp vpn with network manager didn’t do anything. it wanted some gateway and username and password and an optional NT domain but it didn’t work and i dont know what to do with that required gateway! so I followed description on $ sudo featherpad /etc/ppp/chap-secrets and and made it look like this:

Secrets for authentication using CHAP

client server secret IP addresses


then made a connection: $ sudo featherpad /etc/ppp/peers/vpnconnction1 that looks like this:

pty “pptp 172.16.0.x –nolaunchpppd” name MYVPNUSERNAME remotename PPTP require-mppe-128 file /etc/ppp/options.pptp ipparam vpnconnection1

and added a route: $ sudo featherpad /etc/ppp/ip-up.d which looks like:


route add -net dev ppp0

then made it executable: $ sudo chmod +x /etc/ppp/ip-up.d/vpn1-route and put it to test: $ sudo pppd call vpnconnection1 and saw the log: $ sudo tail -f /var/log/messages which says:

pppd 2.4.7 started by mortem, uid 0 Using interface ppp0 Connect: ppp0 <–> /dev/pts/2 CHAP authentication succeeded MPPE 128-bit stateless compression enabled local IP address 172.19.11.x remote IP address 172.19.10.x

looks good but wont work for pinging or using a web browser I even did it as says either way pinging local network looks good but web ping doesn’t

please help me.

In Würm, when should a bonus be an extra die, and when is it a static value?

In Würm, actions are resolved by rolling 2d6 and beating a threshold for the challenge. Context, special abilities, and items can provide bonuses or penalties to this roll.

I’m going to be GMing my first game of Würm soon. I’m trying to build some intuition for what kinds of situations warrant a flat bonus, and what kinds justify a bonus die.

Here’s one such example. Both of these tasks involve one player providing benefits to another character. Why is one stochastic and the other fixed? How can I decide which type of bonus to provide?

  • A character may carry out a ceremony. Participants in the ceremony gain +1d6 to a certain kind of test. For example, a hunting ceremony could add a bonus to tracking a bison
  • A character may play music to provide a +2 or -2 to certain checks. For example, a drum player can inspire fear to provide -2 to steady nerves checks.

Magento 2 Deploying static content causes “Undefined variable: template” error

I just did a static content deploy and cache flush on my Magento 2 site, and when I did, the entire site crashed with the following error: Notice: Undefined variable: template in /vendor/magento/framework/View/Page/Config/Renderer.php on line 389″

The site was working before the static content deploy and only 1 file was added in the theme. When I dug deeper, I also found this error: "A symlink for "vendor/magento/theme-frontend-blank/web/css/source/_reset.less" can't be created and placed to "pub/static/frontend/Vendor/theme/en_US/css/source/_reset.less". Warning!symlink(): No such file or directory.

I’ve never had that issue before, and the only thing I did was add 1 Javascript file to the theme since last deploying static content.

It’s also strange because the _reset.less file does exist in that location that it says it does not exist in. I thought it might be a permission issue, so I set the vendor folder, and everything in it, to 777 (I’m on a local dev environment, and this is only for testing purposes), but it still came up with the same errors. I’m not sure why it can’t find a file that exists where it says it doesn’t exist when it has full permission to do everything, so I’m at a bit of a loss.

Any help would be appreciated.

Design pattern for exposing static functions in C/C++ only to unit tests [on hold]

I have some static free functions (the don’t belong to a class) in a C++ file. I want them to still be only visible within such module and to be free, but I want to test them with unit tests as well.

As far as I can see, the are several possible options:

  • Using macros, enable/disable the static keyword depending on whether or not a variable (TEST_MODE) is defined or not:
#ifdef TEST_MODE    #define static #endif 
  • Use ‘private headers’: create a header file whose name ends with _private and whose location is in include/private.

  • Declare the functions in the normal header file adding like a private section with code comments. Like /////// PRIVATE SECTION ///////

  • Include the *.cpp file in which they are declared (personally I don’t like this option at all)

  • Group the private functions in a ‘private’ namespace. Like namespace myNamespace { namespace private { .... } }. The problem with this one is that it can’t be used in plain C.

  • Use compiler directives for hiding stuff, like __attribute__(("hidden"))

I would say that my favourite one is the private header, it seems to be clean and does not need namespaces, in case the language doesn’t support them.

Which one is considered the best practice?