This repository contains scripts for Blender (checked with 3.4.1 version) that allow you to parse and visualize single-material .gcode files generated with PrusaSlicer.
The developed parser combines all perimeters as Shell, all infills – as Fill, and all supports – as Support.
Setup Blender environment
You can manually set light sources, camera settings, background images, HDRI maps, and materials. Alternatively, you can run certain scripts (“scene_setup_scripts” folder) to automate some parts of this process.
Blender scene
The script-based scene genetator picks the local “print_bed.jpg” file and scales it to real 210×210 mm Prusa Printer dimensions.
Run in Blender
To run it in Blender: (1) copy the code from the “blender_scripts” folder, (2) paste in a new script created in the “Scripting” tab, (3) update the “TODO” sections in the code, and (4) hit the “Run” button.
When you run a script, Blender becomes unresponsive. Therefore, switch the system console window to be able to “Ctrl+C” (break) processing in case of any errors.
Toggle system console
Console window
Add automatic animation
Uncomment the animate_layers() function in the script.
Sample (and rather simple) .NET6 microservices solution which acts as the data aggregator for the different feeds.
The purpose of this solution is to explore the latest framework and play with different patterns, tools & libraries that can be useful when building distributed applications (but not only).
The overall repository structure consists of the following projects located under src directory:
Gateway – API gateway providing a public facade for the underlying, internal services
Aggregator – core service responsible for aggregating the data from different feeds
Notifier – supporting service responsible for sending the notifications
Feeds
News – sample feed providing the worldwide news
Quotes – sample feed providing the quotes (e.g. currency)
Weather – sample feed providing the weather related data
Episodes
The implementation process can be found on our DevMentors YouTube channel, where we publish the videos about building this project.
You can navigate through this repository via specific episode tags which are related to the videos.
This Rx2Animations library is only compatible with rxJava 2.
If you are searching for the one compatible with rxJava 1, take a look over here.
Usage
A sample project which provides code examples that demonstrate uses of the classes in this
project is available in the sample-app/ folder.
True power of this library is the ability to use animations as an observable asynchronous action.
That enables us to apply regular rxJava APIs on the animations.
It provides a couple of classes such as RxValueAnimator, RxValueObservable and RxAnimationBuilder.
Moreover, it also provides many regulary used animation methods (static import) such as fadeIn(), fadeOut(), slideIn(), leave() etc.
Animation created with RxAnimationBuilder automatically pretransforms the view, if not set otherwise.
I.e. if fadeIn() is called, views opacity will be set to 0.f before animation starts.
Managing animations
Starting animation – Every animation chain is started when we subscribe to it. Ending animation – Animations can be easily stopped by unsubscribing animation subscription.
LICENSE
Copyright 2016 Mihael Franceković
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Red Hat® OpenShift® is an enterprise-ready Kubernetes container platform with full-stack automated operations to manage hybrid cloud and multicloud deployments. Red Hat OpenShift is optimized to improve developer productivity and promote innovation
CI/CD is one of the popular use-cases for OpenShift Container Platform. OpenShift scales the pipeline execution through on-demand provisioning in containers. OpenShift provides an end-to-end solution for building complete deployment pipelines and removes the wait time for running builds in large projects
Source-to-Image: Developers do not need to be experts in Dockerfiles or either operating system commands. S2I is responsible to create resources for developers, we only need to pass our central repository URL.
Build Config: The build config is responsible to fetch the code from central repo and build an image in OpenShift and push them in the internal Docker registry.
Deploy Config: Once the image is successfully built then deploy config is responsible for deploying the application in pods into OpenShift.
Step 2. Understand CICD Workflow in RedHat OpenShift
First, when we pass oc new-app it will create a Build Configuration.
It will create a Builder pod that clones the application from the central repo.
Once the source code successfully cloned it will create an image
Builder pod pushes the image to the external and internal registry.
Check if the image is created from the available images in OpenShift or need to create a fresh image layer.
S2I image stream will check if there are any changes in the image.
The change will be notified to Build Config
Once the complete process of Build is done then comes the responsibility of Deployment Configuration to create the pods in OpenShift depending on the image specifications.
Click on Access the OpenShift Lab and you will be redirected to the lab page (wait it will take some time to provision the lab resources)
Once it is done you can see the below page.
Step 5. Deploy an application using S2I Method
Click on Terminal on top.
Run command oc status to check cluster is provisioned successfully, the current project as sn-labs-mahsankhan .(in your case it will be different)
Run command oc new-app --name=bankapplication https://github.com/mahsankhaan/CICD-in-RedHat-OpenShift.git to deploy the application (Please note GitHub URL will be your fork URL done in Step 3)
Build will start and you can see the logs by oc logs -f bc/bankapplication
Run command oc get pods -w and can verify build and deploy stages are successfully complete and one pod is running bankapplication-1-n6ddx (in your case it will be different)
Pass command oc expose svc/bankapplication to expose the application to the world.
Now get the route of the application oc get routes. Open the host (bankapplication-sn-labs-mahsankhan.labs-user-sandbox-…) in the browser and check bank application is up and running.
Step 6. Update some code to check continuous Integration and Delivery
Open the repo (in your case kindly open your Fork repo) this is important because you can’t make a change in this repo directly.
Open Folder views -> admin_login.ejs (Open File at line 141 make it WELCOME ADMIN LOGIN), Click commit changes.
Now again open the terminal and pass command oc start-build bankapplication now complete workflow will take place as discussed in Step 2 .
Again run the command oc get pods and now can check a new build-2 is running. A newly updated pod would be created bankapplication-2-vb8rg and the previous one would be deleted.
Open the same URL again and can verify the update.
# launch dev script using latest supported versions for both Azure and Terraform CLI
./dev.sh
Optionally, it is possible to choose the tools desired versions:
# Set desired tool versions
AZURE_CLI_VERSION=2.24.2
TERRAFORM_VERSION=0.15.5
# launch dev script with parameters
./dev.sh $AZURE_CLI_VERSION$TERRAFORM_VERSION
🙏 Roadmap & Contributions
Please refer to the github project to track new features.
You can pass a string value to the Status() function parameter which is by default ResponseType::JSON using the Response namespace PhpSlides\Enums\ResponseType
In returning value in JSON format. The parameter includes this enum value type:
The success() method takes 2 parameters, $data to render and $status which is the status code.
The first parameter can be either Array or String and the second parameter is an Integer from StatusCode static class.
It returns ResponseType::<type> which is passed as a parameter in the Status() function.
Returning an error Api message using the error() method
It also takes 2 parameters, the first is either an Array or String and the second which is interger for setting http_response_code,
it has default value of StatusCode::INTERNAL_SERVER_ERROR which is 500
It also returns ResponseType::<type>
return (newStatus(ResponseType::JSON))->error('User not Found', StatusCode::NOT_FOUND);
Full code for success() & error() methods
If no parameter is specified in the Status(),
by default it’s returning ResponseType::JSON for returning response in JSON format
<?phpnamespaceApp\Controller\Api;
usePhpSlides\Http\Interface\ApiController;
usePhpSlides\Http\ResponseType;
usePhpSlides\StatusCode;
usePhpSlides\Status;
finalclass UserController extends Controller
{
publicfunctionindex(int$user_id) {
$status = newStatus();
if ($user_id === 1) {
$user = [
'name': 'John Doe',
'email': 'john@doe.com',
'user_id': $user_id
];
$response = $status->success($user); // by default the second parameter is `StatusCode::OK`
} else {
// not found message$response = $status->error("User user_id=$user_id is not found", StatusCode::NOT_FOUND);
}
return$response; // return message as a JSON format `Response::JSON`
}
}
?>
public function set (mixed $data, int $status = StatusCode::NO_CONTENT, string $statusText = StatusText::NO_CONTENT ): void;
public function setStatus (int $status): void;
public function setStatusText (string $statusText): void;
public function setMessage (mixed $message): void;
public function error (array|string $data, int $status = StatusCode::INTERNAL_SERVER_ERROR): string|array;
public function success (array|string $data, int $status = StatusCode::OK): string|array;
Response{} Interface Method
public static function json(array $data = [], int $status = StatusCode::OK): string;
public static function html(array $data = [], int $status = StatusCode::OK): string;
public static function csv(array $data = [], int $status = StatusCode::OK): string;
public static function xml(array $data = [], int $status = StatusCode::OK): string;
public static function array(array $data = [], int $status = StatusCode::UNSUPPORTED_MEDIA_TYPE): array;
enum ResponseType{} Interface
const JSON = 'JSON';
const HTML = 'HTML';
const CSV = 'CSV';
const XML = 'XML';
DOCUMENTATION
Status Class Methods
The Status class provides several methods to manage and format API responses in different formats such as JSON, HTML, CSV, or XML. Here’s a quick guide on how to use them.
The constructor initializes a new Status instance. You can specify the response format by passing a ResponseType enum value. If no value is passed, it defaults to ResponseType::JSON.
$status = newStatus(); // Defaults to JSON$status = newStatus(ResponseType::HTML); // Initializes with HTML response type
getStatus(): int
This method retrieves the current HTTP status code.
$httpStatus = $status->getStatus(); // Returns the current HTTP status code
getStatusText(): string
Retrieves the status text corresponding to the HTTP status code.
$statusText = $status->getStatusText(); // Returns status text, e.g., "OK" for 200
getMessage(): mixed
Gets the message set for the response. This could be an array, string, or any data type depending on the response.
$message = $status->getMessage(); // Returns the message set in the response
get(): string|array
Retrieves the response data in its raw form, either as a string or an array.
$response = $status->get(); // Returns the raw response data
getJson(): string
Converts the response data to a JSON string. This method is useful when you need to explicitly get the response in JSON format.
$jsonResponse = $status->getJson(); // Returns the response as a JSON string
Sets the response data, status code, and status text. This method is used to manually define the response properties.
$status->set(['key' => 'value'], StatusCode::OK, StatusText::OK); // Sets custom response data
setStatus(int $status): void
Sets the HTTP status code.
$status->setStatus(StatusCode::OK); // Manually set the status code
setStatusText(string $statusText): void
Sets the status text corresponding to the HTTP status code.
$status->setStatusText(StatusText::OK); // Manually set the status text
setMessage(mixed $message): void
Sets the message for the response. This message can be an array, string, or any other data type.
$status->setMessage('Success message'); // Manually set the response message
error(array|string $data, int $status = StatusCode::INTERNAL_SERVER_ERROR): string|array
Creates an error response. You can pass the error message and an optional status code. By default, it sets the status code to 500 (Internal Server Error).
The Response class provides static methods to directly return responses in different formats. These methods are especially useful when you want to quickly output data without creating a Status instance.
json(array $data = [], int $status = StatusCode::OK): string
Returns the data in JSON format with the specified HTTP status code.
usingSystem.Collections.Generic;usingMicrosoft.AspNetCore.Mvc;namespaceChatRoom.Controllers{[Route("api/[controller]")][ApiController]publicclassPollingController:ControllerBase{staticprivateList<Msg>Messages=newList<Msg>();staticprivateDictionary<string,int>Subscribers=newDictionary<string,int>();// POST api/polling/subscribe[HttpPut("subscribe/{id}")]publicvoidSubscribe(stringid){if(!Subscribers.ContainsKey(id)){Subscribers.Add(id,0);}}// POST api/polling[HttpPost]publicvoidPost([FromBody]Msgmsg){Messages.Add(msg);}// GET api/polling/[id][HttpGet("{id}")]publicActionResult<IEnumerable<Msg>>Get(stringid){if(Subscribers[id]==Messages.Count){returnnull;}varindex=Subscribers[id];Subscribers[id]=Messages.Count;returnMessages.GetRange(index,Messages.Count-index);}}// 可以创建一个 Msg.cs 文件来放这个类,并且可以放在一个 Models 文件夹中// 此处为了方便就直接放在 ChatRoom.Controllers 命名空间下了publicclassMsg{publicstringuser{get;set;}publicstringmessage{get;set;}publicMsg(stringuser,stringmessage){this.user=user;this.message=message;}}}
usingSystem.Collections.Generic;usingSystem.Threading;usingMicrosoft.AspNetCore.Mvc;namespaceChatRoom.Controllers{[Route("api/[controller]")][ApiController]publicclassLongPollingController:ControllerBase{privatestaticList<Msg>Messages=newList<Msg>();privatestaticDictionary<string,int>Subscribers=newDictionary<string,int>();privatestaticManualResetEventmre=newManualResetEvent(false);// POST api/longPolling/subscribe[HttpPut("subscribe/{id}")]publicvoidSubscribe(stringid){if(!Subscribers.ContainsKey(id)){Subscribers.Add(id,0);}}// POST api/longPolling[HttpPost]publicvoidPost([FromBody]Msgmsg){Messages.Add(msg);mre.Set();}// GET api/longPolling/[id][HttpGet("{id}")]publicActionResult<IEnumerable<Msg>>Get(stringid){if(!Subscribers.ContainsKey(id)){returnnull;}if(Subscribers[id]>=Messages.Count){mre.Reset();mre.WaitOne();}varindex=Subscribers[id];Subscribers[id]=Messages.Count;returnMessages.GetRange(index,Messages.Count-index);}}}