Any input This is a small assignment I have to do for a class. I'm not sure if I'm reading ti correctly to do it right. I'll input what I have at the bottom.
"Goal: This practice assignment requires you to write a eof controlled loop, a counter, an accumulator, and selection structures. Apply wh...
I am new to Hadoop Map reduce Programming. I am trying to learn it with word count example. I am finding the count of specific words in a text file.
import java.io.IOException;
import java.util.*;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.io.*;...
Any time that a row ID (oddly placed in column 8, i.e. row[7]) is repeated after the first instance, I want to write those rows into a second file. The code I'm using is extremely slow -- it's a 40-column CSV with about a million rows. This is what I have:
def in_out_gorbsplit(inf, outf1, outf...
Our Rubberduck open-source VBE add-in project is coming along nicely. One of the main features we're going to be implementing in the next release, is code inspections.
I started by defining an abstraction:
namespace Rubberduck.Inspections
{
/// <summary>
/// An interface that abstracts ...
Hm. *.tiff seems to work everywhere but on my website. And *.tiff is the default for Mac. Guess I'll have to fire up Photoshop or something to convert to PNG. wtf-is-this-shit
my objective is to create a Windows Forms program in C++/CLI using Visual Studio 2012. The program should allow a user to enter a number in a text box, and then button1 click basically manipulates a label and textbox, displaying whether the guess is either too high(cold, blue) or warm(red). For...
I'm a first traveler coding in WinApi, Hooks, COM objects. Then, I made a dll to inject (EasyHook) this in the target SIEMENS Step7 process and modify the software code at runtime:
Maybe I want some opinion about this kind of practices, hooking, injection, file system driver, kernel hook, modify...
This question is for Laravel 4 only, as the relevant parts are completely refactored in the upcoming Laravel 5.
I have written an helper function for validation, so I only have to put this in controllers:
public function postAdd()
{
validate([
'foo' => 'required',
'bar' => '...
import java.util.LinkedList;
import java.util.Queue;
class Node {
public int iData; // data item (key)
public double dData; // data item
public Node leftChild; // this node's left child
public Node rightChild; // this node's right child
public int level;
public void displayNode() // display our...
I'm reading the status of a file and if the first bit in the first byte of the file entry is 0 then the entry is actually available and no file exists so it should be skipped when printing out the directory listing. The string data contains the binary representation of an entire file system.
str...
I wanted to step up my js game, and move on from mostly closure based scripting, so I decided to write an application in node. I don't have much experience with prototype based programming, and I guess it's a little too early for ES6 (well, maybe with traceur).
During planning of my app I saw th...
I'm writing an AdBlocker and it modify browser native to block DHTML effectively, example block Anti-AdBlock.
So I really want to override innerHTML, outerHTML, lenght, width, height using javascript, find a way to get those function arguments[x] to compare, if there is ad words then I will skip...
Here's the problem statement from Minimum Scalar Product
You are given two vectors v1=(x1,x2,...,xn) and v2=(y1,y2,...,yn). The scalar product of these vectors is a single number, calculated as x1y1+x2y2+...+xnyn.
Suppose you are allowed to permute the coordinates of each vector as you wish. ...
I have a question. I need to write a program which will find a prime number, greater than the given n. I wrote the below code, which, I think, works good:
#include <stdio.h>
int isPrime(int n)
{
int i,j=0;
for(i=1; i<=n; i++)
{
if(n%i == 0)
j++;
}
if(j ==...
So i have the following code that reads everything into a single char*, then splits that by line into a array of char* and then lastly converts each line to an int by calling atoi.
(note : This program takes the file to read as a command line parameter, if you want to test the code with text fil...
I'm new to Python 3.4, and trying to make a hangman game with additional features, as required by my course spec.
I was wondering if someone could give this code a quick look, and work out what's happening here.
The initial code ran the word guesses off of a single variable (ie, only 3-4 words)...
I wrote this program, to determine if any given number is happy, and would like to know of any improvements that can be made to make it better. I have tested it, but whether or not it works perfectly I have no idea, there might be some numbers that get through, although I doubt it.
import java.u...
I wrote this program, to determine if any given number is happy, and would like to know of any improvements that can be made to make it better. I have tested it, but whether or not it works perfectly I have no idea, there might be some numbers that get through, although I doubt it.
import java.u...
Theme of my course work in institute is simulation of bus route. Could you determine any faults and defects in this code? I will be very grateful if you give me some advices about one global variable, counters or etc. It's a console version. I have one month to do GUI with help of Qt or Visual C+...
As the first step for writing a Morse code practice program, I thought I'd start with the very simplest step of a text-based Morse code translator. This simple program reads lines from stdin and emits them as a text-based representation of the Morse code equivalent. Any character that doesn't h...
@Amession it is common when teaching beginners because makes it simpler, but it is a bit like avoiding the sex talk to your children because it is difficult. — DavidmhAug 14 at 12:11
@skiwi we're still on using namespace std; no worries
I'm relatively new to NodeJS and express, and I've recently run into the pyramid of doom while doing stuff that requires multiple steps.
I've found that promises are very promising indeed. But I've definitely would love some opinions on various aspects of my approach to routes as a whole.
Here'...
Problem
To figure out if any anagram of the string can be a palindrome or not.
Idea
It relies on two observations.
Frequency of every character in the string is even, if length of the string is even.
Frequency of every character in the string is even except for one character, who frequen...
i need to write a program that reads a sequence of integers and determines if the sequence is alternating.An alternating sequence is a sequence of numbers in which every number should be greater or smaller than the one before it according to the base alternation. for example 1 5 4 8 2 10 is alter...
Natural merge sort is a modification of merge sort that sacrifices O(N) to actually build a list of "runs" that may be defined as monotonically increasing or strictly decreasing contiguous subsequences in the input array. After the run queue is established, the algorithm repeatively pops two runs...
I'm trying to port the constructive solid geometry csg.js http://evanw.github.io/csg.js/ to C# but I have a bug that seem to happend in the Node.ClipTo or Plane.SplitPolygon function but I can't find the problem.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Tex...
I recently got interested in Go and wrote a database server which uses a binary tree for data storage for fun. As I have no prior experience in Go, I'd like to gather a bit feedback on my code and would like to know how I can improve/optimize it. Thanks in advance.
File: BinaryTree.go
package B...
I want to reverse string.
If the string begins with a "'" the whole string should be reversed.
Ex:
"'Hello you"
-> uoy olleH
Hello you
ello you
llo you
lo you
o you
you
you
ou
u
If there's no "'" the string should be reversed word by word. Ex:"Hello you"
-> olleH
Hello
ello
llo
...
Learning Haskell on my own. On lecture 5 of CIS194
I feel I am over-complicating things, and that there should be a succinct way to achieve this - perhaps using concepts I have not learnt - or some prelude function I have missed out on.
Thankful for any pointers on how I can improve (also on t...
I aim to create a few primitives for creating AES256-then-HMACSHA256 secured session state through cookies.
What I've considered:
HMAC instead of plain sha to avoid hash extension attacks
input validation from the programmer
AES in CBC mode, because we're supporting more than 128 bits of data
...
I'm making a code that makes the monster in depends of value "followHunter", follows or run away from hunter. I have written following code. Unfortunately it's long and non-optimed. I feel that there is a way to make it simpler by organising it in procedures and functions but I have no idea how t...
Typeclassopedia presents the following exercise:
One might imagine a variant of the interchange law that says
something about applying a pure function to an effectful argument.
Using the above laws, prove that
pure f <*> x = pure (flip ($)) <*> x <*> pure f
Here's how I understand the ...
I am coding an Objective-C MD5 hash "decrypter". Since you cannot decrypt such a hash function, I am approaching it with a brute force algorithm, that tries every single password combination until it found the correct one or not. I would highly appreciate any help from you guys to improve the alg...
Typeclassopedia presents the following exercise:
Maybe can easily be made an instance of Applicative; writing such an instance is left as >an exercise for the reader.
Here's my implementation:
data Option a = Some a
| None deriving Show
instance Functor Option where
fm...
I am required to convert Farenheit to Celsius using Java GUI.
My code:
package my.tempconvert;
public class TempConvertUI extends javax.swing.JFrame
{
public TempConvertUI()
{
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collaps...
I'm creating a small App and decided to write my own DAO for learning etc.
At the moment its in one big file, which i really don't like. COuld you give me some tips on how:
you would separate this into smaller classes and use abstraction, inheritance etc?
how i can update the CRUD functions(th...
I want to swap each word of a string and print it in a new line, something like:
"Hey guys" ->
yeH
syug
I really don't know how to start, i only print the first word:
void triangle_print(char* output) {
int i = 0;
int j = 0;
j = strlen(output);
for (i = 0; i < j; i += 1) {
printf("%s\n...
public override IDictionary<string, Action<VBE>> GetQuickFixes()
{
return new Dictionary<string, Action<VBE>>
{
{"Replace Rem reserved keyword with single quote.", ReplaceWithSingleQuote},
{"Remove comment.", RemoveComment}
};
}
^^ why didn't I think of that! this is awesome... now gotta think of a way to design a UI for that
I'd have waited till we packed a little bit more features before a first release, but it's fine. The worst that could happen is a lawsuit from JetBrains :)
Well... I know how to get a handle on the code window now, so it shouldn't be too hard to mimic what the dockable window host does to listen for keystrokes.