MM revelation

This page is not finished, for now it is only a bunch of notes.

How it started?

(meetup Andrew Gray)
Meetup group title: “FREE – LIFE CHANGING EVENTS & SEMINARS IN LONDON”
Title of the meetup: Learn how to make a min of $5k p/m passive income! Exclusive opp ENDS 11th 7pm!!

Learn how to make a min of $5k p/m passive income! Exclusive opp ENDS 11th 7pm!!

Saturday, Jul 22, 2017, 3:00 PM

Location details are available to members only.

13 Members Attending

****Third PRE LAUNCH event – Not sure if there will be another one! *****Hello everyone, Andrew Gray, the Founder of this group here. I have an EXCLUSIVE opportunity from my mentor Eric Ho – (Google him, he is a serial entrepreneur!).I am not going to say much here, but there is the potential to earn a minimum of $5,000 per month, passive income,…

Check out this Meetup →

The meetup post contains only a link. The link get you to a registration form.

Place, revealed by email 1 day before.
Plaza River bank
forced to be there soon
5 emails with a stupid video (I’m exciting, pre-launh, like Facebook) before the event.

auditorium
water (no beer, orange joice or something to eat)

yuhuuu, gimme five and big smile, and videos and photos all the time.

high volume music
Singer, horrible pop music, promotion of her album
another singer,

A women was the speaker and then present Eric Ho.
It is like in the videos on youtube.
Good speaker, bla bla bla and trickes to get attention.
Bla bla bla. Some photos
At 24 years old he was financial independent.
Some images with cars (some out of the shop winmdow!)
Some in SPA or yatch (clearly not his, because he was not manouvering”).
A lot os self-videos, some embarassing for the stupidity.

He present Mister Wong. An idiot that has 20 million like for a video on youtube, So? How can this makew ME rich?

All the time generic questions to the crowd and “raise your and if/who”…

All the links in the email before the event are tracked with funnel.

SQL Server connection fails

– IDK: I don’t know
– Y: yes
– N: no

Which version is your SQL Server ?
– I don’t know
– 2016
– 2014
– 2005

Are you using an IP in the conenction string?
– Y
– N

Is the application that need to conenct on the same machine of SQL Server ?
– Y
– N

Are you using a Trusted conenction?
– IDK
– Y
– N

Are you using “localhost” as server name?
– IDK
– Y
– N

Do you know which connection string are you using?
– IDN
– Y
– N

Are the TCP inbound/outboundport allowed for port 1433?
– IDN
– Y
– N

The Login user in SQL Server is allowed to connect and login?
– IDN
– Y
– N

+ A001: use “(local)” instead of “localhost”
+ A002: check this: https://support.microsoft.com/en-us/help/328306/potential-causes-of-the-sql-server-does-not-exist-or-access-denied-err
+ A003: use “(local)” or instead of the IP address
+ A004: check this settings in Server/Security/Logins/User/(right click)/Properties/(Status section)
[attach image]

Connection fail to SQL Server after a database restore

Scenario.

Restore SQL Server database X.
Try to conenct using the usual connection string. Conenction fail.

Yes
Yes
Delete the user in “Security” of SQL Server.
Delete the user from the “Users” of the database.
Create a new user in Server/Securit6y/Logins:
– User name: seelct a user that exists in the machine, ex.: \user
– leave everything unchaged
Create a user in the database in database/Security/Users:
– Login namne: seelct <achine\
– User name: select \
No
Todo
> Yes
< Do you use an IP address in the connection string?

in the database:
– User name: select / using hhe selector
– Login name:
– Default schema:
> No
Yes
Check the user defined in the Application Pool of the current web site
> No
Todo
> No
Todo

MVC API tests – manage unknown error raised by HttpServer

Scenario: integration tests against ASP.Net MVC API.
MVC version 5.2

Create a base class test to manage the repetitive API GET/POST calls like:

protected HttpResponseMessage Execute(HttpMethod method, string url, T data)
{
url = BASE_URL + url;

HttpRequestMessage request = new HttpRequestMessage(method, url);
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

JsonMediaTypeFormatter formatter = new JsonMediaTypeFormatter();
formatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
if (method == HttpMethod.Post && data != null)
request.Content = new ObjectContent(data, formatter);

using (var server = new HttpServer(GetConfiguration()))
using (var client = new HttpClient(server))
{
var response = client.SendAsync(request).Result;
return response;
}
}

Boom.

500. Internal server Error.

The server is set like this:
private HttpConfiguration GetConfiguration()
{
HttpConfiguration configuration = new HttpConfiguration();
//var dependencyResolver = new WindsorDependencyResolver(container);
//configuration.DependencyResolver = dependencyResolver;
WebApiConfig.Register(configuration);

// remove all HostAuthenticationFilter due to the error “no OWIN Authentication manager…”
foreach (var filter in configuration.Filters.Where(f => f.Instance is HostAuthenticationFilter).ToList())
configuration.Filters.Remove(filter.Instance);

return configuration;
}

mmhh… try to debug:
It enter in the ApiController, get the data from the REpository and it exit from the class with a nice colelction of data… what is wrong ???

Routing is ok, it is actually passing the request to the right controller.
Injection of repositories is ok, it is fetching and returning data.
Log4Net is ok, I’m not calling the “log4net.Config.XmlConfigurator.Configure();” without a proper configuration in app.config.

Adding “configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;”
is absolutely useless for this problem.

What to do now?

I’ll check one of 2 or 3 previous project where I’ve already done this a where I spent 1,2 or 7 days to figure out this ALL THE TIMES fucking problem !

What I think is wrong in Python

datetime.now() vs datetime.today()

datetime.today() returns a datetime WITH the time part.
datetime.now() returns a datetime WITH the time part.
So…
from datetime import datetime
now = datetime.now()
today = datetime.today()
print(now)
print(today)

In other languages today is used to return a date time WITHOUT the time part.

Output:
datetime.datetime(2017, 6, 24, 21, 11, 27, 374230)
datetime.datetime(2017, 6, 24, 21, 12, 1, 166053)

filter(filter_rule, collection) vs filter(collection, filter_rule)

filter(lambda x: x > 1, []) is Correct.
filter(lambda x: x > 1, []) is Wrong.

I expect to have filter(what, how), that means filter(collection, filter) followinth the “pattern” Object.Action.
I think the form filter(collection, filter_rule) is more intuitive.

%y %m %d is embarassing

Every time I have to parse or format a string to a date I need to read the documentation carefully.

Paypal exchange rate

I recently made some payments with paypal that requires the GBP currency.
I have added the GBP currency to my Paypal account.
I have a debit and a credit card in GBP currency (HSBC) that I use everyday.
I was not able to add these cards to Paypal. The process return the error “This card is not accepted. Please use a different card”.

I noticed that Paypal apply a particular disparaging exchange rate.
I usually use this site, xe.com that is more accurate of Google.
I concede they can use a little different exchabge rate, just enough to not loose money, but these differences seems exagerate to me.

Date Paypal XE.com Google Paypal diff
12 Jan 2017 0.81837 0.85198 8.85 + 3.94 %
10 Jan 2017 0.8196 0.85181 0.85 + 3.78 %

To calculate the percentage difference I used this formula:
Diff % = ((official_rate-paypal_rate) / official_rate) * 100

GIT Merge vs Rebase

Merge

When you merge a branch into another you apply both the changes done in the two branches to the final one.
In the picture example there is a merge of the changes in C4 and C5 resulting in C6.
It is a 3 way merging because it involves the common origin commit C3.

Rebase

When you rebase a branch on another you apply the specific commit of the branch on the one you are.
In the picture example the changes in C5 are reapplied to the commit C4 resulting in C5.

Differences

The result of the two operations is the same.
The goal to use Rebasing is to have a cleaner history of the changes, as they appear executed sequentially instead of in parallel.

My 2 cent

Imagine this situation.
You have done 10 changes on a branch called “Create modal dialog for new Order”.
You rebase the commits of this branch on the master branch.
For the commit “Add form validation on save button click” how someone can understand which “save” button you are talking about ?
If the reabase put all the commits under the main branch how can I see the work done for a specific feature/bug ? Detaching the commits from a specific branch seems a loose of information to me.

References: https://git-scm.com/book/en/v2/Git-Branching-Rebasing

Once upon a time… software programmer

Job roles:
• Software developer (junior, medium, senior)
• Principal developer
• Lead Developer
• Team leader
• Tech leader
• Software engineer (junrior, medium, senior)
• Softwaree architect
• Business analyst (junrior, medium, senior)
• Full stack developer
• Front end developer
• Back end developer
• Developer manager
• Devops
• VP Engineer

Areas:
• FinTech – Financial & Capital Markets
• SciTech – R&D, Life Science & Medical Devices
• ConsulTech – Media, Telecoms, e-commerce
• DigitalTech – Business Consulting, Integrators & Vendors
• CriticalTech – Critical Infrastructure, Energy, Defence & Government

Microsoft ASP MVC 5

In MVC 5 Microsoft introduced the Attribute Routing functionality.
With it defining the Route for an Action become immediate and there is the advantage to be more safe when you change a routing, you cannot break previous routing rules.
To enable it you have to call the MapMvcAttributeRoutes() method on the RouteCollection.
GlobalConfiguration.Configuration.MapHttpAttributeRoutes();

Constraints on parameter type become more simple to define.
You can define optional parameters and default values more simply too.

Another feature I use all the time is the RoutePrefix: you can define the “controller” segment on the router only on the Controller definition, making more simple and readable changing the routes on the Actions.

You can continue to restrict the HTTP verbs allowed for an Action using [HttpGet], [HttpPost] and [AcceptVerbs]. This permits to have the same URL route for different Actions; for example you can request for the existence of a file (using HEAD) and to downlod the file (using GET) using the same URL.

[Route("Ping"), AcceptVerbs("Head", "Get")] 
public ActionResult Ping() {     return Content("pong (" + Request.HttpMethod + ")"); 
}

Sources:

  1.  https://blogs.msdn.microsoft.com/webdev/2013/10/17/attribute-routing-in-asp-net-mvc-5