instruction stringlengths 71 71.9k |
|---|
I'm interested in the organization, layout and style of how I program. How does organizing code using whitespace work? I've had a go in the code below. I mean like when you press tab and start the code further right into the page.
Was using the goto command the best option for this code? Before learning C++, I learned ... |
I am using RestTemplate to make an HTTP call to one of my service and I would like to have timeout for my HTTP Request:
public static String getResponse(final String url) {
RestTemplate restTemplate = new RestTemplate(clientHttpRequestFactory());
String response = restTemplate.getForObject(url, String.class);
... |
I want to know if I can use a header tag in footer inside section. I also want to know if this follows SEO.
For example, I made four section boxes in footer:
<footer>
<div class="ftr_top"><img src="media/footer.png"></div>
<div class="ftr_bottom">
<section class="ftr_section">
<header class="ftr_head">
<h3>Box 1</h3>
... |
I've made a few functions to check form input for an AJAX request. I am still getting used to JavaScript and some of these AJAX requests. I am looking for any suggestions to better work with JavaScript functions, and passing variables through a function level scoping.
//Form Handler
$("#form-submit").submit(function(e)... |
I wrote this piece of code to mimic the *nix tree utility, however, I am not happy with the pad_info=[] part. It's used to make padding according to whether the parents were last child of their parents or not. Is there any alternate (and a more elegant) way to do this?
def tree(path, depth=1, max_depth=100, print_hidde... |
I'm trying to write a general multithreaded file processing facility. The idea is that some input file consists of a number of discrete records, each record needs to be processed in the same manner, and be written back out to another file. I would like to multithread this. I've tried to make this as simple as possible,... |
I have a code which I believe is callback implementation. Can you please provide your more experienced opinions on whether this is a good way to callback?
public interface Callback {
void run();
}
Test of callback with anonymous function
public class Test {
static void method (Callback callback){
callb... |
I am implementing A064604 - OEIS for positive integers up to 10 billion.
I am finding the divisors in \$O(\sqrt N)\$. So, the overall time complexity of running the formula right now is \$O(N\sqrt N)\$. How do I improve on this?
Pastebin
import math
def factors(n):
return set(reduce(list.__add__,
... |
I have been using $_SESSION, $_POST, $_GET, $_SERVER globals directly without ever knowing there was a concept/practice called, "Wrapping globals in classes" until, yesterday. As I did, I was able to immediately understand its effective benefit / usefulness. But I searched for a good wrapper, for $_SESSION, $_GET and $... |
There is an article where the author tries to compare performance of different web stacks. The result looks pretty controversial.
I try to prove that in real use case the difference between scores of different stacks will be not so significant(under "real" I mean something which relies on database) .
For this purpose I... |
I have written this code to find prime numbers, and it works well, but the calculation speeds are incredibly slow. Am I doing this wrong? I know that I might be really doing this the wrong way, but please help me!
using System;
using System.Collections.Generic;
namespace Primenumbers
{
class MainClass
{
public st... |
I am a beginner in Python and am currently learning about making beautiful code. I've started with a small program. Can you please review my code?
def inputAndRes():
try:
a = raw_input("Enter no. :- ")
n = int(a)
except Exception:
print "-----------------------------------"
... |
I've created an imageViewer that will be initialized with a String array, and will download and show the images as needed.
Alongside a review, could you give me a suggestion on what to do in didReceiveMemoryWarning?
PagedScrollViewController
class PagedScrollViewController:UIViewController,UIScrollViewDelegate {
v... |
I'm currently a beginner with clojure and I thought I'd try building a web crawler with core.async.
What I have works, but I am looking for feedback on the following points:
How can I avoid using massive buffers when I don't want to lose values?
Am I using go blocks efficiently? Are there places where a thread would b... |
I wrote this module in python for some minor tabulation needs in my science projects. This was very helpful for testing, debugging and plotting various data. I often use dictionaries for storing such data, either as an array or as in a spreadsheet (column and row). This tiny script helps me to plot such data in a simil... |
I am currently converting a 2D game to 3D, never having worked with 3D before I am trying to learn as I go. I am wondering what the best way to use vertex/index buffers is.
I am currently looping through a grid and creating a set of buffers for each tile type, which are are then used in the draw method. I'm presuming I... |
This works as expected and I want to get this code reviewed so that I can improve my coding ability.
I am concerned about readability and the quality of the code
#include<stdio.h>
#include<stdlib.h>
struct node
{
int element;
struct node *next;
};
struct node* mergeList(struct node *list1, struct node *... |
I have a list of rectangles as tuples (x, y, w, h). I need to find which ones intersect and if they do, average all the intersecting rectangles into a new rectangle. I also track the resultant averaged rectangle "weight" (the number of intersecting rectangles) as an addition member in the new tuple. (x, y, w, h, weigh... |
My method for counting neighbors in my soon-to-be Game of Life implementation is very repetitive and I was wondering if this could be done more elegantly:
static int countNeighbours(Board b, int x, int y) {
int count = 0;
if (b.getTile(x - 1, y - 1)) {
++count;
}
if (b.getTile(x, y - 1)) {
... |
I am trying to implement a genetic algorithm to solve (Diophantine Equation).
For instance, a + 2b + 3c + 4d = 90 where a, b, c, d are positive integers.
After reading some books and following tutorials, I finally wrote this code, but as I am new to programming and GA, I don't know if this is a good implementation.
#in... |
import Foundation
func printTimeElapsedWhenRunningCode(title:String, operation:()->()) {
let startTime = CFAbsoluteTimeGetCurrent()
operation()
let timeElapsed = CFAbsoluteTimeGetCurrent() - startTime
println("Time elapsed for \(title): \(timeElapsed) s")
}
func squaresSummed(first: Int, second: I... |
I'm trying to reverse a string using pointers and recursion, and I send it a char array. Is this the best way, or is there a better one?
int display_string_reversep(char* astring)
{
char* achar = astring;
if((*achar) != '\0')
{
char* x= achar;
x++;
display_string_reversep(x);
cout<<(*ac... |
As an exercise from RWH, I needed to write a function that splits a list every time the predicate is false (words == splitWith (== ' ') for strings):
splitWith :: (a -> Bool) -> [a] -> [[a]]
splitWith _ [] = []
splitWith p xs
| null pre = splitWith p post'
| otherwise = pre : splitWith p post'
where
... |
I want to be able to compare 2 jagged arrays of doubles for value equality. The arrays can have any number of dimensions. Inside any dimension could also be another array etc.
It is known that the values of any array dimension is a double, null or another array, so it should be able to compare any of these with one fun... |
I am working on a project in which I need to make an HTTP URL call to my server, running RESTful service, which returns the response as a JSON String. I am using RestTemplate here along with HttpComponentsClientHttpRequestFactory to execute a URL.
I have set up an HTTP request timeout (READ and CONNECTION time out) on ... |
I have this query in SEDE to try to find possible not an answers to flag. (I already went through a lot of them, for Stack Overflow, so I don't really recommend anyone else using this one since isn't that helpful anymore.)
As you can see, it looks to be a lot longer and redundant than it probably needs to be. Is there ... |
class Element
attr_accessor :datum, :prev , :next
def initialize(datum,next_element=nil, prev_element=nil)
@datum = datum
@next = next_element
@prev = prev_element
end
end
class Deque
attr_reader :first, :last
def push(datum)
if @last.nil?
@last = Element.new(datum)
@first =... |
I am trying to make a 3D grid plot in Python using Matplotlib. The grid consists of hexahedral cells (with qudrilateral surfaces). The surfaces should be colored according to their height, that is: the z coordinate. A colorbar should accompany the plot.
Here is an example plotting three surfaces:
from matplotlib impor... |
I have a model called WorkOrder which I want to be able to manage from a single window.
The required operations (for now) are only Insert and view, so this is what I came up with:
My Model:
public class WorkOrder
{
public int WorkOrderId { get; set; }
public string WorkOrderName { get; set; }
public strin... |
Although there are several implementations of binary search tree, I have made my own implementation for practice. The following code does the followoing operation
- Create a binary tree
- search through a binary tree
- inorder traversal
- preorder traversal
- breadth first traversal
- depth first traversal(post order)
... |
This code is going to be included in my Minesweeper Probabilities project. (so far it only exists on the develop-branch)
The purpose is to return a specific combination, let's say for example that you have 7 elements and want to return 3 of them, simple combinatorics tells us that there are \$\binom{7}{3} = \frac{7*6*5... |
I have a Rails app where we generate calls. Each call has an incident_number which is a unique number based off the following format: 14-00001 (year in 2 digit followed by a dash then a 5 digit number).
The following code generates an incident number for the Call record by getting the incident year, stripping it to tw... |
Here is a problem I have attempted:
Two positive integers \$N\$ and \$M\$ are given. Integer \$N\$ represents the
number of chocolates arranged in a circle, numbered from 0 to \$N − 1\$.
You start to eat the chocolates. After eating a chocolate you leave
only a wrapper.
You begin with eating chocolate number 0. ... |
Concerning the optimization of this simple function
String formatDate(String format, Locale locale, Date date) {...}
formatting a Date using a SimpleDateFormat created with the arguments format and locale. I'm curious what you thing about the code below. I know it's terrible, but let's assume two things
The code mus... |
I have this code which is performed each time I click the 'show polygons' button. The problem is that it takes a few seconds to finish running through the code before actually drawing the polygons + adding annotations to map. It actually takes about 10 seconds or so each time.
I am wondering if you can suggest any way... |
I am trying to implement a Graph data structure in Golang and choose to use adjacency list representation. When starting to implement adjacency list, I have an idea that if I use map instead of list. I think (not sure though) this is much much easier to implement and I can find element in \$O(1)\$ rather using \$O(n)\$... |
I'm new to the MVC model. This is where I started: User authentication system. After questioning, reading and thinking a lot, I was able to write a small framework (don't know if 'framework' is the right word).
I will try to explain everything as simple as possible. I hope you could tell me what I'm doing wrong and wha... |
I am an experienced Java programmer, but fairly new to JavaScript.
I am creating a chat library in JavaScript, and have it working, but want to know if I am going about this correctly, and following correct JavaScript coding standards.
I have a SDK object, LiveChatConnection class, and LiveChatListener and Credentials ... |
This is part of a school assignment and I came up with the following solution to leave out the max value in a Enumeration:
static void Opdracht3()
{
List<int> values = new List<int>();
foreach (int value in Enum.GetValues(typeof(Opleidingen)))
{
values.Add(value);
}
foreach (int value in va... |
I'm currently learning about different sorting algorithms and after reading on the concept of the insertion sort of how it's done I've tried to implement it by myself before seeing how it was implemented in the source from which I'm learning.
This was my implementation:
void insertionSort(int arr[])
{
for(int i = 1... |
I need to figure out what can be done to improve the performance of a A* search algorithm in PHP. The idea is to look for the shortest path, in number of hops, between two points in a "map". Actual distance is irrelevant.
This is a minimalistic functional version of what I'm doing:
<?php
/*
1 ____ 2 ____ ... |
Assuming that the framework is in place to handle the difference between row and column major matrices, I am curious to know if in a header based library such implementation is semantically and syntactically correct and or appealing. I am not using PIMPL here because it is strictly a header library.
template <typename ... |
I need to split a string into parts of varying predefined lengths, given as a sequence of integers. After a first imperative attempt using a sequence expression and a reference cell, I have now come up with this implementation that uses Seq.scan and doesn't need mutability:
let segmentString lengths (input : string) =
... |
I have some doubts about running time of following question. The problem is printing a binary tree level by level. For example if tree is like
5
/ \
2 6
/ \ \
7 1 8
Then the output should be like
5
2 6
7 1 8
TreeNode structure is very simple and looks like... |
Here is my HTML:
<section id="artists">
<div class="artists-home" style="display: block;">
<a class="artist-ken" href="#">Ken</a>
<a class="artist-kina" href="#">Kina</a>
</div>
<div class="ken-gallery" style="display: none;">
<a class="gallery-home" href=... |
I'm trying to teach myself C++ at the moment, after years of C# and other managed languages. The class in question is a Level in a game, and the idea is to instantiate it from a static factory function.
The questions that I have is:
Should Level::LoadFromFile return a Level or a pointer to one, as it does now?
Is the ... |
I needed a nice typesafe way to implement security checks for various domain objects and actions that can be performed on them.
I had an idea how to do it, so I implemented it as a simple proof of concept.
The core is the ActionSelector<,> class that receives two objects, securityChecker that checks for security, and e... |
I have a class that performs some long-running operation.
This class exposes a Completed event. I'd like clients that use this class to register to get notified ONLY ONCE when the class completes doing its operation.
Would you consider this code appropriate to handle this case:
public class TutorialController
{
pub... |
I am learning java and I successfully wrote one small console application. I would love to get reviews and possible bug sources on my code. I'm particularly concerned with my object structure.
Question
A well renowned hotel has three branches in Miami. Namely x,y and
z. Each has two types of customers: Regular and... |
I came back to some old code today and freaked out. I was like "How does this even work, and if it works it can't do what I intended." I ran a few quick tests and confirmed it did actually do what was intended. I know the long term solution is to avoid this situation by having good unit tests -- then I don't need to... |
In C++11, I tend to have master objects that maintain sole ownership of a collection of some children objects. Let's assume these children objects are non-copyable (for instance, boost::noncopyable).
Other code needs to access these children objects to do some temporary processing, but not keep references, or share ow... |
I am currently using:
class RepeatedTimer(object):
def __init__(self, interval, function, *args, **kwargs):
self._timer = None
self.interval = interval
self.function = function
self.args = args
self.kwargs = kwargs
self.is_running = False
self.start()
def... |
I'm currently learning about different sorting algorithms and after reading on the concept of the insertion sort of how it's done I've tried to implement it by myself before seeing how it was implemented in the source from which I'm learning.
This was my implementation:
void insertionSort(int arr[])
{
for(int i = 1... |
I'm using these functions to filter all my input variables. I was quite confident it would protect my website from possible XSS and SQL injections, but there are still vulnerabilities.
Please suggest improvements for my filter code.
//filter input field
function cleanMe($data) {
// normalize $data because of get_mag... |
I have two inputs (TextBox) on my front end.
The following code parses them from their string representation to aDateTime object. If it fails, it then sets default values.
DateTime dateFrom;
DateTime dateTo;
if (!DateTime.TryParse(txtDateFrom.Text, out dateFrom)) { dateFrom = DateTime.Today.AddDays(-7); }
if (!DateTim... |
I have a array of object, I need to sort them by time (hours, days or months) and separate the number of new IP.
result is an array of object with property time (JavaScript timestamp), user IP (string).
This code does work, but for request resulting in over 10k element, it is slow as hell.
I think the problem is the co... |
BEFORE YOU READ: this link should be included when you just don't like the format of the question and for those that read this question for the first time, the link may give you the idea what happened here. The rest after the line is untouched.
I was asking for such structure on SO, but got only link to boost::multi_i... |
This code uses recursion to solve the 01Knapsack problem. It evaluates all the item permutations that can be added to the knapsack and checks if it gives the maximum profit. What else could have been used to get a faster solution?
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.... |
What I have is an outer loop which loops through a list of strings, followed by another loop which loops through a list of filters; and if the current column is the current filter in the list of filters, it then applies this filter.
I'm just trying to tidy up a messy function but can't see anyway of doing so.
public st... |
Previous questions:
Is my implementation of insertion sort is correct?
Sorting an int[] array with an Insertion Sort
I'm currently learning about different sorting algorithms and after reading on the concept of the insertion sort of how it's done I've tried to implement it by myself before seeing how it was implement... |
I have written a solution to problem 23 of Project Euler, and after doing some testing and editing, I've managed to get the run time down from 1.7443 seconds to 1.56616 seconds. The problem is
Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers.
What are some other wa... |
I am comfortable with the procedural style, and learning the object oriented, so I have done a small Rock Paper Scissors game in both styles.
This script is in procedural style and this one is in object oriented style. Did I implement this little game correctly object oriented wise? And if no, where did I mess things ... |
I would like to gather ideas on how to refactor the JavaScript/NodeJS controller code below to be more aesthetic. The code is using the koa framework thus I use yield commands. I also use mongoose (I'm waiting for 3.9.2 which will support promises).
As a Ruby on Rails developer, I'm searching for a Rails-style way on ... |
I've always been used to write my own CSS but I decided to give a go to twitter-bootstrap and I want to make sure I'm not using more HTML containers that I need to:
This is my code for a single element of a list:
<div class="row form-group">
<div class="col-md-4">
<input type="email" class="form-control" placeho... |
In my attempts to grasp Existential Types in Haskell I decided to implement an integer-based fixed-length vector data type. I'm using ghc 7.8.3.
Specifically I wanted to write a program which asks the user for a possible new value to append to a fixed-length vector and then displays the resulting vector.
First I wrote ... |
I'm having this Arduino Sketch:
#define maxDigitalPin 7 //musn't be greater than 127
boolean state[] = { false, false, false, false, false, false };
unsigned long nextTime[] = { 0, 0, 0, 0, 0, 0 };
void setup(){
Serial.begin(9600);
for(int i = 2; i <= maxDigitalPin; i++){
pinMode(i, INPUT_PULLUP);
}
}
voi... |
I had an interview question like this:
In a company there are different people. One can measure how well they
suits for pair coding as follows:
First, let us compute the PAIRS-value which is the number of letters
P, A, I, R, S given in two people names. Then compute the sum of
consecutive digits and sum of digit... |
I am new to C# and have tried to solve a problem statement from CodeChef:
Problem statement
You are given an array A of N integers. You are to fulfill M queries.
Each query has one of the following three types:
C d : Rotate the array A clockwise by d units.
A d : Rotate the array A anticlockwise by d units.
R d : Q... |
I have created a .ashx file that is able to handle concurrent http requests.
Works great, but now I'd like to create a base class that does the common work in order to not repeat myself each time I need to create a new .ashx of the same kind.
Here is my current code for the http handler:
public class BaseAsyncHandler :... |
I posted a JS subnetting calc before, but I wanted to try a CLI version, so I made this.
The parts I'm most worried about are:
structure (could I refactor the layout better?)
Did I goof any math?
This was primarily a challenge so I could get better at writing Python... obviously it'll never compete with Perl or C.
Al... |
The code provided is working fine, but I would like to see if there is room for improvement for the code provided:
function Ship (size, direction) {
this.coveredFields = [];
this.place = function (sizeY, sizeX) { // sizeX & sizeY: size of fields in both dimensions
// pick randomly within our limits
... |
I've got a text input element which is decorated with an underline. The underline goes up half the height of the input on either side of it and turns blue when the input is focused. It's similar to how inputs look on Android devices.
Here's a JSFiddle and some accompanying code.
<span class="input-underline-wrapper">
... |
Most of my programming experience is with Objective-C, but I have recently started learning Java and JavaFX to build the user interface for a Trading Card Game. This is the most Java I have ever written, and I am completely new to JavaFX as well, so I am sure that there are lots of problems with this code.
I mostly ... |
This is the knapsack problem from rosettacode.org:
A tourist wants to make a good trip at the weekend with his friends. They will go to the mountains to see the wonders of nature, so he needs to pack well for the trip. He has a good knapsack for carrying things, but knows that he can carry a maximum of only 4kg in it ... |
private static boolean trovato , ok = false;
public static void main(String args[]) throws IOException {
HashMap<String, HashSet<String>> map = new HashMap<String, HashSet<String>>();
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
String line;
line = stdin.readLine();
String a = "a" ;
S... |
I'm making a program that takes an integer n and generates the first n Ulam numbers. I followed this guide about OpenMP.
This is the core function, single thread version:
bool isulam (int n, int size) {
int count = 0;
for (int i = 0; i < size; i++)
for (int j = 0; j < size; j++) {
if (i != j... |
I just started to learn Python, and wrote this Madlib program that works the way I intended it to, so I do not need help debugging, just some advice on tips to improve the code or make it simpler.
Program and Madlibs text files on Google Drive
Madlibs Reader
#Date 8SEP14
#introduction and file select
print ("Welcome t... |
Forms in MS Access are really just special glorified classes, so you can create new instances of them from code like this.
Dim someForm as Form_Form1
set someForm = New Form_Form1
someForm.visible = true
I decided to take advantage of this and create a progress bar form to display during long running processes. I cr... |
I'm using the Sieve of Eratosthenes to find primes numbers under N. Is there any performance problems you see with my approach? I used the LinkedList<Integer> because of the performance of removing items to the list while looping through it. Also, I'd want to know if I respect the Java conventions with my code.
import ... |
I saw that there was a previous question asking to review an answer to the Project Euler question #8. My answer didn't look anything like the answer in that question and as a beginner, I was wondering if someone would take a look at my answer and let me know if there is anything I could improve upon.
#Project Euler #8
... |
The following question was taken from Absolute Java 5th ed. by Walter Savitch:
One way to measure the amount of energy that is expended during
exercise is to use metabolic equivalents (MET). Here are some METS for
various activities:
Running 6 MPH: 10 METS
Basketball: 8 METS
Sleeping: 1 MET
The numbe... |
From this question:
Sorted vector (aka flat_set) for objects (pointers) with custom embedded key (functor used)
This is an example of a multi-index container. Note: this is not a container as defined by the standard (a lot of methods and types required for that are still missing). It is a container in that you can add ... |
I'm trying to create a menu for widgets with editable settings. As of now I'm setting these settings per object by coding them in like you can see below.
How could I make this shorter / programmatically create those objects with settings (settings are stored in a MySQL database)?
var widgetArray = new Array();
var... |
I have a synchronized list that I use as a taskqueue. In this queue I have some long values that need to be proceed and create heavy I/O and delay. I thought of using threads to get things done faster.
Is there a better way to implement all 50 threads to wait than using t.join();? Is there anything wrong with the way... |
How can I use a CyclicBarrier with N-THREAD according to my core for optimize this code?
My code has an input like this:
i 3
a duna automobile deserto -1
a nissan auto automobile -1
s aut -1
i 2
a pesca sport frutta -1
s sport -1
END
i = 3 means that there are 3 lines.
"a" means that I'm adding an element (firs... |
I know the Model, Controller and View's purpose, but I have never really found a good concrete class example of a View class.
Usually I see people having some small render() method being called from the Controller, or their Controller holds all the View logic. So I tried my best to create a View class that seemed prope... |
In an earlier question, I showed my code for calculating the mine probability for each and every field in a Minesweeper board. But it doesn't stop there. In that very same Minesweeper Analyze project, there is also an algorithm for calculating the probability of each and every number for each and every field.
Motivatio... |
As I'm slowly getting the hang of Python and Django I'm becoming increasingly worried about the volume/quality of code I have. This is my first time building a Python/Django Application and I'm learning as I go.
The only section I'm really looking for help on is the below get_context_data of my SessionWizardView in vi... |
I have been developing the below method to calculate the CPU usage of a Linux system at a point in time, as a percentage of the total number of cores available in the system.
#!/bin/bash
# Get number of cores from proc cpuinfo
CORECOUNT=`grep -c ^processor /proc/cpuinfo`
# Use top, skip the first 7 rows, count the su... |
The following question was taken from Absolute Java 5th ed. by Walter Savitch:
The video game machines at your local arcade output coupons according to how well you play the game. You can redeem 10 coupons for a candy bar or 3 coupons for a gumball. You prefer candy bars to gumballs. Write a program that defines a var... |
I'm writing some table.tools to make table handling a little easier for me. But I'm a beginner with Lua, so you might help me a bit, to make the code better.
First of all I would like to get the best usability, but performance is a factor as well.
-- is compare equal to AT_LEASE one entry of list_to_search_in?
-- the i... |
Given below is an exercise from the book *Java SE 8 for the Really Impatient( by Cay S. Horstmann:
Write a method that generates a Comparator that can be normal or
reversed, case-sensitive or case-insensitive, space-sensitive or
space-insensitive, or any combination thereof. Your method should
return a lambda ex... |
The below process is designed to pick out only AsbestosUPRNs and get the lowest OverallRiskCategory where they have the newest SurveyDate. I just wanted to ensure this is the best way, it seems neat now though as well as second code, which in reality is the same thing, based on two tables.
SELECT
AsbestosUPRN,
MIN(O... |
Is this a good way to create a class with a constructor and namespace in object literal style?
// root namespace
var myApp = myApp || {};
// sub namespace
myApp.model = {
// Constructor
Person: function (name) {
this.name = name;
}
};
myApp.model.Person.prototype = {
sayName: function () {
... |
I am building a 3D printed self-balancing robot, and use the attached server script to control it. I coded using node.io, express and socket.io.
The system is working, but I would appreciate some coding suggestions as I am quite new to these programming framework, and I would love to understand how to improve my knowle... |
I've been trying for a while to write clean and testable code, with the help of DI and abstractions.
I found myself guilty of service-itis, creating 3 or 4 interfaces for something that clearly doesn't need it. So I decided to relax, and only abstract what really needs it.
I'm faced with a problem where I'm not sure wh... |
This shows a table for open and closed tickets. The code for open tickets is identical with the closed tickets. I was trying to figure out a way to just write one code segment that will show both tables and use half of the code lines. With some changes I ended up to this code. With this code, if I iterate it twice and ... |
Codepen: http://codepen.io/srkimir/pen/mGbrf
Github: https://github.com/srkimir/thumbnails-carousel
While you slide left or right appropriately, thumbnails gets selected and change their opacity to be different among others thumbnails. You can also click on thumbnails to show the appropriate image on carousel.
HTML... |
The following question was taken from Absolute Java 5th ed. by Walter Savitch:
Write a program that starts with the string variable first set to your first name and the string variable last set to your last name. Both names should be all lower- case. Your program should then create a new string that contains your ful... |
Inspired by this question: To calculate the total CPU usage as a percentage
I wrote the following bash script (as an answer) to calculate the CPU usage for a (configurable) period over all CPU cores on a host.
#!/bin/bash
#CORECOUNT=$(grep cpu /proc/stat | grep -v 'cpu ' | wc -l)
#echo $CORECOUNT cores not needed for ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.