Blog

  • Generate Animated Rings With Blender Python API For Website

    Generate Animated Rings With Blender Python API For Website


    Generate Animated 3D Rings for the Web with Blender Python and model-viewer

    Do you want to bring animated 3D models into your website without being a rendering expert? This post walks you through generating a stunning low poly animated ring model using **Blender’s Python API** and displaying it seamlessly on your blog using the Google **model-viewer** web component.

    We will use a reliable complete Python script to automate the entire process overcoming common scripting hurdles in Blender’s background mode.

    1. The Blender Python Script

    The following script automates the creation of three glossy animated rings sets up the camera and lighting and exports the final ready for web **GLB** file. We use simple keyframes for stability meaning the animation will loop although with a slight ease in/ease out effect Bezier interpolation due to a known Blender bug in this specific workflow.

    
    
    
    import bpy
    import math
    import os
    
    # --- Configuration ---
    BLENDER_FILE_NAME = "low-poly-animated-rings.blend"
    EXPORT_FILE_NAME = "low-poly-animated-rings.glb"
    # Determine script directory for saving/exporting files
    SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) if '__file__' in globals() else (os.path.dirname(bpy.data.filepath) if bpy.data.filepath else os.getcwd())
    
    # Geometry and Animation Settings
    LOW_POLY_VERTICES = 16 
    RING_THICKNESS = 0.3
    ANIMATION_FRAMES = 60
    FULL_ROTATION = 2 * math.pi
    
    # Ring Data: (Name, Major Radius, Material Color RGB, Axis)
    rings_data = [
        ("Ring_Red", 4.0, (0.8, 0.1, 0.1), 'X'),
        ("Ring_Green", 3.0, (0.1, 0.8, 0.1), 'Y'),
        ("Ring_Blue", 2.0, (0.1, 0.1, 0.8), 'Z'),
    ]
    
    # --- Utility Functions ---
    
    def clear_scene():
        """Removes all objects from the current scene."""
        bpy.ops.object.select_all(action='SELECT')
        bpy.ops.object.delete(use_global=False)
    
    def create_glossy_material(name, color_rgb):
        """Creates a glossy metallic material."""
        if name in bpy.data.materials: return bpy.data.materials[name]
        mat = bpy.data.materials.new(name=name)
        mat.use_nodes = True
        
        bsdf = mat.node_tree.nodes["Principled BSDF"]
        bsdf.inputs['Base Color'].default_value = color_rgb + (1.0,)
        bsdf.inputs['Roughness'].default_value = 0.1
        bsdf.inputs['Metallic'].default_value = 0.8
        return mat
    
    def apply_material(obj, mat):
        """Applies a material to a given object."""
        if obj.data.materials: obj.data.materials[0] = mat
        else: obj.data.materials.append(mat)
    
    # --- Main Generation Logic ---
    
    def generate_animated_rings():
        clear_scene()
        ring_objects = []
    
        # --- 1. Create Geometry and Materials ---
        
        for name, radius, color_rgb, axis in rings_data:
            mat = create_glossy_material(f"{name}_Mat", color_rgb)
            
            bpy.ops.mesh.primitive_torus_add(
                major_segments=LOW_POLY_VERTICES, 
                minor_segments=LOW_POLY_VERTICES,
                major_radius=radius, 
                minor_radius=RING_THICKNESS, 
                align='WORLD', 
                location=(0, 0, 0)
            )
            ring = bpy.context.object
            ring.name = name
            apply_material(ring, mat)
            
            ring_objects.append({'obj': ring, 'axis': axis})
    
        # --- 2. Animate Rotation (Simple Keyframes Only) ---
        
        bpy.context.scene.frame_start = 1
        bpy.context.scene.frame_end = ANIMATION_FRAMES
        
        for ring_info in ring_objects:
            ring = ring_info['obj']
            axis = ring_info['axis']
            
            if not ring.animation_data:
                ring.animation_data_create()
            
            # Keyframe 1: Start rotation (Frame 1)
            bpy.context.scene.frame_set(1)
            ring.rotation_euler.x = 0
            ring.rotation_euler.y = 0
            ring.rotation_euler.z = 0
            ring.keyframe_insert(data_path="rotation_euler", frame=1)
            
            # Keyframe 2: Full rotation (Frame ANIMATION_FRAMES)
            bpy.context.scene.frame_set(ANIMATION_FRAMES)
            
            # Set rotation for the specific axis
            if axis == 'X':
                ring.rotation_euler.x = FULL_ROTATION
            elif axis == 'Y':
                ring.rotation_euler.y = FULL_ROTATION
            else: # 'Z'
                ring.rotation_euler.z = FULL_ROTATION
                
            ring.keyframe_insert(data_path="rotation_euler", frame=ANIMATION_FRAMES)
    
        # --- 3. Add Camera and Light ---
        
        # Camera setup
        bpy.ops.object.camera_add(location=(0, -8, 2), rotation=(math.radians(70), 0, 0))
        bpy.context.scene.camera = bpy.context.object
    
        # Light setup (Confirmed working fix)
        bpy.ops.object.light_add(type='POINT', location=(5, -5, 5))
        light_object = bpy.context.object
        light_object.data.energy = 1000.0
    
    
        # --- 4. Save and Export ---
        
        blend_save_path = os.path.join(SCRIPT_DIR, BLENDER_FILE_NAME)
        output_path = os.path.join(SCRIPT_DIR, EXPORT_FILE_NAME)
    
        # Save .blend file
        try:
            bpy.ops.wm.save_as_mainfile(filepath=blend_save_path)
            print(f"INFO: Successfully saved .blend file to: {blend_save_path}")
        except RuntimeError as e:
            print(f"WARNING: Failed to save .blend file. Reason: {e}")
    
        # Export to GLB
        bpy.ops.object.select_all(action='SELECT') # Select all objects for export
        
        try:
            bpy.ops.export_scene.gltf(
                filepath=output_path,
                export_format='GLB',
                export_apply=True,
                export_yup=True,
                export_animations=True, # Exports the rotation animation
                use_selection=True
            )
            print(f"INFO: Successfully exported GLB file to: {output_path}")
        except RuntimeError as e:
            print(f"ERROR: Failed to export GLB file. Reason: {e}")
    
    
    # --- Execution ---
    
    if __name__ == "__main__":
        generate_animated_rings()
        print(f"\n--- Animated Rings Generation Complete. \u2705 ---")
    
    

    2. How to Run the Python Script

    To execute this script you must run **Blender** from your computers command line Terminal on macOS/Linux or Command Prompt/PowerShell on Windows.

    Running the Command

    1. Save the Code: Save the script above as a file named low_poly_rings.py.
    2. Open Terminal/Command Prompt.
    3. Run the command: Execute Blender in background mode (-b) and tell it to run your script (-P). Replace the paths below with the actual location of your Blender executable and your script.
    /path/to/blender -b -P /path/to/low_poly_rings.py

    Upon successful completion this command will save two files in the same directory as your script:

    • low-poly-animated-rings.blend
    • low-poly-animated-rings.glb (The file you will use on the web)

    3. Lighting Your Scene with HDR Images

    In 3D graphics especially for realistic rendering we use **Image Based Lighting IBL** to illuminate the scene using high dynamic range images. This allows shiny objects like our glossy rings to reflect the environment naturally.

    Your rings are lit by the **Courtyard EXR** file which is a standard High Dynamic Range Imaging HDRI texture shipped with **Blender 5.0 LTS**. This image provides natural lighting and realistic reflections for the glossy materials defined in the script.

    4. Web Browser Support for Image Formats

    When deciding which HDRI or texture format to use on a website **browser support** is crucial. Here is a comparison of the mentioned formats and their web support:

    Format Type Web Browser Support Open Source Alternative
    .exr HDR Poor (Requires processing/conversion) .hdr (Radiance)
    .hdr HDR Poor (Requires processing/conversion) .hdr (Radiance)
    .ktx Texture Good (Supported via WebGL/WebGPU) .ktx (Open Standard)
    .ktx2 Texture Excellent (Modern Standard via WebGL 2/WebGPU) .ktx2 (Open Standard)

    Conclusion: For maximum modern browser support of animated 3D models and textures **.glb** which includes textures is the best choice and textures within the .glb or for IBL should ideally use formats supported by **WebGPU/WebGL** like **.ktx2**. The **.exr** file must be processed server side or by the model-viewer component before display.

    5. Displaying the Rings with model-viewer

    The easiest way to embed your animated .glb file into a blog post is by using the **model-viewer** component. It handles lighting controls and animation automatically.

    1. Add the script tag to the head of your HTML or blog post template:
      <script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.5.0/model-viewer.min.js"></script>
    2. Insert the component: Use the tag pointing to your exported .glb file.
      
      
      
      <model-viewer
          src="/path/to/low-poly-animated-rings.glb"
          alt="Three animated low-poly rings"
          shadow-intensity="1"
          camera-controls
          auto-rotate
          exposure="1.5"
          animation-name="default"
          autoplay
          loop
          style="width: 100%; height: 500px;"
      >
      </model-viewer>
      
      

    📸 Screenshots & Screencast

    Low poly animated-rings Python code
    Blender Scripting Workspace Displaying Low Poly Animated Rings Python Code

    Low poly animated-rings in Blender
    Blender Layout Workspace Displaying Low Poly Animated Rings

    Low poly animated-rings in Web browser
    Web Browser Displaying Rendered Low Poly Animated Rings

    Screencast For Blender Python API Low Poly Animated Rings

    About the Author

    If you are looking to deepen your Python and Blender skills check out my resources:

  • Review Blender 5.0 Python API

    Review Blender 5.0 Python API


    Blender 5.0 Python API: Key Changes and How to Work with Annotations and Grease Pencil

    Blender 5.0 introduces significant updates to the Python API, affecting how developers interact with Blender’s scripting interface. These changes impact several systems, including annotations, Grease Pencil, node handling, and more. In this post, we’ll break down the major changes and provide guidance on how to adapt to them in your scripts, particularly focusing on annotations and Grease Pencil.

    Blender 5.0 Python API – Key Changes and Summary

    Blender 5.0 introduces many significant updates and changes to its Python API. Here’s a summary of the major changes across various areas:

    1. Breaking Changes

    • Removal of unsupported access to runtime-defined properties storage data: bpy.props-defined properties no longer support direct access through dict-like syntax. Accessing properties like bpy.context.scene['cycles'] is no longer possible.
    • New methods get_transform and set_transform: These allow users to access and manipulate properties without directly modifying storage data, improving performance.
    • Read-only properties: Properties can now be defined as read-only using a new READ_ONLY flag. Having only a getter without a setter makes a property read-only.
    • Property handling and object manipulation: Accessing properties without triggering callbacks is no longer directly supported. Developers may need to restructure their code or use custom data storage to bypass property handling.

    2. New Features & Improvements

    • New get_transform and set_transform methods: These are specifically designed to be more efficient than older getter/setter methods, enabling faster updates and changes.
    • Extensions and Python Code Update: When working with old property access, now you’ll need to use methods like property_unset instead of using the dict-like access.
    • Bundled modules now private: Several internal Blender modules like bl_console_utils and bl_rna_utils are now private and should not be used by scripts.

    3. Renaming of API Elements

    • Grease Pencil to Annotation: Blender has renamed several Grease Pencil elements to Annotation elements for clarity and consistency. For example, bpy.types.GreasePencil is now bpy.types.Annotation, and bpy.data.grease_pencils is now bpy.types.annotations.
    • The stroke and frame structures for annotations are also renamed: For example, bpy.types.GPencilStroke is now bpy.types.AnnotationStroke.
    • Other renamed properties: Several properties were renamed to reflect the new structure, including MovieClip.grease_pencil to MovieClip.annotation, and Scene.grease_pencil to Scene.annotation.

    4. Deprecated Features and Removal

    • Deprecated BGL API removed: The old BGL API used for OpenGL-based drawing has been fully removed.
    • Removed features: Certain properties in the EEVEE render engine have been moved or renamed. For example, scene.eevee.gtao_distance is now part of the view_layer.
    • Deprecated compositor nodes: Some deprecated compositor nodes were removed, including combine and separate nodes.
    • Alembic and USD export changes: There were changes and removal of deprecated options for both Alembic and USD export operators.

    5. New Additions and API Enhancements

    • Native support for buffer protocols in mathutils: This update improves the handling of mathutils types like Vector by switching to float32 from float64 for better performance.
    • Node system updates: The compositor node interface has been simplified. For example, the Gamma node was replaced by its shader node counterpart.
    • Point cache and geometry improvements: The PointCache no longer has a compression property; caches are now always compressed.

    6. UI, Rendering, and Miscellaneous Updates

    • UI changes: Certain theme properties related to UI widgets were removed or renamed, like navigation_bar and tab_active.
    • Rendering updates: The render system now accepts optional frame_start and frame_end arguments in the render.render() operator.
    • Logging updates: Blender 5.0 introduces new logging features, including the ability to log context members during temporary overrides.

    7. Working with Annotations and Grease Pencil in Blender 5.0

    The Annotations and Grease Pencil API has undergone major changes in Blender 5.0, including:

    • Annotation Strokes: The AnnotationStroke objects replace the old Grease Pencil strokes.
    • Layer & Frame Management: Creating annotation layers and frames follows a new API structure, improving the organization and management of strokes.

    Creating and Manipulating Annotations & Grease Pencil in Blender 5.0

    In Blender 5.0, all Grease Pencil-related features have been moved to annotations. This allows for cleaner, more flexible scripting and better performance when working with strokes and layers. Here’s how you can create and manipulate annotations using the updated API.

    
    
    
    import bpy
    import sys
    
    # Define the name for our new Grease Pencil object
    gp_name = "GP_Minimal_Working"
    
    try:
        # --- 1. SETUP: Create the Grease Pencil Object ---
        gp_data = bpy.data.grease_pencils.new(gp_name)
        gp_object = bpy.data.objects.new(gp_name, gp_data)
        bpy.context.collection.objects.link(gp_object)
    
        bpy.context.view_layer.objects.active = gp_object
        gp_object.select_set(True)
    
        layer = gp_data.layers.new("Test_Layer", set_active=True)
        frame = layer.frames.new(0)
        drawing = frame.drawing
    
        # --- 2. STROKE CREATION 3 points, but they are all at (0, 0, 0) ---
        drawing.add_strokes([3]) 
        
        # --- 3. SAVE ---
        bpy.ops.wm.save_as_mainfile(filepath="gp_minimal.blend", check_existing=False)
    
    except Exception as e:
        print(f"\nFATAL EXECUTION ERROR: {e}", file=sys.stderr)
        sys.exit(1)
    
    

    This code demonstrates how to:

    • Create a new annotation object.
    • Add a new annotation layer.
    • Add a frame to the annotation layer.
    • Create a stroke and set its points to create shapes or annotations in 3D space.

    New Features in Blender 5.0 API: Performance Improvements

    Blender 5.0 introduces new methods like get_transform and set_transform that replace traditional getter and setter functions. These new methods are faster, providing significant performance improvements, especially when dealing with transformations and data manipulation. You should use these methods where possible for better performance in your scripts.

    Updated Node System and Geometry Nodes

    Blender 5.0 has overhauled the node system. Some nodes were deprecated or replaced, such as the CompositorNodeGamma being replaced by ShaderNodeGamma. Additionally, the geometry nodes API has been updated to simplify the creation and manipulation of nodes in node trees. These changes improve the usability and flexibility of the node-based systems in Blender.

    Handling Deprecated and Removed Features in Blender 5.0

    As part of the transition to Blender 5.0, several deprecated features have been removed or updated. Notably, the compositor nodes and bpy.types.GreasePencil (now renamed to bpy.types.Annotation) have undergone major changes. Scripts relying on these features will need to be updated to work with the new API. Furthermore, certain bundled Python modules have been made private and should no longer be used by scripts.

    📸 Screenshots & Screencast

    Grease Pencil Object Python code
    Blender Scripting Workspace Displaying Grease Pencil Object Python Code

    Grease Pencil Object in Blender Layout
    Blender Layout Workspace Displaying Grease Pencil Object

    Grease Pencil Object in Blender Shading
    Blender Shading Workspace Displaying Grease Pencil Object

    Screencast For Blender Python API Grease Pencil Object

    Resources and Further Learning

    Conclusion

    Blender 5.0 introduces significant improvements and changes to its Python API, particularly with annotations and Grease Pencil (now renamed to Annotations). By updating your code to reflect these changes, you can ensure smoother and more efficient development. The new get_transform and set_transform methods, alongside the updated node system and property access methods, provide substantial performance benefits. Be sure to adapt to the new standards to get the most out of Blender 5.0’s Python API.

  • CortexIDE 1.4.9 Advanced Editor Review

    CortexIDE 1.4.9 Advanced Editor Review


    CortexIDE A Comprehensive Open-Source Code Editor for Developers

    If you are looking for an AI-powered code editor that can boost your coding productivity with features like code completion, error detection, and intelligent suggestions, then CortexIDE is definitely worth considering. In this post, we will review CortexIDE, an open-source editor designed to make your programming tasks more efficient, especially when integrated with Local AI via Ollama and the Qwen 2.5-coder 7B model.

    What is CortexIDE?

    CortexIDE is an open-source, AI-driven code editor built to support modern development workflows. It integrates advanced AI models like Qwen 2.5-coder 7B to assist with real-time code generation, completion, error detection, and even code refactoring. This editor is designed for developers who want a smarter way to write code, helping them increase productivity without having to leave the editor.

    Key Features

    • Intelligent Code Completion: CortexIDE uses AI models like Qwen 2.5-coder to provide context-aware code suggestions, which speed up the coding process.
    • Real-Time Error Detection: The editor can spot errors as you code, offering suggestions for corrections.
    • Code Refactoring: Automatically suggests improvements to make your code cleaner and more efficient.
    • Cross-Platform Support: CortexIDE works on various operating systems, but here we will focus on its installation and setup on Fedora Linux.

    Installing CortexIDE on Fedora Linux

    CortexIDE is available for download from the official website at opencortexide.com, and it can be easily installed on Fedora Linux. Below are the steps to install CortexIDE and get it up and running with Local AI via Ollama.

    Prerequisites

    • Ollama installed via Fedora’s official repository.
    • CortexIDE app downloaded from the official website.
    • A working GPU if you intend to use the Qwen 2.5-coder 7B model for AI-powered code completion.

    Step-by-Step Installation

    1. Install Ollama

    To install Ollama on Fedora, simply run:

    sudo dnf install ollama

    2. Download and Install CortexIDE

    Visit the official CortexIDE website and download the app for Linux. After downloading, follow the installation steps provided on the site.

    3. Launch CortexIDE

    After installing, launch CortexIDE from your applications menu or via the terminal:

    cortexide

    4. Start Ollama (Local AI Server)

    Before you can use the Qwen 2.5-coder 7B model in CortexIDE, you need to start the Ollama server. Run the following command to start Ollama:

    ollama serve

    This will start the Ollama server, which will allow CortexIDE to access AI models locally.

    5. Download the Model via CortexIDE

    Once Ollama is running, CortexIDE will automatically recognize it as the local AI provider and pull the necessary Qwen 2.5-coder 7B model. No manual download is necessary-CortexIDE will handle this seamlessly.

    6. Start Using CortexIDE

    After the model is downloaded and Ollama is running, you can start coding with AI-powered features like code completion, real-time error detection, and more.

    Requirements For Programming Text Editor

    Glossary:

    Code Editor

    Designed for writing and editing source code.

    IDE

    Integrated Development Environment combines various tools need for software development.

    Plugin

    Software component that adds specific functionality.

    Theme

    Preset package containing graphical appearance to customize look and feel.

    Open source

    Freely available for possible modification and redistribution.

    SCM

    Source code management use to manage and track modifications to a source code repository.

    LMB

    Left Mouse Button (LMB) or left click

    MMB

    Middle Mouse Button (MMB) or scroll wheel

    Test Tools

    Test System
    Name Description
    CPU Ryzen 5 5600GT @ 3.60GHz.
    Memory 32GB DDR4.
    Operating System Fedora Linux Workstation 43.
    Desktop Environment Gnome 49.
    Name Description

    Test Suite
    Name Description
    Large File 1GB human-readable text.
    Regex File Text with word “Helix” repeated.
    Syntax File PHP file containing HTML, CSS & JavaScript.
    Media File Smiley face or Tux Linux JPEG file.
    Java Version OpenJDK 21.0.9.
    PHP Version PHP 8.4.14.
    Python Version Python 3.14.0.
    CortexIDE Version 1.4.9
    Name Description

    Test Scoring

    1. Each feature has two parts.
    2. Score of zero indicates a missing feature.
    3. A part of a feature is work a score of 0.5.

    Three bias elimination steps were utilized. The editor was used for at least three years on different platforms. Attempts were made to get stable plug-ins for missing features. The same editor was compared between the one in the repository, the developers website, and the compiled version if applicable.

    Selecting Editor Version

    For this review, CortexIDE was downloaded from the developers website and it did not require additional plugins.

    Features

    1. The theme can be native for the editor in terms of the background, and the dark theme did not need tweaks for source code management. CortexIDE comes with dark and light themes and others can be created or downloaded or changed from the menu File > Preferences > Theme > Color Theme. The score for the theme was 1.0.
    2. Dragging and dropping a text file into the editor opens a new tab. It is possible to specify the tab location during the drag and drop operation. The score for drag and drop into editor was 1.0.
    3. Opening a very large text file did not crash CortexIDE. An out of memory window was shown and it was not possible to edit the large file. The score for opening a large file was 0.5.
    4. Multiple documents can opened in multiple tabs. Tear-off tabs work by opening a new CortexIDE editor instances which is handy for multiple monitors. The score for multiple documents was a perfect 1.0.
    5. Multiple editors can be opened as new tabs with drag options. Every new editor tab can be split vertically or horizontally. The score for multiple editor view was a perfect 1.0.
    6. Creating non-project files is possible by dragging the folder into the workspace. Non-project files can be opened by the drag and drop operation. The score for creating non-project files was a perfect 1.0.
    7. Soft word wrap can be enabled in the menu View > Word Wrap. Automatic soft wrap for documents is available for CortexIDE. The score for word wrap was a perfect 1.0.
    8. Spell check works as words are typed but it requires an extension, I was not able to install Code Spell Checker due to the Editor version. Spelling errors are shown in opened documents. The score for spell check was a perfect 1.0.
    9. Word count is available for CortexIDE, but it requires an extension, I was not able to install Word Count due to the Editor version.. Selection word count is available. The score for word count was 1.0.
    10. Go to line CTRL-G can jump to a specified line. It is possible to jump to either the first or last line. The score for go to line was a perfect 1.0.
    11. Indentation can default to user-defined tab stops. Children are automatically indented. The score for indentation was a perfect 1.0
    12. Fonts can be dynamically scaled using CTRL-MMB after enabling feature in File > Preferences > Settings. The system font can be bypassed and a new editor font and size can be set. The score for fonts was a perfect 1.0.
    13. Find and replace using regular expressions can be utilized for all open documents in the current session. Find and replace will work for the current document or a selection in the current document. The score for find and replacing using regular expressions was 1.0.
    14. Multiple language syntax highlighting in one file is enabled if the language plug-ins are installed. Each language has code-sensitive syntax colors which can be modified. The score for multiple language syntax highlighting was a perfect 1.0.
    15. Code folding works for markup languages such as HTML. Code folding also works for programming languages such as Java and PHP. The score for code folding was 1.0.
    16. Selecting rectangular block per column works via a toggle or ALT-SHIFT on Linux. Rectangular block selections doe not work properly with word wrap enabled. The score for selecting rectangular block was a 0.5.
    17. Multiple selection works using the shortcut ALT and CTRL-SHIFT-L for words. Search multiple selection is not available. The score for multiple selection was 0.5.
    18. Distraction-free mode to hide panes works. Line numbers can be toggled to improve distraction-free mode. The score for distraction-free was a perfect 1.0.
    19. The file manager can create and delete folders. Media files can be dragged and dropped into the file manager pane. The score for file manager was a perfect 1.0.
    20. Terminal is integrated into CortexIDE. The terminal can follow folder. Terminal can execute system commands. The score for terminal was 1.0.

    Results

    CortexIDE is a very powerful IDE. By default, the CortexIDE editor is no longer missing required features which can be installed by using extensions. For my required features, the CortexIDE editor scored 92.50% or 9.25 out of 10.

    📱 Screenshots

    Ollama Server
    Command Line Displaying Ollama Server Running

    CortexIDE 1.4.9 Setup
    CortexIDE 1.4.9 Setup Screen

    CortexIDE 1.4.9 Ollama Setup
    CortexIDE 1.4.9 Local AI With Ollama Screen

    CortexIDE 1.4.9 Ollama Qwen 2.5-coder 7B
    CortexIDE 1.4.9 Local AI With Ollama Pulling Qwen 2.5-coder 7B

    CortexIDE 1.4.9 Settings Transfer
    CortexIDE 1.4.9 Settings And Themes Transfer Screen

    CortexIDE 1.4.9 Split View
    CortexIDE 1.4.9 Multiple Editor Split View

    CortexIDE 1.4.9 Folder View
    CortexIDE 1.4.9 Installed Folder View

    CortexIDE 1.4.9 Terminal View
    CortexIDE 1.4.9 Terminal View

    🞍 Screencast Tour

    Take a guided walk-through of some of CortexIDE 1.4.9’s best new features—from productivity tools to AI chat agents:

    CortexIDE 1.4.9 Tour And Review

    Addedum CortexIDE 1.4.9 With Updated Ollama Local AI

    How CortexIDE Makes Programming Easier

    With CortexIDE, you get access to powerful AI features that streamline your coding workflow. By integrating Local AI via Ollama and using the Qwen 2.5-coder 7B model, the editor provides intelligent, real-time suggestions that help you write better code faster. Whether you are writing complex functions or need help debugging, CortexIDE serves as a capable assistant.

    Learn More and Connect

    If you are looking to further improve your programming skills, check out these resources:

    Conclusion

    In this post, we have covered how to install and set up CortexIDE on Fedora Linux, and how it integrates with Ollama and the Qwen 2.5-coder 7B model for AI-powered code completion, error detection, and more. Whether you are a beginner or an experienced developer, CortexIDE offers a streamlined and efficient way to code.

  • How to Self-Host Stirling PDF: An Open-Source PDF Editor

    How to Self-Host Stirling PDF: An Open-Source PDF Editor


    Getting Started with Stirling PDF: Installation and Setup Guide

    Stirling PDF is an open-source tool designed to manage and process PDF files with ease. Whether you’re a developer looking to integrate PDF functionality into your web applications or someone who wants a robust tool for PDF manipulation, Stirling PDF can meet your needs. In this guide, we will show you how to install Stirling PDF on your server using Podman (or Podman Compose) for a containerized experience.

    What is Stirling PDF?

    Stirling PDF is a lightweight and efficient solution for handling PDF files. It’s open-source, which means anyone can freely use, modify, and distribute it. It’s particularly useful for developers who need to automate PDF-related tasks, such as converting files to PDF, merging multiple PDFs, or extracting text and images from PDFs.

    You can download and explore the project by visiting its official repository (link to repository, if applicable).

    Installation Instructions

    In this section, we’ll walk you through the process of installing Stirling PDF using Podman (a containerization tool). Podman is a great choice for running containers without requiring a central daemon, making it easier to manage and more secure.

    Prerequisites

    • A Linux-based system (although Podman can be installed on Windows and macOS, this guide assumes you’re using a Linux machine).
    • Podman installed on your machine. If you don’t have Podman installed, you can install it by running the following command:
    sudo apt install podman

    Alternatively, if you’re using a system with Podman Compose (to manage multi-container setups), you can install it with:

    sudo apt install podman-compose

    Step 1: Pull the Stirling PDF Container Image

    To get started with Stirling PDF, the first thing you’ll need to do is pull the container image from the container registry (make sure Stirling PDF’s container image is available on a public registry like Docker Hub or GitHub):

    podman pull stirlingpdf/stirlingpdf

    Step 2: Running Stirling PDF

    Once the image is downloaded, you can easily run Stirling PDF using the following command:

    podman run -d -p 8080:80 stirlingpdf/stirlingpdf

    This command will run Stirling PDF as a container and map port 8080 on your local machine to port 80 inside the container. You should now be able to access Stirling PDF at:

    http://localhost:8080

    If you’re using Podman Compose for a more complex setup with multiple containers, create a docker-compose.yml file like this:

    version: '3'
    services:
      stirlingpdf:
        image: stirlingpdf/stirlingpdf
        ports:
          - "8080:80"
        restart: always

    To run the setup with Podman Compose, use:

    podman-compose up

    Now, just like before, you can access Stirling PDF at:

    http://localhost:8080

    📱 Screenshots & Screencast

    Stirling PDF Compose YAML File
    Gnome Text Editor Displaying Stirling PDF Compose YAML File

    Stirling PDF Podman Compose Build
    Command Line Installation Of Stirling PDF Via Podman Compose Build

    Stirling PDF Setup
    Web Browser Showing Stirling PDF Setup Screen

    Stirling PDF Security Check
    Web Browser Showing Stirling PDF Setup Security Check Screen

    Stirling PDF Browse Layout
    Web Browser Showing Stirling PDF Setup Browse Layout Screen

    Stirling PDF Upload
    Web Browser Showing Stirling PDF Upload Screen

    Stirling PDF Recent Files
    Web Browser Showing Stirling PDF Recent Files Screen

    Stirling PDF System Settings
    Web Browser Showing Stirling PDF System Settings Screen

    Stirling PDF Text And Drawing
    Web Browser Showing Stirling PDF Edit Screen

    Stirling PDF Installation And Setup Screencast

    Need Help or Want More Features?

    If you need assistance with the installation or want to migrate your existing Stirling PDF setup, I am available for one-on-one online programming tutorials. You can reach out to me directly for personalized help with Stirling PDF or any other programming challenges you might have.

    Additional Resources

    If you’re looking to dive deeper into programming, check out my programming books on Amazon and explore my online programming courses. Whether you’re just getting started or looking to level up your skills, these resources will guide you in the right direction.

    I also offer installation and migration services for Stirling PDF. If you need professional help, feel free to get in touch through my services page.

    Conclusion

    With Stirling PDF, you can easily integrate PDF capabilities into your projects with just a few simple steps. If you need further assistance or more detailed instructions, don’t hesitate to reach out!

  • Review Generative AI codellama-7b-hf-q4_k_m.gguf Model

    Review Generative AI codellama-7b-hf-q4_k_m.gguf Model


    Steps to Configure Llama.cpp WebUI with Codellama 7B on Fedora 43

    In this tutorial, we will go through the steps to configure the Llama.cpp WebUI with Codellama 7B running on a Linux system with an AMD Instinct Mi60 32GB HBM2 GPU. This guide will help you set up the environment, install the necessary software, and ensure that everything works smoothly for optimal performance. If you’re new to machine learning or working with large models, this post is perfect for you.

    System Requirements

    Before we begin, ensure that your system meets the following requirements:

    • Operating System: Linux (tested on Fedora 43)
    • GPU: AMD Instinct Mi60 32GB HBM2 (or similar AMD GPU with ROCm support)
    • Memory: Minimum 32GB RAM recommended for smooth operation
    • Disk Space: At least 100GB free for storing models and data
    • Software:
      • Linux Kernel version 5.10 or higher
      • ROCm (Radeon Open Compute) for AMD GPU acceleration
      • Python 3.8 or higher

    Is Code Llama 7B Open Source?

    Yes, Code Llama 7B is available for free public use and is often referred to as open source, though its licensing is more nuanced than a simple open-source license.

    It is an advanced version of the Meta Llama 2 large language model (LLM), fine-tuned specifically for coding tasks. It is not based on Llama.cpp, but is a model developed by Meta.

    Code Llama 7B is licensed under the Meta Llama 2 Community License, which allows for free use, modification, and distribution for most research and commercial purposes. This license is not the MIT License and includes a restriction on commercial use by companies with over 700 million monthly active users.

    Installation Steps

    1. Update Your Fedora System

    First, ensure that your Fedora system is up to date. Open a terminal and run:

    sudo dnf update -y

    2. Install Llama.cpp from Fedora Repositories

    Next, install the llama.cpp package from the Fedora repositories:

    sudo dnf install llama-cpp

    3. Install ROCm for AMD GPU Support

    Since you’re using an AMD Instinct Mi60 GPU, you need to install ROCm (Radeon Open Compute) to enable GPU acceleration. Use the following command:

    sudo dnf install rocm

    4. Verify ROCm Installation

    Once ROCm is installed, verify that your AMD GPU is recognized and working correctly by running the following command:

    rocminfo

    This should show information about your GPU. If it does not, check the official ROCm documentation for troubleshooting.

    5. Download Codellama 7B Model Files

    Download the Codellama 7B model files. Make sure you store them in an accessible directory on your system (e.g., /models/codellama/).

    6. Running Codellama 7B with Llama-server

    Once the models are downloaded, you can run the server with the following command:

    llama-server -hf ggml-org/codellama-7b-GGUF --jinja -c 0 --host 127.0.0.1 --port 8033

    This will start the server at http://127.0.0.1:8033, where you can access the WebUI.

    7. Access the WebUI

    Once the server is running, open a browser and navigate to http://127.0.0.1:8033 to interact with Codellama 7B.

    Screenshots and Screencast

    Here’s where you’ll find a visual walkthrough of setting up codellama-7b-hf-q4_k_m.gguf using Alpaca llama.cpp on your local system:

    Start Llama.cpp Server
    Command Line Starting Llama.cpp Server.

    Llama.cpp WebUI Settings
    Web Browser Running Llama.cpp WebUI Displaying Settings.

    codellama-7b-hf-q4_k_m.gguf answered question about the Mayor
    Command Line codellama-7b-hf-q4_k_m.gguf Answered Mayor Of Toronto Request.

    codellama-7b-hf-q4_k_m.gguf answered question about PHP code
    Command Line codellama-7b-hf-q4_k_m.gguf Answered PHP Code Request.

    codellama-7b-hf-q4_k_m.gguf answered question about screenshot
    Command Line codellama-7b-hf-q4_k_m.gguf Answered Gnome Desktop Screenshot Request.

    codellama-7b-hf-q4_k_m.gguf answered request for Kotlin code
    codellama-7b-hf-q4_k_m.gguf Answered Kotlin Code Request.

    codellama-7b-hf-q4_k_m.gguf answered request for Blender Blend File
    codellama-7b-hf-q4_k_m.gguf Answered Blender Blend File Request.

    Video Displaying Using codellama-7b-hf-q4_k_m.gguf In Custom Web UI For llama.cpp Client

    Addendum Video Displaying Tweaking codellama-7b-hf-q4_k_m.gguf llama.cpp WebUI

    Results:

    Who is the mayor of Toronto?

    Produced inaccurate current answer to Olivia Chow as the mayor of Toronto.

    I need a PHP code snippet to connect to a MySQL database.

    Produced no PHP code snippet to connect to a MySQL database.

    I need a 1080p screenshot of the gnome desktop environment.

    Inaccurately provided instructions to generate a 1080p screenshot of Gnome desktop environment because it is a text-based AI lacking ability.

    I need a kotlin code snippet to open the camera using Camera2 API and place the camera view on a TextureView.

    Produced no Kotlin code snippet.

    I need a blender blend file for fire animation.

    Produce gibberish instead of Blender Blend file for a fire animation because it is a text-based AI lacking ability.

    Additional Resources

    Books

    If you are new to Python programming, check out my book Learning Python for a beginner-friendly approach.

    Courses

    Take my course Learning Python to get hands-on with Python.

    One-on-One Python Tutorials

    For personalized Python help, contact me via Contact.

    Codellama Installation/Support

    Need help with Codellama 7B installation or migration? I offer services at Ojambo Services.

    Conclusion

    By following these steps, you can easily set up and run Codellama 7B on your Fedora 43 system, with llama-server handling the WebUI and providing easy interaction with the model. No additional custom installations are required beyond Fedora’s official packages for both llama.cpp and ROCm.

  • PHP Text PDF Generator App

    PHP Text PDF Generator App


    How to Generate Text PDFs Using PHP Without Third-Party Libraries

    In this tutorial, we will walk through how to generate PDF files with simple text using PHP without any external libraries, and we will also create a styled HTML5 form that allows you to input text and generate a PDF. This tutorial will show you how to:

    • Build a form to accept text input.
    • Use PHP to generate a PDF from the input text.
    • Provide a download link for the generated PDF using Fetch API.

    Step 1: Create the HTML Form

    First, we will create a simple HTML5 form where users can input the text they want to convert into a PDF. The form will be styled for a clean and simple user experience.

    
    
    
            <style>
                body {
                    font-family: Arial, sans-serif;
                    margin: 0;
                    padding: 0;
                    background-color: #f7f7f7;
                }
                .container {
                    max-width: 800px;
                    margin: 50px auto;
                    padding: 20px;
                    background-color: #fff;
                    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
                }
                h1 {
                    text-align: center;
                    color: #333;
                }
                textarea {
                    width: 100%;
                    height: 150px;
                    padding: 10px;
                    font-size: 16px;
                    border: 1px solid #ccc;
                    margin-bottom: 20px;
                    border-radius: 5px;
                }
                button {
                    background-color: #28a745;
                    color: white;
                    padding: 10px 20px;
                    font-size: 16px;
                    border: none;
                    cursor: pointer;
                    border-radius: 5px;
                    display: block;
                    width: 100%;
                }
                button:hover {
                    background-color: #218838;
                }
                #downloadLink {
                    display: none;
                    text-align: center;
                    margin-top: 20px;
                }
            </style>
        <div class="container">
            <h1>Generate PDF from Text</h1>
            <form id="pdfForm">
                <textarea id="inputText" placeholder="Enter the text you want to convert to PDF..."></textarea>
                <button type="submit">Generate PDF</button>
            </form>
    
            <div id="downloadLink">
                <a href="#" id="pdfDownload" download>Download PDF</a>
            </div>
        </div>
    
        <script>
            document.getElementById('pdfForm').addEventListener('submit', async function(e) {
                e.preventDefault();
    
                const text = document.getElementById('inputText').value;
    
                // Sending data to PHP to generate PDF
                const response = await fetch('generate_pdf.php', {
                    method: 'POST',
                    headers: { 'Content-Type': 'application/json' },
                    body: JSON.stringify({ text })
                });
    
                const data = await response.json();
    
                if (data.success) {
                    // Show the download link
                    const pdfLink = document.getElementById('pdfDownload');
                    pdfLink.href = data.pdf_url;
                    document.getElementById('downloadLink').style.display = 'block';
                }
            });
        </script>
    
    

    Step 2: PHP Script to Generate the PDF

    Now we need a PHP script that receives the input text, creates a PDF, and returns a link to download the file.

    
    
    
        // Check if the request is a POST request with JSON data
        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
            $data = json_decode(file_get_contents('php://input'), true);
            
            if (isset($data['text'])) {
                $text = $data['text'];
    
                // Define the path for the PDF file
                $pdf_file = 'generated_pdf.pdf';
    
                // Open the file in write mode
                $file = fopen($pdf_file, 'w');
    
                // Write the raw PDF content
                fwrite($file, "%PDF-1.4\n");
                fwrite($file, "1 0 obj\n");
                fwrite($file, "<< /Type /Catalog /Pages 2 0 R >>\n");
                fwrite($file, "endobj\n");
                fwrite($file, "2 0 obj\n");
                fwrite($file, "<< /Type /Pages /Kids [3 0 R] /Count 1 >>\n");
                fwrite($file, "endobj\n");
                fwrite($file, "3 0 obj\n");
                fwrite($file, "<< /Type /Page /Parent 2 0 R /Resources << /Font << /F1 4 0 R >> >> /MediaBox [0 0 300 300] /Contents 5 0 R >>\n");
                fwrite($file, "endobj\n");
                fwrite($file, "4 0 obj\n");
                fwrite($file, "<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>\n");
                fwrite($file, "endobj\n");
                fwrite($file, "5 0 obj\n");
                fwrite($file, "<< /Length " . (strlen($text) + 44) . " >>\n");
                fwrite($file, "stream\n");
                fwrite($file, "BT\n");
                fwrite($file, "/F1 12 Tf\n");
                fwrite($file, "100 250 Td\n");
                fwrite($file, "($text) Tj\n");
                fwrite($file, "ET\n");
                fwrite($file, "endstream\n");
                fwrite($file, "endobj\n");
    
                // Cross-reference table and trailer (same as before)
                fwrite($file, "xref\n");
                fwrite($file, "0 6\n");
                fwrite($file, "0000000000 65535 f \n");
                fwrite($file, "0000000010 00000 n \n");
                fwrite($file, "0000000079 00000 n \n");
                fwrite($file, "0000000172 00000 n \n");
                fwrite($file, "0000000275 00000 n \n");
                fwrite($file, "0000000364 00000 n \n");
                fwrite($file, "trailer\n");
                fwrite($file, "<< /Size 6 /Root 1 0 R >>\n");
                fwrite($file, "startxref\n");
                fwrite($file, "474\n");
                fwrite($file, "%%EOF\n");
    
                // Close the file
                fclose($file);
    
                // Return the file URL in JSON format
                echo json_encode([
                    'success' => true,
                    'pdf_url' => $pdf_file
                ]);
            } else {
                echo json_encode(['success' => false, 'message' => 'No text provided']);
            }
        } else {
            echo json_encode(['success' => false, 'message' => 'Invalid request']);
        }
    
    

    Step 3: Add Screenshots and YouTube Video

    Screenshots And Screencast

    Generate PDF HTML Code
    Gnome Text Editor Displaying HTML PDF Generator Code

    Generate PDF PHP Code
    Gnome Text Editor Displaying PDF Generator Code

    Generate PDF Form
    Web Browser Displaying Empty Generate PDF Form

    Filled Generate PDF Form
    Web Browser Displaying Finished Generate PDF Form

    Download Generated PDF
    Web Browser Displaying PDF Download Completed

    PHP Text To PDF Video

    Step 4: Promote Your Book and Course

    If you enjoyed this tutorial, you will love my book, Learning PHP, where I go deeper into PHP programming concepts and much more.

    Additionally, check out my comprehensive Learning PHP Course, perfect for beginners who want to become proficient in PHP.

    Step 5: One-on-One PHP Tutorials

    Are you looking to take your PHP skills to the next level? I offer one-on-one programming tutorials and can assist with updating or migrating your PHP applications. Contact me today to schedule a session.

    That’s all for today’s tutorial! Thanks for reading, and happy coding!

  • Build An HTML5 Flashing Neon Star

    Build An HTML5 Flashing Neon Star


    Bring the Bling: Create a Flashing Neon Star with HTML5 and CSS3 (No JavaScript Needed)

    Hello Web Designers

    Welcome to a fun beginner friendly tutorial that will show you how to add some serious bling to your website. We are going to create a dazzling flashing neon star using just two simple web languages: HTML5 for the structure and CSS3 for the style and animation.

    The best part? No complicated JavaScript is required! We will rely entirely on the power of CSS animations to make our star flicker and glow.

    Step 1: The HTML5 Foundation

    First let us set up the structure of our page. We will use a single character star inside a div to represent our star. You can save this as index.html.

    
    
    
    <style></style>
        <div class="star-container">
            <div class="neon-star">★</div>
        </div>
    
    

    Step 2: The CSS3 Magic (The Neon Glow)

    Now for the fun part! Create a file named styles.css. This code applies a dark background and centers the star. The real magic happens with the text-shadow property which creates the vibrant neon effect.

    
    
    
    body {
        background-color: #000;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        margin: 0;
    }
    
    .star-container {
        font-size: 10em; /* Makes the star huge! */
    }
    
    /* The core neon styling */
    .neon-star {
        color: #ff00ff; /* The stars color */
        text-shadow:
            0 0 5px #ff00ff,
            0 0 15px #ff00ff,
            0 0 30px #ff00ff,
            0 0 50px #ff00ff; /* Stacked shadows create the glow */
    }
    
    

    Step 3: The CSS3 Animation (The Flash/Flicker)

    To make the star flash like a faulty neon sign we use @keyframes. This rule defines how the style changes over time. We will make the star dim and lose its glow momentarily.

    Add this animation code to the bottom of your styles.css file:

    
    
    
    /* Apply the flashing animation to the star */
    .neon-star {
        /* ... (Existing styling goes here) ... */
        animation: flash 1.5s infinite alternate ease-in-out; 
    }
    
    /* Define the flashing effect */
    @keyframes flash {
        0% {
            opacity: 1; 
            text-shadow: 0 0 5px #ff00ff, 0 0 15px #ff00ff, 0 0 30px #ff00ff, 0 0 50px #ff00ff;
        }
        50% {
            opacity: 0.2; /* Dims the star */
            text-shadow: none; /* Turns off the glow */
        }
        100% {
            opacity: 1; 
            text-shadow: 0 0 5px #ff00ff, 0 0 15px #ff00ff, 0 0 30px #ff00ff, 0 0 50px #ff00ff;
        }
    }
    
    

    Consolidated Demo

    HTML5 Flashing Neon Star Demo

    Screenshot

    HTML5 Flashing Neon Star
    Web Browser Showing HTML5 Flashing Neon Star

    Live Screencast

    Screencast Of HTML5 Flashing Neon Star

    Level Up Your Coding Skills!

    While this cool effect only uses HTML and CSS the next step in web development is mastering JavaScript!

    If you are ready to dive into client side interactivity data manipulation and building complex applications I have the perfect resources for you:

    Happy coding and may your websites always be dazzling!