Category: Blog

  • react-native-hockeyapp

    While I do not have the time to actively maintain RN-hockeyapp anymore, I am open to new maintainers taking the lead. If you would be interested, contact me at ladislav (at) benloop (dot) com.

    react-native-hockeyapp

    HockeyApp integration for React Native.

    Requirements

    • iOS 7+
    • Android
    • React Native >0.17
    • CocoaPods

    Installation

    npm install react-native-hockeyapp --save

    iOS

    You will need:

    CocoaPods (Setup)

    Podfile

    Add to your ios/Podfile:

    pod "HockeySDK"

    Run pod install

    Open YourProject.xcworkspace

    Add the RNHockeyApp library to your project

    • Drag-and-drop RNHockeyApp.xcodeproj from ./node_modules/react-native-hockeyapp/RNHockeyApp into your Project > Libraries.
    • Drag-and-drop libRNHockeyApp.a from Libraries/RNHockeyApp/Products into Linked Frameworks and Libraries

    Changes to AppDelegate.m

    If you wish to use Device UUID authentication or Web authentication, the following must be added to ios/AppDelegate.m

    #import "RNHockeyApp.h"
    
    - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
      if( [[BITHockeyManager sharedHockeyManager].authenticator handleOpenURL:url
                                                            sourceApplication:sourceApplication
                                                                   annotation:annotation]) {
        return YES;
      }
    
      /* Your own custom URL handlers */
    
      return NO;
    }

    You also need to add RNHockeyApp to Build Settings > Search Paths > Header Search Paths as a recursive search path, adding the following to both Debug and Release and ensuring recursive is selected (double click each line as opposed to editing it as text, and you’ll see the dropdowns):

    $(SRCROOT)/../node_modules/react-native-hockeyapp/RNHockeyApp
    

    Android (React Native >= 0.29)

    Google project configuration

    • In android/setting.gradle

    ...
    include ':react-native-hockeyapp', ':app'
    project(':react-native-hockeyapp').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-hockeyapp/android')
    • In android/build.gradle

    ...
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.1'
        classpath 'net.hockeyapp.android:HockeySDK:4.1.0' // <--- add this
    }
    • In android/app/build.gradle

    apply plugin: "com.android.application"
    ...
    dependencies {
        compile fileTree(dir: "libs", include: ["*.jar"])
        compile "com.android.support:appcompat-v7:23.0.1"
        compile "com.facebook.react:react-native:0.29.+"
        compile project(":react-native-hockeyapp") // <--- add this
    }
    • Manifest file

    <application ..>
        <activity android:name="net.hockeyapp.android.UpdateActivity" />
        <activity android:name="net.hockeyapp.android.FeedbackActivity" />
    </application>
    • Register Module (in MainApplication.java)

    import com.slowpath.hockeyapp.RNHockeyAppModule; // <--- import
    import com.slowpath.hockeyapp.RNHockeyAppPackage;  // <--- import
    
    public class MainApplication extends Application implements ReactApplication {
      ......
    
      @Override
      protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
          new RNHockeyAppPackage(MainApplication.this), // <------ add this line to yout MainApplication class
          new MainReactPackage());
      }
    
      ......
    
    }

    Android (React Native 0.17 – 0.28) – Only react-native-hockeyapp:0.4.2 or less

    Google project configuration

    • In android/setting.gradle

    ...
    include ':react-native-hockeyapp', ':app'
    project(':react-native-hockeyapp').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-hockeyapp/android')
    • In android/build.gradle

    ...
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.1'
        classpath 'net.hockeyapp.android:HockeySDK:4.1.2' // <--- add this
    }
    • In android/app/build.gradle

    apply plugin: "com.android.application"
    ...
    dependencies {
        compile fileTree(dir: "libs", include: ["*.jar"])
        compile "com.android.support:appcompat-v7:23.0.1"
        compile "com.facebook.react:react-native:0.17.+"
        compile project(":react-native-hockeyapp") // <--- add this
    }
    • Manifest file

    <application ..>
        <activity android:name="net.hockeyapp.android.UpdateActivity" />
        <activity android:name="net.hockeyapp.android.FeedbackActivity" />
    </application>
    • Register Module (in MainActivity.java)

    import com.slowpath.hockeyapp.RNHockeyAppModule; // <--- import
    import com.slowpath.hockeyapp.RNHockeyAppPackage;  // <--- import
    
    public class MainActivity extends ReactActivity {
      ......
    
      @Override
      protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
          new RNHockeyAppPackage(this), // <------ add this line to yout MainActivity class
          new MainReactPackage());
      }
    
      ......
    
    }

    Usage

    From your JS files for both iOS and Android:

    var HockeyApp = require('react-native-hockeyapp');
    
    componentWillMount() {
        HockeyApp.configure(HOCKEY_APP_ID, true);
    }
    
    componentDidMount() {
        HockeyApp.start();
        HockeyApp.checkForUpdate(); // optional
    }

    You have available these methods:

    HockeyApp.configure(HockeyAppId: string, autoSendCrashReports: boolean = true, authenticationType: AuthenticationType = AuthenticationType.Anonymous, appSecret: string = '', ignoreDefaultHandler: string = false); // Configure the settings
    HockeyApp.start(); // Start the HockeyApp integration
    HockeyApp.checkForUpdate(); // Check if there's new version and if so trigger update
    HockeyApp.feedback(); // Ask user for feedback.
    HockeyApp.addMetadata(metadata: object); // Add metadata to crash report.  The argument must be an object with key-value pairs.
    HockeyApp.generateTestCrash(); // Generate test crash. Only works in no-debug mode.

    The following authentication methods are available:

    1. AuthenticationType.Anonymous – Anonymous Authentication
    2. AuthenticationType.EmailSecret – HockeyApp email & App Secret
    3. AuthenticationType.EmailPassword – HockeyApp email & password
    4. AuthenticationType.DeviceUUID – HockeyApp registered device UUID
    5. AuthenticationType.Web – HockeyApp Web Auth (iOS only)

    Contributions

    See https://github.com/slowpath/react-native-hockeyapp/graphs/contributors

    Visit original content creator repository
    https://github.com/martincik/react-native-hockeyapp

  • TurkishId

    NuGet Version Build status

    TurkishId

    Validator, model binder and generator tool for Turkish Republic’s citizen ID numbers. I’ve decided to give this a shot last night while I was waiting for a download. And Turkish ID numbers were really popular in Turkish social media last week. The Id number is called “T.C. Kimlik No” (Turkish Republic Identity Number). I decided to use English translation to allow easier handling in international projects.

    Usage

    I wanted the TurkishIdNumber representation to be used anywhere in the code as a value to pass around when using id’s allowing to assume an instance is already validated saving you from redundant checks.

    When you want to use it as a representation of an ID number:

    using TurkishId;
    var id = new TurkishIdNumber("12345678901");
    // throws ArgumentException when invalid parameter is passed

    or if you just want to validate it:

    using TurkishId;
    bool reallyValid = TurkishIdNumber.IsValid("12345678901");

    You can also use the classic TryParse:

    using TurkishId;
    if (TurkishIdNumber.TryParse(value, out var id))
    {
        // ...
    }

    or with a nullable return value which can be used with pattern matching:

    using TurkishId;
    if (TurkishIdNumber.TryParse(value) is TurkishIdNumber id))
    {
        // ...
    }

    NuGet package is here: https://www.nuget.org/packages/TurkishId/

    TurkishId.ModelBinder

    There is also a model binder package that you can install at https://www.nuget.org/packages/TurkishId.ModelBinder. It’s a plug’n’play model binder which lets you to use TurkishIdNumber class directly in your model declarations.

    It’s not part of the original package because you may not want to have whole MVC as a dependency.

    To set it up in an ASP.NET Core project, use this syntax in your ConfigureServices() method in your Startup class:

    services.AddMvc(options =>
    {
      options.ModelBinderProviders.Insert(0, new TurkishIdModelBinderProvider());
    });

    and you’re done. If you’d like to use it in your Razor Pages app use AddMvcOptions instead:

    services.AddRazorPages()
      .AddMvcOptions(options => options.ModelBinderProviders.Insert(0, new TurkishIdModelBinderProvider()));

    or, alternatively, if you only use controllers, you can add it to your AddControllers options:

    services.AddControllers(options =>
    {
      options.ModelBinderProviders.Insert(0, new TurkishIdModelBinderProvider());
    });

    The model binder package will use ASP.NET Core’s model binding message providers. You can now localize them like how you do any other model binder.

    Performance

    This is probably one of the fastest implementations on .NET. I didn’t grind so much on performance but it can easily handle millions of validations per second on my Core i7.

    Algorithm

    Turkish Republic’s ID structure and verification is simple. It’s an eleven digit number. If we name each digit as d(n) where leftmost digit is called d1 and the rightmost d11, a given ID is valid if:

    d1 > 0

    and

    n = (d1 + d3 + d5 + d7 + d9) * 7 – (d2 + d4 + d6 + d8)

    if n < 0 then n = n + 10

    d10 = n mod 10

    and

    d11 = sum(d1..d10) mod 10

    Visit original content creator repository https://github.com/ssg/TurkishId
  • Sebastian-105.github.io

    Sebastian-105
    Website

    Using my Website

    You have to press run (only on replit) This website took a lot of time to make so I would apprecite if you could not copy off me and plagiarize this code.
    If you want to open my website on github than go here here (github.io).

    Forking

    Unless it is directly linking something then delete it.
    1). Because this website works on html and node.js (node.js is better and has more features), to run this website locally type in the terminal
    npm install && npm run start && npm run test
    2). If you find those go through every HTML page and remove

    <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-CCS6F21XDE"> </script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-<some code here>'); </script>

    Downloading my website

    go to here

    I am not responsible for any legal stuff after that.

    Once you find all these stuff you are free to go! 🙂

    Website Links

    Github
    Replit
    render
    netlify
    netlify #2
    vercel

    Doc Links

    Vercel
    Netlify

    Games Page Links

    Vercel
    Netlify

    Links

    Code of coduct.
    The changelog.
    The License.
    Contributing.
    security.

    Deploying

    Deploy to Heroku Fork on Replit Deploy with Netlify Deploy to Render Deploy with Vercel Remix on Glitch

    Contributers:

    Contrib

    Info/Stats

    Stargazers repo roster for @Sebastian-105/Sebastian-105.github.io Forkers repo roster for @Sebastian-105/Sebastian-105.github.io

    Other

    Netlify Status Main Workflow

    REMEMBER TO CITE ME IN THE CODE AND THE FOOTER

    By Sebastian-105

    Visit original content creator repository https://github.com/Sebastian-105/Sebastian-105.github.io
  • php-iup

    php-iup IUP Logo

    php-ffi experiment

    php7.4 interface to the IUP toolkit for building GUI’s.

    Description

    IUP-Toolkit

    IUP is a multi-platform toolkit for building graphical user interfaces. IUP’s purpose is to allow a program source code to be compiled in different systems without any modification. Its main advantages are:

    • It offers a simple API.
    • High performance, due to the fact that it uses native interface elements.
    • Fast learning by the user, due to the simplicity of its API.

    Synopsis

    WARNING:
    This module is in its early stages and should be considered a Work in Progress. The interface is not final and may change in the future.

    Sample GUI:

    php-iup cbox Scintilla Hello World IUP Application

    Sample code:

    require __DIR__.'/../vendor/autoload.php';
    use iup\core;
    $iup = new core();
    
    $multiText = $iup->text(null);
    $vbox = $iup->vbox($multiText);
    $iup->setAttribute($multiText, "MULTILINE", "YES");
    $iup->setAttribute($multiText, "EXPAND", "YES");
    $dlg = $iup->dialog($vbox);
    $iup->setAttribute($dlg, 'TITLE', 'php-iup');
    $iup->setAttribute($dlg, 'SIZE', 'QUARTERxQUARTER');
    $iup->showXY($dlg, $iup::IUP_CENTER, $iup::IUP_CENTER);
    $iup->setAttribute($dlg, 'USERSIZE', null);
    $iup->mainLoop();
    $iup->close();
    

    Author

    Shubham Chaudhary ghost.jat@gmail.com

    Visit original content creator repository https://github.com/ghostjat/php-iup
  • elevators-monitor-mef

    Elevators Monitor MEF (Finite State Machine)

    Description

    Elevators Monitor MEF synergizes cutting-edge software engineering with embedded systems, showcasing a sophisticated simulation of elevator operations using a Finite State Machine (FSM). This project uniquely combines a Qt-based application and an STM32F103C8T6 microcontroller, embodying advanced concepts in computer science and engineering.

    Key Components

    1. Qt Application: Developed in C++, this application benefits from the language’s robustness and versatility, making it ideal for high-performance GUI applications. C++ is renowned for its efficiency and control, crucial for real-time systems and complex simulations.

    2. STM Microcontroller: This component utilizes the STM32F103C8T6, a microcontroller celebrated for its reliability in embedded systems. The microcontroller executes the FSM, managing the dynamics of elevator movements with precision.

    Technical Highlights

    • C++ and Embedded Systems: The choice of C++ for the Qt application stems from its high performance and object-oriented capabilities, essential for developing complex GUI applications. The integration with the microcontroller highlights the versatile application of C++ in both software and embedded systems.

    • FSM Implementation: The project employs a Finite State Machine, a concept fundamental in automata theory and computational models. FSMs are instrumental in representing sequential logic and controlling execution flow, making them ideal for simulating elevator operations. Reference: Hopcroft, J., Motwani, R., Ullman, J.D.: Introduction to Automata Theory, Languages, and Computation, 3rd ed. Pearson, Boston (2007).

    • Peripheral Synchronization: Utilizing USART for communication, the system exemplifies complex synchronization requirements in embedded systems. This aspect underscores the importance of precise timing and resource management in microcontroller programming.

    • Real-Time Data Handling: The implementation includes meticulous data management to ensure seamless real-time communication between the microcontroller and the Qt application, showcasing the advanced use of buffers and data streams. For an in-depth look at the microcontroller part of the project, please see the STM Project Repository on GitHub.

    Objectives

    • To develop a technically advanced program that reflects state-of-the-art practices in software and embedded systems.
    • To demonstrate the practical application of FSM in simulating real-world systems.
    • To provide a comprehensive interface for visualizing and controlling the FSM-based elevator simulation.

    Practical Conclusions

    • Communication protocols are optimized for each state, ensuring data integrity and real-time performance.
    • A 34-byte buffer in Qt is strategically implemented to prevent reading errors and maintain data consistency.
    • Detailed parameter definitions facilitate modular programming in the embedded system, allowing for flexible and scalable code architecture.

    References – Bibliography

    1. Hopcroft, J., Motwani, R., Ullman, J.D.: Introduction to Automata Theory, Languages, and Computation, 3rd edn. Pearson, Boston (2007).
    2. You, J. (2013). Software-based Finite State Machine (FSM) with general-purpose processors [PDF].
    3. CRC Computation in C. Pololu. Available here

    Annexes

    Annex 1. Finite State Machine Diagram

    Visit original content creator repository https://github.com/miguelanruiz/elevators-monitor-mef
  • rmsd

    The root mean Square Deviation (RMSD) is the most common metric for measuring structural similarity between two structures. It is typically used in molecular biology, chemistry, and computational chemistry.

    However, the result can become misleadingly large unless the input data has pre-optimized translation and rotation of the molecules in question. This solution will perform this optimization before calculating optimal (minimal) RMSD values.

    Additionally, if the atoms in the molecules are not correctly ordered, optimal rotation is impossible to achieve. This tool utilizes several ways to solve this problem.

    For more details, see below and read RMSD and Kabsch algorithm.

    The easiest is to get the program via pip.

    pip install rmsd

    There is only one Python file, so you can also download calculate_rmsd.py and put it in your bin folder.

    wget -O calculate_rmsd https://raw.githubusercontent.com/charnley/rmsd/master/rmsd/calculate_rmsd.py
    chmod +x calculate_rmsd

    To calculate the structural difference between two molecules, you might initially compute the RMSD directly (Figure 1.a). However, this straightforward approach could give you a misleadingly large value. To get the true minimal RMSD, you must adjust for translation (Figure 1.b) and rotation (Figure 1.c). This process aligns the two molecules best, ensuring the RMSD accurately reflects their structural similarity after optimal alignment.

    1.a 1.b 1.c
    fig1.a fig1.b fig1.c
    RMSD = 2.8 RMSD = 0.8 RMSD = 0.2

    Atom reordering methods are used when the atoms in two molecules are not in the same order (Figure 2.a). While brute-force through all possible atom combinations and calculating the optimal rotation for each is possible, this approach is computationally infeasible for large structures, as it scales $O(N!)$. Instead, the implemented algorithms efficiently find the optimal mapping of atoms between the two structures using smarter techniques.

    Each method has limitations because finding the best atom mapping depends on properly aligning structures. This is usually done by comparing atom-pair distances. If the molecules are aligned, using the Hungarian cost minimization for atom distance works well. If not, you can align the Inertia eigenvectors (Figure 2.b) as an approximation to align the molecules. Or, use atomic descriptors (Figure 2.c), independent of the coordinate system, to reorder the atoms. Note that all reordering methods have limitations and drawbacks, and the actual order might not be found.

    2.a 2.b 2.c
    fig2.a fig2.b fig2.c

    Use calculate_rmsd --help to see all the features. Usage is pretty straight forward, call calculate_rmsd with two structures in either .xyz or .pdb. In this example, Ethane has the same structure but is translated in space, so the RMSD should be zero.

    calculate_rmsd tests/ethane.xyz tests/ethane_translate.xyz

    It is also possible to ignore all hydrogens (useful for larger molecules where hydrogens move around indistinguishable) and print the rotated structure for visual comparison. The output will be in XYZ format.

    calculate_rmsd --no-hydrogen --print tests/ethane.xyz tests/ethane_mini.xyz

    If the atoms are scrambled and not aligned, you can use the --reorder argument, which will align the atoms from structure B onto A.

    Use --reorder-method to select the reordering method. Choose between Inertia aligned Hungarian distance inertia-hungarian (default), Hungarian distance hungarian (if the structure is already aligned), sorted distance distance, atomic representation qml, and brute force brute (for reference, don’t use this). More details on which to use in --help.

    calculate_rmsd --reorder tests/water_16.xyz tests/water_16_idx.xyz

    If you want to run multiple calculations simultaneously, it’s best not to rely solely on the script. Instead, you can use GNU Parallel to handle this efficiently. For example, compare all ethane_* molecules using two cores and print one file and the RMSD per line. Bash is good for stuff like that.

    find tests/resources -name "ethane_*xyz" | parallel -j2 "echo -n '{} ' && calculate_rmsd --reorder --no-hydrogen tests/resources/ethane.xyz {}"

    It is also possible to use RMSD as a library in other scripts; see tests/* for example usage.

    Found a bug? Submit issues or pull requests on GitHub.

    Note on PDB format. Protein Data Bank format (PDB) is column-based; however, countless examples of non-standard .pdb files exist. We try to read them, but if you have trouble reading the file, check if the file format is compliant with PDB. For example, some hydrogens are noted as HG11, which we assume is not mercury.

    Please cite this project when using it for scientific publications. And cite the relevant methods implemented.

    Implementation: Calculate Root-mean-square deviation (RMSD) of Two Molecules Using Rotation, GitHub, http://github.com/charnley/rmsd, <git commit hash or version number>

    Method Argument Citation
    Kabsch --rotation-method kabsch (Default)

    Wolfgang Kabsch (1976), Acta Crystallographica, A32:922-923

    http://dx.doi.org/10.1107/S0567739476001873

    Quaternion --rotation-method quaternion

    Walker, Shao & Volz (1991), CVGIP: Image Understanding, 54:358-367,

    http://dx.doi.org/10.1016/1049-9660(91)90036-o

    Distance Hungarian Assignment --reorder-method inertia-hungarian (Default)

    Crouse (2016). Vol. 52, Issue 4, pp. 1679–1696, IEEE.

    http://dx.doi.org/10.1109/TAES.2016.140952

    FCHL19 --reorder-method qml

    Christensen et al (2020), J. Chem. Phys. 152, 044107

    https://doi.org/10.1063/1.5126701

    Visit original content creator repository https://github.com/charnley/rmsd
  • GSL-Alphabet-recognition-mediapipe

    GSL-Alphabet-Recognizer

    GSL Alphabet Recognizer using MediaPipe. We estimate hand pose using MediaPipe (Python Version). This is a sample program that recognizes GSL Alphabet hand signs with a simple multilayer perceptron (MLP) using the detected key points.

    This repository contains the following contents.

    • Sample code program
    • GSL Alfabet Hand sign recognition model (TFLite)
    • Learning data for Alphabet sign recognition

    Requirements

    mediapipe v0.8.11 OpenCV 3.4.2 or Later Tensorflow 2.3.0 or Later scikit-learn 0.23.2 or Later (Only if you want to display the confusion matrix) matplotlib 3.3.2 or Later (Only if you want to display the confusion matrix)

    Using webcam (demo)

    Here’s how to run the demo using your webcam:

    python gsl-alfabet-recognizer.py
    

    or in some cases as macOS

    python3 gsl-alfabet-recognizer.py
    

    The following options can be specified when running the demo.

    –device Specifying the camera device number (Default:0) –width Width at the time of camera capture (Default:960) –height Height at the time of camera capture (Default:540) –use_static_image_mode Whether to use static_image_mode option for MediaPipe inference (Default:Unspecified) –min_detection_confidence Detection confidence threshold (Default:0.5) –min_tracking_confidence Tracking confidence threshold (Default:0.5)

    Directory

    │ gsl-alfabet-recognizer.py  
    │
    ├─model
    │  ├─keypoint_classifier
    │     │  keypoint.csv
    │     │  keypoint_classifier.hdf5
    │     │  keypoint_classifier.py
    │     │  keypoint_classifier.tflite
    │     └─ keypoint_classifier_label.csv                  
    └─utils
        └─cvfpscalc.py

    gsl-alfabet-recognizer.py

    This is a sample program for inference. In addition, learning data (key points) for hand sign recognition.

    model/keypoint_classifier

    This directory stores files related to hand sign recognition. The following files are stored.

    • Training data (keypoint.csv)
    • Trained model (keypoint_classifier.tflite)
    • Label data (24 classes) (keypoint_classifier_label.csv)
    • Inference module (keypoint_classifier.py)
    • Greek alphabet (alphabet-24 letters.csv)

    utils/cvfpscalc.py

    This is a module for FPS measurement.

    Learning data collection

    The ahnd key points added to “model/keypoint_classifier/keypoint.csv” as shown below. 1st column: Pressed number (used as class ID), 2nd and subsequent columns: Key point coordinates

    The key point coordinates are the ones that have undergone the following preprocessing one of the 24 classes. the landmarks coordinates does :

    1. Convert to relative coordinates
    2. Flatten to one-dimensional array
    3. Normalize to the maximum value (absolute value)

    Class ID: 0 is related to “alpha” label. Class ID: 1 to “beta” label.

    . . .

    Class ID: 23 for “omega” label.

    Reference

    License

    GSL Alphabet Recognizer using mediapipe is under Apache v2 license.

    Visit original content creator repository https://github.com/dkourem/GSL-Alphabet-recognition-mediapipe
  • metallurgy

    Mission

    I started this project as a way to learn more about Metal and how to use it in SwiftUI. Seeing the response of others online intrested in seeing and learning more about this, I decided to make this project open source. I hope that this project will help others learn more about Metal and how to use it in SwiftUI.

    metallurgy-1.mp4

    Architecture

    The overall architecture of the project is fairly simple to grasp, but there are a few things to keep in mind when adding new shaders to the project.

    Firstly, the project is split into two main parts: the list view and the detail view. The list view is where the user will see all of the shaders that are available to them. The detail view is where the user will see the shader in action and be able to adjust the arguments of the shader.

    Secondly, the shaders themselves are split into two main parts: the shader showcases and models. The shader showcases hold the data for each shader while the shader models hold the data for each argument.

    The shaders are then passed into a class which holds the data for each individual shader. This array of shaders is then passed into the list view where it is displayed to the user. When the user selects a shader, the shader is passed into the detail view where it is displayed to the user.

    The project is set up like this to provide an emphasis on the shaders themselves. The shaders are the main focus of the project. Doing this allows for the shaders to be easily added and removed from the project without having to worry about creating individual views for each shader.

    metallurgy-2.mp4

    Models

    Argument

    This holds the data for each argument. This is passed into each shader which will be used in the shader function. It is also shown in the detail view where it can be adjusted by the user.

    class Argument: Identifiable, ObservableObject {
        var id = UUID()
        let name: String
        @Published var value: Float
        let range: ClosedRange<Float>
        let editable: Bool
    }
    name: String

    This will hold the name of the argument. This will be used to display the name of the argument in the detail view.

    value: Float

    This will hold the value of the argument. This will be used to display the value of the argument in the detail view.

    range: ClosedRange<Float>

    This will hold the range of the argument. This will be used to display the range of the argument in the detail view.

    editable: Bool

    This will hold whether or not the argument should be editable. If the argument should be editable, set this to true. If the argument should not be editable, set this to false.

    Showcase

    This holds the data for each shader. This will be used to display the name of the shader in the list view and the title of the shader in the detail view.

    class Showcase: Identifiable, ObservableObject {
        var id = UUID()
        let name: String
        let time: Bool
        let size: Bool
        let bounding: Bool
        let function: String
        let category: Categories
        @Published var arguments: [Argument]
    }
    name: String

    This will hold the name of the shader. This will be used to display the name of the shader in the list view and the title of the shader in the detail view.

    time: Bool

    This will hold whether or not the shader should have a time argument. If the shader should have a time argument, set this to true. If the shader should not have a time argument, set this to false.

    size: Bool

    This will hold whether or not the shader should have a size argument. If the shader should have a size argument, set this to true. If the shader should not have a size argument, set this to false.

    bounding: Bool

    This will hold whether or not the shader should have a bounding argument. If the shader should have a bounding argument, set this to true. If the shader should not have a bounding argument, set this to false.

    function: String

    This will hold the name of the function that will be called when the shader is run. Be mindful of spelling and capitalization, hence why it is recommended to keep the file name and function name similar.

    category: Categories

    This will hold the category of the shader. Whether it is a color shader, a distortion shader, or a layer shader. This will be used to display the category of the shader category button in the detail view.

    arguments: [Argument]

    This will hold the arguments that will be passed into the shader. Make sure they are in the same order as the arguments in the shader function.

    Contributing

    This project is open to and encourages contributions! Feel free to discuss any bug fixes/features by creating a new. If you are interested in contributing code to this project, fork the repository and submit a pull request. Please make sure to document your code changes and test the project before submitting a pull request. Try to keep the code style consistent with the rest of the project as well.

    Disclaimer

    This project is open source under the MIT license, which means you have full access to the source code and can modify it to fit your own needs.

    This project is also still in beta, so there may be some bugs or areas that could be improved. If you find any bugs or areas that could be improved, please report them by creating a new issue.

    Visit original content creator repository https://github.com/raphaelsalaja/metallurgy
  • privacy-preserving-bandits

    Privacy-Preserving-Bandits (P2B)

    Codes and Data accompanying our paper “Privacy-Preserving Bandits

    @inproceedings{malekzadeh2020privacy,
    	title        = {Privacy-Preserving Bandits},
    	author       = {Malekzadeh, Mohammad and Athanasakis, Dimitrios and Haddadi, Hamed and Livshits, Benjamin},
    	booktitle    = {Proceedings of Machine Learning and Systems (MLSys '20)},
    	url = {https://proceedings.mlsys.org/paper/2020/file/42a0e188f5033bc65bf8d78622277c4e-Paper.pdf},
    	volume = {2},
    	pages = {350--362},
    	year = {2020}
    }

    Public DOI: 10.5281/zenodo.3685952

    Note:

    • To reproduce the results of the paper, you just need to run codes in the experiments folder.
    • Multi-Lable datasets will be automatically downloaded for the firs time.
    • For criteo dataset, in the first time, use the script experiments/Criteo/criteo_dataset/create_datasets.ipynb

    (A) All you need to begin with:

    1: Run 1_build_an_encoder.ipynb.

    2: Run 2_a_synthetic_exp.ipynb.

    (B) For Criteo dataset:

    In the directory experiments/Criteo/, we have already run this file for the experiment we have reported in Figure 7 and provided dataset by processing nrows=1000000000, that uses 1 billion rows of the original dataset.

    I If one desires to make a dataset of another nrows, for the first time, the script create_datasets.ipynb should be used. You should first set this parameter (number of rows) in the create_datasets.ipynb, build the dataset, and then run the Criteo experiment. Please see create_datasets.ipynb for more dtail.

    (C) Info:

    You may need to install packages that are listed in the requirements.txt file.

    % pip install -r requirements.txt 
    

    Specifically, these libraries:

    %pip install iteround
    %pip install pairing 
    %pip install scikit-multilearn
    %pip install arff
    %pip install category_encoders
    %pip install matplotlib
    %pip install tensorflow
    %pip install keras
    
    Visit original content creator repository https://github.com/mmalekzadeh/privacy-preserving-bandits
  • GRAFICOS-COM-CHARTJS

    GRAFICOS COM CHARTJS

    👨‍🏫4 TIPOS DE GRAFICOS DINÂMICOS COM CHARTJS (APENAS O FRONT-END).







    DESCRIÇÃO:

    O projeto “Gráficos com Chart.js” é uma aplicação web que permite a visualização e manipulação de gráficos interativos usando a biblioteca Chart.js. Esta aplicação oferece uma variedade de gráficos, incluindo barras, linhas, pizza e radar, e permite ao usuário alterar dinamicamente os dados exibidos nos gráficos.

    FUNCIONALIDADES:

    1. Visualização de Gráficos: A aplicação fornece diferentes tipos de gráficos, como barras, linhas, pizza e radar, para representar dados de forma visualmente atraente.

    2. Manipulação de Dados: Os gráficos podem ser atualizados dinamicamente com novos dados, permitindo ao usuário explorar diferentes conjuntos de dados e observar as mudanças nos gráficos em tempo real.

    3. Temas de Fundo Aleatórios: Ao clicar em qualquer botão na aplicação, o tema de fundo é alterado aleatoriamente, proporcionando uma experiência visual dinâmica e divertida.

    COMO USAR?

    1. Abrindo App: Abra o ./CODIGO/CODIGO.html no navegador de sua preferência.

    2. Seleção de Gráficos: Escolha o tipo de gráfico que deseja visualizar clicando nos botões correspondentes (MUDAR).

    3. Atualização de Dados: Cada gráfico possui um botão associado que permite alterar os dados exibidos no gráfico. Clique no botão para gerar novos dados aleatórios e atualizar o gráfico.

    4. Mudança de Tema de Fundo: Cada vez que um botão é clicado para atualizar os dados do gráfico, o tema de fundo da aplicação muda aleatoriamente. Isso adiciona uma camada de dinamismo visual à experiência do usuário.

    NÃO SABE?

    • Entendemos que para manipular arquivos em HTML, CSS e outras linguagens relacionadas, é necessário possuir conhecimento nessas áreas. Para auxiliar nesse aprendizado, oferecemos cursos gratuitos disponíveis:

    CREDITOS:

    Visit original content creator repository https://github.com/VILHALVA/GRAFICOS-COM-CHARTJS