|
Raneman posted:Was doing well for a while in my tutorials, until I hit another snag. I proofread it and compared it with the script it told me to type, and I didn't find anything I missed. If you're unpacking to four variables, you need to be doing it with a four-variable list. Pass three arguments (the first is always the name of the program no matter what.)
|
# ? Dec 26, 2010 22:51 |
|
|
# ? Jun 4, 2024 23:58 |
|
I'm reading "Learn You a Haskell for Great Good!" as an introduction to functional programming, but can't get one of the example programs to compile. The OP links to a Haskell thread, but it appears to be long gone, so I hope this is an appropriate place for this question. I've reproduced the code below. When I try and compile using WinGHCi I get the following error message: "[1 of 1] Compiling Main ( todo.hs, interpreted ) todo.hs:26:1: The last statement in a 'do' construct must be an expression " Why could I be getting this error message? Have I screwed up my formatting somehow, or is the compiler doing something odd? code:
|
# ? Dec 28, 2010 01:52 |
|
Grey_Area posted:I'm reading "Learn You a Haskell for Great Good!" as an introduction to functional programming, but can't get one of the example programs to compile. The OP links to a Haskell thread, but it appears to be long gone, so I hope this is an appropriate place for this question. Wherever you have code:
code:
|
# ? Dec 28, 2010 03:12 |
|
Argh, sorry. I added the line numbers to the post so that I could reference line 26, but doing so misaligned the columns. In the original file, the two lines are aligned correctly. Lines 36 and 37 are also lined up correctly in the original. If I put braces around the second two "do" blocks then I get a "parse error on input let" at line 26, while if I put braces around the "do" in main, I get a "parse error on input let" at line 17. I must be doing something retarded, but can't for the life of me work out what. Grey_Area fucked around with this message at 09:34 on Dec 28, 2010 |
# ? Dec 28, 2010 09:24 |
|
Grey_Area posted:Argh, sorry. I added the line numbers to the post so that I could reference line 26, but doing so misaligned the columns. In the original file, the two lines are aligned correctly. Lines 36 and 37 are also lined up correctly in the original. Are you using tabs? If you have your tabstops set to something other than 8 spaces in your editor, then your lines may not be aligned as far as the Haskell compiler is concerned. Edit: Anyway, if you really don't want to fix your broken indenting for some reason, you can change to: code:
ShoulderDaemon fucked around with this message at 09:43 on Dec 28, 2010 |
# ? Dec 28, 2010 09:39 |
|
Oh, I wasn't being clear. The indentation isn't broken in the code. I just messed it up when I copied it into my post. I copy and pasted the code off the tutorial on the website I mentioned and that compiles fine. Which was encouraging as it suggested I'd typed something incorrectly. However, notepad++ tells me that the files match. So now I have two matching files in the same folder, one of which compiles and one of which fails to compile. Fake edit: Ok, I moved the non-compiling file to a different folder, created a new file in the original folder and just directly copied the text from the non-compiling file into it, then saved the new file with the same name. This now compiles. I guess that solves the problem, but I still don't know what the gently caress. The new file has the same name, location and contents as the old file, but it compiles while the old one didn't.
|
# ? Dec 28, 2010 09:58 |
|
Grey_Area posted:I guess that solves the problem, but I still don't know what the gently caress. The new file has the same name, location and contents as the old file, but it compiles while the old one didn't. As ShoulderDaemon pointed out, you are using tabs. If you use tabs, Haskell's tab stops are 8 characters, not 4 like your editor's. You should configure your editor to use spaces, not tabs. There should be no tab characters in Haskell code.
|
# ? Dec 28, 2010 19:22 |
|
Ok, thanks. The editor is set to "haskell" tabs, but I'll uncheck that and replace with spaces.
|
# ? Dec 28, 2010 20:25 |
|
I'm going to ask a possibly really stupid question but my curiousity demands answers. I realise that this might not be the best place for it. How does programming in another (real) language (ex German, Arabic, Japanese) work? I can understand strings and the like but if you put in say a hiragana あ as a variable name [ int あ = 5; ] would the compiler allow it? Are there specific additions to compilers made to handle this case, or is anyone who programs forced to use the English alphabet? As a follow on, wouldn't being from a non-english speaking country immediately put you at a disadvantage? E.g. looking at standard library functions such as push() and pop() or malloc() and free() you'd pretty much need a English->Your Language dictionary by your side the whole time? Don't hurt me, this is legitmate curiousity
|
# ? Dec 29, 2010 06:07 |
|
Rampager posted:How does programming in another (real) language (ex German, Arabic, Japanese) work? I can understand strings and the like but if you put in say a hiragana あ as a variable name [ int あ = 5; ] would the compiler allow it? Are there specific additions to compilers made to handle this case, or is anyone who programs forced to use the English alphabet? You can almost start to do this now, but the predominant set of tools, i.e. Visual Studio is unbelievably poo poo at i18n support. Generally it's Latin character variables with locale encoded comments. Don't forget would be useful for doing any moderate to advanced level of math, moving from written formulae to ANSI code is awful. MrMoo fucked around with this message at 07:46 on Dec 29, 2010 |
# ? Dec 29, 2010 07:41 |
|
Edit: I am stupid.
|
# ? Dec 29, 2010 09:19 |
|
Rampager posted:I'm going to ask a possibly really stupid question but my curiousity demands answers. I realise that this might not be the best place for it. I guess a bunch of programming languages explicitly allow unicode symbols, but, as a German, I get unreasonably annoyed when I have to read code with German comments in it, let alone German identifiers. Also my dictionary did not have "malloc" in it anyway so I did not feel disadvantaged there at all.
|
# ? Dec 29, 2010 11:09 |
|
Learning english just comes with the territory. Almost all useful support is in english, the language itself is english and most code is written with english speakers in mind.
|
# ? Dec 29, 2010 14:20 |
|
I remember being absolutely floored when, as a fine young American, I found some TI-ASM code with French comments. Other countries have programmers
|
# ? Dec 29, 2010 14:27 |
|
Vanadium posted:I guess a bunch of programming languages explicitly allow unicode symbols, but, as a German, I get unreasonably annoyed when I have to read code with German comments in it, let alone German identifiers. Also my dictionary did not have "malloc" in it anyway so I did not feel disadvantaged there at all. A friend of mine's professor required all variables and comments to be written in our local language which required a lot of dicking around on my friend's Linux + Java setup to get working properly, not to mention the overall of it all. I'm not really asking for a solution as I can write it myself, but it seems like there's a good chance this has been asked already or somebody has experience with this. I need to automate some web app on our intranet which are heavy on javascript and use complex authentication so I can't just POST into the forms or something. I need to click a bunch of links, buttons, and fill out a form, repeatedly. It seems like there are Perl modules to automate IE as well as libraries that could be used from C# or VBA code, but if anyone has done this previously, some suggestions would be much appreciated.
|
# ? Dec 29, 2010 14:48 |
|
Thanks for the answers! I didn't really mean malloc() specifically by I don't know, functions like strcpy() make sense to me but to someone who doesn't speak a lick of english it'd be somewhat confusing, and I'm sure there's a lot more examples that I'm having trouble remembering. Although I guess one could just read the source code and figure it out pretty quickly. So, basically, it's possible. Cool
|
# ? Dec 29, 2010 15:06 |
|
Rampager posted:Although I guess one could just read the source code and figure it out pretty quickly. Or, you know, the documentation (assuming that's been translated, of course). Aside from that, English is taught so widely (especially in your examples of Germany and Japan) that pretty much everyone speaks at least enough to understand things like language keywords. If you listen to people discussing technical stuff in a foreign language, you'll notice that they use english for most of the technical terms, even if it's something they could easily translate to their native language.
|
# ? Dec 29, 2010 15:54 |
|
I will be making a transition over into web stuff with C# soon and wanted to scheme what technologies I might want to come to understand to do what I want to do. Already I think ASP.NET is on the plate. I was thinking about the front-end of things. I was hoping to come up with something of an editor that allowed somebody to move boxes and arrows around to make a flowchart. So it would be like a flowchart editor that is served up on a web page. The result of that flow chart is something that the back end would use to do things. I would assume one reason you don't see stuff like that online too often is because it's very difficult. I was wondering what I should investigate as ways to do it.
|
# ? Dec 30, 2010 18:45 |
|
Okay I was wondering if it was possible to write a script to reboot windows into safe mode. I am not talking about giving an option to boot into safe mode every time, just a bat or vbs script to do so. Any help would be greatly appreciated.
|
# ? Dec 30, 2010 20:34 |
|
mobby_6kl posted:It seems like there are Perl modules to automate IE as well as libraries that could be used from C# or VBA code, but if anyone has done this previously, some suggestions would be much appreciated. My first project when I joined the development team in my work involved writing an app that would log in to a third party web page and then scrape a few pages for data. I did this using Access/VBA and it worked a treat. The web page did some sort of client-side encryption on the password that I couldn't replicate in VBA so I couldn't just POST the details to the login form's action. Instead I just fired values in to the form fields then clicked the login button. Everything else could then be done through POSTing and URL manipulation. I don't have the source handy as it's in work, but I'm sure you do something like the following to physically place values in form fields: code:
code:
|
# ? Dec 30, 2010 20:54 |
|
mobby_6kl posted:It seems like there are Perl modules to automate IE as well as libraries that could be used from C# or VBA code, but if anyone has done this previously, some suggestions would be much appreciated. Look into AutoIT as well. You could write it in pure AutoIT, or use its COM bindings to write it in most other langauges. Part of the library included with it has a poo poo-ton of IE automation functions...
|
# ? Dec 30, 2010 21:14 |
|
No mention of Selenium yet? Odd.
|
# ? Dec 31, 2010 02:20 |
|
Got an issue with NetBeans 6.9.1, programming Java. I'm trying to get a random variable e.g Random chamber = new Random(6); to have it's value equaled by an integer of any description...like int a = chamber; or int a == chamber; This doesn't seem to work in Netbeans...neither does making the random number be allowed to == anything or have the use of the && command. Really pissing me off, since I need to do the following. Create a random number from 1 to 6. I can get that by Random chamber= new Random(6); Then create a random round that's also from 1 to 6 so Random round = new Random(6); Create an if statement where if(chamber==round) { stuff happens } Just having some major issues getting random varables to do anything or interact in any way. So I need a method of getting their values slapped onto an integer which I know is much more mallable and useful to mess around with. Any help is greatly appreciated, might even give something to the person that hands me a solution (steam present ect) .
|
# ? Jan 2, 2011 02:58 |
|
What's the return type of Random()?
|
# ? Jan 2, 2011 03:00 |
|
Thanks for the reply, I'm not sure exactly. This is my first time tackling randoms in Java, any idea what the return type should be? I'm just after numbers I can compare with each other. Edit. After some fiddling I've got this without any errors showing up. Random a = new Random(); Random b = new Random(); int chamber = a.nextInt(5); int round = b.nextInt(5); // lots of code later if(isDown[fireKey]&&round==chamber) { g.drawImage(imgbrains1, 25, 50, Graphics.TOP | Graphics.LEFT); flushGraphics(); counter ++; } Time to test it I guess. Smeg Head fucked around with this message at 03:09 on Jan 2, 2011 |
# ? Jan 2, 2011 03:05 |
|
Smeg Head posted:Thanks for the reply, I'm not sure exactly. This is my first time tackling randoms in Java, any idea what the return type should be? I'm just after numbers I can compare with each other. Firstly, you should post this in the Java thread, and secondly, you're slightly misunderstanding what a Random instance is - it's for generating random numbers (using the nextInt method or one of the many other ones) - it isn't a random number itself. Also, you should never compare with == unless you absolutely want to check reference equality - whether two objects are exactly the same - or are using primitive types like ints and floats. Always use the equals() method otherwise.
|
# ? Jan 2, 2011 03:19 |
|
Thanks, I'll do just that.
|
# ? Jan 2, 2011 03:31 |
|
Here's an interesting serial data communication/hardware interaction problem: I've written some C# code that uses serial communication to do some stuff. It works great if the serial port isn't actually connected to anything. If it's connected to my custom circuit, however, it throws System.IO.IOException. If that's not a mindfuck enough, Hyperterminal is able to send. Which leads me to believe that it's my code. Is there some sort of collision detection voodoo at work here?
|
# ? Jan 4, 2011 02:32 |
|
ante: Does the IOException have any additional details? Pastebinning a relevant chunk of your code couldn't hurt.
|
# ? Jan 4, 2011 02:48 |
|
"The I/O operation has been aborted because of either a thread exit or an application request." To eliminate any other sources of error, I've got it right in the constructor, so the only code is this: code:
edit: It also seems to work at 9600 baud I'm transferring some pretty large files(potentially), so I'd still like get this working, if I could. ante fucked around with this message at 03:53 on Jan 4, 2011 |
# ? Jan 4, 2011 03:50 |
|
I know a bit about editing webpages (a little java, php, xhtml and stuff like that). That being said, Setting one up from the ground up sounds pretty difficult for me. Is there a program I can purchase that would allow me to easily set up a website (template, almost) where I could change some things as needed, and more importantly post updates to it in kind of a blog like format? Tons of control isn't required, just some. Or if anyone could point me in the right direction, there are just so many options out there and it's all pretty confusing.
|
# ? Jan 4, 2011 04:17 |
|
Wordpress is a pretty easy way to get going and it's free. Customizing templates for it isn't difficult and if you want to do some real coding down the line, there's plenty of room to do it.
|
# ? Jan 4, 2011 04:21 |
|
rt4 posted:Wordpress is a pretty easy way to get going and it's free. Customizing templates for it isn't difficult and if you want to do some real coding down the line, there's plenty of room to do it. I really just needed something that would be easy for my girlfriend to update using (she doesn't know much about this stuff) and it seems like Wordpress is a pretty good choice for that. Is that a good excuse to finally buy a new windows based computer or is there a similar mac equivalent?
|
# ? Jan 4, 2011 04:37 |
Harvey Mantaco posted:I really just needed something that would be easy for my girlfriend to update using (she doesn't know much about this stuff) and it seems like Wordpress is a pretty good choice for that. Is that a good excuse to finally buy a new windows based computer or is there a similar mac equivalent? Wordpress is a blog software, it runs entirely on the web server so it only requires a web browser to use and post new content. (It does require some more software to do the initial set-up and maintenance, though, but some web hosts might offer automated installation of Wordpress and other popular software packages. I.e. you'd need an FTP client and a text editor to do some configuration and upload the files.)
|
|
# ? Jan 4, 2011 04:41 |
|
Don't try hosting it at home on your cable modem. You'll have much better results with less hassle if you find somewhere to host your blog at something like $1/month. There's good deals on hosting in SA-mart.
|
# ? Jan 4, 2011 04:44 |
|
I used to run a minecraft server. I had access to it via ftp and some user control panel. Is there anyway I could upload a script of some sort (a batch maybe) that would automatically zip a folder, upload it zipped folder to my computer, as well as call a program to render a screenshot of the map. And have it so this script executes once daily?
|
# ? Jan 4, 2011 09:25 |
|
Woofington posted:I used to run a minecraft server. I had access to it via ftp and some user control panel. Is there anyway I could upload a script of some sort (a batch maybe) that would automatically zip a folder, upload it zipped folder to my computer, as well as call a program to render a screenshot of the map. And have it so this script executes once daily? What kind of operating system is your server running? And yes unless your administrator is preventing you from doing so.
|
# ? Jan 4, 2011 10:18 |
|
rt4 posted:Don't try hosting it at home on your cable modem. You'll have much better results with less hassle if you find somewhere to host your blog at something like $1/month. There's good deals on hosting in SA-mart. Oh yeah, Hostgator can certainly get all of my cash bucks.
|
# ? Jan 5, 2011 00:50 |
|
I want to display tomorrows date ( %m%d%y format) in TCL but for some reason this code isn't working:code:
code:
http://www.tcl.tk/man/tcl8.5/TclCmd/clock.htm#M5 EDIT: nevermind I figured it out, this displays tomorrows date lol: code:
pram fucked around with this message at 08:27 on Jan 6, 2011 |
# ? Jan 6, 2011 01:10 |
|
|
# ? Jun 4, 2024 23:58 |
|
baquerd posted:What kind of operating system is your server running? And yes unless your administrator is preventing you from doing so. I would guess its running a linux distro...
|
# ? Jan 7, 2011 14:49 |