Zero waste: trucchi per riciclare (la memoria) meglio

Talk Qui potete vedere il talk che ho fatto insieme a Francesco Panico durante il Pycon.it 2024 PDF Previous Next     / [pdf] View the PDF file here. Elevator pitch Un talk sul riciclaggio? In un certo senso si! Parleremo infatti del peggior spreco per un dev: quello di memoria. Esploreremo il funzionamento del GC e gli algoritmi alla base del suo funzionamento. Impareremo alcune tecniche per analizzare e ridurre il consumo di memoria del nostro codice....

June 16, 2024 · 4 min · Carlo Bertini [WaYdotNET]
#Best Practice #python #Performance #CPython #Debugging #Code Analysis
Separare l’interfaccia dall’implementazione, una delle regole d’oro dell’OOP. Come applicarla in un linguaggio tipizzato dinamicamente come Python? Un’introduzione allo Structural Subtyping e all’utilizzo dei Protocol

Coding to interfaces: Structural Subtyping in Python

Talk Qui potete vedere il talk che ho fatto insieme a Francesco Panico durante il Pycon.it 2023 PDF Previous Next     / [pdf] View the PDF file here. Elevator pitch Separare l’interfaccia dall’implementazione, una delle regole d’oro dell’OOP. Come applicarla in un linguaggio tipizzato dinamicamente come Python? Un’introduzione allo Structural Subtyping e all’utilizzo dei Protocol Descrizione Per coding-to-interfaces si intende una best practice della OOP che consiste nel separare la definizione di una classe (interfaccia) dalla sua effettiva implementazione....

June 15, 2024 · 3 min · Carlo Bertini [WaYdotNET]
#Best Practice #python #Clean Code #Static Analysis #Type-Hinting

Use Sqlite Instead of Db in Memory to Verify Foreign Key

How to check check Constrains in test ? Todo: i need to insert some description :D When we need to check check, we need to use Sqlite provider When use providers: using System; using System.Threading.Tasks; using Bogus; using Microsoft.EntityFrameworkCore; using TrackingConsumerService.Data; using TrackingConsumerService.Data.Models; using Xunit; namespace TrackingConsumerService.Test.Fixture { public class DbContextFixture : IDisposable { public MyDbContest DbContext { get; private set; } public DbContextFixture() { var options = new DbContextOptionsBuilder<MyDbContest>() ....

June 15, 2024 · 1 min · Carlo Bertini [WaYdotNET]
#csharp #dotnet

Use Padrino and sprockets with sprockets-helpers

Thanks to @arthur_chiu and his post on how to integrate sprockets in Padrino with sprockets-helpers, i’ve create my version :D:D:D:D 1) Create padrino-sprockets in config/sprockets.rb module Padrino::Sprockets def self.registered(base) base.set :sprockets, ::Sprockets::Environment.new(Padrino.root) # Add folder base.sprockets.append_path 'assets/javascripts' base.sprockets.append_path 'assets/stylesheets' base.sprockets.append_path 'assets/images' base.set :digest_assets, true # compress file if PADRINO_ENV == 'development' base.sprockets.js_compressor = Uglifier.new(mangle: true) base.sprockets.css_compressor = YUI::CssCompressor.new end # sprockets-helpers base.helpers Sprockets::Helpers # We can configure \`sprockets-helpers\` to find the correct assets for us....

June 14, 2024 · 2 min · Carlo Bertini [WaYdotNET]
#ruby

Padrino 0.11.0 Released - Padrino Lives!

The Padrino team is very pleased to finally be able to announce the 0.11.0 release of the Padrino Framework! We have been working on this release for almost a year now and we have had dozens of contributors helping us stabilize Padrino. We know our release cycle got out whack and this version took too long to release. We all take accountability for that and will work to pick up release momentum and release patch and minor versions more often....

March 23, 2013 · 1 min · Carlo Bertini [WaYdotNET]
#ruby

Usage ImageSorcery with CarrierWave by gem

CarrierWave::ImageSorcery https://github.com/WaYdotNET/carrierwave-imagesorcery Additional processing to use ImageSorcery into CarrierWave. Installation Add this line to your application’s Gemfile: gem ‘carrierwave-imagesorcery’ And then execute: $ bundle Or install it yourself as: $ gem install carrierwave-imagesorcery Usage To use those, you should include specified module (ImageSorcery) into your uploader and use processors: class AvatarUploader < CarrierWave::Uploader::Base include CarrierWave::ImageSorcery ….. end Method implemented convert dimensions resize_to_limit resize_to_fit resize_to_fill resize_and_pad Example class Uploader < CarrierWave::Uploader::Base...

August 22, 2012 · 2 min · Carlo Bertini [WaYdotNET]
#AiS #ruby

The library is a simple API in Ruby for Microsoft Translator V2

MsTranslate The library is a simple API in Ruby for Microsoft Translator V2 The Microsoft Translator services can be used in web or client applications to perform language translation operations. The services support users who are not familiar with the default language of a page or application, or those desiring to communicate with people of a different language group. Installation Add this line to your application’s Gemfile: gem ‘ms_translate’ And then execute:...

March 13, 2012 · 2 min · Carlo Bertini [WaYdotNET]
#AiS #gems #github #ms_transalte #OpenOttica #ruby #ruby #rubygems #tips #traduttore #translate #wrapper

Padrino-admin Twitter Bootstrap v2.0 is ready

(Padrino Admin TwitterBootstrap 2.0) Padrino-Modal: rack-flash and delete function into modal :D highlights error field tof helper: Automatic replace true or false with relative image (list.slim and list.haml) Breadcrumbs Automatic time_ago_in_words when column model is created_at or updated_at Migrate function for MiniRecord Padrino-Modal All result from rack-flash and delete request, now is automatic insert into modal javascript plugin highlights error field tof_helper Automatic replace true or false with relative image (list....

February 2, 2012 · 1 min · Carlo Bertini [WaYdotNET]
#AiS #bootsrtap #github #OpenOttica #padrino #padrino-admin #padrinorb #ruby #ruby #twitter #twitter bootstrap

Padrino Admin another new layout (based on Twitter Bootstrap v2.0-wip)

http://glowing-leaf-7114.heroku.com/admin/ user: test@padrinorb.com pass: test PLEASE DON’T CHANGE LOGIN/PASSWORD Additional feature: ✔ Padrino-Modal: rack-flash and delete function into modal :D ✔ highlights error field ✔ tof helper: Automatic replace true or false with relative image (list.slim and list.haml) ✔ Breadcrumbs ✔ Automatic time_ago_in_words when column model is created_at or updated_at ✔ Migrate function for MiniRecord clone my repository and enjoy :D https://github.com/WaYdotNET/padrino-framework See the code and comment please !!!!

January 30, 2012 · 1 min · Carlo Bertini [WaYdotNET]
#AiS #github #OpenOttica #padrino #padrino-admin #padrinorb #ruby #ruby #twitter #twtitter-bootstrap #waydotnet

Padrino Admin new layout

Hi to all, i’ve publish my version of padrino admin… based on Twitter Bootstrap Login page: Welcome page List user: clone my repository and enjoy :D https://github.com/WaYdotNET/padrino-framework comment please :P

October 24, 2011 · 1 min · Carlo Bertini [WaYdotNET]
#ruby #ruby padrino padrino-admin github #Script