instruction stringlengths 71 71.9k |
|---|
I have a large word-file which is fixed with over 240 000 words. I need to check if a specific word exists in this list. I thought that it would be a good idea to create a RadixTree for this problem.
The text file consists of 240 000 lines, each of which contains one word, which is read into a String. Each string is t... |
I want to be able to improve the way I am sending these emails because it is currently not testable (via Mocking) and it is hard to maintain.
Main Sender (I also need an Async method on there but I have left it out):
public class MailSender
{
protected bool SendEmail(MailAddress toAddress, string subject, string bo... |
Working on some documentation lately, I had a need to convert a number of asynchronous serial waveforms into ASCII graphics characters. Rather than draw them by hand, I decided to write a program to do it for me. I'm interested in a code review, and particularly if there are smarter/shorter ways of coding the class.
... |
I have been learning C# for a couple years now, and using small projects to help myself learn. My most recent project is a complete rewrite of my first C# project that just got out of hand (the old one).
I would really appreciate it if you could take the time to take a look at it and provide some critiques.
Some not... |
I have routine tasks which require pulling data from an obsolete SPC package and putting it into Excel. The SPC software will only export into a text file.
I have put pieced together a script to import this into excel, break it into different sheets and do a little bit of cleaning on it. I am sure this is not the most... |
I've got an MVC APU project that I'm working on to feed data to some JavaScript charts. This beast below takes nearly 1 second of server time to process before it is served to the chart. I know that it's because of the nested for loops.
The chart is a line. By default it shows one data point per month for the last 5 y... |
I've developed some PHP that grabs all of a business listing's categories and then displays just the children categories. This is built on Wordpress. I'm still in the learning process and would appreciate some assistance here. Any optimizations you can suggest I make to my code would be really helpful. Please note, if ... |
At university we shortly started using C. I thought it would be a good exercise for almost everything that has to do with basic C to do a doubly linked list implementation. I tried to do it from scratch without looking at other implementations. Also I tried to apply some C code style, but I prefer the Java brace style ... |
I made a shader to display a YUYV surface (data arranged as: Y0 U0 Y1 V0). It's working, but I don't know anything about shaders, or openGL, or anything graphic related as a matter of fact. I feel more like a mad scientist patching random bits of code together than a programmer. Thus, I would appreciate if anyone could... |
This is my first Python program (before that I've been just poking around with the interpreter itself). I took this opportunity to do some user input and play around with pickle.
I tried to made a system that reads input from the user (a car's name, year of launch and price), and then gives the power of exporting or im... |
I am working on a question in which I need to find a largest palindrome given a string. Here is the description.
public class LargestPalindrome {
public static void main(String[] args) {
System.out.println("Longest Palindrome 1: " +findLongestPalindrome("xyzracecar"));
System.out.println("Longest Palindrome... |
I have successfully implemented a divide and conquer approach for find the maximum sum subarray (see code below). The code works fine and is correct, however I have an efficiency problem in that in order to recursively calculate sub-vectors, I need to do a copying operation which ordinarily wouldn't be there.
I'm usin... |
This calculates the mobility and it's derivative of one element. If I calculate with 1 value of w, it's very fast.
%**setting the equation to calculate**
syms m w k e mi c w t L z ;
a = (((m * w ^ 2 - k) ^ 2 + (c * w) ^ 2) / (e * mi) ^ 2) ^ (1 / 8);
B = 1 / 4 * atan(-c * w / (m * w ^ 2 - k)) + 3.14159 / 4;
X = a * ... |
I am working on a survivor problem:
Complete Question Text: Take a second to imagine that you are in a
room with 100 chairs arranged in a circle. These chairs are numbered
sequentially from One to One Hundred.
At some point in time, the person in chair #1 will be told to leave
the room. The person in chair #2 wi... |
I'm writing a function in JavaScript which, when given an element, can look for the previous or next node, assuming a depth-first order traversal. If the next element is out of bounds, it should return null.
I could of course use document.querySelectorAll('*'), find the index of the element, and then move forwards/back... |
I am writing a Q&A wap page and want to switch questions in one page. This is my first time to write JS and CSS code, so I think there must be some improvement.
$(function(){
$("#parent").on('click','.children', function(e){
var that = e.currentTarget;
var wid = parseInt($(that).parent().css('widt... |
I am writting a program to remove the duplicate values from an array, is any way to optimize code by removing one loop?
var arr=[10,20,30,20,40,10],
newarr=[];
var foo=function(ele, index, array){
match=array[index];
for(var m in newarr){
if(newarr[m]==match)
return true;
}
newarr.push(match);
};
arr... |
class BinaryTreeNode {
private BinaryTreeNode left;
private BinaryTreeNode right;
private int data;
BinaryTreeNode(int d) {
data = d;
}
public void insertLeft(BinaryTreeNode n) {
this.left = n;
}
public void insertRight(BinaryTreeNode n) {
this.right = n;
}
public int height() {
... |
I wrote BST insertion code with the book. The book uses recursion, but I just want to know how I can do it without recursion.
My code is working, but I don't know if it is correct.
public class BSearchTree {
BNode root = null;
public void add(BNode node){
int depth = 0;
if(root != null){
... |
I tend to be rather prolific in my sharing of things I find online. I'm interested in tracking my own habits to make them more effective. Therefore, I submit the above to be critiqued by the lot of you. Have at it.
import argparse
from backports.lzma import LZMAFile
import csv
import datetime
import time
import tweepy
... |
I'm trying to improve my code's performance, and I've found an area where the execution time is being significantly increased. I've had a look through the code but I can't see how I can improve it.
AddData gets called over 200,000 times.
public void AddData(String label, int fromid, int toid, double distance, boolean o... |
I've just started to learn Scala and decided to implement small graph library to train.
Here is the basic version, that describes graph and nodes structure and also provides implementation of DFS to find some path from one node to other.
class Graph[A] {
var nodes = Set.empty[Node[A]]
def addNode(n: Node[A]) = no... |
This is my near-final version of Conway's Game of Life, with inherited colors using PDCurses. Any new spawned cells take on the most frequent color surrounding it when it spawns. This leads to single-colored populations roaming around, and causes interesting "battles" between 2 populations; which usually end in one tak... |
The assignment is to remove the repeating string from a given string and get the count of repeated string.
The code I have tried is below :
public static void main(String[] args) {
String longString = "Energy in the form of seismic waves is released " +
"after an earthquake and seis... |
I do a fair amount of scraping but I am by no way a good PHP programmer. I always struggle to get the innerhtml of elements using PHP, domdocument and XPath.
I have cobbled together a couple of functions that appear to do what I need but my question is are there any major holes in my logic or how can it be improved.
D... |
Adding a directory to the PATH in Unix/Linux is a very common task. However, what if the directory is already in the path? My goal is to write a shell function (preferably portable) that will add a directory to the front or back of the PATH variable, but only if it's not already there.
Here's what I have (syntax is i... |
The code I am working with:
foreach(var currentJob in ttJobHead)
{
foreach (var hdCase in Db.HDCase.Where(hdCase => hdCase.HDCaseNum == currentJob.HDCaseNum))
{
currentJob.ProjectID = hdCase.ProjectID;
}
}
equivalent to the following pseudo code:
foreach(var t1Row in Table1)
{
foreach (var t2R... |
This is a rags-to-riches an overdue alternative implementation on my previous question: Let's Break Down the Party
This alternative uses the int internal representation suggested by @janos and recursion to arrive at the same results. For starters, here are the changes in Denomination enum to support the internal repres... |
I am figuring out how I could make the following query more secure:
I have already used mysqli_real_escape_string but I doubt that adds much to security.
I have looked into the using prepared statements but I also have to take into account the following line:
$check_customer = mysqli_num_rows($run_c);
My solution:
... |
I've just tried my hand at Quicksort, and I seem to have gotten it working (thanks to Stack Overflow). However, is it "true" Quicksort? And is it decently written?
public static void sort(List<Integer> arr, int left, int right) {
int i = left - 1;
int j = right + 1;
if (right - i == 0 || right -... |
Dependencies:
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.13</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.13</version>
</depende... |
Can someone help me make a more elegant solution to this function?
function convertToHHMM(info) {
var suffix='AM';
var hrs = parseInt(Number(info));
var min = Math.round((Number(info)-hrs) * 60);
if (hrs >12) { hrs = hrs - 12; suffix='PM'; }
if (min < 10) {min='0'+min;}
return hrs + ':' + min + ' ' + suffix;
}
|
I decided to build a GUI that would seemlessly create user interfaces for validation functions, functions that check if a string satisfies given rules.
An example 'hello, world!' usage is:
from gui_validation import gui_validation
def is_valid_salutation(salutation):
"""
Salutations to be valid must start with... |
I'm building a random text generator!
My idea was to borrow slightly from the string.Format method styling, have a "format string" that controlled the overall construction of the string, and include "control string" segments inside them that classes will inject text into depending on their own logic.
For example, the i... |
This is the code for my Tic Tac Toe game. The player functions are coded in the class tictactoe and the rest of the functions, which include checking the board for completion, are global functions. Any tips, advice, or even corrections you guys have, please feel free to share them. I am almost brand-new to programming ... |
I have written this little thingie to fix a problem of missing pthread_barrier_t in Mac OS/X pthreads. Are there any issues with this code?
The header:
#ifndef PTHREAD_BARRIER_H
#define PTHREAD_BARRIER_H
#include <pthread.h>
#ifdef __APPLE__
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(PTHREAD_BARRIER_SERIAL... |
It is a code eval challenge question https://www.codeeval.com/open_challenges/14/.
My answer was accepted, and I modified my code again to improve it. Please let me know is it possible to improve it more.
#include <iostream>
#include<fstream>
#include<algorithm>
#include<string>
void create_permute( std::string &recor... |
This is a kind of follow up to my previous sort implementation review with specific questions to merge sort, and Modern C++ idioms.
template<typename InputIt1,
typename InputIt2,
typename OutputIt,
typename Comparator = std::less<typename std::iterator_traits<InputIt1>::value_type >>
void mer... |
Today I've got a pretty simple snippet to be reviewed. The function is extremely simple, as all it does is retrieve some entities from Core Data and then compares the dueDate attribute to today. I'm here asking about two questions:
Is this code reliable?
Is this the most efficient way (less lines of code) to accomplis... |
I have a small Django project to help organize museum artwork. In my models.py file, my museum object is defined as follows:
class Museum(models.Model):
"""Model representation of an art museum"""
title = models.CharField(max_length=50)
website = models.URLField()
description = models.TextField()
im... |
I decided to learn Go, knowing Python. My approach is by solving easy problems like this one:
You are given two strings, A and B. Find if there is a substring that
appears in both A and B. Several test cases will be given to you in a
single file. The first line of the input will contain a single integer
T, the n... |
This will go through and create every possible permutation of a username with a length of between 4 and 255 characters.
import itertools
# creating file
f = open('usernames.txt', 'w')
# setting character possibilities
chrs = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
# setting lengths
min_len... |
This is my solution to K&R Ex 1-18 which requires us to remove all trailing blanks and spaces from a string. I specifically wanted to use a separate function for processing the input (via gtLine()) to promote code re-usability. Please tell me ways in which I could have made my program shorter/better. Also, please point... |
This is my first time coding in my life. I don't really know much about coding. I googled whatever I need and combined them all together. It works great, but want to know if there is any improvement needed. Is there a better language to write in?
import os, csv, re, time
from datetime import date, timedelta
SendIDs =[... |
This is a kind of follow up to my previous sort implementation review with specific questions to quick sort, and Modern C++ idioms.
template<typename BidirIt,
typename Comparator = std::less<typename std::iterator_traits<BidirIt>::value_type>>
void partition(BidirIt first,
BidirIt last,
... |
I was asked in an interview to write code to check if a given string is a palindrome or can be a palindrome by altering some character without using library function.
My logic is to:
Compare 1st char with remaining chars. If it exists, remove both from array using removeElement().
If it does not exist in the char arra... |
I'm learning Java and was making a program to go along with the board game Clue. I type the name of who didn't do it and it takes them off the list. I want to evolve this program to be able to do other things and include the weapons and locations and maybe even probabilities based on other peoples guesses' during the g... |
I am hiding rows for given ids using this code:
var idArray = ['A123','B456']; // getting from web services
for (var i=0;i<idArray.length;i++) {
var id = idArray[i];
$("#eTable tr[data-empid=" + id + "]").hide();
}
HTML (Just for example doesn't needs improvement)
<table id="eTable">
<tr data-empid="A123" da... |
My question is about the equals() method. Most people implement equals() to start like:
@Override public boolean equals(Object o) {
if (this == o) { return true; }
if ( (o == null) || !(o instanceof MyClass) ) { return false; }
...
The !(o instanceof MyClass) line here can be very limiting. Once a cla... |
There is a file with two words with the same length. Call them first and last.
Also there is a file - dictionary with a lot of different words.
The task is to find shortest chain of words from dictionary from first word to last so that two neighboring words different just one character. All words of chain must be the... |
I wrote a script for a timer. Is there any way to improve the code, with fewer number of lines?
JSBIN
var app = angular.module('app', []);
app.controller('main', function($scope, $interval) {
$scope.timer = 0;
var clickme = true,
startfun;
$scope.status = "Start";
var foo = function() {
... |
I have the following extension method which checks all cells for values in a table column with the specified header name:
public static bool AllCellsInColumnHaveValue(this HtmlTable table, string columnName)
{
// Find the columnindex of the specified column name
var cell = new HtmlHeaderCell(table);
cell.Se... |
I have the following RegEx which matches any of a selection of inputs (see the list below).
While it works fine, I'm wondering if there is a better way of writing it, as it looks a little dirty. I've been using various RegEx builders but couldn't come up with a shorter version, so any tips would be appreciated.
-[0-9]... |
Is it good way of asking for a number? Should that function return 0 if there is an error?
private int getNumberDialog(String message) {
try {
String resultInString = JOptionPane.showInputDialog(message);
int result = Integer.parseInt(resultInString);
return r... |
I have taught myself some bash and already knew some AppleScript, so I have come up with this SSH chatting tool for OS X users. It allows you to chat from a terminal to another OS X computer.
One problem is that this code has to be located in an executable shell file on the computer of the person receiving the messages... |
I have lots of dictionary keys with conditional values, ternary in this case:
# cover page
data_coverPage.append({'reportCalendarOrQuarter': coverPage.reportcalendarorquarter.string if coverPage.reportcalendarorquarter else "N/A",
'filingManager_name': coverPage.filingmanager.find_all('name')[0].text if co... |
I wanted to do some exercise and came up with the idea of a good challenge (for my level of course). I tried to implement Laplace's algorithm for computing the determinant, recursively.
#include <math.h>
#include <stdlib.h>
#include <vector>
#include <iostream>
using namespace std;
int getMinimoCount = 0; //ignore the... |
I have inherited this code from my company. It is acting as a helper class for a database and written in VB.NET until date. It is working properly and almost 5 to 10 commercial packages I am maintaining is written based on this work. I just want to know if it can be improved. It invariably uses Async, and I am not sure... |
I wanted to create the most shortest JavaScript code for an endless rotation of elements, without any controls. The elements can be images or SVG-elements (only the Vanilla JS version will work here) or text-container. It doesn't matter. I came up with this:
HTML
<div id="container" class="container">
<img src="htt... |
I am trying to write a method that will return true if a binary tree is full and complete (each node has 2 children or none and all the leaves of the tree are at the same depth).
My idea is to use recursion. I will check for any node if its left son has number of children that is equal to its right son's number of chil... |
I have a user, a micropost and a response model.
The user has many microposts and has many responses.
Microposts have tags using the acts as taggable gem.
I need to find the number of responses a user has, to microposts that are tagged with a specific tag. To be clear, for example, how many responses has user 1 given t... |
I'm writing a tiny WebGL/JS framework to improve my knowledge of JavaScript and WebGL. Following is a class that wraps a Shader Program and provides methods for setting the shader parameters (AKA uniform variables):
ShaderProgram class:
"use strict";
/*
===========================================================
Shade... |
I'm new to writing bash scripts and was wondering if I could get someone's advice on a part of the script I'm working on.
Intended purpose of code
Check if a package exists using dpkg, and if it doesn't, offer to install it for the user. This snippet is part of a larger script that installs a particular Conky configura... |
This is a very simple rock paper scissors game implemented in Haskell.
import System.IO (hFlush, stdout)
import System.Random (getStdGen, randomR)
data RPS = Rock | Paper | Scissors deriving (Eq, Show, Read)
instance Ord RPS where
Rock `compare` Scissors = GT
Scissors `compare` Rock = LT
Paper `compare` ... |
I am writing a C++ client application which will send some data to server and wait for its response. Now the protocol is to wait for a specific timeout and then retry for specific times. If all goes wrong, the client will report a communication failure.
I have implemented the whole matter in a non blocking socket opera... |
I currently have an implementation that helps us deduplicate data but I know it's slow.
Here's an example, note that I'm using OpenStruct here when really these are Mongoid objects pulled from the database.
require 'ostruct'
vendor_data = [
OpenStruct.new(activity_id: "abc123"),
OpenStruct.new(activity_id: "def456... |
I made a method that I can use to avoid having to handle errors from callbacks.
What it does is, call the passed method only if the first argument is null.
So essentially it will bypass to the last method, if an error occurs.
Feedback is welcome.
/**
* continueIf
*
* Returns a continuation method that only continues... |
Below is one of the versions of my wifimap script:
#!/usr/bin/python
"""
Sniffs on the WiFi network and generates a graph showing the communication
between the devices, including information about the announced SSIDs. Will
loop infinitely - kill the program with SIGINT in order to stop it
gracefully. You can also use ... |
I have written two hash map implementations, one that stores Vertices and one that stores self implemented vectors of Edges.
They are all fully functioning, however in my application they are quite slow and was hoping if anyone could point out how to improve their speed.
Vertex Hash Map
public class VertexHashMap
{
... |
I have a few constants in a game that I'm doing for hobby. I need to store constants for the total size of the a Physical World and the size of the Screen.
I can position the world's objects to the screen or vice versa.
To position the images on the screen for example I get the position that the body occupies in the p... |
I have an Android service which must offload a task to a different thread but schedule the response callback unto the calling thread. After much thinking I came up with this code:
public void testRequestingAScheduleUpdateShouldNotBlockAndDeliverItOnTheCallingThread() throws Exception {
final StreamSchedule mockSche... |
I want to read a file and store the number of occurrences of each word in a Map, using tail recursion. I came up with the following; it seems to work; does it look like it's right?
def countWordsinFile(reader:java.util.Scanner, wordCounts:Map[String,Int]): Map[String,Int] = {
if (!reader.hasNext()) wordCounts
e... |
I am trying to build a database structure for a time punching system. What I'm trying to figure out is if what I have is the ideal structure, or if something else exists that I'm overlooking.
I want the records to be connected in some way so that I can pull out all of the records into a table and display them by date a... |
I'm trying to write a class to handle the collecting and calculating of some data. My intention is to have the controller instantiate the Report object, and a very simple view display it. I figured this would keep the controller thin and keep logic out of the views.
class Report
def initialize(year_term_ids = [])
... |
I had to create a program that had a struct that held data inside of it. I had to read an input file and take the contents and read it into an array of structs. Then, I had to solve for some particular statistical data such as finding the lowest and highest scores from the data. I completed my source code and it runs a... |
Here's my first shot at implementing Tic Tac Toe in Ruby. After watching Gary Bernhardt's Functional Core, Imperative Shell, I thought this would be a great exercise in trying out the ideology presented in that screencast. Tear my code apart.
Link to GitHub repo (includes video of usage)
tic_tac_toe.rb -- the procedura... |
I have a JSON input using which I have written below function to recursively create an unordered list.
Is there more precise way to achieve it?
$(document).ready(function () {
var htmlTxt = "";
var cat = [];
var htmlStrTxt = "";
var url = "#";
function recurseMenu(parent, leve... |
Just interested in any comments about the way the code is written. I am very new to python and programming. I did think about a func with a generator, but thought this approach was better.
from datetime import date
from datetime import timedelta
import calendar
import random
class rand_dates(object):
'''
... |
Wanna learn Rust? Ya rly!
I can haz FizzBuzz? No wai!
Gimme /bin/cat then. But rustc say LOL! Must handle teh err0rz!
Now iz all err0r handlurz, so /bin/lolcat. Rust sux, or OP sux?
Plain English translation:
Wanted to learn Rust, but didn't want to write FizzBuzz. How about writing /bin/cat? But for every function ... |
I'm trying to find useful versatile meta-predicates that are different from the vanilla ones offered currently by library(apply).
How about the following two: combine/3 and reduce/3? First, combine/3:
combine(_,[],[]).
combine(Pred_3,[X|Xs],Ys) :-
list_prev_combined_(Xs,X,Ys,Pred_3).
list_combined_([],[],_).
list_c... |
I had an interview recently and discovered that I'd forgotten some of the basics. I've been playing around again and have written a function that will take a binary string (there is no validation yet) and returns the ASCII representation of said string.
I'm looking for advice or tips on how it could be improved. I don... |
I have a webapp that follows responsive design and has following layout structure. The left layout appears when the window's width > 768px and right layout shows otherwise.
Based on preliminary research I think there are no modern pure CSS ways of doing it, so I implemented some jQuery code to solve it.
$(window).resi... |
Edit. Version 2.
I am working on a genetic algorithm in order to solve a little "puzzle."
Given a text file with N rows with 4 int each, the idea is to establish 2 bijections between 2 x 2 columns and the same number of 0 in each column. For this purpose, the program is only allowed to shift the data to the right. For... |
I have a procedure for normalizing variables, the details of which can be viewed in this white paper.
I would like to be able to make the routine scalable to handle any number of variables. Below is the R code for a 4 variable example with a regular correlation coefficient substituted for the preferred nonlinear coeff... |
I have an Array of objects, each which contain their own sub Tags Array, and I need to loop through and find a matching id.
Array: [
Object {
tags: [
{ tag_id: 1 },
{ tag_id: 2 }
]
name: name_1
},
Object {
tags: [
{ tag_id: 3 },
... |
My code does what it's suppose to do but the code is failing Pylint checks.
After pasting my code into Pylint checker, it says that Too many branches (15/12) and its failed me on the Pylint checks.
How can this be cleaned up?
"""Docstring"""
import words
def nicer_englishify_word(word):
"""Docstring"""
wordx =... |
First off, I am very new to WPF. These are the objects I want to display:
public class IssueWithComments
{
public Issue Issue { get; set; }
public IReadOnlyList<IssueComment> Comments { get; set; }
public IssueWithComments()
{
Comments = new List<IssueComment>();
}
}
// Simplified
public... |
I am trying to format supplied phone numbers for a web application. Users in general will be supplying US-based phone numbers, but it is possible for some users to input a phone number from another country.
Here are my assumptions:
Default to US if the number of digits is 7 or 10 after stripping non-digits. If not, ... |
I am using HandlebarsJS for my templating needs.
I have a nested object:
{
"amount": {
"preTax": 15.99,
"tax": 0.0,
"currencyCode": "USD",
"total": 15.99
}
}
And I have the following template:
{{#amount}}
<div>PreTax is {{preTax}}. Tax is {{tax}}. Currency Code is {{currencyCode... |
I need my trading system demo reviewed. It implemented a simple system which parse the trading flow (logged in file) of different trader and calculate some important feature.
packets.h
#ifndef PACKET_H
#define PACKET_H
#include <stdint.h>
class Header{
public:
char marker[3];
uint8_t msg_type;
uint64_t seq... |
This is for a high school class I'm taking. Any tips/improvements?
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import javax.swing.JButton;
import javax.swing... |
I was trying to solve a problem to determine if 2 strings are isomorphic. They are isomorphic when each character in string one can be replaced with another character in string 2. Two different characters may not map to the same value, and same character must not match to different values. Also the length of the string... |
import System.Random (randomRIO)
import System.IO (hFlush, stdout, getLine)
data Tile = EmptyTile | X | O
data Player = Player1 | Player2
instance Show Tile where
show EmptyTile = " "
show X = "X"
show O = "O"
type Board = (Tile, Tile, Tile, Tile, Tile, Tile, Tile, Tile, Tile)
empty... |
I had to make a demo for Spring oauth2 with redis store for tokens. Started with the sparklr2 (with tonr2) sample app from here. They are demo apps to show oauth2 powered by spring. Sparklr is the server and tonr is the client. This link has the details. Wanted to replace, the same JVM, in memory backed token store wit... |
This is a follow up to the questions: PyDOS shell simulation and PyDOS: Version 2.0
Introducing PyDOS 3.0! With brand new features and improved code, this will blow your mind!
New Features (This list will be updated with PyWrite soon)
Dialogs are now in a window like design.
New start-screen, easier to use.
Create you... |
Thanks to your wonderful comments regarding the first version of my code, I have been able to improve it. This new version is more readable (I guess). The problem is that it seems to me that there is no overall performance improvement at all.
Here is the full source code.
const int PUZZLE = 16;
const int POPULATION = 5... |
I have some underscore-delimited strings like abc_def_ghi. I would like to get a substring out of the string made of one or more delimited substrings, so that if I call:
getUnderscoreSubstring("abc_def_ghi",2)
then I get:
abc_def
This is the C# code I'm using:
public string getUnderscoreSubstring(string fullStr,int ... |
I would like to optimize the second line in my for loop(var phase). I believe moving parts of it outside of the loop would optimize performance. What can I move outside the for loop to improve performance?
for (var i = 0; i < items.length; i++) {
var phase = Math.sin((document.body.scrollTop / 1250) + (i % 5));
//var p... |
I adapted most of the suggestions from answers for my previous question Printing all the permutations of a string in alphabetical order to rewrote my solution again. Please let me know any more changes required or any more suggestions.
#include <iostream>
#include<fstream>
#include<algorithm>
#include<string>
void cre... |
This checks if a font is installed by using fc-list and grep. If the particular font is not installed, it offers to install it for the user. This snippet is part of a larger script that installs a particular Conky configuration along with all of its dependencies with minimal effort from the user.
Concerns
I have to cr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.