Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Kilson
Jan 16, 2003

I EAT LITTLE CHILDREN FOR BREAKFAST !!11!!1!!!!111!

Shinku ABOOKEN posted:

I am trying to intercept and modify network traffic going through an "ad-hoc" network running on my Windows 7 laptop (my laptop is the access point).

Currently I am able to sniff the traffic, but I am at a loss with regards to actually stopping the packets at my machine and then re-sending them with extra modifications.

The way network adapters work on Windows is total magick to me.

(I can't use Linux because NVIDIA® Optimus™ Sucks© Balls℠)

Get some kind of proxy thing like Proximitron(sp?) and that should let you do it

Adbot
ADBOT LOVES YOU

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Here's a more philosophical question regarding software design. Everybody talks about "simplicity," but I feel like that doesn't entirely represent the value everybody wants. Something that is simple can be very crude. I was trying to find a better word to get to the core of this. In normal language, the best I could really find is "elegant," but that can imply it is delicate or fashionable. After floating around with this, I came across an old Italian word that only recently became popular in English: sprezzatura.

quote:

a certain nonchalance, so as to conceal all art and make whatever one does or says appear to be without effort and almost without any thought about it

It's traditionally used to define people, originally courtiers, and more recently as ladies/gentlemen, but it sounds more apt. Regardless of language or subdisciplines, I figured the programmers of the thread have an idea of what I'm trying to get at, and if there's a very concise word or words to describe design simplicity.

The Gripper
Sep 14, 2004
i am winner

Shinku ABOOKEN posted:

I am trying to intercept and modify network traffic going through an "ad-hoc" network running on my Windows 7 laptop (my laptop is the access point).

Currently I am able to sniff the traffic, but I am at a loss with regards to actually stopping the packets at my machine and then re-sending them with extra modifications.

The way network adapters work on Windows is total magick to me.

(I can't use Linux because NVIDIA® Optimus™ Sucks© Balls℠)
I think you'd need to somehow route all traffic into userspace, modify things there then send it back out. If you're not doing that then what you're likely capturing/trying to modify is just a copy of the actual traffic, which is being delivered to your capturing tool as well as being sent on it's way to it's destination at the same time.

floWenoL
Oct 23, 2002

Rocko Bonaparte posted:

Here's a more philosophical question regarding software design. Everybody talks about "simplicity," but I feel like that doesn't entirely represent the value everybody wants. Something that is simple can be very crude. I was trying to find a better word to get to the core of this. In normal language, the best I could really find is "elegant," but that can imply it is delicate or fashionable. After floating around with this, I came across an old Italian word that only recently became popular in English: sprezzatura.


It's traditionally used to define people, originally courtiers, and more recently as ladies/gentlemen, but it sounds more apt. Regardless of language or subdisciplines, I figured the programmers of the thread have an idea of what I'm trying to get at, and if there's a very concise word or words to describe design simplicity.

I don't think "sprezzatura" is the right word. Perhaps you're looking for "parsimony".

Workaday Wizard
Oct 23, 2009

by Pragmatica

The Gripper posted:

I think you'd need to somehow route all traffic into userspace, modify things there then send it back out. If you're not doing that then what you're likely capturing/trying to modify is just a copy of the actual traffic, which is being delivered to your capturing tool as well as being sent on it's way to it's destination at the same time.

Apparently I need to either write a filter driver or use Windows Filtering Platform for this. I am not being paid enough to work on Windows Driver development and looking at WFP's docs I see that the filtering rules are not what I need and I don't think I can do TCP injection with it :(

Welp, I guess it's time I try to make Linux work on my laptop again.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

floWenoL posted:

I don't think "sprezzatura" is the right word. Perhaps you're looking for "parsimony".

Wouldn't that imply cheapness? I didn't think that was regarded as a good term.

Foreign Tourist
May 17, 2013
I know I'm still new here, but I was wondering if there's any interest in a thread on esoteric programming languages? I've been wanting to make one, but most of the threads in this forum seem huge and helpful, and I don't know if a thread on esoteric programming languages would be either.

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Just start it and see how it goes.

floWenoL
Oct 23, 2002

Rocko Bonaparte posted:

Wouldn't that imply cheapness? I didn't think that was regarded as a good term.

There are two definitions. I'm thinking #2 in http://www.merriam-webster.com/dictionary/parsimony .

It's worth pointing out that Occam's razor is also known as the "law of parsimony".

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Foreign Tourist posted:

I was wondering if there's any interest in a thread on esoteric programming languages?

I would read this and probably write some crazy things for it, as is my way.

BigRedDot
Mar 6, 2008

"clean" is the word I use.

205b
Mar 25, 2007

I don't know how I'm this bad at bash scripting, but I'm trying to colorize my bash prompt and somehow breaking things in the process. If I call this function:
code:
build_prompt() {
    echo -ne "\x1B[31m"
    echo -ne "\x1B[42m"
    echo -n 'prompt>'
    echo -ne "\x1B[39m"
    echo -ne "\x1B[49m"
}
it prints out a colorized prompt followed by the normal prompt as expected, but then if I type a line or two of gibberish, the seven characters directly under the "prompt>" string are written to twice. (After the seventh character, the cursor moves itself to the beginning of the line.) There's probably a simple explanation for this but I can't figure it out to save my life - I double checked the escape sequence about four times. Any thoughts?

edit: Also if I set PS1=$(build_prompt), the prompt gets changed but most of the prompt line is written to twice

edit 2: Never mind, think I got it. The extra brackets in "\[\x1B[31m\]" tell bash that the escape sequence won't take up any space in the terminal

205b fucked around with this message at 03:58 on May 26, 2013

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

What reasons are there to NOT use CoffeeScript?

Opinion Haver
Apr 9, 2007

The syntax is janky as poo poo. How many arguments are passed to f in f x, y, g a, b, c? What's the difference between f() -> 2 and f () -> 2?

Doctor w-rw-rw-
Jun 24, 2008

Thermopyle posted:

What reasons are there to NOT use CoffeeScript?

No explicit globals?

tarepanda
Mar 26, 2011

Living the Dream

Thermopyle posted:

What reasons are there to NOT use CoffeeScript?

You have to compile it.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Doctor w-rw-rw- posted:

No explicit globals?

While I don't really agree with the syntax is janky assertion its debatable. On the other hand you can always assign variables to the global object so explicit globals are easy to declare. If you're writing for node and the browser you can always lead up your files with root = window or global.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Doctor w-rw-rw- posted:

No explicit globals?

It's just "no shadowing", which is an absolutely terrible idea. It's not just "globals".

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

yaoi prophet posted:

The syntax is janky as poo poo. How many arguments are passed to f in f x, y, g a, b, c? What's the difference between f() -> 2 and f () -> 2?
Both of these are things that should confuse you exactly once. CoffeeScript syntax definitely has some weird points[1], but the rules are all quite simple and should not be an ongoing source of confusion.

The lack of variable shadowing is a bit of an issue, but shadowing is an issue in some way in basically every language without explicit variable declarations.

[1] My current least-favorite quirk is the following, which for some reason doesn't come up much in complaints about CoffeeScript:
code:
setTimeout ->
  foo()
  ...
, 1000
I've sort of gotten used to it, but it still looks really dumb.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Thermopyle posted:

What reasons are there to NOT use CoffeeScript?

Adding a compile step. Beyond that, personal preference.

BigRedDot
Mar 6, 2008

yaoi prophet posted:

How many arguments are passed to f in f x, y, g a, b, c?
So don't do that? It's not like you can't use parenthesis for function application.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Plorkyeran posted:

[1] My current least-favorite quirk is the following, which for some reason doesn't come up much in complaints about CoffeeScript:
code:
setTimeout ->
  foo()
  ...
, 1000
I've sort of gotten used to it, but it still looks really dumb.

That's the main bit of syntax style I'm not big on, multiple function arguments. Everything else is really not that hard unless your exposure to Coffeescript is a quick browse of someone else's source, at which point really what did you expect if you're not planning to learn the language.

The Insect Court
Nov 22, 2012

by FactsAreUseless

yaoi prophet posted:

The syntax is janky as poo poo. How many arguments are passed to f in f x, y, g a, b, c? What's the difference between f() -> 2 and f () -> 2?

This is true, and it's a result of bolting on any neat looking bit of syntax without really considering whether it fits the language. My solution has always been to write Pythonic Coffeescript, although I'm not sure if CS derivatives like Coco or Livescript are any better.

Hughlander
May 11, 2005

tarepanda posted:

You have to compile it.

pokeyman posted:

Adding a compile step. Beyond that, personal preference.

I can't find a quick link for it but at work we use some combination of source maps + node that skips the compile step and no js is generated on the filesystem / all stack / errors are for Coffeescript. I've mentioned before I think in this thread my annoyance with Coffeescript is having to track down other engineers mistakes like:
code:
    # Call x with 3 arguments
    foo.x 1 2 3
    # Call x with 2 arguments
    foo.x 1 2
    # Call x with 1 arguments
    foo.x 1
    # Value of x
    foo.x

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Hughlander posted:

I can't find a quick link for it but at work we use some combination of source maps + node that skips the compile step and no js is generated on the filesystem / all stack / errors are for Coffeescript.

That sounds awesome, if you do track down a link please share.

Gounads
Mar 13, 2013

Where am I?
How did I get here?

tarepanda posted:

You have to compile it.

I saw that as a plus. Catching problems before I go run & debug it = win

Use Grunt.js to auto watch & compile, and it's no bother at all.

I guess jslint catches similar problems, but I've had better luck with the full coffeescript compiler catching my fuckups.

edmund745
Jun 5, 2010
I have a calendar question: over a span of only 2 years, can you always assume that there are 52 complete weeks (from Sunday to Saturday) in the first year?

I have a scheduling program I'm writing that shows a 3-year span of events in one chart. The schedules are weekly and end on Saturday.
The picturebox/image of it looks more or less like below:
[..previous year..][....current year....][.....next year....]

Only the current year is editable and when the user clicks on a point on the chart, it selects a month & week that shows up in more detail in another picturebox. {The [next year] really only shows the events from the current year that overlap into next year, so editing "next year" is not really an issue}

But anyway, I put all the data for the three years into one array. So I need a way to jump over all of the first year's weeks in this array somehow in order for the program to select the proper week (in the current year) for editing.

? Is it safe to assume that there will always be 52 complete weeks in a year, or should I write something to actually count the weeks? I can't find any reference that says that over a 1-year period there would be less than 52 weeks, and the extra 1/7th week wouldn't matter in only a 2-year span (it wouldn't possibly total another whole 7 days, because to do that would require 371 days in that year, which isn't gonna happen for a loooooong time yet....).

This is for the usual Gregorian calendar--localization to other calendars isn't a concern--and is not an accounting issue, so there's none of that leap-year-every-seven-years silliness involved.

edmund745 fucked around with this message at 20:13 on May 27, 2013

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


52 weeks is 364 days, so yes, there will always be 52 full weeks in a single year.

Edit: Missed the bit about needing weeks to run Sunday to Saturday. So no, there may be 51 actual weeks, but there will always be 52 seven-day periods.

ultrafilter fucked around with this message at 20:27 on May 27, 2013

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
There won't always be 52 complete weeks fully contained within the year (and in fact usually won't), but there will always be at least 52 weeks beginning in a given year.

Plorkyeran fucked around with this message at 21:15 on May 27, 2013

edmund745
Jun 5, 2010

Plorkyeran posted:

There won't always be 52 complete weeks fully contained within the year (and in fact usually won't), but there will always be at least 52 weeks beginning in a given year.

Well really I suppose that "52 complete weeks" aren't required in the year, since the "year" of the week is counted as whatever year the ending Saturday falls in.
And there wouldn't be more (or less) than 52 Saturdays in a year since that would require less than/more than 364/365 days.... ? :|

nielsm
Jun 1, 2009



edmund745 posted:

Well really I suppose that "52 complete weeks" aren't required in the year, since the "year" of the week is counted as whatever year the ending Saturday falls in.
And there wouldn't be more (or less) than 52 Saturdays in a year since that would require less than/more than 364/365 days.... ? :|

You do once in a while have years with 53 numbered weeks. Approximately every 5-6 years. Since 52 weeks add up to 364 days that leaves one extra, two extra on leap years. So unless you are at a century boundary (where there is no leap year), 6 years add up to 7 "spare" days, or 5 years in the cases of two leap-years within the period. Then you get those 53 numbered weeks in a year.
Also, the ISO standard for week numbers is that a week belongs to the year which the Thursday falls in. The Saturday thing is USA, Canada and Mexico only, according to Wikipedia. (And over here in Europe, Monday is generally considered the first day of the week.)

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

edmund745 posted:

Well really I suppose that "52 complete weeks" aren't required in the year, since the "year" of the week is counted as whatever year the ending Saturday falls in.
And there wouldn't be more (or less) than 52 Saturdays in a year since that would require less than/more than 364/365 days.... ? :|
There'll be 53 Saturdays if the first day is a Saturday (or a Friday on leap years).

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


There are only fourteen possible calendars, and they can be parametrized by the weekday of January 1st and whether or not it's a leap year. It might be easiest just to count the number of weeks in each of those and be done with it.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

nielsm posted:

unless you are at a century boundary (where there is no leap year)

Careful with that...

qntm
Jun 17, 2009

Although your week starts/ends at midnight on Sunday, whereas an ISO week starts/ends at midnight on Monday, you may find this very useful:

http://en.wikipedia.org/wiki/ISO_week_date

edmund745
Jun 5, 2010

qntm posted:

Although your week starts/ends at midnight on Sunday, whereas an ISO week starts/ends at midnight on Monday, you may find this very useful:

http://en.wikipedia.org/wiki/ISO_week_date

No, it kinda makes my head hurt, really. ;)
I will just have to count the Saturdays in the previous year it seems.
-Either that, or write a metric/decimal calendar setup and convince everyone else that it's a REALLY good idea......

Madox
Oct 25, 2004
Recedite, plebes!
I have a Windows programming question. I want to be able to draw Windows windows to a texture for use in a 3d environment. This is demonstrably possible since things like SphereXP and BumpTop do it. (See here http://superuser.com/questions/114390/make-the-desktop-look-like-3d-in-windows-7-and-xp )

I know the Desktop Window Manager API lets you access composition data and get thumbnails etc, but how do I go about getting the image of the actual window so I can use it as a texture in my own app? I appreciate any tips anyone has.

nielsm
Jun 1, 2009



Madox posted:

I have a Windows programming question. I want to be able to draw Windows windows to a texture for use in a 3d environment. This is demonstrably possible since things like SphereXP and BumpTop do it. (See here http://superuser.com/questions/114390/make-the-desktop-look-like-3d-in-windows-7-and-xp )

I know the Desktop Window Manager API lets you access composition data and get thumbnails etc, but how do I go about getting the image of the actual window so I can use it as a texture in my own app? I appreciate any tips anyone has.

Raymond Chen covered some of this just a short while ago: http://blogs.msdn.com/b/oldnewthing/archive/2013/05/13/10417964.aspx
I'm not sure if that can actually help solve your problem, though.

Madox
Oct 25, 2004
Recedite, plebes!

nielsm posted:

Raymond Chen covered some of this just a short while ago: http://blogs.msdn.com/b/oldnewthing/archive/2013/05/13/10417964.aspx
I'm not sure if that can actually help solve your problem, though.

That method doesnt seem to give me something I can use as a texture of a window. I have also found this page which talks about IDXGIOutputDuplication interface to the desktop. http://www.virtualdub.org/blog/pivot/entry.php?id=356

This returns a bitmap stream of the windows desktop, but doesn't let me get each window separately. It seems promising though.

Adbot
ADBOT LOVES YOU

Hughlander
May 11, 2005

pokeyman posted:

That sounds awesome, if you do track down a link please share.

Turns out it's just native CoffeeScript 1.6+ Using 1.6.2 and NodeJS 0.10.5 our command-line just looks like:

nodemon server.coffee -command -line -args

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply