|
Asymmetrikon posted:basically a left paren that stretches to the end of the expression I don't think I've ever seen this analogy for $, but it's extremely intuitive. I'll have to use that when explaining to other people.
|
# ? Feb 12, 2016 19:27 |
|
|
# ? Jun 8, 2024 19:24 |
|
Yeah that's pretty good
|
# ? Feb 12, 2016 19:28 |
|
I'm back with more hot Haskell questions. Right now I'm doing a program that runs a Hill Cipher on a string. I've got everything else working, except I want to expand it to read stuff from files and user inputs, so that it can be executed and then the program queries the user for commands and reads my encryption and decryption keys from files. Here's how it works: - Build a 3x3 matrix from numbers (I originally used the Data.Matrix constructor fromLists and specified 3x3 Integer lists as the keys) - Right now I want to read my Integers from files. - I've got the process about 95% of the way down, I'd say. I can handle the user input, I can read files, I can parse the contents of the files from IO String to IO Int using read. But when I try to construct the matrices, it all falls down with the error message: code:
code:
Also, a general question about visibility in Haskell. I was told that Haskell is very lenient with visibility, but it doesn't seem to be so. If I try to run constuctors in my main do block, I get a "not in scope" error if I try to access them elsewhere.
|
# ? Feb 14, 2016 19:04 |
|
fromFileToList has type:code:
code:
code:
|
# ? Feb 14, 2016 19:20 |
|
Also, I'm not quite sure what you mean with the constructor question. Can you give an example?
|
# ? Feb 14, 2016 19:20 |
|
A slightly more advanced way to do the same thing, if you want to learn a bit more, would be to partially apply fromList and then pass it to liftM from Control.Monad, and then compose it with fromFileToListlike this:code:
|
# ? Feb 14, 2016 19:46 |
|
Asymmetrikon posted:Also, I'm not quite sure what you mean with the constructor question. Can you give an example? First of all, thanks. This is really helpful! Second of all, sure! Let's say I want to construct two matrices, encryptKey and decryptKey. I wanted to do that in my main block, which I figured should do housekeeping things first and then launch another do function, doLoop. That handles the user's inputs, parses them and then calls various other functions to encrypt and decrypt inputs. If I try to run my matrix constructors in the main function's do block, I get a "not in scope" error when I try to access those matrices in the doLoop block (or even if I isolate the calls out of the doLoop block into an encryptWord x function which references, say, encryptKey as one of its arguments). Here is some more relevant code: code:
code:
code:
If this was a normal programming language, I'd naturally introduce the variables matrixKey and reverseKey as class variables even if they were initialized and constructed in a function or method somewhere else, but as far as I understand that's not really an option with Haskell. I can't just give a type signature for them outside the do block or something, right? Or am I thinking too object oriented? E: It works fine if instead of using discrete functions I then call from my doLoop block I just put the convertFromNumbers $ directly into them and build the matrices at the start of the doLoop. It just seems so wasteful! Shaman Tank Spec fucked around with this message at 20:04 on Feb 14, 2016 |
# ? Feb 14, 2016 19:53 |
|
I think I understand the confusion. Scope is explicit in Haskell - to ensure referential transparency, a function can only use the things that are passed in as arguments, or the things that are defined at the point that the function is defined (other top level functions, for instance.) matrixKey isn't defined when doLoop or encryptWord are defined, so you'll need to pass it in as an argument, like:code:
code:
Edit: I think what people mean when they say that Haskell's visibility is lenient is that you can define a top-level function foo before another one bar, yet you can use bar in foo (technically before it's defined.) Haskell considers all top-level functions to be defined "at the same time." Asymmetrikon fucked around with this message at 20:07 on Feb 14, 2016 |
# ? Feb 14, 2016 20:05 |
|
Asymmetrikon posted:I think what people mean when they say that Haskell's visibility is lenient is that you can define a top-level function foo before another one bar, yet you can use bar in foo (technically before it's defined.) Haskell considers all top-level functions to be defined "at the same time." Yep, that was precisely it! Well, as usual you were a real help. Thanks so much!
|
# ? Feb 14, 2016 20:12 |
|
Der Shovel posted:Yep, that was precisely it! Well, as usual you were a real help. Thanks so much! No problem! I'm always happy to help people get into functional languages like Haskell. They can be really unintuitive coming from an imperative point-of-view, but I think that, once you get used to them, the rules you use to structure programs become very simple and easy to understand.
|
# ? Feb 14, 2016 22:00 |
|
Are there any kind of projects you can do at home with Spark that would do any justice to the capabilities of the framework? Especially something visualization or graphics oriented? I know a team at work uses aggregating a NY taxi data set to visualize it but even that's only like 10GB, not exactly big data. I just want some stuff I can try that doesn't require a huge infrastructure to do, just to mess around with Spark.
piratepilates fucked around with this message at 03:47 on Feb 17, 2016 |
# ? Feb 17, 2016 03:28 |
|
piratepilates posted:Are there any kind of projects you can do at home with Spark that would do any justice to the capabilities of the framework? Especially something visualization or graphics oriented? I know a team at work uses aggregating a NY taxi data set to visualize it but even that's only like 10GB, not exactly big data. I just want some stuff I can try that doesn't require a huge infrastructure to do, just to mess around with Spark. You're not going to have problems that can run on your laptop that are so "big data" they need a cluster. It's a contradiction. The beauty of spark especially when written in Scala (or Java) is that if it works on your machine, it will work on a cluster. Use it to solve problems that can scale even if on a manageable data set that you could handle with awk or a simple python script to learn the platform. Also, if you're portfolio building, the NYC taxi data set is horribly over used. We see thirty resumes with the same project from that data set every time a boot camp lets out.
|
# ? Feb 17, 2016 07:23 |
|
KernelSlanders posted:
Well now I'm curious what all of them are doing with it the exact same way.
|
# ? Feb 17, 2016 15:00 |
|
spark runs fine with no cluster behind it. we have a bunch of spark jobs running on aws lambda and you only get like 1.5 gigs of memory there
|
# ? Feb 17, 2016 16:27 |
|
OK. What the gently caress. value_orientation is an enum. code:
edit: apparently i don't know how enums work when querying via string code:
no_funeral fucked around with this message at 21:52 on Feb 17, 2016 |
# ? Feb 17, 2016 21:31 |
|
piratepilates posted:Well now I'm curious what all of them are doing with it the exact same way. Heat map of pick ups and drop offs by time of day. Map showing most trafficked streets. Some combination of the two. Then there's the ML ones rather than the visualization ones. They'll do something like finding the Bayesian optimal location to pick up a fare, which is really just fitting a gaussian to the pick up location cloud, i.e., the same as the map of pickups by time of day. Mostly it's different ways of taking 2D slices through a 3D data set. These projects show that you can manipulate data, apply descriptive statistics, and use a plotting package. They don't show that you can structure a problem analytically or write software to solve said problem.
|
# ? Feb 18, 2016 06:54 |
|
Yeah, double post. Sensing the obvious question: what would I rather see, I'd rather see you use a more unique data set and actually test business relevant hypothesis with it. In addition to the analysis this shows me you can 1) identify a business relevant hypothesis, 2) test a hypothesis, and 3) find a dataset on your own. Failing that, if you must use the taxi data, do something interesting that requires expanding beyond what you're handed. Write a web scraper to find the times and locations that broadway shows start and let out. What's the impulse response on the likelihood of a pickup/drop off around the theater? Bonus points to expand beyond Broadway shows: Opera at the Met, concerts vs. hockey games vs. basketball games at MSG, events at Bowery Ballroom or Terminal 5, etc. Where do Rangers fans live? Where to Knicks fans live? Are they different? There's only a few flights a day each to JFK and LGA from Kingston and Santo Domingo. Do you see an uptick in rides from those airports to Flatbush and Washington Heights respectively around those times? Do you see the same effect in reverse on the outbound flights? If not, why might there be a difference? This may seem like it assumes a lot of knowledge of New York, and that's the point. If you're going to dive into a data set, you need to understand it. I don't care that you can tell me that sales of our blue widgets are down 10% this month. Your project should prove to me that you can tell me why..
|
# ? Feb 18, 2016 07:18 |
|
Okay goons, help point me in the right direction. Basic info: OS: WIn 10 Pro Current programming knowledge: Low level python (3), some VBS, no access to powershell (that I know of yet). My manager has tasked me with something and I'd like to get some pointers on the best way to accomplish this. I have a list of computer names that is currently in a spreadsheet. I can export this to a .csv if it would help. What I want to do is take this list (It's 85 computers long), iterate over the list, and create a new text document when run that lists the computer name, the owner (Going to have to get specifics if this is the last user logged in or if it's according to this spreadsheet I have, or if I need to pull it from AD), possibly the IP via nslookup or however. I know this should be fairly simple, but here's the question: What is the best/easiest way to go about this? I can set up a python script, and put it in a self-contained .exe (Not sure if py2exe is supported with 3.5). Or can it done via a simpler method such as creating a .vbs or something else?
|
# ? Feb 18, 2016 20:31 |
|
Gothmog1065 posted:Okay goons, help point me in the right direction. I'd stick with Python for now. Don't waste any more of your life learning VBS, it is a terrible language.
|
# ? Feb 18, 2016 20:56 |
|
Gothmog1065 posted:
If you have to create a document, perhaps an ipython notebook could be a good choice.
|
# ? Feb 18, 2016 21:15 |
|
Our backend stores dropdown values as bytes, and I use DropDownListFor and convert the numbers to text values (3 becomes "Consistent") on the View. However, I want to replace the DropDownListFor and just use a DisplayFor or some equivalent instead on a read-only View, and I'm not really sure where to convert the number to text. I can't do it in the ViewModel since it can't convert byte to string, so I'm looking for another way to change it only within the View (one-way change). I found a few SO solutions, but it's a bunch of case statements within the View which I want to avoid if possible. e: Learned about DisplayTemplates - nothing to see here! kloa fucked around with this message at 02:30 on Feb 19, 2016 |
# ? Feb 18, 2016 22:13 |
|
kloa posted:I can't get to the C# thread (Awful app is crashing on forum list ) but need some advice on workflow for an ASP.NET app. I've never used ASP.NET for anything ever, but will a Converter not do what you want here?
|
# ? Feb 18, 2016 22:42 |
|
Gothmog1065 posted:Okay goons, help point me in the right direction. Otherwise, you can no doubt do this in python, as well. Definitely try to avoid learning vbscript in 2016. mystes fucked around with this message at 01:49 on Feb 19, 2016 |
# ? Feb 19, 2016 01:45 |
|
mystes posted:Otherwise, you can no doubt do this in python, as well. Definitely try to avoid learning vbscript in 2016. Thanks everyone. I'm doing this in Python for now. I might start looking into Powershell, but I need to get the month of lunches book and dive into it. Not sure what my boss is doing (other than testing my learning ability), but it's completely out of scope of my job, which is interesting.
|
# ? Feb 19, 2016 01:55 |
|
I apologize if there's a thread for this, but I'm developing curriculum for a intro programming class for kids, and we're thinking about teaching it in MIT's Scratch. Does anyone have any experience teaching kids in Scratch or know of any resources about teaching kids, particularly any good lesson plans?
|
# ? Feb 19, 2016 06:04 |
|
Can't personally speak to scratch but my fiance is a primary teacher and used it with her class a while ago. She was very happy with it.
|
# ? Feb 19, 2016 07:13 |
|
Gothmog1065 posted:Thanks everyone. I'm doing this in Python for now. I might start looking into Powershell, but I need to get the month of lunches book and dive into it. Not sure what my boss is doing (other than testing my learning ability), but it's completely out of scope of my job, which is interesting. https://www.devopsonwindows.com/3-ways-remotely-view-who-is-logged-on/
|
# ? Feb 19, 2016 14:53 |
|
You probably want to use wmi directly to do this programmatically though, rather than parsing the output of one of these commands. I think you can do this in either powershell without anything extra, or in python if you install the wmi module.
|
# ? Feb 19, 2016 15:11 |
|
mystes posted:You probably want to use wmi directly to do this programmatically though, rather than parsing the output of one of these commands. I think you can do this in either powershell without anything extra, or in python if you install the wmi module. Time to learn powershell it seems!
|
# ? Feb 19, 2016 15:23 |
|
Asymmetrikon posted:They can be really unintuitive coming from an imperative point-of-view, but I think that, once you get used to them, the rules you use to structure programs become very simple and easy to understand. Yeah, I don't know what the hell my problem is, but I'm just having such a hard time grasping the big picture. I know how to do some things, but ... well, here's an example. I've been toying with binary search trees. I made one a while ago following the example from Learn You A Haskell which I've been following. I then created a bunch of auxiliary functions for returning values between X and Y from the tree etc. But making those lists by hand has been very painful. I've wanted to make a function where I can give it a list and it will step through that list one by one, running my treeInsert function on each one and spitting out a finished tree in the end. I spent HOURS trying to figure it out somehow, until I stumbled onto a post on the topic and it turned out that the solution was one single line of code using foldl (or foldr). Like I knew folds but for whatever reason I just couldn't figure it out. Haskell constantly makes me feel like a loving moron even though I'm pretty good with "traditional" OOP languages. E: but man I gotta say, when I do get it right and after hours of frustration finally figure out the implementation and can, for instance, make my binary search tree a Monoid, it feels loving GREAT. E2: Honestly, my big problem is that possibly because Haskell is a relatively rare language and not in mainstream use, it doesn't have the kind of widespread community support that something like C#, Python or Java enjoys. With those languages if I'm not entirely sure about something I can google it and turn up a LOT of information which will inevitably nudge me along in the right direction. With Haskell googling something usually turns up relatively few hits and those hits often are extremely unhelpful being either very terse API dumps or some guy who is more interested in being clever than helpful. Shaman Tank Spec fucked around with this message at 16:18 on Feb 19, 2016 |
# ? Feb 19, 2016 15:36 |
|
Der Shovel posted:Yeah, I don't know what the hell my problem is, but I'm just having such a hard time grasping the big picture. I know how to do some things, but ... well, here's an example. This is a typical experience, but keep at it and eventually things will start clicking. The functional paradigm is different enough that it's almost like learning programming all over again. I had the same experience where I found it easy to switch between languages and then I tried Haskell and was completely humbled. Moving around between imperative languages the main differences are the typing discipline and some syntax. Moving between imperative and functional languages requires changing the whole way you approach problems. And Haskell is particularly unforgiving in that it won't let you try and doing something in an imperative way.
|
# ? Feb 19, 2016 16:59 |
|
I don't know what I'm doing! (VBScript) I'm a workstudy in the IT department of my school. Sometimes my boss will hand something off to me and most of the time I can figure it out. I'm not even 100% sure how this new thing works, though. I was handed an asp file that's suppose to pull from the school's LDAP server and populate a directory on their Cisco phone system. Thing is right now the code pulls everyone, including staff, faculty, and students, and they want it to not pull students. I think I need to change two things. First to change this so that it picks up their classification: code:
code:
But I feel like I should be able to specify in the first line to only select users who are not students, which would be ten times easier but I have no idea how to do it because I have pretty basic SQL knowledge and that isn't meshing with how that query is presented to me. I've tried googling around but I'm not sure what exactly this is called, and googling for sQuery turns up pages like this that look completely different. I guess what I'm asking is if the second method is even possible, and if it is what exactly is that kind of query called and where can I find some documentation on it.
|
# ? Feb 19, 2016 19:22 |
|
Moldy Taxes posted:I don't know what I'm doing! (VBScript) The "oCmd.CommandText = "<" & sDomainADsPath & ">;" & sQuery" line is setting the SQL of a command object. sQuery is just a poor name for part of the string that gets built out of. That being said, I don't know WTF is going on in most of that string. You should be able to add a WHERE clause in there somehow, but that will take some trial and error. See if you can print that full oCmd.CommandText out to the screen to see what it ends up looking like, might help figure out what is going on.
|
# ? Feb 19, 2016 19:55 |
|
What is the absolute easiest way to turn a javascript string into a file on my desktop in Windows? If you're in a room full of 100 people with identical stock Windows machines with a.html on the desktop and a.html includes a random javascript string, and the first person to pipe that string into a file on their desktop gets $1,000,000, what are you going to do? It's not actually a webapp at all, it's just a data collection tool that happens to be written in HTML and javascript. I'm "hosting" it on my own desktop and opening it by clicking on the HTML file and it is absolutely the most beautiful and wonderful thing in the world except for the fact that I don't know how to put "var inputs" into a file where the entire rest of the project can begin. OR! To solve the problem I actually care about, I want to record and save my controller movements for machine learning stuff, in a format I already understand. I'm stuck on the saving part. This is language- and technology-agnostic; it's just the thing that would enable me to get to the fun part, which is the analysis. I found a tutorial: http://gamedevelopment.tutsplus.com/tutorials/using-the-html5-gamepad-api-to-add-controller-support-to-browser-games--cms-21345 I copied and pasted the third HTML file and saved it on my desktop. I get to it by opening it in chrome. I slightly modified the javascript in it to append to a string every time the controller updates. When some condition happens, I want to basically do "file.write(str)" and clear the string and then I am DONE. What do I do? EDIT: Found a solution; will implement when I get home code:
it is fucked around with this message at 20:58 on Feb 24, 2016 |
# ? Feb 24, 2016 20:35 |
|
You could use a Blob, like in this fiddle.
|
# ? Feb 24, 2016 20:48 |
|
Asymmetrikon posted:You could use a Blob, like in this fiddle. Doesn't work in FF, I think it requires you to attach to an anchor like so: https://jsfiddle.net/o4cpcL15/ Also IE is dumb, as usual, and the download attribute doesn't work.
|
# ? Feb 24, 2016 20:51 |
|
I had to do something like this in IE once and there's actually no method for saving blobs. The closest accepted method is a flash file someone made that's invisibly embedded and routes the input in and opens a save dialog (perhaps there's a way to just Save the file too but not sure).
|
# ? Feb 24, 2016 20:53 |
|
Wow browser compatibility is weird. I'm always really impressed when front-end people can keep track of all that. Thanks for help y'all
|
# ? Feb 24, 2016 21:03 |
|
There's no way to just email it to yourself? Spin up a server that provides a single endpoint to POST strings and store them to disk? Throw an error somewhere that's logged with the string smuggled in?
|
# ? Feb 24, 2016 21:25 |
|
|
# ? Jun 8, 2024 19:24 |
|
JawnV6 posted:There's no way to just email it to yourself? Spin up a server that provides a single endpoint to POST strings and store them to disk? Throw an error somewhere that's logged with the string smuggled in? code:
it is fucked around with this message at 21:43 on Feb 24, 2016 |
# ? Feb 24, 2016 21:35 |