Open Side Menu Go to the Top

02-06-2014 , 11:55 PM
Quote:
Originally Posted by jmakinmecrzy
On my phone but i think the problem with my fileinputstream program was i put the .read() call inside my loop. I did try to cast to char but it didn't work.

Thanks for the Scanner explanation. That clears up a lot.
Java’s signed byte type is a mistake

Article basically makes same point I made about inhibiting sign extension
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
02-07-2014 , 09:27 AM
Stupid & operator. How many millions of man hours have been spent tracking down bugs where the developer made a typo with & instead of &&? Just make them different enough so the easy typo of the case used 99.9% more often doesn't compile.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-07-2014 , 12:10 PM
At first I was all...wait a second who confuses &blah with &&blah isn't that a syntax error and then I was like...oh wait non-bitwise and?!

Cool languages use , for that operator :P
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-07-2014 , 02:05 PM
Max, I tried your solution.

This is what I have for FileInputStream:

Code:
    public static void main(String[] args) throws IOException
    {
          if (args.length < 1)
          {
              System.out.println("Usage: ASCIIPrinter binary-file-to-open");
              return;
          }

        
        // Open the file passed on the command line
        // Print to standard output (System.out)
        // Only print ASCII characters
        // Only print 64 characters per line
        
        

        FileInputStream in = new FileInputStream(args[0]);
        int i = in.read();
        int count = 0;
        while (i != -1)
        {
            if (i >= 32 && i <= 126)
            {
                System.out.print((char) i);
                count++;
            }
            if (count % 64 == 0)
                System.out.println();
        }
        in.close();
    }
}
This should work I think. I think my 2nd if statement is gonna print too many lines but I'll screw with that later. I still am getting FileNotFoundException thrown every time I try to use it, so I think my problem is on Eclipse's end. I have a folder in my project called binary-data that contains a variety of files, so i thought maybe the problem was with my build path. I added that folder to the build path and it still isn't finding the files. I'm gonna create an new project and put the files in that one and see if it works. Something got ****ed in my import, somehow.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-07-2014 , 02:14 PM
Quote:
Originally Posted by jmakinmecrzy
Max, I tried your solution.

This is what I have for FileInputStream:

Code:
    public static void main(String[] args) throws IOException
    {
          if (args.length < 1)
          {
              System.out.println("Usage: ASCIIPrinter binary-file-to-open");
              return;
          }

        
        // Open the file passed on the command line
        // Print to standard output (System.out)
        // Only print ASCII characters
        // Only print 64 characters per line
        
        

        FileInputStream in = new FileInputStream(args[0]);
        int i = in.read();
        int count = 0;
        while (i != -1)
        {
            if (i >= 32 && i <= 126)
            {
                System.out.print((char) i);
                count++;
            }
            if (count % 64 == 0)
                System.out.println();
        }
        in.close();
    }
}
This should work I think. I think my 2nd if statement is gonna print too many lines but I'll screw with that later. I still am getting FileNotFoundException thrown every time I try to use it, so I think my problem is on Eclipse's end. I have a folder in my project called binary-data that contains a variety of files, so i thought maybe the problem was with my build path. I added that folder to the build path and it still isn't finding the files. I'm gonna create an new project and put the files in that one and see if it works. Something got ****ed in my import, somehow.
I'll take a look at this soon, but you shouldn't be getting file not found. If you are using eclipse, are you giving command line args through the Run Config? If so try supplying the full path name to the input file. I am not sure which directory eclipse would look in for the working dir.

You can always write your program in eclipse and run from command line in the /bin folder if you wanted.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-07-2014 , 02:29 PM
I made a few minor tweaks to the above code and it works fine in my project if I hardcode the file I'm gonna use into the project.

He grades us with a program he wrote called ASCIITester or something that's in my project folder, that uses a bunch of cmd line arguments to test it. Every time I run that program I get a fail, because it can't find my files.

When I do run config and put a file in there as an argument, it works fine. So I'm suspecting the problem might be with his tester class or the way I have my files configured in my project.

Lol sorry to tard up this thread with my technical doofus-ery but I appreciate the help.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-07-2014 , 03:03 PM
For some goofy ass reason the ASCIItester class had the default package as its source folder, so that's why it wasn't working. JFC it took forever to figure that out.

All tests passed so yay for me. Kind of spaghetti coded it at the end but IDGAF.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-07-2014 , 04:35 PM
Quote:
Originally Posted by Phresh
I'm updating a crappy static HTML template for someone and the contact form doesn't seem to work. I'm not a coder and only know very basic HTML stuff. If anyone is willing to take a gander and fix it for me, I'd be very grateful. It doesn't "submit" or do anything. Ideally I'd like a "Thanks, we'll get back to you shortly" to replace the form (would settle for a forward to another page entirely if that's easier) once the form is submitted. Don't see a place to enter the receiving email in the PHP either.

Here's the HTML for the form itself and the PHP code for the mailer: http://speedy.sh/k8N63/mailer.rar (Click mailer.rar at the top near the stars)
Bumping if anyone has time to check quickly. I'd like to get this solved soon. Thanks a lot, guys.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-07-2014 , 06:52 PM
Quote:
Originally Posted by Phresh
Bumping if anyone has time to check quickly. I'd like to get this solved soon. Thanks a lot, guys.
Why are you asking us to download it like this? Can you not post the code here?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-07-2014 , 07:17 PM
http://javascript-puzzlers.herokuapp.com/

Quote:
== is the spawn of satan.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-07-2014 , 07:21 PM
has the wat video been linked here yet?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-07-2014 , 07:27 PM
A couple times when it was new. And at the end of that page.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-07-2014 , 07:34 PM
Quote:
Originally Posted by ganstaman
Why are you asking us to download it like this? Can you not post the code here?
It's 2 kind of big (for a forum post I mean) PHP files and the HTML for the form. So I don't think pasting the code would work. That's just a random file sharing site I found from a Google search. I didn't realize it would deter anyone from helping.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-07-2014 , 07:59 PM
Phresh, https://gist.github.com/

Note: It lets you add multiple files with whatever names you want.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-07-2014 , 08:23 PM
Thanks, Shoe Lace.

https://gist.github.com/anonymous/6bd53841b3262933161e <-- MailHandler
https://gist.github.com/anonymous/737e5b010c819ff16926 <-- MailHandler-sub
https://gist.github.com/anonymous/5d6c4592e93c0a9bcbe8 <-- HTML for form

Right now the Submit button on the form does nothing. I also can't seem to tell where to input the email address the form results should go to. If anyone can help, I'd be very grateful!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-07-2014 , 08:31 PM
You forgot the most important part, it lets you add more than 1 file to the same gist but each file shows up in its own little editor window. It makes it much easier to view.

You should also add the file extension because then it will do nice syntax highlighting.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-07-2014 , 09:02 PM
02-07-2014 , 09:56 PM
Yes that works.

https://gist.github.com/anonymous/d3...ctform-html-L1

^ You're missing an action tag that points to the php file, that is why nothing happens when you submit. Try something like:

Code:
<form action="MailHandler-sub.php" method="post">
Also you should probably wrap all of the php code in an if statement that checks to make sure the request was a post request and that it came from that form. I'll leave that as an exercise to do.

Google for things like "php how do I make sure a form is a post request" and "php check form submit".

Lastly you should consider researching the php function called "header":
http://us1.php.net/manual/en/function.header.php

You can use that to redirect someone to a thank you page upon successful completion of the form.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-08-2014 , 03:23 PM
If someone lives within driving distance of LA and can set up and deploy a secure server (or if you know someone), please send me a PM. Would be helpful if said person could bs their way through Perl.

This is for my place of employment, so it is a "real" gig and privacy is very important.

While I cannot promise 100% approval, I can give about 90% likely, depending on various factors. The timeline would be ASAP and the gig itself would only be ~1 week.

In a nutshell: set up a Linux on an in-house machine; set up a remote server on DO; make the deploy / backup chain simple as possible. The system will be be pre-built FOSS and we may need some customization for functionality, but very little.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-08-2014 , 06:08 PM
Quote:
Originally Posted by Shoe Lace
Yes that works.

https://gist.github.com/anonymous/d3...ctform-html-L1

^ You're missing an action tag that points to the php file, that is why nothing happens when you submit. Try something like:

Code:
<form action="MailHandler-sub.php" method="post">
Also you should probably wrap all of the php code in an if statement that checks to make sure the request was a post request and that it came from that form. I'll leave that as an exercise to do.

Google for things like "php how do I make sure a form is a post request" and "php check form submit".

Lastly you should consider researching the php function called "header":
http://us1.php.net/manual/en/function.header.php

You can use that to redirect someone to a thank you page upon successful completion of the form.
I have no idea where I'm supposed to try the form action bit and have 0 understanding of PHP. I'm not a coder and have no coding aspirations. I was wondering if someone could ship me the right code to get these files functional. If this forum is only for testing skills and stuff I can go elsewhere. My apologies.

Thank you for the help.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-08-2014 , 06:32 PM
yeah, i mean if someone wants to just do the work for you that's fine, but stuff like this is not really what the forum is for.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-08-2014 , 07:36 PM
Phresh,

Did you try clicking the link I supplied? It highlights the exact line you need to change but to do everything you want will require more changes.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-08-2014 , 07:55 PM
Quote:
Originally Posted by Phresh
I have no idea where I'm supposed to try the form action bit and have 0 understanding of PHP. I'm not a coder and have no coding aspirations. I was wondering if someone could ship me the right code to get these files functional. If this forum is only for testing skills and stuff I can go elsewhere. My apologies.

Thank you for the help.
Usually for things like this people offer some kind of reward.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-09-2014 , 05:20 PM
Quote:
Originally Posted by Shoe Lace
Phresh,

Did you try clicking the link I supplied? It highlights the exact line you need to change but to do everything you want will require more changes.
I actually didn't notice that, thanks. I've edited it. Can you point the piece of the PHP code where I input the email address I'd like the form to be sent to?


Quote:
yeah, i mean if someone wants to just do the work for you that's fine, but stuff like this is not really what the forum is for.
Perhaps I overestimated the work required to make the form functional? I am under the impression it's a simple fix (that Shoe Lace provided) and telling me where to input the recipient's email address. If it's more than that, I'll go elsewhere.

Quote:
Originally Posted by Shoe Lace
Phresh,

Did you try clicking the link I supplied? It highlights the exact line you need to change but to do everything you want will require more changes.
I actually didn't notice that, thanks. I've edited it. Can you point the piece of the PHP code where I input the email address I'd like the form to be sent to?


Quote:
yeah, i mean if someone wants to just do the work for you that's fine, but stuff like this is not really what the forum is for.
Perhaps I overestimated the work required to make the form functional? I am under the impression it's a simple fix (that Shoe Lace provided) and telling me where to input the recipient's email address. If it's more than that, I'll go elsewhere.

Edit: There's a bunch of errors in this form. I'm probably just going to download a functional one. Thanks for the help.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-09-2014 , 05:57 PM
To me, because of the success div/message at the top of the form, it looks like you're missing a few lines of javascript.

Code:
$('#message_form').submit(function(e){
	e.preventDefault();
	var jqxhr = $.post("url-to-php-file", $("#message_form").serialize(), function(data){
		if(data = "success string"){
			//do stuff like show success div
		}
	});
}, "text");

Last edited by txpstwx; 02-09-2014 at 06:12 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m