Skip to main content

Posts

Firebase - update a spacific fields of single element of object of array in firestore

Firebase - update a spacific fields of single element of object of array in firestore  Its actully advisable to use map instead of array when ever it is possible. But, there are cetain cases where you don't have option to do so.  For example, you are directly saving the response from some outer source without any modification and they send you an array. In this case you will have array to work with. Firestore does not support array here is why  "bad things can happen if you have multiple clients all trying to update or delete array elements at specific indexes. In the past, Cloud Firestore addressed these issues by limiting what you can do with arrays " For more details information you can refer to Kato Richardson post Best Practices: Arrays in Firebase .  Firestore document having array [ used from stackoverflow question ] Suppose you have array of object something like shown in array. Now you want to update endTime field of the object on the inde...

mailgun forward incoming mail

Mailgun is email service provider. For detail infomration about mailgun you can visit its site mailgun.com . Untill my last project( blogger-editor.xyz ) i was just using mailgun sending mails. There was no need to receive emails on that domain. But in blogger-editor.xyz , I need to have a domain based email address on which i should send and receive email. Its quite straight forward setup to receive email through mailgun. Just you have to do these two things : Make sure your mx record points to mailgun. [ It should be ticked verfied on mailgun dns verification ] Setup route on mailgun MX Record setup with Domain Registrar In domain verification and Dns section of mailgun you will find that you have to setup two mx record with your domain service provider. mxb.mailgun.org ( priority 10 ) mxb.mailgun.org ( priority 10 ) During creation of mx record you will be asked for host. Host value for your record is the @ if you are using root domain with mailgun , and it w...

Find count of day differance between two dates

In golang there is no direct way [ atleast i don't know ] to find count of differance in days between two days. So, I do it the way might every one does [ except who has already faced this ]. Partial Solution What I does is just find out duration differance of two dates using sub function. differance := time.Now().Sub( startTime ) daysCount := int(differance.Hours() / 24.0) It might seem ok. But, there is a problem with this solution.  Let assume, startTime is 2018-02-02 23:59:59 .   In this case daysCount will be 0 on next day [ 2018-02-03 ] until time is 2018-02-03 23:59:59. Perfect Solution Simple solution is just normalize startTime to starting of that date . normalizedTime := time.Date(startTime .Year(),startTime .Month(),startTime .Day(), 0, 0, 0, 0, time.Local) differance := time.Now().Sub( normalizedTime ) daysCount := int(differance.Hours() / 24.0) normalizedTime is startTime but at starting of date. So, Now we are subs...

Setup forward proxy in apache2

Proxy word is noramally used for forward proxy. It forwards requst to other server and pass downs the response to the client. This post is not supposed to describe the differneace between forward and revsers proxy.  But if you want to find out exact differance you can refer this stackoverflow post.   https://stackoverflow.com/questions/224664/difference-between-proxy-server-and-reverse-proxy-server To setup forward proxy on your apahce2. you have to install [ if you are on linux ] / enable [ if you are using windows ] modules mod_proxy.so mod_proxy_ajp.so mod_proxy_balancer.so mod_proxy_connect.so mod_proxy_http.so mod_slotmem_shm.so mod_ssl.so [ If I am includeing any extra please corrent me. But I had to eanble all this modules. ] You have to make virtual host for proxy forward < VirtualHost *: XX  > ProxyRequests On ProxyVia On < Proxy * >   Require all granted < /Proxy > </VirtualHost...

Packfolder : archive your resource of sciter based application

Packfolder packfolder is utility provided as part  sciter-sdk . It compresses resources folder under a single file of the format of your choice ( should support by packfolder ).  Currently, the supported output formats are Syntex, [path]\packfolder.exe [resource-folder] [resource-file].[ext] -V [name-of-variable] -[output-format] For example, Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. PS 08-packfolderIntro> .\packfolder.exe res res.go -v resources -go Source Code   08-packfolderIntro

Use packfolder to archive your resource

In commit 25d8ed42e0bb4c4acb742de9f148f6902d32ff41 go-sciter SDK has added one new facility which automatically resolves file path for archived data . Now you can use archived data from the archive and it will resolve import by itself, as it does for c & c++. Packfolder packfolder is utility provided as part sciter-sdk. It compresses resources folder under a single file of the format of your choice ( should support by packfolder ). Currently, supported output format files are bin ( normal binary file ) an array of bytes in c, go, d and rust language.  Syntex is , [path]\packfolder.exe [resource-folder] [resource-file].[ext] -V [name-of-variable] -[output-format] path = full / relative path to packfolder.exe to execute command resource-folder = full/relative path to the folder inside which your resouce is contained resource-file  = name of the file you want as your output file  name-of-variable = it will the name of the varilble that will iniated with the a...

Remove console screen for your gui application written in go

Remove console screen for your gui application written in go Images of appliaction used as example is notepad plus minus. I writen as example. To get details of this program you can visit post " Simple document based application with golang " You write a GUI application and it runs with a console screen behind. It looks pretty weird, right! I mean what is the meaning of a console when console actually not going to interact with the user.  GoLang Gui Application with Console Screen Don't know how this works on Mac or Linux as I have not done this on either Mac or Linux. But for windows, I find a way to compile console-less GUI application for golang.  Just build the application with this argument. go build -ldflags "-H=windowsgui" ldflags used to set build time variable. Now. in the upper statement we are saying golang that current application we are building is windowsgui application so don't create the console with it. J...