instruction stringlengths 71 71.9k |
|---|
So, back in this question, I built a set of settings. Now, I am trying to clean the entire system up.
This is the abstract base class:
public class SettingChangedEventArgs : EventArgs
{
public int NewSetting { get; private set; }
public SettingChangedEventArgs(int newSetting)
{
NewSetting = newSet... |
I made a snake game with /some/ code from thenewboston's tutorials when I had just started Python. I think it wasn't a good idea to start game development right away since I didn't even know if what I did was correctly coded.
I didn't use classes and objects since I didn't know how to use them. I'm sure this needs a l... |
My app will be running on an iPad with A7. I pass in 3 JSON arrays and right now do some simple filtering, in the future the operation will be much more complicated. I realize the if statement is slowing down the process, but how can I avoid it? Is there a way to have this loop on one CPU and run the GUI on the other... |
Please review my implementation of Fermat's Factorization.
fermat :: Int -> Maybe (Int, Int)
fermat n = odd' n >> (go $ ceiling $ sqrt (fromIntegral n))
where go a = case (try n a) of j @ (Just _) -> j
Nothing -> go (a + 1)
odd' :: Int -> Maybe Int
odd' x = if (odd x) then J... |
This function is used for <iframe> HTML element unwrapping. Most of the lines are repeated. How can I simplify this function?
<span id="pc1430828456801" class="optins">new insert text</span><span id="pc1430828456801" class="optdel">perturbative</span>
I have the same ID for both classes. I want to remove tag and inner... |
I have a library which is running in different datacenters in production. I have three datacenters in production:
DHP, SLP, LTR
Depending on which datacenter code is running, I need to return two string one is LOCAL_STRING and other is REMOTE_STRING.
Our machine name is like this in production and it is also possible ... |
I've created a form to choose the settings. These settings are automatically saved in a file from the game client in this form:
["Setting"] = {
["track"] = "Water Shield",
["duration"] = {
["minimum"] = {
["enabled"] = 1,
["value"] = 50,
},
["maximum"] = {
... |
A page contains a table of links, each link contains a table relevant to the link (a subject). Create a list of these links to pass to the function called scrapeTable which then takes the table and stores it in a CSV file. A directory of files are created for each subject which are then merged into one master file.
I'm... |
I have a class that receives an Object object as a parameter. Then, I want to write two functions to serialize, and deserialize the given object respectively.
public class ObjectWrapper implements Serializable {
private static final long serialVersionUID = 1L;
private byte[] bytes;
private Object object;
... |
It's big, it's ugly, but it should work. My question is: how could I have implemented the "typeselection" function so it is less repetitive? Any tips on other improvements in coding style are welcomed as well.
import math
import turtle
class Triang:
#MATHS FUNCTIONS; THESE GET CALLED WHEN PROGRAM HAS DECIDED ON TRIANG... |
I am new with Rx.net and tried to do a folder watcher that could send a notification when a new file is done being uploaded. Each instance check one and only one folder.
Here are the steps to achieve that:
Must check folder content each x Seconds.
Clear the "already sent" list of files that are no more in the folder... |
I've been building an MMO in Java for a game that will have clients built with libGDX. I have already built clients for the browser, desktop, iOS, and Android. To accommodate multiple platforms, websockets are used, and all messages sent back and forth are in the form of strings.
The purpose of the scheduled refreshA... |
I began working on a Java library that receives a boolean expression such as not A and (B or not C), compiles it to a circuit of logical gates \$\mathcal{C}\$, minimizes \$\mathcal{C}\$, and converts back to a (possibly shorter) boolean expression. Now, first things first: I need to be able to tokenize each input expre... |
Below is a PHP script which dynamically finds and process all of the form elements such as inputs, textareas, dropdowns etc... then organize them into a table as shown in the image below when sending the recipient.
I am new to PHP and what I have put together below is made of many snippets from across the web with som... |
I'd like a code review of the following simple implementation of the classic game Hunt the Wumpus
I'm trying to use JavaScript in the most "functional" way. To help me, I'm using lodash and ES6.
const _ = require('lodash'),
ROOMS = 20,
ROOMS_TUNNELS = 3,
BATS = 2,
PITS ... |
I will start by explaining the situation and then show some code. I have an app that has an array of "default" settings to display on a user's dashboard. The user can modify these settings to enable or disable certain items that appear on their dashboard.
I want to be able to update the "default" settings and if I add... |
Using Bootstrap 3 and PHP, I create my navigation bars in the following way:
<?php
$page_url = $_SERVER['REQUEST_URI'];
$active1 = (strpos($page_url, "one.php") !== false ? " class=\"active\"" : "");
$active2 = (strpos($page_url, "two.php") !== false ? " class=\"active\"" : "");
$active3 = (strpos($page_url, "three.php... |
I have a bit of jQuery that does one thing on mobile, and a different thing on desktop.
On mobile it toggles a class on a div that shares a common class with the link, on desktop it does the same, except on hover.
It all works, but I found that when I had it on mobile and clicked the links a few times in quick successi... |
I would like some advice which relates to the "fat model skinny controller" concept in Rails.
See my show action in the Micropost controller
def show
@micropost = Micropost.find(params[:id])
@tags = @micropost.tag_counts_on(:tags)
@responses = @micropost.responses
@response = current_user.respons... |
I just wrote my first Nim module and was hoping someone with some experience with Nim or similar languages could take a look. In particular I was hoping someone could speak if the use of template is idiomatic (or if they'd be better as a proc) as I have no experience using them in any other programming language.
I was ... |
I have a Python script for doing "safe" file copying.
There are a couple of rules for this copy function:
Existing files should never be overwritten. So if I try to copy $file1 to $location, and there is already $file2 at $location, then $file2 will not be overwritten.
Exact filenames are not important. So if I try to... |
IMetadata
public interface IMetadata
{
String ObjectFullName { get; set; }
String PropertyName { get; set; }
String DisplayName { get; set; }
String DisplayFormat { get; set; }
Int32 DisplayOrder { get; set; }
}
public static class IMetadataExtensions
{
public static String GetFullyQualifiedPr... |
I'm concerned about how much time my application could be spending during garbage collection so I'm trying to figure out how to add some code to instrument this.
Based on some examples:
https://msdn.microsoft.com/en-us/library/cc713687(v=vs.110).aspx
http://www.codeproject.com/Articles/101136/Garbage-Collection-Notifi... |
For a seminar with problems from programming contests I have to implement an algorithm to find the longest path in a graph. Here is a short summary of what I want to solve/achieve:
In this problem we are having a look at tasks which have a number of time units needed to finish the task and a list of dependencies. A ta... |
I have the following optimization problem:
Given two np.arrays X,Y and a function K I would like to compute as fast as possible the matrix incidence gram_matrix where the (i,j)-th element is computed as K(X[i],Y[j]).
Here is an implementation using nested for-loops, which are acknowledged to be the slowest to solve ... |
Is it OK to do that ?
for example, I have my log out service
logout: function() {
var defer = $q.defer();
this.getCustomer().then(function(credentials) {
$http.post(CONSTANT_VARS.BACKEND_URL + '/auth/logout',
{username: credentials.username, customer: credentials.customer}
).success(function(... |
I have the following ajax call and if it errors, I have a default error message stored in a constant which I'll use if the response doesn't contain a custom message. When I look at this, I keep thinking it could be done better. Can anyone suggest how I can do it better?
function requestService(){
$.ajax(... |
My first test (randomUpperCaseLetter) checks if the returned random letter is an uppercase ASCII one. The second one (compareCharactersWithAsciiCodes) is just me trying to understand Java.
package com.company.letter;
import com.company.RandomLetter;
import org.junit.Test;
import static org.junit.Assert.assertEquals;... |
As an exercise to improve my coding ability in C, I have attempted to write a simple and safe file reader. I believe this should be portable as well to major platforms (correct me if I'm wrong). For simplicity's sake I assume the file will fit in memory which is mostly true for my use case.
Please let me know where I c... |
This is a verification code generator, which generates n-digit numeric strings. (code can be 0000, so I chose String as a return type rather than Int or Long.)
It'll be great if anyone review this code and suggest more elegant or scalaish solution.
import scala.util.Random
object VerificationCodeGenerator {
val rand... |
I'm having this part of code which I want to make smaller, more readable and easy to manage. Any thoughts? I tried linq but got lost.
foreach (var o in state.s)
{
TimeSpan timeDiff = (DateTime.Now - o.time);
if (timeDiff.TotalSeconds < 300)
{
richTextBox.Appe... |
The Code Explorer is a dockable toolwindow that displays a TreeView that shows all opened VBA projects and their respective modules, but unlike the "native" Project Explorer, Rubberduck's explorer also drills down to individual module members, and allows quickly navigating them:
While it looks pretty, the code behind ... |
For the below question picked from here:
Write make_inverse_dict(d) that returns a new dictionary with the
'inverse' mapping. The 'inverse' mapping of a dictionary d is a new
dictionary that maps each of d's values to all keys in d that
mapped to it. For instance:
>>> d1 = {'call': 3, 'me': 2, 'maybe': 3}
>>> d2... |
I've been working in C for a while and have decided to implement my own dynamically sized array as an exercise and to actually be used in a project.
I have also written Doxygen documentation for the library, which I have removed from the code here for readability. You can find the full code with documentation here.
I k... |
I wrote a partial implementation of Snake in Haskell. As of now, it only supports the movement of the snake. However, since the code is getting complex, I'm requesting for a review of the code before I add on the food, growing and scoring functions.
I'd be glad to hear any suggestions on how this code could be written ... |
I have the following code in a VIEW:
<select name="selected_budget_mode" class="" onchange="OnBudgetModeChanged(this)">
<option value="0"
<% if params[:current_budget_mode].to_i == 0 %>selected
<% end %>><%= show_budget_mode(0) %></option>
<option value="1"
<% if params[:current_budget_mode].to_... |
I have a task that I am trying to complete and would appreciate direction, to know which is the most efficient path to take for future requirements.
Use Case: A background process that determines if a specific database is broken. This task will be run every two minutes as we must know ASAP if there is a problem with th... |
Is this the most efficient way to do this? Any suggestions on some thing I might have missed or can do better?
func checkPasscodeMatch(){
println(self.passCodetext1.text)
println(self.passCodetext2.text)
// check if pass codes match
if self.passCodetext1.text == self.passCodetext2.text {
//chec... |
I'm looking for a clever way to do the following operation:
Take a list of numbers:
1, 2, 3, 4, 5, 12, 13, 14, 19
and compact it into a string like so:
1-5, 12-14, 19
With the following rule: only compress into a range (i.e. use a dash) when the count of numbers in the range is 3 or more.
I.e.: 1, 2, 4, 5 would result... |
This is part 2 to Fetch, Parse, and Save JSON. As the code evolved, I wanted to post the program with changes for review again.
The objective of the program is to fetch JSON information from a service through their API and save it. Currently, I dislike the way the program handles bad user input in the WeatherTracker c... |
I've written some code to load a section of my application between views. While my code works, I'm wondering if there is a better way to do it. (partial views perhaps?) I currently load the views, then show/hide them depending on a button click.
<div id="wrapper">
@*Sidebar*@
@Html.Partial("_AdministrationSidebar")
... |
I was wondering, beyond the standard improvements that this needs, is there a more "clever" way of solving this problem?
The problem is to translate letters into digits without changing the format of the original string. The conversion is based on the international standard letter/number mapping on phones (i.e. where A... |
I have a method which checks if a control of an entity's attribute is 'multiControl' or not:
private boolean entityHasMultiControl(IEntityMetadata entityMetadata) {
for(IAttributeMetadata attr : entityMetadata.getAttributes()){
for(IControl control : attr.getAttributeType().getControls()){
if(c... |
I have a 2D matrix in Matlab and I want to convert the Matlab code into C++.
In C++ I have int* channel_gr. The commented code is the original Matlab code.
Is there a faster way to execute this code?
//Gr(1:ROIY(1), :) = clipLevel;
for (int i = 0; i < _roiY1; i++)
{
for (int j = 0; j < newWidth; j++)
{
... |
My code compiles and executes. I would like to hear any comments or suggestions pertaining to my use of C++.
#include <iostream>
#include <math.h>
bool error_check(){
if(!std::cin){
std::cin.clear();
std::cin.ignore(256,'\n');
return true;
}
else
return false;
};
... |
I have this method in one of the java classes I'm working on (an implementation of a counting bloom filter):
private int[] hash(V v){
Random r=new Random(v.hashCode());
int l=r.nextInt(size);
int[] keys=new int[size];
for(int i=0;i<bpe;i++){
keys[(r.nextInt(size)+l)%size]=1;
}
return key... |
I just started using C++, and I was wondering if my code fits the standards so far. Specifically, I was wondering if I did the addEdge, isConnected, and getShortestPathForm methods correctly. For instance, are the parameters correct as Vector<T> &v or should it be Vector<T> *v or Vector<T> v?
//Graph.h
#ifndef GRAPH_H
... |
I want to count the total relocations for each of these sorting algorithms. From the results it seems my code is correct, but I need someone to confirm it. Is the counter variable placed in the right position?
int bubblesort(int *p)
{
int i,j,temp,relocations=0;
for(i=1;i<N;i++)
for(j=N-... |
This is a simple practice app that draws a line, and the line 'balloons' up for a second.
This code shows some issues I tend to have a little too often, where I end up defining functions inside of functions, and it feels like there's got to be a better way.
I'm also unsure of the way I updated the size and pos values i... |
I'm creating a puzzle mini game where there is a board of gems, varying in color, and chosen at random.
This is what my code generates:
When you click on a gem the game should traverse the board and find all connecting gems of the same color. When you click the orange square all orange square neighbors are selected.
... |
I always get marked down for my comments and I just wanted to see if these comments are acceptable or what I should include/where I should include them.
import java.util.*; //so I can use scanner
public class GuessingGame {
public static void main(String[] args) {
Random rand = new Random ();
int max =... |
This set of Google Apps Script helper functions are published in this gist, along with a bunch of other utilities. Background info is in this SO question. Since no Google services are used, this is pure JavaScript.
What I hope to get from a code review:
General feedback on clarity & maintainability.
Is the regex in ce... |
I was writing a simple function that would return the Fibonacci sequence up to the nth term and for whatever reason started wasting a lot of time on it. Here's what I came up with:
static IEnumerable<int> Fibonacci(int n)
{
int last = 0,
oneBefore = 0;
if (n > 0) yield return oneBefore = 0;
if (n ... |
I've just started learning C# + MVC. Here's my attempt with MVC:
using System;
namespace QuadraticSolver
{
class Program
{
static void Main(string[] args)
{
Controller c = new Controller();
c.Welcome();
string keyPressed = null;
do
{... |
The part I'm really wondering about is in the "if, elif, else" part. I set the variable to bring up the raw input thing so it would stay there long enough to read instead of just printing a response and closing the program right away. There must be a better way of doing this. An answer about that, and any other tips or... |
I have a form that is used for inputting data, one of the fields is a datalist with around 6000 options in it, I needed to check that the value entered in to the datalist is actually in the list, here is what I came up with,
$('#submit').on('click', function (e) {
var datalistval = $('#ItemSelect').val().split('|'... |
I am new to JavaScript, and trying to ensure the i write the best possible code instead of "copy & paste".
I hope i am asking correctly, want to know if my code I have written is done correctly or could it be done better, the code works, so nothing wrong with the end result, just not sure if I'm on the right track.
$(... |
I am searching in files with extensions .xml, .java, and .properties strings that match a certain regular expression.
When I find it, I write it to the file with the filename, line and string information.
def search(param):
filename = "search-result.txt"
try:
os.remove(filename)
except OSError:
... |
I learnt everywhere that using if statement is a bad practice when it's possible to avoid them. I'm trying to learn how to make clean code, it seems also that some design patterns could be helpful so I'm wondering if it's possible to refactor this piece of code in order to remove if statement from, here is the code dem... |
I am trying to find out the best practice for writing a loop which does one check and at the same time has to increment a value so that the while loop will eventually fail. Performance is important that's why I thought of using the least amount of variables.
Use case
In a decently low level method I do a binarySearch(a... |
I am trying to write up all the linked list basic operations (push, pop, add_at_end, pop_from_end, add_at_index, pop_from_index). This is not a school assignment, even though it may look like one. I have written the code. I have tested it myself quite a bit, although I am no C guru. I would like it if you could tell me... |
With some background and experience in PHP & Python, I'm trying to learn Swift by myself (web, videos, Ray Wenderlich books). I've read that a good first project for beginners is to try and write a basic calculator, so I've tried that. I'm wondering if there's a way to make my code leaner and more elegant (I've spent q... |
I want to write a relatively simple program, that can backup files from my computer to a remote location and encrypt them in the process, while also computing a diff (well not really...I'm content with seeing if anything changed at all, not so much what has changed) between the local and the remote files to see which o... |
I'm trying to learn C++ and I would interested in how I could write better code. The code should be independent of the architecture it is running on. What I want to do is writing some binary data to /dev/rfkill so that I can change some settings. The target is an embedded system so the program does run with root privil... |
I am using this code to get images to load only if they are visible. However, it seems to be slow with thousands of images, even if they are not rendered.
function getViewportHeight() {
if(window.innerHeight) {
return window.innerHeight;
}
else if(document.body && document.body.offsetHeight) {
... |
I wanted an opinion about an idea I had regarding the use of config.properties, static classes and the use of reflection.
I have to load some preferences at application startup, for that I will be using config.properties. Certain properties within config.properties will be changed during various points in the program. ... |
I'm looking to improve the speed my ng-repeat or find an alternative way to do it, because it takes too long to load when it has to manage a lot of data.
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-2 block animate"
ng-repeat="build in buildsRunning.builds.build | limitTo:totalDisplayed track by build._id... |
I have 2 function in Lua, one to look if a key is present inside a provided table and if true then return the value, else return false. This lookup function is called by another function with a "priority queue". It is not a queue per definition but I don't have a better name for it.
function inTable(tbl, item)
for ... |
I'm back after Tic-Tac-Toe in Haskell with a new version.
I added Haddock documentation and wrote a generalized version known as the m,n,k-game. By doing so, I had to redefine Game and getSeqs. getSeqs as of now contains two annoyingly-long list comprehensions which I'd like to get rid of.
I tried to integrate gameStat... |
I have a block of code that is really bugging me but I can't figure out how to clean it up. I have a list of objects which are all related. In fact some of them are complete supersets of one or more others.
To identify the 'Dupes' which are completely contained within other files, I am comparing every file against eve... |
Use Case
I have a service that does processing of records from multiple third-party feeds. The steps are generally identical for each feed, but each feed is populated in a different location on an aggregate feed. I decided to write a generic test that would allow testing of all this processing to keep things DRY.
Test
... |
The first two lines of The Zen of Python:
Beautiful is better than ugly.
Explicit is better than implicit.
I'm writing a function:
def get_item_table(self, itemHeader):
"""Returns a specific html table by the 'Item' name."""
for tbody in self.get_all_tbody():
for tr in tbody.select('tr td div span'):... |
I have again 2 functions but this time they return either the full file name with extension or just the extension with a dot.
Both actions are so similar that I just copy pasted the code from one and changed 1 character... but at the inside I am cringing because it looks terrible to just copy paste. In addition I am no... |
I'm trying to find out what is the best way to create a class so I can use it to connect to the SQL Server and be able to rollback everything if a single error exists.
Right now, I'm using a single connection for a procedure. This, sometimes, is causing my code to throw There is already an open DataReader associated wi... |
I have written a script that run in WingFTP Server which has a Lua scripting engine built in. The script recursively deletes empty folders except the specified root folder.
--Walks a file tree and delete empty folders except the root folder
function EmptyFolderDeleter(options)
local rootPath = options.path
loca... |
At work I am switching from AS3 to HTML5 for mobile game development, I have always hated JavaScript and developing for web but I have denied this transition for far too long and now I have to make the switch.
I would like for some of you to give me a little feedback on my simple Tic Tac Toe game. I only spent my lunch... |
This question is related to my previous question about an MMO Server.
Here, what I am doing with this program is connecting to another Java server program that resides on the same server as the MMO server. Once connected it receives a payload that contains all of the player data for the MMO server as well as all of the... |
I'm working on a project where I have 2 classes, one class for Monomials and another one for polynomials which are built out of monomials.
I would like to make a simpler method for adding and multiplying polynomials, other than my naive method.
public class Monomial {
/**
* @post this.getCoefficient() == coefficient
... |
Some people complain about if - statements and I really appreciate that attitude. Actually I plan to abandon the entire keyword in order to awesomize my code, which is:
Algorithm.java:
package net.coderodde.noxx;
import java.util.Arrays;
import java.util.Random;
/**
* This is algorithm. It works as .. there is no ne... |
Here is the algorithm:
Input: a set of \$M\$ strings \$S=\{s_i\}\$ of length \$N\$ with alphabet \$\Sigma\$
Make an index of each string by chars.
Maintain a position \$p=(p_i)\$ where \$p_i\$ is an index into string \$s_i\$.
Set the initial position such that \$\forall i: p_i = |s_i|+1\$
(1-based indexing).
While char... |
First time writing a generic method here. Input a List<T> and an int value and output a List<List<T>> with each member List<T> of the provided int input.
No doubt there are easier / less verbose ways of handling this via LINQ but I wanted to try my hand with a generic method. Please let me know of any ways that I cou... |
So I wrote this script and although it does work I can't help but think that it can be more efficient with all the repetitive code. Can anyone offer any suggestions on making it fewer lines and eliminating the repeat lines?
$Domains = (Get-ADForest).domains | %{Get-ADDomain $_ | Select DistinguishedName,ReplicaDirector... |
In a plugin that I am currently authoring, I am using a function to check whether the device provides gyroscopic data. Although intuitively this can be easily resolved by checking the value of window.DeviceOrientationEvent, i.e.:
if (window.DeviceOrientationEvent) {
// Ok, device orientation event listening is supp... |
In order to learn C++11, I propose to myself implement a simple single linked list using smart pointers. The idea was to cover the basic operations without leave any memory leak.
I came up with a solution but I'm sure that it could be improved in many ways. So, I would like to receive feedback of any kind: format, read... |
From this blog post:
Write a function that given a list of non negative integers, arranges them such that they form the largest possible number. For example, given [50, 2, 1, 9], the largest formed number is 95021.
I did this in with two tests and using a TDD style.
I am pretty unfamiliar with Java, so looking for ov... |
I am trying to implement so me 'retry' logic in a Data Access layer where the DB occassionaly times out (and the method is called several thousand times a day). This is the best I can come up with, but I don't like throwing the exception if the code falls out of my while loop; it doesn't feel like a succinct solution. ... |
Unity3D has a class for platform-independent data storage called PlayerPrefs. Supported data types: int, float and string can be retrieved and set using static methods, but no bool support exists, and you have to manually call Save() to make sure value changes persist.
I wrote a little helper class to cut down on the t... |
I've never serialized a structure to a file before in C++, so I'm looking for critique on my first try at it.
My main concerns are:
It uses the streams space-delimited behavior. If a vector<char> that contains a space is serialized, it skips the space, which results in an exception. From my tests, it works fine for no... |
I've been doing a lot of form submission using Ajax now and being used to it than having a normal submission. What's been troubling me is that I always ran with a double submission issue when the user clicks twice the submit button to make sure hey hit it.
One way I handle it is by using a flag:
ajaxIsLoading = false; ... |
After a somewhat lengthily discussion in the chat room, I have set up an IoC container with Unity to store my settings in.
This is my static IoC class:
public static class IoCContainer
{
public static IUnityContainer Container = new UnityContainer();
}
In App.xaml.cs:
IoCContainer.Container.RegisterType<Applicatio... |
I'm working on writing a Java class library which includes the following implementation of a counting bloom filter:
package sj224.lib.util;
import java.util.function.Predicate;
import java.util.Random;
public class BloomFilter<V> implements Predicate<V>{
private final int size;
private int count;
private ... |
I wrote a function for repeating a string to a certain length.
For example:
ExpandString("Test", 11);
// output: "TestTestTes"
Are there any optimizations or fixes that can be done to this function?
private string ExpandString(string str, int length)
{
if (length <= str.Length) return str.Substring(0, length);... |
I created a project for a programming class that asks you to make a userform in Visual Studio that calculates mileage, given the user inputs of gallons of gas consumed and distance traveled. The code does its job fine, but I can't help but feel that my use of Do...While and Try...Catch statements are less than elegant.... |
This is my first take on fork, exec and waitpid. I didn't quite understand why I had to use a while loop with waitpid. I discovered that waitpid sets errno to EINTR which is translated to this:
#define EINTR 4 /* Interrupted system call */
And I saw a suggestion in comp.unix.programmer archives to use a while ... |
I have a table I want to get a sum of information on, but the value I need to query on is in two different tables.
The one with values I need to sum is say, kudos, which has a value indicating +1 (1) or -1 (2) in the Action column, which is associated to the discussion it's on, or the comment it's on:
Kudos
+--------... |
I am writing custom voxel engine in Java with JME3, but it is very slow, for simplicity I am rendering cubes instead of faces, also border detection messes up output mesh (doesn't draw cubes on chunk edges).
I would be very thankful if someone with more skill looked into it.
I have included all the code so you won't mi... |
To find the row with max zero Matrix will have either 0 or 1 in sorted manner.
public static void main(String[] args) {
// TODO Auto-generated method stub
int[][] inp=new int[][]{
{0,0,0,1,1},
{0,1,1,1,1},
{0,0,1,1,1},
... |
I have the following tables structures:
CREATE TABLE IF NOT EXISTS `options` (
`option_id` tinyint(4) unsigned NOT NULL,
`poll_id` mediumint(8) unsigned NOT NULL,
`option` tinytext NOT NULL,
UNIQUE KEY `option_id_poll_id` (`option_id`,`poll_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Storing poll options... |
Here is the source of the question. They don't require a tree to be a BST, but my tree is. The algorithm would be the same for a simple binary tree.
And there are two implementations:
A recursive one
A BFS-based one
They also ask which implementation is better. I think the BFS-based one is because in case of an unbal... |
I built a bot with Python to scrape scores on flashscore.com but the data scraped from the site loads into its listbox very slowly. I am curious about the speed of selenium so I made a button that prints all the text and it turns out the speed was fast so it must be the if elif block that is slowing down the program.
f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.