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
KUBaNPhillipay
Jul 16, 2004
I am not sure if anybody is well versed in the WinAPI here or not, but I have scoured the internet in search of an answer to my question and have gotten nowhere.

I am writing an application using the WinAPI and I would like to enable Windows 7 visual styles. The problem is that when I do this all of the controls are surounded by a gray border than I cannot remove. I would like to make it transparent or be able to set it to my background color but have found no what to do so.

If I disable the windows 7 styling I can change it using the WM_CTLCOLORSTATIC message but then my program looks like it was written 10 years ago.

Can anybody help me or at least point me somewhere that could?

Here is an example of what I am dealing with:
http://www.use.com/cbd5224efb7a5af755c8

KUBaNPhillipay fucked around with this message at 06:14 on Jun 10, 2012

Adbot
ADBOT LOVES YOU

Zhentar
Sep 28, 2003

Brilliant Master Genius
Have you tried responding to WM_CTLCOLORBTN?

edit: oh, wait, it looks like that's for the text color, not the control color... Apparently you just have to owner draw it?

KUBaNPhillipay
Jul 16, 2004
That's what I was afraid of. I would really like to match the operating system theme that the program is running on however. So if it's xp it would give it an xp look or whatever.

Is there a way to use owner draw to match the theme of the operating system?

nielsm
Jun 1, 2009



KUBaNPhillipay posted:

That's what I was afraid of. I would really like to match the operating system theme that the program is running on however. So if it's xp it would give it an xp look or whatever.

Is there a way to use owner draw to match the theme of the operating system?

Yeah, set the BS_OWNERDRAW style on the controls and respond to WM_DRAWITEM in the parent, then use the UX theme functions to draw the parts that need theming.
Remember that you actually need to handle painting differently based on whether theming is enabled or not. You may simply want to remove the BS_OWNERDRAW style when theming is disabled and use the simpler method to get Windows to draw the controls correctly.

Zhentar
Sep 28, 2003

Brilliant Master Genius
I'm looking to do some integration testing for a C# project. I want to be able to write a simple parameterized test, and then provide it with a (long) list of inputs and the expected output for each. I know when I was looking into testing frameworks in previously, I saw some with support for this, but now I'm failing to find it again (probably because I don't know the right name for it). What is it called? What does support this well?

I'm also interested in any fuzz testing tools as well, if there are any suggestions there.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
When you have a website that requires login with username and password, what's the correct way to defeat repeated attempts to log in to an account by trying different passwords?

You could lock a user's account for a fixed amount of time when a certain number of failed attempts have been made to log in - say when 3 failed attempts have been made within 15 minutes. But if you do this then one user could grief another by getting them locked out of their account.

Alternatively, you could lock out users from a particular IP address from logging in if a certain number of failed attempts are made from that IP address. But a knowledgeable user can acquire a different IP address and carry on, so this wouldn't stop an attacker, would it? Or am I mistaken in thinking that users can rapidly change IP addresses?

I guess that if several attempts were made to log in to a particular account from IP addresses not previously associated with that account, you could lock it down except for allowing logins from the IP addresses that have been used to successfully log in in the past. But some users might have frequently changing IP addresses through no fault of their own and then they would be out of luck.

How do sites generally deal with this?

Capri Sunrise
May 16, 2008

Elephants are mammals of the family Elephantidae and the largest existing land animals. Three species are currently recognised: the African bush elephant, the African forest elephant, and the Asian elephant.
Does anybody have any experience with fixing compatibility issues? I don't know how to program but I am working on an Excel spreadsheet that will open .pdf files on my company's intranet and take them to a specific page. I have a code that works on most of the firm's computers (Excel 2003 SP3 with Windows XP.

code:

Sub AppendixCSnowData()
Dim IE As Object, strFile As String, iPageNum As Long
strFile = "P:\Structural - Misc\NBCC 2005\National Building Code of Canada 2005 Volume 2.pdf"
iPageNum = 233
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate strFile & "#Page=" & iPageNum
IE.Visible = True
End Sub

This works, however on other's computers running either new versions of Excel or the same one but with Windows 7, this code does not work and gives an error on the "IE.Navigate strFile & "#Page=" & iPageNum" portion. I have been unable to find anything online that will work on new versions of Excel. Opening .pdf files works, however going to a noted page does not on the other OS set-ups.

Huragok
Sep 14, 2011

Hammerite posted:

When you have a website that requires login with username and password, what's the correct way to defeat repeated attempts to log in to an account by trying different passwords?

...

How do sites generally deal with this?

I do a 5 attempt thing. After that I display a message that they've been locked out for 5 minutes and send an auto generated email telling them about it. Haven't heard any gripes about it yet.

Or use maybe use BrowserID?

nielsm
Jun 1, 2009



Hammerite posted:

When you have a website that requires login with username and password, what's the correct way to defeat repeated attempts to log in to an account by trying different passwords?

I would suggest keeping a "failed login attempts" log. It could be an SQL table with userid, time of attempt and IP address (remember IPv6 exists!) of attempt.
When someone wants to try to log in, if they have more than e.g. 3 entries from the past 20 minutes in that table they automatically fail.
You may want to have some policy on clearing out old data from the log.

If you send an email warning about the failed login, be sure to not unintentionally spam the user.

Salis
Jul 5, 2007
Anyone have any suggestions for websites with some guided practice for a complete programming beginner? I've been going through codecademy, but some concepts aren't explained very well and I've always thought it's better to learn from several different sources. Not to mention there's usually only 1 or 2 exercises per concept. Any other beginner-friendly practice you would recommend?

coaxmetal
Oct 21, 2010

I flamed me own dad
It kinda varies by language, most languages have good tutorials somewhere. I can't really speak directly to any beginner tutorials since I learned my first couple languages in school, but some quick googling should turn up a few. I think python is probably a good language to start with.

Suspicious Dish
Sep 24, 2011

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

Salis posted:

Anyone have any suggestions for websites with some guided practice for a complete programming beginner? I've been going through codecademy, but some concepts aren't explained very well and I've always thought it's better to learn from several different sources. Not to mention there's usually only 1 or 2 exercises per concept. Any other beginner-friendly practice you would recommend?

http://learnpythonthehardway.org/
http://thinkpython.com/

Look Around You
Jan 19, 2009

Salis posted:

Anyone have any suggestions for websites with some guided practice for a complete programming beginner? I've been going through codecademy, but some concepts aren't explained very well and I've always thought it's better to learn from several different sources. Not to mention there's usually only 1 or 2 exercises per concept. Any other beginner-friendly practice you would recommend?

4clojure is supposed to be fairly decent.

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.

Look Around You posted:

4clojure is supposed to be fairly decent.

Use this one. It teaches you a language that is actually good, rather than just popular.

tef
May 30, 2004

-> some l-system crap ->

Sinestro posted:

Use this one. It teaches you a language that is actually good, rather than just popular.

Beware of the side-effects of learning lisp. It makes you a smug rear end in a top hat.

JawnV6
Jul 4, 2004

So hot ...

tef posted:

Beware of the side-effects of learning lisp. It makes you a smug rear end in a top hat.

I thought functional languages didn't have those?

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

nielsm posted:

I would suggest keeping a "failed login attempts" log. It could be an SQL table with userid, time of attempt and IP address (remember IPv6 exists!) of attempt.
When someone wants to try to log in, if they have more than e.g. 3 entries from the past 20 minutes in that table they automatically fail.
You may want to have some policy on clearing out old data from the log.

Note that you should also avoid logging attempts to log in for user ids that don't exist, because it's a common mistake to type a username + password together as the password, and you don't want to compound that mistake by writing it down in your log forever.

JetsGuy
Sep 17, 2003

science + hockey
=
LASER SKATES
So I've been having to debug some IDL code lately, an it's been a good 10 years since I even had to look at this. What is it with physicists and insisting on using languages like FORTRAN and IDL? Seriously.

Anyway, does anyone else use IDL? Would it be worth starting a thread up about?

I figured this would be the place to ask.

Salis
Jul 5, 2007
Thanks for all the different links! Would basic online resources and cheap educational materials like books be enough for me to pick up programming as a hobby? (such as making small games or apps or basic web design) Would I eventually need to take some courses?

Regardless I've got enough material now to cover to last me for a while. Thanks again for the links.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Salis posted:

Would basic online resources and cheap educational materials like books be enough for me to pick up programming as a hobby? (such as making small games or apps or basic web design)

If you combine it with not being afraid to ask for help when you get stuck, it's more than enough.

quote:

Would I eventually need to take some courses?

No.

Thermopyle
Jul 1, 2003

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

Salis posted:

Thanks for all the different links! Would basic online resources and cheap educational materials like books be enough for me to pick up programming as a hobby? (such as making small games or apps or basic web design) Would I eventually need to take some courses?

That's exactly how I learned. You can even take it further than pure hobby status if you wanted to. I'm pretty sure I could get a programming job if I tried.

I've contributed to a handful of open source projects, released some Android apps, and released some open source stuff of my own.

Kafka Esq.
Jan 1, 2005

"If you ever even think about calling me anything but 'The Crab' I will go so fucking crab on your ass you won't even see what crab'd your crab" -The Crab(TM)
I've been hired to try and get a list on a website of unionized business in my area. The downside is that they want something they can update from time to time (approximately every year), and the Excel spreadsheet they want to use is 17000+ lines long.

I've got some limited experience coding in PHP (and have a friend to help if I get stuck), but finding a tutorial on how to grab excel spreadsheet values and plugging them into a framework is eluding me.

So to give you an idea of what I'm doing - I want to design a PHP script to display the business by their NAICS workplace designation (which is just a set of seven numbers) and then take three or four cells of information and plug it into the framework dynamically based on which category the user selects. After that it's just a matter of writing another script sending them to the local yellow pages to get the number. What would I look at to do this? The stuff I've found suggests converting files to .CSV first. Any help would be vastly appreciated.

edit: I might have found a really basic version here: http://www.ibm.com/developerworks/opensource/library/os-phpexcel/

There's nothing more to the information than that, really. edit2: other than sorting them by their code so only the apparel manufacturers show up, for example

Kafka Esq. fucked around with this message at 14:45 on Jun 13, 2012

candide
Jun 16, 2002

The Tipping Point
http://lua-users.org/wiki/UnitTesting

Is there a general consensus on the best unit testing framework for Lua? I got the above link from Google but I'm not as familiar with Lua so I'd be pulling out of a hat pretty much.

Johnny Cache Hit
Oct 17, 2011

Kafka Esq. posted:

So to give you an idea of what I'm doing - I want to design a PHP script to display the business by their NAICS workplace designation (which is just a set of seven numbers) and then take three or four cells of information and plug it into the framework dynamically based on which category the user selects. After that it's just a matter of writing another script sending them to the local yellow pages to get the number. What would I look at to do this? The stuff I've found suggests converting files to .CSV first. Any help would be vastly appreciated.

Run far far away from any attempts to pull directly from Excel. You'll easily spend 90% of your time working on that. Instead, dump the file to a CSV. From there, you can use PHPs builtins for parsing CSV files to loop over each entry, pull out the columns you need, and putting them in... some database, I guess.

It sounds like from there you have the ability to make a frontend to that database.

Impotence
Nov 8, 2010
Lipstick Apathy
Database structure question (mysql/php, not my choice):
How would I store a username and a set of data for that username (more specifically points), and get data like point change per day? Input is cumulative (day1 = 5, day2 = 11, not day1 = 5, day2 = 6).

Might be a dumb question but having a brainfart

Strong Sauce
Jul 2, 2003

You know I am not really your father.





Kim Jong III posted:

Run far far away from any attempts to pull directly from Excel. You'll easily spend 90% of your time working on that. Instead, dump the file to a CSV. From there, you can use PHPs builtins for parsing CSV files to loop over each entry, pull out the columns you need, and putting them in... some database, I guess.

It sounds like from there you have the ability to make a frontend to that database.

I used to have to pull data from an Excel spreadsheet into PHP (I've forgotten what the library was unfortunately) and there was nothing difficult about it. Granted I only had real values to worry about instead of functions but I'm guessing Kafka doesn't have to worry about that either.

I would have a small database like sqlite and dump whatever you need into it. Since it is only 17000 rows I can't imagine any problems with just using sqlite.

Then I would have a cron that checks the CRC32 of the file and whenever it changes, reread the entire file and update any rows accordingly.

Edit: I'm pretty sure the one on the IBM website is the same library I used.

Strong Sauce fucked around with this message at 21:20 on Jun 13, 2012

rolleyes
Nov 16, 2006

Sometimes you have to roll the hard... two?

Biowarfare posted:

Database structure question (mysql/php, not my choice):
How would I store a username and a set of data for that username (more specifically points), and get data like point change per day? Input is cumulative (day1 = 5, day2 = 11, not day1 = 5, day2 = 6).

Might be a dumb question but having a brainfart

Assuming you're storing other data than just the points, I'd have thought the best way to do this would be to create a USER_POINTS table with the user ID from your USERS table as a foreign key, something like:

code:
--------------------------------------
|USERID |POINTSDATE          |POINTS | 
--------------------------------------
|1      |12-Jun-2012 00:00:00|0      |
|1      |13-Jun-2012 00:00:00|5      |
|1      |14-Jun-2012 00:00:00|13     |
|...                                 |
--------------------------------------
Then you can do whatever stats-finding you want on it using aggregate functions etc, e.g. to find the points difference between two dates for a given user:
code:
WITH totalpoints
     AS (SELECT SUM(points)
         FROM   user_points
         WHERE  pointsdate BETWEEN to_date(:startdate) AND to_date(:enddate)
                AND userid = :userid)
SELECT totalpoints - points AS pointsdiff
FROM   user_points
WHERE  pointsdate = to_date(:startdate)
       AND userid = :userid  
That's Oracle syntax so might be rather different for MySQL.

rolleyes fucked around with this message at 09:23 on Jun 14, 2012

Johnny Cache Hit
Oct 17, 2011

Strong Sauce posted:

I used to have to pull data from an Excel spreadsheet into PHP (I've forgotten what the library was unfortunately) and there was nothing difficult about it. Granted I only had real values to worry about instead of functions but I'm guessing Kafka doesn't have to worry about that either.

I would have a small database like sqlite and dump whatever you need into it. Since it is only 17000 rows I can't imagine any problems with just using sqlite.

Then I would have a cron that checks the CRC32 of the file and whenever it changes, reread the entire file and update any rows accordingly.

Edit: I'm pretty sure the one on the IBM website is the same library I used.

Oh, cool, I forgot newer versions of Excel support XML output. When I tried this before the design involved using libraries to parse the older Excel binary workbooks, which really freaking sucked and never came close to working.

I'd still say that parsing a CSV is way easier than mucking around with the DOM, but that's personal preference.

ScooterMcTiny
Apr 7, 2004

I hope this is the right place for this question. I'm trying to use VLC to output frames of a video file. I figured out how to launch VLC from terminal and I think I got the commands right, but for some reason when it exports all the image files, only the first one comes through and the rest are 0kb.

Here's the string I'm executing:

code:
/Applications/vlc.app/Contents/MacOS/VLC -I rc /Volumes/movie.mkv --video-filter=scene --vout=dummy 
--start-time=120 --stop-time=125 --scene-ratio=1 --scene-prefix=img- --scene-path=/Volumes/Gifs
And here's the error I get:

code:
VLC media player 2.0.1 Twoflower (revision 2.0.1-0-gf432547)
[0x102800940] [cli] lua interface: Listening on host "*console".
VLC media player 2.0.1 Twoflower
Command Line Interface initialized. Type `help' for help.
> MKV/Ebml Parser: m_el[mi_level] == NULL
MKV/Ebml Parser: Up cannot escape itself
MKV/Ebml Parser: m_el[mi_level] == NULL
MKV/Ebml Parser: Up cannot escape itself
[0x10380b2f0] dts decoder: DTS channels:6 samplerate:48000 bitrate:1536000
Fontconfig error: Cannot load default config file
Fontconfig error: Cannot load default config file
Fontconfig error: Cannot load default config file
Stream with high frequencies VQ coding
Any idea what might be broken? Let me know if there is a better place for this question.

Opinion Haver
Apr 9, 2007

JawnV6 posted:

I thought functional languages didn't have those?

It actually creates a new copy of you who's a smug rear end in a top hat, and then lets the old one get GCed.

Alternate joke: no, there's plenty of smug assholes in functional programming.

coaxmetal
Oct 21, 2010

I flamed me own dad

yaoi prophet posted:

It actually creates a new copy of you who's a smug rear end in a top hat, and then lets the old one get GCed.

Alternate joke: no, there's plenty of smug assholes in functional programming.

it was a good joke either way, plus clearly true re: smug rear end in a top hat, given sinestro.


I learned Haskell when I was in school and really liked it, but haven't had a good reason/motivation (I'm really bad at motivation) to go back to it or any other functional language since. Kinda want one though.

Scaevolus
Apr 16, 2007

"Functional" doesn't imply pure.

Doctor w-rw-rw-
Jun 24, 2008
Is this the right thread to ask this sort of question...? System architecture is a close enough fit I guess.

How would you design a cloud architecture? Assuming AWS or equivalent, let's say I needed web servers, databases, and bursts of I/O-bound or CPU-bound asynchronous tasks on demand. I'd want monitoring, logging (the sort you might want to run analytics on), and the ability to spin up or spin down to accomodate load as necessary.

What are some of the tools I can do to achieve this? Techniques?

I was thinking of Nagios for monitoring, and scribe or plain ol' syslog for logging.

tl;dr what is your dream architecture, if you had to build it on the cloud? I plan to apply the suggestions to practical use in an upcoming project at work.

Opinion Haver
Apr 9, 2007

Ronald Raiden posted:

it was a good joke either way, plus clearly true re: smug rear end in a top hat, given sinestro.


I learned Haskell when I was in school and really liked it, but haven't had a good reason/motivation (I'm really bad at motivation) to go back to it or any other functional language since. Kinda want one though.

Write a webapp in it! Haskell's not a bad fit since you can use the static typesystem to enforce all kinds of interesting things (Yesod has compile-time-checked templates and routing so if you do it right you literally cannot create URLs that aren't handled by some route).

Huragok
Sep 14, 2011
I got a question...

I'm building an API for a product and had a !!brilliant idea!!. Basically, if the user opts-in and provides a Google Analytics token, when the API enpoint is invoked it'll push a tracking/pageview off to GA.

First: Is this a useful feature (product is a SaaS offering targeted at fellow developers)?

Second: Since I have to do this server-side, I'm thinking of making a basic queue that contains the data of the API endpoint and the time it was hit. A background task will read this queue and use a modified version of this gist. Seems like a simple approach, right?

Kafka Esq.
Jan 1, 2005

"If you ever even think about calling me anything but 'The Crab' I will go so fucking crab on your ass you won't even see what crab'd your crab" -The Crab(TM)

Strong Sauce posted:

I used to have to pull data from an Excel spreadsheet into PHP (I've forgotten what the library was unfortunately) and there was nothing difficult about it. Granted I only had real values to worry about instead of functions but I'm guessing Kafka doesn't have to worry about that either.

I would have a small database like sqlite and dump whatever you need into it. Since it is only 17000 rows I can't imagine any problems with just using sqlite.

Then I would have a cron that checks the CRC32 of the file and whenever it changes, reread the entire file and update any rows accordingly.

Edit: I'm pretty sure the one on the IBM website is the same library I used.
I've just figured out that their hosting plan does not include mySQL and they don't want to pay the extra cash to get it.

ninjaedit: yes, real values such as basic character names, locations, and a few numbers. I'm hunting for something that doesn't use mySQL now.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
a year of low-volume mysql hosting should not cost more than an hour of your time

Kafka Esq.
Jan 1, 2005

"If you ever even think about calling me anything but 'The Crab' I will go so fucking crab on your ass you won't even see what crab'd your crab" -The Crab(TM)
My time is worth basically nothing - it's a sponsored internship.

edit: probably just going to use sqlite

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Kafka Esq. posted:

My time is worth basically nothing - it's a sponsored internship.

Huh? Software developer internships usually pay $15-$25 an hour.

Adbot
ADBOT LOVES YOU

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Otto Skorzeny posted:

Huh? Software developer internships usually pay $15-$25 an hour.

Or course credit.

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