This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ballerina/artemis; | |
| import ballerina/io; | |
| @artemis:ServiceConfig{ | |
| queueConfig:{ | |
| queueName:"my_queue" | |
| } | |
| } | |
| service artemisConsumer on new artemis:Listener({host:"localhost", port:61616}){ | |
| resource function onMessage(artemis:Message message) returns error? { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ballerina/artemis; | |
| import ballerina/log; | |
| import ballerina/io; | |
| public function main() { | |
| artemis:Producer prod = new({host:"localhost", port:61616}, "my_queue"); | |
| map<string> msg = {"Hello":"World", "some":"world"}; | |
| byte[] vals = [1,2,2,3,3,2]; | |
| var err = prod->send(vals); | |
| err = prod->send(msg); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ballerina/artemis; | |
| import ballerina/io; | |
| @artemis:ServiceConfig{ | |
| queueConfig:{ | |
| queueName:"my_queue", | |
| addressName:"my_address", | |
| routingType: artemis:MULTICAST | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ballerina/artemis; | |
| import ballerina/log; | |
| import ballerina/io; | |
| public function main() { | |
| artemis:Producer prod = new({host:"localhost", port:61616}, "my_address", addressConfig = {routingType:artemis:MULTICAST}); | |
| map<string> msg = {"Hello":"World", "some":"world"}; | |
| byte[6] vals = [1,2,2,3,3,2]; | |
| io:ReadableByteChannel ch = io:openReadableFile("/home/riyafa/abc.pdf"); | |
| var err = prod->send(vals); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ballerina/http; | |
| import ballerina/io; | |
| import ballerina/log; | |
| @http:ServiceConfig { | |
| basePath: "/" | |
| } | |
| service httpService on new http:Listener(9090) { | |
| @http:ResourceConfig { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ballerina/http; | |
| import ballerina/io; | |
| import ballerina/log; | |
| public function main() { | |
| http:WebSocketClient wsClientEp = new("ws://localhost:9090/ws/xyz/Mawanella?age=26", | |
| config = {callbackService: ClientService, customHeaders:{"X-name":"Riyafa"}, subProtocols:["xml"]}); | |
| var err = wsClientEp->pushText("hello"); | |
| if (err is error) { | |
| log:printError("Error in sending text", err = err); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Arrays; | |
| public class MatrixMultiplicationRecursive { | |
| public static void main(String[] args) { | |
| int[][] A = new int[][]{{13, -3, -25, 20}, {-3, -16, -23, 18}, {20, -7, 12, -5}, {-22, 15, -4, 7}}; | |
| int[][] B = new int[][]{{13, 10, 11, 12}, {13, 14, -23, 18}, {20, -7, 12, -11}, {-12, -13, -14, 7}}; | |
| System.out.println(Arrays.deepToString( | |
| multiply(A, B, 0, 0, 0, 0, A.length) | |
| )); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Arrays; | |
| public class MatrixMultiplicationStrassen { | |
| public static void main(String[] args) { | |
| /*int[][] A = new int[][]{{1, 3}, {7, 5}}; | |
| int[][] B = new int[][]{{6, 8}, {4, 2}};*/ | |
| int[][] A = new int[][]{{13, -3, -25, 20}, {-3, -16, -23, 18}, {20, -7, 12, -5}, {-22, 15, -4, 7}}; | |
| int[][] B = new int[][]{{13, 10, 11, 12}, {13, 14, -23, 18}, {20, -7, 12, -11}, {-12, -13, -14, 7}}; | |
| System.out.println(Arrays.deepToString( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ballerina/http; | |
| import ballerina/io; | |
| listener http:Listener ep = new (9090); | |
| service wsService = @http:WebSocketServiceConfig {} service { | |
| resource function onText(http:WebSocketCaller wsEp, string text) { | |
| io:println("Sever Received: " + text); | |
| } | |
| resource function onClose(http:WebSocketCaller wsEp, int statusCode, string reason) { | |
| io:println("Connection closed"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json, os | |
| import os | |
| import time | |
| import urllib | |
| import urllib2 | |
| from os.path import expanduser | |
| from datetime import datetime | |
| home_site = "http://bing.com" | |
| weekly_wallpapers_url = home_site + "/HPImageArchive.aspx?format=js&idx=0&n=8&mkt=en-US" |