instruction stringlengths 71 71.9k |
|---|
I have re-coded my entire path-finding class, it used to follow Dijkstra's Algorithm, while also being super inefficient, using Lists and a lot of other bad things that I had/have no idea about.
However, I've spent the last 2 days re-writing the entire thing, this time following A*, finally delving deeper into the subj... |
I need a revision for this code... it's a working code, but i'm pretty sure that can be simplified or even improved. This is for converting a normal xliff file (localization file) into a csv, having this content "ID","SOURCE","TARGET" aligned on the same line.
This is an example of the file i'm trying to convert:
...
... |
I have a column where, pretty much, each entry has numbers (specifically #1-4) and spaces (' '). I wanted to make a query that could avoid having to know these numbers and spaces.
$results = $db->query( "SELECT CHS, PIN, DEF FROM MAIN WHERE CHS LIKE '%".$q."%' OR REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(PIN, '1',''),'2'... |
I was just wondering what every one thinks about my Blackjack game. If there are some things I could change to simple the code down, or if I put some repetitive things I don't need. This is my first real extensive coding project.
One thing I was wondering was, when I ask for a bet (numerical input) from the user, how d... |
I've just done my first Angular.js project and can't help but feel I have too much code outside of the framework.
jsFiddle
This is a QA form scoring page that will eventually store it's results in a CRM system, the scoring has a bug but please ignore that.
I'm really after peer review and what the Angular framework can... |
Building a form where values can be entered in either pounds or kilos.
Script is...
function onlyNumber(fld) {
if(fld.value.match(/[^0-9.]/)) {
fld.value=fld.value.replace(/[^0-9.]/g,'');
}
}
function convertUnit(sense, value) {
retValue = 0;
if (isNaN (value)) { alert ('Non-numeric value'); ret... |
I'm working on a project where i am using VueJS as front-end framework.
I've so much data in JSON format to work with for that i've written a helper function to retrieve data from JSON. much like we query SQL for table rows.
here is what i wrote
function getWhere(field, value) {
var result = [];
$vm.services.f... |
Usage (all parameters are optional):
declare @options int = ( -- SQL "enum"
select a.ExcludeUserDatabases | a.ExcludeOfflineDatabases
from dbo.ForEachDatabaseOptions() as a
);
execute dbo.usp_ForEachDatabase
@Command = N'print Db_Name();'
, @Options = @options;
execute dbo.usp_ForEachDatabase; -- print... |
Recently I created a class that would manager errors, log them, and write details about them to files when the function logError was called. It would be done by having an error code and error message and then displaying the error to the console and writing it to the file if the user wanted to.
I just posted this here t... |
I've recently been writing simple data structures, even though they exist in the library it helps me understand them a lot better.
public class Stack<E>
{
private int capacity;
private E[] data;
private int top;
/**
* Default Constructor where the stack size is initially
* set to 1000 element... |
Is there a way to shorten the conditional statement below? As you can see, there's a lot of repetition. Is the if-statement the best approach here? Bearing in mind that there will likely be more numbers to check for (not, just 2 and 3):
var searchArea = function() {
// Search the area around the current position ... |
This is just like std::array<T, N>. I wrote this for practice. The class is in a different namespace, so the name array stands!!
There is only one bug (that I'm aware of) and that's the base() function for the reverse iterators. Works fine with const_reverse_iterator, but if I do the following:
auto i = arr.rbegin(); ... |
The specifications are:
The first 36 hours worked are paid at a rate of 15.0, then the next 5 hours are paid at a rate of 15 * 1.5. Hours after that up to a max of 48 are paid at a rate of 15 * 2.
It works, but I'm new and might've gone about this in a complicated fashion.
import java.util.*;
class Task3
{
public stat... |
I created a guestbook that on one page displays both the form for a new entry and all of the entries that have been created so far.
I am trying to use Kaminari for pagination for the entries.
Right now this code is working on my local machine, but I just have that feeling that it could be improved/refactored, so I wan... |
Here is a little encryptor I wrote, I'm just asking for people to tell me what is good practice and what's not. Also, I mean the code, not the actual encryption (because it's just a dumb thing).
#include "stdafx.h"
#include <iostream>
#include <stdexcept>
using namespace std;
int encrypter(int input);
int decrypter(i... |
The below method is meant to work similar to the way an ArrayList would work with the add method: The given double is added to the end of the array. Obviously since you can't add to arrays, a new array is returned with the number added to the end.
I'm worried about using this in loops due to performance, because if I a... |
The following C# methods take n bits and operates on them all in one pass.
// Sets n bits to zero at index i.
uint zerobits(uint x, int n, int i) {
return x & ~((uint.MaxValue >> (sizeof(uint) * 8 - n)) << i);
}
// Sets n bits to one at index i.
uint setbits(uint x, int n, int i) {
return x | ((uint.MaxValue >... |
Since I've been playing with F#, I decided to try my hand at implementing some of the Project Euler problems, and I've been having a blast doing it. (f#-is-fun)
So, I'm going to list all the Project Euler problems I solved to make things pretty clear:
Project Euler Problem 1: Multiples of 3 and 5
If we list all the na... |
I am calling a service outside of my control. My application must include a time out, so that if the call to the service takes too long, an appropriate time-out message is returned.
// Client connected to remote service
RemoteClient Client = new RemoteClient();
private async Task<MyResult> CheckItAsync(CheckRequest rq... |
I want to have a thin wrapper (low overhead) around c-style string. Also, with some additional features like == and < operators for map indexing. I have come up with the following class.
Can somebody comment on it? From what I've gathered this class would take only as much memory as a pointer, so much less than std::st... |
The idea of my program is to use pthreads, semaphores, posix shared
memory, and sockets to create an environment where N processes
(that we will refer to as the children) can connect to a single
process (that we will refer to as the parent) in order to send it
data.
Requirements
Common Code
The parent and child proce... |
I'm currently working on my final project of my first semester of C++ (and programming in general). What my professor wants us to do is to make a mock social media program that has some basic functions such as:
Sign up
Sign in
Follow user
Write a post
View Activity – (Activity from friends)
View Profile – (Username, f... |
Below function takes an array, an element to be deleted and returns a new array minus the indicated element. Can this be optimized some how? How good is it generally?
public static int[] sbSample(int a[],int i){
int size=0;
int b[]=new int[a.length]; // provide length of new array
for(int k=0;k<a.length;k... |
The following code ingests 10k-20k records per second and I want to improve the performance of it. I'm reading json and ingesting it into the database using Kafka. I'm running it on the cluster of five nodes with zookeeper and Kafka installed on it.
Can you give me some tips to improve?
import os
import json
from multi... |
<?php
// From adventofcode.com
// Question 1:
// An opening parenthesis, (, means he should go up one floor, and a closing parenthesis,
// ), means he should go down one floor.
// To what floor do the instructions take Santa?
// Question 2:
// Now, given the same instructions, find the position of the first characte... |
I need someone review my google map class , here is my situation I am working in medical project , I created one class to show hospital items in map with data object , here is my fragment class , I create helper class as I don't like to put all methods in long class.
import android.location.Location;
import android.os.... |
I am using Play Framework and Slick. In userController.scala I am handling HTTP post requests and sending to personRepository.scala. Is this controller and method written in the correct way?
userController.scala
def register = Action.async { request =>
var user = new UserInsert("", "", "", "", "", "")
request... |
This is a follow-up from: Reversing a domain name string in Java
There are a number of ways of splitting a String using a delimiter in Java, especially now with Java 8:
StringTokenizer (not recommended)
String.split (recommended replacement)
Scanner with delimiter
Scanner with Pattern
Pattern.splitAsStream
With the m... |
As first steps in C, I'm trying to write a program that reads from stdin into an array allocated on the free store, until an exclamation mark ! is entered. The array should be extended to prevent overflow.
Here is what I've written:
#include <stdio.h>
#include <stdlib.h>
char* increase_buffer_size(char *buff_ptr, size... |
I need to handle concurrent requests by waiting for the result of an already running operation. Is this code safe or does it contain bugs?
private readonly object _gettingDataTaskLock = new object();
private Task<Data> _gettingDataTask;
public virtual Data GetData()
{
Task<Data> inProgressDataTask = null;
loc... |
I'm using Cache::remember to cache 3 results in my action, 2 in the same call to Cache::remember. It works, but I have 2 questions about how I can join this Cache::remember call:
Could I use two Cache::remembers in the same method?
Could I join these two Cache::remembers (I need change the first param)?
Is it possible... |
I'm willing to have a way to calculate a quality score of an object; in this case an addressbook contact.
I believe there are way better approaches to do this and I'd like to hear your references.
How can I calculate a quality scoring of an object based on its properties?
/**
*
* get Quality
*
* @return float Conta... |
I have a case in which I need to determine whether a for loop yielded at least one element:
@property
def source_customers(self):
"""Yields source customers"""
for config in RealEstatesCustomization.select().where(
RealEstatesCustomization.customer == self.cid):
yield config.source_customer
... |
I just want some opinions/tips on how to improve.
#import
import string
import random
import time
import pickle
#create grid
def create_grid(size,lastcell,numberofmines):
grid = []
for i in range(size):
row = ['0']*size
grid.append(row)
mines = create_mines(grid,lastcell,numberofmines,siz... |
I'm a junior who wants to refactor a big method in my code, which has been tested and works:
def self.authorized_status plugin_id, store_id, application_id, version, locale=nil
if plugin_id.match /^(\w|-)+$/
I18n.locale = locale || :en # I think I can move it to a concern
# for this I thought about a... |
I am trying to solve following problem in Haskell using recursion:
Define a recursive function funkyMap :: (a -> b) -> (a -> b) -> [a] -> [b] that takes as arguments two functions f and g and a list xs, and applies f to all elements at even positions [0, 2..] in xs and g to all elements at odd positions [1, 3..] in xs... |
I've been messing around with a RationalInt type, using a simple
int-based structure for the time being. I've created code to convert
strings to the RationalInt type, but I'm not happy with it; it is too
convoluted for comfort (though this second rewrite isn't as bad as the
first rewrite, and the initial revision trea... |
I am writing an Express middleware component that'll run on Node 4, which has limited ES2015 support.
The fundamental purpose of this component is to verify JSON web tokens, using the jsonwebtoken module. Here is said component:
const jwt = require("jsonwebtoken");
module.exports = {
ensureAuthenticated: function(r... |
I'm fairly new to jQuery and have decided to make a jQuery audio player for a website.
There are two versions of the way it selects the audio:
Here
Here
I removed some basic, not connected with the player functions. What do you think of it?
$(document).ready(function() {
function secondsTimeSpanToHMS(s) {
... |
I've written (and tested) a simple least mean square adaptive filter . The steps of the algorithm are:
$$ For n = 0, 1, 2, \ldots: $$
$$ x = [u(n), u(n+1), \ldots, n(n-p+1)]^T $$
$$ e(n) = d(n) - w(n)^Tx(n) $$
$$ w(n+1) = w(n) + \mu*e(n)^Tx(n) $$
Where \$u\$ is the input signal, \$w\$ are the weights of th... |
The text file containing cars' arrival and departure time will upload stuff from the parking lot.
Text will be like this:
10:10, 11:10
10:30, 12:40
10:25, 11:10
11:10, 12:20
I created a ParkedCar class:
public class ParkerCar
{
public DateTime ArrivalTime { get; set; }
public DateTime DepartureTime { get; set... |
Is there a cleaner way to write this code? It's the start of a hexeditor I'm creating.
I'm aware that the variables aren't descriptive, this is just a test run for when I imbed it into a File Converter program.
def hexeditor
file = File.read('TESTFILE.txt')
file2 = File.read("TESTFILE2.txt")
a = 1
b = ... |
I have a bash script that is meant to start a google search from the command line. I am also looking to implement a way of getting source code for the search page possibly through a subscript. This is what I have so far:
if [[ $1 == "-n" ]]; then
if [[ $# -lt 2 ]]; then
echo "Usage: google [-n] term [, term... |
I wanted to code a small ASCII art minesweeper clone, to see what it looked like and how much code it needed.
The result is not so bad, under 80 new lines of code in total. It looks kinda readable to me, but I wrote it just know, so I'm biased.
Input checking...
I feel like I got pretty much obsessed with input checkin... |
I have a Tiva TM4C ARM processor connected to a GSM modem (SIM900). When the GSM modem receives a new text message it sends a UART string to the MCU, where an interrupt routine increments a new message counter.
Then my program takes over to parse the message. Below is the code. This code currently functions correctly. ... |
I've made this some time ago for an assignment and I was wondering how it could be improved both in terms of performance and best practices for C code.
#include <stdio.h>
#include <string.h>
#define NR_ROTORS 3 /* Number of rotors */
#define ROTORSIZE 26 /* Rotor charset size */
#define INIT_CHAR 'A' /* initial c... |
I have the working code but it is pretty dirty. The goal is to input a number in an application. If it satisfies the min/max logic then jump to the authorization part. Afterwards we can confirm it or reenter it or cancel it. If fails then re-input it. So totally we can only input twice.
public virtual CallerAuthoriza... |
Description
My program checks the sum of 2 numbers to determine if it is divisible by a certain number (5 in this case). Divisible numbers are deemed usable (for another program I am running). Next it checks the individual integers to see if those are divisible/usable as well.
Problem
I want to use this same code for d... |
I have a report on SSRS (that's SQL Server Reporting Services) that I need to be able to parameterize so that it can run for..
Yesterday (scheduled every morning)
The week that just elapsed (scheduled on Sunday mornings)
The month that just finished (scheduled on the first Sunday of the month)
Now, in order to be abl... |
I've created a (very) simple solution for Project Euler problem 6:
Project Euler Problem 6: Sum square difference
The sum of the squares of the first ten natural numbers is,
$$ 1^2 + 2^2 + ... + 10^2 = 385 $$
The square of the sum of the first ten natural numbers is,
$$ (1 + 2 + ... + 10)^2 = 55^2 = 3025 $$
Hence the ... |
In my single-work.php I have some code with slight variations that I feel could be more DRY. When there are only slight variations like this is it ok to repeat part of the code? Or is there another way to write parts of this?
// Advanced Custom Fields
// Grid images or videos
$grid_image_1 = get_field('image_1')... |
This is a small program I wrote for GCSE computing, it operates using Vectors and that's pretty much it, wondering if you could tell me if there is anything I could do better.
BlackJackv2.cpp
#include "BlackJack v2.h"
int main() {
// Create Vector with the players, using vec because of an undiefined amount of pl... |
I wrote this page with the goal in mind of having a footer that runs along the bottom of the page that can be closed, and has a floating info box that appears when the footer is hovered over. I'm just learning JS, HTML and CSS now, so I'd appreciate any critiques on style.
Am I doing anything the long way? Is any of th... |
The following code sorts the current users bid model items based on a param condition :bid_status. It starts to get messy when checking if the project space (:real_property_sale_project) :failed_date is .present? or .nil? to exclude certain items from the returned results. How can I improve this?
def index
@bids = cu... |
I have written a pager in C that is supposed to be used in systems where curses is not installed (or broken). It can also be used as a system-wide pager, it works with man pages (only on BSD, though). I want to spot any portability or output problems, as there may be some due to the dependence on buffered input:
#inclu... |
Validate that the following bracket pairs [], {}, () open and close successfully in a candidate String.
Valid String Example: "[{()}]" should be evaluated as true because no "outer" open bracket is closed before an "inner" open bracket.
Invalid String Example: "[f{o]o}"
I would appreciate feedback on my implementation:... |
In this revision (follow-up of this post) I've fixed reading from stdin, and also tried to minimise the damage caused by typing additional characters. You might want to see my original post on this.
#include <stdio.h>
#include <stdlib.h>
/*
* A very SIMPLE pager that does not require curses. If your curses library
*... |
I'm trying to implement an algorithm able to search for multiple keys through ten huge files in Python (16 million of rows each one). I've got a sorted file with 62 million of keys, and I'm trying to scan each ten file in dataset to look for a key and its value.
Sorted file key:
a
b
c
d
...
Each dataset file appears ... |
It takes a long time to execute and the CPU usage for the executable is about 25% while it is executing. Any ideas on how to make this faster?
primes.c:
#include <stdio.h>
#include "primes.h"
/* COUNT will be how many numbers to
* check and see if they are prime */
#define COUNT 1000000
int main(void)
{
FILE *ftp;... |
I wanted to revisit this site to post some recent work I put into this small project. I was able to add a console as suggested; but I thought I would ask here how my coding stying is before I work on it more to hopefully avoid getting too frustrated with modifying what may be bad coding style. How has this improved? Ho... |
The code that was just added to Rubberduck will allow us to set up hotkeys for our features, so that next release, Ctrl+Shift+R brings up the refactor/rename dialog, for example.
The requirements were roughly:
Let client code know when a keypress is captured in a code pane
Enable registration and handling of hotkeys
... |
I've written the following in NodeJS as I am trying to learn a bit more about that toolset. It 'works' but is not very robust. I am not concerned with security at this stage and the code will not be accessible to end users. I would like to incorporate some kind of timer which ensures that the call to the Akismet API do... |
In the ongoing saga of me rewriting functions that can be easily composed from existing Rx functions, I present my latest progeny: a bastard combination of Scan and Aggregate. The aim is to aggregate n items from a source, and emit the result every n. Then start again.
public static IObservable<T> BufferAggregate<T>(th... |
I've created a hash for a file converter. The file gets loaded into the program, and from there the file goes to a hex editor and the user picks and chooses what they want to do to the file. During the users' choices, the choices will run against a hash containing all hex information. It will then translate the hex and... |
I am currently learning C++ though Bjarne Stroustrup book Programming Principles and Practices using C++.
Going through the drills, I am trying to purposefully write efficient and readable code (good coding practices. However, I think I may be overdoing it with my use of functions for tasks within my program.
//Functio... |
I've just done an exercise on the abstract factory pattern and I want someone to tell me whether or not I followed the rules of the abstract factory pattern.
Exercise 2 (Abstract Factory: GUI based OS)
The purpose of this exercise is to provide a modelisation of a system for creating different components of a graphica... |
I'm (re)building a data table to track our clients that receive regular income payments. Specifically, I need to pull this data into other workbooks for other reports, and since I was here anyway I decided to upgrade it and anticipate its' future growth.
A sample of the data table (minus sensitive data):
My code finds... |
This is just a basic HackerRank challenge I was working on to better understand F#. Its purpose is just to print a tree that has a straight 'trunk' of \$n\$, splits into 2 branches which diverge to \$n\$, then branches grow a straight trunk to \$\frac{n}{2}\$ which split and diverge to \$\frac{n}{2}\$, etc.
(Note: I wa... |
I have two long (7683200 length) 1D arrays corresponding to two clock cycles, that I wish to combine into single 1D array. The clock_ticks_fine cycles between 0-255, and corresponds to a coarse division of 7.5 msec, with the reset to 0 signified by a 1 in the clock_ticks_coarse array.
I would like this to be much much ... |
I'm trying to solve the following problem:
Australian ballots require that voters rank all the candidates in
order of choice. Initially only the first choices are counted, and if
one candidate receives more than 50% of the vote then that candidate
is elected. However, if no candidate receives more than 50%, all
... |
We have a lot of Controller ActionResults like this in our MVC project. The controllers get really cluttered up. This is a simple example, but we have much more complex ActionResults.
This controller accepts a model, and if the primary key is Guid.Empty, handles it as an Add/Create. Otherwise it handles it as an edit.
... |
Firstly I try to explain my model.
I have 3 type of notifications which can have N types of email templates related to a specific status.
NotifySupervisor(Vacation vacation);
NotifyAdministration(Vacation vacation);
NotifyApplicant(Vacation vacation);
I've created a type of Factory. I don't consider this a Factory Pat... |
All the calculator programs I have seen so far seem long, complicated and they can only operate on two numbers. Mine is simple, short, and it can operate on as many numbers as you want. Please tell me if there is another way to improve this section of code.
x=[]
amount=int(input("How many numbers?"))
operation=input("(... |
I'm trying to implement an algorithm able to search for multiple keys through ten huge files in Python (16 million of rows each one). I've got a sorted file with 62 million of keys, and I'm trying to scan each of the ten files in the dataset to look for a set key and their respective value.
This is a follow-up code on ... |
I am rebuilding the front-end for an application that I am building and have the content laid out the way I need.
I would appreciate any suggestions on how to improve the structure, specifically the header section) with web standards in mind.
You can view the Fiddle here. - edit please ignore the non loading icons in ... |
I started to learn programming just a few days ago. And I've written code for a simple original game for practice, using some knowledge of JavaScript that I have gained so far.
Is the following code properly written? I'm especially concerned about the use of "Math.floor", "Math.random", "function", and "if / else".
Inc... |
I was sitting in my bedroom, looking at my Powers of 2 clock sitting next to my radio, under my analog clock on the wall, and wondered to myself: "Why have all these different clocks when I can have just one?"
So I decided to make my own. This program contains four different display modes: true binary, BCD, analog, an... |
For my AP Computer Science class, I am required to write a program that prints the Twelve Days of Christmas without loops or conditionals using static methods.
public class TwelveDaysOfChristmas {
public static final String[] lines = new String[] {
"A partridge in a pear tree",
"Two turtle doves an... |
I have created this prime number generator. I want it to be as fast as possible, but I am wondering if there is a faster way (there must be).
#include <stdio.h>
#include <stdbool.h>
#include <limits.h>
bool is_prime(const unsigned long long);
int
main(
void)
{
puts("2\n3");
for (unsigned long long n = 5;... |
This is my first big JavaScript project and I wanted to know what I could improve in terms of coding practices and design. It is a Chrome extension made for Vanderbilt students (VandyTab) that takes over the new tab and shows the time, bus timings, what restaurants are open and so on.
var jumbotron, supporting, data, h... |
Inspired by this question, I decided to grow my own fractal tree.
The problem is: given an integer \$n\$, \$0 \leq n \leq 5\$, print the \$n\$th iteration of the fractal tree. The tree is probably easiest to describe in pictures, so here's a minified version of the first iteration:
_____________________________________... |
Problem Statement:
Let A and B be two N bit numbers (MSB to the left). You are given initial values for A and B, and you have to write a program which processes three kinds of queries:
set_a idx x: Set A[idx] to x, where \$0 \le idx < N\$, where A[idx] is idx'th least significant bit of A.
set_b idx x: Set B[idx] t... |
I have been using Microsoft.Unity as my container and have decided that the approach for a lazy implementation causes too much rework. Each time you decide to swap out to use a lazy you have to go add .Value or a .Resolve() after your variable (which could be called hundreds of times).
Suggested lazy implementation by ... |
Lately, I have been reading Uncle Bob's Clean Code book, and decided to try and follow some of his principles to make a class that was a somewhat confusing static helper class, with an abundance of private static methods, into an instance class which more clearly expresses its intent.
The problem is to execute a stored... |
I have a string str ="/Users/user/Desktop/task/U6342_Account_20150112.txt"
I need return only U6342_Account_20150112 as an array ['U6342','Account','20150112']
I did
str.split('/')[-1].gsub('.txt','').split('_')
which gives me ['U6342','Account','20150112']
Is there any more convenient solution to do it?
|
display.php:
<?php
include "funtc.php";
updater();
$token = json_decode(file_get_contents('wp-content/themes/World-of-Warcraft-New/includes/token.json'));//<--open data file
$data = $token->update->NA->formatted;//<--store primary object
if(!isset($data, $data->buy,$data->{'24min'},$data->{'24max'},$data->timeToSell,$... |
So I recently rebuilt a worksheet we have for tracking our clients who take income from their portfolios (here). I intend to be pulling this data into other workbooks for various reporting functions.
To facilitate this, I decided to write methods in the "workbook" module to return:
The codenames of the sheets holding... |
I wanted to download all colour schemes for phpstorm and was too lazy to do it manually so I wrote a little script for it in python, because why not.
This is my very first Python script and I'm still learning through tutorials and what not.
Things it does:
Asks to input the path where to save the files
If the destinat... |
I have made a very simple Brainfuck to NASM converter, that is usable for practically all programs. It has one trivial optimisation (to subsitute ADD for INC with large numbers). How can I make the generated code smaller and/or faster? I would prefer smaller over faster, if I had to choose.
Here is the code:
#include <... |
The following is a small snippet from a pretty large program written to analyze raw data and find specific trade structures. I am new to VBA and this is my first large scale program I have written in the language.
I definitely did things unconventionally and I wanted to ask for some review and pointers how to improve m... |
I once wrote a program to calculate Pascal's triangle limited only by memory. I recently looked back and was disturbed by how ugly it is. I can tell that there are some bad practices for lack of better options known to me.
import java.math.BigInteger;
public class Pascal {
private final int numRows; //The number o... |
I'm working on a script where I want to create one dataframe from a series of files with annual baseball data in them.
I'm relatively new to R and I feel like the way I wrote get_seasons_range() is probably more like writing C# in R, rather than doing it the idiomatic R way. Is there a cleaner way to do this?
read_seas... |
Following a question I asked and the advice on SO I implemented the following solution. Are there any downsides to such a solution? Is there a better way to make it changeable when I need to control formatting of other types like double and float where I have more than one occurrence of each in the dataLine[]?
publ... |
I am checking over 160,000 records in my database every 24 hours to see if there were changes in the incoming data coming from API and my existing data in the database. If there were I am updating those, otherwise I'm doing nothing. Checking 189 days takes 10 seconds and 160,000 about 2.5 hours.
What can I improve in m... |
I am working with a third party XML api, which can only respond to api calls with a error or success xml response.
For example, here's an error xml response:
<?xml version="1.0" encoding="UTF-8"?>
<error>
<message>
<![CDATA[Unable to load XML document from resource ]]>
</message>
<exception>org.impa... |
Point one, I know "Assignator" isn't a real word. I couldn't find a better fit so right now that word is added to my Visual Studio's dictionary!
As a part of my (future) MVVM framework, I needed a class to assign values to a property of an object. As it's a quite generic framework, the class itself needed to be generic... |
I would like to start by mentioning that I am LAMP stack guy who happens to be making my first ever .NET C# web app and I'm seeking general advises for best practices and to see how more experienced people would have done it.
I am using code first development pattern with latest Entity Framework . I have a AppUser mode... |
This question was posed to me by someone in my university's athletics department who had a USB sound level meter and a simple Python script which printed the current sound level (he was provided with that script when he bought the meter):
Can you write a Python script to read the decibel level of the arena during bask... |
I have this problem:
Given a String of any length, return a new String where the last 2 chars, if present, are swapped. My question is, is there a more delicate way to do this than this way:
public String lastTwo(String str) {
if(str.length() < 2 || str.equals("")){
return str;
}
String lastTwo = str.sub... |
I currently have this, which works. However, I would prefer to not have the HTML that displays being stored inline in array like this, but in a more flexible / optimal way so I can have more text / HTML without being restricted to having it inline within the quotes.
texts = {
item1: 'Item Box 1 Content <strong>ht... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.