Friday, April 17, 2020

The Video converter I needed

Handbrake it's an open-source video transcoder and a lifesaver! 
For people that don't have a lot of time for transcoding or don't know a lot about video. I was trying to get working an OGM file on my TV and the format was not recognized by it. It even wasn't visible by Plex that is a great server-client app for organizing video.
So I decided to convert those stupid files. 
The solution... Handbrake it was like magic! 

It let me:
  • Choose the format to convert the files
  • Select various types of files
  • Remove annoying audio tracks on the file
  • Add some subtitles 
  • Force subtitles that were necessary for the video.
So I give you the link for this miraculous and simple app that lets you work on all your videos at once.

https://handbrake.fr/rotation.php?file=HandBrake-1.3.1-x86_64-Win_GUI.exe

The web site for this guy is https://handbrake.fr/ go check it out.

HandBrake logo

I hate the PDF format

The other day I was trying to get a graphical novel from the web but the only format that I found was PDF. In some manner, I was sure it was all that I needed but the PDF format was messing with the images on my Kindle Paper White. 

The solution: Extract the images.
The problem: PDF.

The PDF format is crap because everyone it's trying to get a piece of the action behind it. So every extractor, converter, or creator costs money, it's freemium(for paying later), or it's a scam. I searched for an open-source way of dealing with it and I came across this tool. It was fantastic!

Pkpdfconverter lets you export text images or text and images. This is done in an elegant and simple way. The interface looks kind of old, but it deserves to be checked out.

Here is the link to the project in Sourceforge:

https://sourceforge.net/projects/pkpdfconverter/


Tuesday, March 17, 2020

How Ghost and Wordpress disappointed me

I embarked on a journey to find the perfect blogging platform for my technical writing. After extensive research, I narrowed down my choices to two popular options: Ghost and WordPress. Both platforms promised a seamless blogging experience with powerful features, but, unfortunately, they both fell short of my expectations in different ways.

Ghost: The Minimalist's Dream-Turned Nightmare

Ghost is often praised for its simplicity and speed. As a developer, I was drawn to its clean interface and markdown support. However, my experience quickly turned sour due to several key issues:

  1. Limited Customization: While Ghost's minimalist design is appealing, it comes at the cost of flexibility. Customizing themes and plugins required more effort than anticipated. The lack of a rich plugin ecosystem meant I had to write custom code for even basic features, which was time-consuming.
  2. Cost: Ghost's pricing model is subscription-based, which can be a significant expense for individual bloggers or small businesses. The cost of hosting Ghost on their official platform or self-hosting with proper infrastructure quickly added up, making it less appealing compared to other options.
  3. SEO Limitations: Despite its simplicity, Ghost lacked some essential SEO features out of the box. Implementing advanced SEO strategies required additional plugins or custom development, adding to the complexity and cost.


WordPress: The Jack of All Trades, Master of None

WordPress, on the other hand, is known for its versatility and extensive plugin ecosystem. It seemed like the perfect solution for any blogging need. However, my experience was marred by several frustrations:

  1. Performance Issues: WordPress sites can become sluggish, especially when loaded with multiple plugins and themes. Despite using various caching solutions and performance optimizations, I found it challenging to maintain a fast-loading site, which is crucial for user experience and SEO.
  2. Security Concerns: The vast number of plugins available for WordPress is both a blessing and a curse. Many plugins are poorly maintained or have security vulnerabilities, making WordPress sites a frequent target for hackers. Keeping the site secure required constant vigilance and updates.
  3. Complexity: While WordPress offers unparalleled flexibility, it also comes with a steep learning curve. Configuring and managing a WordPress site, especially for non-technical users, can be overwhelming. The admin interface is cluttered, and finding the right plugins and themes often felt like searching for a needle in a haystack.


In the end, both Ghost and WordPress had their strengths and weaknesses. Ghost's simplicity and speed were offset by its lack of customization and higher costs, while WordPress's versatility was hampered by performance issues, security concerns, and complexity. My experience with both platforms left me searching for a better solution that could strike the right balance between ease of use, customization, and performance.

I am still on the lookout for the perfect blogging platform that meets my technical needs without compromising on user experience and security. If you have any recommendations, I'd love to hear them!

Tuesday, December 18, 2018

Free DNS setup for a domain showing a Blogger web page


I was very busy with some configuration for a friend's blog on Blogger.
She was paying a fee for the DNS redirect from her national DNS service to blogger, and I help her to stop paying for that.

I'll write the steps to reproduce the free DNS setup via CloudFlare, that by the way its an excellent way to manage the DNS for free.

Step 1
In the first place, you need to add the domain to Cloudflare after creating an account in Cloudflare.
After that, we must provide the DNS of Cloudflare to our national domains service, usually, they are:

fred.ns.cloudflare.com
pola.ns.cloudflare.com

Step 2
The next step it's to locate the "configuration area" in Blogspot > Settings > Basic > Publishing >  Blog Address > "+ Set up a third-party URL for your blog - Point your own registered URL to your blog."

Step 3
In there is an input box for setting your domain URL including the subdomain www o blog or whatever... after you put it, it will throw an error and a description and link that downloads a text file that has all the information for upload to the DNS configuration in cloud flares the links says "DNS settings file", the content of the file looks something like this:


  • @ 3600 IN A 216.239.32.21
  • @ 3600 IN A 216.239.34.21
  • @ 3600 IN A 216.239.36.21
  • @ 3600 IN A 216.239.38.21
  • www 3600 IN CNAME ghs.google.com
  • 6n3klf7wtapc 3600 IN CNAME gv-3srif7ga7v6d4w.dv.googlehosted.com


This configuration shows to Blogger that you own the Domain and your point that domain from your DNS to Blogger.

Step 4
The importation of this config it made via a tool of Cloudflare in the tab DNS in DNS Records we look for the Advance button and after that, it will show a configuration panel with a button for Upload DNS File.

We select out just download DNS configuration file from Blogger and Cloudflare configures the DNS for us as Blogger wishes.

Step 5
Wait a while for DNS to deploy return to Blogger and insist on Step 3, it should now take the configuration of your domain and check that you own it. 

Step 6
In Blogger check on the checkbox that says Redirect from the domain alone to the domain with www or blog or whatever...

Step 5
In the same screen in Blogger check for HTTPS > HTTPS Availability and HTTPS Redirect. And put yes in both.

Step 5.1
And as an add-on, you can redirect in the Page Rules tab add the complete URL/Description of the domain and the redirect 301 that it's permanent to the URL with https and www.

NativeScript/Angular for dummies (practical guide)


Soo I begin to wonder what to write next and the response now that I know that Phone/Cordova it's a stinky pile of s... is clear to me now...

This is a thing that I'll surely regret try or write for in some years but let's begin with some easy tutorial for NativeScript.

The way I see it the only cool wat to see this is via the internal app for the playground of the team: Playground NAtivescrip Android for practically we will use Android because we all know that iOS sucks. First, let's install the CLI
npm install -g nativescript
The requirements for a full build of an app are here:
https://docs.nativescript.org/angular/start/quick-setup
Then we proceed to make a new app:
tns create HelloWorld --template tns-template-blank-ng
And for last we try to see our magnificent app in the preview panel:
tns preview
This will throw a QR code that we can scan with our playground app and the app will just pop up in the phone. Well, that's for now, a little guide to make a new app in NativeScript/Angular. See you next time.

Saturday, March 15, 2014

Making a scraper in Node.js...

Let's make a multi link crawler for a multi page query in a web page listing jobs opportunities.

First let's make a module of it, in a separate file from our server in node whatever it is and we gonna call it with

var worker = require('worker.js');

It will be called with this sentence from our express router or whatever you are using.

First we gonna need two libraries 

var request = require("request");
var cheerio = require("cheerio");

One for making requests more easy(request) and another for making jQuery available on the server side(cheerio).

Now we need the list of pages of the main web site, this one makes a default paged list with the jobs listed that day in in one link, and paginates on base of that link so...

var url = "http://www.bumeran.com.ar/empleos-publicacion-hoy.html";

Now for exporting this function to the node server we gona make a "start" function and export it.

In this example we gona make a request to the url of before and read the body with cheerio taking the 
number of pages of that list from the paginator in the bottom. 

Then we send that number of pages to the scraper function 

exports.start = function(req, res) {
    request(url, function() {
        return function(err, resp, body) {
            if (err && resp.statusCode == 200) {
                console.log(err); //throw err;
            }
            $ = cheerio.load(body);
            var pages = $(".paginador.box a:nth-last-child(2)").text().trim();
            console.log(pages); 
            scraper(pages);
        };
    });
};  

The function scraper must have the variable url by the number of page in this case it gona be:

var url = "http://www.bumeran.com.ar/empleos-publicacion-hoy-pagina-" + NUMBEROFPAGE + ".html";

The function scraper will only recive the number of pages from the scraping from before.

It will read every list in every page, and send specific links to the pages with the job descriptions to the scraperLinks function this process will be asynchronously by the nature of node.js. 

function scraper(pages) {
    for(var i = 0; i < pages ; i++){
        var url = "http://www.bumeran.com.ar/empleos-publicacion-hoy-pagina-" + (i + 1) + ".html";
        request(url, ( function(i) {
            return function(err, resp, body) {
                if (err && resp.statusCode == 200){
                  console.log(err); //throw err;
                }
                $ = cheerio.load(body);
                $(".aviso_box.aviso_listado").each(function(index, tr) {
                    console.log("Scrapping..." + $(this).attr("href")); 
                    scraperLinks($(this).attr("href"));
                });
            };
        })(i));
    }
}
NOTE: We are sending the value from "i" to the function as a value itself not a ref because it would not work as expected for the asynchronously way of work.


For last scraperLinks will get every link to a details page and get the info we need with plain jQuery:

function scraperLinks(link) {
            var url = "http://www.bumeran.com.ar" + link;
            request(url, function(err, resp, body) {
                    if (err && resp.statusCode == 200) { console.log(err); } //throw err;
                    $ = cheerio.load(body);            //console.log(body); 
                    var location = $('.aviso-resumen-datos tr td').last().text().trim(); // $('#.aviso-resumen-datos tr').last().find( "a" ).text();
                    var detail = $("#contenido_aviso p:nth-child(2)").text();//$("#contenido_aviso p").first().text();
                    var title = $(".box h2").first().text().trim();
                    var date = $(".aviso-resumen-datos tbody tr td").first().text().trim();
                    console.log("Saving..." + url); 
                    saveAd(url, location, detail, title, date);
                });
        }  

In this case we get title, date, and details from the published job, and send it to the saveAdd funtion that will recive the values and store them in any way posible. 

Well that's all 

Monday, July 1, 2013

The file conversion solution!

So... Last night, I was dealing with a stupid pdf file, this one in particularly was having a core data for a my next app, a perfectly well formed xls inside a stupid pdf file, the solution:

http://www.zamzar.com/

In seconds I was able to convert every file to xls, now the next problem after export the formatted xls to csv, was the conversion to json itself. That I resolve with this web app:

http://www.convertcsv.com/csv-to-json.htm

So the steps are various, but the effort its minimal.

Good luck with your conversions!

bye

Tuesday, June 25, 2013

Check if Mongoose it's already conected


You can tell if mongoose is already connected or not by simply checking:
if(mongoose.connection.readyState){}
0 = no
1 = yes

Monday, June 24, 2013

Error ! [rejected] master -> master (non-fast-forward) on Heroku/Git

$ git push origin master
# To https://github.com/user/repo.git
#  ! [rejected]        master -> master (non-fast-forward)
# error: failed to push some refs to 'https://github.com/user/repo.git'
# To prevent you from losing history, non-fast-forward updates were rejected
# Merge the remote changes (e.g. 'git pull') before pushing again.  See the
# 'Note about fast-forwards' section of 'git push --help' for details.
This error can be a bit overwhelming at first, do not fear. 
Simply put, git push -f https//github.com/user/repo.git to force the upload.

Tuesday, June 4, 2013

Mini Tutorial Node.js, Express, and Jade.


I was having some problems deploying some jade web pages over Node.js with Jade template engine.
So I'm leaving a small tutorial for not forgetting what i have done so far...

Let's see first install everything we need:

>npm install express
>npm install jade

Now we have the pieces lest make the directory structure for this project, just add the directories "views" and "public" we will save the static things in public, like JavaScript and CSS files and jade views in views. Pretty obvious right...
Now lets write some server code...

var app = express();
app.configure(function(){
    app.set('port', process.env.PORT || 3000); //set the port
    app.set('views', __dirname + '/views'); //set views dir
    app.set('view engine', 'jade'); // set the template engine
    app.use(express.favicon()); //set the favicon
   app.use(express.static(path.join(__dirname, 'public'))); //set the public dir for static content
});
app.get('/', function(req, res){
  res.render('index.jade', {title: 'Jade Example'}); //sends title to the template and renders it
});
app.listen(3000);

Let's make some views...
First the layout: layout.jade
!!! 5
html
  head
    title= title
    link(rel='stylesheet', href='/css/bootstrap.css')
    link(rel='stylesheet', href='/css/bootstrap-responsive.min.css')
  body

   header.site-header
     a.logo(href='/', title='Express, Jade and Stylus') Express, Jade and Stylus
       nav.site-nav
         ul.nav
           li.current
             a(href='/', title='Home') Home
    block content
p
  | Created by 
  a(href='http://http://grimaldigerardo.blogspot.com.ar/') Gerardo Grimaldi

Then a simple index: index.jade

extends layout

block content
  h1 = title
  p Welcome to #{title}


The bootstrap css it's inside the public directory in: '/public/css/bootstrap.css'
All ready, let's take it for a spin...

node app.js


Bye


Monday, May 27, 2013

Let's send some mails via Node.js

In my Android app I'm having a unique comments section from the users to contact me, they send comments and messages to my mail via this layout...




Now lets see i want to send a mail, with this three fields, to myself, via my app... I know!
An get request to a server, sending this three fields in a mail to myself!

Let's do this... first of all... lets fins a library that sends mails
bingo!  Nodemailer it s very appropriate for this task...
https://github.com/andris9/Nodemailer
https://npmjs.org/package/nodemailer

Lets's install it..

I use Cloud9 for developing in Node.js the pros are enough and the ide just IDE just works it coud debug in real time, and it got an console with some practice you can make a server and deploying it in no time, now lets see install node mailer.

Node has npm (node package manager) it resolves the dependencies via the Package.json or installing the stuf directly into the app via the npm install <name_of_the_library>, we gona use that for our app.

Just get inside the console and type : npm install nodemailer

This will install the necessary stuf for call the library inside the app.

Now let's make a js file that sends files

var nodemailer = require("nodemailer");
var smtpTransport = nodemailer.createTransport("SMTP",{
    service: "Gmail",
    auth: {
        user: "me@gmail.com",
        pass: "pass"
    }
});
var mailOptions = {
    from: "Server <me@gmail.com>", // sender address
    to: "me@gmail.com", // list of receivers
    subject: "", // Subject line
    text: "", // plaintext body
    html: "" // html body
};

exports.mailOptions = mailOptions;
exports.sendMail = function () {
    smtpTransport.sendMail(mailOptions, function(error, response){
        if(error){
            console.log(error);
        }else{
            console.log("Message sent: " + response.message);
        }
        /* if you don't want to use this transport object anymore, uncomment following line
        //smtpTransport.close(); // shut down the connection pool, no more messages*/
    });  
};
Note: This example is almost identical to the one in the page of the library in Github my server is set in this one.

Now this library exposes itself like a public atribute in a class via the "exports". I assign to them the the methods and properties I want to access from another js file in this case the server one I want for principal obviously requiring it first...

Let's go for the server itself...
var express = require('express');var mail = require("./nodemail");var app = express();
app.use(express.logger());
app.get('/mail/:name/:subject/:text/:securitytoken', function(req, res) {
    if (req.params.securitytoken != 'Salt742!') return res.send('Error: Wrong password...');    try {        newMail(req.params.name,req.params.subject, req.params.text);    }    catch(err) { onError(err); }});
app.listen(process.env.PORT);
function newMail(name, subject, text) {    mail.mailOptions.subject = 'Message from User: ' + name +  ' with Subject : ' + subject;    mail.mailOptions.text = text;    mail.sendMail();}
function onError(err) {    console.log(err);}
console.log('Server HTTP Listening on port ' + process.env.PORT + '...');

Well I'm gona explain this mess:
  1. First we use 'express' for listen to the get requests.
  2. In the get request we read the fields im sending from the app an one security token
  3. First of all we read the token and compare it to the one we got.
  4. Then we load the the data in the function newMail this one will set the values in the nodemail.js 
  5. After this we call the function in nodemail.js that will trigger the mails.
Well people that's all for now. I want some feedback, so please let me know if this is useful for you people out there. Or what would you like to see next in the blog. 

Bye.


Saturday, May 25, 2013

Next app...



I'm having a new app deploying to the Android Play Store. This experiment it's a result of Node.js, Heroku and Android.
The app gets his resources from a scrapper in node.js, with a timer for working some times in the week, i will give some explanation of how this works later on.

The app saves every value the app needs into a MongoDB database, and the second server delivers this data to the Android client via Json and Rest techniques that gives some velocity to develop of the server and adds simplicity that can be lost in more complex models. This is all for now I'll post some code in short.

Bye



  

Deploying my little node.js server to Heroku

Once I got every piece of my app in node.js working. 
I though on deploying  and the best way to do so for me for the scalability and easiness only Heroku comes to my mind:











So lets prepare the environment:

First we open an account on https://www.heroku.com/

Once we have it we need to install the Heroku client the tools for making a deploy https://toolbelt.heroku.com/

Now lest start...

Lets strep into the folder :
>cd myapp

Add everyting to git:
>git init
>git add .
>git commit -m "first commit"

In case of not having an app 
>heroku create

In the case of having an app lets add it wit the name
>heroku git:remote -a myapp

The app needs two things before the upload a:  


  • Procfile : A single file indicating wich file the server must start, with the command web: node server.js 

  • And a Package.json a json structured file indicating name version and package dependencies it must be something like this
        {
            "name": "NodejsServer",
            "version": "0.0.1",
            "dependencies": {
                "express": "3.1.x"
            },
            "engines": {
                "node": "0.10.x",
                "npm": "1.2.x"
            }
        }


Now lets deploy, it's so simple as this...
>git push heroku master

Heroku alone will install the dependencies via the data in the Package.js and then run the app from server.js as it says in the Procfile.


Happy deploy.... bye!

The Video converter I needed

Handbrake it's an open-source video transcoder and a lifesaver!  For people that don't have a lot of time for transcoding or don...