instruction
stringlengths
71
71.9k
I'm writing a python script to find restrictionplaces. I was wondering if there is a better way to write the following: def restrictionplace(string, minLength = '', maxLength = ''): if minLength == '': minLength = 4 if maxLength == '': maxLength = 12 #rest of script if there is no min or maxlength given, ...
I wrote this function that takes 2 arguments - the path to an existing file - file, and the newRoot name. The function splits the new path into directories, replaces the first directory in the path to the file with newRoot, , then loops trough all the directories checking if the director exists, and if not creates one:...
I solved this problem in LeetCode. Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal. Note: Each of the array element will not exceed 100. The array size will not exceed 200. Example 1: Input: ...
I've written this small code chunk to implement a very basic spline system for object motions. As I've only used C# on Unity3D so far I would appreciate feedbacks on this, especially on access levels, naming and the use of C# API. Most of this code is executed before runtime so I'm not really concerned about performanc...
I am new to python and wrote a email redirect script. It extracts mails from a server and than resend them. I would like to get some feedback: import sys import smtplib import poplib import re import argparse def validate_email_address(address): email_pattern = '^[^@]+@[^@]+\.[^@]+$' if not re.match(email_pat...
A while ago, I posted about advice for refactoring a game of Quarto I had coded before. I got some good advice, and did some revisions in lieu of this. import itertools # Enums for quarto. DRAW = "D" WIN = "W" UNDECIDED = "U" LOSE = "L" TIE = "T" class Piece(): """ Piece class: Each piece has a name (string...
def standvastig(reeks): """ Checks if the given input (list or number) is a series of one number (eg. 444444, 2222, etc.) Remark: raise an error if the input is a series of 0s or non-integers >>> standvastig(44444444) True >>> standvastig('44544444') False """ if str(reeks).isdigit...
I wrote this program as an assignment for an introductory programming course in Java, which I then decided to improve past the minimum assignment requirements. It allows two human players to play Connect Four. (If you don't know this game, its rules are explained in the code below.) I would appreciate any feedback such...
I want to have a deck of cards that looks like this: ['H1', 'H2', 'H3', 'H4', 'H5', 'H6'...] For that I wrote the following code: import itertools kind = 'HCDS' value = ['1','2','3','4','5','6','7','8','9','10','J','Q','K','A'] temp = list(itertools.product(kind,value)) deck = [] for i in range...
This is an allocator that is used in replace of malloc if you do a lot of rapid, but small allocations on the heap. I wrote this for reducing system calls to improve performance. It works, but I've never written an allocator before, so I wondered if there is any improvements I can make generally with regards to readabi...
Is it sufficient to only synchronize the incrementCount? Is it possible for all other threads to get the updated value all the time? public class CoounterHolder { private int i=0; public synchronized void incrementCount(){ i++; } public int getCount(){ return i; } } Or would ...
I am working on a project right now, where we need to search different APIs, then clean & persists data to database and finally pushing to Elasticsearch. The high level code looks like this: class BaseParser(object): def __init__(self, source): self.url = source.url self.api_key = source.api_key ...
I was looking for a function which would take the overall width, max height, min height parameters as the input and fit multiple images in the given overall width adjusting their width. For an example in this page, all the images (in the same row) should get auto-adjusted to the same height, keeping their original aspe...
I've been working on a simple forum website as a toy project, to start learning PHP and SQL. I've implemented all of the functionality I want, but I thought I'd run the code by the Code Review community to see how I could improve it. <?php session_start(); class database{ protected static $connection; protected $st...
I don't like the idea of sprinkling process.env all over the place and wanted to abstract it out a bit. I'm new to Node and know there must be a better way to do a few things. Not repeat the name 4 times (twice as a string and twice as a field) Any cleaner way to create properties and centralize existence checks than ...
I tried to implement BFS and DFS from Introduction to Algorithms by Cormen. Any suggestions on how to improve my code? GraphStructures.h #pragma once #ifndef GRAPH_STRUCTURES_H #define GRAPH_STRUCTURES_H #include <vector> #include <string> #include <limits> #include <fstream> #include <sstream> enum class Status { U...
This is a nagios check that will use an API URL, get JSON data, flatten the data into a usable perl hash, and ultimately obtain a date string. Once the date is obtained, it should recognize the strftime format based on user input and determine the delta hours or minutes. Once the delta time is calculated, it should ret...
i've written a basic function to split an array into stride by 2: [z] -> [x],[y] func splitArray(Z x:[Float64])->(Real:[Float64],Imag:[Float64]) { guard (x.count % 2 == 0) else {"BOMB:: need even number of elements in array \(#file) \(#line) \(#function)" return ([0.0],[0.0]) } var Real...
Description The ActivityLifecycleHelper uses wrap(Context)to create the class and save a global Application field. It then uses with(ActivityCallbacks) to register android.app.Application.ActivityLifecycleCallbacks on the Application field. Whenever onActivityResumed(Activity) is triggered the class calls a null OnSav...
I have written code that gets the reputation badge from given score like this: I use an if-else statement here: func GetReputationBadge2(score int) string { badge := "badges-off.jpg" if score >= 50001 { // Diamond badge = "diamond-1.gif" if score >= 500001 { badge = "diamond-5.gif" ...
I have tried to implement a solution to the Rainfall challenge based on the suggestions from 200_success♦ (Rainfall challenge). Problem Statement A group of farmers has some elevation data, and we're going to help them understand how rainfall flows over their farmland. We'll represent the land as a two-dimensional...
I saw some approaches to the Connect Four game on a site. None of them seemed very OO like, therefore I'd like to present my implementation and request suggestions on how to make this code more readable. For example, I dislike the "oddball solution" where I get the current positions stone from the field in class Connec...
I have been working on this problem for 3 days now. I wrote a piece of java code that works perfectly on my machine testing in Eclipse, but when I put it in Foobar, it either returns "Error(400) Bad Request" or "Took too long to execute" or something else. To quote it from this other question of the same Foobar questio...
I'm working on a basic linked list programs. In this program I can insert elements at the beginning, at the middle (after one specific element) of the list and at the end. I also can delete a specific element or delete an element from the end of the list. I have all these four methods in the code. Now I was trying in t...
Does anyone have any recommendations for how I could make this async.waterfall call neater? Ideally I'd be able to do something like: async.waterfall([ serializeUser(user_id), generateAccessToken(user_id), generateRefreshToken(user_id) ], function(error, results) { //my user, access token, and refresh token a...
What's the neatest way to increment all values in a HashMap by 1? The map is <String, Integer>, but the key doesn't matter as every value will be incremented. Is it "cleaner" to use lambdas with forEach/compute/etc. or just loop through the entries? HashMap<String, Integer> map = mobCounter.get(mob); for (Entry<String,...
I am looking for any performance insights or better coding style for my rendering method. public Bitmap bmp; public void render() { Brush[] brushes = new SolidBrush[NumOfShapes]; PointF[][] points = new PointF[NumOfShapes][]; float[] tensions = new float[NumOfShapes]; // We have multiply shapes, every ...
I have read this paper and I actually found it interesting. This is an attempt to implement the proposed algorithm. I would like to know: Is my algorithm correct by what is discribed in the paper? Is my algorithm easy to understand? Here is my little program // Based on http://www.ijcai.org/Proceedings/16/Papers/053....
In Scott's Effective STL Item 24, his template function of "efficientAddorUpdate" does not take advantage of rvalue references. I've tried implementing a modern equivalent with perfect forwarding and emplace, then various less efficient alternatives to compare. It seems that the pf with emplace is the most efficient i...
I want to make the code shorter. Is there any way to loop through the stocks and qty dictionaries, access the closing prices of each individual stock and then calculate the current value of the investment preferably in one or two lines? from nsetools import Nse nse = Nse() #stock name and buy price pair, but not used...
I've created a mini project where the user will enter the total weight of the coins and the program will compute how many coins they have and how many wrappers they'll need. I initially found this challenge in a subreddit named r/beginnerprojects def coinEstimator(): ########################################## ...
I am currently working on my first ASP.NET Core MVC project with a repository pattern. I have gotten it to work but I wonder if there is a better way to solve this. In this case I have an Organization model and an Address model, with OrganizationData and AddressData for the repositories. What I am wondering about th...
This post improves upon my Java implementation of the Huffman algorithm for data compression. I did the following improvements: The map mapping each byte value to its frequency does not rely on float values, but rather on integers representing absolute counts. I am not quite sure, but it seems like a more robust way o...
I've been trying to write a simplified Google Maps program. My programming experience is limited. I have come up with a solution but I'm looking to make it more user friendly by splitting it up into various classes. import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Button; import jav...
So I tried the brute force method after visiting https://www.programiz.com/python-programming/examples/palindrome on palindromes. Any comment on how I can improve my coding will be much appreciated. t=[] def is_palindrome(x) if list(str(x)) == list(reversed(str(x))): t.append(x) else: pass for i...
I have written code to calculate the area of different shapes using polymorphism (virtual and override methods) and it is working as expected. Can anyone please review this and let me know how I can make it better? class Program { static void Main(string[] args) { double side = 0; double length ...
I built this toggle nav that switches a banner section between the slider and a map. All works well but I would like to know how I could improve my JavaScript as I am quite new to it. $(document).ready(function() { // Banners Toggle var bannerSlider = $('#banner_slider'); var bannerMap = $('#banner_map'); $('.thm-ban...
From a deck of 50 need to get sets of 5 as random as possible and as fast as possible. The thought here is to shuffle to get 10 sets of five at a time with no collisions. Int1 and Int2 will not change during a run. If they do other bad stuff would happen. public MainWindow() { InitializeComponent();...
I solved this problem: Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same ch...
I've written an itty bitty tcp server, for educational purposes. The program outputs a file if you input the correct hash (or whatever you set the environment variable to). I've performed tests on the application through netcat ( nc localhost 9000 ) and everything is fine, the application works as intended, both in m...
I'm trying to expand my use of classes and better understand how/when to use them. Please review the code and let me know if I'm on the right track or where I need to make improvements. For example, should I remove the database call from the class, why or why not? <?php class Model{ private $_db; private $fir...
I've just implemented counting sort in C and would like to hear your opinions on it. As I'm usually being rather picky when rating other people's code, please go ahead and be picky, too -- I will try and justify my decisions but I'm thankful for any hints :) #include <stdlib.h> #include <stdio.h> #include <assert.h> /...
I'm implementing a search for a deep array. It applies the search/filter to the deepest level of children below, i.e. { name: 'foo' }, { name: 'bar' }. If all children are filtered from the parent object, the parent is removed from the list too. Since I want to leave the original object intact, I copy each container ob...
I've made this code to extract a conversation from a Skype database file with a certain user ID, all this being specified as a command line argument. Since Skype uses SQLite to store the messages I can use the sqlite3 Python module to retrieve the messages. The code first checks for the database file, opens it if it ex...
I've designed a userform in Excel and it has many comboboxes and textbox inputs, once the user is done it puts ticks in appropriate columns depending on the ComboBox selection and also writes the value of the TextBox to the sheet. At the moment I feel as though the sub could be refined but am unsure how to proceed as t...
I'm developing my first legitimate jQuery plugin, and I'm trying to keep it very modular. To do this, I'm writing many individual functions, which is fine, but I need a clean way to determine what functions to fire based on the plugin options provided by the user. Right now, I'm using a .on('click',...) event with a sw...
I wrote this code to filter a list of names based on certain conditions, and wanted to see if I can reduce this further and eliminate redundancy in code. names1 = ["Jane", "Jake", "Bradley", "Bill", "Betty", "Kara", "Kris", "Jil"] names2 = ["George", "Kate", "Karen", "Kurt", "Greg", "Gary"] selection_criteria = ["full...
I have returned to programming after a year without practice and this is also my first time using Java. I know there is a more efficient way to do this so any suggestions would be appreciated. I am trying to distribute stats randomly to a character in my game. However, I can't just go through each stat and increase/dec...
I recently finished the Using Databases with Python course. To figure out whether I really understood what was being taught, I build an application which does roughly the same but uses a different formatting. The idea is to have a list with addresses, look up the corresponding coordinates using the Google Maps API, sto...
#pragma once #include <atomic> #include <memory> template <typename T> class RingBuffer { public: explicit RingBuffer(std::size_t capactiy) : _buffer_capacity(capactiy){ std::unique_ptr <T[], RingBufferFree> buffer_ptr(new T[capactiy]); _ring_buffer_array = std::move(buffer_ptr); } ~Ring...
In the prior obsolete implementation of std::deque, I used two std::vectors to contain the elements. But the standard guarantees that pointers and references to elements aren't invalidated when an element at either end is erased or when an element is inserted into either end, which the prior implementation doesn't: To...
I am extracting data from .txt files and writing needed data to Excel. My problem is that my code is very very slow and at one point even slower (+35k txt files). How should I rethink this problem? Microsoft.Office.Interop.Excel.Application excelapp = new Microsoft.Office.Interop.Excel.Application(); exce...
I am working on the problem of removing comments from C-like source code. Here is my code in Python 2.7, and if anyone could advise improvement areas (especially performance), or any functional bugs which I do not discover, it will be great. Problem statement Given a file path represented as string, take this input str...
I started learning Haskell a couple of days ago and decided to build a Caesar shift in it. import Data.Char shift_str :: Int -> ([Char] -> [Char]) shift_str num | num > 1 = \str -> shift_str_forwards (shift_str (num-1) str) | num == 1 = shift_str_forwards | num == 0 = no_shift | nu...
Coming from high-level languages like PHP and JavaScript, I'm doing an Assembly course on Udemy. Yesterday I tried to implement the following task: Write a program that takes a number m as input, and prints back 1 to the console if m is a prime number. Otherwise, it prints 0. Original text can be found here (Exerc...
My web application can take URL-encoded strings and return a JSON that contains information, like API calls. My main concerns are with security. I need a cheap and easy (but secure) way to do certain commands. This part is handled by the adminhandle section of the code. My code is currently designed to be able to be de...
I have a method liked_by and it doesn't seem like appropriate as per Ruby style. I need to do it as less as possible. def liked_by if !object.likes.nil? like = Like.where(bonus_id: bonus.id) users = [] like.each do |likes| liked_user = User.find_by(id: likes.user_id) users.push(l...
I am trying to implement multiplication of two numbers without using the * operator, as a practice for programming interviews. I have written two functions. 1) Using Long Multiplication static int MultiplyTwoNumbers(int num1,int num2) { List<int> leftnumber = new List<int>(); do { ...
I want to optimize the below code, I have asked a similar question here. I know this approach is better than my last code but I feel there are ways to optimize this too.This code is used in almost every project and I am not satisfied with this answer. There are not even using last filter results and traversing whole l...
I'm really new with Django and I would like to get your minds, advices, ... in order to improve the first part of my project. For the moment, I created a model form which is named Identity and users can fill the form, get a preview with modification before to submit data. As I said, I'm beginning to use Django and I'm ...
I am a relative newbie to C++. I recently finished a command line program which cracks Vigenere encoded messages from a file by testing each word in the dictionary. I have never had a tutor/teacher for C++, so I wanted to make sure that I don't develop any bad habits. Main.cpp: #include <iostream> #include <fstream> #i...
will you please give your thoughts (code review) on these two way of solving orientation. About the app: We have a universal App. The main purpose of the app is to watch the videos. The app has four screens. Shows the list of shows show the list of episodes in the show details of an episode Player screen The way ...
This is my first program in Swift/Xcode. The full source code and xcode project is available in GitHub. The part I would like reviewed is IOKeyEventMonitor.swift. //Copyright [2016] Jean Helou // //Licensed under the Apache License, Version 2.0 (the "License"); //you may not use this file except in compliance with the ...
After I got this answer, I edited my code after that answer, but the code still seems kind of slow. Can I make any other improvements? And why does the code seem to get slower with every minute? It seems to start great and continue slow. Am I missing something here? using System; using System.Windows.Forms; using Micro...
I have an application which uses SQLite. In that database I have several tables that I need to be able to read and update in my application. Often I need to 'cross-reference' these tables to get the correct values. For instance, I load an interview with answers someone has previously selected. To do so, I have a Result...
I have been learning to code for nearly a month now. Any tips on how I can improve with indenting to help future readers? Snippet body /* font & back clr */ { font-family: verdana; background:whitesmoke ; color:black; } .menu { background: black; width:100%;} ...
I made this AngularJS 1.x filter, to search using a the same SQL LIKE syntax. Right now only the percentage symbol (%) is supported, the underscore symbol (_) is not. Under the hood I'm simply building a RegExp from a format string passed as a parameter (ie. the search string), then I'm looping over all the object prop...
Rather than checking if my angle is in the range of 0 to 2pi every time it gets set, I got the idea to store it as an unsigned short with 0xFFFF being +2pi, thus the standard overflow behavior for unsigned numbers should keep it bound to the desired range. Is it a good idea to do it this way, or is there something I'm ...
After some feedback on my last Ruby Code I decided to start another one with two big concerns in mind: Trying to adequate my coding to the OOP paradigm Trying to follow the Ruby Style-Guideliness I started a small Asteroids remake, trying to make it as simple as I could so I would focus on those things rather than so...
I recently had an interesting requirement in a test environment where I needed to simulate actions at varied (random) intervals in a node back-end. They needed to be sequentially executed, but queued so I could fire and move on. Using a typical timeout/interval here wouldn't work, since if I set a timeout for fn1 to ex...
Lately I've been working on a practice project using JS ES6 to understand it better, therefore I've read a lot about JS design patterns and JS coding strategy. My question is about splitting the functionality of the project so I have to briefly explain to what I'm trying to do in this project. I have an input that gets...
I have a Rails helper that swaps out some text for certain icons. Example: Helper Sample ... '+1' => '<i class="ms ms-loyalty-up ms-loyalty-1"></i>', '+2' => '<i class="ms ms-loyalty-up ms-loyalty-2"></i>', '−1' => '<i class="ms ms-loyalty-down ms-loyalty-1"></i>', '−2' =...
I had an interview yesterday where I had to write an algorithm on the whiteboard for working out if a value is a Palindrome in C#. The pressure got to me a bit but I've written my version of it in Visual Studio this evening. private bool Ispalindrome(string args) { var index = 0; var re...
RetrieveData is a 3rd party API that takes 3 parameters: a buffer, number of bytes to retrieve, and actual bytes required for the buffer. The buffer returned is a non-null terminated unicode string 99% of the time, the buffer is less than 256 bytes, but may be larger and needs to handle this scenario RetrieveData(data...
This is just the server part of a chat program. The user of the server can receive and send messages to all the clients connected to the server. Everything works fine but since I'm a beginner I don't know if I should avoid something or not, what I should improve, etc.. The server class of the app: import java.io.Buffer...
Here is the code for a two-letter word dictionary (example: aa) using array indexing: /* dictionary.h */ #include<stdlib.h> #include<string.h> #include<stddef.h> #define WORDSIZE 2 #define LETTERS 26 #define WORDS LETTERS*LETTERS #define EOS '\0' #define MAXDEFINITIONSIZE 512 typedef struct { char word[WOR...
I've created a Node class and a Graph class class Node: def __init__(self, val): self.val = val self.edges = [] class Graph: def __init__(self, nodes=[]): self.nodes = nodes def add_node(self, val): newNode = Node(val) self.nodes.append(newNode) def add_edge(se...
I have a CSV with around 10,000,000 lines. Each line looks like: keyword1, keyword2, ....keywordn keyword1, keyword2, ....keywordn keyword1, keyword2, ....keywordn keyword1, keyword2, ....keywordn The script which does a frequency count and outputs to another text file: from collections import Counter import csv impor...
Problem statement First version: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BearAndSteadyGene2 { class BearAndSteadyGene2 { /* * Nov. 28, 2016 * */ static void Main(string[] args) { in...
I've just got into Haskell a few days ago and I love it. I'm looking for some pointers and best practices on how to organise and write Haskell code specifically when it comes to managing errors, which I have done using Maybe. The following is an implementation of "select a list from a 2D list, take the last item from i...
My goal is to read complete contact information on an Android application. This is very slow and my understanding is that since the contacts are stored locally in a phone database, it shouldn't take long to fetch complete contact details. public void readContacts() { Log.d("TAG", " -> Into readContacts"); // Ge...
For fun, I decided to inspect the obfuscated source code on TypingTest and figure out how to write an auto typer for it. I came up with the following UserScript. A couple of notes: The site's code simply checks for focus on the .test-edit-area element, and handles each keydown and keypress event that occurs on the ele...
I need to expand logical patterns to list of strings. For example I have the following definition: (expand-pattern '(and "xy" (or "1" "2") (or (and "ab0" (or "1" "2" "3")) "cd01"))) Which evaluates to the following lis...
The program idea is take normal PNG with colour type 2 (Truecolour), decode it to grayscale and perform edge detection operator. I have rewritten code asked here before. Now my mainly concerns are: Style Reasoning errors (algorithms, "Why did you put it there", etc.) Is it ok to have CAPS attributes e.g. IDAT or shoul...
I am new to python from R. They are quite different. I wrote a python code to deal with Excel file. The code was running well, but I think it's kind of the style of R. I want somebody to show me writing the code in python way. The data structure looks like: Name Details 1 AAA first(100%-8) 2 BBB ...
Please review my game. I am learning Python now, so any suggestions are welcome. I am running this on a Linux machine, in Komodo and terminal. #!/usr/bin/python #encoding=utf8 import random # init global variables used for game player = [] dealer = [] class Deck(object): def __init__(self,rank=[], suit=[], whol...
I am trying to create a validation class that can be used to validate many forms of my webpage in general. It makes use of the database as well to verify records. The problem with it is that it looks bad and somewhat inefficient. I couldn't find any alternatives and I have used too many if-else if statements. And also...
I was messing around online at work the other day when our phone systems went down. I came across the R programming language. Now I'm not guru with programming by any means but I like to mess around with different languages here and there, I believe it helps me to become a better programmer. So I decided that I would t...
Here is a simple hex color fetcher and analyzer in javafx that i wrote to understand multi-threading in javafx. Questions: Is my regex ok ? or if it can be improve? I am not much familiar with javafx multi-threading so need know that i am doing it properly or not. Need special attention on prepareTask() method. Is my...
Long story short, the other day I discovered the site LeetCode and started solving some of its problems until I stumbled onto this one. I'll paste the description here: Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementin...
I'm currently working on a website which provides content to users based on their region. As a result the website has subdirectories for the appropriate regions. For example, a pricing page would look something like this: http://mydomain.com/ie/pricing http://mydomain.com/gb/pricing http://mydomain.com/fr/pricing In ...
I have a loop in my main sub routine which creates multiple graphs. This is run across a number of sheets, creating the same graphs for each sheet, but with different ranges and other variables. I have a separate subroutine for each graph (two are shown below, others are similar and can be posted if necessary), however...
For a university assignment I had to plot different polynomial functions depending on one single parameter. That parameter gave the number of supporting points to interpolate a given function in the domain \$\lbrack -1.0, 1.0 \rbrack \$. The supporting points were to be calculated in two different fashions. Either the...
Following your suggestions, I updated my expression evaluator with a Shunting-Yard algorithm. I've created two classes, a Shunting-yard class and a RPNsolver class. The first I mentioned converts from infix to postfix notation and the other solves the postfix expression. I'm open to suggestions of any type. Shunting_ya...
I'm currently working on a WPF application, making calls to various web APIs. Thus, I'm looking after a special observable tasks queue: Progress value must be available Tasks (API calls)/seconds must be limited Failed tasks must be restarted (API calls may unexpectedly raise exceptions) Since the API calls are not v...
I work with an API which answers really slowly. I created a module which constantly asks the API and update some cached value. The code is degraded for study purposes: // module cache.js const Promise = require('bluebird') let results function setter(_results) { results = _results } function recusriveUpdate() { ...
I recently had a requirement to export data to CSV in a different culture & hit an issue (see https://stackoverflow.com/a/40871162/361842). Here's my workaround: function ConvertTo-SpecifiedCulture { [CmdletBinding()] param ( [Parameter(Mandatory,ValueFromPipeline)] [PSObject]$InputObject ...
I have a React/Flux web app and want to follow the architecture best practices: I will focus on one view for my question, the component used to insert/update an entity (a User in occurrence). Everything is working with this code, but the core of my question is about the onUserDetailChanged function in my AdminUserDeta...
Here I am trying to delete a parent node but only if it doesn't have any child node. Please review this code. PostController.php /** * Delete the given post. * * @param int $post_id * @return void * * @throws \App\Exceptions\RelationExistsException */ public function deletePost($post_id) { $relations = ['t...
I am working with Cassandra and using the Datastax Java driver for it. Here is my singleton class where it makes a connection to Cassandra: public class CassUtil { private static final Logger LOGGER = Logger.getInstance(CassUtil.class); private Session session; private Cluster cluster; private static class Ho...