Search Results

Search found 11759 results on 471 pages for 'isolation level'.

Page 40/471 | < Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >

  • How do you add folder level documentation to C# assemblies?

    - by Elijah
    Me: I'm a relative new-comer to the .NET platform. Problem In Java, you can add package level documentation to your project by creating a package-info.java or package.html file and storing in the package folder. How do I add equivalent documentation to my project in C# using Visual Studio 2010? Background I like to write documentation describing my motivations in the package/folder level context of the source code projects that I am working on. I have become very accustomed to this workflow in a variety of languages (specifically Java) and I believe that it is a good way to document my project.

    Read the article

  • How to Convert arrays or SimpleXML-Objects into an XML-String

    - by streetparade
    I want to create a xml from a given string, i have a function but i didn't wrote it.It seems a bit cryptical too. Can please some one review it and give me some Ideas, how it could be written clearer for everybody? /** * Converts arrays or SimpleXML-Objects into an XML-String * @params mixed Accepts an array or xml string with data to Post * @params integer DO NOT PROVIDE. Internal Usage for recursion only */ private function mixedDataToXML($data, $level = 1) { if(!$data){ return FALSE; } if(is_array($data)) { $xml = ''; if ($level==1) { $xml .= '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n"; } foreach ($data as $key => $value) { $key = strtolower($key); if (is_array($value)) { $multi_tags = false; foreach($value as $key2=>$value2) { if (is_array($value2)) { $xml .= str_repeat("\t",$level)."<$key>\n"; $xml .= $this->mixedDataToXML($value2, $level+1); $xml .= str_repeat("\t",$level)."</$key>\n"; $multi_tags = true; } else { if (trim($value2)!='') { if (htmlspecialchars($value2)!=$value2) { $xml .= str_repeat("\t",$level). "<$key><![CDATA[$value2]]>". "</$key>\n"; } else { $xml .= str_repeat("\t",$level). "<$key>$value2</$key>\n"; } } $multi_tags = true; } } if (!$multi_tags and count($value)>0) { $xml .= str_repeat("\t",$level)."<$key>\n"; $xml .= $this->mixedDataToXML($value, $level+1); $xml .= str_repeat("\t",$level)."</$key>\n"; } } else { if (trim($value)!='') { if (htmlspecialchars($value)!=$value) { $xml .= str_repeat("\t",$level)."<$key>". "<![CDATA[$value]]></$key>\n"; } else { $xml .= str_repeat("\t",$level). "<$key>$value</$key>\n"; } } } } return $xml; }else{ return (string)$data; } }

    Read the article

  • How to hide certain elements on a page using jQuery

    - by Ankur
    I am trying to implement something that is similar to a faceted search. My data is a series of objects and relationships. The idea is that you click an object (in this case "95 Theses" and then the possibly relationships are displayed, in this case "author" and clicking the relationship shows the object that matches the relationship, in this case "Martin Luther". My clicking of objects and relationsips (predicates) works fine. What I need to do is allow users to click an object or relationship and have all those that extend from it removed. This is what I thought of adding when a object or relationship 'tag' is clicked (every time I add another object or relationship I increment the global attribute called 'level'): if($(".objHolder,. preHolder").filter("[level>'"+level+"']").filter("[holderId='"+holderId+"']").length) { $(".objHolder,. preHolder").filter("[level>'"+level+"']").filter("[holderId='"+holderId+"']").remove(); } <table border="0" cellpadding="4" cellspacing="2"> <tbody><tr> <td class="objHolder" objid="1" holderid="1" level="1"> <table border="0" cellpadding="4" cellspacing="2"> <tbody><tr class="objItemRow" objid="1" holderid="1" level="1"> <td class="objItem" objid="1" holderid="1" level="2" bgcolor="#eeeeee" nowrap="nowrap">95 Theses</td> </tr></tbody> </table></td> <td><img src="images/right.jpg" alt="" height="10" width="16"></td> <td class="preHolder" level="2" holderid="1"> <table border="0" cellpadding="4" cellspacing="2"><tbody> <tr><td class="preItem" level="3" subid="1" preid="1" holderid="1" bgcolor="#eeeeee" nowrap="nowrap">author</td></tr> </tbody></table></td> <td><img src="images/right.jpg" alt="" height="10" width="16"></td> <td class="objHolder" level="3" holderid="1"> <table border="0" cellpadding="4" cellspacing="2"><tbody><tr><td class="objItem" level="4" objid="3" holderid="1" bgcolor="#eeeeee" nowrap="nowrap">Martin Luther</td></tr></tbody></table> </td> </tr></tbody> </table>

    Read the article

  • How do I handle a low job offer for an entry level position?

    - by user229269
    Hi guys! I recently graduated with MS in CS and I am excited because I just received a job offer from a company I really like for an entry-level sw engineer position. The thing is that, although the salary is not my priority and I care way more about gaining experience, their offer unfortunately is way below of what I expected. Actually after I did some research I realized that, comparing to the average salary range for the entry-level sw engineering positions in my area (one of the most expensive areas in the US) supposedly [X - Y]$ (where X is the lowest average and Y the highest), their offer is 20% below X! I wouldnt have a problem accepting an offer around X but this one is even lower than the lowest. Can I counter offer the X which is 20% more than what they offered me but at the same time is the minimum average? -- And mind you that I didnt even take under consideration the fact that I hold a MS degree which in many cases yields to a 5-10% more pay.

    Read the article

  • How to programmatically control slave computer on BIOS level?

    - by PovilasSid
    I want to run some test on hardware level. My goal is to create or find a way to control one computer from another down to BIOS settings changing. For example: Master computer sends a signal for slave to restart and opens BIOS settings dialog. Master computer sends a signal to slave to change BIOS parameters and then restart. Then slave fully boots up master starts up some software on slave. Then software finishes operations cycle continues till certain conditions are met. I know that I am looking for a complex thing but mainly what I need are correct keywords because now I am being flooded by BIOS configurations tutorials. Main concerns: Is it possible without using any custom tailer chip? How can master monitor salve`s hardware activity? How to let master handled more than one slave? How what connections are needed to create this kind of setup? (cables)

    Read the article

  • Turn Bluetooth On and Off in Andriod 1.5 (SDK level 3)?

    - by pcm2a
    There are tons of pay and free bluetooth toggles on the market that work with Android 1.5 (SDK level 3). The problem is there is no visible API for this! Does anyone have any working code snippits on how to enable and disable bluetooth that works on Android 1.5? I assume you must have to use some kind of reflection for it. There are some examples over on anddev.org, but they only work with Android 1.1 or lower. This is for Android 1.5 (SDK level 3) and not Android 2.0 or greater. In Android 2.0 or later Google added easy to use APIs.

    Read the article

  • Level editor for 3D games with open format or API?

    - by furtelwart
    I would like to experiment with machine generated levels for a 3D game. I'm very open which game this will be. I just like the idea to run through a generated map. For this approach, it would be great if I can use an API or an open format for level designs. Is there an open source level system that can be used in several game engines (ego shooter or whatever)? I don't know if I explained my point clearly, so please add a comment with your question. I will try to clearify my point.

    Read the article

  • Why is the pavucontrol level indicator jumping while nothing plays?

    - by EnterTheLiquidToasterFamily
    The level indicator in the screenshot does jump around even if nothing is playing. The indicator also reasonably represents sound levels when music is playing. I dont have any mediaservers running or noisy browsertabs open. Also no mic connected. When I turn the volume to max in software and on the amp, there is no noise from the speakers at all. Played music is loud and not distorted. Hardware: Realtek ALC889 over optical audio connector to a generic amp. Software: Debian Wheezy with latest backport kernel 3.14 (same thing on wheezy 3.2 stock), wheezy pulseaudio, xfce session, a custom asound.conf that enables pulseaudio to push sound over optical port. /etc/asound.conf pcm.a52 { @args [CARD] @args.CARD { type string } type rate slave { pcm { type a52 bitrate 448 channels 6 card $CARD } rate 48000 #required somehow, otherwise nothing happens in PulseAudio } }

    Read the article

  • Is it possible to do a web search filtered for the user's comprehension level? [migrated]

    - by Tim
    Do any of the major search engines support a filter to indicate the comprehension level of the user and thus to filter out content beyond their scope? So for example, if someone wanted to find results on "astronomy", but to only show content appropriate for someone in junior-high or lower. Alternatively, if there isn't such an existing method directly, any ideas on how this might be accomplished with existing tools? I found this paper, which seems to indicate folks have looked at this, just don't know if there is a real world tool to do this.

    Read the article

  • Android - How to launch Google map intent in android app with certain location, zoom level and marker

    - by umirza47
    Map Intent not working with specific zoom level as well as custom marker float lat = 40.714728f; float lng = -73.998672f; String maplLabel = "ABC Label"; final Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:0,0?q="+lat+","+lng+"&z=16 (" + maplLabel + ")")); startActivity(intent); Anybody know what is wrong? or how to do so? I want to show map of certain (lat,lng) with a custom label-marker at a specific zoom level.

    Read the article

  • Setting up a server with only subdomains, any connection to top level goes to main server on another IP?

    - by Anagio
    I'm developing a web app where users will have their own sub-domain to login to and use the application. I'm running wordpress for the main website to manage the public / front end. Our application is developed in zend framework. The zf project is currently in a subfolder on the main server. I'd like to place the zend framework project onto another server (different IP) and keep it separate from the the wordpress front end www.domain.com site. The zf application server will run nginx. I'm not sure how to setup a server to run strictly sub domains. Setting up the virtual hosts in the configuration file is no problem. To give the users username.domain.com. But what about the main default configuration file? How would that be configured since the top level domain is technically another server (wordpress) on another IP?

    Read the article

  • Can a function defined in a bookmarklet be called from a page-level script?

    - by Soviut
    I have a bookmarklet that needs to open a new window/tab. In order to avoid the popup blocker, I need to call the window.open() method directly in the bookmarklet ie: at the browser-level. However, I want to keep the bookmarklet updatable by loading external Javascript files. To do this, the bookmarklet needs to append script nodes to the DOM. If i were to put window.open() code in one of these externally loaded scripts, the popup blocker would block it since its page-level. What I want to know is if I can create a wrapper function around window.open() in my bookmarklet, then call it from the externally loaded script? What is the scope and what are the permissions on a wrap such as this?

    Read the article

  • Greater than or equal check when using Group Policy Preferences and Item Level Targeting in the Registry

    - by edusysadmin
    I'm implementing some screen saver configurations via Group Policy Preferences (on Win7 Enterprise x64 desktops). The desired configuration is to have users be able to adjust their screen saver and screen saver time out, but not allow them to select non screen saver or a time out higher than 45min. I've found a great write-up for configuration of the screen saver (link) but cannot find a way to configure the time out. I cannot find a way to have the item level targeting compare the reg key HKCU\Control Panel\Desktop\ScreenSaveTimeOut value and force an over-write of the key if configured above 45min/2700seconds. Anyone else tried something like this or found a means to do this?

    Read the article

  • How to capture child links clicked using jquery?

    - by user244394
    I am trying to capture the event when a child element link is clicked and add class called "highlightchild" to it. Also I want to check if there are any child element link exist or not, if no child element exits ie "third level" highlight with "highlightparent" the parent. How can I do that using jquery? $(document).ready(function() { $('.menu ul').hide(); $('.menu .arrowUp').click(function() { $('.menu ul').hide(); $(this).find(".third-level").toggle(); }); }); html <ul class="menu"> <li class="arrowUp"><a href="#">link1</a> <ul class="third-level" > <!-- third level non-active --> <li class="arrowUp"><a href="/somelink/">Some Link</a></li> </ul> </li> <li class="arrowUp"><a href="#">link2</a> <ul class="third-level" > <!-- third level non-active --> <li class="arrowUp"><a href="/links2/">some Links 2</a></li> </ul> </li> <li class="arrowUp"><a href="#">link3</a> <ul class="third-level" > <!-- third level non-active --> <li class="arrowUp"><a href="/Agri/">Agricultural</a></li> <!-- third level non-active --> <li class="arrowUp"><a href="/sugar/">Sugar</a></li> <!-- third level non-active --> <li class="arrowUp"><a href="/bbc/">Coffee</a></li> <!-- third level non-active --> <li class="arrowUp"><a href="/cnn/">Energy</a></li> <!-- third level non-active --> <li class="arrowUp"><a href="funstuff">Fun stuff</a></li> </ul> </li> <li class="arrowUp"><a href="#">link4</a></li> <li class="arrowUp"><a href="#">link5</a></li> <li class="arrowUp"><a href="#">link6</a></li> </ul>

    Read the article

  • How to know the level of a symlink in linux?

    - by ???
    For example, if a symlink a -> b b -> c c -> d say, the symlink level of a is 3. Then, is there any utility to get this info? And, also I want to get the expansion detail of a symlink, which will show me something like: 1. /abc/xyz is expanded to /abc/xy/z (lrwx--x--x root root) 2. /abc/xy/z is expanded to /abc/xy-1.3.2/z (lrwx--x--x root root) 3. /abc/xy-1.3.2/z is expanded to /abc/xy-1.3.2/z-4.6 (lrwx--x--x root root) 4. /abc/xy-1.3.2/z-4.6 is expanded to /storage/121/43/z_4_6 (lrwx--x--x root root) 5. /storage/121/43/z_4_6 is expanded to /media/kitty_3135/43/z_4_6 (lrwx--x--x root root) So I can diagnostic with the symlinks. Any idea?

    Read the article

  • Why is Rake not able to invoke multiple tasks consecutively?

    - by PandaWood
    I have a Rake task which I have simplified below. I'm using Ruby 1.9 on Windows. Perhaps you would like to guess the outcome of calling the Rake task "list_all_levels" below? It should be: "Hello level 1" "Hello level 2" "Hello level 3" But for reasons unknown to me, it prints only "Hello level 1" and then stops. That is, it always invokes only the first task. If I change the first line to pass the arg "42", it would print "Hello level 42" and then stop. I'm wondering why does it not invoke the task 3 times and print all 3 lines? And is there any way to get it to work how I would expect? task :list_all_levels => [] do Rake::Task[:list].invoke 1 Rake::Task[:list].invoke 2 Rake::Task[:list].invoke 3 end task :list, [:level] => [] do |t, args| puts "Hello level #{args.level}" end

    Read the article

  • Can an SSD notify the hosting OS that its wear level is getting high?

    - by Tony_Henrich
    I read a lot about SSDs and I am interested in them for server use. My biggest concern is their reliability. A lot of writes shortens their life span. I can mitigate this problem if I can run some kind of diagnostics on a regular basis on the SSD or if the SSD can automatically warn the OS that its reliability is reaching a critical level. Think of this as S.M.A.R.T or software like SpinRite for SSDs. Does anything I mentioned exist now? Which kind/brand of SSD does this? I don't mind swapping out a tired SSD for a newer one once a while. I am pretty sure that SSDs life is calculated in years and not in few months? For me, the improved performance will pay for the SSD over and over. I am planning to use plenty of RAM as well.

    Read the article

  • When machine code is generated from a program how does it translates to hardware level operations ??

    - by user553492
    Like if say the instruction is something like 100010101 1010101 01010101 011101010101. Now how is this translating to an actual job of deleting something from memory? Memory consists of actual physical transistors the HOLD data. What causes them to lose that data is some external signal? I want to know how that signal is generated. Like how some binary numbers change the state of a physical transistor. Is there a level beyond machine code that isn't explicitly visible to a programmer? I have heard of microcode that handle code at hardware level, even below assembly language. But still I pretty much don't understand. Thanks!

    Read the article

  • How to write php code to input jsonstring and insert to sql server

    - by Romi
    i am trying to OUTPUT a Json String from the phone and to get it uploaded to the sql server i have. I Do not know how to get the output Json and write the php code... i tried many methods but couldnt find a solution. public void post(String string) { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost( "http://www.hopscriber.com/xoxoxox/testphp.php"); try { List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("myJson", string)); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); String str = inputStreamToString(response.getEntity().getContent()) .toString(); Log.w("SENCIDE", str); } catch (Exception e) { Toast.makeText(getBaseContext(), "notwork", Toast.LENGTH_LONG) .show(); } } private Object inputStreamToString(InputStream is) { // TODO Auto-generated method stub String line = ""; StringBuilder total = new StringBuilder(); // Wrap a BufferedReader around the InputStream BufferedReader rd = new BufferedReader(new InputStreamReader(is)); // Read response until the end try { while ((line = rd.readLine()) != null) { total.append(line); } } catch (IOException e) { e.printStackTrace(); } // Return full string return total; } it outputs a json string as [myJson=[{"name":"FriendTracker","user":"amjgp000000000000000","pack":"org.siislab.tutorial.friendtracker","perm":"org.siislab.tutorial.permission.READ_FRIENDS","level":"Normal"},{"name":"FriendTracker","user":"amjgp000000000000000","pack":"org.siislab.tutorial.friendtracker","perm":"org.siislab.tutorial.permission.WRITE_FRIENDS","level":"Normal"},{"name":"FriendTracker","user":"amjgp000000000000000","pack":"org.siislab.tutorial.friendtracker","perm":"org.siislab.tutorial.permission.FRIEND_SERVICE","level":"Normal"},{"name":"FriendTracker","user":"amjgp000000000000000","pack":"org.siislab.tutorial.friendtracker","perm":"org.siislab.tutorial.permission.FRIEND_NEAR","level":"Dangerous"},{"name":"FriendTracker","user":"amjgp000000000000000","pack":"org.siislab.tutorial.friendtracker","perm":"org.siislab.tutorial.permission.BROADCAST_FRIEND_NEAR","level":"Normal"},{"name":"FriendTracker","user":"amjgp000000000000000","pack":"org.siislab.tutorial.friendtracker","perm":"android.permission.RECEIVE_BOOT_COMPLETED","level":"Normal"},{"name":"FriendTracker","user":"amjgp000000000000000","pack":"org.siislab.tutorial.friendtracker","perm":"android.permission.READ_CONTACTS","level":"Dangerous"},{"name":"FriendTracker","user":"amjgp000000000000000","pack":"org.siislab.tutorial.friendtracker","perm":"android.permission.ACCESS_FINE_LOCATION","level":"Dangerous"},{"name":"FriendTracker","user":"amjgp000000000000000","pack":"org.siislab.tutorial.friendtracker","perm":"android.permission.WRITE_EXTERNAL_STORAGE","level":"Dangerous"},{"name":"FriendTracker","user":"amjgp000000000000000","pack":"org.siislab.tutorial.friendtracker","perm":"android.permission.READ_PHONE_STATE","level":"Dangerous"},{"name":"Tesing","user":"amjgp000000000000000","pack":"com.example.tesing","perm":"null","level":"null"},{"name":"Action Bar","user":"amjgp000000000000000","pack":"name.brucephillips.actionbarexample","perm":"null","level":"null"},.......

    Read the article

  • Load different levels in XML

    - by Anearion
    my question is more about a theoretical gener than a pratical way to make things happen. I'm about start developing a game for android, text based so i won't need sprites or animation, nor a game engine. Let's say is similar to a sudoku game, where each level is an harder version of sudoku and each level has some question to be asnwered over the sudoku itself. I was wondering if the better way is to have only one XML and then inside all the different levels, each one with his meta-tags, or if the different approach of making n xml files where each one is a level is preferred. At the moment a level should have those tags: <level> <question>Question_1</question> <hint1>what does it do?</hint1> <hint2>where...</hint2> .... <hintN>how...</hintN> </level> So each level could have some items to read and that's what made me think that maybe different files are better cuz if i have to load lvl 10 i can read only the 10.xml file. I hope my question isn't too stupind. Thanks in advance

    Read the article

  • Problem displaying tiles using tiled map loader with SFML

    - by user1905192
    I've been searching fruitlessly for what I did wrong for the past couple of days and I was wondering if anyone here could help me. My program loads my tile map, but then crashes with an assertion error. The program breaks at this line: spacing = atoi(tilesetElement-Attribute("spacing")); Here's my main game.cpp file. #include "stdafx.h" #include "Game.h" #include "Ball.h" #include "level.h" using namespace std; Game::Game() { gameState=NotStarted; ball.setPosition(500,500); level.LoadFromFile("meow.tmx"); } void Game::Start() { if (gameState==NotStarted) { window.create(sf::VideoMode(1024,768,320),"game"); view.reset(sf::FloatRect(0,0,1000,1000));//ball drawn at 500,500 level.SetDrawingBounds(sf::FloatRect(view.getCenter().x-view.getSize().x/2,view.getCenter().y-view.getSize().y/2,view.getSize().x, view.getSize().y)); window.setView(view); gameState=Playing; } while(gameState!=Exiting) { GameLoop(); } window.close(); } void Game::GameLoop() { sf::Event CurrentEvent; window.pollEvent(CurrentEvent); switch(gameState) { case Playing: { window.clear(sf::Color::White); window.setView(view); if (CurrentEvent.type==sf::Event::Closed) { gameState=Exiting; } if ( !ball.IsFalling() &&!ball.IsJumping() &&sf::Keyboard::isKeyPressed(sf::Keyboard::Space)) { ball.setJState(); } ball.Update(view); level.Draw(window); ball.Draw(window); window.display(); break; } } } And here's the file where the error happens: /********************************************************************* Quinn Schwab 16/08/2010 SFML Tiled Map Loader The zlib license has been used to make this software fully compatible with SFML. See http://www.sfml-dev.org/license.php This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. *********************************************************************/ #include "level.h" #include <iostream> #include "tinyxml.h" #include <fstream> int Object::GetPropertyInt(std::string name) { int i; i = atoi(properties[name].c_str()); return i; } float Object::GetPropertyFloat(std::string name) { float f; f = strtod(properties[name].c_str(), NULL); return f; } std::string Object::GetPropertyString(std::string name) { return properties[name]; } Level::Level() { //ctor } Level::~Level() { //dtor } using namespace std; bool Level::LoadFromFile(std::string filename) { TiXmlDocument levelFile(filename.c_str()); if (!levelFile.LoadFile()) { std::cout << "Loading level \"" << filename << "\" failed." << std::endl; return false; } //Map element. This is the root element for the whole file. TiXmlElement *map; map = levelFile.FirstChildElement("map"); //Set up misc map properties. width = atoi(map->Attribute("width")); height = atoi(map->Attribute("height")); tileWidth = atoi(map->Attribute("tilewidth")); tileHeight = atoi(map->Attribute("tileheight")); //Tileset stuff TiXmlElement *tilesetElement; tilesetElement = map->FirstChildElement("tileset"); firstTileID = atoi(tilesetElement->Attribute("firstgid")); spacing = atoi(tilesetElement->Attribute("spacing")); margin = atoi(tilesetElement->Attribute("margin")); //Tileset image TiXmlElement *image; image = tilesetElement->FirstChildElement("image"); std::string imagepath = image->Attribute("source"); if (!tilesetImage.loadFromFile(imagepath))//Load the tileset image { std::cout << "Failed to load tile sheet." << std::endl; return false; } tilesetImage.createMaskFromColor(sf::Color(255, 0, 255)); tilesetTexture.loadFromImage(tilesetImage); tilesetTexture.setSmooth(false); //Columns and rows (of tileset image) int columns = tilesetTexture.getSize().x / tileWidth; int rows = tilesetTexture.getSize().y / tileHeight; std::vector <sf::Rect<int> > subRects;//container of subrects (to divide the tilesheet image up) //tiles/subrects are counted from 0, left to right, top to bottom for (int y = 0; y < rows; y++) { for (int x = 0; x < columns; x++) { sf::Rect <int> rect; rect.top = y * tileHeight; rect.height = y * tileHeight + tileHeight; rect.left = x * tileWidth; rect.width = x * tileWidth + tileWidth; subRects.push_back(rect); } } //Layers TiXmlElement *layerElement; layerElement = map->FirstChildElement("layer"); while (layerElement) { Layer layer; if (layerElement->Attribute("opacity") != NULL)//check if opacity attribute exists { float opacity = strtod(layerElement->Attribute("opacity"), NULL);//convert the (string) opacity element to float layer.opacity = 255 * opacity; } else { layer.opacity = 255;//if the attribute doesnt exist, default to full opacity } //Tiles TiXmlElement *layerDataElement; layerDataElement = layerElement->FirstChildElement("data"); if (layerDataElement == NULL) { std::cout << "Bad map. No layer information found." << std::endl; } TiXmlElement *tileElement; tileElement = layerDataElement->FirstChildElement("tile"); if (tileElement == NULL) { std::cout << "Bad map. No tile information found." << std::endl; return false; } int x = 0; int y = 0; while (tileElement) { int tileGID = atoi(tileElement->Attribute("gid")); int subRectToUse = tileGID - firstTileID;//Work out the subrect ID to 'chop up' the tilesheet image. if (subRectToUse >= 0)//we only need to (and only can) create a sprite/tile if there is one to display { sf::Sprite sprite;//sprite for the tile sprite.setTexture(tilesetTexture); sprite.setTextureRect(subRects[subRectToUse]); sprite.setPosition(x * tileWidth, y * tileHeight); sprite.setColor(sf::Color(255, 255, 255, layer.opacity));//Set opacity of the tile. //add tile to layer layer.tiles.push_back(sprite); } tileElement = tileElement->NextSiblingElement("tile"); //increment x, y x++; if (x >= width)//if x has "hit" the end (right) of the map, reset it to the start (left) { x = 0; y++; if (y >= height) { y = 0; } } } layers.push_back(layer); layerElement = layerElement->NextSiblingElement("layer"); } //Objects TiXmlElement *objectGroupElement; if (map->FirstChildElement("objectgroup") != NULL)//Check that there is atleast one object layer { objectGroupElement = map->FirstChildElement("objectgroup"); while (objectGroupElement)//loop through object layers { TiXmlElement *objectElement; objectElement = objectGroupElement->FirstChildElement("object"); while (objectElement)//loop through objects { std::string objectType; if (objectElement->Attribute("type") != NULL) { objectType = objectElement->Attribute("type"); } std::string objectName; if (objectElement->Attribute("name") != NULL) { objectName = objectElement->Attribute("name"); } int x = atoi(objectElement->Attribute("x")); int y = atoi(objectElement->Attribute("y")); int width = atoi(objectElement->Attribute("width")); int height = atoi(objectElement->Attribute("height")); Object object; object.name = objectName; object.type = objectType; sf::Rect <int> objectRect; objectRect.top = y; objectRect.left = x; objectRect.height = y + height; objectRect.width = x + width; if (objectType == "solid") { solidObjects.push_back(objectRect); } object.rect = objectRect; TiXmlElement *properties; properties = objectElement->FirstChildElement("properties"); if (properties != NULL) { TiXmlElement *prop; prop = properties->FirstChildElement("property"); if (prop != NULL) { while(prop) { std::string propertyName = prop->Attribute("name"); std::string propertyValue = prop->Attribute("value"); object.properties[propertyName] = propertyValue; prop = prop->NextSiblingElement("property"); } } } objects.push_back(object); objectElement = objectElement->NextSiblingElement("object"); } objectGroupElement = objectGroupElement->NextSiblingElement("objectgroup"); } } else { std::cout << "No object layers found..." << std::endl; } return true; } Object Level::GetObject(std::string name) { for (int i = 0; i < objects.size(); i++) { if (objects[i].name == name) { return objects[i]; } } } void Level::SetDrawingBounds(sf::Rect<float> bounds) { drawingBounds = bounds; cout<<tileHeight; //Adjust the rect so that tiles are drawn just off screen, so you don't see them disappearing. drawingBounds.top -= tileHeight; drawingBounds.left -= tileWidth; drawingBounds.width += tileWidth; drawingBounds.height += tileHeight; } void Level::Draw(sf::RenderWindow &window) { for (int layer = 0; layer < layers.size(); layer++) { for (int tile = 0; tile < layers[layer].tiles.size(); tile++) { if (drawingBounds.contains(layers[layer].tiles[tile].getPosition().x, layers[layer].tiles[tile].getPosition().y)) { window.draw(layers[layer].tiles[tile]); } } } } I really hope that one of you can help me and I'm sorry if I've made any formatting issues. Thanks!

    Read the article

  • Query a Log4Net-database

    - by pinhack
    So if you use Log4Net to log into a database (i.e. using the AdoNetAppender), how can you conveniently get an overview of what has happend ? Well, you could try the following Query ( T-SQL ):   SELECT convert(varchar(10),LogDB.Date,121) as Datum, LogDB.Level, LogDB.Logger,COUNT(LogDB.Logger) as Counter From Log4Net.dbo.Log as LogDB  where Level <> 'DEBUG' AND convert(varchar(10),LogDB.Date,121) like '2010-03-25' GROUP BY convert(varchar(10),LogDB.Date,121),LogDB.Level,LogDB.Logger ORDER BY counter desc This query will give you the number of events by the Logger at a specified date - and it's easy to customize, just adjust the Date and the Level to your needs. You need a bit more information than that? How about this query:  Select  convert(varchar(10),LogDB.Date,121) as Datum,LogDB.Level,LogDB.Message,LogDB.Logger ,count(LogDB.Message) as counter From Log4Net.dbo.Log as LogDB where Level <> 'DEBUG' AND convert(varchar(10),LogDB.Date,121) like '2010-03-25' GROUP BY convert(varchar(10),LogDB.Date,121),LogDB.Level,LogDB.Message,LogDB.Logger ORDER BY counter desc Similar to the first one, but inclusive the Message - which will return a much larger resultset.

    Read the article

  • Alternatives to Pessimistic Locking in Cluster Applications

    - by amphibient
    I am researching alternatives to database-level pessimistic locking to achieve transaction isolation in a cluster of Java applications going against the same database. Synchronizing concurrent access in the application tier is clearly not a solution in the present configuration because the same database transaction can be invoked from multiple JVMs concurrently. Currently, we are subject to occasional race conditions which, due to the optimistic locking we have in place via Hibernate, cause a StaleObjectStateException exception and data loss. I have a moderately large transaction within the scope of my refactoring project. Let's describe it as updating one top-level table row and then making various related inserts and/or updates to several of its child entities. I would like to insure exclusive access to the top-level table row and all of the children to be affected but I would like to stay away from pessimistic locking at the database level for performance reasons mostly. We use Hibernate for ORM. Does it make sense to start a single (perhaps synchronous) message queue application into which this method could be moved to insure synchronized access as opposed to each cluster node using its own, which is a clear race condition hazard? I am mentioning this approach even though I am not confident in it because both the top-level table row and its children could also be updated from other system calls, not just the mentioned transaction. So I am seeking to design a solution where the top-level table row and its children will all somehow be pseudo-locked (exclusive transaction isolation) but at the application and not the database level. I am open to ideas and suggestions, I understand this is not a very cut and dried challenge.

    Read the article

< Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >