Programming, computers, etc. [Serious]

All things asdf (and anything else)

Re: Programming, computers, etc. [Serious]

Postby atomtengeralattjaro » Wed Jul 06, 2016 8:47 am

how do you run a python script?
History has taught us that we don't learn from the past.

Image
User avatar
atomtengeralattjaro
ASDF's Best Friend
ASDF's Best Friend
 
Posts: 33554
Joined: Wed May 23, 2007 11:43 am
Location: green

Re: Programming, computers, etc. [Serious]

Postby Shai'tan » Wed Jul 06, 2016 10:25 am

What do you mean? From C#? Should be possible, saw some examples when I googled it.
Quote of the Ages:

Image
User avatar
Shai'tan
ASDF's Best Friend
ASDF's Best Friend
 
Posts: 25484
Joined: Fri Sep 14, 2007 8:14 am
Location: Seven

Re: Programming, computers, etc. [Serious]

Postby atomtengeralattjaro » Wed Jul 06, 2016 12:07 pm

I meant in general, I know i could google this, but i'm lazy. So you need a python runtime thing to be installed, and then just run your thing? Or is there something special? Because I'm not sure why you need to start it from .NET then, if there isn't anything to it.
Anyway, System.Diagnostics.Process.Start(filename) will start things.
History has taught us that we don't learn from the past.

Image
User avatar
atomtengeralattjaro
ASDF's Best Friend
ASDF's Best Friend
 
Posts: 33554
Joined: Wed May 23, 2007 11:43 am
Location: green

Re: Programming, computers, etc. [Serious]

Postby Arkannine » Wed Jul 06, 2016 1:36 pm

Oh, I've been learning Python and it's fantastic for rapid development and simple scripts. There is a library/function for anything low-level you can think of, so you don't have to worry at all about that and it's really easy to get going. Most of these libraries are built-in, and the ones that aren't are extremely simple to include; there's pip, which is similar to a package manager in which you just
Code: Select all
pip install numpy

and then you just have to
Code: Select all
import numpy

at the top of your code, no version complications, no file location complications, no having to fiddle with any settings to get it working, it just works out of the box. Simply amazing.

atomtengeralattjaro wrote:how do you run a python script?


You must have a Python interpreter installed (that is, the official one you download from the python website or your package manager).
Then, if you're on Linux/Mac or you're on Windows and the installation is in your Path variables just
Code: Select all
python script.py


You can also double-click it but it has that small issue also present in whatever language where the program will exit immediately on completion, so if it's a terminal application it'll close as soon as it's done which might not leave time to read stuff if you need to and there wasn't a blocking input request at the end of the program.

Also because it's interpreted it means anything you write is multi-platform out of the box! I think there's some modules that aren't, if they depend on calls to external languages, but I never had to use one of those. It's so easy I actually just keep my .py files in my Dropbox folder and edit and run them across OS's.
assdef wrote:I've seen a number of Cocks in my days.
User avatar
Arkannine
ASDF Warlord
ASDF Warlord
 
Posts: 15518
Joined: Tue Oct 28, 2008 5:21 pm
Location: I'm on a boat

Re: Programming, computers, etc. [Serious]

Postby Shai'tan » Thu Jul 07, 2016 3:32 am

atomtengeralattjaro wrote:I meant in general, I know i could google this, but i'm lazy. So you need a python runtime thing to be installed, and then just run your thing? Or is there something special? Because I'm not sure why you need to start it from .NET then, if there isn't anything to it.
Anyway, System.Diagnostics.Process.Start(filename) will start things.


Arkannine is correct on how it runs. I was thinking of having an all-in one program that could do a lot of stuff we need for work. Having the python script be something external kinda defeats the purpose. There's also the issue that the python script depends on a couple of extra packages I installed through pip. Which is a rather painful thing to do for most people as it needs Cntlm to use the proxy at work. I'd rather avoid doing that if it's something I'm to give to my colleagues.
Quote of the Ages:

Image
User avatar
Shai'tan
ASDF's Best Friend
ASDF's Best Friend
 
Posts: 25484
Joined: Fri Sep 14, 2007 8:14 am
Location: Seven

Re: Programming, computers, etc. [Serious]

Postby Anonymously Famous » Thu Jul 07, 2016 2:23 pm

Shai'tan wrote:Figured it out! Managed to do it in Python with Requests and NLTLM, so now I just need to reproduce it in C# or call the python script from C#.

I believe you can embed Python in programs, so you might want to look into that.

Glad you got it figured out!
ThingerDudes wrote:The only reasonable amount of Nutella is infinity. Everything else is too little.

Proud poster of the 300kth post in General
User avatar
Anonymously Famous
JKL; Assassin
JKL; Assassin
 
Posts: 10094
Joined: Thu Mar 03, 2011 2:52 pm

Re: Programming, computers, etc. [Serious]

Postby Shai'tan » Thu Jul 07, 2016 5:38 pm

Might look into that as it was a lot easier to do than it seems to be in C#. Taking a little break from that though, now working on communicating with Active Directory, which is one of the reasons I want to build this in C# as well. (It looks to be a lot easier to do this in C#).
Quote of the Ages:

Image
User avatar
Shai'tan
ASDF's Best Friend
ASDF's Best Friend
 
Posts: 25484
Joined: Fri Sep 14, 2007 8:14 am
Location: Seven

Re: Programming, computers, etc. [Serious]

Postby Anonymously Famous » Mon Jul 11, 2016 1:53 pm

It might be fun to have a program that's a Frankensteined together C# and Python program.
ThingerDudes wrote:The only reasonable amount of Nutella is infinity. Everything else is too little.

Proud poster of the 300kth post in General
User avatar
Anonymously Famous
JKL; Assassin
JKL; Assassin
 
Posts: 10094
Joined: Thu Mar 03, 2011 2:52 pm

Re: Programming, computers, etc. [Serious]

Postby Shai'tan » Mon Jul 11, 2016 3:36 pm

Hehe, might be. Just worried about having to download extra stuff for python because that is not easy.
Quote of the Ages:

Image
User avatar
Shai'tan
ASDF's Best Friend
ASDF's Best Friend
 
Posts: 25484
Joined: Fri Sep 14, 2007 8:14 am
Location: Seven

Re: Programming, computers, etc. [Serious]

Postby Anonymously Famous » Tue Jul 12, 2016 2:08 pm

Well, however you get it to work, I hope it's not too much trouble in the long run.
ThingerDudes wrote:The only reasonable amount of Nutella is infinity. Everything else is too little.

Proud poster of the 300kth post in General
User avatar
Anonymously Famous
JKL; Assassin
JKL; Assassin
 
Posts: 10094
Joined: Thu Mar 03, 2011 2:52 pm

Re: Programming, computers, etc. [Serious]

Postby Shai'tan » Tue Jul 12, 2016 3:50 pm

True. If I can get it to work that's the main point anyway.
Quote of the Ages:

Image
User avatar
Shai'tan
ASDF's Best Friend
ASDF's Best Friend
 
Posts: 25484
Joined: Fri Sep 14, 2007 8:14 am
Location: Seven

Re: Programming, computers, etc. [Serious]

Postby Arkannine » Sat Jul 16, 2016 1:26 pm

Shai'tan wrote:Hehe, might be. Just worried about having to download extra stuff for python because that is not easy.


Have you heard about [url="http://cython.org/"]Cython[/url]? I never used it, but my impression is that it converts Python into C and then compiles into bytecode. Might be worth a look.
assdef wrote:I've seen a number of Cocks in my days.
User avatar
Arkannine
ASDF Warlord
ASDF Warlord
 
Posts: 15518
Joined: Tue Oct 28, 2008 5:21 pm
Location: I'm on a boat

Re: Programming, computers, etc. [Serious]

Postby Shai'tan » Sun Jul 17, 2016 4:05 pm

Hmm, think I have heard of it, but never used it. I'll look into it, thanks!

Also, you don't need the " around the url.
Quote of the Ages:

Image
User avatar
Shai'tan
ASDF's Best Friend
ASDF's Best Friend
 
Posts: 25484
Joined: Fri Sep 14, 2007 8:14 am
Location: Seven

Re: Programming, computers, etc. [Serious]

Postby Anonymously Famous » Mon Aug 01, 2016 5:47 pm

The other day, I discovered that one of my coworkers knows about and uses one of my favorite scripting languages that no one has heard about. And he's done stuff that's a lot more complicated than anything I've ever done with it. Thousands of lines of code, with GUI, etc. It was fun to talk about it with him when just about everyone else goes "What is that?"
ThingerDudes wrote:The only reasonable amount of Nutella is infinity. Everything else is too little.

Proud poster of the 300kth post in General
User avatar
Anonymously Famous
JKL; Assassin
JKL; Assassin
 
Posts: 10094
Joined: Thu Mar 03, 2011 2:52 pm

Re: Programming, computers, etc. [Serious]

Postby atomtengeralattjaro » Tue Sep 20, 2016 3:45 am

Encoding bullcrap:



I see this black diamond shape with a white question mark in it a lot in this old article. Is there anything to be done about this, or is it a lost cause? Seems to be in place of punctuation.
History has taught us that we don't learn from the past.

Image
User avatar
atomtengeralattjaro
ASDF's Best Friend
ASDF's Best Friend
 
Posts: 33554
Joined: Wed May 23, 2007 11:43 am
Location: green

Re: Programming, computers, etc. [Serious]

Postby ThingerDudes » Tue Sep 20, 2016 3:38 pm

Not sure what the best way to go about doing this is but if you can get the hex values of the characters and put that into something like this maybe that would help?
Image
User avatar
ThingerDudes
ASDF Warlord
ASDF Warlord
 
Posts: 20470
Joined: Sun Apr 12, 2009 12:12 am
Location: close enough.

Re: Programming, computers, etc. [Serious]

Postby Anonymously Famous » Wed Sep 21, 2016 6:22 pm

It is indeed an encoding issue. The page is encoded in ANSI (Windows-1252), but is being displayed as though it were encoded in UTF-8. What you're seeing is the "replacement character," which is often shown when the current encoding can't properly render the data as characters. The page source doesn't declare an encoding (aka "charset") in the metadata, so it's up to the browser to guess. If you go to "View" -> "Text Encoding" -> "Western" (Firefox) or "More Tools" -> "Encoding" -> "Western (Windows-1252)" (Chrome), it should correct any issues.
ThingerDudes wrote:The only reasonable amount of Nutella is infinity. Everything else is too little.

Proud poster of the 300kth post in General
User avatar
Anonymously Famous
JKL; Assassin
JKL; Assassin
 
Posts: 10094
Joined: Thu Mar 03, 2011 2:52 pm

Re: Programming, computers, etc. [Serious]

Postby atomtengeralattjaro » Thu Sep 22, 2016 3:42 pm

Thanks AF! Super.
I didn't even think to look anywhere near there, as I usually have the menu bar hidden in firefox..
History has taught us that we don't learn from the past.

Image
User avatar
atomtengeralattjaro
ASDF's Best Friend
ASDF's Best Friend
 
Posts: 33554
Joined: Wed May 23, 2007 11:43 am
Location: green

Re: Programming, computers, etc. [Serious]

Postby Anonymously Famous » Thu Sep 22, 2016 7:27 pm

No problem! I may use this website as a real world example of character encoding issues.
ThingerDudes wrote:The only reasonable amount of Nutella is infinity. Everything else is too little.

Proud poster of the 300kth post in General
User avatar
Anonymously Famous
JKL; Assassin
JKL; Assassin
 
Posts: 10094
Joined: Thu Mar 03, 2011 2:52 pm

Re: Programming, computers, etc. [Serious]

Postby Anonymously Famous » Fri Oct 21, 2016 3:08 pm

Someone did a DDoS on a DNS, and now a bunch of stuff I need to access to do my job effectively are unavailable. So I'm here.

Here's an article about the attack.
ThingerDudes wrote:The only reasonable amount of Nutella is infinity. Everything else is too little.

Proud poster of the 300kth post in General
User avatar
Anonymously Famous
JKL; Assassin
JKL; Assassin
 
Posts: 10094
Joined: Thu Mar 03, 2011 2:52 pm

PreviousNext

Return to General

Who is online

Users browsing this forum: Google [Bot] and 12 guests