instruction stringlengths 71 71.9k |
|---|
I have created an auto-typer that runs through a simple little GUI.This was my first ever Java program so it's pretty simple and not anything special, but I'm curious to know if there's anything that I could have done better.
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class AutoTyper{
... |
I need to filter Turkish words according to vovel alternation rules. For example -ler is plural but can have form of -lar thus I use metaphonemes for these transitive allomorphs as vovel_dict in my algorithm.
There is only one condition not to alternate vovel it's 'ken' which excluded. I wrote this but it takes too muc... |
This is a trivial problem. The reason I'm here is to get a better idea of how to use Java's numerous APIs for working with files, folders, and paths. I'm hoping this specific example will help.
Problem Statement
I want to rename a file like this:
/path/to/myFile.txt
to this:
/path/to/myFile_old.txt
Ugly Solution
I'... |
What is the most Pythonic way to take a dict of lists and produce a new dict with the list items as keys and the previous dict's keys as list items.
Here's a visual explanation:
favorite_fruits = {"alice": {"apple", "orange"}, "bob": {"apple"}, "carol": {"orange"}}
people_by_fruit = {"orange": {"carol", "alice"}, "appl... |
For school I had to do a real simple login and authentication system on an Android app, and I'm wondering how my code can be optimised to reduce code duplication and how it can be made more object oriented?
All the app does is make an API call to my SLIM restful web service using AsyncHttpClient library and stores the ... |
The concept is very, very simple: let's do merging run by run (a run is a range without decrement).
template <class RandomIt>
void RunAwareMergeSort(RandomIt first, RandomIt last) {
RandomIt m_first(first); // the begin of first run of merge
RandomIt i(first); // the locater
while (true) {
while (++... |
Any feedback on my code would be greatly appreciated.
/*
The Sieve of Eratosthenes using a javascript array as
an associative data structure.
*/
function range(start, limit, step) {
var rangeArray = [];
for (var i = start; i < limit; i += step)
rangeArray.push(i);
return rangeArray;
}
funct... |
I want to count email addresses with different status. I use ASP.NET MVC and this query is supposed to run every 5 minutes on these tables, which every table is on different .ndf files. About 5 million records will be inserted into email address table every day.
Is this query good enough, in terms of performance? You c... |
I am on the learning curve of C and its capabilities. Below I have tried to create 4 individual programs where the execution is always in order (program 0,1,2,3).
About the program
Program #0 is always executed (called) first, it also creates semid's
Program #1 can ONLY be executed if Program #0 has ran
Program #2 c... |
I'm developing a php framework called Stack. I just created the autoload.php as follows.
<?php
namespace Stack\Application;
define('ROOT', __DIR__);
class AutoLoader
{
private static $pos = false;
private static $namespace_path = NULL;
private static $namespace_name = NULL;
private static $file = NULL;... |
(define loop
(lambda (x proc)
(when (not (= x 0))
(eval proc)
(loop (- x 1) proc))))
Is this the best way to create a loop function in Scheme?
|
I made a fizzbuzz program in Java 7 I'd like reviewed.
Given an input file with three numbers in each line, fizz, buzz, and count:
3 5 10
2 7 15
The output, for each line, should be the numbers from 1 to count, except that multiples of fizz are replaced with "F", multiples of buzz are replaced by "B", and multiples of... |
What it does is simple: the user inputs a from- and a to-value in a field, sets it with ok. With the go-button, the user makes the program count from f to t and adds it to the site. With delete, the user clears the added markup.
I feel I could simplify the two set-functions into one, but I'm quite stuck.
$(document).... |
I do need to use jQuery autocomplete for two inputs. But I have use same processing script for these two elements.
At this stage I am doing it like this:
$("#suburb").autocomplete({
source: function(request, response) {
$.ajax({
url: "includes/state_au_ajax.php",
dataType: "json... |
When searching for information about the Binary Tree, the code on people's blogs are complicated, so here I'm trying to code a very simple Binary Tree.
Am I missing anything? Is there a better way I could be implementing the BinTree::Remove?
#ifndef _BINTREE_H__
#define _BINTREE_H__
using namespace std;
class BinTree{... |
I coded this function to check for a violation of a primary key in a DataTable. The main idea is to retrieve a list of every row that the same value of the column in input and set an error to it.
Private Sub PrimaryKeyCheck(Of ColumnType)(dt As DataTable, ColumnName As String)
Dim violatingGroups =
dt.AsEn... |
I built this wrapper over the System.Security.Cryptography.Aes encryption/decryption so that one need only instance the class and call the appropriate methods. This makes it much simpler to work with AES encryption so that developers don't need to reuse the same AES code everywhere they need encryption.
Any and all com... |
I want to create a JS MVVM framework for learning and personal project.
jsFiddle
HTML:
<input type="text" mk="value=test" value="test" />
<br />
<span mk="text=test"></span>
JS (markjs):
(function () {
Mark = {};
var mark = {
text: {},
value: {}
};
Mark.set = function (name, value) {... |
I have written a CFG (text file) parser for my specific needs. I have found other libraries to be much too large. Even other parsers that bill themselves as "simple" run hundreds of line long.
The code that I need reviewed is the parsing and tokenizing of the input. I feel like it can be simplified. I have added more ... |
I have a Morse Code translator, which can translate text to Morse code and vice-versa. Note that for the two files that the first three lines are generated by the Code::Blocks IDE.
translator.h
#ifndef SPLIT_H_INCLUDED
#define SPLIT_H_INCLUDED
#endif // SPLIT_H_INCLUDED
#include <iostream>
#include <map>
#include <str... |
Often I need to perform multiple assignment from a sequence
(e.g. from the result of a split()) but with some semantics
that, AFAIK, are not available in the language:
Assign N first elements and silently ignore the rest (like Perl's
list assignment).
>>> a, b = 'foo bar is here'.split()
>>> a, b
('foo', 'bar')
>>>
A... |
I'm trying to design a multithreaded daemon for an industrial automation related project.
The daemon will be using a number of 3rd party libs like MQTT, mysql, etc..
My idea is to have worker threads (or callbacks registered with these 3rd party libs) relay events to the main thread using a global mutex and conditional... |
Already read this, but OP is using some other method.
My website finds the time till new year. But this website claims to be accurate to the tenth of a second. So what I found out was my timer and their timer is off by about a minute.
var daysSpan = document.getElementById("days");
var hoursSpan = document.getElementB... |
This is my first Rails project. I have read about concerns which are a great tool, but I am confused about how I should redesign my models.
Some models have similar fields, but the validations are not the same everywhere. For example: 3 models have a phone field, but in one model the phone field is not required. 3 mod... |
I'm writing a program to help with remembering complex bash commands. On invoking the program, it asks for a description of the desired operation, e.g., "increase volume" or "find orphaned packages", and displays the commands matching the input ordered by closest match.
Matching is determined by splitting the command t... |
This is my first time writing C++, so I would appreciate advice in the areas of:
Code style (naming conventions, indentation, etc)
Memory usage (am I performing unnecessary object copies?)
Class design (move constructors, destructors, etc, are they necessary?)
Correct usage of standard library functions (especially th... |
I've written a Java class that will provide the utility of, in essence, hashing user passwords for an Android app that integrates Couchbase mobile into it, and then, checking whether or not the hashing of the password string entered by the user matches the hash stored in the DB to grant access.
Does there appear to be ... |
I have a structure that is organized much like a Sudoku board, where individual cells reside in an n x n region, and those regions reside in an n x n area. I need to be able to address both the regions and the individual cells within the regions separately.
When operating on every individual cell (in a particular order... |
I have created an Insertion Sort code that sorts numbers (obviously).
#include <iostream>
#include <cstdlib>
void insertion_sort(int arr[], int length);
void print_array(int array[],int size);
int main()
{
int array[] = {4,6,3,7,5,9,2,8,1,10};
insertion_sort(array,10);
print_array(array,10);
return 0;... |
Problem
The main idea is to build some fine scale weather data using inverse distance weighting (idw) from the 5 closest stations of the observed station. If the value in the newdat data set is greater than 134, less than -80, equal to -9999, or NA then run the function to get an interpolated value. If greater than 2 ... |
I created a Python module to access Samba shares some time ago, using Mike Teos' SMB module as some kind of a base to it. It is mostly a wrapper, but as I said, I wrote it some time ago and would appreciate feedback on readability, usability and modularity of this module.
ServerAccess.py
#!/usr/bin/env python2
# -*- co... |
I'm doing this small Breakout clone for school, and I've looked at heaps of people's takes on Breakout and tried to combine bits and pieces that I liked. Only problem that I'm having is getting the game to end when the ball hits the bottom window edge and sounds.
You should be able to copy/paste the code into a projec... |
For some purposes it can be highly desirable to use GetSystemTimePreciseAsFileTime() whenever it is available (i.e. Windows 8+) because the accuracy of GetSystemTimeAsFileTime() isn't very high and it varies from system to system. On old systems it's tied to the 15.625 ms heartbeat, but even the 1 ms of newer systems i... |
I want to get the key from value / and value from key ,can anyone help to do in better way ? or can we implement the below code using java enum or spring or apache enumutils or java generic ?
Note : I used to get string from frond end(.jsp) and I want to store store this value into database table as integer.
Frond end ... |
I am working on an app that will interact with assembly (app) versions. I created a struct for that, along with an exception for parsing error.
Here's the code:
[Serializable]
public class VersionParseException : Exception
{
public VersionParseException()
{ }
public VersionParseExce... |
The data (news items) comes from a <ul>. I'm using setInterval and setTimeout for the timing aspects, and jQuery animate for the movement to the right. I know that setInterval and setTimeout start acting weirdly when the tab is not active, but that's not a problem for my specific use-case.
I'm looking for any comments... |
Some exercise required me to write a piece of code to double every second item in a list. My first thought was just using cons and I came up with the following:
doubleSecond :: Num a => [a] -> [a]
doubleSecond [] = []
doubleSecond [x] = [x]
doubleSecond (x:y:xs) = x : (y * 2) : doubleSecond xs
While it's straightforwa... |
This is not ordinary question but it's also not opinion-based, it's more about the standards and the right way of writing JS code. I admit, I'm a total noob in JavaScript, I do not have experience with this language but since it is necessary for the project I'm working on - I had no other choice but to learn a bit abou... |
My code takes input from the user and creates a receipt with the information the program receives from the user:
import easygui
items = []
prices = []
amount = []
amounts = 0
finished = False
total_price = 0.00
list_num = -1
def take_item():
global list_num, amounts, finished
item = easygui.enterbox("What it... |
I created a simple Java program to calculate Goldbach's conjecture and I was wondering how I could improve it (besides using clearer prompt messages).
/* Title: Goldbach Conjecture
* Author: Harris R
*/
import java.util.Scanner;
public class Goldbach
{
public static void main(String[] args)
{
Scanner scan =... |
I attempted to recreate the GitHub code frequency graph (example) with a daily granularity using Perl and git log. How did I do, and what improvements can I make? I know that I should try to reduce the frequency of keys on the x-axis, but I have no idea how to do that and maintain scale.
It should be noted that the de... |
I've created a basic site with thumbnail images which when clicked open a modal type window to show a larger image with info related specifically to the image.
It works as I would like. However, I'm trying to develop my limited JS skills and looking at the code, I think there is most probably an easier and cleaner (and... |
I wrote an implementation in Haskell for Project Euler Problem 54:
The file, poker.txt, contains one-thousand random hands dealt to two players. Each line of the file contains ten cards (separated by a single space): the first five are Player 1's cards and the last five are Player 2's cards. You can assume that all ha... |
This is the javascript component of a plugin for the Sphinx static site generator that creates instant search results as you type into a search box.
Any comments on organization and structure of the code would be appreciated, especially with respect to binding to DOM events. I work primarily in Python, so I'm still lea... |
I was told that this version is too simple, that need something more complex. I added Entity Framework.
Here my code:
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace SalesTaxes
{
public class ShoppingCartContext : ... |
I wrote a program to fill a timetable for a school. There are some simple rules:
Each subject has a preset number of blocks (blocks are 2 hour periods).
Professor provide a valid hours they have to teach.
There cannot be a subject at block and day x if there isn't any professor of that subject that can teach it at t... |
I've wrote this code to calculate the prime numbers between two integers n and m, and I want to optimise it.
#include<iostream>
#include <cmath>
using namespace std;
int main (){
long int T[100][2],n,m,i,j;
int testcase,k;
bool prem;
cin>>testcase;
for(i=0;i<testcase;i++){
cin>>T[i][0]>>T[i][1];}
for(k=0;k<testcase;... |
In my web projects I often need a simple way to trigger callbacks defined somewhere else. Leaving jQuery finally behind me, I was missing their simple event system and tried to create my own. I'd like to know if this is a good implementation since I am not that proficient with Javascript yet.
function Events ()
{
/... |
I've created a helper method that is essentially used to get the default state of an select:
<%= select_tag "question_main_frequency",
options_for_frequency_state(frequency_segment(question)), { class: 'form-control' } %>
The helper method I've created to get the default state looks like this:
def frequen... |
My application has a whole chain of Observables running through it, and recently I found that something was slowing down my (hot) source, but I couldn't work out where.
Obviously, with everything running in series by default, a good first step was to introduce some 'parallelism', so after having done battle with my own... |
Goal: provide binding event mechanism which can use default or custom settings in a most proper, organised and readable way.
var module = (function () {
var settingsDefault = {
clickObject: 'body'
};
var s = settingsDefault;
var init = function (settingsCustom) {
s = settingsCustom;
... |
I made a scripted expression for after effects a while ago. This script is preventing objects to lay on odd pixels when a Keyframe is applied.
// Amount of Keyframes
n = transform.position.numKeys;
// Time
t = time;
// Time of Keyframe
timeOfKeyframe = null;
if ( n != 0 ){
// Time of first Keyframe
timeOfF... |
I recently started C# and I've got the feedback that I still repeat too much. How can I make it less repetitive?
namespace ExtraOefLabo
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
... |
Related to this question (and even this Stack Overflow's one) I have been trying to avoid blocking the code. So what I understood it's that is preferable to make all the methods that rely on an async one async themselve (thus not defeating the purpose of asynchronous). Therefore I have changed my code to do the followi... |
This is my code for project euler #35 (in Python):
The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.
There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97.
How many circular primes are there below one million... |
Here you find some code that returns the value of a multivariate Bernoulli density function - for a dice with n faces, where each face has its weight (weight must be positive reals, not necessarily sum = 1) it provides the result of the tossing.
function face = weighted_dice(faces, weight)
% face = dice(faces, weig... |
I have been trying to learn JavaScript for the past few days and decided it was time to put what I had learnt into practice. Here is the program I created. It's a five-question quiz which counts the number of correct questions as you go through the quiz and also ranks you at the end of the program.
//I am going to pla... |
One of the K&R exercises is to write a small piece of software to compare two files and print the first line in which they differ.
Here is my attempt:
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#define SET 1
#define UNSET 0
#define BUFFERSIZE 100
void error(char *fmt, ...);
int ... |
I have the following table:
id speed date
1 0 01/01/2015
2 0 01/01/2015
3 0 01/01/2015
4 0 01/01/2015
5 0 01/01/2015
6 0 01/01/2015
7 25 01/01/2015
8 78 01/01/2015
9 13 01/01/2015
10 45 01/01/2015
11 0 01/01/... |
I have a data file which contains floating point data arranged in 4 columns. Each row represent a specific data point. The first column(X) is made up of 100 different values but the values are repeating. Fortunately they are sorted in ascending order. For each distinct value in first column the second column(Y) has a d... |
As the title says, I want a function that takes a vector, as well as the number of bins, and splits the vector in that number of bins, with a minimum length of 1 for each bin.
def split_into_bins(nbin, vector):
"""
Randomly split vector into nbin number of bins, each of random size
"""
permutation = li... |
The purpose of this code is to let me loop over 100 items (up to MAX_CONCURRENT at a time), performing some action on them, and then return only once all items have been processed:
/// <summary>Generic method to perform an action or set of actions
/// in parallel on each item in a collection of items, returning
/// on... |
I have written VBA code to copy and do some formatting and create sheets based on unique reference and insert some information. I want to optimize this code and make it short as much I can. The code is broken into parts to help make clearer what I am doing with it.
Sub Previous_comments_and_modifications()
Dim x As L... |
Curious if there is a better way to write a repository method that receives argument List<int> and checks if the database Contains an int?.
public List<int> GetNumbersByNumbers(IEnumerable<int> numbers)
{
var convertedNumbers = numbers.Select(m => (int?)m);
return Context.TblNumbers
.Where(m => converte... |
I want to write a complete diffie Hellman example for bouncy castle that includes key generation, key exchange, encryption, and decryption. I also want to verify that if Alice is initiating a connection to Bob, that she should send her public key, Parameter P, and Parameter G.
This is also a good reference.
Namespaces:... |
I have made an effect that has the h1 move and then reveals p using .addClass, .removeClass and CSS3 transition. It works perfectly but I think I am repeating too much of the code and I think there may be a way to write it better. I need postShow and postHide to be different because I need setTimeout to be in postShow ... |
Given a letter (A or B) representing the color for N nodes of a graph and the set of M edges. Its possible to make all the graph have the letter A by flipping the nodes connected by an edge ?
Example:
Given the following letter graph:
A - B
Its impossible to make all the letters A by flipping the nodes connected by... |
Related to another answer of mine on Project Euler 35, I found the need to calculate all combinations of certain digits, i.e. 1, 3, 7 and 9, below a given n. I looked around, and didn't find any really good premade solutions, but found some bits and pieces related to Cartesian products, and collated my findings into th... |
I am writing some examples of Java programs on GitHub rsp/ppj for people to learn and I want them to be as simple and compact as possible, to work on Java 1.7.x (a.k.a. Java 7) and to not use any non-standard libraries that need installation.
This question is about my WhereEven example:
a function of an int[] array tha... |
To help my son with his programming skills, I am trying refresh my limited Python knowledge. I chose a simple dice game called Pig Dice.
import sys
import random
HUMAN = 0
COMPUTER = 1
HOLD = False
ROLL = True
class Die:
def __init__(self):
self.value = random.randint(1, 6)
def roll(self):
s... |
I have the following class for Quicksorting.
import java.util.Random;
public class QuickSorter {
public static void main(String[] args) {
Random random = new Random();
int[] randoms = new int[10000];
for(int i = 0; i < randoms.length; i++) randoms[i] = random.nextInt(10000);
quickS... |
This is a follow up question of this one.
Since the original question was posted, it has turned out that in some cases I want the code to be synchronous and in others to be async.
I have updated the code the 'handle registration' method is now fully sync I believe:
public void HandleRegistration(IProgress<string> progr... |
I've got this massive nested for loop with a few if and else statements in nodeJs. The output of all of this is just string which is combined from different values out of JSon object. What I want to do is rewrite it in more efficient way as JSlint plugin for sublime is complaining about complexity of it:
var instancesL... |
Background
I'm writing a wrapper for a significant portion of a native library in Java. The native objects my classes are wrapping are giving me some headaches in terms of design.
I'm not a fan of the two-step initialization idiom but I've resigned myself to use it if the native object has a lot of configuration option... |
I'm flexing the C++ muscle and came up with the following implementation of Mergesort. Any suggestions as to the implementation and style are welcome.
int* MergeSort(int a[], int size)
{
if (size <= 1) return a;
int mid_point = size / 2;
int left_size = mid_point;
int right_size = size - mid_point;
... |
I have just started learning graph algorithms and am trying to arrive at an ideal interface. I understand that this code will not be used anywhere else (I will certainly use Boost::Graph) but I just want to make sure that what I am writing is not completely wrong.
Specifically, my question in the implementation below r... |
I have two questions about my code:
Are there any performance improvements in this implementation or generally (register int ?) that I could make?
What could I improve in my coding style?
void mergesortArray(int data[], int amount){
if(amount == 1) return;
//Precomputing values
int sizeint = sizeof(int... |
I have the following method which calculates average days on market for a sale type segment:
def average_days_on_market_sale_type_segment
# on market days
on_market_days = {}
# 1. get last year sales - note that the dates need to be sequential in time (oldest in time comes first, most recent in time commes... |
I am building an MVC 5 application using code-first Entity Framework 6 and a customised ASP.NET Identity model for authentication.
I will only be authenticating against external OAuth providers (Google, Facebook etc) and persisting the login and claims information in custom code-first EF entities.
Since this is the fir... |
In prepping to teach a workshop on recursion I wrote this code that uses a maze-building algorithm. In doing so I found it really natural to use generators a lot. I feel pretty happy with how the code turned out but its also pretty unusual and I wonder what yall think of it.
This is meant to run on latest chrome (parti... |
public function getData ($term) {
$db = Database::getInstance();
$term = htmlentities($term);
//Kill the script if the term is blank
if ($term == "") {
die();
}
$query = "SELECT * FROM coils WHERE name like '%$term%' or
... |
I have a function for merging data from an object (a PrintTestDataItem) into a template file for a printed label (a LabelFormatDocument called label in this snippet). The LabelFormatDocument is a third-party class that I use to set various fields on my label and I do this by setting the numerous substrings to the value... |
I create constant class , include my url constant , my user web calls .... etc
I put my constant class in Utils package
here is my questions , is it good to inset constant class in Utils package ?
second question , should I separate each element create constant file for url , user ... etc
// url constants
///////... |
Is there anything wrong with using double ternary operator like so:
var stateName:String = state is String ? state as String : "name" in state ? state.name : null;
Here is two lines because someone requested it:
var stateName:String = state is String ? state as String :
"name" in state ? sta... |
The idea is to perform a bit-wise scan of an ushort provided to find any and all matches within an enum collection.
The code I developed is as follows:
public List<T> GetEnumItemsFromUshort<T>(ushort input) where T : struct, IComparable, IConvertible, IFormattable
{
var output = new List<T>();
forea... |
I've recently been working on a small project to provide a simple heartbeat between server and client applications. Pretty happy with it, just wondering if it could function better (I know it could use cleaning, and a standard naming convention, I like to code quick and dirty then clean up)
Any advice would be greatly... |
I am adding two custom metaboxes to the WordPress post page from a plugin. I am currently doing it with two separate instances of add_meta_boxes but this feels very bulky, especially as I go to add more.
Since the plugin is fairly small I dont want to include a framework and was wondering if there was an easier to add ... |
The task is to assign the n numbers given as input by the user in an array . For Ex : If user gives 10 as input then the generated array should be like this ,
arr[0] = 0
arr[1] = 1
arr[2] = 2
arr[3] = 3
.
.
.
arr[10] = 10
The code below works fine but i am using a loop to assign this numbers to an array which can pro... |
This post is a follow-follow-up to this post and its follow-up.
In those two posts we managed to speed-up the solution of an Alberi puzzle, and to create a one-tree-per-region puzzle.
The complete code hereafter can be used to create multi-tree-per-region puzzles.
Using DFS I had little chance to find a valid puzzle, s... |
I wrote a small class that does a database lookup and it generates a collection/Array. The Collection is resorted based on values returned from the database. Finally, the records can be retrieved using the public method called getQuestions().
I trying to move away from procedural code into object-oriented programming. ... |
I use this code to create a common interface around my C++ objects. At first it was intended to only POD types (implemented with functions like malloc() and memcpy()) but later it was modified to allow using a reduced interface for other C++ objects, allowing for things like constructors/destructors to be called by the... |
I have data like:
var data =
[{
"date":"1-1-2013",
"answer":"yes"
},{
"date":"1-1-2013",
"answer":"no"
},{
"date":"2-1-2013",
"answer":"no"
},{
"date":"2-1-2013",
"answer":"no"
},{
"date":"2-1-2013",
"answer":" " ... |
I have a console application that I want to use to send an email notification every day at some time (call it 06:00 local time). To do so at the moment I am using a System.Timers.Timer in the following way.
I have the following implementation of my service class:
public class PerfomanceService : INotificationService
{... |
I am trying to implement AES on GPU using CUDA programming. I use 4 TBoxes in my implementation that requires 4kB of GPU Memory. I have used a 1KB array for 1KB plaintext. first all of plaintext would be copied to GPU memory, then encryption would be started using
cudaMemcpyToSymbolAsync(DEV_message, H_Message, 1024, 0... |
Just experimenting with various Javascript techniques and was wondering if the code below is valid and if there are any disadvantages to using this technique to create html tags from JS object constructors? I know the usual technique is to add the html directly in the body and loop through an array to populate the elem... |
I've completely reworked the previous code, posted here, so that it is a bit more correct regarding dynamic memory management, and also a bit more true to the object-oriented paradigm.
/** A program for Red-Black Tree manipulation: insertion and value retrieval.
* All position relations (first, last, previous, next) ... |
I'm really trying to wrap my head around application safety in some web pages. I'd like to mention some of the things I've done in the past and hear some critiques on how I can get better. Applications I have made in the past have been mostly for hobby, but I'm currently creating one with data that needs to be secure.
... |
Recently I felt the need to write a Mutable<T> class so that I can pass immutable objects through methods, whose value can then be changed. Some examples of immutable classes (including primitive types):
int
long
short
byte
double
float
String (though already has a StringBuilder class
BigInteger
and others.
There is ... |
Here is my code simulating liquid in a pipe cooling under different conditions. How did I do approaching this in an object orientated way? Is there any way I can improve this code?
import numpy as np
import scipy
from scipy.optimize import minimize
from matplotlib import pyplot as plt
class pipeSimulator:
R_w = 0.... |
Curious how sqlite3 would handle different race conditions in a multithreaded environment, I created a simple module called deterministic for serializing the execution of multiple threads that lets the programmer explicitly program in the spots where thread-switching happens. Hopefully this example usage will explain ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.