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
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

ultrafilter posted:

Or course credit.

Oooooooh that's spectacularly painful

Adbot
ADBOT LOVES YOU

Nippashish
Nov 2, 2005

Let me see you dance!

Otto Skorzeny posted:

Oooooooh that's spectacularly painful

Sometimes you can get grants to hire interns, I assumed this is what he meant by "sponsored".

canned_fruit
Feb 4, 2008
Apologies if this is the wrong thread but I'm sure you guys will know:

Is it actually possible to make money off Chrome/Firefox extensions through advertising or otherwise? All I can find from googling is that Google doesn't allow adsense in extensions. How about alternatives like adbrite?

Sorry if I'm way off the mark, I'm only just starting to get my head around it all.

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)
Haha, no, guys, the kicker is that I am a liberal arts major who preferred to do history/political science over computer science.

This is an internship with a worker's organization that I took to get contacts in the area (which is working spectacularly, by the way). So I'm not getting paid much more than 11/hr or so. Theoretically, however, I don't have to be doing this at all - they wanted a list of common ones. I just wanted them to be able to search them all, easily.

Anyway, I'm working on installing SQLite tonight. We'll see how it goes.

edit: I guess I meant trying to get it working with what I have so far. vvv

Kafka Esq. fucked around with this message at 21:38 on Jun 17, 2012

Doctor w-rw-rw-
Jun 24, 2008

Kafka Esq. posted:

Haha, no, guys, the kicker is that I am a liberal arts major who preferred to do history/political science over computer science.

This is an internship with a worker's organization that I took to get contacts in the area (which is working spectacularly, by the way). So I'm not getting paid much more than 11/hr or so. Theoretically, however, I don't have to be doing this at all - they wanted a list of common ones. I just wanted them to be able to search them all, easily.

Anyway, I'm working on installing SQLite tonight. We'll see how it goes.

SQLite isn't really something you install. at least, not in the way you do databases like Postgres or MySQL. It's just a library that manipulates database files, so you don't install it per se - you install the library that provides your language with its functionality.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
Suppose you are creating a web application and you want users to be able to create accounts and choose usernames for them. You don't want to restrict the characters they can use without good reason, so you intend to allow any Unicode character unless there is a good reason not to allow it. What characters do you disallow, and how would you code a function to check whether a username is acceptable or not?

nielsm
Jun 1, 2009



Go read a bit about Unicode normalisation forms, it's very relevant for things that have to not just be displayed but also compared and searched against.
Alternatively, have plain ASCII usernames and then display names in addition to that.

pseudorandom name
May 6, 2007

Also Unicode Character Classes, to filter out such things as U+1F4A9 PILE OF POO.

Impotence
Nov 8, 2010
Lipstick Apathy
I want to learn some ASP/ASP .NET. What kind of webserver setup should I be using? I have a Windows server, but it's 2003 and I don't know if IIS 7.5 runs on it, or how setup should be done (is IIS versioning tied to the OS exactly?) Any quickstart tutorials to get off the ground?

Quebec Bagnet
Apr 28, 2009

mess with the honk
you get the bonk
Lipstick Apathy

Biowarfare posted:

I want to learn some ASP/ASP .NET. What kind of webserver setup should I be using?

Windows.

quote:

(is IIS versioning tied to the OS exactly?)

Yes. IIS 6, which is the version included with Windows 2003, can run ASP.NET 4.0 applications and any framework that works with that, so you're OK there. You'll need to handle URLs a little differently if you're using ASP.NET MVC because IIS 6 handles URL processing differently from 7, information on that is in the MVC guide.

quote:

Any quickstart tutorials to get off the ground?

http://www.asp.net
http://www.asp.net/mvc

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

pseudorandom name posted:

U+1F4A9 PILE OF POO.

I laughed way too hard when I looked this up

Doctor w-rw-rw-
Jun 24, 2008

Otto Skorzeny posted:

I laughed way too hard when I looked this up

It's also included as one of iOS's emoji, but looks entirely too happy.

Jehde
Apr 21, 2010

I'm trying to create a simple text file parser for an iPhone app with no experience in Obj-C prior. I've managed to get as far as loading the file into a string and separating the string using delimiters, which creates a bunch of strings for each input, but I need to convert these strings into an array of usable integers.

This is what I have so far:
code:
// Build array of strings for each parameter.
NSArray *strparams = [[lines objectAtIndex:i] componentsSeparatedByString:@" "];

// Initialize array for integers of each paramater.
NSMutableArray *params = [NSMutableArray arrayWithCapacity:6];

for (int index = 0; index < [strparams count]; index++)
{
	// Convert string parameter at index into integer. [NOT WORKING]
	int intParam = (int)[strparams objectAtIndex:index];  

	// Put integer into integer array.              
        [params replaceObjectAtIndex:index withObject:intParam];
}
I tried to simply take the string item out of the string array and cast it as an int, and then store that int into a new array, but it returns an error "Incompatible integer to pointer conversion sending 'int' to parameter of type 'id'"

Any ideas?

Suspicious Dish
Sep 24, 2011

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

Otto Skorzeny posted:

I laughed way too hard when I looked this up

U+1F3E9

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Objective-C code:
int intParam = [[strparams objectAtIndex:index] intValue];
[params replaceObjectAtIndex:index withObject:[NSNumber numberWithInt:intParam]];

Carthag Tuek
Oct 15, 2005

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



Jehde posted:

I'm trying to create a simple text file parser for an iPhone app with no experience in Obj-C prior. I've managed to get as far as loading the file into a string and separating the string using delimiters, which creates a bunch of strings for each input, but I need to convert these strings into an array of usable integers.

This is what I have so far:
code:
// Build array of strings for each parameter.
NSArray *strparams = [[lines objectAtIndex:i] componentsSeparatedByString:@" "];

// Initialize array for integers of each paramater.
NSMutableArray *params = [NSMutableArray arrayWithCapacity:6];

for (int index = 0; index < [strparams count]; index++)
{
	// Convert string parameter at index into integer. [NOT WORKING]
	int intParam = (int)[strparams objectAtIndex:index];  

	// Put integer into integer array.              
        [params replaceObjectAtIndex:index withObject:intParam];
}
I tried to simply take the string item out of the string array and cast it as an int, and then store that int into a new array, but it returns an error "Incompatible integer to pointer conversion sending 'int' to parameter of type 'id'"

Any ideas?

To elaborate on Plorkyeran's post, the Cocoa collection classes can't hold C primitives (int, char, etc), they need to be boxed in an NSObject subclass (usually NSNumber). This also means if you later need to access the primitive value, you'll have to unbox it ([obj intValue], see NSNumber documentation).

I would probably do something like this for your snippet:

Objective-C code:
NSMutableArray *params = [NSMutableArray arrayWithCapacity:6];

for (NSString *paramString in [[lines objectAtIndex:i] componentsSeparatedByString:@" "]) {
	[params addObject:[NSNumber numberWithInt:[paramString intValue]];
}
Note: When you pass a capacity to an NSMutableArray, it just allows it to internally choose the best implementation beforehand. A mutable array doesn't have a constant length, you can just add on to it and it'll inflate. I usually don't bother giving any capacity unless it later turns out that there's a bottleneck there. Also 6 is a magic number, if you really want to supply a capacity, probably better to do [NSMutableArray arrayWithCapacity:[[lines objectatIndex:i] count]].

Fast enumeration (for-in) is almost always preferable to a regular old for-loop on a collection, unless you need the index or whatever.

Also you may want to check out the dedicated Obj-C thread: http://forums.somethingawful.com/showthread.php?threadid=3400187

Carthag Tuek fucked around with this message at 01:50 on Jun 18, 2012

Jehde
Apr 21, 2010

Plorkyeran posted:

Objective-C code:
int intParam = [[strparams objectAtIndex:index] intValue];
[params replaceObjectAtIndex:index withObject:[NSNumber numberWithInt:intParam]];

Ahhh alright, MutableArrays can only take objects and not primitive types. Thank you!

EDIT: As for the capacity, the capacity will always be between 2-6, so I actually changed it to 2 to accomodate the auto-inflating, but it's not really too important, all the data gets changed into objects anyways.

I tried posting a Quartz related question in the iPhone dev thread before but it was ignored, and seeing as this was just a basic Obj-C question I figured I'd have more luck here. Surely enough I did. Thanks again for the help Plorkyeran and Carthag!

Jehde fucked around with this message at 02:15 on Jun 18, 2012

csammis
Aug 26, 2003

Mental Institution

Doctor w-rw-rw- posted:

It's also included as one of iOS's emoji, but looks entirely too happy.

The expression makes it look like an Ewok

pseudorandom name
May 6, 2007

Doctor w-rw-rw- posted:

It's also included as one of iOS's emoji, but looks entirely too happy.

That isn't a coincidence, Google and Apple added ~700 emoji glyphs to Unicode 6.0.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Jehde posted:

I tried posting a Quartz related question in the iPhone dev thread before but it was ignored, and seeing as this was just a basic Obj-C question I figured I'd have more luck here. Surely enough I did. Thanks again for the help Plorkyeran and Carthag!

As someone who ignored your question, I did so because it seemed to ask "how do I build this nontrivial app", which is a question I figure you should explore a bit more on your own. I meant to guide you down that path if no one responded for a day or two but I forgot, sorry.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

nielsm posted:

Go read a bit about Unicode normalisation forms, it's very relevant for things that have to not just be displayed but also compared and searched against.
Alternatively, have plain ASCII usernames and then display names in addition to that.

pseudorandom name posted:

Also Unicode Character Classes, to filter out such things as U+1F4A9 PILE OF POO.

Thanks, I find learning about Unicode to be actually very interesting, but it tends to seem very complex. As far as I'm understanding it you would probably want to make sure the user name was in NFC and then check that all the characters code points in it were in an acceptable General_Category? For example, you would prohibit code points with the General_Category Cn (Unassigned), Co (Private Use), Cc (Control), and others besides. Are there other things to consider when validating a name, or any gotchas?

I see that there is also the option to be more "aggressive" about normalizing Unicode text by using NFKC, but I'm not sure when you might do that. I guess maybe you would use it to compare strings, but you would not necessarily store a string in NFKC, since you lose information by doing so?

Zombywuf
Mar 29, 2008

Hammerite posted:

Thanks, I find learning about Unicode to be actually very interesting, but it tends to seem very complex. As far as I'm understanding it you would probably want to make sure the user name was in NFC and then check that all the characters code points in it were in an acceptable General_Category? For example, you would prohibit code points with the General_Category Cn (Unassigned), Co (Private Use), Cc (Control), and others besides. Are there other things to consider when validating a name, or any gotchas?

I see that there is also the option to be more "aggressive" about normalizing Unicode text by using NFKC, but I'm not sure when you might do that. I guess maybe you would use it to compare strings, but you would not necessarily store a string in NFKC, since you lose information by doing so?

http://www.regular-expressions.info/unicode.html will probably help. You probably want L, M, Zs and P (or maybe a subset). Normalisation I would leave up to whatever library I'm using to compare strings. Which I would then moan about if it didn't work.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Zombywuf posted:

http://www.regular-expressions.info/unicode.html will probably help. You probably want L, M, Zs and P (or maybe a subset). Normalisation I would leave up to whatever library I'm using to compare strings. Which I would then moan about if it didn't work.

Would you say it would be reasonable to restrict to L, M, N, P, Zs and possibly some of S (for special snowflakes who enjoy having, erm, snowflakes in their name) but to apply additional rules, e.g.

- remove Zs characters appearing at the start and end of the name (doesn't make sense for names to start or end with whitespace)
- disallow M characters from appearing at the start of the name
- require a minimum number of non-M, non-Zs characters

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

Biowarfare posted:

I want to learn some ASP/ASP .NET. What kind of webserver setup should I be using? I have a Windows server, but it's 2003 and I don't know if IIS 7.5 runs on it, or how setup should be done (is IIS versioning tied to the OS exactly?) Any quickstart tutorials to get off the ground?

Head to ASP.NET to get started. You want to download the Visual Web Developer Express. It'll have a web server you can test on. For deployment Windows Azure (Microsoft cloud hosting) currently has "free" accounts for low traffic websites if you want to show everything off down the road.

Zombywuf
Mar 29, 2008

Hammerite posted:

Would you say it would be reasonable to restrict to L, M, N, P, Zs and possibly some of S (for special snowflakes who enjoy having, erm, snowflakes in their name) but to apply additional rules, e.g.

- remove Zs characters appearing at the start and end of the name (doesn't make sense for names to start or end with whitespace)
- disallow M characters from appearing at the start of the name
- require a minimum number of non-M, non-Zs characters

Well, it all depends on how far you're willing to bend to special snowflakes. There are times I've been tempted to change my name to something that has no valid normal form in unicode as a big gently caress you to the world. Trimming (and normalising) whitespace and disallowing combining chars where they don't belong is reasonable, however if you're allowing symbols you might as well allow as much punctuation as they want. I guess it depends on what the use case is if you want allow Zalgo usernames.

nielsm
Jun 1, 2009



I would say that the most important property of a user name (login name) is that the user is able to re-enter it using any reasonable input method suitable for the language used for the user name.
Pathological names, like ones that don't have a valid normal form, aren't really interesting. I would reject names that don't seem to make sense.

However I would probably not use arbitrary Unicode strings for login names anyway. Let users log in with their email address as identification and then have a display name, then you won't have to put this kind of limits on the display name.

Goat Bastard
Oct 20, 2004

The question I always ask myself when defining validation requirements is "what real problem am I trying to solve with this validation?".

If there is a genuine (observed) problem with users entering junk data, or if certain data will break the system in some way then the validation should be designed to prevent this problem and only this problem. Otherwise what the benefit of preventing the user from entering " " or whatever as a name? If they're actively trying to enter junk data then they can enter "x" just as easily, and you may inadvertently blacklist some valid name.

Edit: just noticed this is for user names, not person names, but I'll leave it here as the point remains true. If the person wants to log in as " " is there a valid business reason (eg the name may need to appear on a printed report) for stopping them from doing it? These are the only reasons I would consider preventing certain characters/patterns.

Goat Bastard fucked around with this message at 14:10 on Jun 18, 2012

tef
May 30, 2004

-> some l-system crap ->

nielsm posted:

However I would probably not use arbitrary Unicode strings for login names anyway. Let users log in with their email address as identification.

My email address has puny code in it :q:

Zombywuf
Mar 29, 2008

nielsm posted:

However I would probably not use arbitrary Unicode strings for login names anyway. Let users log in with their email address as identification and then have a display name, then you won't have to put this kind of limits on the display name.

I would put limits on display names, rtl characters, byte order marks, abuse of combining characters and simply invalid codepoints will all come and bite you. Do I have to enter my email address in encoded word format or can I just enter it in unicode and have the computer work it out?

Vanadium
Jan 8, 2005

tef posted:

My email address has puny code in it :q:

We really need a new internet standard specifying a more limited grammar for valid email addresses so that we can finally explain the regexes to match valid emails in unironic tutorials!

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I have a question about Agile stuff. Some years back I was in an organization using XPlanner, and everything was estimated in man hours. As a team we all had a velocity for ourselves based on man hours. I wondered if there was some other way to represent the unit of work. It all does boil down to man hours, but team members with more experience in a subject will tend to do something quicker. This means I can't really estimate things purely on man hours if I don't know who will be doing the work. Is there some general concept of replacing man hours with something like a "man hour currency" that people go through at different rates? If so, what tools can handle that kind of thing?

No Safe Word
Feb 26, 2005

Rocko Bonaparte posted:

I have a question about Agile stuff. Some years back I was in an organization using XPlanner, and everything was estimated in man hours. As a team we all had a velocity for ourselves based on man hours. I wondered if there was some other way to represent the unit of work. It all does boil down to man hours, but team members with more experience in a subject will tend to do something quicker. This means I can't really estimate things purely on man hours if I don't know who will be doing the work. Is there some general concept of replacing man hours with something like a "man hour currency" that people go through at different rates? If so, what tools can handle that kind of thing?

Yes, most agile tools are built around "story points" which are exactly the generic thing you're talking about. Different developers can have different velocities and you can plan their iteration tasks accordingly. It's kind of the whole reasoning for the existence of "user story points" as a thing. Then you estimate everything in those and go from there.

rolleyes
Nov 16, 2006

Sometimes you have to roll the hard... two?
To me, it sounds like he wants to be able to provide generic estimates without knowing which people (or even which team) will be assigned the work - that's not going to be possible because the entire point of the backlog/allocation/scheduling part of the Agile system is that it is benchmarked against the output of individuals and teams.

Team A might get a 16-pointer done in a week while team B might take a week and a half, depending on their velocity.

Coca Koala
Nov 28, 2005

ongoing nowhere
College Slice
I'm working on a school project to write a piece of software that takes input of an infix expression, converts it to postfix, and then evaluates the postfix expression. I haven't started working on postfix evaluation, which is apparently the easy part. I'm still wrestling with the algorithm my professor provided:

1. If the token is an operand, add it to the queue immediately
2. If the value is a close-parenthesis, pop all the stack elements and add them to the queue one by one until an open-parenthesis is found.
3. If the value is an operator, pop everything on the stack and add them to the queue one by one until you reach either an operator of lower precedence, or a right-associative operator of equal precedence (eg, the logical NOT is a right-associative operator). Add the found operator to the queue and push the original operator onto the stack.
4. At the end of the input, pop everything that remains on the stack and add to the queue one by one.

He gives a sample input of 4+3*5, and says that it should be output as 4 3 5 * +.

I don't see how he's getting that output based on the algorithm he's provided. You process the 4, it's an operand and goes in the queue.

You process the +, which is an operator. You check the stack and see that the stack is empty; null is of lower precedence than the +, so you push + on the stack. You process the 3, it's an operand, and goes in the queue.

You process the *, and it's an operator. So you pop everything on the stack, which means now you're looking at the +. The + is an operator of lower precedence than the *, so you cease popping items from the stack, enqueue the +, and push the * on the stack.

You process 5, which goes in the queue.

Now you've reached the end of the input, so you pop the stack and add the *, and your queue looks like 3 4 + 5 *.

Am I somehow misinterpreting the algorithm? Based on the way it's written, it doesn't look like it's possible to get more than one operator in the stack at a time, which I don't think is correct. Is the algorithm itself miswritten? The professor is pretty bad at proofreading his project guidelines, so it's always a possibility that he's given us bum data to work with. I'd talk to him or the TA, but the professor never answers his email and the TA missed our 2pm appointment today; apparently his alarm didn't go off and he slept through it.

Plorkyeran
Mar 22, 2007

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

Coca Koala posted:

You process the *, and it's an operator. So you pop everything on the stack, which means now you're looking at the +. The + is an operator of lower precedence than the *, so you cease popping items from the stack, enqueue the +, and push the * on the stack.
Step #3 is not worded very well. You stop popping once the top of the stack has lower precedence that the current operator, which in this case is true before you pop anything so you don't pop and enqueue the +.

Coca Koala
Nov 28, 2005

ongoing nowhere
College Slice
Jesus christ. Thanks for clearing that up, I appreciate it.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Zombywuf posted:

Well, it all depends on how far you're willing to bend to special snowflakes. There are times I've been tempted to change my name to something that has no valid normal form in unicode as a big gently caress you to the world. Trimming (and normalising) whitespace and disallowing combining chars where they don't belong is reasonable, however if you're allowing symbols you might as well allow as much punctuation as they want. I guess it depends on what the use case is if you want allow Zalgo usernames.

Could you point me to an example or examples of Unicode strings that do not possess a normalisation form? What is the result of applying the normalisation algorithms to strings like that? Is there a collection anywhere of pathological examples of Unicode text?

I hadn't considered the idea of letting users have separate login and display names (potentially with different restrictions applied). I guess that has its advantages and disadvantages.

It also reached my attention that there are some category C characters that there might be reason to allow, such as ZERO WIDTH NON-JOINER

Goat Bastard posted:

The question I always ask myself when defining validation requirements is "what real problem am I trying to solve with this validation?".

If there is a genuine (observed) problem with users entering junk data, or if certain data will break the system in some way then the validation should be designed to prevent this problem and only this problem. Otherwise what the benefit of preventing the user from entering " " or whatever as a name? If they're actively trying to enter junk data then they can enter "x" just as easily, and you may inadvertently blacklist some valid name.

Edit: just noticed this is for user names, not person names, but I'll leave it here as the point remains true. If the person wants to log in as " " is there a valid business reason (eg the name may need to appear on a printed report) for stopping them from doing it? These are the only reasons I would consider preventing certain characters/patterns.

Although this is very reasonable and sensible advice, I am paying such inordinate attention to this in part because it is an opportunity for me to improve my understanding of Unicode and related topics.

Zombywuf
Mar 29, 2008

Hammerite posted:

Could you point me to an example or examples of Unicode strings that do not possess a normalisation form? What is the result of applying the normalisation algorithms to strings like that? Is there a collection anywhere of pathological examples of Unicode text?

Ah wait, I was getting confused about technically illegal unicode strings and normal forms. There are certainly invalid unicode strings but it seems the Unicode Consortium were still kind enough to give them a normal form. e.g. space byte_order_mark combining_ring_above.

SirPablo
May 1, 2004

Pillbug
I'm interested in doing some research on determining a person's worldscope. By worldscope I mean the rough physical area of the earth that their life covers (work, play, living, etc.). For example, Joe's worldscope is confined to 30 miles within the center of Oklahoma City, OK - he lives and works there, seldom leaves, and most of his friends/family are there. Now I'd like to write some code to do figure this out for me, my question isn't really with the code but with what kind of data could I use and how do I get it. A couple of ideas would include analyzing a person's Facebook friends list, their check-ins via Facebook/Foursquare, and locations that they tweet from. However, I have very little idea how to obtain those data, if it is even possible.

The application for this is to figure out how large of an area a person cares about what weather is happening. The hypothesis is they would only care about what is happening within their worldscope, so figuring out what that is would be highly useful for communicating weather information.

Adbot
ADBOT LOVES YOU

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





I'd whitelist unicode display names, not blacklist. Allow common alphabets and maybe punctuation, special case RTL alphabets and make sure everything normalizes. Even if you do this people are going to be able to 'forge' other user's display names because of the common practice of reusing glyphs for nonequivalent characters.

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