instruction stringlengths 71 71.9k |
|---|
I have an application where I use Task to run an operation. During the operation, there can be a problem which will need some user interaction (continue or not). I need to bubble up a messagebox and get the user result back to the operation thread.
This is how I got it working:
public interface IPlugin
{
void Conne... |
In five minutes I made a pretty ugly looking function. Can you help before I have to commit the code into history?
Requirements:
I would like a function that takes an array of numbers, and returns an
array of ranges. Ideally remove the duplicate line.
Sample Input:
Array(1,2,3,4,5,6,10,11,12,13,20,24)
Output:
Array... |
This is my app.js:
'use strict';
global.config = require('./config/environment/config');
global.i18n = require('./config/locales/config');
var express = require('express');
var app = express();
app.locals = global.config;
var passport = require('passport');
var session = require('express-session');
var load = requir... |
I wrote the following code to read constants from annotations:
public class ContentUtils {
static {
String[] videoFormats = null;
String[] imageFormats = null;
try {
Field multipartFileField = MultipartFileWrapper.class.getField("multipartFile");
Extensions annotation... |
In short I have a bunch of articles (~100k) which shall be ranked ("mixed", hence "newsmix") based on their newsValue (how important they are, between 1 and 10) and newsLifetime (how long they stay important, between 1 and 4), how long ago since published, and the users' preference for each category. It also groups the... |
I've been trying to optimize this while making it readable. Thoughts?
The sequence of triangle numbers is generated by adding the natural
numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 +
7 = 28. The first ten terms would be:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
Let us list the factors of... |
I have this very simple code which is used to parse values:
public class Connections
{
public List<Integer> getConnections() throws IOException
{
byte[] fileBytes;
File myFile = new File("/proc/net/sockstat");
if (myFile.exists())
{
try
{
f... |
I've made the following DataSetReader, DS Attribute, and DataSetManager.
My main concerns are the following:
This is my first time using a Singleton. Should I? And have I done it well?
My aim is to make this class reusable in other projects. Is there anything I should improve to allow for this further? I pulled the lo... |
Based off the coding puzzle: Who is this chatbot?
The code's purpose is to create an AI that the user can communicate with. Due to there being no hard-coded strings, the AI learns from what the user has said.
In my version of this AI, all messages said by the user are stored in an array and when it comes time for the c... |
I was given an assignment to ensure that a list was symmetric.
I built it in a way that worked and it passed the tests. But I wanted to see if it could've been written more efficiently and still readable.
Original question
A list is symmetric if the first row is the same as the first column,
the second row is the s... |
So, this is my refactored VM:
public partial class MainPageVM : INotifyPropertyChanged
{
private IThemeProvider _ThemeProvider;
private IStartupVersionProvider _StartupVersionProvider;
private IFontSizeProvider _FontSizeProvider;
public ObservableCollection<MenuItem> Back { get; set; }
public Obser... |
I am taking Stanford's Introduction to Databases Self-Paced online course. I have gone through the videos in the SQL mini-course, and I am having trouble completing the exercises.
The following is the question from the SQL Social-Networking Query Exercises, Question 5:
For every situation where student A likes studen... |
I'm just getting started with F# and was writing some unit tests for some functionality I had written. In the interest of brevity, I decided to create some lists of the different test cases and just run through them all in one test instead of creating separate test methods for each one (I'm not focusing on that design ... |
I was just messing around with python making wav files; when I came up with this (what I think is) pretty neat script. It takes each character and represents it with a tone.
import wave
import struct
from math import sin
import os
RATE = 44100
maxVol = 2 ** 15 - 1.0 # maximum amplitude
noise_output = wave.open('nois... |
I'm writing a simple script which will search a source directory for certain types of files and move them to a destination directory. I'm using it as an opportunity to practice writing some "defensive" code which nicely reports errors to the user, rather than spitting out a stack trace.
As a start, the program should r... |
Follow up to Duplicate like a weapon, arrays like heaven.
@rolfl suggested in chat that I try to complete this challenge again in a Java 8 friendly way. I took the opportunity to also employ the algorithm suggested in this brilliant answer.
I'm not familiar with Java 8 features, but am definitely interested in using i... |
We are trying to use NodeJS for analytics. The following code gets the parameter from a URL and dumps it into a flat file. Is there any way to optimize it to get better response time?
var http = require("http");
var url = require("url");
var cluster = require('cluster');
var fs = require('fs');
var numCPUs = require('o... |
I was trying to refactor the following code for Caesar cipher, but it feels overly complicated at the end of the refactoring. Could someone else take a look at it and let me know if I am just overdoing/making it complicated for someone trying to read the code?
My highest priority is to write readable code, so any point... |
Is this kind of vectorized operations the most efficient way to do this in matlab? Any critics about my code? Am I doing something wrong (i tested several times, I think it works). Notice that I use J to store the history of the cost function so I can see how well it is converging (by plotting a graph for instance).
ma... |
I have recently started working on angular.js and I like it. I have decided to use a single controller per view. I use the json data from the backend. As my work is progressing, my codes are getting more verbose and I would like your suggestions on how I can (as a newbie) improve my code. I use the default $http servic... |
I'm fairly new to JavaScript and I wonder if there is a way to write this function shorter and better?
function checkFile(file){
var cbEnab= true;
if (file !== undefined && file !== null) {
cbEnab = (!jQuery.endsWith(file, "Com.js"));
}
return cbEnab;
}
|
I've just finished Project Euler Problem 8, which ask for the greatest product of any sequence of 13 consecutive digits in a given string.
I wonder if there's something that could be improved.
function EulerProblem8() {
var amountOfDigits = 13;
var sequence = "731671765313306249192251196744265747423553491949349698... |
I have the following method:
Float getPriceEqualsCategoryName(BrowseNode node, Float productPrice) {
String name = node.getName();
for (Entry<String, List<RangeValue>> entry : categoryToFee.entrySet()) {
if (name.equals(entry.getKey())) {
List<RangeValue> values = entry.getValue();
... |
I've made a simple bash script to check if a web server responds, and to send emails to a list of addresses if the website is down. Any suggestions as to how to improve it/ edge cases that I missed/ better styling/ etc? I'm not very familiar with idiomatic bash.
#!/bin/sh
output=$(wget http://lon3213:8111 2>&1)
patter... |
I tried looking up some good example init scripts, but all that I found were excessively complicated. So I wrote my own simple init script targeting CentOS 6. I tried to follow LSB where I understood what it says. CentOS uses chkconfig instead of the LSB comment block.
This is my first serious shell script ever. What d... |
Below is some powershell to write to the event log; if the -Force parameter is specified this saves you the effort of writing additional code to first check whether the log exists.
I had to make use of Remove-Variable to allow some parameters to flow through; I'd not used that feature before / been aware of that nuance... |
This is my very first program in JavaScript. I am trying to teach myself from JavaScript: The Definitive Guide, 6th Edition.
The code is also available on my bitbucket.
I decided to remake the classical game Xonix as an exercise. I took some concepts from this video.
I would like to ask you for advice in:
Style: I r... |
Idea
The cache is nothing but a circular arrayList. This list contains Entry<K,V>. Whenever new entries are coming, add at the end of the list. That means least recently used element at the first. Suppose if you are reusing any element then unlink from the list and add at the end.
In order to get any element, we need t... |
I picked up Sass last week, and I'm already diving into expressions. I have a @mixin that creates a CSS border triangle using the following call: .foo:after { ... @include triangle(bottom,8px,7px,8px,#4986c8); } producing something like:
Here's my @mixin:
@mixin triangle($dir,$tl,$size,$br,$clr) {
$a: solid transp... |
I want to use a better syntax than nested foreach statements to overwrite the initial list with items from the second list.
In the code below:
I want to overwrite initialList with those in secondList that have the same Value (Remove Red).
Use the items in secondList where Value was the same (Yellow)
New initialList l... |
I'm starting up a new project, and I've always had an issue getting vertical alignment right in CSS. Is there anything I could do better that what I've currently come up with? Replacing the header and nav with divs, and changing the rgba values to hex values this seems to work all the way back to IE7 which I'm happy wi... |
I've got the following task:
Keeping in mind Horner's Scheme, write an application that converts a given number x in n-number system to m-number system where m, n <= 10. x is a natural number or zero, x <= unsigned(-1)
My code is as follows:
#include <iostream>
int toDecimal (int, int);
int fromDecimal (int, int);
i... |
I recoded malloc() by using brk() and sbrk(). I just want some "reviews" to see if it is possible to improve my code to make it faster and better. If I'm doing some tests like "ls -Rla /" it takes a lot longer than the original ls, and if I do with "sh -c", it's way longer than the first one.
malloc.c
#include "../inc/... |
I have this small "framework" for representing matrices with entries of primitive type double, and performing Gauss-Jordan elimination (for solving systems of linear equations). My main concern is cohesion of my code, but I would be glad to hear whatever comes to mind.
GaussJordanElimination.java:
package net.coderodde... |
Around a year ago, I wrote this Stack Overflow answer where I suggested an idea to replace deeply nested loops with a single iterable virtual-container object that "contains" all the indices.
The following is an implementation, but I'm still not that familiar with C++11 at the moment, so I thought I'd ask for a review.... |
I've written a cipher class based off of cryptographically secure hash functions and block cipher counter mode of operation. It currently runs around 20MB/s on my machine with the Java implementation of SHA256. The class is here as well as below.
Any critique or input on the design or code?
package blackdoor.crypto;
i... |
I'm hoping to figure out a faster way to write this before I resign myself to copying and pasting 500 times. I have code here that needs to do tons of vlookup matches. The only thing that changes are two variables each time.
First part is just establishing variables and a count of the rows I need to loop through for ... |
I wrote this script a while back to generate press releases. It consumes a csv of data where each row contains the data for a country and fills in values in pre-written text based on the data. In its current state, it's basically a mad libs implementation with some hard coded conditionals. I'd like to refactor it to ma... |
I'm trying to get the URL of the browser with Mac OS X app. I wrote some AppleScript and am trying to use it in Cocoa. The problem is, when I watch it with instruments, memory is increasing, and at the end of 3-4 hours it's nearly 20MB.
First generation
Second generation (5 min. later)
#import "AppDelegate.h"
#imp... |
I have multiple threads calling a method, passing in an ID and value.
I have two constraints I need to place on this method:
Only one of the same ID can be processed at a time. Additional threads with the same ID must wait.
Subsequent calls with the same ID must be processed in the order they were received.
Here's an... |
I've thrown together a utility for my programs to log to a database, but the code looks like a mess and I don't know how to clean it up. This library is going to be used from all of my other programs and it is therefore important to keep the code clean and secure.
#include <log_entry.h>
#include <my_global.h>
#include... |
I would like to create a generic template class for my document processor. Assuming the template has a source file path and a "content", here's what I came up with:
Template
public interface ITemplate<T>
{
/// <summary>
/// The filepath of the base document for the template.
/// </summary>
String BaseDo... |
Examples:
12 gives:
'AB' and 'L'
and
123 gives
'ABC', 'LC' and 'AW'
Here is my attempt:
import java.util.*;
public class decoding {
static int calls = 0;
static Map<Integer, String> codes = new HashMap<Integer, String>();
private static void construct(){
codes.put(1, "A");
codes.put(2, "B");
codes.put(3, "C... |
I have multiple API calls so I created a service however I would like to find a way to remove the duplication
myAppServices.factory('apiService', function ($http, $q) {
return {
getDocuments: function () {
return $http.get('/api/autodeskdocuments/1')
.then(function (response) {
... |
Trying to implement a simple, thread-safe LRU cache that's meant for "read mostly" use.
Collections.sychronizedMap()
Clean, simple, not much else to say.
public class LRUConcurrentCache<K,V> {
private final Map<K,V> cache;
private final int maxEntries;
public LRUConcurrentCache(
int maxEntries
... |
A simple command that wraps another command, locking a file first. It is similar to flock, just simpler.
#include <stddef.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/file.h>
#include <err.h>
#include <stdlib.h>
void attemptLock(const char *lockFileName)
{
int fd = open(lockFileName, O_CREAT | O_WRONLY,... |
For my Operating Systems class, I needed a linked list data structure and didn't have one already written. During the course of thinking about how to implement a linked list again (it had been a while..), I decided that a lot of the most common functions used on linked lists can be implemented based on applying or comp... |
Let's assume I have an enum type with currency:
public enum CurrencyType {
USD("American Dollar", "USD"),
EUR("Euro", "EUR"),
JPY("Japan Yen", "JPY");
private final String fullName;
private final String shortName; // enum valirables can change in the future, so I do not use Currency.name()
pr... |
I've made some CAPTCHA reader and maker in Python using Tkinter. Do you know if it's possible to keep image and output files in "memory" not writing them on disc? Because right now everything is 'stiffly' made. And what would you do differently?
gui.py
import tkinter as tk
from PIL import Image, ImageTk
import captcha... |
I'm trying to make a good MVC model using annotations, which I will use it in a large scale GUI project. I want to respect the maximum of rules and guidelines, and be able to decorrelate every parts of the MVC. The code must be beautiful, testable and maintainable. I wrote a sample project to show you my model. What do... |
I've build a handlebars helper that takes n total pages and currentPage and returns the HTML for the page number links, skipping out pages far away from the current page to avoid it being too big. I feel like there are a lot of if statements in there and it could be a bit more compact.
'use strict';
var config = requ... |
In a project I've started, I decided to implement some new code to handle AJAX requests.
The requirements are that it can ONLY access the /ajax/ folder, load translations from another folder (/lang/) and that you MUST be authentificated previously.
This code is currently in use in a CMS.
Here is the ajax.php file (plac... |
I am getting better with jquery day by day, but there are still things I don't know how to sum up several functions to reduce some code.
So I am using three jquery modal dialog popups and I have written a lot of code to make them all work fine. However, I believe it should somehow be possible to reduce all the code int... |
I have implemented a max-Heap data structure backed by an array. I wanted to know whether this is an acceptable implementation or not.
Any improvements or suggestions are welcome.
import java.util.Arrays;
import java.util.NoSuchElementException;
public class MaxHeapDemo {
int heap[],heapSize=0;
public MaxHeapDemo(... |
I have a table in my database containing email and email_state amongst other values.
Email is the email of the contact, and email_state is the existence of the email. It can contains 3 values: null (not checked), EXISTS or NOTEXISTS.
When the application (a PlayFramework Java application) starts, I call the start() met... |
I am pretty new to Swift, as a solo developer I was wondering if somebody could pass comments on the singleton implementation below. The code does work, but being new to Swift and knowing that there are a lot of gotchas, I wanted to get some feedback from someone more experienced.
// Test Singleton Swift 1.2
class FGSi... |
This is a follow-on qestion from: LRU cache design
Revised Implementation
package lrucache;
import java.util.LinkedHashMap;
public class LRUCacheV2<K, V> extends LinkedHashMap<K, V>{
private static final int MAX_ENTRIES = 3;
/**
* super class constructor arguments are
* cache size = MAX_ENTRI... |
Using Python Scipy, I am trying to divide all numbers in all columns of a sparse matrix (400K × 500K, density 0.0005), by the sum of the squares of all numbers in a column.
If a column is [ [ 0 ] , [ 2 ] , [ 4 ] ], the sum of the squares is 20, so after computation the column should be [ [ 0 ] , [ 0.1 ] , [ 0.2 ] ].
T... |
This is an implementation of heapsort as seen on Programming Pearls, adapted for java List collections. It is working on a copy of the list passed-in on purpose at the moment.
import java.util.ArrayList;
import java.util.List;
public final class HeapSort {
private HeapSort() {}
public static <T extends Compa... |
Given a slice of unknown length (potentially very small or very large), and another slice containing (unique) integers indicating indices to be removed from that slice, the most straight forward way to achieve this would be to sort the indices in reverse order then remove each of them from the slice in turn via:
mySlic... |
Earlier, I've posted a question about a file used to handle AJAX requests.
I've followed some of the advices given and made some changes on the code itself.
You can go on "All-purposes AJAX handler made with PHP and .htaccess that speaks JSON" to read more information about it's working.
This is simply a follow-up, and... |
I am starting to learn Haskell, so I coded a naive solution to the primality test and summation of primes (Project Euler Problem 10: sum of all primes under 2 million) . As I have an imperative programming background, can you tell me if my code is functional enough?
isqrt :: Int -> Int
isqrt n = floor(... |
I've completed the application and it works against all tests I've thrown at it. Now, I'd like to see if there's a way I can optimise the application and lower the code footprint.
The application is intended to be used for collecting input and collating this into an email, to be used later.
All variables are pulled fro... |
I have 2 buttons for Terms and Conditions in my project, that I need to implement in multiple activities. I created the following class:
public class TermsAndConditionsView extends LinearLayout implements View.OnClickListener {
private Context context;
public TermsAndConditionsView(Context context) {
s... |
I've been playing around with the code challenges on projecteuler.net. A few of them involve prime numbers, so I've created a function to find them based on the sieve of Eratosthenes.
It works fine, and is reasonably quick for small numbers, but much slower for the challenges that involve the larger numbers, like 2mil... |
I have +-645 IRL links I need to validate. The code below is my attempt, but my problem is that it takes forever to check all links and sometimes times out. Is there a better way of validating so many links?
index.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$notValid = [];
// This array contains... |
I have a dictionary whose values may contain keys that are already in the dictionary. What we are actually talking about are parameters. Sometimes a parameter is defined by a number plus another parameter, etc.
It looks something like this:
paramDict = {'ad': '2*dmcg/factor*(xw/factor)',
'dmcg': 2.05e-07,
'dxwn_3vna': ... |
I've been working on a TicTacToe GUI. While the game works with a proper restart, exit and win conditions; I feel that it could still be better optimized.
I'm not particularly concerned with the cosmetics of the GUI. I'm aware of how to make an interface "pretty", so to speak. I would just like to know if there was a b... |
I'm new to programming and want to check if I'm using best coding practices in my program.
package scott.TicTacToe.main;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public c... |
This is a very subjective question, but I'm curious as to other people's opinions.
Would you find this bit of code distasteful? Is it cryptic and unreadable, or is it using features of the language in an elegant way?
def winning_side(home_goals, away_goals):
"""Takes a home score and an away score, and returns the ... |
In my JavaScript quiz, I have two functions below which are not DRY. What i want to do is to cut it, so everything below var = text would be used only once not twice.
My concept is to enclose these two functions in bigger function (e.g. guess()) and keep the trimmed correctGuess() and incorrectGuess() within it.
Now he... |
Need help with DRYing out my Sass... there is just so much repetition in here:
.cta_foo { @include linear-gradient(#f69c28,#b75d00,#b75d00); text-shadow: -1px -1px 0 #b85e00;
&:hover { @include linear-gradient(#FFAC41,#E77500,#E77500); } }
.cta_bar { @include linear-gradient(#17b629,#0e831c,#0e831c); te... |
A function that relatively quick replaces one color with another, in a memory-buffered BMP.
I am trying to improve the performance as much as it is possible. The previous implementation of this function was even faster.. but then I ran into some padding complications.
union
{
unsigned long ulColor;
unsigned cha... |
I have an application that looks like such:
var app = angular.module('app', []);
app.Person = function(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
app.controller = function('myController', function($scope) {
$scope.pageData = [];
$scope.pageData.firstName = ['John']... |
How do I condense this gigantic monster into something more manageable? I heard about command pattern but I can't figure out how to use it. What other solutions are there?
public void AI(){
count++;
if(count % 2 == 0){
letter = "O";
}
if(((buttons[1].getText().equals("X") && buttons[2].getText... |
I'm trying to figure out the most elegant solution to do the following asynchronously using JavaScript (specifically node):
Given a destination file name, check if it is a directory
If it is a directory, delete it
Copy a source file onto the destination file name
I would like to do this asynchronously using callbacks... |
Here's a perhaps naive but simple implementation of Radix sort in Java.
It works with any radix, and both positive and negative numbers.
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public class RadixSortWithDivision {
public static final int DEFAULT_RAD... |
I've moved my main() to the bottom of the code block in order to fit it all in one class for this submission. Is there a better way to do it?
import java.util.ArrayList;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by Travis on 2/2/2015.
*/
public class Com... |
Just coded up a simple Stack using an Array in Java for practice. Other than the lack of JavaDoc (still need to learn that part), did I cover all the bases?
import java.util.Iterator;
public class ArrayStack<T> implements Iterable<T> {
private T[] stack;
private int top = 0; //Position of the top of the stack... |
This is a Tic Tac Toe game with a "new game" button. I'm after a general review of the code with some tips on how to make it simpler and tidier.
GitHub
HoboChess.java
package sample;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import jav... |
Here is my function which convert linked list in the following order:
Example:
Inputs: 1->2->3->4->5->6->7->8->NULL and k = 3
Output: 3->2->1->6->5->4->8->7->NULL.
void SingleList::orderSort3()
{
// If linked list is empty or there is only one node or two nodes in list
if(getHead() == NULL || getHead()->getNext... |
I'm trying to write code to solve water pouring problem in Clojure. The following code is strongly influenced by Martin Odersky's solution lectured in his coursera course, Functional Programming Principle in Scala. He first created a class Pouring with parameter capacity, which is accessible everywhere in the class. Th... |
I've put some code together that helps me search an internal ticket system using an HTA application with some TextBoxes and some embedded VBScript that runs PowerShell scripts. The PowerShell scripts are hard coded to a certain directory and I was wondering if there's a better way to accomplish this task/goal. I real... |
I coded up a basic DLL for use in a stack or a queue in JavaScript for practice. Coming from a C++/Java background, I basically just converted how I would code it up in one of those. I'm not sure if there's a more JavaScript optimized way of doing it.
function Node(val) {
this.data = val;
this.prev = null;
... |
I am working on an HTML / JavaScript listings template for online auctions. There are two sets of tabbed navigation features in the listing that are driven by JavaScript as well as a dynamic image gallery. Everything appears to be functioning very nicely. The template is fiddled here. (complete project repository here... |
I'm having some difficulty with servlet and filter lifecycles. The intention here is to use the front controller pattern with a simple login; authentication is accomplished with the filter.
Am I passing the auth token in a rational way?
The login.jsp page:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCT... |
The active column in the database only contains a boolean. The country column contains ISO 3166 A2 codes (2 char). Do you have any advice on improving this class?
<?php
class WebShops {
private $database;
public function __construct() {
$this->database = new Database();
}
public function ... |
I wrote a PHP script and was wondering if it was well written or if it could be improved upon to read or run more efficiently, any help or critique would be greatly appreciated.
The file will be placed in cron jobs and run every 15 minutes. The goal is that it will take new customers from a remote MySQL database and ad... |
I really appreciate the way filtering is applied to queries in Django. I have a list of items (each item is an Item instance which contains a few attributes) that I would like to provide a similar API for filtering.
For reference, the Item class contains the following attributes:
Name
Description
Price
Stock
Current... |
Basically my code piece is a sitemap crawler - it opens sitemap, that contains sub-sitemap listings from - to a datespan. It opens sub-sitemap and gets all the URLs (most of them are seourl's, but not all). As sub-sitemap is enumerated all of it's put in list called list2.
Code overview is like:
var dict = list2.ToDic... |
I've finally written my first loop in SCSS, trying to avoid it for quite some time since I thought it was unnecessary (was writing vanilla CSS not so long ago, so I was used to manual work).
However, I feel this code isn't very optimized, especially since I seem to need two different while-loops (one for divs from cent... |
The task is to create a DataTable with 1 column + header and 7 rows with content. The content will never change
Implementation:
private DataTable createTable()
{
var table = new DataTable();
table.Columns.Add(new DataColumn("Wochentage", typeof(string)));// Wochentage=> WeekDays
createR... |
I have an HTLP template file called "template.tmpl". In the template I have a few placeholders like {{NAME}} and {{USERNAME}}. I am then loading the template file into a variable called $template using file_get_contents. I then put the $template variable through a function which deals with replacing a series of placeho... |
I have a WPF application, in which I'd like to bind a collection to a combobox using an asynchronous method :
<ComboBox Margin="2,0,5,0" Width="178" ItemsSource="{Binding Animateur}" DisplayMemberPath="nom" SelectedIndex="0" />
the viewmodel class
_service.GetAnimateur((item, error) =>
{
... |
#include <iostream>
#include <conio.h>
#include <windows.h>
#include <math.h>
using namespace std;
#define RUNS 1000
char z[100000];
int i,j,k,c;
void main(void)
{
DWORD starttime,endtime;
float totaltime;
starttime = GetTickCount();//get start time
for(k=... |
I have stored in a XML file some Travel packages, each package has a code( the codes are stored in an array = $code).
I am using the below code to pull the requested data from the XML based on the given code. At this time I have copy/paste the code for each given code, but I have lots more and I dont want to copy paste... |
I've created this class, for flashing variables like validation errors or success messages. But I'm not certainly sure about it.
<?php
namespace Basalt\Http;
class Flash
{
const MESSAGE_PREFIX = 'flash_';
/**
* Return flashed message.
*
* @param string $name Flash message name.
* @param b... |
I have a function below that does the following uses a bunch of smaller CRUD operations which I call create, retrieve (instead of read), update, delete. Because this function does a bit of everything it can be hard to name it.
Here's a bit about its behavior:
pass in array of redirects (objects with url, and path prop... |
I have the following code at the moment:
public void initialiseButtons() {
this.saveNewButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
savePatientData(actionEvent);
}
});
this.clearFieldsButton.setOnAction(new E... |
I've been learning Java Database Programming for like 2 days, I read theory at first. Now decided to get stuck in. I just wanted a few pointers.
I am using JavaDB (Netbeans Service) should I be using something better? As I've read it has some security flaws.
I split one class to two (as you'll see below), is what I'v... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.