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
MacGowans Teeth
Aug 13, 2003

Zhentar posted:

I like for what I've used it for. I don't know the answer to you question though.
Oh, I agree. There are a lot of things I use it for where I wouldn't use any other tool. I just run into a lot of posts talking about what a pain in the rear end it is.

Adbot
ADBOT LOVES YOU

Titan Coeus
Jul 30, 2007

check out my horn

totalnewbie posted:

Okay, well, today's results also positive. Code here: http://pastebin.com/PWs0J8t7

It is pulling the files over a LAN so I don't know if that is the bottleneck or what but they both take over just a minute to run on about 130 lines with about 100 files. Some lines end up having no file to open, also they are organized by year (by folder and filename) and a mix of xls/xlsx.

If you believe the network is the bottleneck you might be out of luck unless you want to put a lot more effort into it. Assuming this is VBA/VBScript, threading isn't supported in either language.

If you want to some fake thread-like behavior, you can have your code start a new process for each data file (via objShell.Exec or Shell), but you'd need to move your logic into a separate code file which was then executed (once for each data file) by your "main" code.

totalnewbie
Nov 13, 2005

I was born and raised in China, lived in Japan, and now hold a US passport.

I am wrong in every way, all the damn time.

Ask me about my tattoos.
Yeah, if that is indeed the bottleneck then I will just live with it. This implementation just feels better and I think is probably easier to adapt to other uses - which is why I was so hopeful to find something more efficient in the first place.

The code is definitely cleaner and easier to follow IMO so there is always that :D

Thanks for the suggestions, though. Maybe when I am really bored...

totalnewbie fucked around with this message at 20:48 on Oct 3, 2012

Zhentar
Sep 28, 2003

Brilliant Master Genius

Titan Coeus posted:

If you believe the network is the bottleneck you might be out of luck unless you want to put a lot more effort into it. Assuming this is VBA/VBScript, threading isn't supported in either language.

Threading also gets more complicated when it involves COM interop.

I'd bet the bottleneck isn't in the networking (that would be a pretty drat slow network), but in the Excel stuff. Excel's COM interop is not exactly blazing fast.

Impotence
Nov 8, 2010
Lipstick Apathy
Have to change some legacy code, web application that doesn't have https -- would it be "reasonably acceptable" to check if JS is enabled clientside, and then attempt to basic-SHA512 it with external IP or some other stuff as a nonce of a sort (any suggestions?), and HTTP POST that along with adding &prehashed=1 or something to the postdata as a stopgap?

I already know this is disgusting and session hijacking and .js files modified in transit etc, but nothing can do :\

shrughes
Oct 11, 2008

(call/cc call/cc)

Biowarfare posted:

Have to change some legacy code, web application that doesn't have https -- would it be "reasonably acceptable" to check if JS is enabled clientside, and then attempt to basic-SHA512 it with external IP or some other stuff as a nonce of a sort (any suggestions?), and HTTP POST that along with adding &prehashed=1 or something to the postdata as a stopgap?

I already know this is disgusting and session hijacking and .js files modified in transit etc, but nothing can do :\

No, that's completely worthless.

I'm not even sure what you're saying, because you're using pronouns that lack antecedents, but whatever it is, it's completely worthless.

(What is the "it" in "basic-SHA512 it"?) (What does "basic-SHA512" even mean?) (What is "external IP"?) (What is the other stuff?) (It doesn't matter, what you're proposing is completely worthless and doesn't add any security.)

shrughes fucked around with this message at 09:34 on Oct 4, 2012

Flaggy
Jul 6, 2007

Grandpa Cthulu needs his napping chair



Grimey Drawer
So we started getting this error on our website today:

Fatal error: require() [function.require]: Failed opening required '../Sorting Systems/sortingheader.php' (include_path='.;C:\php5\pear') in D:\Hosting\2630349\html\Products\Sorting-Systems\sorting.php on line 43

It happened out of no where with nothing changing as far as us putting any new files or changing any directories. Talked with the host provider, they said they had upgraded their php to 5.3 and we were still on 5.2, so we did the upgrade and it was still broken the line 43 it is refering to is this

<?php require("../Sorting Systems/sortingheader.php"); ?>

Did some function change in the php upgrade? I am at a complete loss here.

e: poo poo I think I broke the tables, apologies.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
I have no idea whether something changed in PHP, but the error refers at one point to a directory called "Sorting Systems" and at another to a directory called "Sorting-Systems". Which is it? Does the require statement use the correct version?

Flaggy
Jul 6, 2007

Grandpa Cthulu needs his napping chair



Grimey Drawer

Hammerite posted:

I have no idea whether something changed in PHP, but the error refers at one point to a directory called "Sorting Systems" and at another to a directory called "Sorting-Systems". Which is it? Does the require statement use the correct version?

Fixed. Thanks for the help.

Flaggy fucked around with this message at 21:26 on Oct 4, 2012

Johnny Cache Hit
Oct 17, 2011

Carthag posted:

Which supposedly should decode to a PICT image of a flower.

I wrote a decode function and if I align it to the structure from Apple's docs on PICT files I get this:

code:
0x0136 -- size
0x0000 0x0000 0x000C 0x000C - bounding box
0x0011 - version 2
0x02FF - always for version 2
0x0c00 (...)
Looks fine to me :shobon: Check your decoding function. Here's my powerfully ugly two minute version:

code:
def convert(v)
  c = {
  "."=>0x00.to_s(2),
  "/"=>0x01.to_s(2),
  "0"=>0x02.to_s(2),

  # and the rest of that massive decode table...
  }
  "%06d"%c[v]
end

def decode(encoded)
  msg = encoded.scan(/.{4}/).map do |block|
    decoded = block.scan(/./).map { |char| convert char }.join
    decoded.scan(/.{8}/).map { |bits| "0x%02x" % bits.to_i(2) }
  end
end

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Thanks, sorry I should have updated my post last night. I took another look at it and realized I had an off-by-one error in my decoding table :downs:

Chillmatic
Jul 25, 2003

always seeking to survive and flourish
I know nothing about coding and am in general stupid. But I think what I want to do is possible, and any help would be really appreciated!

What I'm trying to do is get an RSS feed's XML converted to plain text headlines and descriptions that can be read by a computerized voice. (It's for android/tasker)

I was proud of myself that I managed to program tasker to actually pick up an RSS and read its contents, but it read literally the entire contents of the XML file. :downs:

So essentially what I'd like to do is convert an XML from a given RSS feed into something that looks like the screenshot but is actually just parsed into a normal text file that the phone will be able to read. Is there any way to do something like that which would update itself regularly or is what i'm looking for not actually a thing.

Only registered members can see post attachments!

Cat Plus Plus
Apr 8, 2011

:frogc00l:

Chillmatic posted:

I was proud of myself that I managed to program tasker to actually pick up an RSS and read its contents, but it read literally the entire contents of the XML file. :downs:

Well, that's what RSS is. If you want to use it, you need to parse it first, and then extract whatever information you need out of that. Use an RSS library rather than raw XML parser, though. It'll expose a high-level interface for dealing with feeds instead of DOM tree/SAX events. Java ecosystem loves everything XML so much there should be plenty of those around.

DeathBySpoon
Dec 17, 2007

I got myself a paper clip!
I've got some Access 2010 questions- hopefully this is the right thread. I'm trying to make it so that when I click an item listed in a query in a subform, it updates a text box with info from that record. Here's what it looks like:




So, ideally, when you click on the Algebra 2 record, the CRN text box on the top will fill in with the correct number for the selected class. Same thing with students and their ID number. How would I go about creating this behavior? The only events I seem to have access to are gain focus / lose focus for the subforms, when I really seem to need access to an event when a record is selected. Any ideas? I'm really new to Access, but not to programming in general. This is just a totally new paradigm for me.

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Is this going to support multiple users? Cause Access doesn't really do that at all.

gariig
Dec 31, 2004
Beaten into submission by my fiance
Pillbug
You really want SQL Server 2012 Express assuming a Windows/Microsoft place. It's a scaled down version of SQL Server that has some limitations but should be enough to get you started.

Maybe the better question is why did you pick Access/VBA as the programming language instead of whatever you are more comfortable with?

nielsm
Jun 1, 2009



I have always found Access extremely weird to work in, counter-intuitive in pretty much everything.

If you have a background in regular desktop software development (or even web development) you will probably find it easier to work with Visual C# Express (or Visual Basic Express) and SQL Server Express (as suggested above) and write a proper application. That will let you do your event-driven programming with commits to database when you want it to happen, instead of implicit-everything as Access does.

Unless, of course, using Access is a strict requirement for the task.

lllllllllllllllllll
Feb 28, 2010

Now the scene's lighting is perfect!
I am playing around with Microsoft Small Basic again (please don't laugh) and came around the following problem:

Let's say I want to fill the screen with random pixels. It would be easy to generate random numbers within the dimensions of the resolution. But what if I want to avoid filling a spot more than once (and some very late because the number never comes up)?

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Are you just talking about sampling without replacement?

Grundulum
Feb 28, 2006
I'm now attempting to migrate my terrible, horrible, no-good, very bad code over from Fortran into CUDA Fortran ( :suicide: ).

Here's the minimal working example (there are roughly 16,000 more lines where this came from):
code:
!**********************************************************************
module gpu_kernel

use cudafor

integer, shared :: first_ran4_call

contains
   ! ******************************************************************
   attributes(global) subroutine Cuda_Kernel(iseed)
   
   implicit none
   
   ! Input/output variables
   integer, intent(inout) :: iseed
   ! local variables
   real(kind=4) :: ran
   
   iseed = iseed - (blockIdx%x-1)*blockDim%x - threadIdx%x
   first_ran4_call = 1
   
   ran = ran4(iseed)
   
   return
   end subroutine
   
   
   ! ******************************************************************
   attributes(device) function ran4(idum)
   
   implicit none
   
   integer :: idum
   
   if((idum .lt. 0) .or. (first_ran4_call .eq. 1))then
     first_ran4_call = 0
     idum   = 1
   endif
   
   ran4 = 1.0
   
   return
   end function
end module gpu_kernel



program mc_delB

use gpu_kernel

implicit none

integer :: iseed, BlocksPerGrid, ThreadsPerBlock

BlocksPerGrid = 16; ThreadsPerBlock = 1; iseed = -2255
call Cuda_Kernel<<<BlocksPerGrid,ThreadsPerBlock>>>(iseed)

stop

end program
What I get are the following errors:
code:
Host MODULE data cannot be used in a DEVICE or GLOBAL subprogram - first_ran4_call (Line 20)
1 severe for cuda_kernel
Host MODULE data cannot be used in a DEVICE or GLOBAL subprogram - first_ran4_call (Line 35)
Host MODULE data cannot be used in a DEVICE or GLOBAL subprogram - first_ran4_call (Line 36)
Symbol, ran4, has not been explicitly declared
3 severes for ran4
What am I doing incorrectly? first_ran4_call is declared with the "shared" attribute. How is it being counted as a host variable and not a device variable? Additionally, why is the program not handling the function ran4 correctly?


Edit: For reference, the CUDA Fortran Quick Reference Card, which seems to have exactly the same module structure as my error prone program.
http://www.pgroup.com/lit/literature/pgi_cuf_qrc.pdf



Edit 2, days later: I should have read the quick reference more thoroughly. shared variables, like I intended first_ran4_call to be, can *only* be declared within device or global subroutines/functions.

Grundulum fucked around with this message at 21:01 on Oct 8, 2012

FlyingDodo
Jan 22, 2005
Not Extinct
Is there a good way to seed a noise function? As an example from http://freespace.virgin.net/hugo.elias/models/m_perlin.htm has a noise function like this:


code:
int Noise(int x){

	x = (x<<13) ^ x;
	return ( 1.0 - ( (x * (x * x * 15731 + 789221) + 1376312589) & 7fffffff) / 1073741824.0);    

}
However there is no way to set a seed. One way of doing it I have seen is to just add an extra dimension. So for generating 2d noise you actually generate 3d noise with the z being a seed. But this won't work so great, because seeds close to each other will produce very similar results.

Is there a proper way of doing this?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
The standard implementation I've seen is "A Recursive Implementation of the Perlin Noise Function", from Graphics Gems II.

gonadic io
Feb 16, 2011

>>=
Roughly how long would it take to create a 3D engine/simulator using pretty much only OpenGL in C++? Surely there's already a huge amount of theory w.r.t. dealing with collisions and lighting and all that stuff?

e: I appreciate that this is a really general question but I'm trying to work out if it'd be suitable to base a year long project on.

Mo_Steel
Mar 7, 2008

Let's Clock Into The Sunset Together

Fun Shoe
What plain-text editors do you all recommend for coding / scripting? Working in Notepad++ is what I've been using so far, but I'm curious if there's anything better out there that is recommended.

ToxicFrog
Apr 26, 2008


Mo_Steel posted:

What plain-text editors do you all recommend for coding / scripting? Working in Notepad++ is what I've been using so far, but I'm curious if there's anything better out there that is recommended.

I'm quite fond of JEdit. It only does syntax hilighting (no semantic analysis or automatic compilation or anything) but it's a nice general-purpose programmer's editor.

For heavier stuff I've been using IntelliJ IDEA (with the lua, scala, and clojure plugins) - it's a full-power IDE, though, and the system requirements are pretty steep.

vi and emacs are also common recommendations. At this point I'm not convinced they're worth learning if you don't already know them, though.

gariig
Dec 31, 2004
Beaten into submission by my fiance
Pillbug

Mo_Steel posted:

What plain-text editors do you all recommend for coding / scripting? Working in Notepad++ is what I've been using so far, but I'm curious if there's anything better out there that is recommended.

Sublime Text 2 is my other favorite right now. It is $60 but you don't have to purchase a license it just nags you occasionally.

Also Emacs and Vim

Modern Pragmatist
Aug 20, 2008

ToxicFrog posted:

vi and emacs are also common recommendations. At this point I'm not convinced they're worth learning if you don't already know them, though.

I take it you've never used either of them. They are very much worth the effort to learn and you only have to learn it once since it will work for any language you may be dealing with. Your productivity will thank you later.

ToxicFrog
Apr 26, 2008


Modern Pragmatist posted:

I take it you've never used either of them. They are very much worth the effort to learn and you only have to learn it once since it will work for any language you may be dealing with. Your productivity will thank you later.

I've used both for months at a time. I am still open to being convinced, but the impression I got from both is that all of the "killer features" and customization that are supposedly their big advantages have been standard in graphical editors for at least a decade now, which have the added advantage of being more discoverable. It was also not at all my experience that you "only had to learn it once since it will work for any language", at least in the case of emacs; I was switching between C, C++, Scala, Lua, and bash, and each one required painstaking configuration - and, in some cases, modification - of poorly documented elisp scripts to get it working at all. Contrast this with JEdit (which only does basic syntax hilighting, but does work out of the box for every language I use) or IDEA (which makes it really easy to install new modes and generally does not require you to manually fix them).

(Last time I had this conversation, vim's killer feature was regex-based, multi-file search and replace...in half again as many keystrokes as it takes to do the same thing in JEdit.)

I don't want to start a massive editor flamewar or derail the thread, so we can take this to PM or IRC (or another thread, if there's a suitable one) if you like.

Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.
I've been using acme for years, and now there's a nice video tour of it.

MacGowans Teeth
Aug 13, 2003

I've never tried emacs, but vim is great, and I wish I could do all of my text editing using it. The initial learning curve isn't even really that steep - you start by learning how to move around in a file and enter insert mode, and that gets you basically productive, and then you learn all the other cool poo poo it can do as you go. Setting up a vimrc is pretty straightforward, and plugins are generally easy to find and the ones I've tried work well. Good luck making it look non-hideous on Windows, though...for some reason themes that look great in Linux look terrible or don't work in Windows, so I'm stuck with one of the less ugly defaults if I have to use it in Windows. I've only been using it for a couple of months, so I haven't exactly mastered it, but it's hands down my favorite text editor that I've tried.

Thermopyle
Jul 1, 2003

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

gariig posted:

Sublime Text 2 is my other favorite right now. It is $60 but you don't have to purchase a license it just nags you occasionally.

Also Emacs and Vim

This is a good answer. I switched over to ST2 a few weeks ago and it's still awesome.

Civil Twilight
Apr 2, 2011

Thermopyle posted:

This is a good answer. I switched over to ST2 a few weeks ago and it's still awesome.

I switch between it and vim at regular intervals. For people who aren't interested in learning a lifestyle editor like vim, I can't recommend ST2 highly enough.

Modern Pragmatist
Aug 20, 2008
Sublime Text is pretty great as well. Also you can enable vim keybindings.

Mo_Steel
Mar 7, 2008

Let's Clock Into The Sunset Together

Fun Shoe
Thanks for all the feedback; Sublime looks pretty slick so I'll give that a try for now and see how I feel about it.

oRenj9
Aug 3, 2004

Who loves oRenj soda?!?
College Slice
This should probably go in the homework help thread, but I figured this one attracts more attention.

I'm using Dr Racket to do some development. I have this piece of code that should work, but it doesn't. It is throwing an error despite me using a perfectly legal command.

code:
(define (transpose list) 
  (map (lambda (n1 n2)
         (cons n1 n2))
       (car list)
       (cadr list)
  )
)

(transpose '((1 2) (3 4)))
Now, when I run this, I get an error message that says, "cons: second argument must be a list, but received 1 and 3." But, when I look at this, it says that "The cons function actually accepts any two values, not just a list for the second argument." That indicates that this method should work. What am I doing wrong?

I'm in Advanced Student mode, if that helps. I also tried replacing cons with list, but that resulted in a different error, something about requiring an expression after an open parenthesis.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

Dissenting opinion on the editor thing: I like TextPad, but that might just be because I'm used to it. You can link it into MinGW/other compilers. What I like most about it is the relatively powerful regex search in files you don't have open, no real upward limit on file size, etc.

For Linux I've joined the dark side and actually kinda like vim now.

Sub Par
Jul 18, 2001


Dinosaur Gum
My GPS-enabled running watch generates XML files that basically store the workout state every second. So each second there is a <sample> node that contains the time offset (# secs offset from the workout's start), the lat/long, speed, time, distance, and heart rate metrics.

For fun and to learn some web crap, I want to build a little website that duplicates much of the functionality of sites like TrainingPeaks.com that provide reporting, dashboards, and maps to review runs. I'm trying to decide how to store the data and wonder if anyone has suggestions about the most efficient way?

My day job is super SQL heavy so my immediate reaction is to just shove it into SQL Server but I realize that time series data is sort of a niche thing and that there may be other structures that are better. Am I better off looking at something else, or should I just build a boring old data model and do the work in an RDBMS? Thanks.

nielsm
Jun 1, 2009



It's not really relational data, but it sounds like it still fits neatly into a single SQL relation, so it's probably not a bad choice. Storing it in an SQL database also gives you a language to analyse the data, so I'd say go ahead and do that.

Alternatively you can play with one of those key-value stores/document databases/NoSQL systems, though I don't think you'll win much if anything by that.

raminasi
Jan 25, 2005

a last drink with no ice
There are specifically-tuned time series database engines.

Adbot
ADBOT LOVES YOU

Plorkyeran
Mar 22, 2007

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

oRenj9 posted:

This should probably go in the homework help thread, but I figured this one attracts more attention.

I'm using Dr Racket to do some development. I have this piece of code that should work, but it doesn't. It is throwing an error despite me using a perfectly legal command.

code:
(define (transpose list) 
  (map (lambda (n1 n2)
         (cons n1 n2))
       (car list)
       (cadr list)
  )
)

(transpose '((1 2) (3 4)))
Now, when I run this, I get an error message that says, "cons: second argument must be a list, but received 1 and 3." But, when I look at this, it says that "The cons function actually accepts any two values, not just a list for the second argument." That indicates that this method should work. What am I doing wrong?

I'm in Advanced Student mode, if that helps. I also tried replacing cons with list, but that resulted in a different error, something about requiring an expression after an open parenthesis.
The student languages are not Racket; there's a bunch of occasionally useful but mostly just confusing things that are forbidden in them, such as improper lists (i.e. cons with something other than a cons or empty in the second position). Naturally, the homework assignments never need or noticeably benefit from the forbidden things.

Your main problem is that you made a very poor choice when naming your function's argument.

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