teleren/devto huggingface dataset:
Automatic copyright year in Perch CMS
Published: 2020-05-11 09:18:45

---
title: Automatic copyright year in Perch CMS
published: true
date: 2017-02-06 08:30:22 UTC
tags: 
canonical_url: https://www.juanfernandes.uk/blog/automatic-copyright-year-in-perch-cms/
---

One of the things I still get asked to do a lot by clients, ones that don't have a site that is managed by a CMS - is to update their copyright year on the footer.

Now, this is fairly easy to do using PHP on its own, just using this line of code:

```
    <?php echo date("Y"); ?>

```

But, you if allow your CMS users to edit the copyright text, then you can't use PHP in a Perch HTML template.

After reading this article, [Passing Variables Into Templates](https://docs.grabaperch.com/templates/passing-variables-into-templates/ "Passing Variables Into Templates"), I created this code snippet that sets a variable with the current year and then I pass this variable to the Perch template.

```
    <?php
        $curYear = date('Y');
        PerchSystem::set_var('curyear',$curYear);
        perch_content_custom('Footer', array(
            'template'=>'footer.html'
        ));
    ?>

```

This is the Perch template I use to add the copyright text and year.

```
    <p class="copyright">©2015 - <perch:content id="curyear" /> <perch:content
    type="text" id="footer-copyright" label="Copyright Text" required="true" /></p>

```

This may be a bit over the top, I could simply just added the PHP code in the footer template and not allow the user change the copyright text, but my copyright statement is part of a bigger template that needs to be CMS managed.

I hope you found this tip useful. Let me know if you see any way I could improve this code.

How are you setting the copyright year?
Hi, I'm Ddinardi0
Tags: introductions
Published: 2017-02-06 18:22:58

---
title: Hi, I'm Ddinardi0
published: true
description: My introduction post
cover_image: 
tags: introductions
---

Hi there! My name is Diego Dinardi, I'm a journalist, copywriter and independent fiction author who just recently overcame his fear of coding. I'm based in SÃ£o Paulo, Brazil and I'm currently studying very basic jScript, HTML and CSS and SQL.
Hi, I'm Amanda Benhamou
Tags: introductions
Published: 2017-02-06 16:39:58

---
title: Hi, I'm Amanda Benhamou
published: true
description: Aspiring Web Developer
cover_image: 
tags: introductions
---

I have been coding for ~1 year.

You can find me on Twitter as [@AmandaBenhaMOO](https://twitter.com/AmandaBenhaMOO)

I live in New York.


I mostly program in these languages: JavaScript.

I am currently learning more about Angular2 and Node.

Nice to meet you.
Hi, I'm Pramjeet Ahlawat
Tags: introductions
Published: 2017-02-05 12:42:03

---
title: Hi, I'm Pramjeet Ahlawat
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for 3 years.

You can find me on GitHub as [pramjeet](https://github.com/pramjeet)

I live in Gurgaon, India.

I work for noti5.me.

I mostly program in these languages: javascript.

I am currently learning more about node.js.

Nice to meet you.
Hi, I'm Aidan Woods
Tags: introductions
Published: 2017-02-04 20:17:17

---
title: Hi, I'm Aidan Woods
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for [number] years.

You can find me on GitHub as [aidantwoods](https://github.com/aidantwoods)

I live in [city].

I work for `<(/dev/null)`.

I mostly program in these languages: [languages].

I am currently learning more about [topic].

Nice to meet you.
Hi, I'm mdickin
Tags: introductions
Published: 2017-02-05 00:03:15

---
title: Hi, I'm mdickin
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for [number] years.

You can find me on GitHub as [mdickin](https://github.com/mdickin)

I live in [city].

I work for [company]

I mostly program in these languages: [languages].

I am currently learning more about [topic].

Nice to meet you.
Hi, I'm Nick Wu
Tags: introductions
Published: 2017-02-04 23:20:05

---
title: Hi, I'm Nick Wu
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for 9 years.

You can find me on Twitter as [@WujunaoNick](https://twitter.com/WujunaoNick)

I live in [city].

I work for [company]

I mostly program in these languages: [languages].

I am currently learning more about [topic].

Nice to meet you.
Hi, I'm cmp
Tags: introductions
Published: 2017-02-04 23:13:06

---
title: Hi, I'm cmp
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for 10+ years.

You can find me on Twitter as [@0xCMP](https://twitter.com/0xCMP)

I mostly program in Python, JavaScript, and Go.

Nice to meet you.
Hi, I'm Bob van Hoove
Tags: introductions
Published: 2017-02-04 20:21:40

---
title: Hi, I'm Bob van Hoove
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for 8 years.

You can find me on Twitter as [@courier10pt](https://twitter.com/courier10pt)

I live in Nijmegen.

I work on applications for the Information Service Centre @ Radboud University 

I mostly program in these languages: C#, javascript


Nice to meet you.
Hi, I'm Gregoor
Tags: introductions
Published: 2017-02-04 20:15:45

---
title: Hi, I'm Gregoor
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for ~8 years.

You can find me on GitHub as [Gregoor](https://github.com/Gregoor)

I live in Germany for the moment, but I'm more of a nomad nowadays.

I work as a freelancer, mostly for Gigster.

I mostly program in these languages: JavaScript, SQL, Ruby, Python.

Nice to meet you.
Hi, I'm Ian Spence
Tags: introductions
Published: 2017-02-04 18:46:26

---
title: Hi, I'm Ian Spence
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for 7 years.

You can find me on GitHub as [ecnepsnai](https://github.com/ecnepsnai)

I live in Vancouver, BC.

I mostly program in these languages: Objective-C, C, Golang, Javascript

I am currently learning more about TLS, OpenSSL/LibreSSL.

Nice to meet you.
Hi, I'm #MuthuPandian
Tags: introductions
Published: 2017-02-04 05:43:08

---
title: Hi, I'm #MuthuPandian
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for 3 years.

You can find me on Twitter as [@muthuPandian_t](https://twitter.com/muthuPandian_t)

I live in Chennai.

I work for Whirldata

I mostly program in these languages: Java, R, Python, Tensorflow.

I am currently learning more about Machine Learning, Deep Learning.

Nice to meet you.
Hi, I'm Adam Brandizzi
Tags: introductions
Published: 2017-02-04 00:27:17

---
title: Hi, I'm Adam Brandizzi
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for 15 yars.

You can find me on Twitter as [@adambrandizzi](https://twitter.com/adambrandizzi)

I live in Recife.

I work for Liferay.

I mostly program in Java, Python, JavaScript and, naturally, Bash :)

I am currently learning more about Haskell, Rust and machine learning.

Nice to meet you.
Hi, I'm Justin Aiken
Tags: introductions
Published: 2017-02-03 22:28:14

---
title: Hi, I'm Justin Aiken
published: true
description: My introduction post
cover_image: 
tags: introductions
---

You can find me on GitHub as [JustinAiken](https://github.com/JustinAiken)

I work for [UserTesting](https://www.usertesting.com)

I mostly program in these languages: Rails. And a little Elixir

I am currently learning more about Docker, ML, and React.
Hi, I'm dezren
Tags: introductions
Published: 2017-02-03 21:01:30

---
title: Hi, I'm dezren
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for a few  years.

You can find me on GitHub as [dezren39](https://github.com/dezren39)

I live in Eau Claire, WI.

I work for a [company].



I am currently learning more about development.


Nice to meet you.
Hi, I'm Rip
Tags: introductions
Published: 2017-02-03 19:17:27

---
title: Hi, I'm Rip
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for 3 or 4 years.

You can find me on GitHub as [ripbandit](https://github.com/ripbandit)

I mostly program in these languages: C++, Javascript/Node.js and Go.

I am currently learning more about Vue.js and Rust.

Nice to meet you.
Vladimir Vivien
Tags: introductions
Published: 2017-02-03 19:07:45

---
title: Vladimir Vivien
published: true
description: My introduction post
cover_image: 
tags: introductions
---

Hi, I am Vladimir Vivien, a software engineer in the US.  I have been coding since floppy disks were a thing.  

Currently, I primarily work on Go open source projects for fun ([github.com/vladimirvivien](https://github.com/vladimirvivien)) and profit (at {code} by Dell EMC).

I enjoyed Go so much that I published an introductory book in Go titled [Learning Go Programming](https://www.packtpub.com/application-development/learning-go-programming) from Packt.  

When I am not slinging code, I enjoy spending time with my family, playing with my beat-making gears and reading about (and playing with) technology.
Rails ActionCable The Saga Continues
Tags: rails, ruby, actioncable
Published: 2017-02-03 17:25:52

---
title: Rails ActionCable The Saga Continues
published: True
description: Continued Struggles with Action Cable and a Solution
cover_image: https://cdn-images-1.medium.com/max/1600/1*qbcP_tuqHcGXv6DBn9_rXw.jpeg
tags: rails, ruby, actioncable
---

Yesterday I wrote a post titled, “My Struggle With Rails ActionCable” which got a lot of good feedback and reviews. But overnight I thought long and hard about this problem that I faced in that I could not get the request origin aka TENANT to be delegated to the channel.rb file.

There was an open issue on the Apartment Gem where several people were discussing Apartment and Actioncable. After doing my own research and coming up short I saw a light at the end of the tunnel. One of the contributors to the Apartment gem found some documentation on how the user is verified for connection and he discovered the following in the documentation.

"Note that anything marked as an identifier will automatically create a delegate by the same name on any channel instances created off the connection."

So I went to work to refactor my code and this is what I came up with in the connection.rb file

![connection.rb](https://cdn-images-1.medium.com/max/1600/1*m5tzRJ4kviE1LczEAI9TCA.png)

If you notice the ActionCable connection is now identified by `current_user` and by `tenant` by setting the `tenant` in the `connect` method by simply calling `self.tenant = request.subdomain` then immediately following we switch the tenant and connect to the proper channel based on tenant. Since we are now delegating tenant to the channel it's a relatively easy fix to get the channel wired up and switch the tenant in our `send_message` method.

![channel.rb](https://cdn-images-1.medium.com/max/1600/1*lP8CDseOefW7aDh9nF3FBA.png)

Now if you look at the `send_message` method in the channel file you'll notice we're switching the tenant as such `Apartment::Tenant.switch!(tenant)` which is possible now because we delegated `tenant` from the `connection.rb` file so that it's available to the channel.

End result, ActionCable and Multi-tenancy now working across the board. I honestly haven't seen a use case (trust me I've googled for hours) where someone was building a multi-tenant SaaS platform and integrating ActionCable.

So now this feature is near completion, just ironing out some coffeescript bugs and issues with the Background Job processor.

I'm hoping to write a full tutorial soon on this topic, but for now the problem is solved and I have to give a big thanks to the Apartment and Rails community for helping to steer me in the right direction to solve my specific use case.

What are you building with ActionCable? Are you implementing multi-tenancy? If so, give me a shout and let's compare notes!

Cheers!
shakycode â¤
Twitter: [shakycode](https://twitter.com/shakycode)
Email: shakycode@gmail.com

[Originally posted here](https://shakycode.com/rails-actioncable-the-saga-continues-7c29301be0df#.rsxhmuduh)
Hi, I'm Michele Mirandola
Tags: introductions
Published: 2017-02-03 11:31:39

---
title: Hi, I'm Michele Mirandola
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for 7 years.

You can find me on GitHub as [Miralo](https://github.com/Miralo)

I live in Verona, Italy.

I work for EWake (Agency)

I mostly program in these languages: Css, Sass, Javascript, Pug, Twig.

I am currently learning more about ES6/7, Vue.js, NodeJs and the world around them.

Nice to meet you.
Hi, I'm Bogdan Ciobotaru
Tags: introductions
Published: 2017-02-03 10:09:00

---
title: Hi, I'm Bogdan Ciobotaru
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for 1,5 years.

You can find me on GitHub as [bciobo](https://github.com/bciobo)

I live in Berlin.

I work for fredknows.it

I mostly program in these languages: Python and TS/JS.

I am currently learning more about Continous deployments and Artificial Neural Networks.

Nice to meet you.
Secrypto
Tags: ruby, rails, webdev, encryption
Published: 2017-02-03 10:07:56

---
title: Secrypto
published: true
description: Open Source API to encrypt/decrypt text.
cover_image: 
tags: #ruby, rails, webdev, encryption
---


Hi i just implemented (for funny) a little ruby API that allow you to encrypt/decrypt text. Take a look at:

http://secrypto.herokuapp.com

https://github.com/davidesantangelo/secrypto/

Don't worry for all text are encrypted and saved on DB with AES 256 encryption. You can use the heroku app or install it on your server.
Hi, I'm Ranjeev Atwal
Tags: introductions
Published: 2017-02-03 09:27:04

---
title: Hi, I'm Ranjeev Atwal
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for 5 years.

You can find me on GitHub as [ranjeev75](https://github.com/ranjeev75)

I live in Leamington Spa.

I work for Breaking Free Group

I mostly program in these languages: Javascript.

I am currently learning more about React-native, react, machine learning.

Nice to meet you.
Hi, I'm stevensonmt
Tags: introductions
Published: 2017-02-03 04:54:10

---
title: Hi, I'm stevensonmt
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for a few years.

You can find me on GitHub as [stevensonmt](https://github.com/stevensonmt)

I live in the Pacific NW.

I am an amateur coder with a day job tangentially related to software.

I mostly program in these languages: ruby, html, css, crystal, rust, elm.

I am currently learning more about rust and elm while getting a firmer grasp on core concepts such as recursion and the differences between functional and imperative programming.  I would like to learn elixir at some point.

Nice to meet you.
Hi, I'm Meyer Zinn
Tags: introductions
Published: 2017-02-03 02:39:04

---
title: Hi, I'm Meyer Zinn
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for ~3 to 4 years.

You can find me on GitHub as [20zinnm](https://github.com/20zinnm)

I live in Dallas.

I study at St. Mark's.

I mostly program in these languages: Go, Java, (.*)Script.

I am currently learning more about game development and web applications.

Nice to meet you.
Hi, I'm Michael Scott Shappe
Tags: introductions
Published: 2017-02-02 22:35:24

---
title: Hi, I'm Michael Scott Shappe
published: true
description: My introduction post
cover_image: https://scontent.xx.fbcdn.net/v/t1.0-1/p320x320/16387232_10210645087097833_7173584627844255452_n.jpg?oh=c272a346c997a57bc1eee988cfb86687&oe=5910AD88
tags: introductions
---

I have been coding for 30 years.

You can find me on GitHub as [mshappe](https://github.com/mshappe)

I live in Richfield, MN.

I am semi-self-employed, consulting as Camelopard Consulting LLC, currently contracted to Red Stamp.

I mostly program in these languages: Ruby, JavaScript, formerly C/C++, Python.

I am currently learning more about the joys of JavaScript frameworks.

Nice to meet you.
Hi, I'm shakycode
Tags: introductions
Published: 2017-02-02 21:33:14

---
title: Hi, I'm shakycode
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for 5 years.

You can find me on GitHub as [shakycode](https://github.com/shakycode)

I live in Houston.

I work for many companies

I mostly program in these languages: Ruby, Python, Javascript, and Rust.

I am currently learning more about Event Driven Architecture and SOA Architecture.

Nice to meet you.
Hi, I'm anchapin
Tags: introductions
Published: 2017-02-02 17:15:47

---
title: Hi, I'm anchapin
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for 14 years.

You can find me on GitHub as [anchapin](https://github.com/anchapin)

I live in Pittsburgh.

I work for 3R Building Sustainability.

I mostly program in these languages: Python and JavaScript.

I am currently learning more about bluetooth.

Nice to meet you.
Why I am learning Rust now
Tags: rust, functional, systemsprogramming
Published: 2017-02-01 21:10:54

---
title: Why I am learning Rust now
published: true
description: beginning programming with Rust
cover_image: 
tags: rust, functional programming, systems programming
---

From its inception, I have always been vaguely aware of this new language called Rust. It has been developed up to this point, mainly by and for the Systems Programming community. Some say that it will replace C.

For me, I am no hardliner, and will accept that the old gods will continue to exist, prosper, and torment their followers. Though, thankfully, I have never been tied to these larger communities. I grew up with Forth, Prolog, SML , Haskell, and some C when in need of an escape from the walled gardens.
Before learning Rust, I had viewed it with apprehension: due to a lack of sane functional programming. Even today, after several months of attunement, I fear that multithreading is much higher on the list of priorities compared to anything that smells like old books.

This is precisely why I am hopeful for the future of FP in Rust. Traditionally there has been a rift between academic and practiced programming. The Ivory tower has always held the “good answers while everyone else just uses the “bad workarounds”. Rust can change this.

The type system in Rust, with all of its obsession with object lifetimes, has created something so paranoid, that it almost resembles the Calculus of Constructions. This is the next best thing that a Programming Theory practitioner could ask for next to a Lambda. Currently lambdas/closures in Rust are very scary things: you can use an FnMut or a closure and “move to copy all of the scoped variables. This contextual information forms the environment of the CoC logic. All that is necessary now would be a formalization of Rust's type system and then we would have a language that can be formally manipulated.

There are a few other things that Rust incorporates that have a history in published journals of Functional Programming. Rust Exception Handling is exceptional in the respect that it does not require a specific stack structure or long jumps into distant code paths. All of the basic categorical operations have been implemented. I have started to suspect that Rust will become a darling language, until I keep programming in it and get the bad taste in my mouth.

From all that I can gather from the state of the language. One, the language community is growing. Two, the language maintainers are open to experimentation. Three, there is a growing area of common structure linking Rust to the PLT community. When more people get to influence the direction of a language, as a linguist, I believe that it creates a better end product, or at least it smooths down the rough edges; and that is what Rust needs right now the most: a good polishing.

My Rust escapades are available open source on Github.

– Student
Spring-Session Grails Plugin (Part 2)
Tags: grails, java, springsession, groovy
Published: 2019-07-24 08:10:14

---
title: Spring-Session Grails Plugin (Part 2)
published: true
tags: GRAILS, JAVA, SPRINGSESSION, GROOVY
canonical_url: https://jsblogs.github.io/blogs/2017/02/01/Spring-Session-Grails-Plugin-part-2
---

[![Fork me on GitHub](https://camo.githubusercontent.com/e7bbb0521b397edbd5fe43e7f760759336b5e05f/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677265656e5f3030373230302e706e67)](https://github.com/jeetmp3/spring-session)

In my [**previous blog**](jeetmp3/spring-session-grails-plugin-part-1-2gc4) I’ve explained [**spring-session grails plugin**](https://grails.org/plugin/spring-session) along with Redis datastore. We’ve also covered JSON serialization that will be almost same when you use mongo datastore. In this blog post I’ll explain how you can use MongoDB as your session store.

To change datastore you need to add a property in your `Config.groovy`.

```groovy
springsession.sessionStore=SessionStore.MONGO
```

This will set MongoDB as your datastore. By default it’ll try to connect mongo running on **localhost** port **27017**. Let’s check out the some config properties with their default values.

**_Note:_** _Some of the common properties explained in previous block. Those will work same for mongo datastore_.

```groovy
springsession.mongo.hostName="localhost" // MongoDB host server. Default is localhost.
springsession.mongo.port=27017 // MongoDB port. Default is 27017.
springsession.mongo.database="spring-session" // MongoDB database to store sessions. Default is spring-session.
springsession.mongo.username="" // MongoDB username. Default is "".
springsession.mongo.password="" // MongoDB password. Default is "".
springsession.mongo.collectionName="sessions" // Mongo collection name to store session data. Default is "sessions".
springsession.mongo.replicaSet=[[:] ] // MongoDB replica set if any. It includes list of maps [[hostName: 'localhost', port: 27017] ] Default is [[:]].
springsession.mongo.jackson.modules=[] // Jackson module class if any. Default is empty list
```

**_Note:_** _MongoDB is a NoSQL and schemaless database. So you don’t need to create database and collections for the session. It’ll auto created when session will created._

By default it uses Java serialization. To use JSON Serialization please visit to [**first blog**](/blogs/2016/12/15/Spring-Session-Grails-Plugin) of this series. First 2 steps will be same but in 3<sup>rd</sup> step **_Register my module class with spring-session plugin_** you will have to use mongo specific `jackson.modules` property.

```groovy
springsession.mongo.jackson.modules = ['demo.SimpleModule']
```

That’s it in this post guys. In my next blog, I’ll explain how to use JDBC datastore with spring-session grails plugin.