instruction
stringlengths
71
71.9k
I have a list of objects, which contains field rawData (eg rawData="KLAX 141353Z 06003KT 6SM BR FEW002 FEW008 BKN280 12/12 A3007 RMK AO2 SLP182 T01170117 $"). In my case rawData is METAR report from which i want to extract the most severe weather condition (clouds, fog, rain, snow). Currently I am applying parseWeather...
Here is my class to read a csv file and I was wondering if there is any improvements that I should do. I feel there are some performance improvements or in exception handling because I just took IO exceptions. package com.mypackage.utils; import com.opencsv.CSVParserBuilder; import com.opencsv.CSVReader; import com.op...
I am getting familiar with decorators, and after a couple of tutorials i came up with a decorator that might is useful for me. Is this the proper way to use decorators? Any suggestion about the code? def timeit_decorator(original_function): import time import colorama def wrapper(*args, **kwargs): ...
This Rust code plays the Silver Dollar Game. I've put some effort into trying to utilize the appropriate parts of std. This is the first program in the first real programming book I ever received. Practical Programs for the BBC Computer and Acorn ATOM I have not factored any code out to structs or traits. Listing of Ca...
I was working on a program that creates an array, then gives statistical information about that array such as std dev, median, mode average etc. I have written a method for each statistical value, however I am not too sure that they are efficient, particularly the getMode() method. I would be really happy if you helpe...
The program I've made is a template matching program which finds an image within an image - where's Wally/Waldo! I've complete the program and all works fine despite being very slow (around a minute). I would appreciate some advice on how I could improve the following code. I'm happy to share the rest of the source cod...
I have a WPF application where I have a function for generating an overlaying info grid. I have written some code for queueing the messages(IpopupMessage) so that each displays a certain amount of time public interface IPopupMessage { string Description { get; set; } TimeSpan Duration { get; set; } SolidCo...
I know, this sounds really difficult, but it is really easy. I needed to convert a single Portuguese word in the plural into singular. I know there's a right name for that, but it is escaping me. The rules are simple, and will compile them from http://www.easyportuguese.com/portuguese-lessons/plural/ (but applying in r...
I was going through Real World OCaml and wanted to make the program in "A Complete Program" use Async. It works now, but I'm wondering how idiomatic it is, and if I'm doing anything weird? open Core.Std open Async.Std let read_and_accumulate () = Reader.lines (Lazy.force Reader.stdin) |> Pipe.filter ~f:(Fn.non Str...
I have an input for users to enter a Twitter account in any different way and I want to extract the user account. For example: twitters = [ "www.twitter.com/twitteruser1", "@twitteruser2", "twitteruser3", "https://twitter.com/twitteruser4", "https://www.twitter.com/twitteruser5", "www.twitter.co...
Here is my exchange rate calculator, i took xml file from here: xml_rates I would like a review if I am doing everything right, and what I could do better. I am not sure if I should make another class for all of these methods? Shall I also create class for loading xml file? Thank you guys for looking at it. public s...
The idea here is that my executable can be started normally (in which case it runs my business logic), or it can be wrapped in a nanny process (which starts a child process to run the business logic, and if the child process dies restarts it indefinitely). Here are some more specific requirements: As invisible to the...
Syntax is ./bf-interpreter <program.bf>. #include <stdio.h> #include <stdlib.h> #define MEM_CELL_SIZE 30000 #define MAX_INSTRUCTIONS 5000 unsigned int progressUntilNext(char* source, unsigned int i_pointer, size_t newLen) { int open_brackets = 0; for(int i = i_pointer; i < newLen; i++) { switch (so...
I have made a small Vue app which fulfills the following user stories: Given I make a search for an existing GitHub user, then: The user's username is shown The user's avatar is shown The user's most commonly used language, if available, in their repositories is shown as a 'favourite language' The user's followers, if...
I have been trying to learn to program in a more object oriented manner and I am at the moment working on a Tic Tac Toe game. I have tried to split my classes so that it would make sense, OOP wise. I am just concerned whether I have split it up correctly and if I am really following the standards of OOP programming. I ...
I have Ubuntu 16.04 with standard apache web server installed. Nothing special about it. No open ports but 80. Instead of the default index page I put this one: <?php $path = "."; $dh = opendir($path); $i=1; while (($file = readdir($dh)) !== false) { if($file != "." && $file != ".." && $file != "index.php" && $file...
I'm implementing (for an article) two custom infix operators: ¿% - to calculate percent of total %? - to calculate the percent that represents a segment of total After debugging some errors and looking for information I finally found a way to get my code working: protocol NumericType { static func *(lhs: Self, r...
I'm writing an interpreter, and I'm designing the abstract syntax tree currently. Right now, I'm trying to figure out a way to add (or do other operations with) two Numbers, without casting to double or using a long switch statement I've currently implemented addition with a switch statement, but I don't want to copy t...
I was working on one of the Hackerrank programs, Bigger is Greater, and it basically deals with finding the next largest lexicocraphic permutation of a string. I've implemented my solution, following an algorithm described here. I then store all the permutations in a vector, loop through it, and search for the next per...
I am a C#/.Net developer and have decided it is time to branch out and really learn Python. I started with a simple implementation of a Mastermind-esque game. Any comments about the code would be greatly appreciated. I already know the gameplay isn't perfect, but it was just a quick attempt. I also am aware that there ...
I had to build a 2-player Tic Tac Toe app in C# w/ WinForms for a pre-interview screen. I got past that stage successfully and the app works flawlessly, but I would like to get some feedback. Although I've been programming C# for a while, I don't have too much experience with certain architectural paradigms such as Mod...
The purpose of this code is to simulate epidemics across a population. There are 625 (pop) individuals at random locations. The epidemic parameters are infectious period (inf_period), trans (transmissibility of the disease - essentially virulence), susc (the susceptibility of each individual to the disease), and eps (e...
I am developing an application that has different configurable versions - "a1" and "a2". The version name is initially being set from the database as "a1" in the $rootScope. I reference the version name in every templateProvider in UI-Router, which ends up being over 30 times: .state('app.auto.public.inventory.list', {...
This is a solution to Advent of Code 2016, Day 8. The tricky part of this problem is that you have to be able to rotate both the rows and columns of a two-dimensional array. Rotating a row is easy using std::rotate, but rotating a column seems much harder. My basic approach was to write a "getter function" such that ge...
I am new to Jquery plugins, I was searching a lot about widgets and plugins, however I am still not sure if this code is okay. Should I use widgets for stateful plugins? Or is this plugin correct? Does this code have any downsides? I was trying to make a container here, where you can add/remove elements. (function($...
I am using 5 Hotels APIs and trying to combine and pick min price hotel with unique hotels from all APIs. I am following these STEPS Call All 5 APIsand wait for response. get all static data from database or if avail my server caching(all 5 APIs like hotels name, images, desc, etc) Combine into one custom class get GI...
After reading many posts about how to handle sequences in EF 6 (see below) I found a way that was working for me. I'm using Code First and want to include the sequence from scratch, so without using migrations (tell me if I'm getting this wrong). Task was to get an unique and gapless incrementing extra ID for my entity...
I have to show price of an item. If the price is only in dollars, it should look like an integer. But if it contains cents, it should look like double value and always have two symbols after decimal separator: 2 550$ 2 550,55$ 2 550,50$ I decided to use Decimal format for this task, but I don't know how to proper...
I am trying to implement HMAC-SHA256 authentication into my Python RESTful API project. I am using Python Eve (built on top of Flask), started with an simplified HMAC-SHA1 example. My application is very simple: ## # application.py ## from eve import Eve from hmac import HMACAuth SETTINGS = { 'DEBUG': True, 'M...
Usually, parser combinators in Haskell based on the parser type like newtype Parser t r = Parser ([t] -> [(r,[t])]) This allows back tracking and multiple results. However I think it would be good to have it in "push" style, means the parser will have a set of result when no more input given, and have a transition fun...
I've just asked What's the idiomatic way to get the sort order of data, without actually applying it? (or see the original it was found to be a dupe on). So, I want to implement properly what seems to be the only suggested option - generating an array of indices and sorting it by the original data's relative order. Her...
Here is the code that I write for my work on Excel-vba. I use that code to know shifts' and operators' performances. Main purpose is to divide machines' work to orders and shifts. Sub Ucshift() On Error Resume Next 'Cleaning before start Sheets("Data").Range("A1:R568").AutoFilter Sheets("Data").Range("A:A,F:...
I have written this generic method to check whether a object has a dependent items or not: public void ItemDependant<TEntity>(Guid id, Expression<Func<TEntity, bool>> condition, Expression<Func<TEntity, string>> select) where TEntity : BaseModel { var foundItems = _dbContext.Set<TEntity>().Where(x => x.IsD...
I was reviewing today some code which gets as input a list of payments (paymentList) and a list of installments (installmentList) has to populate two other lists, respectively depositList and balanceList. Basically it calculates the sum of all payments from paymentList and fills depositList with the amount enough to le...
I am doing some exercises in this book. I've been trying to avoid Regex so far in my mission to teach myself computer science, as it makes my head hurt. That said - one of the exercises is to find all words without the letter 'e'. I have: /\b([^e ]+)\b/ There must be a better way using Regex to find all words that don...
I do not want to call this a wrapper, but no other name comes to mind right now, so I'll use it incorrectly for the rest of the question - It's just a class that adds C++ functions to dirent.h but it's very specific to my use case. All of the code works well, but I've never worked with the dirent.h library and jumping ...
A flexible, fast and lightweight rate limiter that allows rate limiting of any action on a website. Doesn't work across a scaled deployment by design, but could easily be modified to work in this way if required. By design chose to keep it to this model. Example usage If an IP address requests more than 100 page views...
I've been working on Python for the past few weeks trying to get my head around it's syntax/naming conventions/style/etc. I decided to make a monty hall sim to see how it looks in python. For those who don't know what the Monty Hall problem is, check the second paragraph here. I've verified the code is fully functional...
The basic UI for my checkers app is complete, so the next step is to come here for review. I have not built my Facade over my F# game library, so some of the type usages are a little strange; this will be done as soon as I get the library in a slightly more stable state. MainPage.xaml This is the opening view (and on...
I'm creating an app where the login page doesn't have the header/footer bars that the pages, after being logged in, would have. I've created an example that works, but I'm unsure if I am using the prop/component inheritance or patterns correctly. I feel like there is a lot of nesting going on here, but I'm unsure if t...
This is my first ever Python program so I would really like to know if it's any good (I mean if it is well writen), and if not then how to make it better. I would also like to know if there is a way to get all the veriables in one line without a space between them. This calculator is basicly this calculator which I wro...
I am in the process of translating an implementation of dflop_en_clr from VHDL to Haskell: if (reset = '1') then out_1 <= '0'; elsif rising_edge(clk) then if (clear_n = '0') then out_1 <= '0'; elsif (enable = '1') then out_1 <= in_1; end if; end if; Types to know: data PIn = PIn { _in_1 ...
I wrote this prime factors program as a programming exercise. Any comments or constructive criticisms are welcome. One question: prime[] is an array which stores the number's prime factors and associated exponents. How many elements, at most, does this array require? That is, what is the greatest number of prime factor...
I had to write a string search function that would search for barcodes, and be forgiving of minor formatting differences. For example, the barcode may be entered as YF 1942-AB in the customer's database, but a barcode scanner may read the barcode as YF1942AB. The goal is to get the correct substring indices (range) for...
I've made a simple clicking game where you spam a button in order to get coins which you can use to buy upgrades to get even more coins. I've only 2 classes one that is responsible for the game logic - MainGame and one for the items available in the shop - Item. MainGame public partial class MainGame : Form { priva...
I'm creating a plugin for the game Minecraft, and with it I'm using HikariCP and MySQL to store data between server restarts. I've created working code but I'm wanting to improve it. While the code works fine, I feel there's a simpler way to structure it. I appreciate any suggestions. HikariFacade.java public class Hik...
I developed the following Python functions when solving a few Project Euler problems, and since I'm not that familiar with Python, I'm curious at how I could improve them. The code consists of a data holder class, and a few functions. Option class: This object stores data for a combination option. It has two data membe...
Time Machine is a useful backup service for Mac, but deleting multiple backups is cumbersome. This script allows mass deletion of unwanted backups while allowing specified "important" backups to remain. I recently ran out of space on an external drive I was using as a Time Machine backup location, and though there were...
Recently, just for fun, I've created a clone of the widely popular game Tetris using C++. Since I am still a novice when it comes to C++, I would really appreciate all the feedback I can get from those with more experience. The code below is also on GitHub. Main.cpp #include "Game.h" #include <ncurses.h> #include <cloc...
I started learning about React and redux recently and I created a dummy project based on drf-redux project and react-redux-quiz-game This application uses Django rest framework for API and React with Redux for front end. A user sees options to add/edit/delete questions and answers in admin mode. In student mode user c...
I made a variation on the program that moves the character to the next character. This version moves the characters n steps forward and takes care of white spaces in between. It works but wonder if there is a better way of coding this. It only works with lowercase alphabet characters. import java.util.Scanner; public c...
I am trying to make file read and update operations thread safe and prevent race conditions in Python. Am I missing out something, or would this work in production? import os import time from contextlib import contextmanager import errno current_milli_time = lambda: int(round(time.time() * 1000)) lock_retry_wait = 0.0...
I made a class that will be used to get an image properties like width, height, and MIME type. <?php namespace Resizer; class ImageResizer { protected $imageOrig = null; protected $width = null; protected $height = null; protected $mime = null; public function loadImage($path = null) { ...
It is supposed to take an arbitrary number of arguments, turn those arguments into buttons, and arrange those buttons in a way to give each individual button the largest area possible. Is there a better way to do this? Be as thorough as you like. import sys import tkinter as tk import os from tkinter import * ###funct...
I have a 7x7 board and I want to select some elements from it. The elements I want to select are marked o, the other ones are marked x. Here is the board: xoxoxox ooooooo xooooox ooooooo xooooox ooooooo xoxoxox I use indexing starting from 1. The point (1,1) is the top left. The current list comprehension I have to se...
I have two JSON and each JSON I am loading in a Map. First JSON { "abc": "2", "plmtq": "hello+world", "lndp": "def+ooo", "yyt": "opi" } I am loading this JSON in a map as key:value pair. Here abc is the key and 2 is the value. Let's call this mapA. This is a String to String map. Second JSON { "abc":...
I have a List of Results. My goal is to extract the Result property Method from all elements of List<Result>, make extracted elements unique and prepare a string for SQL statements like WHERE method IN ('A','B','C'). Here is the Result class and a List<Result> example. The solution is in the ListTransformation() method...
All Spanish nouns have a gender (masculine [el] or feminine [la]; e.g. la casa, el perro). I'm using some javascript and jquery to display a random word from a list of nouns (2D array), as well as buttons corresponding to the two Spanish articles ("el" or "la"). If the user clicks on the correct article for the word, a...
As an avid user of esoteric programming languages, I'm currently designing one, interpreted in Python. The language will be stack-based and scripts will be a mix of symbols, letters, and digits, like so: ab123c-43=f54g6!6 This will be read from the file and passed to a new Script object, to tokenize. It needs to be to...
there is a knows problem stated as "Cyclic string": A string S has been recorded many times, and then from the resulting line took a substring, and give to you.Your task is to determine the minimum possible length of a string S. Input In the first and only line of the input file contains a string that contains only le...
I have a consumer which is listening to Kafka and from which I am getting avro GenericRecord. Now basis on GenericRecord payload, I am extracting lot of other things. clientId, deviceId, payId, crossId, appPayload. And on all those things I have to do sanity check to make sure they are null/empty or not. And if they ...
I created a small working autoloader based on some of the answers and ideas found on Stack Exchange (I lost the reference). However, I don't know much about PHP (I mainly know C, a bit C++ and Java). I'm trying to create a small MVC website for school project using my own templates and JavaScript as well. I mainly crea...
Brief introduction for CSR: The compressed sparse row (CSR) or compressed row storage (CRS) format represents a matrix M by three (one-dimensional) arrays, that respectively contain nonzero values, the extents of rows, and column indices. It is similar to COO, but compresses the row indices, hence the name. Th...
This is new code based on some new ideas to reduce calls to is_bad_version. Refer to the previous version of the code discussion from here. Any smarter ideas for better time complexity, any code bug or code style advice are highly appreciated. My major idea is divide and conquer like a binary search/quick select. Probl...
I have two Kafka consumer ConsumerA and ConsumerB. I want to run these two kafka consumers independent of each other on the same machine. There is no relation between them at all. These two kafka consumer will work on different topics on the same machine. Each consumer should have a different Properties object. Each c...
I'm learning LISP and am starting with Project Euler. I would love some initial feedback on my LISP code for this simple task. I know it spits out the correct answer, but what I'm not sure about is if I'm using LISP the way it is intended (and the way to strive for in the future in order to achieve success with LISP). ...
I'm looking to use LISP as best I can, not just get the right answer. This is very early on in my LISP career so feedback is welcome and exciting! Recently asked about Project Euler #1, got some feedback and incorporated into this answer for #2, but I know there's a LOT left to be learned! Description of Problem #2 Ea...
I have this Enum from which I am calling the appropriate execute method based on what type of enum (eventType) is passed. public enum EventType { EventA { @Override public Map<String, Map<String, String>> execute(Map<String, String> eventMapHolder) { if (eventMapHolder.isEmpty()) { return Immut...
I implemented merge sort with my own linked list for a school project. I was not allowed to use anything but the methods you see in the list. It seems to work properly, however, when running the provided testbed, I am told that the implementation is likely \$O(n^2)\$. I've looked for a long time trying to find where my...
I am creating a small backend library that uses a persistent queue, where the queue is just lines in a text file. The purpose is simply to allow multiple processes to read from the text file, so that work can be coordinated across processes. The constructor for the queue is asynchronous, because we use async i/o to ens...
This is my first attempt at building a linked-list-based stack and queue. It is the result of ~90 minutes of trying to implement some of what we're being taught in Algorithms class. I would like feedback on possible optimisation and oversights. I did try to segment and comment the code the best I could. This was writ...
I'm beginner at programming (I guess it's quite obvious) and this is my small "app" I tried to make, that takes username and password from the user. Could you give me some advice on how can I improve it? using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace...
I tried my level best to get it done. But I would like to have a better solution in all terms. Given 2 huge numbers as seperate digits, store them in array and process them and calculate the sum of 2 numbers and store the result in an array and print the sum. Input: Number of digits:12 9 2 8 1 3 5 6 7 3 1 1 6 Num...
I wrote the following code: def find_storms_dst(d_f, max, min): i = 0 storms = [] while i < len(d_f.index): dst = d_f['Dst'][i] if dst < max: if dst < min: print 'out of range' s = Storm(i, d_f.index[i], dst) while i < len(d_f.index)-1: ...
I'm guessing this has quadratic time complexity, \$O(n^2)\$, and \$O(2n)\$ for memory complexity. I wonder if I can do something within the list comprehension to just .pop(n) something out of the list instead of relying on a second list. Thoughts? listx = ['cat', 'dog','rabbit'] listLettersAlreadyFound = [] [[listLette...
This is the "Popes" problem from UVa Online Judge: On the occasion of Pope John Paul II's death, the American weekly magazine Time observed that the largest number of Popes to be selected in a 100-year period was 28, from 867 (Adrian II) to 965 (John XIII). This is a very interesting piece of trivia, but it would be m...
I am trying to compute a spherically symmetric function on a 2D grid. The simple solution that I came up with is the following: Grid_side = 10 N_pix = 100 function = lambda r : 1.0 / r**2.0 grid_x = np.linspace(-Grid_side, Grid_side, N_pix) grid_y = np.linspace(-Grid_side, Grid_side, N_pix) SphericallySymmetric_func...
Here is my Go code to interact with a Redis server package redisclient import ( "time" "gopkg.in/redis.v5" ) type RedisClient struct { client *redis.Client } func New() (rc * RedisClient) { return &RedisClient{ client: redis.NewClient(&redis.Options{ Addr: "localhost:6379", ...
Here's my first Rust program that I could actually use for something: use std::io; use std::process; fn main() { let mut sum = 0; loop { let mut number_str = String::new(); match io::stdin().read_line(&mut number_str) { Ok(n) => { if n == 0 {break} }, Err(e) => { println...
When coding I noticed I started to get into a habit of not using if-else statements when the else block only has one line of code. For example, if I have code that can be solved like this: public Person(int initialAge) { if(initialAge < 0){ System.out.println("Age is not valid, setting age to 0."); ...
C is naturally clumsy at polymorphism but I wanted to avoid duplication so I wrote this function. But I'm sure there are ways left to improve it. Please not that for brevity's sake not all data types have been included. void print_int(const void *number) { int result = *((int*) number); printf("%d ", result); }...
I've seen code that basically does the same thing, but i'd like some input on this. Basically what i did wrong or not good enough heh :). #include <stdio.h> #include <String.h> #include <stdlib.h> #include <ctype.h> char *getName() { char name[100]; int length; char *holder; printf("Tell me your name!\n...
I made a tic-tac-toe game that is a player vs. player version (no AI). I have tried not to utilize objects because I haven't really gotten there yet. A previous version (see here) utilized global variables, but now I've gotten around that! The code: #Objective: Create a tic-tac-toe game within the command-line #Version...
I have attempted to a zebra puzzle in prolog and I was seeking some feedback as to the way I went about solving the puzzle. Here is the puzzle: Two weeks ago, four enthusiasts made sightings of objects in the sky in their neighborhood. Each of the four reported his or her sightings on a different day. The FBI c...
Please find how I would model a system that had teachers, students, classes and parents. Instead of creating a model for each user type, I created only two models, User and Profile. Each user can have multiple profiles and each profile can have a unique profile_type. I would love to get some feedback on my proposed arc...
This function returns the largest product of all elements of a list between the leftmost and rightmost min and max elements. Is there more readable and maybe compact way to rewrite the elif chain in this code: from operator import mul from functools import reduce prod = lambda iterable: reduce(mul, iterable, 1) def p...
Arrays of double can be zero-initialized with the { 0 } initializer, which works even on systems that have a binary representation of 0.0 that is not all bits zero. While the IEEE 754 representation of floating point zero is all bits zero, the C Standard makes no guarantees about the representation of floating point nu...
I just wanted to get some constructive feedback on my solution for this problem taken from the HackerRank Cracking the Coding Interview series. CTCI Arrays Left Rotation Problem Statement #include <map> #include <set> #include <list> #include <cmath> #include <ctime> #include <deque> #include <queue> #include <stack> #...
I have a function that is designed to parse an utterance (or typed in string) and identify the intent as a yes or no answer. There are many ways of saying "yes" to something, and similarly for "no" or "unsure"; however, some of these phrases may include sub-phrases that have alternative meanings. For example: certainly...
I have an Activity called AuthActivity and I would like all of my authentication Fragments to be in this Activity. I will have 4 Fragments: LoginFragment, RegisterFragment, ForgotPasswordFragment and RememberedLoginFragment. I currently only have the LoginFragment and I would like some feedback before I continue making...
I have a very simple webpage that contains 4 color images. When I hover over any of the images the original (xxxx1.jpg) is replaced by a black and white version (xxxxx2.jpg) of the same image, and then it reverts back to the original image after hover. I'm declaring the same variable for both handlerIn and handlerOut: ...
Although it's a well-known algorithm, I thought to implement it from the perspective of a coding interview. I want to know if I can improve my code somehow. So, given the time constraint, is this a good enough solution to impress the interviewer? class MyQueue { private Stack<Integer> s1; private Stack<Integer>...
In my previous question I asked how could the Redis client be improved. Here I will ask how can the Game data Client can be improved. Game Data client sits on top of Redis Client and uses datatypes from datape package Here is the code: package gamedatamanager import ( "log" "reflect" "encoding/json" "...
Example input : A) 1, 2 B) 2, 8 C) 7, 8 Required Result : 8, 10 The output from the program with this input should be A + C. Few notes : We can only combine 2 sets. There must always be exactly one pair (or a single set) which sums up to the specified result. Input will always be in this format x,y. Set internal cl...
I'm the current maintainer of Showdownjs, a markdown parser off which PageDown (stackexchange's markdown parser) is based on. Showdown uses the following regex to parse horizontal rules: /^( ?(-|\*|_) ?){3,}[ \t]*$/gm This works fine for most cases. However, the following input: - - - - - - - - - - - - - - - - - - - -...
The code finds marked attributes and parses them according to the attribute type. Is it possible to simplify this logic? Is there generic way to do it? Please suggest some way to optimise this code. All the data type of Product class will be string. I'm getting product input as XML directly converting serialized data t...
I am simulating a simple bus network (as shown in the picture) using event simulation. There are two buses running (starting at 1 and 4) and the travel time between nodes is 10 units. For now, I used the switch-cases to manage the event. However, if I need to expand the network, it might be very confusing to manage al...
I'm working on a website and am trying to implement a parallax effect on an image and title (possibly other elements too). I'm trigering the effect with .scroll() and updating the transform property with .css("transform","translate3d(0,x,0)"). It works fine but on some pages with a lot of elements the frame rate drops ...
For learning purposes, I'm trying to implement a Markov Chain from scratch in Python. The goal is, provided a file with a list of words, and some sequence, to predict the next letter according the the probability computed from the list of words. My questions are not related to the Python syntax (for instance I know tha...
I wrote this script template at work to save typing repetitive commands and to improve my Bash-fu. I'd like to know of any moderate-to-severe quoting, robustness, security or usability issue. All code provided in answers should work in Bash 4. .sedevrc: #!/bin/bash se_projects=() se_cvs_dir="${USER}@172.0.0.1/export/h...