teleren/devto huggingface dataset:
How to generate Prestashop Invoice by Customer name
Tags: blog, prestashop, tutorial
Published: 2018-05-24 08:59:59

---
title: How to generate Prestashop Invoice by Customer name
published: true
tags: blog, prestashop, tutorial
canonical_url: https://www.prestasoo.com/blog/how-to-generate-prestashop-invoice-by-customer-name.html
---

![](https://www.prestasoo.com/images/stories/generate-prestashop-invoice-by-customer-name.jpg)

##Want to generate the invoice by customer name instead of the boring numbers?

It's so easy - on this Prestashop Tutorial, i will show you how to do it.

- Step I: Modify function getFilename() in your-website/classes/pdf/HTMLTemplateInvoice.php.
- Step II: Get the customer object by adding this line: $customer = new Customer((int)$this-\>order-\>id\_customer);
- Step III: Return with the name and the number.

Are you ready? Follow me.

Before you do anything else, please make sure backup your website / your file first. When you done, let's go.

##I - Modify function getFilename()

Open and edit function getFilename() in your-website/classes/pdf/HTMLTemplateInvoice.php by using your favourite editor.

##II - Get the customer object.
###Find getFilename() function (line 500):

public function getFilename()
    {
        $id_lang = Context::getContext()->language->id;
        $id_shop = (int)$this->order->id_shop;
        $format = '%1$s%2$06d';


Change it to:

public function getFilename()
    {
        $id_lang = Context::getContext()->language->id;
        $id_shop = (int)$this->order->id_shop;
        $format = '%1$s%2$06d';
        $customer = new Customer((int)$this->order->id_customer);


##III - Return with the name and the number.
###Look into this code:

return sprintf(
            $format,
            Configuration::get('PS_INVOICE_PREFIX', $id_lang, null, $id_shop),
            $this->order_invoice->number,
            date('Y', strtotime($this->order_invoice->date_add))
        ).'.pdf';


Change it to:

return sprintf(
            $format,
            Configuration::get('PS_INVOICE_PREFIX', $id_lang, null, $id_shop),
            $this->order_invoice->number,
            date('Y', strtotime($this->order_invoice->date_add))
        ).'_'.$customer->firstname.'_'.$customer->lastname.'.pdf';


##Final - Enjoy your result

The invoice name will be IN_number_customername.pdf. For example : IN000001_Natalia_Eva.pdf.

Is it cool, huh? Don't forget our blog to find the useful [Prestashop tutorials](https://www.prestasoo.com/Blog/?utm_source=devto&utm_medium=article&utm_campaign=invoice_customer_name).

Have a nice weekend!
How to Build your First Offline Webpage
Tags: pwa, webdev, javascript, beginners
Published: 2018-05-24 14:58:27

---
title: How to Build your First Offline Webpage
published: true
description: How to Build your First Offline Webpage
tags: pwa,webdev,javascript,beginners
cover_image: https://cdn.pixabay.com/photo/2018/05/02/09/59/bike-3368157_960_720.jpg
---

**Today we are building our First Offline Web page with the Help of Service Workers.**

# What is Service Workers?

Service Workers can run BackGround In our browsers without user Interaction. They work on There Own thread and work even the browser closes / site closes.

Service Workers run only on Secured Sites like (https) at the time development it will work on localhost.


Today we are using the service Workers to Build Our Offline Web page.

First, we need to check if the service workers are available in Browser.

this our script.js file code.

![](https://thepracticaldev.s3.amazonaws.com/i/x0z218xrx7jk01iu6yl4.png)

what the above code does if there is service worker in navigation

if it is then run these code inside the block.

 we need to create the empty sw.js file and we need to specify the path of a sw.js  file in register method.

Register method gives us back a promise if it is successfully registered
then we are good to go otherwise some problem occurred during the registration.


## Now we are in Sw.js file

they are different life cycle events service worker offers us 
which are install, activate, fetch?


First, we need to install the service worker for that we need to write some code.

# Install Event

```
self.addEventListener('install',function(){
   

})

```
it looks like these 


At the time of installing we need to open the cache and put our static assets in the cache.


![](https://thepracticaldev.s3.amazonaws.com/i/6xjugryg1213exjge75h.png)

event.waitUntil() takes the Promise so that it waits until the promise
resolves. Like please wait until assets are put inside the cache.

I'm skipping the activate event we already cached our static assets in the cache name of**'my-cache-1'**.

Now we want to access the cache and use the assets inside the cache instead of sending the network request.

# Fetch event

![fetch sw](https://thepracticaldev.s3.amazonaws.com/i/owdgnfd2ue1o6ch97k7b.png)


What it does first it checks the requested file is in the cache if yes use it or send a network request.



Wow, we are  successfully completed  our  simple offline web page

![im](https://thepracticaldev.s3.amazonaws.com/i/u98l3a6umh6xfvzrw4zx.gif)


These is our final output try your own if you have any doubts feel free to ask.

Happy coding...


**Resources**

- [Cache Api ](https://developer.mozilla.org/en-US/docs/Web/API/Cache)

- [More About Service Workers](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API)
Upgrade to Polymer 3 or LitElement?
Tags: polymer, webcomponents, javascript, discuss
Published: 2018-05-24 11:03:29

---
title: Upgrade to Polymer 3 or LitElement?
published: true
description: 
tags: polymer, webcomponents, javascript, discussion
---


From [Roadmap update, part 2: FAQ](https://www.polymer-project.org/blog/2018-05-02-roadmap-faq), Polymer team states:

> • For new projects, we suggest that you use LitElement (and if your project is an app, PWA Starter Kit, which incorporates LitElement).

> • We recommend that you update existing apps and elements to use Polymer 3.0.

What is your opinion about this? I know that converting a big application is not easy so is it worth it, or can you survive with Polymer 2?
Need tips to start Software Engineering <Post 2>
Tags: java, code, engineer, software
Published: 2018-05-24 09:21:15

---
title: Need tips to start Software Engineering <Post 2>
published: true
description: I have chosen a starter stack JAVA / JAVA EE / JAVASCRIPT 
tags: JAVA, Code, Engineer, Software
---
https://thepracticaldev.s3.amazonaws.com/i/jfbmdesig0gfdfqt5vs8.png

I have chosen my starter stack; My choice is JAVA as a starter stack , planning to learn :
 1. JAVA SE - for desktop app (even it's kinda depracted) : swing is no longer developed , java fx seems to be the new option reminaing
 2. JAKARTA is the new JAVA EE  - for web dev 
 3. JAVASCRIPT (and its children) for any frond-end tasks 
 4. Android (with JAVA) for mobile dev in Android ecosystem


#Questions (to perk):
 - where to host my JAVA starter projects online  ?
 - Where to host my JAVA commercial projects  ?
 - What is the real great learning path in JAVA WEB ? (I'm lost with all these JSP, JSF, Play Framework, Servlet, Spring, ...) Which one to pick ? Help me find the right path step by step.
 
##My most fleshly wish
As I said in the publication 1 of my Enginneer starter thread, I was for 7 years WebDesigner; more than CMS - Wordpress, Drupal, and out of it.
So I end up with a lot of projects on 100% PHP hosting like justhost or godaddy.
I do not know if it is possible but I will want to create web services in JAVA and consume them on each of the PHP PHP (with javascript). I can hoster all web services on a JAVA hosting and as that always take advantage of my PHP hosting.
###What do you think ?


This is my first challenge as a future Software Engineer, future JAVA Software Engineer. #MayMyWishComTrue

###Some examples of a website with a java backend that I appreciated :
http://www.univ-poitiers.fr/actualites/
https://www.pole-emploi.fr/accueil/
https://www.jacksonhole.com/ (used to turn in JAVA backend)

Thanks your advises and tips would be helpful !
Promise Explained like I'm 5.
Tags: javascript, explainlikeimfive
Published: 2018-05-24 09:11:30

---
title: Promise Explained like I'm 5.
published: true
description: A quick explanation of what promises does explained in simplest way possible.
tags: javascript, explainlikeimfive
---

This is based on my understanding of Promise, feel free to correct me if you think there's something wrong with my explanation :P

Now imagine yourself running an errand for your mom while she's out working. She told you two things:

1. Clean the house
2. Buy pizza for dinner

Your typical approach would be cleaning the house for whole day, afterwards go out of the house to buy some pizza. This process would take much time as you have to walk out of the house, wait in line just to get yourself some of that tasty pizza. 

A better way we could have done it is, call a pizza guy, and tell him to have the pizza delivered at certain time, and clean the house afterwards.

What does it have to do with promise? You have executed the pizza task without have to wait for it, then you go clean the house, after some time, the pizza may have arrived at same time you have finished cleaning the house.

TL;DR: Promise is (as far as I understand it) executing whatever process you have but without having to wait for an actually result.
ReactJS Class Components
Tags: react, javacsript, django, discuss
Published: 2018-05-24 09:01:23

---
title: ReactJS Class Components
published: true
description: Class Components of Reacts JS
tags: ReactJS,React,Javacsript,Django,discuss
---
Hello, I want to ask in ReactJS. What do you consider in making every Class Components in the project?

For example, I am making CRUD with SEARCH and using Backend with DjangoREST or other API Framework. So, I am requesting in the API everytime.

I want to know what components should I make to make the project well developed.

Thank you so much.
FEATool Multiphysics 1.8 - with OpenFOAM GUI and MATLAB CFD Interface
Tags: multiphysics, matlab, cfd, openfoam
Published: 2018-05-24 08:28:51

---
title: FEATool Multiphysics 1.8 - with OpenFOAM GUI and MATLAB CFD Interface
published: true
description: FEATool Multiphysics MATLAB FEM and CFD Toolbowith OpenFOAM GUI
tags: Multiphysics, MATLAB, CFD, OpenFOAM
---

The FEATool Multiphysics MATLAB and Octave FEM Simulation Toolbox (https://www.featool.com) version 1.8 is now available. In addition to being a fully integrated FEA multiphysics toolbox, and interfacing with the FEniCS FEM solver and external mesh generators such as DistMesh, GiD, Gmsh, and Triangle, the highlight of the new version is introducing a fully integrated and cross-platform OpenFOAM CFD GUI interface for MATLAB and GNU Octave.

The new OpenFOAM MATLAB CFD interface allows one to conveniently setup both laminar and fully turbulent incompressible Navier-Stokes CFD problems all within an easy to use graphical user interface (GUI). Featuring built-in CAD tools and (STL) CAD file import, automatic mesh generation (with automatic 2D to 3D mesh conversion and extrusion for 2D problems), FEATool to OpenFOAM case file conversion, solver selection and control, as well as solution import with postprocessing and visualization. As with all the FEATool MATLAB GUI functionality, models can also be saved and exported as m-file CLI functions where custom scripting and support for all MATLAB and Octave functions and toolboxes is supported. With the added support for the popular OpenFOAM CFD solver and FEniCS, high-performance multiphysics, multi-simulation, and CFD modeling can now be all be conveniently done within a single software interface.

Please visit http://www.featool.com/news/2018/05/17/FEATool-v1p8-with-OpenFOAM-Matlab-CFD-Solver-Interface.html for more information.

FEATool Multiphysics is developed by Precise Simulation Ltd. which was established in 2013 and is dedicated to providing accurate, efficient, and easy to use software solutions to a wide range of mathematical modeling, multiphysics, and computer simulation needs. In close collaboration with academic high-performance computing (HPC) partners with significant knowledge and over a decade of experience in many physics based Computer Aided Engineering (CAE) fields such as Computational Fluid Dynamics (CFD), Computational Structural Mechanics (CSM), chemical engineering, and heat transfer simulations Precise Simulation is able to offer a wide range of customized solutions.

The goal of the FEATool Multiphysics software suite is to be able to make physics based computer simulation easier and more enjoyable to learn for students in engineering, physics, and mathematics, and also simpler and more convenient to work with for both academic teachers, researchers, and corporate engineers.
Mocking frameworks for C/C++ on Linux
Tags: linux, testing, discuss, tdd
Published: 2018-05-24 08:28:17

---
title: Mocking frameworks for C/C++ on Linux
published: true
description: 
tags: linux,testing,discuss,tdd 
---
My team and I started working with mocking for C and C++ on Windows a few months ago, and we were using Typemock's Isolator++.
Now we decided to start working on Linux. Typemock recently released Isolator++ for Linux, so we naturally started working with it.
My question is: does anyone use Isolator++ for Linux and can tell me a little about the experience? if not, which mocking frameworks do you use on Linux?
Transducer Workshop Announcement
Tags: clojure, transducer, announcement, taiwan
Published: 2018-05-24 02:03:37

---
title: Transducer Workshop Announcement
published: true
description: Transducer Workshop Announcement, Clojure Taiwan Community
tags: clojure, transducer, announcement, taiwan
cover_image: https://thepracticaldev.s3.amazonaws.com/i/3vh42w9gm3qxcteynlzs.jpg
---

Sharpen your Clojure transducer skills and have fun.

# Where, When

There will be a transducer workshop during the Meetup of the [Clojure Taiwan Community](https://clojure.tw/) on May 30th 2018, at 19:45 (UTC+8).

# Live broadcast

The workshop (in English) will be interactive and will mainly consist in practicing implementing strange transducers. The workshop will be broadcasted live on the [community's Youtube channel](https://www.youtube.com/channel/UCuhNAPxr-iYeXcuT3qWg8Dw).

# Telegram

For those interested to join the event and ask questions, you can do so via the [community's Telegram channel](https://clojure.tw/tg).

# Be prepared

I invite you to prepare yourself before the workshop by reading [my blog serie on Transducers](https://dev.to/greencoder/build-your-own-transducer-and-impress-your-cat---part-1-mhp).
clink
Tags: actions, tools, cmd, console
Published: 2019-10-01 15:34:53

---
title: clink
published: true
tags: Actions,Tools,cmd,console
canonical_url: https://esabook.wordpress.com/2018/05/24/clink/
cover_image: https://esabook.files.wordpress.com/2018/05/clink.png
---

The good project where `we can provides rich completion, history, and line-editing capabilities. Readline is best known for its use in the well-known Unix shell Bash, the standard shell for Mac OS X and many Linux distributions.`  
[https://mridgers.github.io/clink/](https://mridgers.github.io/clink/)
Need tips to start software engineering <Post 1>
Tags: code, java, software, engineering
Published: 2018-05-24 00:56:58

---
title: Need tips to start software engineering <Post 1>
published: true
description: Student Learning alone programming and wishing to become Software Engineer (at home). I would like to have some tips for starting from scratch and designing a software efficiently.
tags: Code, JAVA, Software, Engineering
---

![](https://thepracticaldev.s3.amazonaws.com/i/n5q1uudov6xv4d9zp0j4.png)

#Step 1 - Ask your peers in the field

I'm about to start again, everything from scratch,..... Any pieces of advices about How to start efficient Software Engineering? Building solutions from analysis to modeling, from sketching to code.
I'm a newbie Software Engineer with no-degree, have been working in web Dev, already 7 years as a simple Web Designer (CMS stuffs). 
It's came to me that Web Design is boring , I want to put hands on dirty :)
Impatient to start again with JAVA stack (first) . Despite the fact I know that it's JS time I'd like to start by odd.


Thanks for your help !

Links, ressources, books would be appreciated.
How Destructuring Works in JavaScript💢💢💢
Tags: webdev, beginners, react, javascript
Published: 2018-05-24 00:35:05

---
title: How Destructuring Works in JavaScript💢💢💢
published: true
description: Destructuring in JavaScript
tags: webdev,beginners,react,javascript 
cover_image: https://cdn.pixabay.com/photo/2018/03/29/07/45/woman-3271591_960_720.jpg
---


*Destructing helps to write less code and easy way to access the properties in JavaScript.*



## Object destructuring.💔

**Suppose we have an object literal.**

```
let obj={
 name:'sai',
 show:true
                                              
} 
```

##### How can we access the properties in Object?

- The answer is we are using dot notation to access the object properties

Like we need to use **obj.propertyname or obj['propertyname']**

![](https://thepracticaldev.s3.amazonaws.com/i/oxpnmqpesmsql5zc7ss5.png)


**let's see the same thing using object Destructuring**

![](https://thepracticaldev.s3.amazonaws.com/i/t8ewvg0p1jqfcmg5vnea.png)


Have you seen in object Destructuring we are accessing the same property in an easy way instead of writing dot notation?


## Array Destructuring

 Let's see an example 

#### How can we access elements in an array?

- The answer is we are using its location like 0,1,2,3etc

![normal](https://thepracticaldev.s3.amazonaws.com/i/2htuck587p13rw4q8m1n.png)

The  **second thing we can access using arr['0']**

![string](https://thepracticaldev.s3.amazonaws.com/i/0srjrjw1rnf7qdhbuy0q.png)


Now we can access the same elements using Array Destructing instead of using its location every time.

![array destruturing](https://thepracticaldev.s3.amazonaws.com/i/kdmkt7pya9w3i49rlis1.png)




### How can we use Destructuring in functions?

let's see the example 

I'm passing the object as an argument to the function.

 Showing without destructuring
![func normal](https://thepracticaldev.s3.amazonaws.com/i/3oozjxxzignu57m5nbf2.png)


**The Same thing with Destructuring**

![func des](https://thepracticaldev.s3.amazonaws.com/i/g0ydfuu2syu3mqev3gm2.png)

In above code, we are destructuring the object in the function parameter itself.
Have you seen how much less code we write to access the same thing?


# Now we are moving to level deep 

### Nested destructuring💣

![](https://thepracticaldev.s3.amazonaws.com/i/00c7nzawn9y4vlr7y6ht.png)


It is bit easy instead of we don't need to write obj.show.items to access the items property.


Hope you guys enjoyed!!!!! If you have any doubts feel free to ask.
Happy coding........
Email template coding resources and tools
Tags: email, productivity, tutorial, webdev
Published: 2018-05-23 20:37:15

---
title: Email template coding resources and tools
published: true
description: There are many different ways to code your email template. Learn by example by looking at other people's code. Take advantage of libraries, template systems and frameworks.
tags: email, productivity, tutorial, webdev
---

There are different ways to code your email template:

* **Code from scratch, writing all of your CSS directly inline** - gives you a better handle of your code and makes it easy to troubleshoot later
* **Write CSS in head or an external file and use an inliner tool** - makes writing CSS easier and allows for more complex styling
* **Use a framework/system that compiles your HTML and CSS** - provides better management of more complex template building

Choose which way you're most comfortable with as that will become the most efficient way to do it over time. Learn by example by looking at other people's code. Take advantage of libraries, template systems and frameworks.

###[Check out my email template guide to getting started coding custom marketing email campaigns](https://blocksedit.com/email-template-guide/code/)
In VR, what is that "loading" animation called when you look at something that you can interact with?
Tags: help, vr
Published: 2018-05-23 20:24:06

---
title: In VR, what is that "loading" animation called when you look at something that you can interact with?
published: true
description: When you look at something you can interact with in VR, you see this loading animation for 3 seconds before it triggers. What is it called?
tags: help, vr
---

When you look at something you can interact with in VR, you see this loading animation for 3 seconds before it triggers a 'click' event. It prevents unwanted clicking every single thing you look at by requiring you to look at it for a few seconds. Kinda like a crosshair you see in computer games. What is it called? Does it even have a name?

I want to Google / CodePen a nice animation for my stereoscopic HTML5 video player but don't really know what to look for besides circle loading animations.
Rating StackOverflow Answers.
Tags: stackoverflow, github, nlp, discuss
Published: 2018-05-23 20:21:08

---
title: Rating StackOverflow Answers.
published: true
description: Automated Rating of StackOverflow answers.
tags: StackOverflow, Github, NLP, discuss
---
Fellow Devs, how would you like the idea of rating StackOverflow answers via answerers Github activity? Please sound off your thoughts below. (Consider this as for a pure research project)
Translating Integers Into An English String in Ruby
Tags: discuss, ruby
Published: 2018-05-23 19:21:41

---
title: Translating Integers Into An English String in Ruby
published: true
description: Let's write a script to change 127 to one hundred twenty seven for fun.
tags: discuss, ruby
---

I'm a huge dork. I was fiddling around on [repl.it](https://repl.it) to see if I could use it in next year's AP CS class (hey go volunteer with [TEALS](https://tealsk12.org)!) and I stumbled upon [this script](https://repl.it/@jmkoni/englishnumberold) from a year ago. Don't judge me too harshly! I don't even know what I was doing or why. After seeing the state it was in, I could not leave it alone. And apparently, I am in a better headspace now because I was able to refactor it fairly quickly and get it into a [much better state](https://repl.it/@jmkoni/Englishnumber). I did this heavily utilizing constants and recursion, but I'd be interested to see how others would solve this.

Here is the code if you don't want to bother with the repls:
{% gist https://gist.github.com/jmkoni/8b9633b0970978dfd8ea3d9c6078b3fa %}
How do you stay well-informed as a developer?
Tags: discuss, productivity, learning
Published: 2018-05-23 17:50:07

---
title: How do you stay well-informed as a developer?
published: true
description: What are some of your favorite resources for staying up-to-date as a dev?
tags: discuss, productivity, learning
---

Earlier today, @rrampage posted a great question about [good chat channels for developers](https://dev.to/rrampage/good-chat--online-channels-for-developers-3c8p).

In a similar vein, I've been wondering: How does one stay well-informed as a dev?

Personally, I think I'm _bad_ at this. I waste a lot of time dealing with firehoses of sub-par or tangential information&mdash;DEV.to being the notable exception, of course. 😉

1. What are some of your favorite resources for staying informed?
  * _Any medium (blog, newsletter, etc.) on any topic._
2. What tools or techniques do you use to efficiently manage these resources?

---

Was this helpful? Did I save you some time?

## {% cta https://www.adamlombard.com/support-me %} 🫖 Buy Me A Tea! ☕️ {% endcta %}

---