Daily Archives

Articles indexed Saturday September 8 2012

Page 10/15 | < Previous Page | 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Approach to retrieve files from server

    - by Aerus
    I'm in the process of making a Java application with a corresponding update application. At any given time the user may want to update the application and the updater will ask for a list of files of the latest release. Based on this list, the updater can determine which files need to be downloaded to complete the update. I now have 2 approaches to solve this, but i would like to know what approach will put the least stress on my application and server. I could send a list of files i want to download to my server and the server zips the files and simply returns this compressed file to the application. The updater sents a request for each seperate file to the server, which simply returns the file The application will be used mainly in Belgium and The Netherlands and connections/bandwidth tend to be pretty decent in here. The average size of a single file should be around 100Kb and at most 1Mb. I expect an update to have anywhere between 10 to 50 new files. I expect at most 100 persons/day to update the application, i.e. in the week when a new version is released. I hope this is enough information to sketch my problem and any advice is welcome. If there is another common way to tackle this, i'd be glad to hear it.

    Read the article

  • preview form using javascript in popup

    - by user1015309
    please I need some help in previewing a form in popup. I have a form, quite big, so I added the option of preview to show as popup. The lightbox form popup works well, but the problem I now have is function passform ()passing the inputs(textfield, select, checkbox, radio) into the popup page for preview on Click(). Below are my javascript and html codes. I left the css and some html out, because I think they're not needed. I will appreciate your help. Thank you The Javascript function gradient(id, level) { var box = document.getElementById(id); box.style.opacity = level; box.style.MozOpacity = level; box.style.KhtmlOpacity = level; box.style.filter = "alpha(opacity=" + level * 100 + ")"; box.style.display="block"; return; } function fadein(id) { var level = 0; while(level <= 1) { setTimeout( "gradient('" + id + "'," + level + ")", (level* 1000) + 10); level += 0.01; } } // Open the lightbox function openbox(formtitle, fadin) { var box = document.getElementById('box'); document.getElementById('shadowing').style.display='block'; var btitle = document.getElementById('boxtitle'); btitle.innerHTML = formtitle; if(fadin) { gradient("box", 0); fadein("box"); } else { box.style.display='block'; } } // Close the lightbox function closebox() { document.getElementById('box').style.display='none'; document.getElementById('shadowing').style.display='none'; } //pass form fields into variables var divexugsotherugsexams1 = document.getElementById('divexugsotherugsexams1'); var exugsotherugsexams1 = document.form4.exugsotherugsexams1.value; function passform() { divexugsotherugsexams1.innerHTML = document.form4.exugsotherugsexams1.value; } The HTML(with just one text field try): <p><input name="submit4" type="submit" class="button2" id="submit4" value="Preview Note" onClick="openbox('Preview Note', 1)"/> </p> <div id="shadowing"></div> <div id="box"> <span id="boxtitle"></span> <div id="divexugsotherugsexams1"></div> <script>document.write('<PARAM name="SRC" VALUE="'+exugsotherugsexams1+'">')</script> <a href="#" onClick="closebox()">Close</a> </div>

    Read the article

  • My events don't show up in the goal funnels or conversion funnels

    - by Amit Bens
    I have an event set up on a website and I'd like to track the effect this event has on conversion rate. The event seems to be working fine - I can see it on Top Events with all the labels, etc. But when going into Goal Flow and selecting 'Event Category' these events don't show up. I have this running for about a week. And I have made multiple checks to verify that I have events that triggered the conversion goal. Any clue about what I'm doing wrong?

    Read the article

  • Handling SEO for Infinite pages that cause external slow API calls

    - by Noam
    I have an 'infinite' amount of pages in my site which rely on an external API. Generating each page takes time (1 minute). Links in the site point to such pages, and when a users clicks them they are generated and he waits. Considering I cannot pre-create them all, I am trying to figure out the best SEO approach to handle these pages. Options: Create really simple pages for the web spiders and only real users will fetch the data and generate the page. A little bit 'afraid' google will see this as low quality content, which might also feel duplicated. Put them under a directory in my site (e.g. /non-generated/) and put a disallow in robots.txt. Problem here is I don't want users to have to deal with a different URL when wanting to share this page or make sense of it. Thought about maybe redirecting real users from this URL back to the regular hierarchy and that way 'fooling' google not to get to them. Again not sure he will like me for that. Letting him crawl these pages. Main problem is I can't control to rate of the API calls and also my site seems slower than it should from a spider's perspective (if he only crawled the generated pages, he'd think it's much faster). Which approach would you suggest?

    Read the article

  • Can I use a list of blog ping services for a portal?

    - by Ivanhoe123
    I'm setting up a list of ping services for a portal. It has a blog, forum, articles, restaurants, hotels and many other information, so it is far beyond a blog. I have a list of standard ping services for WP blogs - but I do not know if this should be literally only for blogs. My questions are: Is it recommended to ping blog services from a portal, such as http://blogsearch.google.com/ping/RPC2? Are there any penalties for sites that are not recognized as blogs? Is there some list of ping services for regular websites and not only blogs? Thanks!

    Read the article

  • Migrating from a wordpress.com to wordpress.org blog without harming SEO

    - by kikio
    I've had a Wordpress.com weblog for 3 years. And its pages have a good pagerank and are shown in first search results pages. Because of the limitations, I should migrate to my own WordPress. How to migrate safely with the minimum SEO problems? (I know how to export content in wordpress.com and import it to a new wordpress.org blog.) Note 1: links structure and site design are different on the new wordpress blog. (I don't like wordpress.com links structure :| ) Note 2: as you know, it's not possible to edit .htaccess file on wordpress.com. so I can't use 301 redirects.

    Read the article

  • C to C++ Conversion [closed]

    - by Annalyne
    Can someone convert this code to C++, pretty please? :( #include <stdio.h> #include <stdlib.h> #include <time.h> #define WEAPON_ROPE 10 #define WEAPON_REVOLVER 20 #define WEAPON_LEADPIPE 30 #define WEAPON_CANDLESTICK 40 #define WEAPON_KNIFE 50 #define WEAPON_WRENCH 60 #define PEOPLE_MRGREEN 100 #define PEOPLE_MSSCARLET 200 #define PEOPLE_CONLMUSTARD 300 #define PEOPLE_PROFPLUM 400 #define PEOPLE_MISPEACOCK 500 #define PEOPLE_MISWHITE 600 #define PLACE_KITCHEN 1 #define PLACE_HALL 2 #define PLACE_POOLROOM 3 #define PLACE_STUDY 4 #define PLACE_LOUNG 5 #define PLACE_LIBRARY 6 #define PLACE_CONSERVATORY 7 #define PLACE_DINING 8 #define PLACE_BILLIARDS 9 int main() { int die = 0; int players[6][9] = {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}; int allCards[] = {WEAPON_ROPE, WEAPON_REVOLVER, WEAPON_LEADPIPE, WEAPON_CANDLESTICK, WEAPON_CANDLESTICK, WEAPON_KNIFE, WEAPON_WRENCH, PEOPLE_MRGREEN, PEOPLE_MSSCARLET, PEOPLE_CONLMUSTARD, PEOPLE_CONLMUSTARD, PEOPLE_PROFPLUM, PEOPLE_MISPEACOCK, PEOPLE_MISWHITE, PLACE_KITCHEN, PLACE_HALL, PLACE_POOLROOM, PLACE_STUDY, PLACE_LOUNG, PLACE_LIBRARY, PLACE_CONSERVATORY, PLACE_DINING, PLACE_BILLIARDS}; int deckSize = 23; // number of cards in allCards array int count; for (count = 0; count < deckSize; ++count) { printf(", %d", allCards[count]); } // End for // These three array's are so you can put a card back, if need be... int weaponCards[] = {WEAPON_ROPE, WEAPON_REVOLVER, WEAPON_LEADPIPE, WEAPON_CANDLESTICK, WEAPON_CANDLESTICK, WEAPON_KNIFE, WEAPON_WRENCH}; int weaponDeckSize = 7; int peopleCards[] = {PEOPLE_MRGREEN, PEOPLE_MSSCARLET, PEOPLE_CONLMUSTARD, PEOPLE_CONLMUSTARD, PEOPLE_PROFPLUM, PEOPLE_MISPEACOCK, PEOPLE_MISWHITE}; int peopleDeckSize = 7; int placeCards[] = {PLACE_KITCHEN, PLACE_HALL, PLACE_POOLROOM, PLACE_STUDY, PLACE_LOUNG, PLACE_LIBRARY, PLACE_CONSERVATORY, PLACE_DINING, PLACE_BILLIARDS}; int placeDeckSize = 9; srand(clock()); // seed rand() using clock() which gives // the current tick your processor is at... int killer[3]; // no need to initialize yet. killer[0-2] will initialize int deckShuffle = rand() % weaponDeckSize; // picks one number out of the deck killer[0] = weaponCards[deckShuffle]; allCards[deckShuffle] = 0; // Card drawn. No longer exists in deck deckShuffle = rand() % peopleDeckSize; // picks another random card out of the deck killer[1] = peopleCards[deckShuffle]; allCards[deckShuffle + weaponDeckSize] = 0; // Card drawn. No longer exists in deck deckShuffle = rand() % placeDeckSize; // randomly picks the last card needed killer[2] = placeCards[deckShuffle]; allCards[deckShuffle + weaponDeckSize + peopleDeckSize] = 0; // Card drawn. No longer exists in deck int numberOfCards = 0; printf("CLUE\n"); printf("written by John Schintone\n"); printf("Origonal game delvoped by Hasbro\n"); int numberOfPlayers = 0; while ((numberOfPlayers < 3) || (numberOfPlayers > 6)) { printf("How many players are Going to play :\n"); printf("[number] > "); scanf("%d",&numberOfPlayers); // A very fast if statement which only uses integers/char's switch(numberOfPlayers) { case 6: { numberOfCards = 3; } break; case 5: { numberOfCards = 4; } break; case 4: { numberOfCards = 5; } break; case 3: { numberOfCards = 6; } break; default: { printf("You must enter a number between 3 and 6...\n"); } // End default } // End switch } // End while int index1, index2; // Note: ++index1; is faster than index1++; and will almost always // produce better code (index1++ happens after this statement line. // ++index1 increments index1 before this statement line) for (index1 = 0; index1 < numberOfPlayers; ++index1) { printf("Player %d", index1); for (index2 = 0; index2 < numberOfCards; ++index2) { // Remember that allCards[deckShuffle] == 0 because we removed that // card ages ago... works out well, just don't forget you did that : ) while (allCards[deckShuffle] == 0) { deckShuffle = rand() % deckSize; } // End while players[index1][index2] = allCards[deckShuffle]; allCards[deckShuffle] = 0; // Card removed for after loop... printf(", %d", players[index1][index2]); switch(players[index1][index2]) { case WEAPON_ROPE: { } break; // Add more... case PEOPLE_MRGREEN: { } break; // Add more... case PLACE_KITCHEN: { } break; // Add more... default: { printf("Program has caught player %d cheating...", index1); } // End default } // End switch } // End for printf("\n"); } // End for printf("The killer is %d, with the %d, and in the %d \n\n", killer[0], killer[1], killer[2]); printf("Type h for this help... \n"); printf("Type e to escape... \n"); printf("Type r to roll the die... \n"); char command = '\0'; // \0 represents zero, or the null character while (command != 'e') { printf("[one character] > "); scanf("%c", &command); if (command == 'r') { die = rand() % 6 + 1; printf("Your number is: %d \n", die); } // end while if (command == 'h') { printf("Type h for this help... \n"); printf("Type e to escape... \n"); printf("Type r to roll the die... \n"); } // End if printf("\n"); } // End while return(0); // Success. Program worked ok } // End main() Function

    Read the article

  • Correct way to use Farseer Physics in XNA

    - by user1640602
    I am using Farseer Physics for my 2D sidescroller game and I'm not sure how to proceed with it. I currently have a Sprite class (handles nothing but graphics), a GameObject class (contains specific object info like hit points), a World object which contains the list of Bodies, and a Level object which contains all of these objects. Originally I was trying to keep track of the Sprites, GameObjects, and Bodies separately because I felt that would provide loose coupling but it quickly became a headache. So my new idea was to add a Sprite member to the GameObject class but I'm still not sure how to maintain the Bodies because they have to communicate with GameObject. Specifically, my issue is this: The position of the Body is used to draw the Sprite inside of the Level. In order to do that I would have to maintain a link between GameObjects and Bodies. Is this correct or is there a better way to architect my game? If any of this is unclear please ask and I'll try to clarify. Thank you in advance for any help.

    Read the article

  • default xna 4.0 gametime don´t works well for 2D physics

    - by EusKoder
    I am developing a game using Visual Studio 2010 and XNA 4.0, after advancing to some extent with the project (a platform based 2d platformer msdn starter kit) I got to test it on different computers with different hardware (CPU, graphics, etc.) and I found that the speed of movement object of the game is quite different, I implemented the PSK physics msdn that are based on time, /// <summary> /// Updates the player's velocity and position based on input, gravity, etc. /// </summary> public void ApplyPhysics(GameTime gameTime) { float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds; Vector2 previousPosition = Position; // Base velocity is a combination of horizontal movement control and // acceleration downward due to gravity. velocity.X += movement * MoveAcceleration * elapsed; velocity.Y = MathHelper.Clamp(velocity.Y + GravityAcceleration * elapsed, -MaxFallSpeed, MaxFallSpeed); velocity.Y = DoJump(velocity.Y, gameTime); // Apply pseudo-drag horizontally. if (IsOnGround) velocity.X *= GroundDragFactor; else velocity.X *= GroundDragFactor; //velocity.X *= AirDragFactor; // Prevent the player from running faster than his top speed. velocity.X = MathHelper.Clamp(velocity.X, -MaxMoveSpeed, MaxMoveSpeed); // Apply velocity. Position += velocity *elapsed; Position = new Vector2((float)Math.Round(Position.X), (float)Math.Round(Position.Y)); // If the player is now colliding with the level, separate them. HandleCollisions(gameTime); // If the collision stopped us from moving, reset the velocity to zero. if (Position.X == previousPosition.X) velocity.X = 0; if (Position.Y == previousPosition.Y) { velocity.Y = 0; jumpTime = 0.0f; } } tested eg with a PC (PC1) 2.13GHz Intel Core 2 6400 / ATI Radeon HD 4670 and another one: (pc2) 3.00GHz Intel Pentium D / Intel 82945G Express Chipset Family by displacement difference (moving x axis at supossed (position = velocity * gametime.ElapsedGameTime.TotalSeconds) constant velocity, for example) is 3 seconds in a total of 20 (example: moving pc1 player sprite 6000 pixels in the x-axis at 20 seconds and pc 2 runs the same distance in 17 ). Tested on a 3rd PC: i72700k / Gigabyte GTX 560 TI the results are even worse, after some time after starting the game gets like 3 times slower and showing the number of pixels in each frame moved in a debug window in the game (counting updatespersecond with counter variable for updates cuantity and gametime for counting a second show 63fps), it appears as if the number is always constant ( refreshments lose the Update method?). In this pc if I put the game in fullscreen during the course of the game, the effect of "go slow" is immediate and restore window mode sometimes yield returns to "normal" and sometimes not. Eventually I began to try a new project to test whether the movement is constant in different pc loading only one sprite and its position value in screen printing. Occur The same. I even tried moving a constant amount of pixels explicitly (position + = 5) and different speeds in different pc quantities of pixels moved in x time. I have the game loop as the default (fixedTimeStep=true;SynchronizeWithVerticalRetrace=true;). I've also tried turning off and creating another timestep as discussed in different post (eg http://gafferongames.com/game-physics/fix-your-timestep/ but i can´t achieve the desired result, move the same number of pixels in X seconds on different computers with windows. All pc used for tests use windows 7 enterprise pc1 == x86 the others are x64. The weirdest thing is that I find information about people describing the same problem and that I wear long nights of searches. Thanks for your help.

    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

  • Rotate a vector by given degrees (errors when value over 90)

    - by Ivan
    I created a function to rotate a vector by a given number of degrees. It seems to work fine when given values in the range -90 to +90. Beyond this, the amount of rotation decreases, i.e., I think objects are rotating the same amount for 80 and 100 degrees. I think this diagram might be a clue to my problem, but I don't quite understand what it's showing. Must I use a different trig function depending on the radians value? The programming examples I've been able to find look similar to mine (not varying the trig functions). Vector2D.prototype.rotate = function(angleDegrees) { var radians = angleDegrees * (Math.PI / 180); var ca = Math.cos(radians); var sa = Math.sin(radians); var rx = this.x*ca - this.y*sa; var ry = this.x*sa + this.y*ca; this.x = rx; this.y = ry; };

    Read the article

  • Unity3D: default parameters in C# script

    - by Heisenbug
    Accordingly to this thread, it seems that default parameters aren't supported by C# script in Unity3D environment. Declaring an optional parameter in a C# scirpt makes Mono Ide complaint about it: void Foo(int first, int second = 10) // this line is marked as wrong inside Mono IDE Anyway if I ignore the error message of Mono and run the script in Unity, it works without notify any error inside Unity Console. Could anyone clarify a little bit this issue? Particularly: Are default parameters allowed inside C# scripts? If yes, are they supported by all platforms? Why Mono complains about them if the actually works?

    Read the article

  • What collision detection approach for top down car game?

    - by nathan
    I have a quite advanced top down car game and i use masks to detect collisions. I have the actual designed track (what the player see) with fancy graphics etc. and two other pictures i use as mask for my detection collisions. Each mask has only two colors, white and black and i check each frame if a pixel of the car collide with a black pixel of the masks. This approach works of course but it's not really flexible. Whenever i want to change the look of a track, i have to redraw the mask and it's a real pain. What is the general approach for this kind of game? How can i improve the flexibility of such a mask based approach?

    Read the article

  • Add values to an array after isset()

    - by user1656692
    I'm trying to add elements to an array after subsequent trials, but so far only one value is being added to the array. I've Googled and searched stackoverflow, and I seem to be getting only half the picture unless if I'm implementing it wrong. There are about 40 files, which will be needed to be submited one after another, and then a value from each trial is stored in the database. So far, this is what I've done. $_SESSION['task2'] = array(); //Submit Task 1 if (isset($_POST['submit_task_01'])) { $trial1_ac_sec = cleanInput($_POST['clockInputTask_01ac']); $trial1_est_sec = cleanInput($_POST['clockInputTask_01']); $trial1_ac = round(($trial1_ac_sec * 42.67), 2); $trial1_est = round(($trial1_est_sec * 42.67), 2); $trial1_judgErr = $trial1_ac - $trial1_est; $trial_1error = round($trial1_judgErr, 2); array_push($_SESSION['task2'],$trial_1error); header("location: Trial_2.php"); } //Submit Task2 if (isset($_POST['submit_task_02'])) { $trial2_ac_sec = cleanInput($_POST['clockInputTask_02ac']); $trial2_est_sec = cleanInput($_POST['clockInputTask_02']); $trial2_ac = round(($trial2_ac_sec * 42.67), 2); $trial2_est = round(($trial2_est_sec * 42.67), 2); $trial2_judgErr = $trial2_ac - $trial2_est; $trial_2error = round($trial2_judgErr, 2); array_push($_SESSION['task2'],$trial_2error); header("location: newEmptyPHPWebPage.php"); } ... and so on.. up until 40 I'm just wondering what am I doing wrong, I know that each time isset() will reload the page, and the previous data won't be available, so in that sense I thought I'd create an array for sessions and then push data in the session, however that doesn't seem to work. If anyone has any ideas on what I can do, I'll greatly appreciate it. Thank You.

    Read the article

  • Mysql query trouble: uploading

    - by Jakub Zak
    I'm trying for last hour solve this problem. I have a long form and I'm trying to upload info into mysql database. Into table I made. This is the mysql query I'm using: mysql_query("INSERT INTO `users_temp`(`first_name`, `surname`, `birthday`, `nationality`, `email`, `mobile`, `landline`, `address`, `town`, `post_code`, `country`, `password`, `code_conf`) VALUES ([$f_name],[$s_name],[$bday],[$nationality],[$email],[$mobile],[$landline],[$address],[$town],[$post_code],[$country],[$pass],[$conf_code])"); If anyone see any problem why it doesn't work pls let me know. Thank you...

    Read the article

  • Phonegap web view thinks device screen taller than it is - results in offscreen tabbar

    - by Stin
    I have a jQTouch application loaded via server, so all I need to do is display the webpage full screen in PhoneGap for a faux-Native app. Unfortunatley each solution I've tried in PhoneGap has an issue: it thinks the screen size is taller than it is. This resuls in the tabbar that is pinned to the bottom being permantly offscreen and there fore unusable. You should be able to recreate this with my code below and going to the iTabbar online demo. Any thoughts on how to correct this issue? For background, going to the app page in iOS safari works fine, as well as saving the page to the home screen. In both cases the webview stops at the bottom of the screen and the tabbar is therefore viewable. Also, I'm using build.phonegap.com to compile (I'm not compiling locally) I've tried two methods: load the childBrowser plugin and call up the page (with navbar hidden via options) set the following config.xml parameter to prevent phonegap from switching to Safari, and then just load the link (preferable as it's cleaner in my mind. I've pasted my index.html and config.xml below) Details on the config.xml paramater: Open all links in WebView stay-in-webview with values true or false example: <preference name="stay-in-webview" value="true" /> if set to true, all links (even with target set to blank) will open in the app's webview only use this preference if you want pages from your server to take over your entire app default is false (Source: https://build.phonegap.com/docs/config-xml) my index.html: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html;charset=utf-8"> <title>MyApp</title> <script src="phonegap.js"></script> </head> <body> <p><a href="http://www.itabbar.com/itabbar/demo.html#home">Launch iTabbar</a></p> </body> </html> my config.xml: <?xml version="1.0" encoding="UTF-8" ?> <widget xmlns = "http://www.w3.org/ns/widgets" xmlns:gap = "http://phonegap.com/ns/1.0" id = "com.phonegap.myapp" versionCode="10" version = "1.0.0"> <!-- versionCode is optional and Android only --> <name>MyApp</name> <description> My app is... </description> <author href="https://myurl.com" email="[email protected]"> me </author> <preference name="stay-in-webview" value="true" /> </widget>

    Read the article

  • Go — variadic parameter functions weirdness

    - by ivanzoid
    I'm trying to write simple fmt.Printf wrapper which takes variable number of arguments, here is the code: func Die(format string, args ...interface{}) { str := fmt.Sprintf(format, args) fmt.Fprintf(os.Stderr, "%v\n", str) os.Exit(1) } But when I'm calling it: Die("foo") I get: foo%!(EXTRA []interface {}=[]) Can't figure why I'm getting this text after the "foo" & what is the correct way to create wrappers around fmt.Fprintf?

    Read the article

  • CSS3: Top align of list item

    - by Irishgirl
    CSS3: Top align of list item. See image as below. How can I align a blue arrow to align on top of a senetence of each list. I'm using jQuery 1.7 and it is for iOS (iPhone). ul.lists{ padding:0 0 15px 0;} ul.lists li{ line-height:18px; border-bottom:1px #bfeaf0 solid; padding:6px 12px; background:url(../images/arrow_cyan.svg) no-repeat left; } /* no-repeat left top; */ I've tried to include a js as offset $("li:last").offset({ top: -15 }); but it did not work properly because I don't know how to move all blue arrows to align each list even the sentence might might run into more than one line.

    Read the article

  • iOS iPad Master Detail template can't interact with detail view

    - by CraigularB
    I have an iPad app generated from the Master-Detail template in XCode. The iPad Storyboard has under the Detail View Controller a View that holds a ScrollView which holds an ImageView. In the DetailViewController.m file I added the following code to allow the ScrollView to move and zoom the image: -(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView { return self.comicImage; } This works great on the iPhone (it's a universal app) but not the iPad; I can scroll and zoom the image on the iPhone no problem, but on the iPad it's like the ScrollView isn't responding to the touches, and I can't figure out how to pass the touches on to the ScrollView. I've already deactivated the popover controller from appearing with a right swipe like this: self.splitViewController.presentsWithGesture = NO; How do I make it so the user can interact with the ScrollView in the DetailViewController?

    Read the article

  • Using unset member variables within a class or struct

    - by Doug Kavendek
    It's pretty nice to catch some really obvious errors when using unset local variables or when accessing a class or struct's members directly prior to initializing them. In visual studio 2008 you get an "uninitialized local variable used" warning at compile-time and get a run-time check failure at the point of access when debugging. However, if you access an uninitialized struct's member variable through one of its functions, you don't get any warnings or assertions. Obviously the easiest solution is don't do that, but nobody's perfect. For example: struct Test { float GetMember() const { return member; } float member; }; Test test; float f1 = test.member; // Raises warning, asserts in VS debugger at runtime float f2 = test.GetMember(); // No problem, just keeps on going This surprised me, but it makes some sense -- the compiler can't assume calling a function on an unused struct is an error, or how else would you initialize or construct it? And anything fancier just quickly brings up so many other complications that it makes sense that it wouldn't bother classifying which functions are ok to call and when, especially just as a debugging help. I know I can set up my own assertions or error checking within the class itself, but that can complicate some simpler structs. Still, it would seem like within the context of the function call, wouldn't it know insides GetMember() that member wasn't initialized yet? I'm assuming it's not only relying on static compile-time deduction, given the Run-Time Check Failure #3 it raises during execution, so based on my current understanding of it it would seem reasonable for the same checks to apply. Is this just a limitation of this specific compiler/debugger (Visual Studio 2008), or more tied to how C++ works?

    Read the article

  • C++ SDL State Machine Segfault

    - by user1602079
    The code compiles and builds fine, but it immediately segfaults. I've looked at this for a while and have no idea why. Any help is appreciated. Thank you! Here's the code: main.cpp #include "SDL/SDL.h" #include "Globals.h" #include "Core.h" #include "GameStates.h" #include "Introduction.h" int main(int argc, char** args) { if(core.Initilize() == false) { SDL_Quit(); } while(core.desiredstate != core.Quit) { currentstate->EventHandling(); currentstate->Logic(); core.ChangeState(); currentstate->Render(); currentstate->Update(); } SDL_Quit(); } Core.h #ifndef CORE_H #define CORE_H #include "SDL/SDL.h" #include <string> class Core { public: SDL_Surface* Load(std::string filename); void ApplySurface(int X, int Y, SDL_Surface* source, SDL_Surface* destination); void SetState(int newstate); void ChangeState(); enum state { Intro, STATES_NULL, Quit }; int desiredstate, stateID; bool Initilize(); }; #endif Core.cpp #include "Core.h" #include "SDL/SDL.h" #include "Globals.h" #include "Introduction.h" #include <string> /* Initilizes SDL subsystems */ bool Core::Initilize() { //Inits subsystems, reutrns false upon error if(SDL_Init(SDL_INIT_EVERYTHING) == -1) { return false; } SDL_WM_SetCaption("Game", NULL); return true; } /* Loads surfaces and optimizes them */ SDL_Surface* Core::Load(std::string filename) { //The surface to be optimized SDL_Surface* original = SDL_LoadBMP(filename.c_str()); //The optimized surface SDL_Surface* optimized = NULL; //Optimizes the image if it loaded properly if(original != NULL) { optimized = SDL_DisplayFormat(original); SDL_FreeSurface(original); } else { //returns NULL upon error return NULL; } return optimized; } /* Blits surfaces */ void Core::ApplySurface(int X, int Y, SDL_Surface* source, SDL_Surface* destination) { //Stores the coordinates of the surface SDL_Rect offsets; offsets.x = X; offsets.y = Y; //Bits the surface if both surfaces are present if(source != NULL && destination != NULL) { SDL_BlitSurface(source, NULL, destination, &offsets); } } /* Sets desiredstate to newstate */ void Core::SetState(int newstate) { if(desiredstate != Quit) { desiredstate = newstate; } } /* Changes the game state */ void Core::ChangeState() { if(desiredstate != STATES_NULL && desiredstate != Quit) { delete currentstate; switch(desiredstate) { case Intro: currentstate = new Introduction(); break; } stateID = desiredstate; desiredstate = core.STATES_NULL; } } Globals.h #ifndef GLOBALS_H #define GLOBALS_H #include "SDL/SDL.h" #include "Core.h" #include "GameStates.h" extern SDL_Surface* screen; extern Core core; extern GameStates* currentstate; #endif Globals.cpp #include "Globals.h" #include "SDL/SDL.h" #include "GameStates.h" SDL_Surface* screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE); Core core; GameStates* currentstate = NULL; GameStates.h #ifndef GAMESTATES_H #define GAMESTATES_H class GameStates { public: virtual void EventHandling() = 0; virtual void Logic() = 0; virtual void Render() = 0; virtual void Update() = 0; }; #endif Introduction.h #ifndef INTRODUCTION_H #define INTRODUCTION_H #include "GameStates.h" #include "Globals.h" class Introduction : public GameStates { public: Introduction(); private: void EventHandling(); void Logic(); void Render(); void Update(); ~Introduction(); SDL_Surface* test; }; #endif Introduction.cpp #include "SDL/SDL.h" #include "Core.h" #include "Globals.h" #include "Introduction.h" /* Loads all the assets */ Introduction::Introduction() { test = core.Load("test.bmp"); } void Introduction::EventHandling() { SDL_Event event; while(SDL_PollEvent(&event)) { switch(event.type) { case SDL_QUIT: core.SetState(core.Quit); break; } } } void Introduction::Logic() { //to be coded } void Introduction::Render() { core.ApplySurface(30, 30, test, screen); } void Introduction::Update() { SDL_Flip(screen); } Introduction::~Introduction() { SDL_FreeSurface(test); } Sorry if the formatting is a bit off... Having to put four spaces for it to be put into a code block offset it a bit. I ran it through gdb and this is what I got: Program received signal SIGSEGV, Segmentation fault. 0x0000000000400e46 in main () Which isn't incredibly useful... Any help is appreciated. Thank you!

    Read the article

  • Wait 300ms and then slide down menu using jQuery

    - by Derfder
    I tried this js code: <script type="text/javascript"> $(document).ready( function() { var timer; $('.top-menu-first-ul li').hover(function(){ if(timer) { clearTimeout(timer); timer = null } timer = setTimeout(function() { $(this).find('ul').slideToggle(100); }, 500) }, // mouse out }); }); </script> with this html: <ul class="top-menu-first-ul"> <li> <a href="http://google.com">Google</a> <ul class="top-menu-second-ul"> <li><a href="http://translate.google.com">Google Translate</a></li> <li><a href="http://images.google.com">Google Images</a></li> <li><a href="http://gmail.google.com">Gmail</a></li> <li><a href="http://plus.google.com">Google Plus</a></li> </ul> </li> <li> <a href="http://facebook.com">Facebook</a> </li> <li> <a href="http://twitter.com">Twitter</a> </li> </ul> but it is not working. I would like to show the submenu when hovering over e.g. Google link and other will appear after 300ms. So, I need to prevent loading submenu when the user just quickly hover over it and not stay on hover link for at least 300ms. Then I need to stop executing code (or slide up) when he leaves the link. Because if he go over and back and over and back a copule of times he stop doing hovering anfd the code is still executing itself how many times he had hover over the link. I need somehow prevent this to happen. EDIT: I need to solve this without plugins like hoverIntent etc. if possible, just plain javascript and jQuery

    Read the article

  • C# How can I access to a dynamic created array of labels

    - by Markus Betz
    I created an array of labels on runtime. Now i have a problem to access these labels from other functions. Dynamic creation: private void Form1_Shown(object sender, EventArgs e) { Label[] Calendar_Weekday_Day = new Label[7]; for (int i = 0; i < 7; i++) { Calendar_Weekday_Day[i] = new Label(); Calendar_Weekday_Day[i].Location = new System.Drawing.Point(27 + (i * 137), 60); Calendar_Weekday_Day[i].Size = new System.Drawing.Size(132, 14); Calendar_Weekday_Day[i].Text = "Montag, 01.01.1970"; this.TabControl1.Controls.Add(Calendar_Weekday_Day[i]); } } And the function where I want to access to the dynamic created array of labels: private void display_weather_from_db(DateTime Weather_Startdate) { Calendar_Weekday_Day[0].Text = "Test1"; Calendar_Weekday_Day[1].Text = "Test2"; } Error shown: Error 1 The name 'Calendar_Weekday_Day' does not exist in the current context Form1.cs 1523 25 Test I tryed this, but didn't help :( public partial class Form1 : Form { private Label[] Calendar_Weekday_Day; } Someone an idea?

    Read the article

  • I am in search of a programming language with the below characteristics: [closed]

    - by f f
    I am in search of a programming language with the below characteristics: it has existing, large and supportive/helpful community it has consice syntax it's fast it can create standalone apps with no dependencies, totally portable and compatible with windows I can easily set event listeners of almost anything I can easily do automatically every action possible has as extensive as possible ready-to-use commands list works easily with winxp, win com, firefox, etc api for example, I want to detect that I have clicked a specific button in a webpage in firefox or in a third-party app in windows: I want to do this easily, not with writing 100 lines of code

    Read the article

  • Bind a ViewModel to a DropDownListFor with a third value besides dataValueField/dataTextField

    - by Elisa
    When I show a list of testplanViewModels in my View and the user selects one the SelectedTestplanId is returned to the Controller post action. What should also be returned is the TemplateId which belongs to the SelectedTestplanId. When the AutoMapper definition is run the Testplan.TestplanId is implicitly copied over to the TestplanViewModel.TestplanId. The same could be done by providing a TemplateId on the TestplanViewModel. When the user selects now a "TestplanViewModel" in the View, how can I attach the TemplateId to the controller action to access it there? The DropDownList does not allow 2 dataValueFields! CreateMap<Testplan, TestplanViewModel>().ForMember(dest => dest.Name, opt => opt.MapFrom(src => string.Format("{0}-{1}-{2}-{3}", src.Release.Name, src.Template.Name, src.CreatedAt, src.CreatedBy))); public ActionResult OpenTestplanViewModels() { IEnumerable<Testplan> testplans = _testplanDataProvider.GetTestplans(); var viewModel = new OpenTestplanViewModel { DisplayList = Mapper.Map<IEnumerable<Testplan>, IEnumerable<TestplanViewModel>>(testplans) }; return PartialView(viewModel); } public class TestplanViewModel { public int TestplanId { get; set; } public string Name { get; set; } } public class OpenTestplanViewModel { [Required(ErrorMessage = "No item selected.")] public int SelectedTestplanId { get; set; } public IEnumerable<TestplanViewModel> DisplayList { get; set; } } OpenTestplanViewModel @using (Html.BeginForm("Open", "Testplan")) { @Html.ValidationSummary(false) @Html.DropDownListFor(x => x.SelectedTestplanId, new SelectList(Model.DisplayList, "TestplanId", "Name"), new { @class = "listviewmodel" }) }

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15  | Next Page >