I attempted to implement a Monoid instance for a function a -> b.
instance Monoid (a -> b) where
mempty f = f
mappend f g = g . f
Please critique it for correctness and style.
In addition, I'm curious how mappend should be implemented. Should f or g be applied first?
I'm in the process of adding network support for a little Mac & Windows game I'm writing. Today I've finished the basic sockets plus a few other network helpers and would appreciate having the code reviewed.
Networking/Sockets.hpp:
#pragma once
#ifdef _WIN32
// Windows, any version:
#i...
ok so im sorry to be asking, however im trying to make it so that when i press z, a portal appears at my Spr_players coordinates, however if one of them already exists, i want it to be erased and im simply wondering what ive done wrong. Again sorry for bothering. (please note that i am a bad prog...
This is my first post. I have to take over an old project that was coded in VS 2010 C# 4.0 recently. Interface programming seems to be all over the place and over-applied to me, but I am unsure if it is that way.
The purpose is to get input from fellow programmers and seniors alike so that I can...
I always forget how to do this efficiently with Vim's arglist. Drawing inspiration from a post over at stackoverflow, I wrote a Bash function to perform a project-wide search & replace.
It does the following:
find files matching a file-pattern
narrow down to those files containing a search-pat...
Not exactly a complete script but still a worthy question
Take the following code for example:
if ($var == 1 || $var == 2 || $var == 3) { // do if true }
Is it possible shorten this, like so:
if ($var == (1|2|3)) { // do if true }
I'm always looking for ways to speed up development and if ...
We get the search string from UI, based on the search parameters we need to create a backend query, this is similar to "Feed Item Query Language(FIQL)". I have wrote the code to find the boolean operators in the search parameters like "||" (or operator) and ";" (And operator). The code is working...
I am creating a netflix-type program and I already have a map class with the form
template <(class keyType, class valueType)>
class Map
I need to create a movie class and I think the movie title and keywords(like type of movie and starring actor) need to be added to the map. I'm thinking I need...
I am able to get the correct outputs on my Ubuntu system but getting run time error when i submit the solution.I am using python3.4 for the same.Here is my source code.
t=int(input())
i=0
while(i!=t):
list=[2]
number=3
counter=0
limit1=int(input(""))
limit=int(input(""))
...
I wrote a little factory to dynamically load assets in angular resolve. I was wondering if it's well structured and if it can be made prettier?
app.factory('loadAssets', function ($q) {
var jsPath = "scripts/",
cssPath = "css/",
imagesPath = "images/",
head = documen...
I need someone's expertise on this exporting problem and I am stuck in this for days. Also I am very new to Maya API so to speak, and have been trying to avoid to touch any-API related in the script.
How it works: Select a camera (animated or not is optional) >> File >> Export Selection >> File ...
@furor it seems you have misunderstood what we define as a code-review. We do not help you understanding code given to you, so you can refactor it or add new features. There is a proposal: "Code Understanding" that fills exactly this gap. Sure your code is reviewable as a CR question, but I don't think that this question will get answers along the lines of what you expect — Vogel61210 secs ago
etl currently has no wiki and three questions. It was mentioned that it may be a rebel tag.
For those that don't know, ETL is an acronym for Extract-Trsnsform-Load and is a term heard often in the database world. The problem I foresee is that you could potentially tag 50% or more of the sql ques...
But the languages are vastly different. The entire display engine is rewritten. Imagine AWT, swing and JavaFX were built into the language... AS1 = AWT, AS2 = swing, AS3 = JavaFX. And everyone has their imports hardcoded. — Pimgd10 secs ago
@Pimgd, you're the domain expert here. I was literally just playing devil's advocate for the sake of discussion. I personally think you made a compelling case. — RubberDuck1 min ago
It's the only language I know that has that much of a rewrite
the other one could be ColdFusion, but there they have cfml and cfscript, which are two different ways of coding. Neither is removed in language version updates, just extended.
NO, it shouldn't exist, not even be a synonym!
c# has major differences between versions, too. And yet, the only C# tag we have is c#. How do we address this?
C# 2.0 introduced generics. Enter the generics tag.
C# 3.0 introduced linq. Enter the linq tag.
C# 4.0 introduced the Task Parallel Li...
It's only simple, but is going to be part of a set of boilerplate files for future web projects, so I'm keen to get some feedback.
I should mention that not all exceptions will be left to this handler - this is for any that fall through the gaps during development. E.g. if my router throws a pag...
Create method named "performAddition()" which takes 3 integer values as input from the user and returns addition of those 3 numbers.
{{{{{ I have done till here }}}}
plz... help me with this part as i am new to java i didn't understand
However, if any of the number is equal to the other one, i...
/************************************************************************/
/*Below this line, implementation not required if wifi is not supported.*/
/************************************************************************/
in the source files?
the methods are all stubs with things like return false
Cause the alternative is adding "Implementation is not required if wifi is not supported." to each function
#include "unabtoCameraInterface.h"
/*Get the supported wifi types of the camera. Combine flags with |.*/
uint8_t getSupportedWifiTypes(){
/*VENDOR-TODO implement.*/
/*0 means no wifi is supported.*/
return 0;
/*Example for supporting all wifi encryptions that have a password:*/
/*return WIFIENCTYPE_WEP | WIFIENCTYPE_WPA_PSK_AES | WIFIENCTYPE_WPA_PSK_TKIP | WIFIENCTYPE_WPA2_PSK_AES | WIFIENCTYPE_WPA2_PSK_TKIP;*/
}
/*Retrieves whether the camera supports Wifi-protected Setup via push button configuration.
I have code for calculating date for orthodox Easter and it makes me cry when I look at "if-else" part. Please give your suggestions on how to make it shine(if possible).
I guess I can format day/month to DateTime format but I'm affraid it'll bring just more mess.
It works just fine though: htt...
similar things have happened to me before including Portal memes (spaaaace) and some internet explorer / firefox advert that had weeeeeeeeeeeee in it or something
If you don't get the reference it just looks silly
Focusing on GetFODepartmentData() method
This method is really hard to read, especially the inner most loop, where you didn't add braces {}.
After extracting the creation of the XmlNamespaceManager object to a separate method
private XmlNamespaceManager GetXmlNamespaceManager(XmlNameTable...
You add value when you upvote, and remove value when you downvote. You also add value when you ask a question, because all positive scores on answers to your question are counted as part of your valueadd.....
if you ask a question, you provide an opportunity for someone else to earn value, votes.
So, people like JavaDeveloper actually add a lot of value. People who vote a lot add value too.
I am populating a dropdown selection with entries from a database table.
Now based on that selection I would like to show other information from the database.
The database table:
TABLE `events` (
`event_id` INT(11) unsigned NOT NULL AUTO_INCREMENT,
`event_title` VARCHAR(255) NOT NULL,
...
I have seen two syntaxes for declaring a code block:
function/if/etc {
...
}
and
function/if/etc
{
...
}
Which version of this syntax is more correct or more closely follows convention?
Does it even matter to people?
I have a group of tests that must be run in similar (but different) fashion and they have setups, results, etc. which are also similar but different. Great, I thought, I'll use interfaces to define these tests and setups. However, I can't implement the setups and results as the specific types, ...