Search Results

Search found 314 results on 13 pages for 'rooms'.

Page 2/13 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • ability to see free/busy detail information for conference rooms in Outlook 2007 and Microsoft hosted Exchange solution

    - by Malav
    recently my company migrated from an in-house Exchange server to the Microsoft hosted exchange online solution. My client is Outlook 2007. Before the migration, I could see the details of the meetings when I hovered on the busy blue bar for a resource such as a conference room. I could click on the meetings and see the invite list and the contents of the meeting. Ofcourse if the meeting was marked as private I could not. however after the migration to the online solution, I cannot see the detailed information. I can still see if the room is busy or not but I can no longer see the details of that meeting. The IT folks can see the information and they claim that they can see it because they have full admin rights. It is their claim that in the hosted Exchange solution you can either have full access (admin access) and see the details or not see anything but just that the room is busy. there is no middle ground such as being able to see the details of the meeting but not having any admin rights. For some reason I believe this to be not true. Can someone please verify my doubts and inform me of what needs to be done to see that information if my IT folks are wrong? thanks

    Read the article

  • How is fire spread in server rooms and datacenters?

    - by sharptooth
    Every now and then I read that a severe fire has happened in some datacenter, lots of equipment has been damaged and customers have gone offline. Now I wonder what is there to support and spread fire? I mean walls in a server room usually have little or no finish. Racks are made of metal. Almost all units have metal cases. Cables have (or at least should have) insulation of materials that don't spread fire. What is spreading fire in a server room or datacenter?

    Read the article

  • JQuery: Get length of JSON reply?

    - by Rosarch
    In a JQuery getJSON call, how can I tell the length of the JSON that's returned? function refreshRoomList() { $.getJSON('API/list_rooms', function (rooms) { if (rooms.length > 0) { $("#existing-room-list").empty(); $("#join-existing-room").text("Join existing room:"); // this shouldn't be here $.each(rooms, function (index, roomName) { var newChild = sprintf('<li><a href="room?key=%s">%s</a></li>', index, roomName); $("#existing-room-list").append(newChild); }); } else { $("#join-existing-room").text("No rooms found."); } }); } For some reason this doesn't work, but if I replace rooms.length > 0 with true, the full list of rooms is printed out.

    Read the article

  • dependent: :destroy is not deleting dependencies from views

    - by jxdx
    Projects have many rooms. When I delete a project from the view, the associated rooms are not deleted. Rooms also have many products which should also be deleted when a project is deleted. Project class class Project < ActiveRecord::Base belongs_to :user has_many :rooms, dependent: :destroy has_many :products, through: :rooms end Projects Controller class ProjectsController < ApplicationController def destroy @project = current_user.projects.find(params[:id]) if @project.delete redirect_to user_projects_path(@project.user) end end end Rooms Controller class RoomsController < ApplicationController def destroy @room = Room.find(params[:id]) if @room.delete redirect_to root_path end end The delete link in the projects show view. = link_to "Delete", project_room_path(room.project, room), method: :delete, data: { confirm: "Are you sure?" }, title: room.title, class: "btn btn-danger"

    Read the article

  • How can I implement a matchmaker?

    - by csiz
    I'm making a multiplayer game, where players are separated in to rooms that would ideally have about 20 players. So I need a few pointers on an algorithm to distribute the players in to these rooms. A few more constraints: When a players gets in to a room, he should stay there until he decides to exit (the room itself changes levels) There may be more room servers, every server should create more rooms until near full capacity There's a central server that manages all the room servers, and directs the players towards their room

    Read the article

  • SQL group results as a column array

    - by Radek
    Hi guys, this is an SQL question and don't know which type of JOIN, GROUP BY etc. to use, it is for a chat program where messages are related to rooms and each day in a room is linked to a transcript etc. Basically, when outputting my transcripts, I need to show which users have chatted on that transcript. At the moment I link them through the messages like so: SELECT rooms.id, rooms.name, niceDate, room_transcripts.date, long FROM room_transcripts JOIN rooms ON room_transcripts.room=rooms.id JOIN transcript_users ON transcript_users.room=rooms.id AND transcript_users.date=room_transcripts.date JOIN users ON transcript_users.user=users.id WHERE room_transcripts.deleted=0 AND rooms.id IN (1,2) ORDER BY room_transcripts.id DESC, long ASC The result set looks like this: Array ( [0] => Array ( [id] => 2 [name] => Room 2 [niceDate] => Wednesday, April 14 [date] => 2010-04-14 [long] => Jerry Seinfeld ) [1] => Array ( [id] => 1 [name] => Room 1 [niceDate] => Wednesday, April 14 [date] => 2010-04-14 [long] => Jerry Seinfeld ) [2] => Array ( [id] => 1 [name] => Room 1 [niceDate] => Wednesday, April 14 [date] => 2010-04-14 [long] => Test Users ) ) I would like though for each element in the array to represent one transcript entry and for the users to be grouped in an array as the entry's element. So 'long' will be an array listing all the names. Can this be done? At the moment I just append the names and when the transcript date and room changes I echo them retrospectively, but I will do the same for files and highlighted messages and it's messy. Thanks.

    Read the article

  • Procedual level generation for a platformer game (tilebased) using player physics

    - by Notbad
    I have been searching for information about how to build a 2d world generator (tilebased) for a platformer game I am developing. The levels should look like dungeons with a ceiling and a floor and they will have a high probability of being just made of horizontal rooms but sometimes they can have exits to a top/down room. Here is an example of what I would like to achieve. I'm refering only to the caves part. I know level design won't be that great when generated but I think it is possible to have something good enough for people to enjoy the procedural maps (Note: Supermetrod Spoiler!): http://www.snesmaps.com/maps/SuperMetroid/SuperMetroidMapNorfair.html Well, after spending some time thinking about this I have some ideas to create the maps that I would like to share with you: 1) I have read about celular automatas and I would like to use them to carve the rooms but instead of carving just a tile at once I would like to carve full columns of tiles. Of course this carving system will have some restrictions like how many tiles must be left for the roof and the ceiling, etc... This way I could get much cleaner rooms than using the ussual automata. 2) I want some branching into the rooms. It will have little probability to happen but I definitely want it. Thinking about carving I came to the conclusion that I could be using some sort of path creation algorithm that the carving system would follow to create a path in the rooms. This could be more noticiable if we make the carving system to carve columns with the height of a corridor or with the height of a wide room (this will be added to the system as a param). This way at some point I could spawn a new automa beside the main one to create braches. This new automata should play side by side with the first one to create dead ends, islands (both paths created by the automatas meet at some point or lead to the same room. It would be too long to explain here all the tests I have done, etc... just will try to summarize the problems to see if anyone could bring some light to solve them (I don't mind sharing my successes but I think they aren't too relevant): 1) Zone reachability: How can I make sure that the player will be able to reach all zones I created (mainly when branches happen or vertical rooms are created). When branches are created I have to make sure that there will be a way to get onto the new created branch. I mean a bifurcation that the player could follow. Player will follow the main path or jump to a platform to get onto the other way). On the other hand if an island is created by the meeting of both branches I need to make sure the player will be able to get onto the island too. 2) When a branch is created and corridors are generated for each branch how can I make then both merge or repel to create an island or just make them separated corridors. 3) When I create a branch and an island is created becasue both corridors merge at somepoint or they lead to the same room, is there any way to detect this and randomize where to create the needed platforms to get onto the created isle? This platforms could be created at the start of the island or at the end. I guess part of the problem could be solved using some sort of graph following the created paths but I'm a bit lost in this sea of precedural content creation :). On the other hand I don't expect a solution to the problem but some information to get me moving forward again. Thanks in advance.

    Read the article

  • Limit foreign key choices in select in an inline form in admin

    - by mightyhal
    Edited :-) Hopefully a bit clearer now. The logic is of the model is: A Building has many Rooms A Room may be inside another Room (a closet, for instance--ForeignKey on 'self') A Room can only in inside of another Room in the same building (this is the tricky part) Here's the code I have: #spaces/models.py from django.db import models class Building(models.Model): name=models.CharField(max_length=32) def __unicode__(self): return self.name class Room(models.Model): number=models.CharField(max_length=8) building=models.ForeignKey(Building) inside_room=models.ForeignKey('self',blank=True,null=True) def __unicode__(self): return self.number and: #spaces/admin.py from ex.spaces.models import Building, Room from django.contrib import admin class RoomAdmin(admin.ModelAdmin): pass class RoomInline(admin.TabularInline): model = Room extra = 2 class BuildingAdmin(admin.ModelAdmin): inlines=[RoomInline] admin.site.register(Building, BuildingAdmin) admin.site.register(Room) The inline will display only rooms in the current building (which is what I want). The problem, though, is that for the inside_room drop down, it displays all of the rooms in the Rooms table (including those in other buildings). In the inline of rooms, I need to limit the inside_room choices to only rooms which are in the current building being displayed by the main form. I can't figure out a way to do it with either a limit_choices_to in the model, nor can I figure out how exactly to override the admin's inline formset properly (I feel like I should be somehow create a custom inline form, pass the building_id of the main form to the custom inline, then limit the queryset for the field's choices based on that--but I just can't wrap my head around how to do it). Maybe this is too complex for the admin site, but it seems like something that would be generally useful... Thanks again for your help!

    Read the article

  • Algorithm to use for shop floor layout?

    - by jkohlhepp
    I ran into a classroom problem yesterday (business oriented class, not computer science) and I found it interesting from an algorithmic perspective. The problem goes something like this: Assume there is a shop floor with N different rooms, and you have N different departments that need to go in those rooms. The departments and the rooms are all the same size, so any department could go in any room. There is a known travel distance from each room to each other room. There is also a known amount of trips necessary from one department to another (trips are counted the same regardless which room they originate from, so a trip from A to B is equivalent to a trip from B to A). Given those inputs, determine a layout of departments into rooms which minimizes travel time. What is the best way to approach this problem algorithmically? Is there already a particular algorithm or class of algorithms designed to solve this type of problem? Does this type of problem have a name in computer science? I am not looking for you to design an algorithm to solve this, although feel free to do so if you would like. I'm wondering if this is a problem space that has already been well defined and studied algorithmically and if so get some links to research further. I can see a lot of different data structures and algorithms that might apply to this and I'm curious which approach would be "best". And don't worry, you are not doing my homework for me. This is not a homework problem per se, as this is a business course and we were simply discussing the concepts and not trying to solve the problem algorithmically.

    Read the article

  • Is the way I'm implementing my genetic algorithm right?

    - by Mhjr
    In my graduation project, I am asked to use a genetic algorithm (any variation of it can be chosen) to generate valid timetables. What I did was make a simple program that generates unique sequences representing genes, the sequence is described below: (sorry if it's mathematically incorrect) The only variable in the sequence is the room element, so basically the program takes a tree that goes like this: [Course] -(contains)-> [Units] -(contains)-> [Offerings] -(contains)-> [Instructors] -(contains)-> [Rooms] Each course can have n units (duplicates). Each unit can have n offerings (lectures,lab session, excercises,...). Each offering has only 1 instructor. Each instructor (or the whole lecture composed from the four elements of the sequence) has multiple rooms. When a timetable is initialized, one of these sequences that differ in rooms will be taken into the timetable, so the difference in genes (sequences) of each timetable will be just the rooms random choice and the difference between chromosomes (timetables) will be time placements of these genes (sequences). My question is, before I proceed in implementing what I described, is it valid? Is the representation used here for chromosomes a permutation representation?

    Read the article

  • Answers to Conference Revenue Tweet Questions

    - by D'Arcy Lussier
    Originally posted on: http://geekswithblogs.net/dlussier/archive/2014/05/27/156612.aspxI tweeted this the other day… …and I had some people tweet back questioning/asking about the profit number. So here’s how I came to that figure. Total Revenue Let’s talk total revenue first. This conference has a huge list of companies/organizations paying some amount for sponsorship. Platinum ($1500) x 5 = $7500 Gold ($1000) x 3 = $3000 Silver ($500) x 9 = $4500 Bronze ($250) x 13 = $3250 There’s also a title sponsor level but there’s no mention of how much that is…more than $1500 though, so let’s just say $2500. Total Sponsorship Revenue: $20750.00 For registrations, this conference is claiming over 300 attendees. We’ll just calculate at 300 and the discounted “member rate” – $249. Total Registration Revenue: $74700.00 Booth space is also sold for a vendor area, but let’s just leave that out of the calculation. Total Event Revenue: $95450.00 Now that we know how much money we’re playing with, let’s knock out the costs for the event. Total Costs Hard Costs Audio/Visual Services $2000 Conference Rooms (4 Breakouts + Plenary) $2500 Insurance $700 Printing/Signage $1500 Travel/Hotel Rooms $2000 Keynotes $2000 So let’s talk about these hard costs first. First you may be asking about the Audio Visual. Yes those services can be that high, actually higher. But since there’s an A/V company touted as the official A/V provider, I gotta think there’s some discount for being branded as such. Conference rooms are actually an inflated amount of $500 per. Venues make money on the food they sell at events, not on room rentals. The more food, the cheaper the rooms tend to be offered at. Still, for the sake of argument, let’s set the rooms at $500 each knowing that they could be lower. For travel and hotel rooms…it appears that most of the speakers at this conference are local, meaning there’s no travel or hotel cost. But a few of them I wasn’t too sure…so let’s factor in enough to cover two outside speakers (airfare and hotel). There are two keynotes for this event and depending on the event those may be paid gigs. I’m not sure if they are or not, but considering the closing one is a comedian I’m going to add some funds here for that just in case. Total Hard Costs: $10700 Now that the hard costs are out of the way, let’s talk about the food costs. Food Costs The conference is providing a continental breakfast (YEEEESH!), some level of luncheon, and I have to assume coffee breaks in between. Let’s look at those costs. Continental Breakfast $12 per person Lunch Buffet $18 per person Coffee Breaks (2) $6 per person (or $3 a cup) Snacks (2) $10 per person (or $5 each) Note that the lunch buffet assumes a *good* lunch buffet – two entrees, starch, vegetable, salads, and bread. Not sure if there’ll be snacks during coffee breaks but let’s assume so. Total Food Cost Per Person: $46 Food Cost: $14950 Gratuity: $2691 Total Food Cost: $17641 Total food cost is based on the $46 per person cost x 325. 300 for attendance, 12 for speakers, extra 13 for volunteers/organizers. Gratuity is 18%. Grand Totals So let’s sum things up here. Total Costs Hard Costs: $10700.00 Food Costs: $17641.00 Total:          $28341.00 Taxes:         $3685.00 Grand Total  $32026.00 Total Revenue Sponsorship  $20750 Registration   $74700 Grand Total   $95450.00 Total Profit $63424.00 Now what if the registration numbers were lower and they only got 100 people to show up. In that scenario there’d still be a profit of just under $26000. Closing Comments A couple of things to note: - I haven’t factored in anything for prizes. Not sure if any will be given out - We didn’t add in the booth space revenue - We’re assuming speakers aren’t getting paid, but even if they were at the high end its $12000 ($1000 per session), which is probably an inflated number for local speakers. - Note that all registrations were set to the “member” discounted price. The non-member registration price is higher. There is also an option for those that just want to show up for the opening keynote. There you have it! Let me know if you have any questions. D

    Read the article

  • Can you notice what's wrong with my PHP or MYSQL code?

    - by Jenna
    I am trying to create a category menu with sub categories. I have the following MySQL table: -- -- Table structure for table `categories` -- CREATE TABLE IF NOT EXISTS `categories` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(1000) NOT NULL, `slug` varchar(1000) NOT NULL, `parent` int(11) NOT NULL, `type` varchar(255) NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=66 ; -- -- Dumping data for table `categories` -- INSERT INTO `categories` (`ID`, `name`, `slug`, `parent`, `type`) VALUES (63, 'Party', '/category/party/', 0, ''), (62, 'Kitchen', '/category/kitchen/', 61, 'sub'), (59, 'Animals', '/category/animals/', 0, ''), (64, 'Pets', '/category/pets/', 59, 'sub'), (61, 'Rooms', '/category/rooms/', 0, ''), (65, 'Zoo Creatures', '/category/zoo-creatures/', 59, 'sub'); And the following PHP: <?php include("connect.php"); echo "<ul>"; $query = mysql_query("SELECT * FROM categories"); while ($row = mysql_fetch_assoc($query)) { $catId = $row['id']; $catName = $row['name']; $catSlug = $row['slug']; $parent = $row['parent']; $type = $row['type']; if ($type == "sub") { $select = mysql_query("SELECT name FROM categories WHERE ID = $parent"); while ($row = mysql_fetch_assoc($select)) { $parentName = $row['name']; } echo "<li>$parentName >> $catName</li>"; } else if ($type == "") { echo "<li>$catName</li>"; } } echo "</ul>"; ?> Now Here's the Problem, It displays this: * Party * Rooms >> Kitchen * Animals * Animals >> Pets * Rooms * Animals >> Zoo Creatures I want it to display this: * Party * Rooms >> Kitchen * Animals >> Pets >> Zoo Creatures Is there something wrong with my loop? I just can't figure it out.

    Read the article

  • How Can I Populate Default Form Data with a ManyToMany Field?

    - by b14ck
    Ok, I've been crawling google and Django documentation for over 2 hours now (as well as the IRC channel on freenode), and haven't been able to figure this one out. Basically, I have a model called Room, which is displayed below: class Room(models.Model): """ A `Partyline` room. Rooms on the `Partyline`s are like mini-chatrooms. Each room has a variable amount of `Caller`s, and usually a moderator of some sort. Each `Partyline` has many rooms, and it is common for `Caller`s to join multiple rooms over the duration of their call. """ LIVE = 0 PRIVATE = 1 ONE_ON_ONE = 2 UNCENSORED = 3 BULLETIN_BOARD = 4 CHILL = 5 PHONE_BOOTH = 6 TYPE_CHOICES = ( ('LR', 'Live Room'), ('PR', 'Private Room'), ('UR', 'Uncensored Room'), ) type = models.CharField('Room Type', max_length=2, choices=TYPE_CHOICES) number = models.IntegerField('Room Number') partyline = models.ForeignKey(Partyline) owner = models.ForeignKey(User, blank=True, null=True) bans = models.ManyToManyField(Caller, blank=True, null=True) def __unicode__(self): return "%s - %s %d" % (self.partyline.name, self.type, self.number) I've also got a forms.py which has the following ModelForm to represent my Room model: from django.forms import ModelForm from partyline_portal.rooms.models import Room class RoomForm(ModelForm): class Meta: model = Room I'm creating a view which allows administrators to edit a given Room object. Here's my view (so far): def edit_room(request, id=None): """ Edit various attributes of a specific `Room`. Room owners do not have access to this page. They cannot edit the attributes of the `Room`(s) that they control. """ room = get_object_or_404(Room, id=id) if not room.is_owner(request.user): return HttpResponseForbidden('Forbidden.') if is_user_type(request.user, ['admin']): form_type = RoomForm elif is_user_type(request.user, ['lm']): form_type = LineManagerEditRoomForm elif is_user_type(request.user, ['lo']): form_type = LineOwnerEditRoomForm if request.method == 'POST': form = form_type(request.POST, instance=room) if form.is_valid(): if 'owner' in form.cleaned_data: room.owner = form.cleaned_data['owner'] room.save() else: defaults = {'type': room.type, 'number': room.number, 'partyline': room.partyline.id} if room.owner: defaults['owner'] = room.owner.id if room.bans: defaults['bans'] = room.bans.all() ### this does not work properly! form = form_type(defaults, instance=room) variables = RequestContext(request, {'form': form, 'room': room}) return render_to_response('portal/rooms/edit.html', variables) Now, this view works fine when I view the page. It shows all of the form attributes, and all of the default values are filled in (when users do a GET)... EXCEPT for the default values for the ManyToMany field 'bans'. Basically, if an admins clicks on a Room object to edit, the page they go to will show all of the Rooms default values except for the 'bans'. No matter what I do, I can't find a way to get Django to display the currently 'banned users' for the Room object. Here is the line of code that needs to be changed (from the view): defaults = {'type': room.type, 'number': room.number, 'partyline': room.partyline.id} if room.owner: defaults['owner'] = room.owner.id if room.bans: defaults['bans'] = room.bans.all() ### this does not work properly! There must be some other syntax I have to use to specify the default value for the 'bans' field. I've really been pulling my hair out on this one, and would definitely appreciate some help. Thanks!

    Read the article

  • Add column from another table matching results from first MySQL query

    - by Nemi
    This is my query for available rooms in choosen period: SELECT rooms.room_id FROM rooms WHERE rooms.room_id NOT IN ( SELECT reservations.room_id FROM reservations WHERE ( reservations.arrivaldate >= $arrival_datetime AND reservations.departuredate <= $departure_datetime) OR ( reservations.arrivaldate <= $arrival_datetime AND reservations.departuredate >= $arrival_datetime ) OR ( reservations.arrivaldate <= $departure_datetime AND reservations.departuredate >= $departure_datetime ) ); How to add average room price column for selected period(from $arrival_datetime to $departure_datetime) from another table (room_prices_table), for every room_id returned from above query. So I need to look in columns whos name is same as room_id... room_prices_table: date room0001 room0002 room0003 ... Something like SELECT AVG(room0003) FROM room_prices_table WHERE datum IS BETWEEN $arrival_datetime AND $departure_datetime ??

    Read the article

  • Mysql - Grouping the result based on a mathematical operation and SUM() function

    - by SpikETidE
    Hi all... I'm having the following two tables... Table : room_type type_id type_name no_of_rooms max_guests rate 1 Type 1 15 2 1254 2 Type 2 10 1 3025 Table : reservation reservation_id start_date end_date room_type booked_rooms 1 2010-04-12 2010-04-15 1 8 2 2010-04-12 2010-04-15 1 2 Now... I have this query SELECT type_id, type_name FROM room_type WHERE id NOT IN (SELECT room_type FROM reservation WHERE start_date >= '$start_date' AND end_date <= '$end_date') What the query does is it selects the rooms that are not booked between the start date and end date. Also, as you can see from the reservation table, we also have 'number of rooms booked between the two dates' factor also... I need to add this 'no.of booked rooms between the two dates' factor also in to the query... The query should return the type of rooms for which at least one room is free between the two dates. I worked out the logic but just can't represent it as a query....! How will you do this...? Thanks for your suggestions..!

    Read the article

  • Should I be using the command pattern? Seems like a lot of work...

    - by Fedor
    My Room class has a lot of methods I used before I decided to use the command pattern. Previously, I was invoking a lot of commands and now it seems I have to make a method in my roomParser class for every method. If I wanted to invoke say, setHotelCode I would have to create a method in roomParser that iterates through and invokes the method. Is this the way I should be using the command pattern? <?php interface Parseable { public function parse( $arr, $dept ); } class Room implements Parseable { protected $_adults; protected $_kids; protected $_startDate; protected $_endDate; protected $_hotelCode; protected $_sessionNs; protected $_minRate; protected $_maxRate; protected $_groupCode; protected $_rateCode; protected $_promoCode; protected $_confCode; protected $_currency = 'USD'; protected $_soapAction; protected $_soapHeaders; protected $_soapServer; protected $_responseXml; protected $_requestXml; public function __construct( $startdate,$enddate,$rooms=1,$adults=2,$kids=0 ) { $this->setNamespace(SESSION_NAME); $this->verifyDates( $startdate, $enddate ); $this->_rooms= $rooms; $this->_adults= $adults; $this->_kids= $kids; $this->setSoapAction(); $this->setRates(); } public function parse( $arr, $dept ) { $this->_price = $arr * $dept * rand(); return $this; } public function setNamespace( $namespace ) { $this->_sessionNs = $namespace; } private function verifyDates( $startdate, $enddate ) {} public function setSoapAction( $str= 'CheckAvailability' ) { $this->_soapAction = $str; } public function setRates( $rates='' ) { } public function setHotelCode($code ) { $this->_hotelCode = $code; } private function getSoapHeader() { return '<?xml version="1.0" encoding="utf-8"?> <soap:Header> </soap:Header>'; } private function getSoapFooter() { return '</soap:Envelope>'; } private function getSource() { return '<POS> <Source><RequestorId ID="" ID_Context="" /></Source> </POS>'; } function requestXml() { $this->_requestXml = $this->getSoapHeader(); $this->_requestXml .='<soap:Body></soap:Body>'; return $this->_requestXml; } private function setSoapHeaders ($contentLength) { $this->_soapHeaders = array('POST /url HTTP/1.1', 'Host: '.SOAP_HOST, 'Content-Type: text/xml; charset=utf-8', 'Content-Length: '.$contentLength); } } class RoomParser extends SplObjectStorage { public function attach( Parseable $obj ) { parent::attach( $obj ); } public function parseRooms( $arr, $dept ) { for ( $this->rewind(); $this->valid(); $this->next() ) { $ret = $this->current()->parse( $arr, $dept ); echo $ret->getPrice(), PHP_EOL; } } } $arrive = '12/28/2010'; $depart = '01/02/2011'; $rooms = new RoomParser( $arrive, $depart); $rooms->attach( new Room( '12/28/2010', '01/02/2011') ); $rooms->attach( new Room( '12/29/2010', '01/04/2011') ); echo $rooms->count(), ' Rooms', PHP_EOL; Edit: I'm thinking it may be easier if I made the RoomParser less generic by storing properties that all the objects will share. Though I'll probably have to make methods if I want to override for a certain object.

    Read the article

  • Reasoner Conversion Problems:

    - by Annalyne
    I have this code right here in Java and I wanted to translate it in C++, but I had some problems going: this is the java code: import java.io.*; import java.util.*; public class ClueReasoner { private int numPlayers; private int playerNum; private int numCards; private SATSolver solver; private String caseFile = "cf"; private String[] players = {"sc", "mu", "wh", "gr", "pe", "pl"}; private String[] suspects = {"mu", "pl", "gr", "pe", "sc", "wh"}; private String[] weapons = {"kn", "ca", "re", "ro", "pi", "wr"}; private String[] rooms = {"ha", "lo", "di", "ki", "ba", "co", "bi", "li", "st"}; private String[] cards; public ClueReasoner() { numPlayers = players.length; // Initialize card info cards = new String[suspects.length + weapons.length + rooms.length]; int i = 0; for (String card : suspects) cards[i++] = card; for (String card : weapons) cards[i++] = card; for (String card : rooms) cards[i++] = card; numCards = i; // Initialize solver solver = new SATSolver(); addInitialClauses(); } private int getPlayerNum(String player) { if (player.equals(caseFile)) return numPlayers; for (int i = 0; i < numPlayers; i++) if (player.equals(players[i])) return i; System.out.println("Illegal player: " + player); return -1; } private int getCardNum(String card) { for (int i = 0; i < numCards; i++) if (card.equals(cards[i])) return i; System.out.println("Illegal card: " + card); return -1; } private int getPairNum(String player, String card) { return getPairNum(getPlayerNum(player), getCardNum(card)); } private int getPairNum(int playerNum, int cardNum) { return playerNum * numCards + cardNum + 1; } public void addInitialClauses() { // TO BE IMPLEMENTED AS AN EXERCISE // Each card is in at least one place (including case file). for (int c = 0; c < numCards; c++) { int[] clause = new int[numPlayers + 1]; for (int p = 0; p <= numPlayers; p++) clause[p] = getPairNum(p, c); solver.addClause(clause); } // If a card is one place, it cannot be in another place. // At least one card of each category is in the case file. // No two cards in each category can both be in the case file. } public void hand(String player, String[] cards) { playerNum = getPlayerNum(player); // TO BE IMPLEMENTED AS AN EXERCISE } public void suggest(String suggester, String card1, String card2, String card3, String refuter, String cardShown) { // TO BE IMPLEMENTED AS AN EXERCISE } public void accuse(String accuser, String card1, String card2, String card3, boolean isCorrect) { // TO BE IMPLEMENTED AS AN EXERCISE } public int query(String player, String card) { return solver.testLiteral(getPairNum(player, card)); } public String queryString(int returnCode) { if (returnCode == SATSolver.TRUE) return "Y"; else if (returnCode == SATSolver.FALSE) return "n"; else return "-"; } public void printNotepad() { PrintStream out = System.out; for (String player : players) out.print("\t" + player); out.println("\t" + caseFile); for (String card : cards) { out.print(card + "\t"); for (String player : players) out.print(queryString(query(player, card)) + "\t"); out.println(queryString(query(caseFile, card))); } } public static void main(String[] args) { ClueReasoner cr = new ClueReasoner(); String[] myCards = {"wh", "li", "st"}; cr.hand("sc", myCards); cr.suggest("sc", "sc", "ro", "lo", "mu", "sc"); cr.suggest("mu", "pe", "pi", "di", "pe", null); cr.suggest("wh", "mu", "re", "ba", "pe", null); cr.suggest("gr", "wh", "kn", "ba", "pl", null); cr.suggest("pe", "gr", "ca", "di", "wh", null); cr.suggest("pl", "wh", "wr", "st", "sc", "wh"); cr.suggest("sc", "pl", "ro", "co", "mu", "pl"); cr.suggest("mu", "pe", "ro", "ba", "wh", null); cr.suggest("wh", "mu", "ca", "st", "gr", null); cr.suggest("gr", "pe", "kn", "di", "pe", null); cr.suggest("pe", "mu", "pi", "di", "pl", null); cr.suggest("pl", "gr", "kn", "co", "wh", null); cr.suggest("sc", "pe", "kn", "lo", "mu", "lo"); cr.suggest("mu", "pe", "kn", "di", "wh", null); cr.suggest("wh", "pe", "wr", "ha", "gr", null); cr.suggest("gr", "wh", "pi", "co", "pl", null); cr.suggest("pe", "sc", "pi", "ha", "mu", null); cr.suggest("pl", "pe", "pi", "ba", null, null); cr.suggest("sc", "wh", "pi", "ha", "pe", "ha"); cr.suggest("wh", "pe", "pi", "ha", "pe", null); cr.suggest("pe", "pe", "pi", "ha", null, null); cr.suggest("sc", "gr", "pi", "st", "wh", "gr"); cr.suggest("mu", "pe", "pi", "ba", "pl", null); cr.suggest("wh", "pe", "pi", "st", "sc", "st"); cr.suggest("gr", "wh", "pi", "st", "sc", "wh"); cr.suggest("pe", "wh", "pi", "st", "sc", "wh"); cr.suggest("pl", "pe", "pi", "ki", "gr", null); cr.printNotepad(); cr.accuse("sc", "pe", "pi", "bi", true); } } how can I convert this? there are too many errors I get. for my C++ code (as a commentor asked for) #include <iostream> #include <cstdlib> #include <string> using namespace std; void Scene_Reasoner() { int numPlayer; int playerNum; int cardNum; string filecase = "Case: "; string players [] = {"sc", "mu", "wh", "gr", "pe", "pl"}; string suspects [] = {"mu", "pl", "gr", "pe", "sc", "wh"}; string weapons [] = {"kn", "ca", "re", "ro", "pi", "wr"}; string rooms[] = {"ha", "lo", "di", "ki", "ba", "co", "bi", "li", "st"}; string cards [0]; }; void Scene_Reason_Base () { numPlayer = players.length; // Initialize card info cards = new String[suspects.length + weapons.length + rooms.length]; int i = 0; for (String card : suspects) cards[i++] = card; for (String card : weapons) cards[i++] = card; for (String card : rooms) cards[i++] = card; cardNum = i; }; private int getCardNum (string card) { for (int i = 0; i < numCards; i++) if (card.equals(cards[i])) return i; cout << "Illegal card: " + card <<endl; return -1; }; private int getPairNum(String player, String card) { return getPairNum(getPlayerNum(player), getCardNum(card)); }; private int getPairNum(int playerNum, int cardNum) { return playerNum * numCards + cardNum + 1; }; int main () { return 0; }

    Read the article

  • Algorithm to map an area [on hold]

    - by user37843
    I want to create a crawler that starts in a room and from that room to move North,East,West and South until there aren't any new rooms to visit. I don't want to have duplicates and the output format per line to be something like this: current room, neighbour 1, neighbour 2 ... and in the end to apply BFS algorithm to find the shortest path between 2 rooms. Can anyone offer me some suggestion what to use? Thanks

    Read the article

  • Hiding Options of a Select with JQuery

    - by Syed Abdul Rahman
    Okay, let's start with an example. Keep in mind, this is only an example. <select id = "selection1">     <option value = "1" id = "1">Number 1</option>     <option value = "2" id = "2">Number 2</option>     <option value = "3" id = "3">Number 3</option> </select> Now from here, we have a dropdown with 3 options. What I want to do now is to hide an option. Adding style = "display:none" will not help. The option would not appear in the dropdownlist, but using the arrow keys, you can still select it. Essentially, it does exactly what the code says. It isn't displayed, and it stops there. A JQuery function of $("#1").hide() will not work. Plus, I don't only want to hide the option, I want to completely remove it. Any possibility on doing so? Do I have to use parent/sibling/child elements? If so, I'm still not sure how. Any help on this would be greatly appreciated. Thanks.           Another question - It's related Ok, so I found out that there is a .remove() available in JQuery. Works well. But what if I want to bring it back? if(condition)     {     $(this).remove();     } I can loops this. Shouldn't be complicated. But the thing of which I am trying to do is this: Maximum Capacity of Class: (Input field here) Select Room: (Dropdown here) What I'd like for it to do is to update is Dropdown using a function such as .change() or .keyup. I could create the dropdown only after something is typed. At a change or a keyup, execute the dropdown accordingly. But what I am doing is this: $roomarray = mysql_query("SELECT *     FROM         (         SELECT *,         CASE         WHEN type = 'Classroom' THEN 1         WHEN type = 'Computer laboratory' THEN 2         WHEN type = 'Lecture Hall' THEN 3         WHEN type = 'Auditorium' THEN 4         END AS ClassTypeValue         FROM rooms         ) t     ORDER BY ClassTypeValue, maxppl, roomID"); echo "<select id = \"room\">"; while ($rooms = mysql_fetch_array($roomarray)) { ?> <option value=<?php echo $rooms['roomID']; ?> id=<?php echo $rooms['roomID']; ?>><?php echo $rooms['type']; echo "&nbsp;"; echo $rooms['roomID']; echo "&nbsp;("; echo $rooms['maxppl']; echo ")"; ?></option> <?php } echo "</select>"; Yes, I know it is very messy. I plan to change it later on. But the issue now is this: Can I toggle the removal of the options according to what has been typed? Is it possible to do so with a dropdown made from a loop? Because I sure as hell can't keep executing SQL Queries. Or is that even an option? Because if it's possible, I still think it's a bad one.

    Read the article

  • New CAT5 cable run is unstable - bad jacks? Bad cable?

    - by BeemerGuy
    This is a little project I'm doing at home. I wanted to wire two rooms together (basically, the router is one room, and the switch is in the second room). So I ran a CAT5 between the two rooms, and wired an RJ45 jack in each room. I then hooked up the two jacks with two CAT5 cable to run it through the cable tester, and all 8 wires seem good. Now, when I connect the switch and the router, the connection is unstable -- I ping the router and it barely holds on for two pings before it disconnects, and stays in that unstable state. Just to make sure the router and the switch are ok, I connected them with long wire between the two rooms and the connection is absolutely stable, and pings continuously. What could be the cause for the unstable connection? Especially that it pings a few times, so there IS a connection. But why is it unstable? And how come the cable tester says it's ok, but it's unstable?

    Read the article

  • How to fix unstable RJ45 jacks? [closed]

    - by BeemerGuy
    This is a little project I'm doing at home. I wanted to wire two rooms together (basically, the router is one room, and the switch is in the second room). So I ran a CAT5 between the two rooms, and wired an RJ45 jack in each room. I then hooked up the two jacks with two CAT5 cable to run it through the cable tester, and all 8 wires seem good. Now, when I connect the switch and the router, the connection is unstable -- I ping the router and it barely holds on for two pings before it disconnects, and stays in that unstable state. Just to make sure the router and the switch are ok, I connected them with long wire between the two rooms and the connection is absolutely stable, and pings continuously. What could be the cause for the unstable connection? Especially that it pings a few times, so there IS a connection. But why is it unstable? And how come the cable tester says it's ok, but it's unstable?

    Read the article

  • Inside Red Gate - The Office

    - by Simon Cooper
    The vast majority of Red Gate is on the first and second floors (the second and third floors in US parlance) of an office building in Cambridge Business Park (here we are!). As you can see, the building is split into three sections; the two wings, and the section between them. As well as being organisationally separate, the four divisions are also split up in the office; each division has it's own floor and wing, so everyone in the division is working together in the same area (.NET and DBA on the left, SQL Tools and New Business on the right). The non-divisional parts of the business share wings with the smaller divisions, again keeping each group together. The canteen One of the downsides of divisionalisation is that communication between people in different decisions is greatly reduced. This is where the canteen (aka the SQL Servery) comes in. Occupying most of the central section on the first floor, the canteen provides free cooked lunch every day, and is where everyone in the company gathers for lunch. The idea is to encourage communication between the divisions; having lunch with people in a different division you wouldn't otherwise talk to helps people keep track of what's going on elsewhere in the company. (I'm still amazed at how the canteen staff provide a wide range of superbly cooked food for over 200 people out of a kitchen in which, if you were to swing a cat, it would get severe head injuries.). There's also table tennis and table football tables that anyone can use, provided you can grab them when they're free! Office layout Cubicles are practically unheard of in the UK, and no one, including the CEOs, has separate offices. The entire office is open-plan, as you can see in this youtube video from when we first moved in (although all the empty desks are now full!). Neil & Simon, instead of having dedicated offices, move between the different divisions every few months to keep up to date with what's going on around the company; sitting with a division gives you a much better overall impression of how the division's doing than written status reports from the division heads. There's also the usual plethora of meeting rooms scattered around the place; when we first moved in in 2009 we had a competition to name them all. We've got Afoxalypse A & B, Seagulls A & B, Traffic Jam, Thinking Hats, Camelids A & B, Horses, etc. All the meeting rooms have pictures on the walls corresponding to their theme, which adds a nice bit of individuality to otherwise fairly drab meeting rooms. Generally, any meeting room can be booked by anyone at any time, although some groups have priority in certain rooms (Camelids B is used a lot for UX testing, the Interview Room is used for, well, interviews). And, as you can see from the video, each area has various pictures, post-its, notes, signs, on the walls to try and stop it being a dull office space. Yes, it's still an office, but it's designed to be as interesting and as individual as possible.

    Read the article

  • Why is my Map broken?

    - by Kirk
    Scenario: Creating a server which has Room objects which contain User objects. I want to store the rooms in a Map of some sort by Id (a string). Desired Behavior: When a user makes a request via the server, I should be able to look up the Room by id from the library and then add the user to the room, if that's what the request needs. Currently I use the static function in my Library.java class where the Map is stored to retrieve Rooms: public class Library { private static Hashtable<String, Rooms> myRooms = new Hashtable<String, Rooms>(); public static addRoom(String s, Room r) { myRooms.put(s, r); } public static Room getRoomById(String s) { return myRooms.get(s); } } In another class I'll do the equivalent of myRoom.addUser(user); What I'm observing using Hashtable, is that no matter how many times I add a user to the Room returned by getRoomById, the user is not in the room later. I thought that in Java, the object that was returned was essentially a reference to the data, the same object that was in the Hashtable with the same references; but, it isn't behaving like that. Is there a way to get this behavior? Maybe with a wrapper of some sort? Am I just using the wrong variant of map? Help?

    Read the article

  • Using collections/containers/catalogs in Domain Models

    - by devoured elysium
    Let's say I want to model a cinema. The cinema will have a couple of rooms(for example, 7), where the movies are being played. I wonder how should I design the domain model for this scenario. Should the Cinema class concept concept have a direct association with the 7 rooms? Should the Cinema class concept have an association with a catalog of the 7 rooms? Why? I am having some trouble understanding why in some places I see the first case and in some others I see something like the second case. If instead of rooms, I wanted to depict the relationship between Cinema and: Tickets to sell (today). Tickets already sold (today) Customers in the Cinema database The set of hours at which there are movies playing in a given room in the cinema. The set of places you can sit at in a room in the cinema. Should I use catalogs, should I connect them directly to the Cinema concept with a multiplicity of * in the target? Thanks

    Read the article

  • rails validation of presence not failing on nil

    - by holden
    I want to make sure an attibute exists, but it seems to still slip thru and I'm not sure how better to check for it. This should work, but doesn't. It's a attr_accessor and not a real attribute if that makes a difference. validates_presence_of :confirmed, :rooms {"commit"=>"Make Booking", "place_id"=>"the-kosmonaut", "authenticity_token"=>"Tkd9bfGqYFfYUv0n/Kqp6psXHjLU7CmX+D4UnCWMiMk=", "utf8"=>"✓", "booking"=>{"place_id"=>"6933", "bookdate"=>"2010-11-22", "rooms"=>[{}], "no_days"=>"2"}} Not sure why my form_for returns a blank hash in an array... <% form_for :booking, :url => place_bookings_path(@place) do |f| %> <%= f.hidden_field :bookdate, { :value => user_cart.getDate } %> <%= f.hidden_field :no_days, { :value => user_cart.getDays } %> <% for room in pricing_table(@place.rooms,@valid_dates) %> <%= select_tag("booking[rooms][][#{room.id}]", available_beds(room)) %> <% end %> <% end %>

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >