<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: medsaid2001</title>
    <description>The latest articles on DEV Community by medsaid2001 (@medsaid2001).</description>
    <link>https://dev.to/medsaid2001</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F849086%2Ffd573c6f-c927-4a7c-a62c-e6b33224b70c.png</url>
      <title>DEV Community: medsaid2001</title>
      <link>https://dev.to/medsaid2001</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/medsaid2001"/>
    <language>en</language>
    <item>
      <title>how to paginate a table</title>
      <dc:creator>medsaid2001</dc:creator>
      <pubDate>Mon, 24 Oct 2022 00:42:16 +0000</pubDate>
      <link>https://dev.to/medsaid2001/how-to-paginate-a-table-3ng0</link>
      <guid>https://dev.to/medsaid2001/how-to-paginate-a-table-3ng0</guid>
      <description>&lt;p&gt;I'm not that good with PHP but I want to paginate a table that gets its data from JSON. I'm using livewire. can someone help&lt;/p&gt;

</description>
    </item>
    <item>
      <title>ICON CONVERTER</title>
      <dc:creator>medsaid2001</dc:creator>
      <pubDate>Sun, 07 Aug 2022 15:40:00 +0000</pubDate>
      <link>https://dev.to/medsaid2001/icon-converter-53do</link>
      <guid>https://dev.to/medsaid2001/icon-converter-53do</guid>
      <description>&lt;p&gt;Most computer imaging software provides several formats for images, including .ico files. These are regular icons, typically used for Applications, sites, or games. These .ico files can be used for print advertising as well. If you wish to utilize an image as an icon on a device or computer screen, you must first convert it to the icon format. There are several ico converter tools available to assist in the creation of the icon.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Photoshop
&lt;/h2&gt;

&lt;p&gt;Adobe Photoshop can be used to create pictures and edit pictures, but as an icon editor, it is not as intuitive as it could be. The solution is to download a &lt;a href="https://www.mediacollege.com/adobe/photoshop/plugins/ico/"&gt;free plugin&lt;/a&gt; that is easy to acquire and simple to install. To install the plugin, download the zipped package and, when requested, place it in the Photoshop Plugins folder. When the installation is finished, restart Photoshop. Open the JPG picture file that you wish to use as an icon. To create the icon, simply save the file with the file extension.ico using the plugin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use an Online Converter
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.seosniffer.com/ico-converter"&gt;ICO Converter&lt;/a&gt; is a free online tool that will convert any picture file into an icon. Convert a PNG, GIF, or JPG into icon files. This program does not need to be downloaded, which adds security to the process of downloading web software packages onto your computer. You may use ICO Converter to convert a single image or a group of images. It can also merge PNG pictures into a single icon or divide an &lt;a href="https://www.seosniffer.com/ico-converter"&gt;icon&lt;/a&gt; into images. To load the picture files into the application&lt;/p&gt;

&lt;h2&gt;
  
  
  Build Your Code
&lt;/h2&gt;

&lt;p&gt;In the last few years, I've grown to love the C# programming language; creating an ico converter is as easy as writing a few lines of code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;static void Main(string[] args)
        {
            string image_read_path = Directory.GetCurrentDirectory()+"\\image.png";
            string image_save_path = Directory.GetCurrentDirectory()+"\\image.ico";
            if (File.Exists(image_read_path))
            {
                using (FileStream stream = File.OpenWrite(image_save_path))
                {
                    try
                    {
                        Bitmap bitmap = (Bitmap)Image.FromFile(image_read_path);
                        Icon.FromHandle(bitmap.GetHicon()).Save(stream);
                        Console.WriteLine("File Converted");
                        Console.ReadKey();
                    }catch(Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        Console.ReadKey();
                    }
                }
            }
            else
            {
                Console.WriteLine("File Not Found");
                Console.ReadKey();
            }


        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Reversing Youtube Algorithm</title>
      <dc:creator>medsaid2001</dc:creator>
      <pubDate>Thu, 28 Apr 2022 17:09:46 +0000</pubDate>
      <link>https://dev.to/medsaid2001/reversing-youtube-algorithm-1hn0</link>
      <guid>https://dev.to/medsaid2001/reversing-youtube-algorithm-1hn0</guid>
      <description>&lt;p&gt;is this a good idea or a bad one?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2rgMJQ5G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ym2esnchudcn3yenyda6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2rgMJQ5G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ym2esnchudcn3yenyda6.png" alt="Image description" width="742" height="783"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Coding is Not Enough</title>
      <dc:creator>medsaid2001</dc:creator>
      <pubDate>Tue, 19 Apr 2022 18:53:30 +0000</pubDate>
      <link>https://dev.to/medsaid2001/coding-is-not-enough-2bp6</link>
      <guid>https://dev.to/medsaid2001/coding-is-not-enough-2bp6</guid>
      <description>&lt;p&gt;SEO is a technique that can have multiple benefits. For instance, it could drive more traffic to your own website. Additionally, SEO could help you get more job opportunities - either in your career or as a freelance writer. &lt;/p&gt;

&lt;h2&gt;
  
  
  What Is SEO and Why Does It matter?
&lt;/h2&gt;

&lt;p&gt;Search engine optimization is the process of improving your website’s visibility in &lt;a href="https://blog.seosniffer.com/posts/serp"&gt;search engine results pages (SERPs)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It’s the process of making your website’s content, design, and overall experience more visible in the SERPs so that more people are able to find and come to your site. SERPs are the front page of the internet, and the best way to get there is through an optimized website. &lt;br&gt;
think of it like, you interrogate your database and apply filters to the results. This way, you can get a more accurate portrayal of the data at your fingertips. &lt;/p&gt;

&lt;p&gt;The best results from Google comes from websites that are written with deliberate SEO in mind. In order to get the best results from Google, your website must be optimized for the top seeds in each search query. The best way to do this is with a focused focus on improving the content, design, and overall experience of your site.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Does SEO Work?
&lt;/h2&gt;

&lt;p&gt;To achieve success with SEO, you need a general understanding of the process, as well as a few SEO-specific terms. The following are some of the most important terms you need to know to optimize your site for success on the internet.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://seosniffer.com/keyword-explorer"&gt;Keyword research&lt;/a&gt;: During the content writing process, it’s important to know what search queries your audience is asking for. You can do this by using keywords research to discover what topics your potential customers are interested in.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://try.alexa.com/seo-tutorials/keyword-gap-analysis"&gt;Keyword gaps&lt;/a&gt;: When you know what topics are popular, it’s time to start filling in the gaps. This can be done through keyword research or through in-depth content analysis.&lt;/p&gt;

&lt;p&gt;In the next article, I will discuss how I combined my knowledge of SEO and coding to create a successful website.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Morphotop Library</title>
      <dc:creator>medsaid2001</dc:creator>
      <pubDate>Mon, 18 Apr 2022 05:01:25 +0000</pubDate>
      <link>https://dev.to/medsaid2001/morphotop-library-3057</link>
      <guid>https://dev.to/medsaid2001/morphotop-library-3057</guid>
      <description>&lt;p&gt;A while ago, I got my hands on the executable file of the morphotop. The morphotop is a fingerprint reader that can read all of the fingerprints in your hand. After playing with it for a while, I managed to build a C++ library that can communicate with the device.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include "BDS_Common.h"
#include "BDS_OS.h"
#include "BDS_Interface_XCS.h";
#include &amp;lt;iostream&amp;gt;

extern "C" __declspec(dllexport) int LoadLib(TCHAR *file, void ** o_pp_handle)
{
    HINSTANCE h_lib = LoadLibrary(file);
    *o_pp_handle = NULL;
    if(h_lib == NULL)
        return ERROR_LOADLIBRARY;
    *o_pp_handle = h_lib;
    return 0;
}
extern "C" __declspec(dllexport) int GProcAddress(void * i_p_handle,char * i_pc_method, void ** o_pp_procaddress) {
    void * l_p_proc;
    l_p_proc = GetProcAddress((HINSTANCE)i_p_handle,i_pc_method);
    if(l_p_proc == NULL)
        return ERROR_GETPROCADDRESS;
    *o_pp_procaddress = l_p_proc;
    return 0;
}
extern "C" __declspec(dllexport) int resolveInterface (TCHAR * i_pc_fullpath, int i_i_dllType, 
                          interfaceFunction ** o_p_interfaceTable,
                          int * o_i_interfaceTable_count,
                          int * o_i_dllVersion) {
    void * l_p_handle = 0;
    int l_i_result;
    int l_i_dllType;
    void * l_pf_getInterface;
    l_i_result = LoadLib(i_pc_fullpath,&amp;amp;l_p_handle);
    if(l_i_result == 0) {
        l_i_result = GProcAddress(l_p_handle,"getInterface", &amp;amp;l_pf_getInterface);
        if(l_i_result == 0) {
            l_i_result = ((pf_getInterface)l_pf_getInterface)
                         (&amp;amp;l_i_dllType,
                          o_i_dllVersion,
                          o_p_interfaceTable,
                          o_i_interfaceTable_count);
        if (i_i_dllType != l_i_dllType) {
                return ERROR_DLL_TYPE;
            }
        }
    };
    return l_i_result;
}
extern "C" __declspec(dllexport) int EnumerateUsableBiometricDevices (void * l_p_handle, int * const o_p_deviceCount) {
    int l_i_result;

    void * l_pf_getInterface;
        l_i_result = GProcAddress(l_p_handle,"BDS_EnumerateUsableBiometricDevices", &amp;amp;l_pf_getInterface);
        if(l_i_result == 0) {
            l_i_result = ((pf_BDS_EnumerateUsableBiometricDevices)l_pf_getInterface)
                         (o_p_deviceCount);

        }

    return l_i_result;
}
extern "C" __declspec(dllexport) int OpenBioDevice (void * l_p_handle, const int i_i_deviceIndex,
                int * o_p_deviceHandle,
                void * const i_p_userData) {
    int l_i_result;

    void * l_pf_getInterface;
        l_i_result = GProcAddress(l_p_handle,"BDS_OpenBiometricDevice", &amp;amp;l_pf_getInterface);
        if(l_i_result == 0) {
            l_i_result = ((pf_BDS_OpenBiometricDevice)l_pf_getInterface)
                         (i_i_deviceIndex,o_p_deviceHandle,i_p_userData);

        }

    return l_i_result;
}
extern "C" __declspec(dllexport) int CloseBioDevice (void * l_p_handle, const int i_i_deviceHandle) {
    int l_i_result;

    void * l_pf_getInterface;
        l_i_result = GProcAddress(l_p_handle,"BDS_CloseBiometricDevice", &amp;amp;l_pf_getInterface);
        if(l_i_result == 0) {
            l_i_result = ((pf_BDS_CloseBiometricDevice)l_pf_getInterface)
                         (i_i_deviceHandle);

        }

    return l_i_result;
}
extern "C" __declspec(dllexport) int SetDetectionMode (void * l_p_handle, const int    i_i_deviceHandle, 
                                                       const int    i_i_detectionMode,  const int    i_i_fingerNumber) 
 {
    int l_i_result;

    void * l_pf_getInterface;
        l_i_result = GProcAddress(l_p_handle,"BDS_SetParametersForDetectionMode", &amp;amp;l_pf_getInterface);
        if(l_i_result == 0) {
            l_i_result = ((pf_BDS_SetParametersForDetectionMode)l_pf_getInterface)
                         (i_i_deviceHandle,
                         i_i_detectionMode,
                         i_i_fingerNumber);

        }

    return l_i_result;
}
extern "C" __declspec(dllexport) int GetDetectedImage (void * l_p_handle, const int i_i_deviceHandle,
                const unsigned long i_l_timeout,
                BDS_Image * const o_p_outputImage,
                BDS_DetectionResults * const o_p_results) {
    int l_i_result;

    void * l_pf_getInterface;
        l_i_result = GProcAddress(l_p_handle,"BDS_GetDetectedImage", &amp;amp;l_pf_getInterface);
        if(l_i_result == 0) {
            l_i_result = ((pf_BDS_GetDetectedImage)l_pf_getInterface)
                         (i_i_deviceHandle,
                         i_l_timeout, o_p_outputImage,o_p_results);

        }

    return l_i_result;
}

extern "C" __declspec(dllexport) BDS_Image * BDS_GetDirectImage (void * l_p_handle,const int i_i_deviceHandle,const unsigned long i_l_timeout
                ,BDS_Image *    o_p_outputImage)
                {
                    int l_i_result;
                    //o_p_outputImage=(BDS_Image*) new BDS_Image();
                BDS_Image * o_p_outputImage2=(BDS_Image *) new BDS_Image();
    void * l_pf_getInterface;
        l_i_result = GProcAddress(l_p_handle,"BDS_GetDirectImage", &amp;amp;l_pf_getInterface);
        if(l_i_result == 0) {
            l_i_result = ((pf_BDS_GetDirectImage)l_pf_getInterface)
                         (i_i_deviceHandle,
                         i_l_timeout, o_p_outputImage2);
        }

    return o_p_outputImage2;
                }

extern "C" __declspec(dllexport) int BDS_SetParametersForDirectMode (void * l_p_handle,const int i_i_deviceHandle,const int i_i_samplingMode)
                {
                    int l_i_result;

    void * l_pf_getInterface;
        l_i_result = GProcAddress(l_p_handle,"BDS_SetParametersForDirectMode", &amp;amp;l_pf_getInterface);
        if(l_i_result == 0) {
            l_i_result = ((pf_BDS_SetParametersForDirectMode)l_pf_getInterface)
                         (i_i_deviceHandle,i_i_samplingMode );

        }

    return l_i_result;
}


extern "C" __declspec(dllexport) int AutoTest (void * l_p_handle,const int      i_i_deviceIndex, 
                                               const BDS_TestParameters * const  i_p_testParameters, 
                                               BDS_TestResults * const   o_p_testResults) {
    int l_i_result;

    void * l_pf_getInterface;
        l_i_result = GProcAddress(l_p_handle,"BDS_Autotest", &amp;amp;l_pf_getInterface);
        if(l_i_result == 0) {
            l_i_result = ((pf_BDS_Autotest)l_pf_getInterface)
                         (i_i_deviceIndex,
                         i_p_testParameters, o_p_testResults);

        }

    return l_i_result;
}

extern "C" __declspec(dllexport) int BDS_SetParametersForLiveMode (void * l_p_handle,
const int i_i_deviceHandle,
const int i_i_samplingMode) {
    int l_i_result;

    void * l_pf_getInterface;
        l_i_result = GProcAddress(l_p_handle,"BDS_SetParametersForLiveMode", &amp;amp;l_pf_getInterface);
        if(l_i_result == 0) {
            l_i_result = ((pf_BDS_SetParametersForLiveMode)l_pf_getInterface)
                         (i_i_deviceHandle,
                         i_i_samplingMode);

        }

    return l_i_result;
}
int  ApplicationCallback(const int i_i_deviceHandle,BDS_Image * const i_p_currentImage,const unsigned char * const i_p_inputData,
     unsigned char * const o_p_outputData,void * const o_p_userData){

  return 0;
 }

extern "C" __declspec(dllexport)  int BDS_DefineLiveProcess (void * l_p_handle, const int i_i_deviceHandle,BDS_Callback c) {
    int l_i_result;
    void * l_pf_getInterface=(void*)new int(20);

    //o_p_outputImage2=ApplicationCallback;
        l_i_result = GProcAddress(l_p_handle,"BDS_DefineLiveProcess", &amp;amp;l_pf_getInterface);
        std::cout&amp;lt;&amp;lt;l_i_result;
        if(l_i_result == 0) {
            l_i_result = ((pf_BDS_DefineLiveProcess)l_pf_getInterface)
                         (0,
                        c);

        }
        //free(l_pf_getInterface);
    return l_i_result;
}



extern "C" __declspec(dllexport) int BDS_GetBiometricDeviceDescriptor (void * l_p_handle,const int i_i_deviceIndex,char * pointer){
    int l_i_result;
    BDS_DeviceDescriptor * o_p_deviceDescriptor =NULL;
    void * l_pf_getInterface;
        l_i_result = GProcAddress(l_p_handle,"BDS_GetBiometricDeviceDescriptor", &amp;amp;l_pf_getInterface);
        if(l_i_result == 0) {
            l_i_result = ((pf_BDS_GetBiometricDeviceDescriptor)l_pf_getInterface)
                         (i_i_deviceIndex,
                         o_p_deviceDescriptor);
           pointer =o_p_deviceDescriptor-&amp;gt;m_deviceSerial;
        }

    return l_i_result;
} 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code is outdated and I am sharing it in hopes that someone can benefit from it. &lt;/p&gt;

&lt;p&gt;a also biult a c# wrapper that use the c++ library&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Morphotop
{
    public unsafe partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();
            //BDS_Callback callback = Callback;

        }
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
        public struct BDS_Image
        {
            public unsafe uint m_magic;
            public unsafe uint m_version;
            public unsafe uint m_width;
            public unsafe uint m_height;
            public unsafe uint m_flags;
            public IntPtr m_image;
            public unsafe uint m_count;
            public unsafe uint m_checksum;
            public unsafe fixed byte m_rfu[25];
        }
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        public unsafe delegate int BDS_Callback(IntPtr i_i_deviceHandle,
                                   BDS_Image* i_p_currentImage, IntPtr i_p_inputData,
                                    IntPtr o_p_outputData, IntPtr i_p_userData);

        public  unsafe int CallbackPointer(IntPtr i_i_deviceHandle, BDS_Image* i_p_currentImage, IntPtr i_p_inputData,
                                    IntPtr o_p_outputData, IntPtr i_p_userData)
        {
            try
            {
                uint size = i_p_currentImage-&amp;gt;m_width * i_p_currentImage-&amp;gt;m_height;
                byte[] data = new byte[size];
                byte[] height = new byte[i_p_currentImage-&amp;gt;m_height];
                byte[] width = new byte[i_p_currentImage-&amp;gt;m_width];
                IntPtr pointer = Marshal.AllocHGlobal(data.Length);
                Marshal.Copy(i_p_currentImage-&amp;gt;m_image, data, 0, data.Length);
                Marshal.FreeHGlobal(pointer);

                 SetPicture(pictureBox1, ConvertToBitmap(data, width.Length, height.Length));
            }
            catch
            {
            }
            return 0;
        }
        private  void SetPicture(PictureBox img, Bitmap bmp)
        {
            try
            {
                if (img.InvokeRequired)
                {
                    img.Invoke(new MethodInvoker(
                    delegate()
                    {
                        pictureBox1.Image = bmp;
                    }));
                }
                else
                {
                    pictureBox1.Image = bmp;
                }
            }
            catch
            {
            }
        }
        public void Initialize()
        {


            // int res5 = OpenBioDevice(i_p_handle, 0, out device_handle, user_data);
        }
        private void Capture_Click(object sender, EventArgs e)
        {




            int p = BDS_SetParametersForDirectMode(i_p_handle, 1);
            BDS_Image* resdet = BDS_GetDirectImage(i_p_handle, 0, 5000);
            uint size = resdet-&amp;gt;m_width * resdet-&amp;gt;m_height;
            byte[] data = new byte[size];
            byte[] height = new byte[resdet-&amp;gt;m_height];
            byte[] width = new byte[resdet-&amp;gt;m_width];
            if (data.Length != null)
            {
                IntPtr pointer = Marshal.AllocHGlobal(data.Length);
                try
                {
                    Marshal.Copy(resdet-&amp;gt;m_image, data, 0, data.Length);
                    Marshal.FreeHGlobal(pointer);
                    File.WriteAllBytes("test",data);
                    Bitmap bmp =ConvertToBitmap(data, width.Length, height.Length);
                    bmp.Save(Directory.GetCurrentDirectory()+"\\test.jpg");
                    pictureBox2.Image = bmp;
                }
                catch
                {

                }
            }

        }
        private Bitmap ConvertToBitmap(byte[] image_data,int width,int height)
        {
            try
            {
                int Width = width;
                int Height = height;
                var b = new Bitmap(Width, Height, PixelFormat.Format8bppIndexed);

                ColorPalette ncp = b.Palette;
                for (int i = 0; i &amp;lt; 256; i++)
                    ncp.Entries[i] = Color.FromArgb(255, i, i, i);
                b.Palette = ncp;
                var BoundsRect = new Rectangle(0, 0, Width, Height);
                BitmapData bmpData = b.LockBits(BoundsRect,
                                                ImageLockMode.WriteOnly,
                                                b.PixelFormat);

                IntPtr ptr = bmpData.Scan0;

                int bytes = width * b.Height;
                var rgbValues = new byte[bytes];
                Marshal.Copy(image_data, 0, ptr, bytes);
                b.UnlockBits(bmpData);
                return b;
            }
            catch
            {
                return null;
            }
        }



        private void Form1_Load(object sender, EventArgs e)
        {
            Initialize(textBox1);
        }



       private IntPtr i_p_handle;
        public void Initialize(TextBox result)
        {
            i_p_handle = IntPtr.Zero;
            IntPtr o_pp_procaddress = IntPtr.Zero;
            IntPtr o_p_interfaceTable = IntPtr.Zero;
            IntPtr o_i_interfaceTable_count = IntPtr.Zero;
            IntPtr o_i_dllVersion = IntPtr.Zero;

            IntPtr o_p_deviceCount = IntPtr.Zero;
            IntPtr device_handle = IntPtr.Zero;
            IntPtr img2 = IntPtr.Zero;
            IntPtr r = IntPtr.Zero;
            int user_data = 300;
            int re = 0;
            result.AppendText("Loading Library......." + Environment.NewLine);
            re = LoadLib(Directory.GetCurrentDirectory() + "\\SDKServices.dll", out i_p_handle);
            if (re == 0)
            {
                result.AppendText("Library Loaded No ERRORS" + Environment.NewLine);
                result.AppendText("Resolving interface" + Environment.NewLine);
                re = resolveInterface(Directory.GetCurrentDirectory() + "\\SDKServices.dll", o_pp_procaddress, out o_p_interfaceTable, out o_i_interfaceTable_count, out o_i_dllVersion);
                if (re == 0)
                {
                    result.AppendText("Interface resolved" + Environment.NewLine);
                    result.AppendText("Enumerating devices" + Environment.NewLine);
                    re = EnumerateUsableBiometricDevices(i_p_handle, out o_p_deviceCount);
                        OpenBioDevice(i_p_handle,0,out r,user_data);
                        SetupLiveMode(0,i_p_handle);
                    if (re == 0)
                    {
                        result.ForeColor = Color.Black;
                        result.AppendText("device enumerated" + Environment.NewLine);
                    }
                    else
                    {
                        result.AppendText("device could not be enumerated" + Environment.NewLine);
                    }
                }
                else
                {
                    result.AppendText("Interface could not be resolved" + Environment.NewLine);
                }
            }
            else
            {
                result.ForeColor = Color.Black;
                result.AppendText("could not load library" + Environment.NewLine);
            }
        }
        public void OpenDevice(TextBox result, IntPtr i_p_handle, IntPtr o_p_deviceHandle, int i_p_userData)
        {
            int resu = OpenBioDevice(i_p_handle, 0, out o_p_deviceHandle, i_p_userData);
            if (resu == 0)
            {
                result.AppendText("Biometric Device Opened" + Environment.NewLine);
            }
            else
            {
                result.AppendText("Could not open Biometric device" + Environment.NewLine);
            }
        }

        public void CloseDevice(TextBox result, IntPtr i_p_handle, int o_p_deviceHandle)
        {
            int resu = CloseBioDevice(i_p_handle, o_p_deviceHandle);
            if (resu == 0)
            {
                result.ForeColor = Color.Black;
                result.AppendText("Biometric Device Closed" + Environment.NewLine);
            }
            else
            {
                result.ForeColor = Color.Red;
                result.AppendText("Could not close Biometric device" + Environment.NewLine);
            }
        }
        public BDS_Callback callback1;
        public void SetupLiveMode(int SamplingMode, IntPtr i_p_handle)
        {
             callback1 = new BDS_Callback(CallbackPointer);
             int res = BDS_DefineLiveProcess(i_p_handle, SamplingMode, callback1);
        }
        [DllImport("SSB.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        public extern static int LoadLib(String path, out IntPtr i_p_handle);

        [DllImport("SSB.dll", CallingConvention = CallingConvention.Cdecl)]
        public extern static int GProcAddress(IntPtr i_p_handle, string i_pc_method, out IntPtr o_pp_procaddress);

        [DllImport("SSB.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        public extern static int resolveInterface(String path, IntPtr i_i_dllType, out IntPtr o_p_interfaceTable, out IntPtr o_i_interfaceTable_count, out IntPtr o_i_dllVersion);


        [DllImport("SSB.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        public extern static int EnumerateUsableBiometricDevices(IntPtr path, out IntPtr o_p_deviceCount);


        [DllImport("SSB.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        public extern static int OpenBioDevice(IntPtr path, int i_i_deviceIndex, out IntPtr o_p_deviceHandle, int i_p_userData);


        [DllImport("SSB.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        public extern static int CloseBioDevice(IntPtr path, int i_i_deviceHandle);

        [DllImport("SSB.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        public extern static int SetDetectionMode(IntPtr path, IntPtr i_i_deviceHandle, int i_i_detectionMode, int i_i_fingerNumber);
        [DllImport("SSB.dll", CallingConvention = CallingConvention.Cdecl)]
        public extern unsafe static BDS_Image* BDS_GetDirectImage(IntPtr path, int i_i_deviceHandle, ulong i_l_timeout);
        [DllImport("SSB.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        public extern static int BDS_SetParametersForDirectMode(IntPtr hadle, int sample);
        [DllImport("SSB.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        public extern static int BDS_SetParametersForDirectMode(IntPtr path, IntPtr i_i_deviceHandle, int i_i_samplingMode);
        [DllImport("SSB.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        public extern static int BDS_DefineLiveProcess(IntPtr l_p_handle, int a, BDS_Callback c);

        [DllImport("SSB.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        public extern static int BDS_DefineLiveProcess(int l_p_handle, BDS_Callback bds);

        private void Close_Click(object sender, EventArgs e)
        {
            CloseDevice(textBox1, i_p_handle, 0);
        }
        IEnumerable&amp;lt;Rectangle&amp;gt; FindImageTiles(Bitmap compositeImage)
        {
            var result = new List&amp;lt;Rectangle&amp;gt;();

            // Scan for a non-empty region that hasn't already been "captured"
            for (var x = 0; x &amp;lt; compositeImage.Width; x++)
            {
                for (var y = 0; y &amp;lt; compositeImage.Height; y++)
                {
                    // Only process the pixel if we don't have a rectangle that
                    // already contains this and if it's not empty
                    if (!result.Any(r =&amp;gt; r.Contains(x, y))
                        &amp;amp;&amp;amp; compositeImage.GetPixel(x, y).A != 0)
                    {
                        // Now that we've found a point, create a rectangle
                        // surrounding that point, then expand outward until
                        // we have a bounding rectangle that doesn't intersect
                        // with the tile
                        var rect = new Rectangle(x - 1, y - 1, 2, 2);
                        bool foundBounds = false;
                        while (!foundBounds)
                        {
                            var xRange = Enumerable.Range(rect.Left, rect.Right)
                                .Where(px =&amp;gt; px &amp;gt;= 0 &amp;amp;&amp;amp; px &amp;lt; compositeImage.Width);
                            var yRange = Enumerable.Range(rect.Top, rect.Bottom)
                                .Where(py =&amp;gt; py &amp;gt;= 0 &amp;amp;&amp;amp; py &amp;lt; compositeImage.Height);

                            // Adjust the top
                            if (rect.Top &amp;gt;= 0
                                &amp;amp;&amp;amp; xRange
                                    .Select(bx =&amp;gt; compositeImage.GetPixel(bx, rect.Top))
                                    .Any(p =&amp;gt; p.A != 0))
                            {
                                rect.Y--;
                                rect.Height++;
                            }
                            else if (rect.Bottom &amp;lt; compositeImage.Height
                                &amp;amp;&amp;amp; xRange
                                    .Select(bx =&amp;gt; compositeImage.GetPixel(bx, rect.Bottom))
                                    .Any(p =&amp;gt; p.A != 0))
                            {
                                rect.Height++;
                            }
                            else if (rect.Left &amp;gt;= 0
                                &amp;amp;&amp;amp; yRange
                                    .Select(by =&amp;gt; compositeImage.GetPixel(rect.Left, by))
                                    .Any(p =&amp;gt; p.A != 0))
                            {
                                rect.X--;
                                rect.Width++;
                            }
                            else if (rect.Right &amp;lt; compositeImage.Width
                                &amp;amp;&amp;amp; yRange
                                    .Select(by =&amp;gt; compositeImage.GetPixel(rect.Right, by))
                                    .Any(p =&amp;gt; p.A != 0))
                            {
                                rect.Width++;
                            }
                            else
                            {
                                foundBounds = true;
                            }
                        }
                        result.Add(rect);
                    }
                }
            }

            return result;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            IEnumerable&amp;lt;Rectangle&amp;gt; rec = FindImageTiles((Bitmap)pictureBox2.Image);
            Image img = pictureBox2.Image;
            Graphics newGraphics = Graphics.FromImage(img);
            foreach(Rectangle r in rec){
                newGraphics.DrawRectangle(new Pen(Color.Black, 2), r);
            }
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you can find the entire project in here &lt;a href="https://github.com/medsaid2001/morphotop-library"&gt;https://github.com/medsaid2001/morphotop-library&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>JavaScript DeobFuscator</title>
      <dc:creator>medsaid2001</dc:creator>
      <pubDate>Sun, 17 Apr 2022 21:21:17 +0000</pubDate>
      <link>https://dev.to/medsaid2001/javascript-deobfuscator-23nm</link>
      <guid>https://dev.to/medsaid2001/javascript-deobfuscator-23nm</guid>
      <description>&lt;p&gt;JavaScript is a popular and powerful programming language that is supported by most modern web browsers. It’s used for a variety of tasks from authenticating users to monetizing websites. It’s not just a pretty wrapper around HTML and CSS, it’s essential for modern web programming.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is De-Obfuscation?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://seosniffer.com/javascript-deobfuscator"&gt;De-obfuscation&lt;/a&gt; is the process of removing or removing the obfuscation features from a program. Oftentimes, this is done to audit a code base to make sure it’s properly licensed and in compliance with best-practices. But it can also be done to analyze a code base to identify duplicate code and encourage future improvements.&lt;/p&gt;

&lt;p&gt;Typically, the goal of de-obfuscation is to remove all the extra information that may have been added by the original author without their knowledge.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Importance of De-Obfuscation
&lt;/h2&gt;

&lt;p&gt;When a developer writes code, they usually don’t know where it’ll be used. For example, a checkout flow in a web application may use a lot of variable names and expressions that are unique to that application. But the author might not know that the checkout algorithm will lead to different results on different websites.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/ Example obfuscated code
const _0x38a2db = ['\x54\x6f\x74a\x6c', '\x6c\x6f\x67', '\x3a\x20'];
const _0x9b58d9 = function(_0x39ddb7) {
    return _0x38a2db[_0x39ddb7 + (-0x6d5 + 0x58 + 0x11 * 0x62)];
}, _0x498b9b = function(_0x48d808, _0x14da1e) {
    return _0x9b58d9(_0x48d808);
}, _0x34c7bc = function(_0x16af1d, _0x27a29e) {
    return _0x498b9b(_0x16af1d);
}, _0x23a1 = _0x34c7bc;
let total = 0x2 * 0x109e + -0xc * -0x16a + -0x3234;
for (let i = 0x1196 + 0x97b * 0x3 + -0x2e07; i &amp;lt; -0x95 * -0x38 + -0x1a75 + -0x619; i++) {
    total += i;
}
console[_0x34c7bc(-(0x1e7c + -0x1 * -0x1367 + 0x2ef * -0x11))](_0x498b9b(-(0x1020 + 0x253 + 0x7 * -0x2a2)) + _0x23a1(-(0x12c5 + -0x1887 + -0x1 * -0x5c5)) + total);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s where de-obfuscation comes into play. By removing the variable names and expressions from the source code, the developer prevents others from accidentally introducing those variables into their code.&lt;br&gt;
&lt;a href="https://seosniffer.com/javascript-deobfuscator"&gt;deobfuscated javascript&lt;/a&gt; code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let total = 0;
for (let i = 0; i &amp;lt; 10; i++) {
  total += i;
}
console.log("Total: " + total);


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why De-Obfuscation is Important
&lt;/h2&gt;

&lt;p&gt;When you spend time in a codebase, you’re using that code as your guide. It might be a novel idea in one organization, but in another, it might be considered old hat. In either case, the code should be treated as if it were written by someone else. After all, it is!&lt;/p&gt;

&lt;p&gt;When you work in a team, it’s essential to write clean code. If someone else has to mess with your code, you want that person to be as gentle with it as possible. That way, you can continue to make improvements and new features without having to reverse engineer the entire server!&lt;/p&gt;

&lt;p&gt;When you don’t know where your code will be used, it’s much easier to make changes that follow best-practices and local precedent. When you know where your code will be used, you can more easily aim for maintainership and avoid common pitfalls such as naming conflicts, typos, and inconsistencies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Defeating &lt;a href="https://seosniffer.com/javascript-deobfuscator"&gt;De-Obfuscation&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;You may have success in removing the obfuscation features from your code base, but what happens if someone else wants to read it and understand it better? Let’s say you submit your code to a code review service. The code is marked as stable and ready for review. But then you realize that a colleague has a different idea of what your code should look like. What should you do?&lt;/p&gt;

&lt;p&gt;You might want to reverse-engineer your code to find the parts of it that your colleague removed. But that’s a huge mistake! You should definitely not reveal your code’s internal structure in order to keep your colleague from accidentally revealing information you didn’t want them to see.&lt;/p&gt;

&lt;p&gt;Instead, you should simply contact the colleague and let them know what was removed and why. This simple action can go a long way in &lt;a href="https://seosniffer.com/javascript-obfuscator"&gt;re-obfuscating&lt;/a&gt; your code. And it can also prevent future misunderstandings.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
