Daily Archives

Articles indexed Wednesday November 6 2013

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

  • Complex, yet simple crafting system model

    - by KatShot
    I'm working on some arcade shooter/slasher, and the main logline is "Kick'em with everything you want". There's not so many enemies in GDD, main focus is on tons of weapons and gadgets to cause mayhem. To get weapon, you need to craft it, and now crafting system looks simple, like: 1) You got three slots for weapon parts (like A, B, C) 2) You collect misc weapon parts, and when you got atleast one for every slot, you can craft a weapon (for example, if you got A1, B1, B2, B3 and C1, you can craft such models - A1B1C1, A1B2C1, A1B3C1) As for me, this crafting system is too simple, because weapon parts will just fall from the top of screen, often enough. That's why I'm thinking about adding some more crafting system levels, like resources (collect 10 scrap pieces to make part A1 or C3), etc. My question is: How can i add some more complex, still simple, transparent levels in crafting system? upd. For example, in Minecraft or Terraria, first 5-10 crafting recipies quite transparent and simple IMHO. But then it turns into huge mess to understand, how to craft this or that (for example, fishing rod)

    Read the article

  • Unknown error XNA cannot detect importer for "program.cs"

    - by Evan Kohilas
    I am not too sure what I have done to cause this, but even after undoing all my edits, this error still appears Error 1 Cannot autodetect which importer to use for "Program.cs". There are no importers which handle this file type. Specify the importer that handles this file type in your project. (filepath)\Advanced Pong\AdvancedPongContent\Program.cs Advanced Pong After receiving this error, everything between #if and #endif in the program.cs fades grey using System; namespace Advanced_Pong { #if WINDOWS || XBOX static class Program { /// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (Game1 game = new Game1()) { game.Run(); } } } #endif } I have searched this and could not find a solution anywhere. Any help is appreciated.

    Read the article

  • Fair dice over network w/o trusted 3rd party

    - by Kay
    Though it should be a pretty basic problem, I did not find a solution for it: How to play dice over a network without a trusted third party? The M players shall roll N dice, one player after another. No player may "cheat", i.e. change the outcome to his advantage, or "look into the future" before the next roll. Is that possible? I guess the solution would be something like public key crypto, where each player turns in an encrypted message. After all messages were collected you exchange the keys to decode the messages. Then the sha1(joined string of all decrypted messages) mod 6 + 1 is used to determine the die. The major problem I have: since the message [c/s]hould be anything, I don't know how to prevent tampering with the private keys. Esp. the last player to turn in his key could easily cheat (I guess). The game should even stay fair, if all players "conspire" against one player.

    Read the article

  • Object array updates one instance repeatedly [on hold]

    - by MGN001
    I'm making a 2D shooter, and the player object holds an array of bullets that represent how many shots the player can have on screen at once. At least, this is what I'm trying for. What's happening is that each time any of the objects in the array is called, it seems to update a single object in memory. So, if I fire and then fire again, the object "starts over" from where I shot from and moves twice as fast. I've spent weeks trying to fix this and I've managed nothing. Hopefully another pair of eyes will see something I've missed. Player.cpp #include "Player.h" const int startLives = 3; const int maxHealth = 2; const float speed = 1; const int maxVelocity = 500; const int topBound = WINDOW_HEIGHT / 5 * 3; const int slowRate = 500; const int accRate = 1000; const int maxBullets = 5; const float spriteWidth = 99; const float spriteHeight = 75; const Vector2f startPosition = { (WINDOW_WIDTH / 2) - (spriteWidth / 2), (WINDOW_HEIGHT / 4 * 3) - (spriteHeight / 2) }; Bullet bullets[maxBullets]; Bullet * bulletPointers[maxBullets]; SDL_Texture * playerHealthy; SDL_Texture * playerDamaged; SDL_Texture * currentSprite; SDL_Rect * rect; Vector2f position; Vector2f velocity; int Health; int Lives; Player::Player() { rect = new SDL_Rect(); } Player::~Player() { SDL_DestroyTexture(playerHealthy); SDL_DestroyTexture(playerDamaged); SDL_DestroyTexture(currentSprite); rect = NULL; } void Player::Initialize(SDL_Renderer * renderer) { SDL_Surface * temp; temp = IMG_Load(".\\Sprites\\player.png"); if (temp == NULL) { printf("Initialization Error: %s\n", IMG_GetError()); exit(PLAYER_INITIALIZATION_ERROR); } playerHealthy = SDL_CreateTextureFromSurface(renderer, temp); temp = IMG_Load(".\\Sprites\\playerDamaged.png"); if (temp == NULL) { printf("Initialization Error: %s\n", IMG_GetError()); exit(PLAYER_INITIALIZATION_ERROR); } playerDamaged = SDL_CreateTextureFromSurface(renderer, temp); temp = IMG_Load(".\\Sprites\\laserGreen.png"); if (temp == NULL) { printf("Initialization Error: %s\n", IMG_GetError()); exit(PLAYER_INITIALIZATION_ERROR); } SDL_Texture * bullet = SDL_CreateTextureFromSurface(renderer, temp); temp = IMG_Load(".\\Sprites\\laserGreenShot.png"); if (temp == NULL) { printf("Initialization Error: %s\n", IMG_GetError()); exit(PLAYER_INITIALIZATION_ERROR); } SDL_Texture * explosion = SDL_CreateTextureFromSurface(renderer, temp); for (int i = 0; i < maxBullets; i++) { bullets[i].Initialize(renderer, bullet, explosion); bulletPointers[i] = NULL; } temp = NULL; rect->h = spriteHeight; rect->w = spriteWidth; Reset(); } void Player::Update(Input input, float deltaTime) { if (abs(velocity.x) < slowRate * deltaTime) { velocity.x = 0; } else if (velocity.x > 0) { velocity.x -= slowRate * deltaTime; } else if (velocity.x < 0) { velocity.x += slowRate * deltaTime; } if (abs(velocity.y) < slowRate * deltaTime) { velocity.y = 0; } if (velocity.y > 0) { velocity.y -= slowRate * deltaTime; } else if (velocity.y < 0) { velocity.y += slowRate * deltaTime; } if (Health <= 0) { --Lives; Spawn(); } velocity.x += UnitVector(input.InputNew.movement).x * accRate * deltaTime; velocity.y += UnitVector(input.InputNew.movement).y * accRate * deltaTime; if (Magnitude(velocity) > maxVelocity) { velocity.x = UnitVector(velocity).x * maxVelocity; velocity.y = UnitVector(velocity).y * maxVelocity; } position.x += velocity.x * deltaTime * speed; position.y += velocity.y * deltaTime * speed; if (input.InputNew.JumpLeft && !input.InputOld.JumpLeft) { position.x -= spriteWidth; } if (input.InputNew.JumpRight && !input.InputOld.JumpRight) { position.x += spriteWidth; } Boundaries(); rect->x = position.x; rect->y = position.y; if (input.InputNew.Fire && !input.InputOld.Fire) { Fire(); } for (int i = 0; i < maxBullets; ++i) { if (bulletPointers[i] != NULL) { bullets[i].Update(deltaTime); if (bullets[i].getPosition().y < -33) { bulletPointers[i] = NULL; } } } } void Player::Draw(SDL_Renderer * renderer) { for (int i = 0; i < maxBullets; ++i) { if (bulletPointers[i] != NULL) { bullets[i].Draw(renderer); } } SDL_RenderCopy(renderer, currentSprite, NULL, rect); } void Player::Spawn() { position = startPosition; Health = maxHealth; currentSprite = playerHealthy; rect->x = position.x; rect->y = position.y; } void Player::Boundaries() { if (position.x < 0) { position.x = 0; velocity.x *= -1; } else if (position.x > WINDOW_WIDTH - spriteWidth) { position.x = WINDOW_WIDTH - spriteWidth; velocity.x *= -1; } if (position.y < topBound) { position.y = topBound; velocity.y *= -1; } else if (position.y > WINDOW_HEIGHT - spriteHeight) { position.y = WINDOW_HEIGHT - spriteHeight; velocity.y *= -1; } } int Player::getLives() { return Lives; } void Player::Reset() { Lives = startLives; Spawn(); } void Player::Fire() { for (int i = 0; i < maxBullets; ++i) { if (bulletPointers[i] == NULL) { bulletPointers[i] = &bullets[i]; bullets[i].Fire(position,velocity.x/2); break; } } } Bullet.cpp #include "Bullet.h" const int speed = 500; Vector2f bulletVelocity; float ExplosionMax = 0.5f; float ExplosionTimer; const Vector2f fireOffset = { 45.5f, 10.0f }; const Vector2f explosionOffset = { 23.5f, -27.0f }; const Vector2i bulletSize = { 9, 33 }; const Vector2i explosionSize = { 56, 54 }; Vector2f bulletPosition; SDL_Texture * bulletSprite; SDL_Texture * explosionSprite; SDL_Texture * bulletCurrentSprite; SDL_Rect * bulletRect; Bullet::Bullet() { } Bullet::~Bullet() { } void Bullet::Initialize(SDL_Renderer * renderer, SDL_Texture * bullet, SDL_Texture * explosion) { bulletSprite = bullet; explosionSprite = explosion; bulletRect = new SDL_Rect(); } void Bullet::Update(float deltaTime) { bulletPosition.y -= bulletVelocity.y * deltaTime; bulletPosition.x += bulletVelocity.x * deltaTime; bulletRect->x = static_cast<int>(bulletPosition.x); bulletRect->y = static_cast<int>(bulletPosition.y); } void Bullet::Draw(SDL_Renderer * renderer) { SDL_RenderCopy(renderer, bulletCurrentSprite, NULL, bulletRect); } void Bullet::Fire(Vector2f pos, float xSpeed) { bulletPosition.x = pos.x + fireOffset.x; bulletPosition.y = pos.y + fireOffset.y; bulletVelocity.x = xSpeed; bulletVelocity.y = speed; bulletCurrentSprite = bulletSprite; bulletRect->h = bulletSize.y; bulletRect->w = bulletSize.x; bulletRect->x = static_cast<int>(bulletPosition.x); bulletRect->y = static_cast<int>(bulletPosition.y); } Vector2f Bullet::getPosition() { return bulletPosition; } void Bullet::Hit() { bulletCurrentSprite = explosionSprite; bulletVelocity = { 0.0f, 0.0f }; ExplosionTimer = ExplosionMax; bulletPosition.x += explosionOffset.x; bulletPosition.y += explosionOffset.y; bulletRect->w = explosionSize.x; bulletRect->h = explosionSize.y; }

    Read the article

  • How to bind std::map to Lua with LuaBind

    - by MahanGM
    Is this possible in lua to achieve? player.scripts["movement"].properties["stat"] = "stand" print (player.scripts["movement"].properties["stat"]) I've done getter method in c++ with this approach: luabind::object FakeScript::getProp() { luabind::object obj = luabind::newtable(L); for(auto i = this->properties.begin(); i != this->properties.end(); i++) { obj[i->first] = i->second; } return obj; } But I'm stuck with setter. The first line in lua code which I'm trying to set value "stand" for key "stat" is not going to work and it keep redirecting me to the getter method. Setter method only works when I drop ["stat"] from properties. I can do something like this for setter in my script: player.scripts["movement"].properties = {stat = "stand"} But this isn't what I want because I have to go through my real keys in c++ to determine which key is placed in setter argument table value. This is my map in class: std::map<std::string, std::string> properties;

    Read the article

  • UIPickerView and empty core data array

    - by Mark
    I have a viewcontroller showing items from a core data entity. I also have a tableview listing records from the same entity. The table is editable, and the user could remove all the records. When this happens, the view controller holding the pickerview bombs because it's looking for records in an empty array. How to prevent this? I'm assuming I need to do something different at objectAtIndex:row... # pragma mark PickerView Section - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { return 1; // returns the number of columns to display. } - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { return [profiles count]; // returns the number of rows } - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { // Display the profiles we've fetched on the picker Profiles *prof = [profiles objectAtIndex:row]; return prof.profilename; } //If the user chooses from the pickerview - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { selectedProfile = [[profiles objectAtIndex:row]valueForKey:@"profilename"]; }

    Read the article

  • PHP Ajax not working

    - by Kostis
    I have 3 buttons on my page and depending on which one the user is clickingi want to run through ajax call a delete query in my database. When the user clicks on a button the javascript function seems to work but it doesn't run the query in php script. The html page: <?php session_start(); ?> <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-7"> <script> function myFunction(name) { var r=confirm("Are you sure? This action cannot be undone!"); if (r==true) { alert(name); // check if is getting in if statement and confirm the parameter's value var xmlhttp; if (str.length==0) { document.getElementById("clearMessage").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("clearMessage").innerHTML= responseText; } } xmlhttp.open("GET","clearDatabase.php?q="+name,true); xmlhttp.send(); } else alert('pff'); } </script> </head> <body> <div id="wrapper"> <div id="header"></div> <div id="main"> <?php if (session_is_registered("username")){ ?> <!--<a href="#">???a????s? pa?a??? µ???µ?t??</a><br /> <a href="#">???a????s? pa?a??? s??ed????</a><br /> <a href="#">???a????s? push notifications</a><br />--> <input type="button" value="???a????s? pa?a??? µ???µ?t??" onclick="myFunction('messages')" /> <input type="button" value="???a????s? pa?a??? s??ed????" onclick="myFunction('conferences')" /> <input type="button" value="???a????s? push notifications" onclick="myFunction('notifications')" /> <div id="clearMessage"></div> <?php } else echo "Login first."; ?> </div> <div id="footer"></div> </div> </body> </html> and the php script: <?php if (isset($_GET["q"])) $q=$_GET["q"]; $host = "localhost"; $database = "dbname"; $user = "dbuser"; $pass = "dbpass"; $con = mysql_connect($host,$user,$pass) or die(mysql_error()); mysql_select_db($database,$con) or die(mysql_error()); if ($q=="messages") $query = "DELETE FROM push_message WHERE time_sent IS NOT NULL"; else if ($q=="conferences") $query = "DELETE FROM push_message WHERE time_sent IS NOT NULL"; else if ($q=="notifications") { $query = "DELETE FROM push_friend WHERE time_sent IS NOT NULL"; } $res = mysql_query($query,$con) or die(mysql_error()); if ($res) echo "success"; else echo "failed"; mysql_close($con); ?>

    Read the article

  • Error when linking C executable to OpenCV

    - by Ghilas BELHADJ
    I'm compiling OpenCV under Ubuntu 13.10 using cMake. i've already compiled c++ programs and they works well. now i'm trying to compile a C file using this cMakeLists.txt cmake_minimum_required (VERSION 2.8) project (hello) find_package (OpenCV REQUIRED) add_executable (hello src/test.c) target_link_libraries (hello ${OpenCV_LIBS}) here is the test.c file: #include <stdio.h> #include <stdlib.h> #include <opencv/highgui.h> int main (int argc, char* argv[]) { IplImage* img = NULL; const char* window_title = "Hello, OpenCV!"; if (argc < 2) { fprintf (stderr, "usage: %s IMAGE\n", argv[0]); return EXIT_FAILURE; } img = cvLoadImage(argv[1], CV_LOAD_IMAGE_UNCHANGED); if (img == NULL) { fprintf (stderr, "couldn't open image file: %s\n", argv[1]); return EXIT_FAILURE; } cvNamedWindow (window_title, CV_WINDOW_AUTOSIZE); cvShowImage (window_title, img); cvWaitKey(0); cvDestroyAllWindows(); cvReleaseImage(&img); return EXIT_SUCCESS; } it returns me this error whene running cmake . then make to the project: Linking C executable hello /usr/bin/ld: CMakeFiles/hello.dir/src/test.c.o: undefined reference to symbol «lrint@@GLIBC_2.1» /lib/i386-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[2]: *** [hello] Erreur 1 make[1]: *** [CMakeFiles/hello.dir/all] Erreur 2 make: *** [all] Erreur 2

    Read the article

  • SFx Server Did Not Reply

    - by user2956426
    have the following problem : For a project I've tentatively created a Silverlight 5 web application and successfully integrated a WCF service. So far so good , in the Visual Studio 2012 environment everything works as intended. The data is processed. Now I wanted to see if it all works well on IIS 7.5 . When I called the test page and spoke to the WCF service Error 405 - Method not allowed occures. After searching I solved the problem with a module allocation for *.svc .                       So, then comes the error 405 although no longer , and the service also reports the status 200 - OK . Unfortunately, the application still does not work . Now this error is reported in Silverlight : The server doenst reply a meaningful response , which may be caused by a non- matching agreement , a premature session shutdown or an internal server error . No idea what I must adjust or change now. Have read on one of the few sites on the topic that is ClientConfig blame, as they would continue as a reference for the *.xap file is valid after publishing , and not used WebConfig ... But according to the error message above, it seems to be problem in the ServiceModel.dll ... Please , can anyone help me resolve this error? Thank you, Roland I uploaded my project. Maybe someone can solve the issues in there or can check my config-files. http://www.file-upload.net/download-8261762/CiFls.zip.html

    Read the article

  • Access multiple objects/arrays in JSON in jQuery $.each

    - by user2880254
    I am trying to build a simple page to view messages saved in a mysql db via JSON and jQuery. My JSON IS {"unread_msgs":[{"id":"6","title":"33333","user1":"19","timestamp":"1383747146","client_id":"Generic"},{"id":"5","title":"42142","user1":"19","timestamp":"1383740864","client_id":"Generic"}],"read_msgs":[{"id":"4","title":"test to addnrow","user1":"19","timestamp":"1383676647","client_id":"Generic"},{"id":"2","title":"kll","user1":"19","timestamp":"1383675548","client_id":"Generic"},{"id":"1","title":"jkjljklj","user1":"19","timestamp":"1382539982","client_id":"Generic"}],"urm_t":2,"rm_t":3} My JS <script type="text/javascript"> function GetClientMsgs () { $.post("assets/server/client_msgs.php",{ client_id:local_client_id } ,function(data) { var MsgData = $.parseJSON(data); console.log("Msg json data parsed"); $.each(MsgData, function(key, value) { console.log(value); $('#unread_row').append('<td><a href="#read_pm" onClick="ReadMsg('+value.unread_msgs.id+'); return false;">'+value.unread_msgs.title+'</a></td><td><a href="#profile">'+value.unread_msgs.studioname+'</a></td><td>'+value.unread_msgs.timestamp+'</td><td><a href="#delete_msg" onClick="DeleteMsg('value.unread_msgs.id+'); return false;">X</a></td>'); $('#read_row').append('<td><a href="#read_pm" onClick="ReadMsg('+value.read_msgs.id+'); return false;">'+value.read_msgs.title+'</a></td><td><a href="#profile">'+value.read_msgs.studioname+'</a></td><td>'+value.read_msgs.timestamp+'</td><td><a href="#delete_msg" onClick="DeleteMsg('+value.read_msgs.id+'); return false;">X</a></td>'); }); }); } </script> PHP $msgs = array('unread_msgs' => $dn1s, 'read_msgs' => $dn2s, 'urm_t' => $unread_msgs, 'rm_t' => $read_msgs); $json = json_encode($msgs); I am trying to post values returned such as unread_msgs.title or .id and am not able to access any of the objects. I have searched on here and could not find something specific to my structure. Thanks alot.

    Read the article

  • Google Anlytics event not firing

    - by yar1
    I am not getting and event data in GA. I installed Google Analytics Debugger Chrome extension and I see nothing happening (same goes when looking at Network panel in developer tools). I Googled it and read many (many) other answers and it looks like I'm doing things right. Page views, etc. are registering correctly... I have this code as the last thing before my closing tag: <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-MYREALCODE', 'mybna.net'); ga('send', 'pageview'); var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-MYREALCODE']); _gaq.push(['_trackPageview']); </script> My event handlers are done using jQuery, all inside an external js file, loaded before the closing tag. For example: $(function () { $('#show-less').click(function (e) { pbr.showHideMore(e); _gaq.push(['_trackEvent', 'ShowMore', 'Hide', 'top button']); }); }); Any ideas anyone?

    Read the article

  • How to get into android phone without having to press any buttons

    - by user2961092
    I'm not a programmer, so I'm not sure what I'd needed to answer my question. I'm wondering if it's possible to program a way to half wake your cell phone screen without having to press any buttons or using the sensors. Like I've found you can do on the blackberry z10, you have an option to wake the screen by swiping up from a locked screen. I love android and will use it regardless, but I had to use a z10 for work for a while and stumbled upon that feature. It would be fantastic to have that feature with Android as hitting a power button can get annoying. Thanks in advance

    Read the article

  • Make var_dump look pretty

    - by tPlummer
    I have a simple $_GET[] query var set for showing testing data when pulling down queries from the DB. <?php if($_GET['test']): ?> <div id="test" style="padding: 24px; background: #fff; text-align: center;"> <table> <tr style="font-weight: bold;"><td>MLS</td></tr> <tr><td><?php echo KEY; ?></td></tr> <tr style="font-weight: bold;"><td>QUERY</td></tr> <tr><td><?php echo $data_q; ?></td></tr> <tr style="font-weight: bold;"><td>DATA</td></tr> <tr><td><?php var_dump($data); ?></td></tr> </table> </div> <?php endif; ?> When I do var_dump, as expected it's this big array string that is all smushed together. Is there a way to add in line breaks at least for this or display the var_dump in a way that's more readable? I'm open to jQuery suggestions on manipulating the string after it's posted.

    Read the article

  • How to insert <li> element on <ul> using pure javascript

    - by Damiii
    I am having an issue with javascript and i don't know how to solve it ... Actually my code is working good with jsfiddle, but when i try to insert on my HTML page ,it simply doesnt work anymore ... What i want to, is to add the < li on < ul each time i tried to hit the button named "Add" ! HTML code: .... <td width="50%" valign="top"> <b> SUPER: </b> <ul id="ul"> </ul> </td> .... <input type="submit" value="Add" onclick="add()"/> .... JavaScript code: <script type="text/javascript"> function add(){ var ul = document.getElementById("ul"); var li = document.createElement("li"); li.innerHTML = "LoL"; ul.appendChild(li); } </script> The result with that code : it doesn't add anything on my HTML page when i try to hit the button... Thankfully,

    Read the article

  • Pass a datatable model to controller action in MVC

    - by user2906420
    Code: @model System.Data.DataTable <button type="submit" class="btn btn-primary" data-dismiss="modal" aria-hidden="true"> Download</button> [HttpPost] public void getCSV(DataTable dt) { MemoryStream stream = Export.GetCSV(dt); var filename = "ExampleCSV.csv"; var contenttype = "text/csv"; Response.Clear(); Response.ContentType = contenttype; Response.AddHeader("content-disposition", "attachment;filename=" + filename); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.BinaryWrite(stream.ToArray()); Response.End(); } I want to allow the user to export a CSV file when the button is clicked on. the datatable should be passed to the method getCSV. Please can someone help me. thanks I do not mind using Tempdata to store the datatable and then access it in the controller

    Read the article

  • Count if with two criteria excel vba

    - by Manasa J
    can some one help me create a macro for the following Data.The values in GradeA,GradeB etc.. columns need to be populated by checking sheet1 ColumnB(Student Name) and columnH(Grade).I need both row wise and Column wise total. Student GradeA GradeB GradeC GradeD GradeE GrandTotal Std1 1 0 2 0 0 3 Std2 0 0 0 1 1 2 Std3 1 0 1 0 0 2 Std4 0 2 0 3 0 5 Std5 0 1 2 1 0 4 Std6 1 0 2 0 2 5 Grnd 3 3 7 5 3 21

    Read the article

  • javascript timer fires up on the first key press

    - by pedrag
    I have a html page with a timer in it. I'm starting the timer with the keypress event, but i want it to execute only for the first key. I'm using a variable to catch the total keys in an other function which there were pressed and i have something like that: if(totaAttempts==1) start the timer, but with this solution the timer starts correctly, but is stomps when a key is pressed again. Any better ideas? Thanks in advance function setTime() { if (totalAttempts == 1) { ++totalSeconds; secondsLabel.innerHTML = pad(totalSeconds % 60); minutesLabel.innerHTML = pad(parseInt(totalSeconds / 60)); } } function pad(val) { var valString = val + ""; if (valString.length < 2) { return "0" + valString; } else { return valString; } }

    Read the article

  • How to combine template partial specialization and template argument deduction

    - by KKKoo0
    My understanding is that template argument deduction is only for function templates, but function templates does not allow partial specialization. Is there a way to achieve both? I basically want to achieve a function-like object (can be a functor) with the signature template<class InputIterator1, class InputIterator2, class OutputIterator, int distribution> void GetQuantity(InputIterator1 frist1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, double supply, double limit); Depending on the value of distribution, I want to have a couple of specializations of this template. And when I call this function,I basically do not want to specify all the type parameters, because they are many of them (and thus I need argument deduction)!

    Read the article

  • UIImagePickerController shows last picture taken instead of camera input

    - by jules
    I'm having a strange behaviour within my app. For taking pictures i'm using the following pretty standard code for displaying the UIImagePickerController: UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.allowsEditing = NO; picker.sourceType = UIImagePickerControllerSourceTypeCamera; [self presentViewController:picker animated:YES completion:nil]; It works perfectly fine the first time I tap the button which calls this action. The strange behaviour starts when I tap that button again. The UIImagePickerController starts again BUT it doesnt show the input from the camera anymore. It shows the last picture I've taken. More Details of this state: Tapping on the image shows the yellow square of the auto focus. (which it actually uses to focus the camera correctly) When I tap on the ImageCapture button - the correct image is taken and presented on the screen. If I take a picture and press 'Retake' the regular camera image is presented as input. More weirdness: It has nothing to do with the iPad I'm using. Creating a new example app which only has button which calls the code from above everything works perfectly fine. I assume it has something to do with the configuration of the app. Therefore I checked everything but could not find any differences which may cause this issue. Thanks in advance for any advice! Update: I do implement the UIImagePickerControllerDelegate in order to dismiss the UIImagePickerController.

    Read the article

  • XSLT Exclude Specific Tags

    - by MMKD
    I have a problem i am trying to resolve in an XSLT but i an unable to find a solution. The example below is related to a payment system it is adding items to a basket then removing them. The out XML provides a audit trail of actions conducted on a basket. Senario: Add Item (Id 1) Add Item (Id 1) With a price change Void Item (Id 1) Void Item (Id 1) With a price change Add Item (Id 1) Add Item (Id 1) Expected Outcome Remove: Add Item (Id 1) Add Item (Id 1) With a price change Output XML Contains Void Item (Id 1) Void Item (Id 1) With a price change Add Item (Id 1) Add Item (Id 1) Input XML: <xml> <product void="false"> <sequence_number>1</sequence_number> <item_id>11111111</item_id> <price>12</price> </product> <product void="false"> <sequence_number>2</sequence_number> <item_id>11111111</item_id> <price>12</price> <price_change> <price>10</price> </price_change> </product> <product void="true"> <sequence_number>3</sequence_number> <item_id>11111111</item_id> <price>12</price> <price_change> <price>10</price> </price_change> </product> <product void="true"> <sequence_number>4</sequence_number> <item_id>11111111</item_id> <price>12</price> </product> <product void="false"> <sequence_number>5</sequence_number> <item_id>11111111</item_id> <price>12</price> </product> <product void="false"> <sequence_number>6</sequence_number> <item_id>11111111</item_id> <price>12</price> </product> </xml> Expected outcome: <xml> <product void="true"> <sequence_number>3</sequence_number> <item_id>11111111</item_id> <price>12</price> <price_change> <price>10</price> </price_change> </product> <product void="true"> <sequence_number>4</sequence_number> <item_id>11111111</item_id> <price>12</price> </product> <product void="false"> <sequence_number>5</sequence_number> <item_id>11111111</item_id> <price>12</price> </product> <product void="false"> <sequence_number>6</sequence_number> <item_id>11111111</item_id> <price>12</price> </product> </xml> XSLT <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="//product[@void='false']"> <xsl:if test="item_id != //product[@void='true']/item_id"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:if> </xsl:template> </xsl:stylesheet> The problem with this is that it is deleting all products that are not voided and have the same id and not taking into account the number of void items vs the number of none void items. If you have 1 void item it should only delete one product that is not voided but has exactly the same tags as itself

    Read the article

  • load different div with different conten and not reload the page?

    - by Lars Holmqvist
    I have the following code to load different div with different content by clicking on a link. My question is how can I write so that not reload the page every time I click on a link. #content > div { display: none; } #content > div:target { display: block; } <a href="#div1">Div one</a> <a href="#div2">Div two</a> <a href="#div3">Div three</a> <a href="#div4">Div four</a> <div id="content"> <div id="div1">This is div one</div> <div id="div2">This is div two</div> <div id="div3">This is div three</div> <div id="div4">This is div four</div> </div>

    Read the article

  • Wrapbootstrap integration

    - by Shaun Frost Duke Jackson
    Good Afternoon All, I'm having trouble integrating this template into my rails application. I've changes all the images and loaded all the files into their relevant areas. However they still have the subdirectories. Does anyone know of a guide I can walk through which might explain how you do this, especially to include the revolution-slider which has a whole subdirectory of CSS and images. Template being used: https://wrapbootstrap.com/theme/pixma-responsive-multipurpose-template-WB0B348C6 Thanks for the help.

    Read the article

  • Having issue with OpenGL 1.0 for HP slate 7

    - by Roy Coder
    I have issue with HP slate when i am trying to draw Line in OpenGL Draw method. But working in other devices. In Hp Slate Green line not drawn properly as like in another device. My Code is: gl.glPushMatrix(); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glVertexPointer(2, GL10.GL_FLOAT, 0, vertexFloatBuffer); gl.glColorMask(true, true, true, true); gl.glDepthMask(true); gl.glLineWidth(8.0f); setColor(gl); gl.glDrawArrays(GL10.GL_LINES, 0, fPoints.length / 2); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glPopMatrix(); Suggest me at which place i am wrong or missing something? UpdateImage

    Read the article

  • Am I allowed to subclass UIWebView?

    - by Raja.Integrass
    I just want to clear this up once and for all, is it ok to subclass a UIWebView? Will I ever have to be nervous about apple rejecting the app because of a UIWebView subclass? The documentation states: Subclassing Notes The UIWebView class should not be subclassed. But at the same time Apple contradicts itself with this WWDC video: https://developer.apple.com/videos/wwdc/2011/?id=511#rich-text-editing-in-safari-on-ios In slide 41 they specifically talk about subclassing a UIWebView Thanks in advance!

    Read the article

  • Socket stops communicating

    - by user1392992
    I'm running python 2.7 code on a Raspberry Pi that receives serial data from an Arduino, processes it, and sends it to a Windows box over a wifi link. The Pi is wired to a Linksys router running in client bridge mode and that router connects over wifi to another Linksys router to which the Windows box is wired. The code in the Pi runs fine for some (apparently) random interval, and then the Pi becomes unreachable from the Windows box. I'm running PUTTY on the the Windows machine to connect to the Pi and when the fail occurs I get a message saying there's been a network error and the Pi is not reachable. Pinging the Pi from the Windows machine works fine until the error, at which time it produces "Reply from 192.168.0.129: Destination host unreachable." The client bridge router to which the Pi is connected remains reachable. I've got the networking code on the Pi wrapped in an exception handler, and when it fails it shows the following: Ethernet problem: Traceback (most recent call last): File "garage.py", line 108, in module s.connect((host, port)) File "/usr/lib/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) error: [Errno 113] No route to host None The relevant python code looks like: import socket import traceback host = '192.168.0.129' port = 31415 in the setup, and after serial data has been processed: try: bline = strline.encode('utf-8') s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, port)) s.send(bline) s.close() except: print "Ethernet problem: " print traceback.print_exc() Where strline contains the processed data. As I said, this runs fine for a few hours more or less before failing. Any ideas? EDIT: When PUTTY fails its error message is :Network Error: Software caused connection abort."

    Read the article

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