instruction stringlengths 71 71.9k |
|---|
I have the following code:
static void TimerElapsed(object sender, ElapsedEventArgs e)
{
foreach (BIGService bigService in runningServices)
{
if (!bigService.ExecutedToday)
{
int executionResult = bigService.Execute();
string serviceName = bigService.ToString();
... |
I have client's methods that processes a large SQL query. I wouldn't like to do that through getting whole query result to memory, but process it in batches. It entails with exposing JDBC API to client's code. I think that this code could be refactored much better.
//client's method
m_jdbcManager = JdbcManager... |
I have written a singleton module which is to be used for some future modifications on .chart elements. Modification functions, such as colorArgumentButtons() are called recursively so that I don't have to iterate over all .chart elements in all functions.
Is my use of _ for private "class vars" proper? Otherwise they ... |
In a payment application a day before and at the same time with some payments some messages(email) needs to be sent.
I have a DTO (called EscrowPayment, projected from some entity) from which I generate and send two similar `messages.
I look for advice specifically on the following issues with the code I ended up:
Cop... |
PHP's eval() is general considered insecure with any user input.
However, with filtering of input (i.e. [-+/*0-9]) you can make eval() secure for a small subset of PHP; mathematical expressions.
I've tried to think of a way to extend that by allowing a limited set of math functions and I believe I've found a secure way... |
I have the following contact form, using PHP, JS and a bit of Ajax. I want to make sure that it is secure.
<?php
session_start();
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
ob_start();
if(isset($_POST['name']) && isset($_POST['email']) && isset($_POST['message']) && isset($_POST['token']))
{
... |
I've started writing a small CSV parser class as I needed a method to group a CSV file by a given column.
class CSVParser {
private $FileName;
private $FileHandle;
private $HasHeaderRow = false;
private $RowsToIgnore = array();
public function __construct ($FileName, $Mode = "r") {
$this... |
I began the journey to be a self-taught programmer about a month ago and my biggest fear about teaching myself is developing bad habits and not realizing it.
I'm looking for criticism on this "Guess a Number" game. It's my first real "project" that I've invested serious time into so I feel like this is my first opportu... |
I am setting different RadioGroup like this:
fragment.setT1RadioGroup((RadioGroup)fragView.findViewById(rowids[0]).findViewById(R.id.t1_radiogroup));
fragment.setT2RadioGroup((RadioGroup)fragView.findViewById(rowids[1]).findViewById(R.id.t1_radiogroup));
fragment.setT3RadioGroup((RadioGroup)fragView.findViewById(rowids... |
I've implemented just as Ryan Bates suggested in his railscast episode, I've got everything working just right, so here is his approach in the controller :
def new
session[:order_params] ||= {}
@order = Order.new(session[:order_params])
@order.current_step = session[:order_step]
end
def create
sess... |
I would prefer if more experienced users could give pointers on how I can optimize and think better when writing code.
If you are unfamiliar with unity3d, ignore the use of UnityEngine, the heritage from MonoBehaviour as well as the Debug.Log();, Debug.LogWarning();, and Debug.LogError();.
using UnityEngine;
public cl... |
I've been working on an html5 canvas video player with a lot of fun little extras and ui toys, the main one being a chroma key (green screen) effect that allows the user to key out different colors or ranges of color while the video is playing.
I seem to have hit a snag in the recommended chroma key method. It works, ... |
I came across an issue the other day where I really just could not think of a functional solution. So I fell back on my imperative programming skills. Since a functional solution still eludes me, I figured I'd shout out for some help here.
Use Case
I have a List of Strings with arbitrary lengths. These Strings need to ... |
Just looking for some feedback on a hangman script. It works perfectly fine; I'm just trying to master the Python language, and the best place way to get better is to ask the true masters!
import random
UNKNOWN_CHARACTER = "*"
GUESS_LIMIT = 7
words = []
def load_words():
global words
with open("dictionary.t... |
I make some ui custom controls. Typically my controls have themes to them so it can be changed. I dont use css files for each themes. What I do instead is hava a javascript file that contains the different themes for that particular control. Example of my button control (Note i took the rest of the css off the other... |
I would like to get some feedback on my code. I am starting to program after doing a few online Python courses.
Would you be able to help me by following my track of thinking and then pinpointing where I could be more efficient? (I have seen other answers but they seem to be more complicated than they need to be, albei... |
I need a little help with improving my first Java program. I have programmed for about a month, so my code is quite messy. The program is a "Musiclist" program, with which you can add songs, edit songs, and remove songs from the list.
The program uses 2 ArrayLists, to store the information about the song (Song name, Ar... |
I found a function online that tests if a tree is a binary search tree:
private boolean isBST(Node node) {
if (node==null) return(true);
// do the subtrees contain values that do not
// agree with the node?
if (node.left!=null && maxValue(node.left) > node.data) return(false);
if (node.right!=null && min... |
This is a follow up review of question 'a custom Undo Manager'.
After reviewing all the comments and answers, my code has been revised (completely rewritten) based on the review.
Summary
The intent of the code is to provide a means to keep track of events in c#. Each Action has an undo and redo event (Command) and is ... |
I am working on a browser strategy game as a hobby and came up with a decision to use a tile-based map for the world map.
I have several questions so far:
I am using double-cache (file and apc) for performance issues. Isn't it too much? Or should I consider using Redis or anything similar?
What would be the best way ... |
So I've got this module called risar, which draws. But that's not really of importance. I wrote this code which sets 20 flowers on the background.
Now they need to move downwards by 5 units. The code works fine but it looks horribly awkward to me. I'd like it to look more "fancy" or maybe that less loops would be used ... |
I am trying to make a 3D application with OpenGL/LWJGL at the moment, but I am now already hitting some limits on the JVM, most likely due to a configuration that needs to be done.
I have the following code in the render loop:
@Override
protected void render(final double msDelta) {
glClearColor(0.0f, 0.25f, 0.0f, 1... |
I would prefer if more experienced users could give pointers on how I can optimize and think better when writing code.
If you are unfamiliar with Unity3d, ignore the use of UnityEngine, the heritage from MonoBehaviour as well as the Debug.Log(), Debug.LogWarning(), and Debug.LogError().
Inventory Script (RPG) in C#
Thi... |
I have a click event that calls a function (below, txtResize) which makes some CSS changes to html text. (Acts on Text of 3 unique elements).
Q: What is the best way to refactor this code to limit excessive if/else usage, AND restore the original state of ALL text elements once the user clicks away from this section?
H... |
Are there any improvements to these two classes which implement FNV-1a for hashing? Particularly, I'm looking for any reuse opportunities (possibly via a common abstract superclass derived from HashAlgorithm?).
GitHub
public sealed class Fnv1a32 : HashAlgorithm
{
private const uint FnvPrime = unchecked(16777619);
... |
Please note there are newer revisions of this code, one here, and one here for continuous audio recording.
This is a program I wrote as a .wav audio recording library for Linux. It was developed on a Raspberry Pi, so that may affect the dependencies required.(1)
wav.h
#include <stdint.h>
typedef struct
{
char RIF... |
I'm currently writing a script and I decided to run cane over it to look for some issues, and the following method was highlighted. I've done my best to cut it back, and at this point I'm inclined to leave it as-is, however cane is still giving it a pretty high rating of 23 (15 is the point it starts complaining) so I ... |
I am trying to emulate a basic CPU (Z80) as close as possible. It currently does not read real assembly code, but that will be implemented. If you have any views on how that could be implemented, I'd really appreciate it. Instead of reading real assembly code, I made up a simpler version with the knowledge I had at t... |
I saw this problem posted as an interview question asked at Bloomberg:
Given an integer N, print numbers from 1 to N in lexicographic order.
Restriction. One cannot use strings or characters.
Below is my solution to this problem. Can the algorithm be improved?
#!/usr/bin/env python
import sys
import traceback
def ... |
I recently got started with Elixir. I'm used to F#'s pipes, and Seq.map and LINQ's .Select statements. Things are different in Elixir, and the code I have seems very ugly. Anon functions in anon functions.
defrecord FileData, name: "", date: nil
def filedetails() do
files = File.ls!
datestr = fn {{year, mo... |
I need a review of the following code for finding all permutations of a string in C++:
List Permute(const String& string)
{
if (string.length == 0)
return EmptyStrings(1);
List prevList = Permute(SubString(string,1,string.length));
List nextList = EmptyStrings(string.length*prevList.length);
for... |
I request you to provide insightful suggestions to improve the following code as well as an alternative algorithm to solve it.
Problem Specification:
We'll say that a "mirror" section in an array is a group of contiguous elements such that somewhere in the array, the same group appears in reverse order. For example, t... |
To add line numbers to a file (via stdin to stdout) we can use cat -n or nl.
Given the file test.txt with:
hello
hello
bye
We can do:
$ cat -n < test.txt
1 hello
2 hello
3 bye
In languages like AWK, Perl, and Ruby, we often get built-in constructs to process files line-by-line, making this program... |
I came up with the following solution to find the number of prime numbers from 1 to n.
I'm wondering if there is a more optimal way.
var max = 10;
var compositeNumbers = {};
mainLoop:
for (var i=2; i<= max;i++)
{
smallLoop:
for (var j=2; j<=Math.ceil(Math.sqrt(i));j++)
{
if (i % j == 0)
{
... |
In the process of learning F#, I wrote this code that reads lines of input from the console and stores them in a list.
As far as I can tell the code works correctly, but since I'm new to functional programming, I'm not sure if it is written as well as it could have been.
Should I have read characters iteratively inste... |
I've been solving problems on checkio (and trying to digest other's code) in order to improve my Python.
My main goals are to learn to write more idiomatic Python and to explore the language more fully ("batteries included" is no joke!). I'd like critiques on the following (working) code in terms of pythonic-ness and ... |
This question is really to help me decide on something. I have started development of my own programming language that I am calling DeliciousWaffle (or maybe samscript).
So far it looks pretty cool. I built a compiler in Python, and associated .dw files with it. These files are like .py or .vbs or .java. They provi... |
I'm simple looking for what the general preference is between the below options:
anon function directly to variable
middleware.customer = function(req, res, next){
req.customer = function(){
var customer = false;
if(req.method == "POST") customer = req.body;
if(req.method == "GET") customer... |
I need your help to see if the following binary search code is correct. I did my best to cover the corner cases. I wonder if I missed anything.
The code as it is with tests (you can play with it online here):
function binarySearch<a, r>(
hay: a[],
needle: a,
compare:(one: a, another: a, oneGreaterThanAnoth... |
The comprehensive description of the problem can be found here. I'm looking for code review, clever optimizations, adherence to best practices. etc.
This code is also a correction of code previously posted here.
/**
* @author javadeveloper
*/
public final class MedianOfTwoSortedArrays {
private MedianOfTwoSorte... |
I'm writing a utility that validates fields. I decided to try my hand at Behaviour Driven Development (BDD). The validator utilises "rules" to determine if field is valid.
Three different types of rules exist:
RegexRule A field conforms to specific pattern(s)
RequireRule A value is present
EqualityRule A field's value... |
I created a rubber ball by extending instance of b2Body prototype of Box2D.js. I get the instance from factory method b2World#CreateBody.
var ball = world.CreateBody(bodyDef);
I extended the instance in the constructor of my RubberBall prototype. In result, I made the constructor very long.
function RubberBall(positi... |
Critiques (even pedantic ones) are welcome.
bool unique_chars(std::string &s) {
if (s.length()>256) return false;
std::bitset<256> bs;
for (auto &c:s) {
if (bs.test(c)) return false;
bs.set(c);
}
return true;
}
EDIT 1:
for (auto &c:s) { //OLD
for (unsigned char c:s) { //NEW
... |
In this program, I understood everything except power(x1,y1-1). I want to know how the power(x1,y1-1) function exactly works.
#include<iostream.h>
#include<conio.h>
int power(int,int);
void main()
{
int x,y,p;
clrscr();
cout<<"\n\n\t calculating power of a number using recursion";
cout<<"\n\n\t Enter... |
My program uses graphics convolution, an algorithm that processes pixels to make them round, soft and blurred. This particular algorithm is well-known, but its slowing down the operation of the whole program.
Can you suggest any improvements of this algorithm? I tried following from here, especially "ultimate solution"... |
I am working on a simple quiz-type game in which the user basically is asked a series of questions and needs to provide an answer.
I'm trying to find a solid/robust way of recording how long it takes for the user to answer each question. This is a web-based game so I am using JavaScript and PHP. I am very inexperienced... |
I wanted to see the site's top sponsors - users that have paid bounties on questions that they didn't own.
I started off with a bounty-related existing query, selected the details into a subquery, and then grouped by sponsor and ended up with this query, which no longer has anything in common with the query I started o... |
I'm trying to implement a left leaning red black tree as described here. This is their snippet for insert
private Node insert(Node h, Key key, Value value) {
if (h == null) return new Node(key, value);
if (isRed(h.left) && isRed(h.right)) colorFlip(h);
int cmp = key.compareTo(h.key);
if (cmp == 0) h.v... |
Please note that all credit for code goes to humanoid24 and I have only helped the bare minimum required to be able to post it here.
I am working with some friends to replicate a server for the game LEGO® Universe which was shut down two years ago. This code is included in the LUNIServer v3 here.
The server does what i... |
I am just starting to program in C#, so I am a beginner. I've been practicing some coding and I would like your opinion on something.
I have a flying direction for a plane, e.g. ''London - Berlin'' (direction). I want to create a method that will return the first and the last consonant of the plane's starting point (... |
I've found a peace of code I've wrote not long ago. It is used to fetch some dictinary from DB table only once and then return it to requestors. Seems like I tryed to implement double-checked locking here. Is it correct? If not, what are the mistakes?
package a.b.c.service.orders;
import java.util.List;
import java.ut... |
Looking for general feedback and praise. This is for learning an not implementation as I would expect the built is sort algos to be much faster.
Addressed issues here:
A package for sort algorithms
/***************************************************************************************************
**ALGORITHMS
... |
This is basically the registry pattern and a pub/sub event system.
Very simple and minimalist. Looking for general feedback.
/***************************************************************************************************
**COMMS
- provides registry and event system
- reduces dependencies
***********************... |
This Scala code snippet is supposed to encode a SHA1 hash in base 62.
Can you find any issues? I'm asking since I might not be able to change the algorithm and, for example, fix issues in the future.
I'd like to be able to also implement it in JavaScript in the future.
def mdSha1() = java.security.MessageDigest.getInst... |
I'm working on the following interview practice problem, and got the following solution, which runs in worst case n! time (best case constant), and I'm trying to optimize it.
Can you offer any suggestions to go about this? I think it should be able to be reduced down to quadratic, if not nlogn, but I'm not entirely sur... |
In my application, I have a small hierarchy of related classes (partner categories - partners - partner points).
The application has two representations of its content:
in the form of partners points on the map
in the form of a list of partner categories or partners within a category
The application has the filters f... |
Project Euler problem 26 asks us to:
Find the value of d < 1000 for which 1/d contains the longest recurring cycle in its decimal fraction part.
I wrote this function in Python to find the decimal representation of a rational number p/q. How can I improve it? Also suggest good coding styles.
#! /usr/bin/env python
# ... |
I wrote a simple class in Python, which controls code invocation, in a multi-threaded environment, with the following logic:
The class' main method, named try_to_do, takes two function pointers as arguments: yes_we_can_fn and no_we_cannot_fn.
In any point in time, only a single thread can invoke code the function passe... |
We all know about the indices trick, right? Here's (hopefully) an improved version...
template <::std::size_t...> struct indices { };
namespace detail
{
template<class A, class B> struct catenate_indices;
template <::std::size_t ...Is, ::std::size_t ...Js>
struct catenate_indices<indices<Is...>, indices<Js...> >
{
... |
I suspect that this can be done in a much neater way using list comprehension in python:
poses = []
for x,y in get_points(spline):
pose = Pose2D()
pose.theta = 0
pose.x=x
pose.y=y
poses.append(pose)
return poses
Is there a way to create a nice one liner for the above? (I do not have a constructor t... |
I need to write a function that, when given an input (string, float, or int), returns that input as a reduced partial fraction, and it needs to accept a wide array of inputs:
1.5 => "1 1/2"
5/2 => "2 1/2"
"1/3" => "1/3"
5 => "5"
"6 1/3" => "6 1/3"
0 => "0"
I've written this function using the Rational class, but was ... |
This is a Python program to mint a hashcash token, but my code is a lot slower than using a library. What is slowing my program down? It takes over 10 seconds to mint a 20-bit stamp, but using a library, it takes less than a second.
This is my program:
from os import urandom
from hashlib import sha1
import time
def ... |
Just a plain button, in different sizes. I wanted to achieve exactly the same styling cross browser for both anchors, inputs and buttons.
I'm just wondering if this could be improved.
Markup
<!DOCTYPE html>
<html>
<head>
<title>CSS button</title>
<link rel="stylesheet" href="css/main.css">
</hea... |
I've created this abstract base class for testing the Equals method.
The basic idea is that derived class implements methods to get:
the primary test instance, and
a list of unequal instances (it's up to
the derived class to ensure that this list is sufficient instances for testing
all possible inequalities)
The bas... |
I have implemented a calculation of Pi in Python, just for the lulz.
But now I wonder if I could improve this more. Could you help me out? I do not program a lot in Python.
from time import time
from decimal import *
def faculty(m):
k=m
n=1
while(n<m):
k=k*n
n+=1
if(k>0):
return... |
I need to split one NSArray into NSDictionary. Every key in NSDictionary will contain an NSArray with the object with the same value.
i.e. I have an array with 1000 customers and I want create an NSDictionary based on their zip code.
I wrote this code into an NSArray category and it works, but I'm looking for a better ... |
I used the following code:
#include<vector>
class UltrasonicRecorder
{
public:
UltrasonicRecorder(int referenceValue, Input referenceInput) :
_referenceValue(referenceValue),
_referenceInput(referenceInput)
{}
std::vector<int> GetData();
void RecordData(Input);
int CompensateTemper... |
I would like to replace the string "The quick brown fox jumps over the lazy dog" with the string "The1 quick2 brown3 fox4 jumps5 over6 the7 lazy8 dog9".
Is there an cleaner, more elegant, sexier way?
String.prototype.concatWordNumber = function() {
var myArray = this.split(' ');
var myString = "";
for (var i=... |
I am starting with a starting colour, a target colour and a starting position in an image. I want to change every contiguous pixel if it is close to the starting colour.
Imagine a stop sign. It has white letters on a red background. But the red is faded to a bunch of different reds. It should work that all of the red a... |
I made a simple program to catalog some old records I have. It seems a tad redundant in the searching function. Does anyone know what I can do about that?
import easygui as eg
import sys
namedoc = open(r"C:\Users\User\Desktop\RcrdCat\names.txt", 'a')
nd2 = open(r"C:\Users\User\Desktop\RcrdCat\names(2).txt", 'a')
auth... |
This is one of the longest programs I have made with methods and I think I must be doing this rather inefficiently. Any comments to improve would be appreciated.
package numberwords2;
import java.awt.Component;
import javax.swing.JOptionPane;
public class NumberWords2
{
static String rawInput;
static String out... |
Below is a Singleton that I designed as a piece of sample code for a website I'm working on for fun. The goal is to use the Singleton to hold an Earth object since Earth is unique and there is only 1 of them. Please let me know your thoughts on the implementation.
Singleton.java
package design.patterns;
/**
* This... |
This is a parsing function that will at tildes (~) to end of search terms in certain circumstances.
Example an inputs and outputs:
Input: Output:
name:(john doe) name:(john~ doe~)
name:[andy TO charlie] name:[andy TO charlie]
john doe john~ doe~
james NO... |
I would prefer if more experienced users could give pointers on how I can optimize and think better when writing code.
If you are unfamiliar with unity3d, ignore the use of UnityEngine, the heritage from MonoBehaviour as well as the Debug.Log();, Debug.LogWarning();, and Debug.LogError();
Awake is called directly after... |
I have started to learn C and I have tried my hand at temperature conversion. The idea is to convert a temperature from Fahrenheit to Celsius and vice/versa. Can somebody review my code and let me know how I might be able to improve it? My program is as follows:
#include <stdio.h>
void fahconv()
{
double fah;
... |
How could I simplify the onCreate() method? Maybe via compact and properly-named methods?
public class FilterActivity extends FragmentActivity {
private Bundle args;
private FilterFragment filterFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedIns... |
I have finished a program, and it does what I want it to do, but I feel I am "doing it wrong", even though it's seemingly efficient enough. I have prepared a small example of what I feel I am handling wrong with the backgroundworker class and would like to see if I could have handled this any more cleanly.
First, I hav... |
As I understand creating lots of resource managers in C# may be a bad idea so I thought that the best thing to do would be to create a singleton for this.
However, I'm not 100% if this is a good idea, or if this is a good way to implement it.
The main thing about the implementation I am unsure about is making the "Ins... |
I have made some jQuery Fallback Support for the CSS Property "background-attachment: local" and I am mainly a CSS developer. I do some jQuery, but I thought I would check to see if I am doing this in the more efficient way, as I may have multiple versions of this on one page.
CODEPEN DEMO
HTML
<div class="container">
... |
I am using JMapper to map from multiple sources to a destination class. Could you review it and let me know if the code looks OK to you? Please suggest any changes that I can make to improve it.
Interface to Map sources to destination object:
public interface ObjectMapper<D> {
public D getDestination(Object... sou... |
Question
Suppose we have two sorts of classes
an input class Input
defines a type result_type
defines set(result_type)
an output class Output
defines a type result_type
defines result_type get() const
has a number of Input classes as member variables, on which its output depends
Given an output class and several... |
I'm receiving data from a serial port in C, using Serial Programming Guide for POSIX Operating Systems as a guide.
The data I receive should be always 10 bytes in length but I want to be sure that, if there is any error (more or less bytes received), reading will clear buffer before the next data arrive, so that there ... |
Accordion plugin
As I don't use jQuery (because I just have fun with Chrome and iOS/Android) and I prefer to write my own functions, I decided to write a simple Accordion function some time ago:
Short code
High performance
Latest JS CSS3 HTML5 technologies
I don't want to add many classes and ids, and many eventhandl... |
A while back I wrote the following code (target is embedded C code on an 8 bit atmel device):
bool received;
tryAgain:
received = radioReceive(radiogram, MatchTree, CycleClock, duration);
if (received && radiogram->timeSlit == SolicitMask)
goto tryAgain; // not interested in recursion and the (stack... |
I'm writing my first JavaScript application (no 3rd party libraries used) and looking for some high-level guidance on how to better organize the code into separate classes & files.
Here is a simplified/contrived example to illustrate my current organizational layout/problems:
game.js:
/* Lots of constants, enums, etc d... |
How can I simplify this in Delphi?
Procedure colori1
Begin
if Temperatura<=15 then
begin
Form1.Label1.Font.Color:=clBlue;
Form1.Label2.Font.Color:=clBlue;
Form1.Label3.Font.Color:=clBlue;
Form1.Label4.Font.Color:=clBlue;
Form1.Label5.Font.Color:=clBlue;
end;
if (Temperatura>=16) and (Temperatura<=18) th... |
I have coded a webpage and it looks exactly how I want, but I think there could be improvements, possible as unnecessary floats, etc...
Could anybody please review my CSS code? Its not difficult or vague, I guess.
DEMO:
http://jsfiddle.net/dqC8t/2364/
CSS:
body{
background: url("http://i.imgur.com/cQhlsYZ.png") repeat-... |
I'm writing a service to parse machine log files as they are written to a central directory and push them to a web service. Each machine generates several log files at a time, with each file encapsulating a particular domain of operational information (e.g. user login sessions, errors, statistics, etc.).
The log files ... |
At this point I've written a fair amount of code to deal with dynamic line items. I've slowly refactored most of the code into an Order object that's created at page load which contains the methods for various actions within the table.
I'm hoping to get some feedback from another set of eyes as to how to further optimi... |
I have written some code for one of my assignments. However, I feel that I am repeating myself slightly in a few places. I have that niggling feeling that there is a better way to do things.
Here is the code in full:
#include <stdio.h>
#include <string.h>
#define ARR_SIZE 256
int main(void)
{
//Declare char arra... |
Search an element in a n-ary tree. Looking for good code practices, optimizations etc.
If question is ambiguous, let me know and I will reply ASAP.
Note - SearchInANAryTree name of class is for personal maintenance reason, so please ignore feedback as that name does not sound good. Also, help me with three questions:
... |
As part of learning more C, I wrote this extremely trivial C program that takes Student scores from stdin and, upon termination, prints out the minimum score/maximum score and the average score. Can somebody review my code and tell me how I might be able to improve my code?
#include <stdio.h>
int main()
{
int ... |
In my Android application, I have two types of filters: search filters and sorting filters.
I need to read filters from view, display filter on view, and save them into and from memory. I should include these needed features into one class to help myself add new filters in the future. I also need to divide filters by t... |
I have just started to use PHP OOP and I would like to write a class to make a multi-language website. I started from this but I wanted to use OOP so I came up with this:
Language.php
<?php
class Language {
private $UserLng;
private $langSelected;
public $lang = array();
public function __construct(... |
I have 18 RadioGroup. I am declaring the RadioGroup like this way
private RadioGroup kn1RadioGroup, kn2RadioGroup, kn4aRadioGroup,
kn4bRadioGroup, kn4cRadioGroup, kn4dRadioGroup, kn4eRadioGroup,
kn4fRadioGroup, kn4gRadioGroup, kn4hRadioGroup, kn4iRadioGroup,kn4jRadioGroup,ap2aRadioGroup,ap2bRadioGroup,
ap2cRadioGroup,... |
We have multiple scripts which write into XLSX with the same format, into a different format or slide variation. I am trying to write an API which saves time for other programs, but I need input on restructuring the file.
import openpyxl
from xlsxwriter.workbook import Workbook
class xlsx_extend(object):
"""This c... |
The assignment is very open and we have only 4 things it needs to cover:
File write and read
Use a Struct
Export into HTML format
use a common sorting algorithm
so I've decided to create a little "Library" with following features:
read the input file "Library.dat"
List the books on the console
Sort the books by name... |
I'm new to jQuery/JSON and I've build an dynamic toggle system. It work fine, but I'm not sure about my code and I want a better way of building this.
Could you please see my code and give comments/solutions/explanations for a better structure for this system?
NOTE: All JSON files are the same build
$(document).ready(f... |
Currently working on writing out some test for an iOS enterprise application. My concern is in this set up of my overloaded constructor.
- (id)init
{
CRMHttpClient *client = [CRMHttpClient sharedClient];
NSOperationQueue *queue = [NSOperationQueue new];
UIApplication *application = [UIApplication sharedApp... |
I'm looking to simplify the initialisation of the second constant, preferably to just one line. Any ideas? Anything from Guava or JDK (up to 1.6) is ok to use.
enum Box {
PROMO_HEADER,
FREEMIUM,
EXTRA_STORIES,
TOP_STORIES,
TOP_CHARACTERS,
TOP_THEMES,
TOP_ARTISTS,
TOP_ISSUES
// severa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.