instruction stringlengths 71 71.9k |
|---|
I know using a UnitOfWork/Repository pattern in a normal class should work fine without any issues but how about using them in a static class/methods (I mean using a private static IUnitOfWork instance, refer CustomerService class). Will this work fine in multiple user scenario without overlapping with other request (I... |
In JavaFX, the lifecycle of an Application is quite different than Swing. Your constructor must take no arguments so that the Application class can create an instance of your object. Once the instance has been created, it calls start(Stage), which gives you a Stage for you to put your user interface on. This may be fin... |
I'm looking for a way to make my code more simple. This code takes a list of vectors and returns all subset of that list that sum up to another vector.
For example:
{'a','b','c'} is the subset consisting of: a (1100000), b (0110000), and c (0011000).
def AddVectors(A, B):
if not A:
return B
if not B:... |
I am using the jsmn JSON parser (source code) to get extract data from a JSON string. jsmn stores the data in tokens that just point to the token boundaries in the JSON string instead of copying the data. For example, jsmn will create tokens like:
Object [0..31]
String [3..7], String [12..16], String [20..23]
Number ... |
The reason I asked about standing the test of time is that I previously used PHP echo to create a string and placed it into a div with .innerHTML, but modern browsers were not passing the value of the select box. (Went back and tested wit IE9 and the innerHTML version worked.)
file:js_selecttest.php
<form method="post"... |
Based on the post I made here: RFC on "Factory" code and its responses, and my (inner) response to those responses, I'm beginning to wonder if it would be just as well to simply switch based on the user's hardware, and forget about this "fancy pants" factory stuff. After all, new code will have to be added for each new... |
This is the code I wrote to find out the time spent by product in process represented by clockin and clock out. Time stamps X and Y (for example, 7/23/2013 7:00 AM and 7/23/2013 8:00 AM) reflect the time period where in I am calculating the time.
X, Y, CLOCK_IN and CLOCK_OUT are all timestamps.
I wrote this code, but I... |
I'm just looking for feedback on correctness of my understanding of async/await. I'm curious about the Task.Run inside of the StartReceive() method. Resharper (or maybe just the compiler) warns against doing this without an await, but I think in this case, it's ok.
After running, one can connect by telnetting to local... |
Ramer-Douglas-Peucker is a great algorithm for reducing the number of samples in a given trace, and also for keeping its general shape (as much as he can).
I have a trace with 32.000.000 samples, and I want to compute a reduced version in order to be able to plot it into my winform application.
The first time I used th... |
I am trying to mimic std::stack in my implementation (just the basic interface - no iterators / allocators). Since I was having trouble handling all the memory allocation/deallocation, I read this.
Although my implementation seems to work flawlessly, I'm still not confident about these things:
There is no memory-le... |
This is my first time messing with PHP and I tried to put together a simple address book that when the user fills out the form it would update a database table, then display the row data on the page after submission.
It works fine, but I just want to make sure I'm headed in the right direction.
index.php:
<?php
if ($_... |
I'm doing a BattleShip game in javascript with iio engine.
I'm trying to play against a computer so I have to put a random position for the ships (I hope you know the game :) ).
I have 5 ships that have to be placed in a grid (10x10). The problem is that the function is pretty slow, and sometimes the page don't get loa... |
I have sample database in GES files and I wrote importer in Ruby.
Sample file: WAR_APO.GES: https://gist.github.com/regedarek/cd0ce73c5d1e14ff9818
I will have several of GES files which I want to move to my data folder in app and I want to process them manually.
For most of them logic is the same but the difference ar... |
As a beginner Python programmer, I wrote a simple program that counts how many times each letter appears in a text file. It works fine, but I'd like to know if it's possible to improve it.
def count_letters(filename, case_sensitive=False):
alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
with ... |
I'm working on a project where I need to map XML values to field names. Classic CS problem, I think I've got a pretty good approach but would like feedback.
For example: breachReportType matches to Breach Report Type:. However, there are similar matches like: breachType or breachReportCause.
The inputs are like ...
Xm... |
I wrote this form object to handle an e-commerce order form. My areas of concern are the verbosity of the populate method, and the repetition of the validations. I omitted some address fields and validations for brevity.
class OrderForm
include ActiveModel::Model
def persisted?
false
end
attr_accessor :pa... |
I have two buttons on an ASP.NET page that have separate OnClick methods in the code behind. In one of the methods, if a certain condition is met, the entire process of the other method should be executed.
Here is a simplified example of my code, which works as I intend in my actual implementation:
// OnClick="ThisButt... |
In my web development company, we have many designers who have the following development knowledge:
Client-side web languages (HTML, CSS, JavaScript)
Basic database design (how to create tables, relationships, etc), and
Basic SQL
So we thought about giving them a simple platform to create data-oriented web apps.
Wha... |
Here is my link to the JSFiddle and the full screen description.
Note on the full mode screen: the footer is not sticking, but it actually sticks if I check on my browser.
So that is exactly what I want for my layout. I want someone to see if there's anything in my CSS I don't need, or if I am using improperly without ... |
I have been working on a Bencoded string parser in order to improve my knowledge
of Haskell. After running the code through hlint, I still have a few questions:
As I noted in the comments, the key value in the definition of BMapT should
always be a Bstr. Is there any way to enforce a particular data constructor when
p... |
I have a web layout that I created and then later wanted to add a dropdown menu to it. I found that my html was not quite optimum for that, so I wrote some jQuery that is now working quite nicely but I need this to be critiqued to see if and where I could have changed some things here.
My dropdown menu is the class "dr... |
Code is below. I'd like to know if this is a solid/efficient implementation of the in-place quicksort algorithm and if my Python style is good (I know there are no comments for now). Code is also on Github here if you'd like: https://github.com/michaelrbock/data-structs-and-algos/blob/master/Sorts/quicksort.py Thanks!
... |
I have started to learn Java and I need your critique for my first program. It is an interpreter that can calculate any expression including abs(), sqrt(), min(), max(), round() and pow().
What can you say about this? Are there any code defects or pointless comments?
Main class
import java.io.*;
public class Main {
... |
I'm making this web application that needs some very simple JavaScript/HTML5 related features integrated (hereby an upload feature). However, I'm not sure about whether I've overdone it, as it's the first time I'm writing JavaScript without just throwing it all into the same file, with no namespace.
For example, I'm no... |
I would really appreciate a review of my interpretation of MVC here.
It's as bare bones and clear as possible. I've based it on some in-depth reading but I don't know if I have understood everything correctly!
For example, how have I wired the model onChange to the controller?
Where/when should the view be initial... |
I am creating a dynamic menu whose items appear depending on a set 'mode' (that is passed via AJAX). Off this it creates the menu, disabling and hiding icons that are not associated with that mode.
The problem is, there are a lot of if conditions in my implementation. Can anyone show me a cleaner way of doing what I am... |
After reading about MVC pattern in Head First Design Patterns, I've decided to write a TicTacToe app.
I will not reveal the source code of the classes Matrix, Dimension, and Size because they do not relate to the topic. All source code can be found here.
Please criticize my code, along with its MVC pattern usage.
TicTa... |
Initial note: You do not need to have knowledge of LWJGL or OpenGL to review this code. The only parts of the code that require LWJGL knowledge are the Game class, and the rest, although it may contain some LWJGL/OpenGL/Slick-util code, it is rather self explanatory for anybody who's worked in Java before.
So I've buil... |
I'm trying to write a simple GTK GUI for the command line program auCDtect. It is supposed to take .flac files, convert them to .wav temporarily, pass the to the auCDtect command line program to check they are lossless and then delete the temporary .wav file and output the results.
For around 10+ files it's rather slow... |
I have written code to print a range of numbers using multi-threaded programming. It takes in the number of threads to spawn as input.
It is working fine and giving the expected results. I just wanted you to check it and see if the code can be written a bit more efficiently.
#include<stdio.h>
#include <windows.h>
... |
Is this the best way of doing this? I wanted to make sure the grammar is correct when the array is output.
1 car, 2 cars.
The output is correct but is there an easier way generally? I just want to make sure I am doing this in a proper way. I don't have the benefit of the experience of the majority of you guys so I am a... |
I just wrote some PHP to let a client lock off a their one-page site from the public using a password. No users and no database. Just checking the password the user enters and testing it against the chosen phrase. This should be simple (right?) but I havn't built this sort of thing before. Let me know what you think, a... |
I was attempting to build a program using Ruby that asks the user to input at least three numbers, and it returns the mean, median, and mode of those numbers.
A developer friend of mine glanced over it and said that the program was wrong, but didn't state specifically what was wrong with it. I have looked over it and t... |
I've written this code to get input from a file and count the repetition of number of that file and give output to another file. How can I make this code better?
#include <iostream>
#include <cmath>
#include <fstream>
using namespace std;
int main()
{
ofstream outputFile("outPutData.txt");
ifstream theFile ("... |
I'm just looking for some feedback on my implementation of a maxheap mostly relating to style. I'm trying to create good habits as I learn to program.
Note: for the sort method I was given the precondition that the passed in array never has empty/null elements and that it must be sorted in place.
public class Heap12<E ... |
I was making an algorithm for a task I found in a book. It says that there is sorted array, that was swapped so it looks like "4567123", and was proposed to use binary search modification.
Below is my solution in java.
The thing is, I'm a bit cringed that I can't process cases for array size of 2, 3 generically (for ca... |
I am looking for feedback on a solution to the following problem posed from a book that I'm working through (Java: How To Program 9th Edition):
Write an application that reads a line of text and prints a table indicating the number of occurrences of each different word in the text. The application should include the w... |
I am working on creating a Makefile for my ProjectEuler solutions. I need to compile each solution into a separate binary for personal timing purposes. Is it possible to pass the name of the rule to the -o option to remove some repeated code?
CXX = g++
CXXFLAGS = -std=c++0x
INC = -Iinclude/ -I../tools/
binaries=01sum3... |
I am learning PowerShell, and created the following script cmdlet.
It reads one or more specified script files, to discover special functions (UnitTests, or functions with the Verb 'UnitTest' or 'DataTest'.
I designed the parameters to work like Get-Content, as it reads content from files.
I would like general feedbac... |
I typed this up quickly as an intuitive solution for determining if a given number is a perfect square.
How could I improve this? I already know that it doesn't handle the case where the number is 1. I'm wondering if I could generalize the calculation so it rounds up. What can I look into to develop a mindset for tackl... |
Function: Trim
Returns a new string after removing any white-space characters from
the beginning and end of the argument.
string trim(string word) {
if(startsWith(word, " ")) return removeSpaces(word, "Front");
if(endsWith(word, " ")) return removeSpaces(word , "Back");
return word;
}
string removeSpa... |
Considering the code that you can find at the bottom of this post, it's safe to say that this is a good example of how I can use different representations in different basefields correctly in C++ ?
I'm referring to the use of:
std::hex in the std::istringstream case
the use of std::cout.setf() and std::cout.unsetf() i... |
Can my rand_int function be improved?
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int rand_int(int a,int b)
{
//The basic function here is like (rand() % range)+ Lower_bound
srand(time(0));
if (a > b)
return((rand() % (a-b+1)) + b);
else if (b > a)
return((rand() % (b-a+1)) +... |
I'm looking for an lib which can search an array of strings with multible search-strings (array). I want to get an int-array of all indexes/matches.
private int[] getIndexArray(String[] pArray, String[] pSearchStrings) {
int[] indexes = new int[0];
for (String str : pArray) {
if (ArrayUtils.contains(pSe... |
This script takes the list of provided URLs and scrapes the present links in each URL. For each scraped link, Facebook share, tweet, Google Plus is found out.
For example, if the provided URL is www.example.com, the URL is scraped and, let us say, 2 links are found:
www.example.com/1.php
www.example.com/2.php
Then ... |
I have a method that checks whether an addressCriteria contains only certain fields or more. If it contains more fields, it should return false, otherwise true.
I'm uncertain what the best way to write my if statement is. As far as I can tell, I see 2 options:
Write them in 1 if statement
Write each check in a differ... |
I am currently writing a game in C++ and have some variables that I want to be accessible from everywhere. For the examples, I will have the shared variable as an object of the class Input.
At the moment I am implementing it like this:
input.h:
#ifndef INPUT_H
#define INPUT_H
extern Input input;
#endif
init.cpp:
Input... |
I have a method that calls a "bridge" for TraderMarketInfo. When info is received, it checks if info IsSet and raises an event. I want to make this method async. C# .NET4.0 VS2012.
Original method:
public void RequestMarketInfo()
{
TraderMarketInfo marketInfo = bridge.GetMarketInfoAll(Data.Symbol);
if (marketIn... |
When creating multiple constructors, I usually do the following;
public ConstructorName(int count)
{
this(count, 0);
}
public ConstructorName(String count)
{
this(Integer.parseInt(count), 0);
}
public ConstructorName(int count, int other)
{
// Do something here
}
However, I can also do it this way;
publi... |
In a simple webapp I have been using as a playground, I am playing with using rxjava to perform a number of operations in a reactive manner. I have been using reactivemongo to connect to my Mongo database, but I find that for anything more than a trivial CRUD operation I often end up trying to reduce a Future[List[Fut... |
I'm using Twitter Bootstrap and I'm working on a page that has several tabs that all have carousels in them (each with a ton of images) I've managed to write an AJAX script that pulls the images from a JSON file I've created (for one of the carousels). I'm planning on making similar JSON file for the rest, but what I'm... |
I have a rather simple task in trying to extract keywords from input.dat which looks like:
func1
{
yes true;
keyword123 (1.1 0 -0.3);
gamma (0 1 0);
dir (1 0 0);
func2
{
yes false;
keyword123 (1.1 0 -0.3);
gamma (0 0 1);
... |
I'm doing this in Hadoop Java where I'm reading a String. The string is huge that has been tokenized and put in an array. It has key-value pairs but they are not in any order. I want this order to be rigid so I can load that as a table. So in SQL, if I select a column (after loading this in a table), all the keys of on... |
I'd like to get some feedback on whether this is idiomatic elisp, whether it's any good, and any small modifications that would be useful. Thanks
(defun jump-to-register-other-window (register-name)
"Open a register in the other window if file"
;; Should also display register contents if register is text
;; jump... |
I wanted to write the best implementation I could think of the following really, super simple and stupid OOP model in php.
class Number {
private $number = false;
function __construct($n) {
if(is_int($n)) {
$this->number = $n;
}
}
public function get() {
return $th... |
I am practising recursion and have written the small code for summing a+b as below:
#include <stdio.h>
int b=6;
static int cnt;
void main(void)
{
int a=9,sum;
sum=succ(a);
printf("Sum returned : %d\n",sum);
}
int succ(x)
{
cnt++;
return(cnt<=b ? succ(x+1) : x++);
}
I am getting the results fi... |
I had made some pages and they work but I'm not sure if I coded it in best way so I want your suggestions and ideas to make my code better.
connection.php
<?php
$mysql_host = 'localhost';
$mysql_user = 'root';
$mysql_pass = 'root';
$mysql_data = 'project_eye';
$connect = mys... |
I have the following condition statement in Groovy:
if ( condition_1 ) {
//some actions
} else if ( condition_2 ) {
//some another actions
} else {
assert false, 'Assertion description'
}
Code Narc gives me a warning about using boolean false constant in the assertion. I'm not sure if it is real issue, so ... |
I am trying to download files using jsp but then downloaded files are not readable.
Suppose if i download pdf files then it can not opened,if i download jpg files then it can not opened and similarily for the video files too.
Please point out the mistakes where i have made
<%@ page import = "java.sql.*"%>
<%@ page ... |
I want to use the enum on the client for a dropdown list. Does this make sense, or is there a smarter way of doing this?
public class clientEnum
{
public string Value { get;set;}
public int Key { get; set; }
}
public static List<clientEnum> EnumToclientEnum <T>(T enumType) where T : Type
{
List<clientEnu... |
This question has become long after many updates. Click here to go down.
I have implemented stack using arrays in C. Please give me suggestions on how to improve it. The purpose of writing it is practice-only.
I'll be implementing it by using pointers soon so please leave the part about using pointers instead of array... |
Could you tell me how to make it quality code?
<?php
class Game {
public function __construct() {
session_start();
}
public function play(){
return '<input type="button" value="Play" onclick="window.location = \'?play=1\'">';
}
public function start($msg=null) {
unset($_SESSI... |
A little background
I'm an intern at a large engineering company, and I'm also the only CS major in the entire building. The people on my team don't have technical backgrounds, but hired me to start developing an internal application.
About my program
I'm trying to read two part numbers as input, search through a CSV ... |
We are working to translate our site into different languages. Currently, we pull 80% of a page from a database that is already translated. We drop in a language id and output the appropriate content.
What I need to store and access are the bits and pieces of text that need to appear on every page, but won't be stored... |
I created this small function just to practice C code. It's a simple random string generator.
#include <string.h>
#include <time.h>
char *randstring(int length) {
static int mySeed = 25011984;
char *string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,.-#'?!";
size_t stringLen = st... |
I have two solutions (in Jython) to take two pictures and copy and paste alternate sections of one picture to the other, like so:
for x in range (0,w):
for y in range (0,h):
sourcePx=getPixel(pic1,x,y)
targetPx=getPixel(pic2,x,y)
if (y>=0 and y<20) or (y>=40 and y<60)or (y>=80 and y<=100):
setColor... |
Here is my code for removing duplicated values from an array. I think I tested it with the most possible cases. Any suggestions or bugs?
class duplicate {
public static int[] removeDuplicates(int[] arr) {
int end = arr.length;
for (int i = 0; i < end; i++) {
for (int j = i + 1; j < e... |
After I had my code for stack implementation by array reviewed I wrote stack implementation by using pointers. Here's my code. Any suggestions for improvement are welcome.
I'll be adding updated code so please review the latest one. Obviously you are free to ignore this also. To skip reading this long question you can... |
The following code makes jQuery trigger a new target event on elements when they become the target of the fragment identifier.
For a very basic example, the following target event handler:
$('.question-page .answer').on('target', function highlight(){
$(this).stop().css({'background':'orange'}).animate({'background... |
I have a question about the best way to design / redesign my software. I have a program that uses a web services to perform certain tasks. Each task is a different set of request / response classes on the server end and a general function call from the Main Hook.
RequestObject req = new RequestObject("SomeVal");
Respon... |
I wrote this Jqeury to make it work with asp.net update panel. I know i do little bit of hacking to make it work just. I want to get some help in how to optimize and remove the hacks from my script.
<script type="text/javascript">
//get all elemnt with class .resource-download
$.each($(".resource-download"), f... |
To get more familiar with Java, I decided to make a Tetris clone.
As I finished the Tiles beans class, I went to the Tetromino class, which is basically made of different sets of 4 Tiles objects (I'm grouping them with ArrayLists). Each Tetromino has a different colour and shape.
Would it be better practice to identify... |
Given a table, I want to explore all possible transition between the elements in the table.
ex: for a table with size 3 [0,1,2], the output of the algorithm should be 0->1, 1->0, 0->2, 2->1, 1->2, 2->0.
I guess this can be regarded as traversing a complete graph.
I have an implementation of an algorithm doing this in ... |
I had posted a question some time back for the best way of doing an account hierarchy, and this is the way implemented at last.
Can someone point out any obvious flaw in this (other than SOQL)?
The use case is to find the first account which has IS VGE flag checked, or if no IS VGE ones in hierarchy get the topmost one... |
For a university project I'm trying to build a system that has a general architecture of:
Client app <=====> Client library < - - > Server library <=====> Server app
I'm trying to make the client and server as general (in the context of a java application, cross-platform compatibility is a concern for later) as possibl... |
I am new to JavaScript. I know that many inheritance and initialization methods have been written and use some advance features like Object.create:
Simple JavaScript Inheritance
Why Prototypal Inheritance Matters
For practice, I wrote my own methods for inheritance and initialization. I have no idea if my code is goo... |
I have written this big function to do some formatting in my python code. Would you be able to suggest anyways to make this smaller ?
def disfun(String1,String2,String3):
if String3 == "A" or String3 == "B":
if String3 == "A":
pass
elif String3 == "B":
pr... |
I'm trying to improve my functional skills and seeing where it fits and where it might not. Please review the code and see where functional practices might be applied. I'm specifically looking at trying to get rid of the state variables.
private int GetFirstLineFrameCount(XDocument doc)
{
var subElement = (from res... |
I'm cloning a fairly complex div/ page and changing various things in it before appending it to the DOM. The current method seems long-winded, and I was hoping if there was a simpler way of doing it?
$.each(results.jobs, function(i, result){
var theID = result.id,
theTitle = result.title,
theDescription = result.desc... |
I'm trying to clean some incoming $_GET parameters. I've not done this before, so I'd love feedback.
I'm especially concerned with the array. While all the other parameters control simple logic, the array will be saved into the database and potentially output to users.
Please also feel free to point out any redundanc... |
Are there any ways I could improve speed and less code? The elevator that uses this script works fine. Could anything be better?
print(" Teknikk xPower 9700 PRE DEV V1 Intialised")
-- Develoment sample, May have functions added or removed. --
local Floor = script.Parent.Floor
local Floors = script.Parent.Floors
local... |
I have been working to create an easy-to-use set of methods to encrypt configuration objects for my client application. It will contain username and passwords to databases and similar vaults of data, so it's rather important that I've got the fundamentals correct.
I'm fairly new to this form of encryption, and I certai... |
I've been working with jQuery, mostly consuming plugins and using bits and pieces here and there for other functionality. Anyways, I wrote some standalone functionality in jQuery for a project and decided to convert it to a plugin as an exercise for myself. Note, it's not a full blown plugin, I don't inject markup or C... |
I am writing a unit test for a Dispatcher that will route a HTTP request to a specific Controller and invoke a specific method on that Controller. It will also trigger various events at different steps of the process. The majority of what is going on is carried out by dependencies injected at construction time; the Dis... |
I am currently writing my first actual C++ project. I like Chess and I would like to see how good I'm doing on a monthly basis, so the idea is to read the log files (.pgn files) from the games and tell me how many games I won and such.
My question specially relates to Games.cpp where I'm not sure I have done the right ... |
I'm not sure what I'm doing wrong, but I run the code using a Web Vulnerability software and I get a lot of XSS attacks against the code. Is there something I could do better?
// connect to database
include("dbconnect.php");
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$email = $_POST['email... |
I am fairly new to coding TSQL script and am looking for some second view on my script.
The goal here is to to pull in some data and amongst that data to show a field with a counting the number of working days since the order date only (i.e. minus weekend days and UK bank holidays). The SELECT script below is working a... |
I am using if statements within my functions to validate form fields and then on the isset event.
I want to be able to create many different functions to validate various fields groups, and it seems that this statement could grow very long:
if (($namecheck === TRUE) && ($emailcheck ===TRUE) && ($messagecheck ===TRUE)) ... |
I've written the following extension to determine the MIME type of a base64 string. It's worked in my local tests, but can anyone point out issues or alternate methods?
public static AttachmentType GetMimeType(this string value)
{
if(String.IsNullOrEmpty(value))
return new AttachmentType
{
... |
Following is the code to update content via ajax. Please review all aspects of the code.
var ajaxUpdate = {
init: function(){
ajaxUpdate.enableHistory();
},
_this:null,
enableHistory: function(){
History.Adapter.bind(window,'statechange',function() { // Note: We are using statechange ins... |
Here is the script:
function opening(){
setTimeout(function () {
var opening = $('#stage');
opening.find('h1').fadeIn('slow', function(){
setTimeout(function () {
opening.find('.logo').fadeIn('slow', function(){
setTimeout(function () {
... |
I am writing my first programs in Python and want to be sure my code is good and not too C++-like. Consider the problem of finding all common 'associations' for set of 'keys'.
Data format is
first line: integer N
N lines: key: association 1 ... association P_1
N+2th line: integer K
K lines: key 1 ... key T_1
For each... |
I really like functional programming in C#, it gives you a lot of flexibility.
I am wondering if it is the right idea to use functions instead of helper methods, and to make the code more readable.
So here is what I want, I have a method that needs to find Saturday and do something with it:
public void SomeMethod()
{
... |
The script currently loops through an output line-by-line, picking out elements of interest and adds them to a hash data structure. If a key already exists (in this case the interface name), it appends data to it.
I can work with a data structure, but I am never happy with the approach I take of looping through the dat... |
I've just written an implementation of Conway's Game of Life as an exercise and I'd love to get some feedback on how I can improve this program and hopefully my style in general.
I've tested the code in Python 2.7.3. It requires the PyPNG module to render the state of the simulation.
"""Simulate Conway's Game of Life.
... |
Ok, this might be a very stupid question/idea (I'm still a beginner). Lets say I have a construct like this:
g.setColor(new Color(random.nextInt(5) * speed, 255, speed * 3));
Now it is very likely that the passed arguments will in some cases be out of the expected range, so the code will throw an exception. To circumv... |
I have a script I use to prune packages that have gone stale from my custom Debian repository (i.e. they no longer exists on any of the official repositories):
import apt_pkg
import gzip
import subprocess
CUSTOM_REPO = ("/home/tshepang/.custom_repo/dists/tshepang/main/"
"binary-amd64/Packages.gz")
TEMP... |
I have come up with an idea for adding privacy support in JavaScript. I haven't found something similar in the net, so I'm thinking it's probably because the idea is bad, but yet, I want to see some response, just to be sure.
var util = {
s4: function() {
return Math.floor((1 + Math.random()) * 0x10000)
... |
I've followed this blog to get images with nice pretty rounded corners in Android.
I've managed to strip out a lot of the superfluous arrayAdapter stuff and make it much more simple.
I've largely tweaked this just until I made it work. Does anyone have any feedback?
class StreamDrawable extends Drawable {
private... |
require([
'jquery',
'underscore',
'backbone'
], function ($, _, Backbone) {
'use strict';
// TODO: Would like to access through define module, but not sure how..
var player = chrome.extension.getBackgroundPage().YouTubePlayer;
var user = chrome.extension.getBackgroundPage().User;
// ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.