A question to you guys, say I want to make a multiplayer html 5 browser game, what kind of technologies would I be looking at to make this perform well?
For instance, i open an instance of the game in my browser and that creates a server people could join and send messages to.
I haven't used HTML5 yet but depending on your game I'm assuming you would want to look into web sockets, the audio/video tags, maybe drag and drop. Quick google search will pull up all kinds of goodies related to the new features like this blog.
And hooray for leaving bad jobs, I hope to be doing the same soon.
Monkey Ball WarriorA collection of mediocre hatsSeattle, WARegistered Userregular
edited August 2011
I would just like to say that dress codes are an evil blight.
SO anyway, dictionaries that map, idk, a string or something, to functions, are these as useful as I think they are, or am I just making things overly complicated?
Example: Say I have an list of objects, and I want to allow you to sort them by various fields of the object. Some of the fields are straitforward comparables, but some of them (for various reasons outside your control) are weird as hell, Like, to take an example from work, IList<KeyValuePair<string,string>. But the point is you need a special comparator to sort by these. What I'm doing is I get a string from the UI of whatever field they want to sort by, look it up in the dictionary. Sometimes it's just a p=>p.field func, but sometimes it's a function I can't even fit on one line. Whatever I get I feed into the sorter and I'm done. Advantage is that to support a different, equally weird, class I just define a new dictionary.
Is this a reasonable approach? I know i'm talking in c# at the moment, but it seems like a construct that could be used in any language that had function types.
Monkey Ball Warrior on
"I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
Depends. What is the concept visually and what is the gameplay like? How real-time things are and how players interact decides a lot of what kind of infrastructure is involved.
0
Monkey Ball WarriorA collection of mediocre hatsSeattle, WARegistered Userregular
I would just like to say that dress codes are an evil blight.
Reasonable dress code are reasonable. I don't want to go to work and have to interact with people wearing dirty or ratty clothing.
Yeh, I mean, when I say dress code, I mean "You have to wear this particular kind of shirt and these particular kind of pants". Requiring your cloths to be clean and intact is fine. And if you have to directly interact with external customers frequently, then I can see dress codes being a necessary evil. But if I'm a cubicle bound code factory, telling me what kind of shirt I can wear is just power tripping.
I should be clear: I wouldn't pass up an otherwise good job because of a dress code. But that doesn't make them sensible.
"I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
I would just like to say that dress codes are an evil blight.
SO anyway, dictionaries that map, idk, a string or something, to functions, are these as useful as I think they are, or am I just making things overly complicated?
Example: Say I have an list of objects, and I want to allow you to sort them by various fields of the object. Some of the fields are straitforward comparables, but some of them (for various reasons outside your control) are weird as hell, Like, to take an example from work, IList<KeyValuePair<string,string>. But the point is you need a special comparator to sort by these. What I'm doing is I get a string from the UI of whatever field they want to sort by, look it up in the dictionary. Sometimes it's just a p=>p.field func, but sometimes it's a function I can't even fit on one line. Whatever I get I feed into the sorter and I'm done. Advantage is that to support a different, equally weird, class I just define a new dictionary.
Is this a reasonable approach? I know i'm talking in c# at the moment, but it seems like a construct that could be used in any language that had function types.
What about a more generic approach? Check to see if the property type in question implements IComparable<T>, then IComparable, else see if you have a registered Comparison for that type. That way, you could just define a comparator for a data type and then use the same setup for all objects without having to set up a new dictionary.
0
Monkey Ball WarriorA collection of mediocre hatsSeattle, WARegistered Userregular
I would just like to say that dress codes are an evil blight.
SO anyway, dictionaries that map, idk, a string or something, to functions, are these as useful as I think they are, or am I just making things overly complicated?
Example: Say I have an list of objects, and I want to allow you to sort them by various fields of the object. Some of the fields are straitforward comparables, but some of them (for various reasons outside your control) are weird as hell, Like, to take an example from work, IList<KeyValuePair<string,string>. But the point is you need a special comparator to sort by these. What I'm doing is I get a string from the UI of whatever field they want to sort by, look it up in the dictionary. Sometimes it's just a p=>p.field func, but sometimes it's a function I can't even fit on one line. Whatever I get I feed into the sorter and I'm done. Advantage is that to support a different, equally weird, class I just define a new dictionary.
Is this a reasonable approach? I know i'm talking in c# at the moment, but it seems like a construct that could be used in any language that had function types.
What about a more generic approach? Check to see if the property type in question implements IComparable<T>, then IComparable, else see if you have a registered Comparison for that type. That way, you could just define a comparator for a data type and then use the same setup for all objects without having to set up a new dictionary.
Well if the property's name isn't listed somewhere, if I can't do a
if (listOfPropertiesThatAreCompareble.Contains(propertyName))
or
if (dictNameToComparableField.TryGetValue(propertyName, out compareableVar)
the only way I can know what type it is, is by using reflection, which is NOT something I'm terribly familiar with. I had heard rumors that reflection is terrifically slow, but I don't know if that's true or if that would even matter in this context. However, if I could, say, hunt down the name of the propery, figure out if its type is comparable, then if not lookup a comparator in a dictionary, then finally just toString() it, that would basically make any type work at least to some degree. Plus most of the weird comparator functions are the same except what field they are working against.
I will have to look into it.
Monkey Ball Warrior on
"I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
@Monkey_Ball_Warrior
For your example couldn't you create multiple comparison functions and pass the applicable function into the sort method based on user input (MSDN)? Quite possible that I misunderstood you.
@Monkey_Ball_Warrior
For your example couldn't you create multiple comparison functions and pass the applicable function into the sort method based on user input (MSDN)? Quite possible that I misunderstood you.
That is essentially what I'm doing now. The user selects some property to sort by, so I get basically a string from the UI that is that property's name. The way I'm doing it now is that I look up that name in a dictionary, and that maps it to a function that takes an element of the list, and returns a comparable (some of these are simple like p=>p.age, and some are complex) and I just feed that into a .OrderBy() linq sort. I could change that to use the Comparison function type, I probably should so that I can then use .Sort instead of .OrderBy. But the basic idea is the same.
Monkey Ball Warrior on
"I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
0
Monkey Ball WarriorA collection of mediocre hatsSeattle, WARegistered Userregular
edited August 2011
How do you delete a post?
Monkey Ball Warrior on
"I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
I have a Java web service problem that's a bit odd because I write and consume a lot of services.
There's a module of mine in a desktop app that creates a long, complicated SOAP request and calls a third party web service. This works just fine. This module also calls lots of web services of mine on our Tomcat server. Again, this works just fine. Due to some business requirements, I have to now route the requests from the desktop app through our app server to the third party service and back.
Is there a simple way in Java to call a webservice passing a string that includes all the soap headers and everything else? I've seen tools in other languages that you just pass in a URL and the request in the form of a string, but I haven't been able to find anything like that in Java.
I think that the internet has been for years on the path to creating what is essentially an electronic Necronomicon: A collection of blasphemous unrealities so perverse that to even glimpse at its contents, if but for a moment, is to irrevocably forfeit a portion of your sanity.
Xbox - PearlBlueS0ul, Steam
If you ever need to talk to someone, feel free to message me. Yes, that includes you.
I would just like to say that dress codes are an evil blight.
SO anyway, dictionaries that map, idk, a string or something, to functions, are these as useful as I think they are, or am I just making things overly complicated?
Example: Say I have an list of objects, and I want to allow you to sort them by various fields of the object. Some of the fields are straitforward comparables, but some of them (for various reasons outside your control) are weird as hell, Like, to take an example from work, IList<KeyValuePair<string,string>. But the point is you need a special comparator to sort by these. What I'm doing is I get a string from the UI of whatever field they want to sort by, look it up in the dictionary. Sometimes it's just a p=>p.field func, but sometimes it's a function I can't even fit on one line. Whatever I get I feed into the sorter and I'm done. Advantage is that to support a different, equally weird, class I just define a new dictionary.
Is this a reasonable approach? I know i'm talking in c# at the moment, but it seems like a construct that could be used in any language that had function types.
What about a more generic approach? Check to see if the property type in question implements IComparable<T>, then IComparable, else see if you have a registered Comparison for that type. That way, you could just define a comparator for a data type and then use the same setup for all objects without having to set up a new dictionary.
Well if the property's name isn't listed somewhere, if I can't do a
if (listOfPropertiesThatAreCompareble.Contains(propertyName))
or
if (dictNameToComparableField.TryGetValue(propertyName, out compareableVar)
the only way I can know what type it is, is by using reflection, which is NOT something I'm terribly familiar with. I had heard rumors that reflection is terrifically slow, but I don't know if that's true or if that would even matter in this context. However, if I could, say, hunt down the name of the propery, figure out if its type is comparable, then if not lookup a comparator in a dictionary, then finally just toString() it, that would basically make any type work at least to some degree. Plus most of the weird comparator functions are the same except what field they are working against.
I will have to look into it.
I'll whip up a quick solution to this problem. Give me a few minutes.
Reflection gains a terrible reputation of being slow, when it generally isn't bad.
I would just like to say that dress codes are an evil blight.
SO anyway, dictionaries that map, idk, a string or something, to functions, are these as useful as I think they are, or am I just making things overly complicated?
Example: Say I have an list of objects, and I want to allow you to sort them by various fields of the object. Some of the fields are straitforward comparables, but some of them (for various reasons outside your control) are weird as hell, Like, to take an example from work, IList<KeyValuePair<string,string>. But the point is you need a special comparator to sort by these. What I'm doing is I get a string from the UI of whatever field they want to sort by, look it up in the dictionary. Sometimes it's just a p=>p.field func, but sometimes it's a function I can't even fit on one line. Whatever I get I feed into the sorter and I'm done. Advantage is that to support a different, equally weird, class I just define a new dictionary.
Is this a reasonable approach? I know i'm talking in c# at the moment, but it seems like a construct that could be used in any language that had function types.
What about a more generic approach? Check to see if the property type in question implements IComparable<T>, then IComparable, else see if you have a registered Comparison for that type. That way, you could just define a comparator for a data type and then use the same setup for all objects without having to set up a new dictionary.
Well if the property's name isn't listed somewhere, if I can't do a
if (listOfPropertiesThatAreCompareble.Contains(propertyName))
or
if (dictNameToComparableField.TryGetValue(propertyName, out compareableVar)
the only way I can know what type it is, is by using reflection, which is NOT something I'm terribly familiar with. I had heard rumors that reflection is terrifically slow, but I don't know if that's true or if that would even matter in this context. However, if I could, say, hunt down the name of the propery, figure out if its type is comparable, then if not lookup a comparator in a dictionary, then finally just toString() it, that would basically make any type work at least to some degree. Plus most of the weird comparator functions are the same except what field they are working against.
I will have to look into it.
I'll whip up a quick solution to this problem. Give me a few minutes.
Reflection gains a terrible reputation of being slow, when it generally isn't bad.
Ok, so this turned out to be non trivial like I thought it would be.
I got about this far before hitting a brick wall converting the IComparer instance so that the LINQ statement would accept the type.
public static IOrderedEnumerable<T> OrderBy<T>(this IEnumerable<T> enumerable, string propertyName)
{
PropertyInfo property = typeof(T).GetProperty(propertyName);
if (property == null)
throw new ArgumentException("propertyName");
var iComparerType = typeof(IComparable<>).MakeGenericType(property.PropertyType);
if (iComparerType.IsAssignableFrom(property.PropertyType))
return enumerable.OrderByDescending(x => property.GetValue(x, null));
var comparer = Activator.CreateInstance(typeof(DefaultComparer<>).MakeGenericType(property.PropertyType));
return enumerable.OrderBy(x => property.GetValue(x, null), comparer);
}
Perhaps someone else can take it just a bit further and figure out where I went wrong.
Depends. What is the concept visually and what is the gameplay like? How real-time things are and how players interact decides a lot of what kind of infrastructure is involved.
Suppose a platformer, where the truth of the game is hosted by one client and the other players are merely sending their control inputs to move their characters and then seeing visual updates, but not actually running any server code.
I would just like to say that dress codes are an evil blight.
SO anyway, dictionaries that map, idk, a string or something, to functions, are these as useful as I think they are, or am I just making things overly complicated?
Example: Say I have an list of objects, and I want to allow you to sort them by various fields of the object. Some of the fields are straitforward comparables, but some of them (for various reasons outside your control) are weird as hell, Like, to take an example from work, IList<KeyValuePair<string,string>. But the point is you need a special comparator to sort by these. What I'm doing is I get a string from the UI of whatever field they want to sort by, look it up in the dictionary. Sometimes it's just a p=>p.field func, but sometimes it's a function I can't even fit on one line. Whatever I get I feed into the sorter and I'm done. Advantage is that to support a different, equally weird, class I just define a new dictionary.
Is this a reasonable approach? I know i'm talking in c# at the moment, but it seems like a construct that could be used in any language that had function types.
What about a more generic approach? Check to see if the property type in question implements IComparable<T>, then IComparable, else see if you have a registered Comparison for that type. That way, you could just define a comparator for a data type and then use the same setup for all objects without having to set up a new dictionary.
I'm old school and use what you're describing as a way to fire events. Mainly because the syntax is roughly the same in any language.
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
Mmm I wasn't aware people didn't know about HTA and Windows and how most of Windows' interface is made using HTA (or it was in the XPish times).
They were also blissfully unaware that Windows loaded IE pretty much at the get go and not when the physical application was run instead. I'm pretty sure it's some activex dll that's cached and loaded when windows is started but it's still attributing to IE being quick to load as opposed to firefox or something.
bowen on
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
I didn't know about HTA, but I'm not a Windows dev. Looks like it's kind of like JavaFX, but better?
I had no idea that there are technical people involved with Windows stuff who don't know that IE is loaded right away and used for a lot of stuff in Windows, though.
Yeah a lot of people are attributing IE9 loading extremely fast but fail to take notice of the fact that IE gets loaded during windows boot regardless. So the only thing that IE needs to do is make a form and load controls, instead of instantiating the rendering engine and all that nonsense. A clear advantage if I ever saw one.
A question to you guys, say I want to make a multiplayer html 5 browser game, what kind of technologies would I be looking at to make this perform well?
For instance, i open an instance of the game in my browser and that creates a server people could join and send messages to.
There IS a 2D framework out there somewhere for HTML5 games, but I seem to have misplaced the bookmark.
As far as multiplayer... such a thing CAN be achieved by using something like the Google Wave tech that was built to send small chunks of data rapidly via the browser.
Mmm I wasn't aware people didn't know about HTA and Windows and how most of Windows' interface is made using HTA (or it was in the XPish times).
They were also blissfully unaware that Windows loaded IE pretty much at the get go and not when the physical application was run instead. I'm pretty sure it's some activex dll that's cached and loaded when windows is started but it's still attributing to IE being quick to load as opposed to firefox or something.
I didn't know about HTA, but I also didn't know that people had never noticed that things like Explorer can take urls...
Yeah explorer taking urls should've been a dead giveaway.
HTAs are kinda neat, I was surprised to learn things like the activation system in windows, and things like the control panel, my computer, etc are all HTA forms. I am surprised more people haven't heard of it, actually.
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
They need to hurry up and send my contract over so that I can sign it, give my notice, and then stop pretending to care about things that are no longer my problem.
A question to you guys, say I want to make a multiplayer html 5 browser game, what kind of technologies would I be looking at to make this perform well?
For instance, i open an instance of the game in my browser and that creates a server people could join and send messages to.
There IS a 2D framework out there somewhere for HTML5 games, but I seem to have misplaced the bookmark.
As far as multiplayer... such a thing CAN be achieved by using something like the Google Wave tech that was built to send small chunks of data rapidly via the browser.
In theory.
I've been following a Flash dev that is moving on to HTML/JS dev and he has been using impact.js to build a Tile based RPG game on WordPress that is modified to allow you to create dungeons via wp posts. It's looking pretty damn cool.
jackfaces
"If you're going to play tiddly winks, play it with man hole covers."
- John McCallum
Two questions for any database / data miners here. I'm trying to use some software called smart analyzer to do some counts on a database. Getting really stuck on the "levels" though. Basically its made up of parents and babies. each have a unique id, but parents can have many babies etc etc. I need to do searches about babies (i.e in a date of birth range, whether they are the youngest baby in a family ) and then return the unique parents i.d's, not the babies. Anyone have any experience of this? I just kinda need stuff to read that's good for people pretty new to databases. Sorry I can't put it into words better, as I'm new to the whole thing.
Secondly people may or may not remember I needed help with a survey on pair programming. I've put the link in my sig, and hopefully it works. I'm new to google docs. I'll be eternally grateful for the help.
Two questions for any database / data miners here. I'm trying to use some software called smart analyzer to do some counts on a database. Getting really stuck on the "levels" though. Basically its made up of parents and babies. each have a unique id, but parents can have many babies etc etc. I need to do searches about babies (i.e in a date of birth range, whether they are the youngest baby in a family ) and then return the unique parents i.d's, not the babies. Anyone have any experience of this? I just kinda need stuff to read that's good for people pretty new to databases. Sorry I can't put it into words better, as I'm new to the whole thing.
Secondly people may or may not remember I needed help with a survey on pair programming. I've put the link in my sig, and hopefully it works. I'm new to google docs. I'll be eternally grateful for the help.
Is there colums to link to the parent ids? If not, you're probably fucked with any store bought or column based searching and you'll have to go to some coding there instead of a SQL query or analyzer.
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
Two questions for any database / data miners here. I'm trying to use some software called smart analyzer to do some counts on a database. Getting really stuck on the "levels" though. Basically its made up of parents and babies. each have a unique id, but parents can have many babies etc etc. I need to do searches about babies (i.e in a date of birth range, whether they are the youngest baby in a family ) and then return the unique parents i.d's, not the babies. Anyone have any experience of this? I just kinda need stuff to read that's good for people pretty new to databases. Sorry I can't put it into words better, as I'm new to the whole thing.
Secondly people may or may not remember I needed help with a survey on pair programming. I've put the link in my sig, and hopefully it works. I'm new to google docs. I'll be eternally grateful for the help.
Your wording isn't making it completely clear what you're asking I'm afraid. Can you give some examples of what exactly you're after? Are you trying to design the queries that can do these things or what? What do you mean by "levels"? Relationships?
Yeah I'm not really sure either. Sorry. I think I was hoping someone would have used the smart analyzer software but that is probably slim. Ignore my intial questions and if anyone has any good reading to recommend on databases that would be cool. I think all I have managed to do is look like a idiot, but thankfully I'm used to that.
Is that a number I can add to another number? I figured that was some kind of error.
does
1.1 + 6.12323e-017 == ~1.1
??
Yup, as Phyphor said, it's 6.12323 * 10^-17. That's what the 'e' means - exponent!
--
Technical aside - just satisfying curiousity:
So a double has 52 bits of normalised mantissa (ignoring the edge cases where the exponent is at the smallest value). So I'd expect that the smallest number you can add to a double is 2^-53 times smaller than that double.
So for a value of 1.0, the smallest non-zero number you can add is ~1.11e-16.
So 1.1 + 6.12e-17 should have the same exact bit pattern as 1.1.
Yeah I'm not really sure either. Sorry. I think I was hoping someone would have used the smart analyzer software but that is probably slim. Ignore my intial questions and if anyone has any good reading to recommend on databases that would be cool. I think all I have managed to do is look like a idiot, but thankfully I'm used to that.
Hey, no worries. Not sure what software you're using nope, but feel free to ask questions when you got em.
I'm trying to come up with a way to take a list of items and randomize the order (I don't know of a way to do this built in).
I have a rnd(cap) function that will give me a random number between 0 and cap -1. Also note: all arrays are 1 based.
My idea was to built a list of available positions, randomly select one and then remove it from the list of available ones. It runs decently fast but can't be super quick because we're talking 35,000 items. I think the BASIC language is reasonably clear to read to see what I'm doing here.
*BUILD LIST OF POSSIBLE POSITIONS
POSLIST = ""
FOR VX = 1 TO ITMCNT
POSLIST<-1> = VX
NEXT VX
*TOTAL NUMBER OF SPOTS
TOTALSPOTS = ITMCNT
FOR IX = 1 TO ITMCNT
*GET RANDOM SPOT IN POSLIST
RAND = RND(TOTALSPOTS)+1
*RESULTING POSITION IS EQ TO WHAT IS STORED AT THIS SPOT IN THE POSLIST
VAL = POSLIST<RAND>
*SET VALUE IN COUNT LIST
COUNTLIST<VAL> = PARTLIST<IX>
*REMOVE USED POSITION
POSLIST = DELETE(POSLIST,RAND)
*1 LESS SPOT AVAILABLE
TOTALSPOTS = TOTALSPOTS - 1
NEXT IX
Posts
For instance, i open an instance of the game in my browser and that creates a server people could join and send messages to.
And hooray for leaving bad jobs, I hope to be doing the same soon.
SO anyway, dictionaries that map, idk, a string or something, to functions, are these as useful as I think they are, or am I just making things overly complicated?
Example: Say I have an list of objects, and I want to allow you to sort them by various fields of the object. Some of the fields are straitforward comparables, but some of them (for various reasons outside your control) are weird as hell, Like, to take an example from work, IList<KeyValuePair<string,string>. But the point is you need a special comparator to sort by these. What I'm doing is I get a string from the UI of whatever field they want to sort by, look it up in the dictionary. Sometimes it's just a p=>p.field func, but sometimes it's a function I can't even fit on one line. Whatever I get I feed into the sorter and I'm done. Advantage is that to support a different, equally weird, class I just define a new dictionary.
Is this a reasonable approach? I know i'm talking in c# at the moment, but it seems like a construct that could be used in any language that had function types.
Reasonable dress code are reasonable. I don't want to go to work and have to interact with people wearing dirty or ratty clothing.
Yeh, I mean, when I say dress code, I mean "You have to wear this particular kind of shirt and these particular kind of pants". Requiring your cloths to be clean and intact is fine. And if you have to directly interact with external customers frequently, then I can see dress codes being a necessary evil. But if I'm a cubicle bound code factory, telling me what kind of shirt I can wear is just power tripping.
I should be clear: I wouldn't pass up an otherwise good job because of a dress code. But that doesn't make them sensible.
What about a more generic approach? Check to see if the property type in question implements IComparable<T>, then IComparable, else see if you have a registered Comparison for that type. That way, you could just define a comparator for a data type and then use the same setup for all objects without having to set up a new dictionary.
Well if the property's name isn't listed somewhere, if I can't do a or the only way I can know what type it is, is by using reflection, which is NOT something I'm terribly familiar with. I had heard rumors that reflection is terrifically slow, but I don't know if that's true or if that would even matter in this context. However, if I could, say, hunt down the name of the propery, figure out if its type is comparable, then if not lookup a comparator in a dictionary, then finally just toString() it, that would basically make any type work at least to some degree. Plus most of the weird comparator functions are the same except what field they are working against.
I will have to look into it.
For your example couldn't you create multiple comparison functions and pass the applicable function into the sort method based on user input (MSDN)? Quite possible that I misunderstood you.
That is essentially what I'm doing now. The user selects some property to sort by, so I get basically a string from the UI that is that property's name. The way I'm doing it now is that I look up that name in a dictionary, and that maps it to a function that takes an element of the list, and returns a comparable (some of these are simple like p=>p.age, and some are complex) and I just feed that into a .OrderBy() linq sort. I could change that to use the Comparison function type, I probably should so that I can then use .Sort instead of .OrderBy. But the basic idea is the same.
There's a module of mine in a desktop app that creates a long, complicated SOAP request and calls a third party web service. This works just fine. This module also calls lots of web services of mine on our Tomcat server. Again, this works just fine. Due to some business requirements, I have to now route the requests from the desktop app through our app server to the third party service and back.
Is there a simple way in Java to call a webservice passing a string that includes all the soap headers and everything else? I've seen tools in other languages that you just pass in a URL and the request in the form of a string, but I haven't been able to find anything like that in Java.
If you ever need to talk to someone, feel free to message me. Yes, that includes you.
I'll whip up a quick solution to this problem. Give me a few minutes.
Reflection gains a terrible reputation of being slow, when it generally isn't bad.
Ok, so this turned out to be non trivial like I thought it would be.
I got about this far before hitting a brick wall converting the IComparer instance so that the LINQ statement would accept the type.
public static IOrderedEnumerable<T> OrderBy<T>(this IEnumerable<T> enumerable, string propertyName) { PropertyInfo property = typeof(T).GetProperty(propertyName); if (property == null) throw new ArgumentException("propertyName"); var iComparerType = typeof(IComparable<>).MakeGenericType(property.PropertyType); if (iComparerType.IsAssignableFrom(property.PropertyType)) return enumerable.OrderByDescending(x => property.GetValue(x, null)); var comparer = Activator.CreateInstance(typeof(DefaultComparer<>).MakeGenericType(property.PropertyType)); return enumerable.OrderBy(x => property.GetValue(x, null), comparer); }Perhaps someone else can take it just a bit further and figure out where I went wrong.
Suppose a platformer, where the truth of the game is hosted by one client and the other players are merely sending their control inputs to move their characters and then seeing visual updates, but not actually running any server code.
I'm old school and use what you're describing as a way to fire events. Mainly because the syntax is roughly the same in any language.
They were also blissfully unaware that Windows loaded IE pretty much at the get go and not when the physical application was run instead. I'm pretty sure it's some activex dll that's cached and loaded when windows is started but it's still attributing to IE being quick to load as opposed to firefox or something.
I had no idea that there are technical people involved with Windows stuff who don't know that IE is loaded right away and used for a lot of stuff in Windows, though.
Also @Jimmy King Congrats, I missed your post.
There IS a 2D framework out there somewhere for HTML5 games, but I seem to have misplaced the bookmark.
As far as multiplayer... such a thing CAN be achieved by using something like the Google Wave tech that was built to send small chunks of data rapidly via the browser.
In theory.
I didn't know about HTA, but I also didn't know that people had never noticed that things like Explorer can take urls...
Also, congrats Jimmy!
HTAs are kinda neat, I was surprised to learn things like the activation system in windows, and things like the control panel, my computer, etc are all HTA forms. I am surprised more people haven't heard of it, actually.
Thought this would catch someone's eye.
They need to hurry up and send my contract over so that I can sign it, give my notice, and then stop pretending to care about things that are no longer my problem.
I've been following a Flash dev that is moving on to HTML/JS dev and he has been using impact.js to build a Tile based RPG game on WordPress that is modified to allow you to create dungeons via wp posts. It's looking pretty damn cool.
"If you're going to play tiddly winks, play it with man hole covers."
- John McCallum
Let's say I want to do... this:
cos(1.5708);
and have it return something other than face melting
how do I go about that?
(1.5708 = 90/180.0f*M_PI)
What, specifically, is the face melting?
#include <cmath> #include <iostream> int main( int argc, char *argv[] ) { std::cout << std::cos( 90.0 / 180.0 * M_PI ) << std::endl; return 0; }Sure, it returns a very very small number:
./testcos
6.12323e-017
But par for the course when you're dealing with floating point.
Is that a number I can add to another number? I figured that was some kind of error.
does
1.1 + 6.12323e-017 == ~1.1
??
Secondly people may or may not remember I needed help with a survey on pair programming. I've put the link in my sig, and hopefully it works. I'm new to google docs. I'll be eternally grateful for the help.
6.12323e-017 is 0.0000000000000000612323, so yes
Is there colums to link to the parent ids? If not, you're probably fucked with any store bought or column based searching and you'll have to go to some coding there instead of a SQL query or analyzer.
Your wording isn't making it completely clear what you're asking I'm afraid. Can you give some examples of what exactly you're after? Are you trying to design the queries that can do these things or what? What do you mean by "levels"? Relationships?
Yup, as Phyphor said, it's 6.12323 * 10^-17. That's what the 'e' means - exponent!
--
Technical aside - just satisfying curiousity:
So for a value of 1.0, the smallest non-zero number you can add is ~1.11e-16.
So 1.1 + 6.12e-17 should have the same exact bit pattern as 1.1.
Heh, so it does!
And 0.5 + 6.12e-17 does change bit patterns.
Good to know.
Hey, no worries. Not sure what software you're using nope, but feel free to ask questions when you got em.
I'm trying to come up with a way to take a list of items and randomize the order (I don't know of a way to do this built in).
I have a rnd(cap) function that will give me a random number between 0 and cap -1. Also note: all arrays are 1 based.
My idea was to built a list of available positions, randomly select one and then remove it from the list of available ones. It runs decently fast but can't be super quick because we're talking 35,000 items. I think the BASIC language is reasonably clear to read to see what I'm doing here.
*BUILD LIST OF POSSIBLE POSITIONS POSLIST = "" FOR VX = 1 TO ITMCNT POSLIST<-1> = VX NEXT VX *TOTAL NUMBER OF SPOTS TOTALSPOTS = ITMCNT FOR IX = 1 TO ITMCNT *GET RANDOM SPOT IN POSLIST RAND = RND(TOTALSPOTS)+1 *RESULTING POSITION IS EQ TO WHAT IS STORED AT THIS SPOT IN THE POSLIST VAL = POSLIST<RAND> *SET VALUE IN COUNT LIST COUNTLIST<VAL> = PARTLIST<IX> *REMOVE USED POSITION POSLIST = DELETE(POSLIST,RAND) *1 LESS SPOT AVAILABLE TOTALSPOTS = TOTALSPOTS - 1 NEXT IXHeh, I didn't know what it was called - and that I was doing it wrong - until I looked it up.
Turns out that to do an in-place randomisation properly, you go from the *back* of the array.
The advantage being that you can do it in-place, so you can avoid deleting items from the middle of a list. Should speed things up a bit!