instruction stringlengths 71 39k |
|---|
trait Comonad[M[_]] {
// map
def >>[A,B](a: M[A])(f: A => B): M[B]
// extract | coeta
def counit[A](a:M[A]): A
// coflatten | comu
def cojoin[A](a: M[A]): M[M[A]]
}
object Comonad {
implicit def listComonad[A]: Comonad[List]
=
new Comonad[List] {
def counit[A](lsa: List[A])
... |
I was wondering about on how to organise the code on my site, to make it clearer as possible and clearly readable.
I'm organising it with namespace, separating every single section of the page.
For example:
var Header = {
//code relative to the header
}
var CentralBody = {
//code relative to the CentralBody
}
$(fun... |
I am writing a Nonogram game in JavaScript.
I would like to know your opinions on the code and suggestions on how to improve it.
I'm using a MVC approach.
the Model has two matrices (represented as linear arrays): one with the actual Nonogram cells and the other with the guesses of the player;
cells are just strings: ... |
I'm taking a sentence and determining whether or not it is a palindrome. I'm doing this while learning about stacks.
Is there a way I can use pointers instead of char array 'sent' so that the number of input characters need not be constrained to 20 in the following code?
The code is working fine, but should there be a... |
I present a bunch of grids of data to the user, and want to sum certain columns in some of the grids.
// for one such grid:
rows = [{id: 0, name: "Alice", age: "23"},
{id: 1, name: "Bob", age: "25"} /* ... */]
sum_aggregator = {
init: function() { return 0 },
step: function(l, r) { return l + parse(r)... |
I have solved one problem on Codeforces and I guess the output is quite correct. However, it is slow for input in range of thousands. Since, I am learning Python now, it would be great help if one could help me optimise this code. Any notes, tips or suggestions on the sidelines are always welcome.
The question is a pra... |
I've written a simple program to test out the capabilities of netwire (or rather, how to write programs using netwire). The goal is to have an application that shows a window, starting out as completely filled with red. Pressing space should switch from red to blue and vice versa. Pressing escape or closing the window ... |
I am trying to solve this problem on Sphere Online Judge. I keep getting a timeout error. Any comments or suggestions are welcome and appreciated.
package info.danforbes.sphere;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOExceptio... |
I made an android app which utilizes SSDP for automatic device discovery.
Because I didn't need the whole UPnP functionality, I wrote my own independent SSDP component.
It works well, but I feel like I might've made the implementation way more complex than it needs to by adding too much indirection/abstraction.
I can'... |
Right now I'm creating a community. You can register and create your own profile and post on a forum etc. I'm just doing this for fun and learning. I'm not planning on becoming a professional programmer this is just a hobby of mine.
Anyway, I want do it right though. Please review my script and tell me if it seems OK a... |
It's a standalone HTML file on GitHub
I included the CSS and JavaScript with the HTML so it would be easier to e-mail the game.
I'm most interested in comments about the solution-checking functions. This is the main function:
var evaluateSolution = function () {
//"In play" is the default state for the game.
var state ... |
I'm currently doing my first internship and had to create an application that will check through the first row of a CSV for valid or invalid input. Is there a more elegant way to code or to refactor my FileValidator class? This is my first time programming in a professional environment, so I'm still trying to learn how... |
I wrote a script that updates some library files for the game framework libgdx by grabbing the latest nightly build .zip file from a server and extracting the contents to the appropriate locations.
#!/usr/bin/python
__appname__ = 'libgdx_library_updater'
__version__ = "0.1"
__author__ = "Jon Renner <rennerjc@gmail.com>... |
You can place the script where you want the content to be checked and loaded in your design.
urlCheck is the name given to the function. You can change it, and if you do, change all urlCheck references within the code.
window.location.href returns the current address as http://.... Use this to identify certain pages... |
Is there any way I can refactor this expression tree?
public static IOrderedQueryable<T_PO> SortedPO(this IQueryable<T_PO> query, ExtjsGridPagingParameter.SortingParameter sortingParameter)
{
IOrderedQueryable<T_PO> result = null;
if (String.IsNullOrEmpty(sortingParameter.property) == false)
... |
Let's say I have a List contains numbers:
1,2,3,4,5,6,7,8,9
and I would like to split this to two lists:
odd numbers
even numbers
So I can do this two ways:
Solution 1:
Create two methods:
List<Integer> filterOdd(List<Integer> numbers){
List<Integer> result = new ArrayList<Integer>();
for(Integer n : numbe... |
I'm trying to determine whether an element which has been clicked has a specific tagname. The trick is, that sometimes when you click an element you want any parent to be that specific tag.
My approach:
var ignore = 'a input textarea body'.split(' ');
var isClickable = function(elem) {
var cancel = false;
for... |
I have some custom tables in a Wordpress database that I need to export to CSV. I created a dashboard widget to help with this based on some assistance given to me on on one of my SO questions. It basically consists of a single button that posts back and does some output buffering to render the CSV.
I've had it working... |
I created my first jQuery plugin over this weekend. I would like a code review so that I can improve my code in the future and learn from any mistakes I make. Any tips for Github would also be greatly appreciated since I am also new to GitHub :).
Demo: https://rawgithub.com/Shivambh28/ezToggle/master/demo.html
GitHub:... |
I have some duplicate code using LINQ & XML. I'm sure there is a way to refactor it, but I'm not sure how to go about doing it. Would someone help, please?
var fileInfo = dataXL.Worksheet("data")
.Where(t => t["F2"].Equals(company))
.Select(t => new
{
... |
I have created a personal password storage program that takes the user's username, password, and for what account it is for, and stores it in a text file and can also read from them (assuming you type the right name in). What I'm looking to do, is either trim it down (take out none needed code) or finding more effectiv... |
I've been teaching myself Python - my first programming language - for about two years now.
I recently discovered the concurrent.futures module and wanted to do something with it. What do you think about this script?
import re
import shutil
import string
from collections import Counter
from concurrent.futures import P... |
def alist(x):
if x == 1:
return 1
return [alist(x - 1), x, alist(x - 1)]
l = '%r' % alist(int(raw_input('Maximum Number Of Asterisks: ')))
f = l.replace("[", "").replace("]", "").replace(",", "").replace(" ", "")
for i in f:
print "*" * int(i)
So, basically, I just formatted the list into a string,... |
As suggested on my previous question, I am posting my revised code for feedback.
One thing that caught my attention is that my program actually runs slower after adding the modifications. It was previously running near 128 iterations per second on a single core machine and 382 in a 4-core machine. It now runs at 125 ... |
I'm using a payment gateway and am trying to implement the post and response handling with CURL so that it all happens on one page.
The following is tested and works but I want to double check it's secure. I'm not storing the card details but I'm essentially posting them to myself (via AJAX) and then curling that throu... |
This method takes a string and parses the syllables. I've broken much of the logic into helper methods. Without getting into the helper methods, it's pretty easy to tell what this is doing. But there are a lot of conditionals. I tried handling the conditions that handle adding to the syllables variable and those that s... |
I've done a LOT of reading about creating a Unit Of Work and Repository based implementation for my Entity Framework based application. I have come up with the following - what problems can you find?
The theory of making the actual SQL Server unit of work, context, and repository coupled to entity framework is that the... |
I've worked hard on this code and it functions exactly as I wanted, but I've been told it is a little bit unreadable. My focus is to get the code as clean as possible, and have things as efficient as possible.
This is the code I am working with:
http://jsfiddle.net/xT5X5/6/
//latest
var maxFields = 10;
$('.form').on('... |
I'm working on my site, and need help knowing what I need to do to improve the security of my login system.
If you feel so inclined, I would love some help to tell me what the exact changes that I need to make, but if you could just tell me what other security measures I need to add, that would be amazing.
This is a lo... |
I am trying to turn this function:
collection = ['hey', 5, 'd']
for x in collection:
print(x)
Into this one:
def printElement(inputlist):
newlist=inputlist
if len(newlist)==0:
Element=newlist[:]
return Element
else:
removedElement=newlist[len(... |
I wrote this tiny script to pull the JSON feed from the CitiBike website:
import requests
import time
def executeCiti():
r = requests.get("http://citibikenyc.com/stations/json")
print r.json()
time.sleep(62)
while True:
executeCiti()
exit()
Then I just run the script in terminal and output... |
I am doing interview studies and can't find a simple DFS for a cycle-finding algorithm. I want someone to tell me if my DFS algorithm works and how it can be improved.
Where can you get a typical DFS cycle finding algorthm for Java? I assume you have to "mark" the nodes and edges in order to find a cycle? Can you si... |
I figure that someone here probably knows a much better way to do this. I'm still figuring out AJAX and jQuery, so I consider that I still need to master quite a bit of knowledge.
My function extends Foundation 4 Reveal's functionality in a few ways:
Uses WordPress AJAX to dynamically pull in content to populate a mo... |
This little program is self-explanatory. I count letters in a string (can be any string), using a for loop to iterate through each letter. The problem is that this method is very slow and I want to avoid loops.
Any ideas? I thought that maybe if I remove checked letters from the string after each loop, then in some cas... |
I'm working on a communications layer for a system that reads data from a TCPIP client that is formatted as fixed-width ASCII (yeah, old school). I was quite surprised that there seemed to be no built in way to do this, and ended up using the following simple StreamReader subclass:
/// <summary>
/// A Stream reader tha... |
We have a lot of phone numbers that contain dashes and start with a zero which are from another country.
I am trying to strip the dashes and the one leading zero and select the country code from a drop-down box.
I'm using "raw" JS with DOM here (for the sake of not having to pull in a framework):
<html>
<head><title>Da... |
I have this ExpressJS route for saving and listing Category model.
exports.save = function(req, res, next){
//validate here>>>
var name = req.body.name;
var description = req.body.description;
new Category({
name: name,
description: description,
}).save(function(err, docs){
if ( err ) {
con... |
This code doesn't look too good. Could anyone help me format it?
private void initComparisonDatatable() {
List<BrandProfitAndLoss> brandProfitAndLossComparisonDatatable = new ArrayList<BrandProfitAndLoss>();
BrandProfitAndLoss brandProfitAndLossCurrentYear = new BrandProfitAndLoss();
BrandProfitAndLoss bra... |
I finally got my upload form and code that uploads to db. I used tutorial from this site.
As I am php newbie, I want to know how secure this code is and if it is not secure at all (which I am almost sure of...) could someone tell me how to make it secure. This upload should be only for pdf, jpeg, jpg, doc files. Also t... |
The function arg_to_uint64 takes a 0-terminated string and returns an unsigned int. The unsigned int is the integer presentation of arg in decimal or in hex (if prefixed with 0x) as defined in the C language standard.
constexpr char hexprefix[]="0x";
inline std::uint64_t
arg_to_uint64(const char* arg)
{
constexpr s... |
I am currently working on a project which uses the MVVM pattern. I have a POCO which I want to present in an editor and, because the object is composed from a number of smaller, reusable POCOs, I thought it would be appropriate to show it in a TabControl.
The result looks like this:
On the left is a collection of Prod... |
I wrote something that has probably done thousands of times:
a function that takes a parsed http query as input and return a linq query.
Any input is appreciated.
public IList<Lead> GetLeads(NameValueCollection nvc)
{
IQueryable<MyContext> queryBase = QueryBase();
foreach (string key in nvc)
{
con... |
I am trying to make a text-based RPG in Python and Pygame. I need a way to manage my inventory slots. Currently, I have no way to find out what is currently equipped. I can only overwrite it, even though I can display the current armor value and what it would be.
Here is the code for the only item I have "finished," ... |
I have been working on improving my javascript skills, mainly "namespacing" and the best practices used by js developers. I would like to know how I can improve this code and any tips that may help me along the way. Below is the specific code I am working with and there is a working fiddler also.
Just to note, I on... |
Is there a smarter way to write this code? I used to add all the elements in the collection constructor, something like this:
new OrderWizardStateCollection([new OrderWizardState(..), new OrderWizardState(..)..])
but now, since I have this one conditional addition, I'm writing it this way:
this.state_collection = new... |
Could it be written better?
package main
import (
"code.google.com/p/go-tour/wc"
"fmt"
)
func WordCount(s string) map[string]int {
dict := make(map[string]int)
splited := Split(s)
for _, string := range splited {
_, present := dict[string]
if present {
dict[string]++ ... |
I recently came across the Sleeping Barber problem and found out that it is a good place to start learning how to use threads properly.
I don't have too much experience with threads and want to learn more, so I figured I'd give it a go.
I'm hoping to get some constructive criticism on the code and any heads up on the... |
As a follow-up to my previous question about prefix free code, I learned about the module unittest and wrote the following set of functions, to be used in order to semi-automatically check the optimality of the output of any new algorithm to compute prefix free code.
The code works but I would like it to be as elegant ... |
I applied for a job and they asked me to write code with the following requirements:
Get a "toolbar offer" description from
http..update.utorrent.com/installoffer.php?offer=conduit. Parse the
bencoded (see http://en.wikipedia.org/wiki/Bencode) response and
extract the URL of the binary and its SHA1 hash. The h... |
This is Tic-Tac-Toe using negamax for AI. Help me make it better!
Some sore points are:
def get_mark
good_mark = false
until good_mark
mark = gets.chomp
if mark =~ /x/i
chose_x
good_mark = true
elsif mark =~ /o/i
chose_y
good_mark = true
else
puts ... |
I'm a JavaScript developer. I'm pretty sure that will be immediately apparent in the below code if for no other reason than the level/depth of chaining that I'm comfortable with. However, I'm learning Ruby, and so I'd love to write beautiful Ruby code too. My simple first project is a Craigslist search-across-regions s... |
Background: I was making a chrome extension that injects movie ratings into theatres' showtimes pages. The problem I was duplicating a lot of code calling similar but just slightly different functions. Sometimes I wanted to do an $(el).prepend, sometimes $(el).append, or $(el).after, or $(el).find('something').prepend,... |
Thanks for the Reply.
Here is the actual Scenario
My application received the data from a backend in the form of a class object ie.
public class FlowObject {
private String id;
private List<FlowStep> flowlSteps;
private List<String> audRefs;
}
Now FlowStep class as mentioned above is
public class FlowStep { ... |
T_PROJECT is the class that will be retrieve data from linq to sql and ProjectOwnerDataFields is the class that will be used to show data in view. in edit mode i have to get value from model and send it back like this. is there anyway to refactor this and remove the reverse duplication on ProjectOwnerDataFields and Upd... |
I should be able to figure this out on my own, but I can't seem to wrap my head around how to optimize this set of logic for interpreting the existence of URL parameters.
<cfif ParameterExists(start) and not ParameterExists(end) and not ParameterExists(after)>
<cfquery name="STUDENT" datasource="#STUD_DB#">
SELECT ... |
I'm working on some exercises Scala by Example and I've implemented an excl() method on sets which removes an element from a set, and a toString method that converts a set to a string.
I'm practicing use pattern matching here. A bit concerned about shadowing my instance variables on the line
case NonEmptySet(elem, left... |
I'd like some comments and any suggestions that you have for where to go next with this.
I've been working on developing a JavaScript library that allows for dynamic forms by simply adding some extra HTML tags and attributes to your form. It's brand new, so it doesn't have a lot of features, but it's based on the idea... |
I have code for a class that will manage an OAuth authentication key, included below. Because this class's functionality means it needs to be considered with regards to security, I wanted to check to make sure that all is as it should be (or figure out what ought to be changed), and there aren't any extra risks anywhe... |
I'm just starting to learn C++ and have been experimenting with various functions. Here is one that computes the number of permutations of n consecutive numbers as well as all possible permutations provided n. I'd love to receive any form of tips and criticisms on improving this function.
#include <string>
#include <io... |
This will later be be posted on my website to explain quick sort so I would like how I could improve the readability and simplicity of this demo class. I do not like my use of the stack (meaning this recursion cannot process a list with millions of values).
How could I reduce the stack impact? I think the best way woul... |
For my first not-just-a-few-days-long Python project, I needed something to handle basic set theory operations (union, intersection etc.) for one dimensional integer intervals, so I came up with this module.
It would be cool if you could tell me if the code is OK or something you would frown upon if you had to continue... |
For work, my colleague and I sketched this method up as a brain dump of how we want this method to work. What I am trying to figure out is how can we break this method into smaller components so that it is easier to test to write tests for this. I am trying to avoid putting this into methods where they are coupled by p... |
I need to build a application which sends a lot of emails. These emails are based on a table. Basic idea is, I grab a bunch of records from database. Create MailMessage (System.Net.Mail) and send it. Since there are a lot of mails to be sent, I am thinking about developing a multi-threaded application.
public void... |
This is a program that I made for encrypting text files, it uses a one time pad cipher to encrypt the files, but I do not know if there are any holes in my program that could be a vulnerability.
import os
q = 1
while q == 1:
e = raw_input("file to encypt: ")
#This will open a file for encryption
o = open(e... |
I am writing a TCP based client that need to send and receive data. I have used the Asynchronous Programming Model (APM) provided for Socket class by the .NET Framework.
After being connected to the socket, I start waiting for data on the socket using BeginReceive.
Now, while I am waiting for the data on the Socket, I ... |
I've been learning Python like for a year and started learning a little about pandas DataFrame. I made this little program to practice all the concepts and would like to hear your suggestions for improvement.
GOAL
This program should plot how the inventory levels behave according some initials conditions: number of per... |
Here is an exercise I completed today from Bjarne Stroustrup's Programming Principles and Practice in C++ book. Any tips about coding style, simplification, or perhaps modularization by means of using functions for some of the data processing would be sincerely appreciated. FYI I have only been programming for 5 month... |
I am looping through an object and finding whether or not the object has the "key," along with some further stuff.
I feel that there is some other correct way to do this apart from this:
var initialLocalesGen = function(data){
var status;
if(!$.isEmptyObject(data)){
console.log(data);
if(da... |
I have to check for the Highest Date from CostRepository whether it is create date or edit date then i have to get value in that field. edit date can be null. i don't know how to fix the codesmell.
var allCostsInThisPo = CostRepository
.GetAll()
.WhereInPo(po.po_surr_key);
... |
I am trying to draw a Checkerboard pattern on a LCD using a GUI library called emWin. I have actually managed to draw it using the following code. But having this many loops in the program body for a single task, that too in the internal flash of the microcontroller is not a good idea.
For those who have not worked wit... |
I tried this so far:
public String readchar (Reader input) throws java.io.IOException
{
int i16 = input.read(); // UTF-16 as int
if (i16 == -1) return null;
char c16 = (char)i16; // UTF-16
if (Character.isHighSurrogate(c16)) {
int low_i16 = input.read(); // low surrogate UTF-16 as int
if (low_i16 == -1)... |
I wrote a recursive function that traverses nested DOM nodes of the following form:
<a href="#" title="test">
<div id="nested-image">
<img src="image.jpg" />
</div>
</a>
The recursive function is the following:
function getNestedNodes(node) {
var ary = [];
for(var i = 0; i < node.length; ++i) {
v... |
This Python class takes a GF2 (finite field mod 2, basically binary) polynomial in string form, converts it to a binary value, then does arithmetic operations, then converts the result back into a polynomial in string form.
There are 2 parts I'd like to direct your attention to. I'll call them exhibits a and b.
For... |
Resharper thinks I should change this
while (dockPanel.Contents.Count() > 0)
to the following:
while (dockPanel.Contents.Any())
Without thinking twice about it, I switched to the any version because .Any() is more readable for me. But a coworker of mine sees the change and asked why I did it. I explained that this im... |
This is a multi-threaded socket client written to talk to the Scrolls socket server. The idea is to send commands to the socket server and respond to messages received via callbacks. I've never done multi-threading before and would like the code reviewed for code correctness, best practices, and potential issues regard... |
I was able to pull the records I wanted but I have a feeling it could be written better for these particular MySQL query strings.
SELECT ID,XAxis,YAxis,Player,Castle,Alliance FROM SC75
WHERE Snap = (SELECT MAX(SavedSnap) FROM DataSnap WHERE Server = 75)
AND hex(Player) IN (hex('Vandiel'))
UNION
SELECT SC.ID,XAxis,YAxis... |
I'm always programmatically creating and laying out UI elements in multiple ViewControllers and I've wanted an easy way to get relevant Screen information (sizes/points) globally using a helper class.
I've created a FlexibleScreen class and would like some constructive feedback. In addition to the typical code review... |
I'd appreciate a review of at least some of this javascript, if anyone has time. It's really long, but I think it's useful. It's designed to let you create forms and do javascripty things by only modifying html tags and attributes.
Take a look at what it's supposed to do here: https://docs.google.com/document/d/1T08A... |
I have created a video/article slider. It works fine, but I have a feeling it's not quite a standard solution.
I would appreciate it if someone could review my code, so that if there are mistakes, I could learn from them.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascrip... |
I have a function that I intend to use for validating zip codes and I wanted to know if my way could be made better.
function zipcode (inputtxt)
{
var zipcode = /^\+?([0-9]{2})\)?[-. ]?([0-9]{4})[-. ]?([0-9]{4})$/;
if((inputtxt.value.match(zipcode))
{
return true;
}
... |
I am concerned about creating too many objects in my code.
Am I using duplicate code? Can I cut down on the number of lines of code?
Note: I only want to use recursion to solve this. Any suggestions on the design of the program and naming convention used here are appreciated.
import java.util.ArrayList;
class Subse... |
I have seen this question asked a few times, but I do not entirely understand the solutions provided.
Below is a bit of code I came up with for splitting up an arraylist into five parts. I have tested and changed the array size from 0 to 16 and it works fine.
I am sure there is a "better" way of doing this, so I would ... |
Okay, so I finally tackled #13 from Project Euler. I'm said to announce it took me almost 2 hours to come up with this solution, after about an hour of thinking on how to do it.
Here's what I did:
private void Euler13()
{
// store 50 digit numbers into a 100 by 50 array
int[,] superMegaInt = { {3,7,1,0,7,2,8,7,... |
Are there any potential issues with the following Javascript code:
var BobsGarage = BobsGarage || {}; // namespace
/**
* BobsGarage.Car
* @constructor
* @returns {BobsGarage.Car}
*/
BobsGarage.Car = function() {
/**
* Engine
* @constructor
* @returns {Engine}
*/
var Engine = function()... |
I basically have a couple of clients built with C#, using System.Net.Sockets TCP connections connecting to a node server backend.
I've looked at tons of examples and everyone seems to receive data in a different way. I copied methods I liked and thought would work for me and put together this method.
This is the metho... |
The function is entered by the user as a series of coefficients and powers in the form of numerators and denominators. There is a little error somewhere with negative numbers that I'm working on finding. Other than that, I just want to know about the coding style.
Class Integration
package calculus;
import java.util.... |
In my project (which is a discussion system) there are approved and unapproved comments. There's a class that tells if unapproved comments should be shown. But I cannot think of a good name for this class. Right now it's named ShowUnapproved but doesn't that sound like a Boolean? (Rather than a configuration setting.)
... |
I'm writing this game server for my small 2D MMO game.
So here are my questions:
What do you think about the Thread-Safety of the code?
Please explain how can it be made thread-safe / show example/ fix the thing if its not thread safe already.
using System;
using System.Net;
using System.Net.Sockets;
using System.Tex... |
I wrote a simple parser for input-output operators. What is wrong with this code and how could it be better?
#ifndef PARSER_H_
#define PARSER_H_
#include <string>
class parser {
public:
typedef std::string::const_iterator const_iterator;
private:
static const_iterator start_position(bool b, const std::string... |
I am reading space separated integers, removing redundant ones and then sorting them. The following code works.
I was thinking whether this is the fastest way to do that or can it be optimized more?
import sys
def p():
#Reads space seperated integers
#Removes redundant
#Then sorts them
nums = set(map(i... |
I found an interview question which requires us to print the elements of the matrix in a spiral order starting from the top left. I need some pointers on how to improve my code:
#include <stdio.h>
//function that prints a row from startx,starty to endy
void printRow(int arr[][4],int startx,int starty,int endy)
{
i... |
I have been looking for a Cross-browser solution for DOMTokenList and element.classList. I wasn't able to find much for DOMTokenList and the polyfills that I found for element.classList were mostly limited to IE8+ as they relied on modifying the DOM Element prototype. There are of course some other stand alone function... |
I am trying to do a randomize function. It randomly selects one person (from two) to insert something into the console. The second person goes next, and then they keep alternating until the loop ends.
randomize();
RandomTurn := random(2)+1;
while (1) do
begin
if RandomTurn = 1 then
PersonTurn... |
I am creating a file uploader, and one function of the uploader will parse the file name to make sure that it is in the correct format.
This is the proper format of the file name: FILENAME_USERNAME_YYYYMMDD.csv,
where FILENAME and USERNAME are any chars of any length.
Specifically, I must extract the date from the fil... |
I have been working on a bash script for a while now to organize my movie files. I can do it by hand, but at the time I was taking a bash scripting class and thought I would like to use it to create this project. I don't know if there is a better way of doing it or not, but I would like you to take a look at my scrip... |
I've written a double-linked list library for another program I'm working on. I want to be particular about this library because I will be using it in another library, which will be used the program I'm currently working on.
I'm including the header file, source file, and a test main file (and its output). As far as I ... |
The entire flow depends on parameters. It's all in the same method with an if/else, but I want to make the code a bit more clear. How can I functionally decompose this method into many?
private void BindTreeView(IEnumerable<Opcion> OptionList, TreeNode parentNode)
{
var nodes = OptionList.Where(x => parentNode == n... |
I am studying for a degree in "Bachelor of Engineering in Information and Communication Technologies." I am currently on vacation, just after we started learning C++ at the end of the semester. I wanted to be ahead of the next semester, so I decided to try to use these classes and to make a text-based game.
I would li... |
I've written the following Python class that fetches iptables rules using basic string processing in Linux. Am I doing this in the correct manner? I've tested the code and it's running fine.
I'm ultimately going to use this class in a GUI app that I'm going to write using Python + GObject.
#!/usr/bin/python
import sys,... |
Consider the following code.
public async void Connect()
{
bool success = await ConnectAsync();
if (success) NotifyUserOfSuccess();
}
public async Task<bool> ConnectAsync()
{
var t = await Task.Run(()=>
try {
ConnectSynchronously();
} catch (Exception e)
{
return false;
}
return... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.