Cryptographically secured HTTP lambda invocations

A lambda function invocation is when the caller supplies a piece of code to a function, for then to have the other function execute the code the caller supplied. In the following video, I am illustrating how you can securely transmit code over the web, to another server, for then to have the other server execute your code (securely), and return the result of the invocation back to the client. As an additional bonus, all the traffic is encrypted between both parties.

The whole idea is based upon combining two simple ideas; Cryptographic signatures guaranteeing the invocation originated from some trusted party - And sandbox execution environments, assigning rights on a "per keyword level" to some other party, as long as he can establish the code originated from him or her. As a bonus, everything is encrypted back and forth, preventing a malicious adversary to understand what the clients are communicating about. The whole thing works due to cryptographic signatures, being a lookup into "which sandbox" the client is allowed to play in. Hence, a public cryptography key is associated with elevated rights, associated with a particular client.

[CSF] OfficeFloor: Going Beyond Dependency Injection

So why another Dependency Injection (DI) framework? Because Dependency Injection is only part of the Inversion of (Coupling) Control problem. OfficeFloor provides the complete injection solution.

Dependency Injection Problem

Dependency Injection on it's own can actually promote lower cohesion and higher coupling. Why, because Dependency Injection provides undisciplined short cuts to get references to objects. I need a repository to retrieve some data, I just inject it. I need some logic to work out some result, I just inject it. Overtime with on going improvements to systems, everything starts to reference everything else. Changing the interface of one thing becomes difficult, as so many things just pull it in (higher coupling). Furthermore, because it is so easy to "just inject" dependencies, convenience starts polluting single purpose logic of classes (lower cohesion).

Mediator Design Pattern In Java

Let's finish some remaining design patterns to cover this topic. Today, I will discuss another design pattern - Mediator Design Pattern.

Mediator Design Pattern

  • The Mediator Design Pattern is one of the Gang of Four design patterns which is used to control and reduce complexity of communication among groups of objects.
  • The Mediator Pattern is a behavioral pattern which defines an object to encapsulate the interaction between objects.
  • The Mediator Pattern helps us to reduce chaotic dependencies between objects. 
  • The Mediator pattern helps us to restrict any direct communication between the objects and allow us to collaborate objects only via a mediator object.
  • By using Mediator object we can control communication between objects.
  • The Mediator object also hides the complexity of communication between objects.
  • The Mediator pattern defines a mediator class to handle all the communications between different classes. That also supports easy maintenance of the communication related code by using loose coupling.
  •  The Chatting Application is a good example of Mediator pattern where a group of chat users communicates with each other via the char server.
  • The Whatsapp is another good example of the Mediator pattern. Whatsapp server handles all the communication between different whatsapp users.
  • Air Traffic Control System is also another great example in which all flights doing takeoff or landing communicates with the Air Traffic Control to manage their safe and smooth movement.

mediator design pattern

Let's take an example of communication between different workers; each one is assigned to a dedicated type of job to perform. We will see how they can communicate with others with the help of manager for the jobs they are not doing. I will not use multi-threading or network related code just to make the example as simple as possible. 

How to Deal With Difficult People on Your Teams

Humans are social creatures who seek personal validation based on how others interact with them. We feel good and important when others share our belief system and dejected when there's a conflict of opinions.

It's then natural to want to work with people who are just like us, our clones.

So, every once in a while when we come across people who do not value our inputs, crush our ideas, ignore what we have to say, act as a know-it-all, seem to find pleasure in criticism, satisfaction in creating chaos and look for the negative side of things, it upsets us.

9 Best WordPress Facebook Plugins to Grow Your Blog

Are you looking for the best Facebook plugins for WordPress?

Facebook is the world’s largest social media platform with more than 2 billion monthly active users. That’s why there are many WordPress Facebook plugins that can help you maximize your online presence.

In this article, we have hand-picked the best WordPress Facebook plugins to grow your website and get more traffic.

Best Facebook plugins for WordPress

Editor’s Note: If you’re looking for chatbot or messenger bot plugins, then please see our list of the best chatbot software for small businesses.

1. Smash Balloon Custom Facebook Feed Pro

Smash Balloon Custom Facebook Feed Pro

Smash Balloon Custom Facebook Feed Pro is the best Facebook plugin for WordPress. It lets you connect your WordPress site to your Facebook account with the click of a button.

With Custom Facebook Feed Pro, you can easily add your Facebook posts to any WordPress post, page, or sidebar. It comes with multiple layout choices with easy to use styling options.

You can take full control of your feed. You can choose to hide things like comments, likes, reactions, and shares.

It supports multiple feeds, so you can use them in different areas of your site. This plugin works with both Facebook pages and groups and helps you drive more engagement towards your Facebook community.

You can also use it to display your Facebook user reviews, embed your Facebook photo albums, create a carousel, and more.

Note: There’s also a free Facebook Feed plugin by Smash Ballon with limited features that you can use.

2. RafflePress

RafflePress

RafflePress is the best contest and giveaways plugin for WordPress. It lets you easily run a contest where people need to take specific actions to enter.

Contests are one of the fastest ways to get a ton of likes and engagement for your Facebook page. RafflePress comes with a built-in giveaway template for growing your Facebook page.

To enter your contest, people will need to visit your page on Facebook and/or view one of your posts or videos.

It comes with a drag and drop contest builder where you can simply add actions and assign them different numbers of entries into the contest.

You can also use it with other popular social media platforms like Twitter and Instagram, or run giveaways to grow your email list.

RafflePress lets you easily draw a winner, too. In fact, you even get a link to email the winner from inside the app itself.

3. Shared Counts

Shared Counts

Shared Counts is one of the best social media plugins for WordPress. It allows you to easily add social sharing buttons to your WordPress posts. This includes buttons for Facebook, Pinterest, Twitter, LinkedIn, and more.

It is highly optimized for speed and performance and can accurately show shares count for different social sites. It even comes with multiple button styles. This means you can choose the style that looks best on your site.

4. Pixel Cat – Conversion Pixel Manager

Pixel Cat – Conversion Pixel Manager

Pixel Cat – Conversion Pixel Manager allows you to add Facebook retargeting pixel to your WordPress site. This pixel allows you to show customized ads to Facebook users who have visited your website.

Pixel Cat also helps you track WooCommerce customers and show them better ads in their Facebook feed.

There’s also a Pro version that gives you extra power and flexibility.

5. Social Reviews and Recommendations

Social Reviews and Recommendations

Social Reviews and Recommendations lets you display Facebook page reviews on your WordPress website. It comes with an easy to use widget that allows you to connect your website to your Facebook page and display Facebook users’ reviews.

This helps you add social proof to your website and build trust in your brand. The free version works fine, but you will need to pay for the ‘Business’ version to display reviews in the Schema.org rich snippets format.

6. Facebook Page Like Widget

Facebook Page Like Widget

Facebook Page Like Widget allows you to easily add a Facebook page plugin to your blog’s sidebar. It is extremely easy to use and comes with a shortcode that you can use to display the Facebook Like box anywhere on your website.

It comes with the same customization options as the default Facebook page plugin. You can show or hide profile pics, include your page cover, customize width and height, and select language.

7. Nextend Social Login and Register

Nextend Social Login and Register

Nextend Social Login and Register plugin allows users to register and login on your website using their social profiles. It supports login with Facebook, Google, and Twitter.

This plugin works seamlessly with the default WordPress login and registration forms. Users have the option to use Facebook or use the default signup method. Once registered, a user can disconnect their social account at any time by visiting their user profile page inside the admin area.

8. FAuto Poster

FAuto Poster

FAuto Poster allows you to automatically share new articles on your Facebook page or profile. Upon activation, you will need to connect it to your profile and authorize your website.

It allows you to choose which content you want to share: posts, pages, and custom post types. You can even disable sharing for a single item before publishing it.

FAuto Poster is a lightweight plugin that’s quick and easy to install and configure. There’s also a pro version, which lets you automatically post to Twitter, LinkedIn, and Tumblr as well as to Facebook.

9. Social Snap

Social Snap

Social Snap lets you automatically post your content to Facebook. You can use it for other social media sites as well, including Instagram, Twitter, and LinkedIn.

It doesn’t just work for your new content, either. You can also use Social Snap to automatically re-share older content. That way, you can drive more traffic to content you’ve created in the past.

Social Snap also lets you add social links to your posts and pages and display follower counts. This can be a great form of social proof and can help grow your Facebook following.

Bonus: All in One SEO

All in One SEO

All in One SEO is one of the best WordPress SEO plugin on the market. It has a huge range of features that let you optimize your content to rank higher in search engines.

Although it’s not a social media plugin, we’ve included it as a bonus on this list for one very important feature. All in One SEO lets you add Open Graph metadata to your content. This means you have more control over how your content displays when it’s shared on Facebook.

Using All in One SEO, you can set a custom image thumbnail to appear alongside your content on Facebook. You can even give your content a different title or description to use on Facebook. Most importantly, it fixes the incorrect thumbnail issue on Facebook.

We hope this article helped you discover the best WordPress Facebook plugins to grow your blog. We also recommend going through our proven tips to drive traffic to your WordPress site, and our comparison of the best email marketing services to connect with your readers.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post 9 Best WordPress Facebook Plugins to Grow Your Blog appeared first on WPBeginner.

Python 3 programing, Plurality voting.

Python 3 programing, Plurality voting.

Help Please!!!

I need the code for this type of voting method in python 3. I attached the csv file, also the name of the csv file is heroes.csv.

https://drive.google.com/file/d/1ObV7L9FVM-Bdek26YTzS8IzHKQsZx-rT/view?usp=sharing

Plurality voting

This is the conventional one person, one vote method we use today in most elections. In this case, the winner of the election is the candidate that gets the most votes. To implement this method using our data, you need to count only the top-ranked hero for each survey entry (the one with a ranking of 1) and add up

Zk SDK -error 1053: the service did not respond in a timely fashion

Dear sir,
i got a TFT device attendance 3.5 inch and iam using SDK 6.2.4.11 iam using windows 10 LTSC Enterprize 64 bit
when running , i created a windows service on it when i try to run it, it does not work and cause an error 1053 :Error 1053: "The service did not respond in a timely fashion ... ,is there any conflict between windows 10 Enterprize and the SDK that i am using
i attach my service that iam registering to windows 10 64 bit Enterprize(64 bit) i try it on windows 10 pro-64 bit (my personal computer) and it is working , is there any prerequisite files should i install on the client computer(where the problem occurs)

also i attach the sdk iam using , iam deploying the service on my personal computer and run it on the client computer

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Timers;
using System.IO;
using System.Threading.Tasks;
using Oracle.ManagedDataAccess.Client;
using Oracle.ManagedDataAccess;
using zkemkeeper;

namespace Att_Service2
{
    public partial class Service1 : ServiceBase
    {
        //Timer timer = new Timer();
        //public zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
        //public zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
        //ZkSoftwareEU.CZKEUEMNetClass axCZKEM1 = new ZkSoftwareEU.CZKEUEMNetClass();
        zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();        
        private bool bIsConnected = false;//the boolean value identifies whether the device is connected
        private int iMachineNumber = 1;//the serial number of the device.After connecting the device ,this value will be changed.
        ServiceController service = new ServiceController("Atten_Service2");
        Timer timer = new Timer(); // name space(using System.Timers;)  
        //string IP = "192.168.0.201";
        //int Port = 4370;
        string sdwEnrollNumber = "";
        int idwTMachineNumber = 0;
        int idwEMachineNumber = 0;
        int idwVerifyMode = 0;
        int idwInOutMode = 0;
        int idwYear = 0;
        int idwMonth = 0;
        int idwDay = 0;
        int idwHour = 0;
        int idwMinute = 0;
        int idwSecond = 0;
        int idwWorkcode = 0;

        int idwErrorCode = 0;
        int iGLCount = 0;
        int iIndex = 0;
       // string TNS = "DATA Source=192.168.0.2:1521/ORCL;USER ID=PROKEM;Password=PROKEM";
        //     string       TNS1 = "DATA Source=136.243.14.106:1521/ORCL;USER ID=ELMASSALLA;Password=ELMASSALLA";

        public Service1()
        {
            InitializeComponent();
        }
        protected override void OnStart(string[] args)
        {
            // WriteToFile("Service is started at " + DateTime.Now);
            timer.Elapsed += new ElapsedEventHandler(OnElapsedTime);
            timer.Interval = 600000; //100 seconds instead of 10 seconds   --
            timer.Enabled = true;


        }
        protected override void OnStop()
        {
            // WriteToFile("Service is stopped at " + DateTime.Now);
        }

        public void sendToOracle(int iMachineNumber, string sdwEnrollNumber, int verifyMode, DateTime Date, OracleConnection ora)
        {
            int c1;
            string ID;
            int Code;
            c1 = iMachineNumber;
            ID = sdwEnrollNumber;
            Code = verifyMode;
            DateTime ATT;
            ATT = Date;
            OracleCommand oracmd = new OracleCommand();
            oracmd.CommandText = "insert into TA_ATTENDANCE_SHEET_LOG(c1,ID,Code,ATT) values(:c1,:ID,:Code,:ATT)";
            oracmd.Connection = ora;
            try
            {
                //ora.Open();
                // MessageBox.Show("Connection Successfully");
                oracmd.Connection = ora;  //must take open connection
                oracmd.Parameters.Add(":c1", c1);
                oracmd.Parameters.Add(":ID", ID);
                oracmd.Parameters.Add(":Code", Code);
                oracmd.Parameters.Add(":ATT", ATT);
                oracmd.ExecuteNonQuery();
                //  MessageBox.Show("data inserted successfully");
                //DataTable dt = new DataTable();
                //OracleDataAdapter da = new OracleDataAdapter("select * from  Dummy", ora);
                //da.Fill(dt);
                //dataGridView1.DataSource = dt;
                WriteToFile("Data inserted successfully  at " + DateTime.Now);

                oracmd.Dispose();

            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message.ToString());
                WriteToFile(ex.Message+" at "+ DateTime.Now +"  Fail to insert in table");
            }

        }//end function 

        public void WriteToFile(string Message)
        {
            string path = "C:\\Logs";
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            //AppDomain.CurrentDomain.BaseDirectory +
            string filepath =  "C:\\Logs\\ServiceLog_" + DateTime.Now.Date.ToShortDateString().Replace('/', '_') + ".txt";
            if (!File.Exists(filepath))
            {
                // Create a file to write to.   
                using (StreamWriter sw = File.CreateText(filepath))
                {
                    sw.WriteLine(Message);
                }
            }
            else
            {
                using (StreamWriter sw = File.AppendText(filepath))
                {
                    sw.WriteLine(Message);
                }
            }
        }

        private void OnElapsedTime(object source, ElapsedEventArgs e)
        {
            //zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
            //ZkSoftwareEU.CZKEUEMNetClass axCZKEM1 = new ZkSoftwareEU.CZKEUEMNetClass();  update 
            //IP =
            string TNS;
            string IP;
            //////////////////update 1-9-2020   to read from text file the Attendance Machine IP and the connection string 
            //data in file should be like 
            //DATA SOURCE = 192.168.2.240:1521 / ORCL; USER ID = ASCON; Password = ASCON-192.168.2.74-
            string totalData = File.ReadAllText(@"c:\Data\Att1.txt"); //read information for attendance Machine1 

            try
            {
                //int index = totalData.IndexOf("-");
                //TNS = totalData.Substring(0, index - 1);
                //IP = totalData.Substring(index+1,totalData.Length-1);
                int index = totalData.IndexOf("-");
                int lastindex = totalData.LastIndexOf("-");
                int IPlength = lastindex - index - 1;
                TNS = totalData.Substring(0, index).ToString().Trim();
                IP = totalData.Substring(index + 1, IPlength).ToString().Trim();
                ///TNS = "DATA SOURCE = 192.168.2.240:1521 / ORCL; USER ID = ASCON; Password = ASCON";
                // IP = "192.168.2.74";
                //MessageBox.Show(TNS + "    " + IP);
                ///TNS = "DATA SOURCE = 192.168.2.240:1521 / ORCL; USER ID = ASCON; Password = ASCON";
                // IP = "192.168.2.74";

            }
            catch (Exception ex) { WriteToFile("No file exist or revise the format to be like  DATA SOURCE = 192.168.2.240:1521 / ORCL; USER ID = ASCON; Password = ASCON-192.168.2.74-   the file path is  c:\\data\\Att1.txt");return;}



            /////////////////////////////////////////////////////////////////////////////////////

           //uncomment this OracleConnection ora = new OracleConnection(TNS);
            //uncomment this OracleDataAdapter ODA;// = new OracleDataAdapter();
            DataTable dt = new DataTable();
            DataTable All_Data = new DataTable();
            string sdwEnrollNumber = "";
            int idwTMachineNumber = 0;
            int idwEMachineNumber = 0;
            int idwVerifyMode = 0;
            int idwInOutMode = 0;
            int idwYear = 0;
            int idwMonth = 0;
            int idwDay = 0;
            int idwHour = 0;
            int idwMinute = 0;
            int idwSecond = 0;
            int idwWorkcode = 0;
            int idwErrorCode = 0;
            int iGLCount = 0;
            int iIndex = 0;

            int Port = 4370;
            bool bIsConnected;
            int iMachineNumber = 1;
            string insertSQL;

            try
            {

              //  ora.Open();
              //  WriteToFile("Connected to Oracle Server " +DateTime.Now);
            }
            catch (Exception ex) { WriteToFile(ex.Message.ToString()+"  "+TNS); return; }

            //1-Oracle Connection 
            //                // uncomment OracleConnection ora = new OracleConnection(TNS);
            //                //uncomment OracleCommand oracmd = new OracleCommand();


            //2-MAchine Connection 

            try
            {
                //bIsConnected = axCZKEM1.Connect_Net(IP, Port);
                //if (bIsConnected == true)
                //{
                //    WriteToFile("Connected to attendance "+IP + DateTime.Now);
                //    //                    //btnConnect.Text = "DisConnect";
                //    //                    //btnConnect.Refresh();
                //    //                    //lblState.Text = "Current State:Connected";
                //    iMachineNumber = 1;//In fact,when you are using the tcp/ip communication,this parameter will be ignored,that is any integer will all right.Here we use 1.
                //    axCZKEM1.RegEvent(iMachineNumber, 65535);//Here you can register the realtime events that you want to be triggered(the parameters 65535 means registering all)

                //}


            }
            catch (Exception ex)
            {
                WriteToFile("Fail to connect to attendance Machine"+IP+":"+Port + DateTime.Now);


            }
            //3- Get Data From Attandance Machine

            try  ///////////today
            {  ////////////////today
                while (axCZKEM1.Connect_Net(IP, Port) != true) ;//****New check connection TCP
                WriteToFile("Connected to attendance "+DateTime.Now.ToString());

                //axCZKEM1.RefreshData(iMachineNumber);//********New 
                axCZKEM1.EnableDevice(iMachineNumber, false);//disable the device today
                WriteToFile("Device Disabled " + DateTime.Now.ToString());
                while (axCZKEM1.ReadAllGLogData(iMachineNumber) != true) ;//**New i added a loop instead of if (axCZKEM1.ReadGeneralLogData(iMachineNumber)) also ch
                                                                  //also changed the Read Generallog to read log
                                                                  //{
                WriteToFile("Begin Loop " + DateTime.Now.ToString());
                while (axCZKEM1.SSR_GetGeneralLogData(iMachineNumber, out sdwEnrollNumber,out idwVerifyMode,
                                out idwInOutMode, out idwYear, out idwMonth,out  idwDay, out  idwHour, out idwMinute, out idwSecond, ref idwWorkcode))//get records from the memory
                    {
                        //                        //insert into Oracle DB 
                        DateTime Date = Convert.ToDateTime(idwYear.ToString() + "-" + idwMonth.ToString() + "-" + idwDay.ToString() + " " + idwHour.ToString() + ":" + idwMinute.ToString() + ":" + idwSecond.ToString());
                    //  WriteToFile(Date);
                    //MessageBox.Show(iMachineNumber + "-" + sdwEnrollNumber + "-" + Date);
                    /*Commented on 18-7-2020 
                    WriteToFile(iMachineNumber+"-"+ sdwEnrollNumber+"-"+ idwInOutMode+"-"+ Date);
                    ODA = new OracleDataAdapter("select  *  from  dummy where ID='"+ sdwEnrollNumber + "' and ATT='"+Date+"'", ora);
                    ODA.Fill(dt);
                    if(dt.Rows.Count<1)
                    sendToOracle(iMachineNumber, sdwEnrollNumber, idwInOutMode, Date, ora);
                    dt.Clear();
                      */
                    //     MessageBox.Show("inserted Successfully");

                    //18-7-2020 Added 
                    /////TA_ATTENDANCE_SHEET_LOG

                    //test -send the data to oracle without any checking 14-10-2020
                    //sendToOracle(iMachineNumber, sdwEnrollNumber, idwInOutMode, Date, ora);

                    //if(Convert.ToInt16( sdwEnrollNumber)==14476)
                    try
                    {
                      //  if (Convert.ToInt16(sdwEnrollNumber) == 14476)
                            WriteToFile(iMachineNumber + " " + sdwEnrollNumber + " " + idwInOutMode + " " + Date);
                        //else WriteToFile("");
                    }
                    catch (Exception ex) {
                        //WriteToFile("Fail to Write to File...");
                        //if (!(service.Status.Equals(ServiceControllerStatus.Stopped)) ||!(service.Status.Equals(ServiceControllerStatus.StopPending)))
                        //              service.Start();
                        // if(service.Status==ServiceControllerStatus.Running)  service.Stop();
                        WriteToFile("Exception");

                    }
                    /* i commented this part to send the data direct to Oracle 14-10-2020
                      try
                          {
                              WriteToFile("begin checking dummy table for redundancy data...");
                              ODA = new OracleDataAdapter("select * from TA_ATTENDANCE_SHEET_LOG where ID='" + sdwEnrollNumber + "'", ora);
                              if (All_Data.Rows.Count > 0) All_Data.Clear();
                              ODA.Fill(All_Data);//this is one record
                          }
                          catch (Exception ex) { WriteToFile(ex.Message.ToString() + " at " + DateTime.Now); }

                          ////pass the datatable to the funtion checkifexist to check the timestamp also 
                          int val = Checkifexist(ora, sdwEnrollNumber, Date, All_Data);
                          WriteToFile("value of redundancy " + val.ToString());
                          if (val == 0)
                          {
                              sendToOracle(iMachineNumber, sdwEnrollNumber, idwInOutMode, Date, ora);
                          }

                         */

                }//end while
                WriteToFile("End Of while loop");
                axCZKEM1.EnableDevice(iMachineNumber, true);
                axCZKEM1.Disconnect();//***New
                  //uncomment this  ora.Close();
               // }


     //           else
       //         {
                    //                    // MessageBox.Show("Error in reading Data ");           
                    /// ///  WriteToFile("Service Error " + DateTime.Now);
      //          }



            }
          catch (Exception ex)
          {
                if (service.Status == ServiceControllerStatus.Running) service.Stop();
                WriteToFile("error " + ex.ToString()+ " at "+DateTime.Now.ToString() );
          }//today


        }//end function 
        public int Checkifexist(OracleConnection ora, string EnrollNum, DateTime dt, DataTable All_data)
        {
            OracleCommand oracmd = new OracleCommand();
            OracleDataReader DR;
            DataTable dt1 = new DataTable();

            string d;
            foreach (DataRow dr in All_data.Rows)
            {
                d = dr["ATT"].ToString(); //the ATT column - Date column-



                if (!Convert.ToBoolean(d.CompareTo(dt.ToString())))
                {
                    WriteToFile("Added new log:"+EnrollNum+" at "+d.ToString());      
                    return 1; //the value exists   in ORacle
                }

            }
            return 0; //the value does not exist
        }




    }//end class
}//end namespace`