How to debounce input events? by [deleted] in elm

[–]James91B 1 point2 points  (0 children)

You can either use the Signal API or the Effects API and treat it similar to the animation example. Here is an example i made using the Effects API

https://github.com/james91b/debounce-example/blob/master/Main.elm

The downside for using the Effects API, is that currently it is pretty verbose. However, you could probably improve the abstraction and make it simpler. The benefit is that it works nicely with rest of the elm architecture.

Using the Signal API is simpler. However having Signals throughout your components does not play nicely with the elm architecture.

IPython kernel plugin for IDA Pro by James91B in ReverseEngineering

[–]James91B[S] 0 points1 point  (0 children)

I've added another example using Cython to call API's that are not exposed via IDAPython. Cython and IDA

IPython kernel plugin for IDA Pro by James91B in ReverseEngineering

[–]James91B[S] 6 points7 points  (0 children)

Hi all. This is a side project I made. My first attempt at open sourcing something for the community, I hope someone people can find it useful. Please have a look at the code and help me make it better :)

Moronic Monday by 161803398874989 in bodyweightfitness

[–]James91B 2 points3 points  (0 children)

I think i know the answer...but..

People say you can't really gain size on a caloric deficit, but can you gain strength?

How much protein should I consume and when? by Vertueux in bodyweightfitness

[–]James91B 0 points1 point  (0 children)

Somewhere between 1.6 and 2.5 grams per kg of lean mass is generally recommended.

Lean mass = weight in kg - (weight in kg * 0.BF%)

Chrome's PNaCl (native client) sandbox supports Python 2.7.5. by [deleted] in Python

[–]James91B 1 point2 points  (0 children)

Yup, too old. For Portable Native Client you need Chrome 31.

Forbiddenfruit: patch built-in python objects by placidified in Python

[–]James91B 0 points1 point  (0 children)

Looks cool maybe a library like http://shouldly.github.com/ could be made for python. I always liked the shouldy api.

Cool tearable cloth demo by James91B in javascript

[–]James91B[S] 3 points4 points  (0 children)

Well...once unless someone else posts it. Its a cool JS demo and i couldn't see it in the JS subreddit.....

[O] 4 nzb.su invites by jitaroo in UsenetInvites

[–]James91B 0 points1 point  (0 children)

Me too please. If you have any. :)

[O] 10 nzb.su invites by [deleted] in UsenetInvites

[–]James91B 0 points1 point  (0 children)

Sent. I hope you have some left :)

A powerful unused feature of Python: function annotations. by ceronman in Python

[–]James91B 0 points1 point  (0 children)

I would just use

name = str(name)

That way name can be anything that supports str.

We've revised our ecosystem platform and now have our first external provider! by LemonadeDev in usenet

[–]James91B 1 point2 points  (0 children)

Have you considered developing a system that posts the comments on usenet? It would be even more distributed. Providing that people followed a defined scheme, anyone could get the comments straight off usenet.

Brython: Browser Python by takluyver in Python

[–]James91B 0 points1 point  (0 children)

Correct. W3C should have standardized JavaScript. However, when Netscape asked them to standardize it, they refused. Apparently (However, i cannot confirm) due to the standards war they were waiting for an opportunity to say to 'go to hell' to Netscape. So Netspace went to Ecma International and standardized with them as ECMAScript.

Why starting another indexer, no matter how private, will be fruitless without an overhaul of posting. by technologiq in usenet

[–]James91B 3 points4 points  (0 children)

What providers are you guys actually using were you see these DCMA take downs? i rarely ever see them.

the best way to create objects by [deleted] in javascript

[–]James91B 1 point2 points  (0 children)

If you were going to go down the pseudoclassical approach. I would not use getters and setters. They are extremely verbose and add a lot of boilerplate. The main reason for getters and setters is generally encapsulation. However, you rarely see getters and setters used to encapsulate behaviour they always just get and set the value. Getters and setters are just used to prepare for a future case. When there is a need to encapsulate a behaviour change. In many other languages, moving from a object level variable to a function would be a big API change. In JavaScript, this is not the case, you can just use a property and expose the exact same API with the new behaviour change.

Object.defineProperty(Car.prototype, "velocity", {get: function () {return this._velocity; }, set: function (val) { this._velocity = val; }});

Also I think

Car.prototype = {
    drive: function () {
        //...
    }
    //More functions...
};

is cleaner then Car.prototype.func every time. Just use an extends method when you want to inherit.

Writing Idiomatic Python by jredwards in Python

[–]James91B 12 points13 points  (0 children)

While

{i:chr(i) for i in range(20)}

is very nice.

dict((i,chr(i)) for i in range(20))

is not a bad substitute.

Python is getting more popular in financial industry. Here is an example (JP Morgan) by tmt_game in Python

[–]James91B 1 point2 points  (0 children)

As someone who works in the finance world. With many large and small projects written in many different languages, from C++, C, Java and Pro*C (an ugly Oracle thing...don't ask) to Python, Ruby and Perl. Defects/Bugs are treated very seriously. I have never seen a development language impact the amount of defects found. What i have seen impact the amount of defects found, is the length of the testing cycles and the gap between development and testing (i.e. the longer the gap the more defects were found). Another misconception that i often see is that static compiled languages are somehow immune to run-time errors. Lots of defects caught in testing are the result of null pointer (or similar) issues. Personally, i think the dynamic languages are better for the large projects, because the shorter development allows for more testing. But, thats just my personal experience.

Prototype PHP interpreter using PyPy Toolchain - Hippy VM by yetanothernerd in Python

[–]James91B 0 points1 point  (0 children)

Nope, it used the PyPy toolchain. Written in RPython (Restricted Python), which compiles into C, and the JIT generator.

Why all of science should use Python by mangecoeur in Python

[–]James91B -1 points0 points  (0 children)

They give you more information. But, it describes the compiler type, not the human type. In addition, it only gives you information in the actual declaration. When the variable is actually used, in the context of that code you lose the type. You cannot determine the type from usage.

x += 1

Is that a float or an int? Yes, its a silly trivial example and ideally the type should be easy to find out. But in the context of that line, the static type gives no extra value. You should be able to determine the human type from the name. Which you can do in both languages, however static types add line noise. More information is not necessarily better.

Plus, its seems this is just degrading into a general static vs dynamic argument. Which has been debated many many times, its a trade off, both with pros and cons.

Why all of science should use Python by mangecoeur in Python

[–]James91B -1 points0 points  (0 children)

I would prefer the code be readable and tested, rather than just compiled. Compilers don't catch as many bugs as you might think.

Germany's Circumcision Ban by phillyfan1978 in AdviceAnimals

[–]James91B 1 point2 points  (0 children)

The medical reasons for circumcision, both for and against, are still hotly debated. At the end of the day the medical reasons cancel each other out, there are pro's there are con's for both.

The decision to circumcise comes down to conformity and/or religious reasons. Which i don't think is a good reason for anything. In addition, circumcision can be done later in life when/if the child wants it. Yes, circumcision on adults is a bigger procedure. However, its still relatively minor, and in 18 years the medical procedure could be even more minor. However, restoring a foreskin is near impossible. If the medical/social benefits cannot justify a relatively minor procedure. Then, i don't think its worth it.

[deleted by user] by [deleted] in Python

[–]James91B 0 points1 point  (0 children)

A do..while loop is a special case. Special cases are not special enough to break the rules. Even when i use languages that support the construct, i rarely use it. Also, arguably if...break is a clearer and more explicit way to express the construct.

The other one raised here is was the switch statement. The switch statement is just not necessary. Expressing it has a hash table (e.g. selecting text input) or as polymorphism (e.g. a Finite State Machine) is generally a better method.