Give Python a try. It's simple and readable enough that anyone can pick it up, yet powerful enough for whole businesses to rely on it.
Python.org if you're interested, and if you're looking for a fun way to learn (i.e not through reading gigantic, often dense textbooks), try the Python Challenge.
I would suggest something like https://scratch.mit.edu/ it uses drag and drop blocks and is very easy to undestand. They even have tutorials right on the site, this is where a lot of kids and sometimes even adults have started making simple projects that introduce them to programming. I have seen some books that help teach scratch however I have never used/read any of them so I wouldn't know how good they are.
Have fun!
I'd recommend starting with basic JavaScript before upgrading to TypeScript.
r/learnjavascript+typescript
https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html
Basically it doesn't have generics which means you have to do a lot of fuckery with interfaces to get to a level of abstraction that you get with generics. And it's still not really possible. You end up with a lot of duplicated code for compatibility with different types.
Best example is https://golang.org/pkg/sync/atomic/ the atomic package used for asynchronous arithmetic.
You have AddInt32, AddInt64, AddUint32....
https://scratch.mit.edu/projects/465992973/fullscreen/
WASD for move, SPACE for super, MOUSE for aim, E for gadget "extra credit"
Unfortunately, you can't gain your HP yourself with just not attacking. You have to get green potion to gain your HP. Once you get it, it will give 1000 HP
>The programming language that empowers everyone to become a systems programmer.
>everyone to become a systems programmer.
Umm, am I the only one who thinks this is overly dramatic? Look at D's website
It's modern, yet not full of overwhelming colors or styling, doesn't turn you into a systems programmer, conveys just enough information.
IDK, maybe I'm getting old.
I don't like Go either. That said, I have some feedback for the author. Meta: please timestamp blog posts, at least the month and year–in this case February 2018.
Anyway...
> Rob's resistance to the idea has successfully kept Go's official site and docs highlighting-free as of this writing.
This is mostly true but the Go Tour does have optional syntax highlighting.
> Java can now emit this warning for switches over enum types. Other languages - including ... Elixir ... similarly warn where possible.
Elixir doesn't actually. It's a dynamically-typed language and it doesn't do exhaustivity checking.
> higher-order functions that generalize across more than a single concrete type,
I believe the author is referring to parametrically polymorphic functions. Higher-order functions are ones that accept and/or return functions, and Go has first-class functions so it follows it has HOFs as well, e.g. https://golang.org/doc/codewalk/functions/
> the Go team's response of "vendor everything" amounts to refusing to help developers communicate with one another about their code. ... I can respect the position the Go team has taken, which is that it's not their problem,
Actually, I don't think that's it. Go's primary 'client' is Google, and Google source code famously vendors everything. Go is designed from the ground up to enable that strategy. Its suitability to others is a secondary consideration.
> The use of a single monolithic path for all sources makes version conflicts between dependencies nearly unavoidable. ... Again, the Go team's "not our problem" response is disappointing and frustrating.
But again funnily, it's perfectly suited for Google's monorepo.
> Go has no tuples
True, but it does have multiple return values, which is a use case for tuples. This specialization can be considered good or bad (imho, bad).
This is not right! There are no arrays in lua.
Code like this would be completely valid
local t = { }
for i = 0, 2, 1 do t[i] = i end
And you would have your "array" t
start at 0.
Although, as stated by the lua.org page, "arrays" in lua are allowed to start at any index they want, but guess why, it's because they are not arrays, they are tables
Financial costs aside, adding classes to students' schedules requires removing other classes, unless you're advocating for longer school days. Same goes for school size. Would you recommend that something be replaced, or leave it to parents to decide?
>Even if the programming is more centered around seeing the effects of basic functions like using Scratch (https://scratch.mit.edu/), this sort of practice will greatly benefit future generations in whichever career path they go down.
Yes and no. Building logic is certainly necessary for learning minds, but arithmetic and pre-algebra already exist, and not only have these goals in mind, but are also much more applicable to real-world situations.
Also if things like try(bar(try(foo(try(baz()))))
are proposed by the Go team member(s), the "Control flow" section of the FAQ should be adjusted or deleted. It says
> Why does Go not have the ?: operator? > > There is no ternary testing operation in Go. You may use the following to achieve the same result: > if expr { n = trueVal } else { n = falseVal }
> The reason ?: is absent from Go is that the language's designers had seen the operation used too often to create > impenetrably complex expressions. The if-else form, although longer, is unquestionably clearer. A language needs > only one conditional control flow construct.
(emphasizes mine)
They're doing the same in schools in Europe as Biden is proposing here, lots of coding from age 8 upwards.
The problem is that learning to code in Scratch is a limited knowledge. What they should be teaching is the fundamental skills that allow people to go into all sorts of professions.
Teach logic, problem solving, mathematics, actual languages and their syntax (word groups etc), basics of how computers work (Charles Petzold's book Code is a fascinating read about how we got from analog comms like telegrams to digital computers and it removes the mystery of 'computers as magical items from D&D').
Teach them how to do the things that are behind coding, chemistry, physics etc and let them choose a path. Teaching everyone how to code won't solve much in the long term.
It's a totally valid option in some languages and for some semantics. It's among Kotlin's official idioms, for example.
On this occasion I have to say that despite that this is Rasmus we're talking about, I still believe there is a bug - although it may just be a documentation bug.
The documentation mentions nothing about undefined behaviour, a warning, notice or error being issued when a non-numeric value is passed to this function. In this case, one would expect, given PHP's type juggling behaviour, that the normal rules about implicit conversion to float should apply, and a non-numeric value should convert to float as 0.0. Any departure from the normal type-juggling rules is normally noted in the documentation with a notice saying that you may encounter "undefined behaviour" if you supply a certain type. There isn't such a warning in the documentation (there may be a PHP warning issued, I don't know - but this is normally mentioned in the documentation too).
The documentation also mentions nothing about the return value being anything other than a formatted string at any time.
If returning NULL to some requests is the correct behaviour this should be documented, by swapping this:
> Return Values A formatted version of number.
with this:
> Return Values A formatted version of number, or NULL if $number was non-numeric.
> string strtolower ( string $string )
> Returns string with all alphabetic characters converted to lowercase.
> Note that 'alphabetic' is determined by the current locale. This means that e.g. in the default "C" locale, characters such as umlaut-A (Ä) will not be converted.
Was this written before mb_strtolower()
was available, or was the developer simply unaware of it?
In any case, this is a beautiful and compact example of the weirdness of PHP. Even in this short sample, things like the unpredictable naming of standard functions are clearly visible (i.e. why not str_to_lower()
and strreplace()
?).
I would recommend no namespaces and write code with the ES6 module system.
Until everything updates to ES6 modules, resolution is going to continue being a pain in the ass. Best practice right now is to compile ES6 modules to commonjs modules.
https://www.typescriptlang.org/docs/handbook/modules.html
Edit: I didn't know for a long time that you can still do commonjs imports while still using the ES6 system like this:
import foo = require('bar');
It will never be possible for a translator like this to be truly faithful to the language. Because of TypeScript’s intentional unsoundness, there’s always a possibility that a variable typed as number
is actually a string. Hence a faithful C++ translation would be forced to store it in a tagged union of all possible JS types rather than a simple double
.
For reference:
Golang's reference time for formatting is "Mon Jan 2 15:04:05 MST 2006" or "01/02 03:04:05PM '06 -0700"
Internally time is: > The zero value of type Time is January 1, year 1, 00:00:00.000000000 UTC.
It is possible. Each of the individual steps are doable.
It's just an if/else. If you can find out the IP range to compare to the IP we get with $_SERVER['REMOTE_ADDR'], you've got yourself a working "reverse hellban".
You're just wasting multiple hours arguing about something that no one in the entire world will ever be able to trust, and is bug ridden with undefined behaviors by default. I don't trust any OS written with a single line of c/c++ language without having undefined behaviors or nasty bugs. But instead of criticizing OSX, I'm gonna do you a favor. You'll be wasting countless more hours of your life on such shitty dying languages with no future and no users so leave them and let me introduce you to a new language -
a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety.
When you rewrite OSX in a better language, I'll award you with a github star! Also, don't f*ck around with your security kid, learn for your future :)
~~Why not just use <code>json_encode</code>?~~
Note to self, don't start writing a comment on /r/shittyprogramming before you've read the whole comment your commenting on... *facepalm*
Go doesn't have type casts the way C does; instead, we have type conversions and type assertions, and you need to choose the one that's right for the situation. (Both would be a cast in C)
Conversions ask the compiler to change the representation of one value into another. For example, truncating a float32 into an int. This is required whenever the underlying types are different, or if the types have different names but the same underlying type. This is generally pretty performant, with the exception of converting between byte slice and string, which incurs an allocation and copy, which can be quite costly.
What you are using here, though, is a type assertion, which is required when you have an interface but need to pull out the concrete type from it (or check if it matches a different / broader interface). For a concrete type check, this is pretty fast, because an interface is basically a type pointer and a value pointer, so you can think of it like a conditional... If the type pointer matches, extract the value.
So, could this be slow? Yes, but generally your latency to your user and/or the database will be much larger, so unless you are doing it millions or billions of times, there are probably other things which can be optimized first if you find it is getting slow.
Cleaner syntax with less baggage, quirks, and boilerplate. There are plenty of articles around contrasting the two. The official site is a good place to start.
LUA? What's LUA? I only know of Lua.
> "Lua" (pronounced LOO-ah) means "Moon" in Portuguese. As such, it is neither an acronym nor an abbreviation, but a noun. More specifically, "Lua" is a name, the name of the Earth's moon and the name of the language. Like most names, it should be written in lower case with an initial capital, that is, "Lua". Please do not write it as "LUA", which is both ugly and confusing, because then it becomes an acronym with different meanings for different people. So, please, write "Lua" right!
The idea that buffer overflow problems can be fixed with better programmers is completely unworkable. The best programmers in the business write buffer overflow bugs - because they're human, and people make mistakes, and software is complicated. Mechanical checking is the solution.
The problem is fixable in C, but nobody in the C community seems interested in it.
If you're fed up with the problem, you can always try DasBetterC.
Don't start with Java for an 11 year old.
Start with <strong>Scratch</strong> - a graphical programming system specifically designed by the MIT to teach kids programming. You can use <strong>Scratch Playground</strong> as a learning resource (free to read online). The graphical nature of Scratch makes it very easy to grasp the fundamental concepts like loops, conditionals, variables, program flow, etc. Also, it is really fun to work with. Scratch is simply the very best introduction to programming in existence.
Other than that, head over to /r/programmingforkids for more inspiration and insights. This subreddit is specifically for teaching kids programming.
No matter what she learns, make sure that she has fun and instant rewards (another plus for Scratch).
I first ran across this issue 4 years ago with the function in_array which you need to set the strict parameter to avoid this issue.
Due to PHP converting the two values to floats before the comparison you can have a large discrepancy between two values.
For example: '9223372036854775296' == '9223372036854776832' is true.
Comparing any two values between the two above are also equal. That is 1536 numbers which evaluate to being equal.
> > higher-order functions that generalize across more than a single concrete type, > > I believe the author is referring to parametrically polymorphic functions. Higher-order functions are ones that accept and/or return functions, and Go has first-class functions so it follows it has HOFs as well, e.g. https://golang.org/doc/codewalk/functions/
I think the author was referring to HOFs, but the "generalize across more than a single type" part was meant as an additional qualifier, not as a description of what "higher-order function" means. That is, yes, Go may have some HOFs, but it doesn't have HOFs that work with multiple types. Specifically it doesn't have map
, filter
or fold
, which I believe many would consider the quintessential HOFs.
If you don't care about branding, that's totally fine: ignore this and go back to writing awesome Go programs. If you're already using Go, you're probably not the target audience for this, and that's 100% OK.
Beware knee-jerk negative reactions. It's always easy to be a quick critic. It takes more time to absorb something new and different and give it a fair evaluation. The fact (like it or not) is that branding and a professional look will help with not turning away other Go developers, not to mention the people they have to convince to let them use Go at work. Replacing the 1995-esque web design we've been using (which was mostly my doing) is a positive thing for more Go adoption, which grows the Go community and helps everyone.
Also, in case everyone forgot, this was the old Go logo: https://golang.org/doc/go-logo-white.png. The new one captures the same spirit but ends up being a bit more versatile.
It's so retarded because almost everything in the nomenclature will sound offensive out of context. Parent-child is especially fun:
Make a parent kill its children
Send a signal to hang child up
Dispose of children
EDIT: Found a real example of this while working on my project: https://dlang.org/phobos/std_ascii.html#.isWhite
It's a feature that allows you to seperate query logic from query data. I.e. mysql knows that the :id in where id=:id is just data, it will not parse anything contained in this data. See here
PNG/JPG files can be generated automatically, on-demand (for example, using PHP - see http://php.net/manual/en/image.examples-png.php).
Contents (including text) can be easily set using variables available to PHP script during execution.
Your IP, browser info and OS are sent to the server during load request, so they are also available to developer. They can be used to generate any image file and served back as JPG/PNG file.
Once generated, JPG/PNG file obviously can't modify itself - it will remain static. So if you download it, it won't change. You will probably see changes when you refresh that page, because JPG will get regenerated.
The race condition is interesting but only so far as it wastes disk space. The biggest problem here is that people continue to accept filenames from the client.
In almost all languages, including PHP, you're able able to accept the incoming file(s) being uploaded and turn them into a stream which you can then check (e.g. does the first block contain the expected bytes) and then save as a filename of your choosing (e.g. UID + extension based on opening byte sequence).
Allowing someone to save a file as .htaccess is the exploit here, not the race condition.
SSA for all architectures, not just amd64. This is a huge win for ARM, since ARM isn't good at executing bad code like x86 is.
More SSA optimizations, and better generated code in general.
New, faster compiler frontend parser.
The compiler frontend can start assuming an SSA backend, and do less work for the backend, which will actually make the backend faster too. One recent example: https://go-review.googlesource.com/27461 and
Smaller binaries. e.g. https://golang.org/cl/26668
Crawshaw is working on the "plugin" execution mode.
Bunch of TLS updates.
Who knows. It's still early days. But SSA everywhere is the main theme.
>At this point, I can see zero reasons why anyone would choose PHP or MySQL over, say, Python and PostgreSQL.
Ubiquity?
>[Python] has more libraries.
Debatable. It might have better package management than PHP's PEAR and PECL offer, but that doesn't mean there's more functionality available.
>There are several well-established frameworks of varying complexity/configurability for doing web programming in Python.
The very same can be said of PHP, and probably to a greater extent.
>Oh, and if you learn Python, that's a skill that transfers beyond web development.
The same can also be said of PHP.
in PHP: http://php.net/manual/en/language.operators.comparison.php
= is used for definition
$a == $b Equal TRUE if $a is equal to $b after type juggling.
$a === $b Identical TRUE if $a is equal to $b, and they are of the same type.
it's a joke that ==== becomes a thing
You are probably running this on Windows, which has a maximum rand() value of 32767, which means every 32768 tries will repeat the entire deterministic pattern of rand().
And to answer your question, rand() is certainly not "random" in any cryptographical or even useful sense.
There was a number of reasons, among which is the ability to create functions that look like custom language constructs, this way we have synchronized
as a function, and not a built-in keyword:
synchronized(lock) {
// do something
}
or with
:
with(foo) {
print(propOfFoo)
funOfFoo()
}
It also enables type-safe builders
I think that is due to the fact, that the # operator is more like a max index operator, than a length operator http://i.imgur.com/HdRBm8p.png
what I don't really understand is the last one though
edit: from https://www.lua.org/manual/5.1/manual.html#2.5.5
"The length of a table t is defined to be any integer index n such that t[n] is not nil and t[n+1] is nil"
so it is like the "max index"
Edit2: added "like" to the last statement.
Not necessarily. I have no problems reading it when it's formatted like this:
thing = (conditionA) ? A : (conditionB) ? B : C;
This all assumes you're not using something shitty like PHP with it's left associativity.
You can accomplish this with the new template literal type support in TS. Be warned, though... it'll probably be more annoying than useful.
Here's an example with valid IDs containing a, b, or c and of length 5. Change Char
and ID
to adjust those parameters.
type Char = "a" | "b" | "c"
type ID = ${Char}${Char}${Char}${Char}${Char}
// fails const id1: ID = "abcde" // d and e aren't valid const id2: ID = "ab" // wrong # of letters
// passes const id3: ID = "abaaa" const id4: ID = "ababc"
Glad you're having fun!
We're working on IDEs: https://www.rust-lang.org/ides.html
If you're not actually using SSL, because you have the Rust app behind some sort of terminating proxy, you can turn it off with a feature, I think. A Rust SSL implementation might be even better, though obviously, you want these kinds of things to be battle-tested... only one way to get there!
Cross-platform GUI is hard. :)
I started this on the Scratch forum, which is a platform for children and thererore has a very strict language policy. I then subconsciously abbrivated 'Brainfuck' even on places where I hadn't to.
lua is a good language, not for it's feature set, but because it can easily be embedded. https://www.lua.org/ddj.html
this means that you can deploy a statically linked binary, and still have the option for a dynamic runtime. I often wondered why I saw lua everywhere, and this is why.
> We laid out an actionable plan for advertising our success stories, including a specific direction for whitepapers and our blog. Thanks, @carols10cents and @shepmaster, for helping us figure out how to make Rust "boring" in the way that companies want!
Particularly excited about this. I've personally had a hard time selling Rust as a viable solution at work because of this. Friends of Rust has been a great start, but there is more work we can do on this front to make it easier for us to convince tech leads that Rust is something they can bet confidently on.
> In searching for case studies all I've found
There's also https://www.rust-lang.org/friends.html
> mozilla only feels comfortable using a few lines of rust in firefox so far.
The way that this is phrased implies some sort of lack of confidence in Rust, but it's not that: it's that changing things in a codebase that's millions of lines long takes time.
> While I'd like to ask why Rust has yet to see serious adoption despite Go and Swift seeing significant uptake, that's the wrong question.
Go has been stable for four years, Swift is pretty much the native language of a platform. Rust has only been stable for a year.
You can write it like this:
jdbcClient.update(sql) { queryResult ->
if(queryResult.failed()) {
}
}
In Kotlin, there is a convention that if the last parameter of a function accepts a function, a lambda expression that is passed as the corresponding argument can be placed outside the parentheses.
If the lambda is the only argument to that call, the parentheses can be omitted entirely.
Worth noting that GHC Haskell has:
Although the project leaders happen to be Google employees that are paid to work on Go, it is not a Google product and the title makes it sound like the decisions of the Go team are driven by Google executives.
The only control Google has over Go is that they own employee copyrights, so they have partial ownership of the code: https://golang.org/AUTHORS
Background: As a kid, Jake used to come up with these imaginative "choose your own adventure" type games in his mind, then have me play along. He would describe a setting, I would have to try to solve my way out of the puzzle using resources he described.
He called them "Cupcake Adventures", and the reward at the end of everyone was finding the cupcake. Really fun, and really bonding times with him.
Fast forward, Jake found a programming website called Scratch, and decided to try to program one of these Cupcake Adventures.
This is his first attempt. See if you can solve it, and find the elusive cupcake!
https://scratch.mit.edu/projects/471904241/
PS it helps if you start by clicking the "Maximize screen" icon.
From that stack overflow link,
>The documentation isn't as good as languages like PHP and Java that have strong corporate backings...
Wow. No. PHP documentation sucks big time. For eg want to know about exception handling in php? This is all the documentation has to say about it. Try to find out how a return statement inside a finally block behaves in php (Hint: It is in comments).
Also, I have been told by a php core developer (a programming student, actually), that PHP documentation is wrong even regarding the most basic of stuff. The argument was regarding what consist of a valid integer literal in php, I showed the person the pattern from documentation and the response was that it was actually wrong and it does not match with the code!
> Caution The distribution of mt_rand() return values is biased towards even numbers on 64-bit builds of PHP when max is beyond 2^32. This is because if max is greater than the value returned by mt_getrandmax(), the output of the random number generator must be scaled up.
> Caution This function does not generate cryptographically secure values, and should not be used for cryptographic purposes. If you need a cryptographically secure value, consider using random_int(), random_bytes(), or openssl_random_pseudo_bytes() instead.
Here's how you use a priority queue in Go:
1.) Go to https://golang.org/pkg/container/heap/#example__priorityQueue and copy paste the code so you can use the standard library.
2.) Start using the heap interface and pointers to your queue to get things started.
3.) Get frustrated with interface{}
and the heap api so try and implement a "type safe" wrapper specialized to your queue.
4.) Realize you need to do it again for your next item type.
5.) Start refreshing your resume
D isn't a bad language, but it's not been adopted very much, even after several years. A more promising alternative is Rust, which is a memory-safe systems programming language that probably covers a lot of similar use-cases.
Rust is quite difficult to learn at first, though, and I wouldn't recommend it as a first language, but it's a joy to use once you understand it a bit more.
The variable-declaration style shown in this article is this:
val x : Int
This is not the officially recommended style. The following is recommended:
val x: Int
Edit: After I posted this comment, the page was updated to match the recommended style.
>How is information hiding implemented in ES6
it's possible, but idiomatically, information hiding isn't really a big deal in js and i don't think it's worth the trouble. having said that, create a closure inside a scope that is inaccessible outside the scope:
const privateFunction = () => { return ' heh'; }; const privateMember = 'heh';
export default class Foo { public publicFunction() { return privateMember + privateFunction(); // closure inaccessible to code using class Foo } }
I answered your first question before I read your second and third question.
Yeah, definitely use TypeScript. It's pretty close to what you're looking for. You may not be be following the exact same route when architecting code, but you'll wind up in nearly the same place. I also used AS3 and also thought it was a pretty good look into what ecma could be, and I think TypeScript is fantastic for communicating contracts and adding stronger enforcement. It will never be quite as powerful for architecting as a statically typed language, but it takes JavaScript and elevates it to about 90% of the way there, which is good enough in my experience.
Scratch is a "visual programming language" developed by MIT and is a great way to get kids thinking the way a programmer thinks by making small animations and even games. It's worth checking out and easily age appropriate for a 9 year old.
Also, forget sharing something if your project is reasonably complicated- literally everyone will start complaining about how it doesn't run on their extremely weak and slow school-loaned chromebook (speaking from experience...).
Scratch is fun and all, but you have to keep in mind that like 95% of the community is <13, and it's probably better to move on once you've gotten past that...
It isn't a functional vs imperative debate. It is a complexity vs. simplicity debate. You've structured your argument as:
Go takes a different route. Adding more to a language makes it easier to do some things, but it also makes the language more complicated. There is a tragedy of the commons problem that shows up at the end of that road, where you have every language feature that anyone can stuff in. The devs have drawn a line, an opinionated, arbitrary line, and said they don't want to add every feature, and they have decided on a case by case basis.
I have to respect them for it, and I suspect that over time more people will appreciate it. Saying that they have a duty to programmers everywhere to add generics is narcissism masquerading as altruism. They don't have to do things your way.
I use go because I am completely fed up with languages with feature-itis. I don't want generics, and macros, and annotations, and derived types, and tons of stuff going on behind the scenes that I don't entirely know about. I want to know exactly what's going to happen when I program. I don't want magic, I want logic.
Also, rsc has a short article about the issues with generics here. I don't see anything that you wrote that addresses it.
Have you heard about our lord an saviour Rust?
This would be the equivalent of your snippet:
fn http_call() -> (i32, String){ println!("This is a fake http call"); (200, "Ok".to_string()) }
fn main() { let (code, msg) = http_call(); println!("Code = {}, msg = {}", code, msg); }
Featuring:
Strict typing (with type inference, so you often don't need to specify types explicitly).
[Trait-based] Generics
Sane package management
Tuples
And also: zero-cost abstractions, move semantics, guaranteed memory safety, threads without data races, pattern matching, minimal runtime, efficient C bindings
P.s.: We are absolutely not a cult.
Before you commit to Dart maybe check out TypeScript. You get most of the benefits of Dart but with a much larger community, better tooling, tons of libraries, much better JS interop, etc.
$value = filter_var($value, FILTER_SANITIZE_STRING);
To verify that it is a certain type, use the Validate filters from the second link.
You could probably do it with an absolutely ABSURD walk rate, since rookie eligibility only counts "at bats." 48-for-125 with 105 walks, 10 HBP, 15 2B, 1 3B, 10 HR and 30 RBI would be slash line of .384/.679/.760, an OPS of 1.439 and an OPS+ of 297 (using this OPS+ calculator that uses 2010-2016 numbers).
All of that, and still be eligible for RotY the next year even though you had 240 plate appearances.
Edit: I fucked my numbers up, edits in bold.
Obligatory example:
12:32:31 a@link ~ ~/ghc-head/bin/ghci GHCi, version 7.3.20110921: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Prelude> :set -XConstraintKinds Prelude> type Stringy a = (Read a, Show a) Prelude> :i Stringy type Stringy a = (Read a, Show a) -- Defined at <interactive>:1:6 Prelude> :k Stringy Stringy :: * -> Constraint Prelude> :{ Prelude| data Bit = T Prelude| | F Prelude| deriving (Show, Eq) Prelude| :} Prelude> :t T T :: Bit Prelude> :k Bit Bit :: * Prelude> :i Bit data Bit = T | F -- Defined at <interactive>:1:6 instance Eq Bit -- Defined at <interactive>:3:26 instance Show Bit -- Defined at <interactive>:3:20 Prelude> :show bindings type Stringy a = (Read a, Show a) data Bit = T | F instance Eq Bit instance Show Bit Prelude>
Usually the truth lies somewhere between two opposing opinions. Based on the conversation between GNOME and System76 on this subreddit they are at least trying to be professional. That being said, if misinformation was spread, a retraction and apology is NEEDED. If not from Jeremy, then from System76. Especially in this day and age where we should all be keenly aware of the negative impact of misinformation.
I also think it's a bit ironic (assuming bad behaviour occurred) that System76 will be building a new desktop environment using RUST; the language that has prospered under their Code of Conduct.
I say this all while running Pop!_OS on my main rig.
Because there is some understandable confusion regarding the role that the foundation plays, please note that the foundation doesn't design the language or determine what gets into it. The design of Rust (the language, the stdlib, the tools, etc.) is determined by the respective teams (listed at https://www.rust-lang.org/governance/ ). All moderate-to-major changes to an area of Rust must be approved by a near-unanimous vote by the members of relevant team ("near-unanimous" in the sense that members who are absent for a long time without casting a vote can be ignored), and the foundation doesn't have any say on team membership.
I saw this game on here and figured I could modify my version of Lunar Lander to make this.
^(Check out /r/Scratch by the way, there's not a lot of us)
EDIT: A lot of people have been asking about the global time records in Lunar Lander. Since something like 99.99% of you don't have a Scratch account, they won't work for you since they rely on Cloud variables, which can only be used when you're logged in to Scratch.
Okay guys check out this site. An MIT site with a user by the same username (unscrambled_eggs), and their is a comment at the bottom that is similarly random characters. Coincidence? Or could it be the same person? https://scratch.mit.edu/users/unscrambled_eggs/
This is indeed quite cool!
SQL injection was a big thing back in the day - to protect yourself though, you literally just need to use mysqli_real_escape_string or an equivalent function when passing variables to SQL queries - while it is true that some people still make the mistake of not using this function, I'm curious how prevalent it is.
Golang competes in the Java/C# space, not the C/C++/Rust space. It has a garbage collector. It abstracts things away from you. Even stack allocation isn't explicit. Its concurrency model is nice, but isn't as performant as raw threads can be since the runtime scheduler isn't free (this is why Rust got rid of its green threads implementation early on).
The consensus across the Go community is to use the net/http.
The standard library already offers a good set of features that you can leverage and extend by yourself. Some times. The most common approach is to include specialized packages as middleware to provide cache, routes, authentication, etc and avoid convoluted frameworks from early development. If you search the same question on the Internet and/or ask professional Go developers, you will get, most of the time, a similar answer.
Tweaking the GOGC
variable doesn't seem like the most prudent solution here. Not to mention it's a one dimensional knob, and another part of your code might work better with a different number so now you have to choose what part you're optimizing for.
Seems to me it'd be better to use object pooling in the specific instances where you know you're going to use a bunch of objects for short periods of times. Go comes with a simple implementation in the standard library.
Not only is it bad, but it has been deprecated since 5.3 and is removed since 5.4.
>What does this do exactly?
Register globals places data submitted by the user into variables, which may affect your code.
Take the following code for example:
if (is_user_authenticated()) { $authorized = true; }
if ($authorized) { //grant admin rights }
now assume you got register globals turned on and visit the following URL:
http://domain.com/admin.php?authorized=1
The data submitted in the query string will populate variables matching the names of the fields in the query string, meaning that the $authorized variable will be set to "1" without ever needing to pass through authentication, and the user will thus have access to administration privileges.
> How do I salvage my scripts and "fix" it?
I suggest you read through the following:
Just a few off the top of my head:
But yeah, PHP7 is basically a version that is making great strides to fix what was broken with PHP.
Here's my crappy implementation in Haskell:
user@server ~ $ ghci
ghci, version 7.8.4: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> [ if x mod
15 == 0 then "FizzBuzz" else if x mod
3 == 0 then "Fizz" else if x mod
5 == 0 then "Buzz" else show x | x <- [1..1100] ]
In Java objects can be null, but it's easy to forget the check to see if it's null. In Kotlin this mindset is created for you. You have nullables or non-nullables. The non-nullables can never ever be null. The nullables can be null. You can't simply call a function on a nullable. You have to check it it's null first or use the safe call ("variable?. function" the '?' checks if it's null first before executing the function). So this way you are forced to handle null. For more information you can check the website of Kotlin: https://kotlinlang.org/docs/reference/null-safety.html
> When it comes to Go, you don't know what you're talking about. Learn to write a container type and then get back to me. Here's a Heap https://golang.org/src/container/heap/heap.go?s=2105:2138#L51 See the return type? interface{}.
> This is how it's done in Go.
It does. >Affectionately nicknamed “the book,” The Rust Programming Language will give you an overview of the language from first principles.
Found https://www.rust-lang.org/learn is just a little bit easy to misunderstand. The italics try to help but it's easy to confuse even for native English speakers!
Multiplatform docs here: https://kotlinlang.org/docs/reference/multiplatform.html
Example from the docs:
// Common module
package org.jetbrains.foo
expect class Foo(bar: String) { fun frob() }
fun main(args: Array<String>) { Foo("Hello").frob() }
// JVM module
package org.jetbrains.foo
actual class Foo actual constructor(val bar: String) { actual fun frob() { println("Frobbing the $bar") } }
I brought up how I thought the expect
and actual
keywords (but primarily the latter) added unneeded verbosity in the Kotlin Slack awhile back and was pretty much shrugged off (to be clear: not by JetBrains, but others there), despite folks on the Kotlin team admitting that they exist in part to make the IDE's job easier, but weren't actually necessary.
It leaves a sour taste in my mouth, but I suppose it might be because I'm familiar with projects in C/C++ where, if a symbol goes undefined, the compiler/linker is smart enough to tell you that without being hand-held.
I should add that I use Kotlin day-to-day and am generally very pleased with the work JetBrains has done. In this instance, however, I don't see the justification for cluttering the language.
The second link for "php tutorial" is this: http://php.net/manual/en/tutorial.php "Last updated: Fri, 21 Oct 2011"
I'd say they're in a much better situation than Perl is. :)
The question is: What are we going to do about it?
Big find? Well, not really. Third-party mirrors, official or not, are still just that: mirrors. They're ultimately controlled by the kind person who volunteered. In fact, PHP makes this pretty damn clear by listing the mirror provider on the mirror selection page.
Calling it a "a not-so-hidden secret on [PHP's] website" is pretty misleading. It's properly PT Pasifik Satelit Nusantara's not-so-hidden secret.
Also suspicious: notice there's not a single mention of the word "mirror" in that article. If the author weren't trying to sensationalize he'd at least mention how the content got there.
I think there are other ways of helping on-board people from other backgrounds, especially with something like Go's tour. If you give people the path of least resistance to trying the code, it can feel much more doable. D's sample code selector https://dlang.org/ is pretty cool as well.
I feel as though this web design is less comfortable because I don't know where I am going. There is a TON of information on the front page, is there a link to the documentation in the middle of the page? How do I install? Is the install button behind "Get started" or is it on this front page? What does the Rust book look like? Is it the Rust book that Marcus told me about? etc.
When someone is completely new to the site, there is a lot to look at, and it feels a bit overwhelming.
https://www.typescriptlang.org/docs/handbook/type-compatibility.html#a-note-on-soundness
But to give a simple, concrete example:
const map: Record<string, number> = { a: 1 };
const value = map.b; // value is undefined, but type system says it's a number
If he is interested in learning to program I recommend trying out Scratch. It is a visual based language that is super easy to use and learn and it a great introduction. I basically grew up on it, and it gave me a great basis for learning.
Markov Chains have been around a long time.
A guy I met at a computer training class showed me this project he did - collecting all of the "online (text) erotica I could find", then feeding it into in a markov chain text generator, and then hooking that up to the speech synthesizer. The computer generated filth that came from the machine was pretty amazing.
Send a HEAD request.
e.g. using requests
>>> import requests >>> resp = requests.head('http://www.python.org') >>> print(resp.status_code) 301
I'm sorry, but that's the opposite of "pythonic".
Magically adding all created users to some hidden list, preventing them from being deleted ever and setting up for hilarious bugs when you decide to work with another set of users elsewhere in the program? Not pythonic, it obviously violates like four and a half of the rules.
Accessing that list by iterating over the class object (with the actual method implemented in a metaclass somewhere else)? Dude, WTF.
Make a, I don't know, Context
or Users
or whatever object representing your collection of users and give it an new_user
method that creates and adds a user. Then implement iteration as usual. That's it, no possibility for weird bugs, you always see where you pass your collection, and you don't have to use complicated, rarely used features to implement weird, unexpected functionality.
You're not compiling with optimisation. Also you're not using unboxed vectors. To fix the former you only need to add -O to the ghc invocation (ghc might not be truly magical, but it's more magical than you think!). The latter requires changing the Data.Vector import to Data.Vector.Unboxed and adding a couple of type annotations (I had to specify the type of numvec, and the type of round used in main): http://hpaste.org/53543
These changes brought it down to 0.057s on the test image on my system :)
(e: To clarify what's going on, as I understand it code using Data.Vector is hugely dependent on optimisation for performance: Without it, every time you use a vector function you're actually constructing a whole new vector. Which means a hell of a lot of copying data around. I think it's actually not so much ghc that's incredibly magical here but the inlining and fusion rules in the Data.Vector library. They basically do the equivalent of replacing map f . map g (where in order to compute the result you first need to compute an intermediate vector) with map (f . g), except in a far more general way.
In this case it seems that ghc -O also picks up on the (fft_CT xse) subexpression in fft_CT being reused, and other similar cases, so that it can avoid recomputing those values. Surprisingly you can't always depend on that happening, though. So if you want to make sure a computation's result is shared, bind it explicitly.
As for switching to unboxed vectors, that simply means that you're using arrays which actually directly contain their values, rather than pointers to heap objects containing the values. Unboxed vectors are faster than boxed vectors but can't be defined in terms of themselves (for instance, let v = cons 0 (generate 10 (\i -> 1 + (v ! i))) in v == fromList [0,1,2,3,4,5,6,7,8,9,10] can be evaluated with boxed vectors but not unboxed vectors).)
From http://www.python.org/static/humans.txt:
> Standards: HTML5, CSS3, W3C (as much as possible) > > Core: Python 3 and Django 1.5 > > Components: Modernizr, jQuery, Susy (susy.oddbird.net) > > Software: SASS and Compass, Coda, Sublime Text, Terminal, Adobe CS, Made on Macs > > Hardware Stack: Ubuntu 12.04, Postgresql 9.x, Nginx, Gunicorn > > Helpers: South, Haystack, Pipeline
Are you familiar with PEP-3107, function annotations, implemented by Python3? It provides some level of syntactic expressiveness for implementing some form of static type checking (static as in expressed in source code, but not static in the sense of a "pre-run" check).
Some interesting discussion on this Stackoverflow post
the entire vent is things i said in 4th grade or didnt say at all plus i didnt know about sex until early 6th grade when we didnt talk anymore and all my online friends were litterally talked to me on scratch.mit.edu lmao how could they tell me about sex
https://pbs.twimg.com/media/E8u1VVEUUAAFwFc?format=jpg&name=medium
If you used Rust with MSVC ABI on Windows, you probably noticed this sentence on the Rust download page:
>MSVC builds of Rust additionally require an installation of Visual Studio 2013 (or later) so rustc can use its linker. Make sure to check the "C++ tools" option.
Now it's no longer true! Full Visual Studio installation is not necessary anymore, more lightweight Visual C++ Build Tools can be installed instead.
PHP Manual says:
>If a file is pure PHP code, it is preferable omit the PHP closing tag at the end of the file. This prevents accidental whitespace or new lines after PHP closing tag which may cause unwanted effects because PHP will start output buffering when there is no intention from the programmer to send any output at that point in the script.
Nowadays most universities start students off with Java or Python. Those languages are both easy to learn while being versatile and they both see actual use in industry. However, it's more important that you understand the fundamentals of programming logic, control flow, data storage, etc. than any particular language.
If you want other things to study, look into discrete math and theory. Even something simple like knowing what a DFA is and their limitations would put you way ahead of the curve.
As an aside, this question isn't really suitable for this forum. /r/learnprogramming would probably be a better place to post this.
Not really. Given the responsibility of the mod team, it would make sense to apply "accountability" to the frame of reference of the mod team: The Code of Conduct.
I would say with reasonable confidence that was/were likely issue(s) regarding member(s) of the Core team not abiding by the CoC, where the Moderation team attempted enforcement/direction/guidance and was ignored/rebuked.
TypeScript cannot generate the functions for you, but you can write them yourself and TypeScript can narrow types for you based on control flow. Better explanation here: https://www.typescriptlang.org/docs/handbook/advanced-types.html
More on point, it is why PHP has its alternate syntax for control structures: it was easier to write a parser that parsed control structures whose start and end points were in discrete chunks of code than it was to write one that handled curly braces, so that's what Rasmus did. Curly braces came later.
The alternate syntax then fell into disuse for years, until people started looking for ways to do HTML templating in content management systems without bringing in a whole template system like Smarty. They rediscovered the alternative syntax, and lo! it was perfect for that use case. So now Rasmus' quick-and-dirty shortcut is an important part of templating in PHP, even if it was never designed to do that.
Hi everyone! If you are looking for free kids coding, please go to Scratch . It was developed at MIT and its free! Over 20 million kids around the world use it and over 70% schools in the US use it as a CS education curriculum. Its put together by one of the best teams. I know because I work there. AMA or reach out if you need anything.