Search Results

Search found 32 results on 2 pages for 'sprugman'.

Page 1/2 | 1 2  | Next Page >

  • database design help for game / user levels / progress

    - by sprugman
    Sorry this got long and all prose-y. I'm creating my first truly gamified web app and could use some help thinking about how to structure the data. The Set-up Users need to accomplish tasks in each of several categories before they can move up a level. I've got my Users, Tasks, and Categories tables, and a UserTasks table which joins the three. ("User 3 has added Task 42 in Category 8. Now they've completed it.") That's all fine and working wonderfully. The Challenge I'm not sure of the best way to track the progress in the individual categories toward each level. The "business" rules are: You have to achieve a certain number of points in each category to move up. If you get the number of points needed in Cat 8, but still have other work to do to complete the level, any new Cat 8 points count toward your overall score, but don't "roll over" into the next level. The number of Categories is small (five currently) and unlikely to change often, but by no means absolutely fixed. The number of points needed to level-up will vary per level, probably by a formula, or perhaps a lookup table. So the challenge is to track each user's progress toward the next level in each category. I've thought of a few potential approaches: Possible Solutions Add a column to the users table for each category and reset them all to zero each time a user levels-up. Have a separate UserProgress table with a row for each category for each user and the number of points they have. (Basically a Many-to-Many version of #1.) Add a userLevel column to the UserTasks table and use that to derive their progress with some kind of SUM statement. Their current level will be a simple int in the User table. Pros & Cons (1) seems like by far the most straightforward, but it's also the least flexible. Perhaps I could use a naming convention based on the category ids to help overcome some of that. (With code like "select cats; for each cat, get the value from Users.progress_{cat.id}.") It's also the one where I lose the most data -- I won't know which points counted toward leveling up. I don't have a need in mind for that, so maybe I don't care about that. (2) seems complicated: every time I add or subtract a user or a category, I have to maintain the other table. I foresee synchronization challenges. (3) Is somewhere in between -- cleaner than #2, but less intuitive than #1. In order to find out where a user is, I'd have mildly complex SQL like: SELECT categoryId, SUM(points) from UserTasks WHERE userId={user.id} & countsTowardLevel={user.level} groupBy categoryId Hmm... that doesn't seem so bad. I think I'm talking myself into #3 here, but would love any input, advice or other ideas. P.S. Sorry for the cross-post. I wrote this up on SO and then remembered that there was a game dev-focused one. Curious to see if I get different answers one place than the other....

    Read the article

  • How do I allow remote access to mysql using xampp?

    - by sprugman
    I'm using xampp and navicat to manage mysql on two dev machines (laptop & desktop). The laptop is my main machine, while the desktop acts as a local dev server for the group. Connecting to mysql via localhost in navicat is working fine on the laptop. Is there a way (other than the http tunneling method) to allow access to the desktop from the laptop via navicat?

    Read the article

  • How to troubleshoot problems sharing internet connection via WiFi on Mac OS X

    - by sprugman
    I'm at a hotel, plugged into their network via ethernet on my MacBook. I want to share the connection via wifi to two other computers. I went to Prefs Sharing and set up internet sharing. I know it's working because my friend with a Mac access the net fine. My friend with the PC can see the network, but can't connect to it. In the sharing prefs, airport options, I chose these options: Channel: Automatic Enable encryption: yes WEP Key length 40-bit password length: 5 chars (as specified in the instructional text) Update: I tried it with encryption turned off, and it works. Of course, I'd rather not do that... Any ideas?

    Read the article

  • Better urls for this internal web server?

    - by sprugman
    I've got a server that I have admin access to, but don't fully manage. (I think it's a virtual machine, but I'm not 100% sure. It's running Apache on Windows Server 2003.) I share the ip with another user, so my sites all have to use the :8080 port. This is kind of ugly. Also, AFAIK, the only access I have is through an ip address. (I'm inside a corporate firewall and don't think I have access to a DNS server or anything.) I've adjusted my hosts file so I don't have to use the ip address on my local machine, but that's not a very generic solution. Are there any options to 1) get rid of the port requirement 2) be able to use a name (maybe a machine name) instead of the ip address in a generic way? (I'm not really a network admin -- I'm a developer managing this machine. The IT folks who really manage it are a few people away from me and tough to get to do anything, so I'm looking for a light-weight solution if possible.)

    Read the article

  • jquery selector to count the number of visible table rows?

    - by sprugman
    I've got this html: <table> <tr style="display:table-row"><td>blah</td></tr> <tr style="display:none"><td>blah</td></tr> <tr style="display:none"><td>blah</td></tr> <tr style="display:table-row"><td>blah</td></tr> <tr style="display:table-row"><td>blah</td></tr> </table> I need to count the number of rows that don't have display:none. How can I do that?

    Read the article

  • how to programmatically create menu items while creating nodes?

    - by sprugman
    I'm creating some nodes programmatically, thus: foreach ($titles as $t) { $n = new stdClass(); $n->type = 'myType'; $n->uid = 1; $n->title = $t; $menu = array(); $menu['link_title'] = $t; $menu['menu_name'] = 'primary-links'; // this attempt at placing the menu item in a particular place in the // menu hierarchy didn't work: $menu['parent'] = 'primary-links:867'; $menu['depth'] = 3; $menu['p1'] = '580'; $menu['p2'] = '867'; $n->menu = $menu; node_save($n); } I've got a menu structure like this: primary-links Parent 1 Child 1 Child 2 Parent 2 Child 3 I want the new menu items to appear as children of Child 3. I was able to create menu items at the same time as the nodes, and they appeared in the correct menu, but not in the correct place in the hierarchy. What am I missing?

    Read the article

  • How to give the menus associated with dojo's dijit.ComboBox different css from those of dijit.Menu

    - by sprugman
    When you use a dijit.ComboBox, the type ahead suggestions get implemented as a dijit.Menu. I've got a design which calls for the matched portion of the suggestion rows to be normal, and the unmatched portion to be bold. The structure that dojo creates is like this: <ul class="dijitReset dijitMenu"> <li role="option" class="dijitReset dijitMenuItem"> <span class="dijitComboBoxHighlightMatch">Ch</span>oice One </li> <li role="option" class="dijitReset dijitMenuItem"> <span class="dijitComboBoxHighlightMatch">Ch</span>oice Two </li> </ul> So I can target the matched part, but not the unmatched part. So my css needs to be something like: .dijitMenuItem { font-weight: bold; } .dijitMenuItem .dijitComboBoxHighlightMatch { font-weight: normal; } The problem is, if I do that, all menus will be bolded, and I don't want that. Just doing something like this: <select dojoType="dijit.form.ComboBox" class="foobar">[options]</select> puts the foobar class in the ComboBox, but the menu is an independent node not under that hierarchy. What's the easiest way to add a css class around the popup menu that the ComboBox generates?

    Read the article

  • how do arguments work with dojo.connect?

    - by sprugman
    I've read the docs, but I must be missing something. I've got a grid, I want to connect to the event that fires when the column headers are clicked for sorting, thus: dojo.addOnLoad(function(){ var grid = dijit.byId("grid"); dojo.connect(grid, "setSortInfo", 'afterSort'); }); function afterSort() { console.info('after sort'); } That works fine as far as it goes. I know the setSortInfo method has an argument which is the column number. How do I get that value? I've tried putting a parameter in the sig for afterSort to no avail. The docs say "the method receives the same arguments as the event", but where are they???

    Read the article

  • How to create a tree with filtered nodes from drupal taxonomy.

    - by sprugman
    I'm trying to create a menu tree in drupal like this: - term 1 node 1 node 2 - sub-term 1 node 3 node 4 + sub-term 2 - sub-term 3 node 5 - sub-sub-term 1 node 6 + term 2 etc. (Sub-term 2 and term 2 are toggled closed.) Some requirements: Output this using something like JQuery Menu to get an interactive tree Filter the nodes by cck type Filter the nodes by cck field Only have terms with nodes or other active terms in them show up Mark the current node as such, and automatically open the tree to that point Do I have to write this myself, or are there a combination of modules that can do it? I've got Advanced Taxonomy Blocks, which is pretty close, but it doesn't list the nodes.

    Read the article

  • how to avoid 'out of memory' errors when programmatically generating a lot of nodes in drupal?

    - by sprugman
    I'm creating about 150 nodes programmatically and running into 'out of memory' errors when doing it all in a single request. (I have a menu callback that generates the nodes and calls node_save() on them.) Example: for($i=0; $i<150; $i++) { $node = new stdClass(); $node->title="Foo $i"; $node->field_myfield[0]['value'] = "Bar $i"; ... node_save($node); } I've heard of BatchAPI, but never used it. Is that the right tool to get around this? The docs talk about timeouts, but not memory issues. Is there something simpler that I might be missing?

    Read the article

  • string parsing help

    - by sprugman
    I've got a string like this: #################### Section One #################### Data A Data B #################### Section Two #################### Data C Data D etc. I want to parse it into something like: $arr( 'Section One' => array('Data A', 'Data B'), 'Section Two' => array('Data C', 'Data D') ) At first I tried this: $sections = preg_split("/(\r?\n)(\r?\n)#/", $file_content); The problem is, the file isn't perfectly clean: sometimes there are different numbers of blank lines between the sections, or blank spaces between data rows. The section head pattern itself seems to be relatively consistent: #################### Section Title #################### The number of #'s is probably consistent, but I don't want to count on it. The white space on the title line is pretty random. Once I have it split into sections, I think it'll be pretty straightforward, but any help writing a killer reg ex to get it there would be appreciated. (Or if there's a better approach than reg ex...)

    Read the article

  • how to insert page view of a node in another page in drupal

    - by sprugman
    I have a list of node ids and I want to display the 'page' view of each one. For various reasons, I don't want to do this with views, and don't think I should need a module. Just an API call to theme('node'). Something like: $nids = array(3,4,5); foreach ($nids as $nid) { $node = node_load($nid); $result .= theme('node', $node); } but I'm not getting back the full page view of the node. I added this to my node-[type].tpl.php file: if ($page) print "PAGE MODE "; else print "NOT PAGE "; if ($teaser) print "TEASER MODE "; else print "NOT TEASER "; and got: NOT PAGE NOT TEASER I seem to be in some kind of limbo. I suspect there's an argument that I add to the theme function, but the terms are all so general (theme, teaser, page, node), I'm having trouble with my google-fu.

    Read the article

  • is it possible to continue a file upload after a browser has been quit?

    - by sprugman
    If a user starts uploading a file (in a web app), and they close their browser before the upload completes, what happens? My guess would be that the upload gets abandoned, and the server has some garbage cleaning mechanism that kicks in eventually, but I'm not sure. Any difference between servers or server languages? Any difference between quitting the browser and just closing a window?

    Read the article

  • apache on windows virtual directory config help

    - by sprugman
    I'm running Apache on Windows XP via Xampplite, and could use help configuring my virtual directory. Here's what I'm hoping to do on my dev box: I want my source files to live outside of the xampp htdocs dir on my local machine I can access the project at http://myproject others on my local network can access the project at my.ip.address/myproject keep localhost pointing to the xampp's htdocs folder so I can easily add other projects. I've got 1 & 2 working by editing the windows hosts file, and adding a virtual directory in xampp's apache\conf\extra\httpd-vhosts.conf file. I don't immediately see how to do 3 without messing up 4.

    Read the article

  • Where do you put non-controller classes in codeigniter?

    - by sprugman
    I've got a class Widgets. Widgets are made up of Doohickies. I'm never going to need to access Doohickies directly via url -- they're essentially a private class, only used by Widgets. Where do you put your code to define the Doohicky class? In /app/controllers/doohicky.php? in app/controllers/widget.php? somewhere else? Obviously, the former seems cleaner, but it's not obvious to me how to make the Doohicky class available to Widget.

    Read the article

  • Should I *always* import my file references into the database in drupal?

    - by sprugman
    I have a cck type with an image field, and a unique_id text field. The file name of the image is based on the unique_id. All of the content, including the image itself is being generated automatically via another process, and I'm parsing what that generates into nodes. Rather than creating separate fields for the id and the image, and doing an official import of the image into the files table, I'm tempted to only create the id field and create the file reference in the theme layer. I can think of pros and cons: 1) Theme Layer Approach Pros: makes the import process much less complex don't have to worry about syncing the db with the file system as things change more flexible -- I can move my images around more easily if I want Cons: maybe not as much The Drupal Way™ not as pure -- I'll wind up with more logic on the theme side. 2) Import Approach Pros: import method is required if we ever wanted to make the files private (we won't.) safer? Maybe I'll know if there's a problem with the image at import time, rather than view time. Since I'll be bulk importing, that might make a difference. if I delete a node through the admin interface, drupal might be able to delete the file for me, as well. Con: more complex import and maintenance All else being equal, simpler is always better, so I'm leaning toward #1. Are there any other issues I'm missing? (Since this is an open ended question, I guess I'll make it a community wiki, whatever that means.)

    Read the article

  • clever way to conditionally split this string?

    - by sprugman
    I've got a string that could be in one of two forms: prefix=key=value (which could have any characters, including '=') or key=value So I need to split it either on the first or second equals sign, based on a boolean that gets set elsewhere. I'm doing this: if ($split_on_second) { $parts = explode('=', $str, 3); $key = $parts[0] . '=' . $parts[1]; $val = $parts[2]; } else { $parts = explode('=', $str, 2); $key = $parts[0]; $val = $parts[1]; } Which should work, but feels inelegant. Got any better ideas in php? (I imagine there's a regex-ninja way to do it, but I'm not a regex-ninja.;-)

    Read the article

1 2  | Next Page >