Daily Archives

Articles indexed Tuesday July 2 2013

Page 13/19 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • What are the steps for renewing a GoDaddy domain? [on hold]

    - by Omne
    I've read this help article on GoDaddy's website and I know must be super easy to do it. but I don't have a GoDaddy domain currently and I am trying to explain the process to a friend. I am looking for a more detailed answer than the one on GoDaddy's website, specially I would like to know how one could add or renew other services, such as DBP, while renewing the domain. Screenshots would be useful too!

    Read the article

  • Default Wordpress site on IIS

    - by Mike
    We have multiple wordpress installations on our IIS7 (Windows Server 2008) Server as follows: http://www.example.com/site_one http://www.example.com/site_two http://www.example.com/site_three These all work properly. However we would like to configure it so that when users visit the root domain (http://www.example.com/) or any page underneath, ie: http://www.example.com/ http://www.example.com/page1 http://www.example.com/page2 They would actually see the corresponding pages for site_two: http://www.example.com/site_two/ http://www.example.com/site_two/page1 http://www.example.com/site_two/page2 How could we achieve this?

    Read the article

  • Determining explosion radius damage - Circle to Rectangle 2D

    - by Paul Renton
    One of the Cocos2D games I am working on has circular explosion effects. These explosion effects need to deal a percentage of their set maximum damage to all game characters (represented by rectangular bounding boxes as the objects in question are tanks) within the explosion radius. So this boils down to circle to rectangle collision and how far away the circle's radius is from the closest rectangle edge. I took a stab at figuring this out last night, but I believe there may be a better way. In particular, I don't know the best way to determine what percentage of damage to apply based on the distance calculated. Note : All tank objects have an anchor point of (0,0) so position is according to bottom left corner of bounding box. Explosion point is the center point of the circular explosion. TankObject * tank = (TankObject*) gameSprite; float distanceFromExplosionCenter; // IMPORTANT :: All GameCharacter have an assumed (0,0) anchor if (explosionPoint.x < tank.position.x) { // Explosion to WEST of tank if (explosionPoint.y <= tank.position.y) { //Explosion SOUTHWEST distanceFromExplosionCenter = ccpDistance(explosionPoint, tank.position); } else if (explosionPoint.y >= (tank.position.y + tank.contentSize.height)) { // Explosion NORTHWEST distanceFromExplosionCenter = ccpDistance(explosionPoint, ccp(tank.position.x, tank.position.y + tank.contentSize.height)); } else { // Exp center's y is between bottom and top corner of rect distanceFromExplosionCenter = tank.position.x - explosionPoint.x; } // end if } else if (explosionPoint.x > (tank.position.x + tank.contentSize.width)) { // Explosion to EAST of tank if (explosionPoint.y <= tank.position.y) { //Explosion SOUTHEAST distanceFromExplosionCenter = ccpDistance(explosionPoint, ccp(tank.position.x + tank.contentSize.width, tank.position.y)); } else if (explosionPoint.y >= (tank.position.y + tank.contentSize.height)) { // Explosion NORTHEAST distanceFromExplosionCenter = ccpDistance(explosionPoint, ccp(tank.position.x + tank.contentSize.width, tank.position.y + tank.contentSize.height)); } else { // Exp center's y is between bottom and top corner of rect distanceFromExplosionCenter = explosionPoint.x - (tank.position.x + tank.contentSize.width); } // end if } else { // Tank is either north or south and is inbetween left and right corner of rect if (explosionPoint.y < tank.position.y) { // Explosion is South distanceFromExplosionCenter = tank.position.y - explosionPoint.y; } else { // Explosion is North distanceFromExplosionCenter = explosionPoint.y - (tank.position.y + tank.contentSize.height); } // end if } // end outer if if (distanceFromExplosionCenter < explosionRadius) { /* Collision :: Smaller distance larger the damage */ int damageToApply; if (self.directHit) { damageToApply = self.explosionMaxDamage + self.directHitBonusDamage; [tank takeDamageAndAdjustHealthBar:damageToApply]; CCLOG(@"Explsoion-> DIRECT HIT with total damage %d", damageToApply); } else { // TODO adjust this... turning out negative for some reason... damageToApply = (1 - (distanceFromExplosionCenter/explosionRadius) * explosionMaxDamage); [tank takeDamageAndAdjustHealthBar:damageToApply]; CCLOG(@"Explosion-> Non direct hit collision with tank"); CCLOG(@"Damage to apply is %d", damageToApply); } // end if } else { CCLOG(@"Explosion-> Explosion distance is larger than explosion radius"); } // end if } // end if Questions: 1) Can this circle to rect collision algorithm be done better? Do I have too many checks? 2) How to calculate the percentage based damage? My current method generates negative numbers occasionally and I don't understand why (Maybe I need more sleep!). But, in my if statement, I ask if distance < explosion radius. When control goes through, distance/radius must be < 1 right? So 1 - that intermediate calculation should not be negative. Appreciate any help/advice!

    Read the article

  • The best tile based level design [on hold]

    - by ReallyGoodPie
    My current method for tile based levels is to put everything in an array like the following: grass = g sky = s house = h ... """ ["SSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"], ["SSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"], ["HHHHHHHHHHHHHHSSSSSSSSSSSSSSSS"], ["GGGGGGGGGGGGGGGGGGGGGGGGGGGGGG"], """ I would then run a for loop to pass these on to a sprite class, bliting the images to the screen. This is what I'd generally do in pygame when I am creating levels for a tile based RPG's. However, as I've gone on, I have added allot more sprites and image and it is seriously becoming more and more confusing to work with this and allot of mistakes are being made. What is the best alternative or other methods for doing this?

    Read the article

  • Objective-C Moving UIView along a curved path

    - by PruitIgoe
    I'm not sure if I am approaching this the correct way. In my app, when a user touches the screen I capture the point and create an arc from a fixed point to that touch point. I then want to move a UIView along that arc. Here's my code: ViewController.m //method to "shoot" object - KIP_Projectile creates the arc, KIP_Character creates the object I want to move along the arc ... //get arc for trajectory KIP_Projectile* vThisProjectile = [[KIP_Projectile alloc] initWithFrame:CGRectMake(51.0, fatElvisCenterPoint-30.0, touchPoint.x, 60.0)]; vThisProjectile.backgroundColor = [UIColor clearColor]; [self.view addSubview:vThisProjectile]; ... KIP_Character* thisChar = [[KIP_Character alloc] initWithFrame:CGRectMake(51, objCenterPoint-5, imgThisChar.size.width, imgThisChar.size.height)]; thisChar.backgroundColor = [UIColor clearColor]; thisChar.charID = charID; thisChar.charType = 2; thisChar.strCharType = @"Projectile"; thisChar.imgMyImage = imgThisChar; thisChar.myArc = vThisProjectile; [thisChar buildImage]; [thisChar traceArc]; in KIP_Projectile I build the arc using this code: - (CGMutablePathRef) createArcPathFromBottomOfRect : (CGRect) rect : (CGFloat) arcHeight { CGRect arcRect = CGRectMake(rect.origin.x, rect.origin.y + rect.size.height - arcHeight, rect.size.width, arcHeight); CGFloat arcRadius = (arcRect.size.height/2) + (pow(arcRect.size.width, 2) / (8*arcRect.size.height)); CGPoint arcCenter = CGPointMake(arcRect.origin.x + arcRect.size.width/2, arcRect.origin.y + arcRadius); CGFloat angle = acos(arcRect.size.width / (2*arcRadius)); CGFloat startAngle = radians(180) + angle; CGFloat endAngle = radians(360) - angle; CGMutablePathRef path = CGPathCreateMutable(); CGPathAddArc(path, NULL, arcCenter.x, arcCenter.y, arcRadius, startAngle, endAngle, 0); return path; } - (void)drawRect:(CGRect)rect { CGContextRef currentContext = UIGraphicsGetCurrentContext(); _myArcPath = [self createArcPathFromBottomOfRect:self.bounds:30.0]; CGContextSetLineWidth(currentContext, 1); CGFloat red[4] = {1.0f, 0.0f, 0.0f, 1.0f}; CGContextSetStrokeColor(currentContext, red); CGContextAddPath(currentContext, _myArcPath); CGContextStrokePath(currentContext); } Works fine. The arc is displayed with a red stroke on the screen. In KIP_Character, which has been passed it's relevant arc, I am using this code but getting no results. - (void) traceArc { CGMutablePathRef myArc = _myArc.myArcPath; // Set up path movement CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; pathAnimation.calculationMode = kCAAnimationPaced; pathAnimation.fillMode = kCAFillModeForwards; pathAnimation.removedOnCompletion = NO; pathAnimation.path = myArc; CGPathRelease(myArc); [self.layer addAnimation:pathAnimation forKey:@"savingAnimation"]; } Any help here would be appreciated.

    Read the article

  • Is using multiple canvas objects a good practice?

    - by user1818924
    We're developing a jump and run game with HTML5 and JavaScript and have to build an own game framework for this. Here we have some difficulties and would like to ask you for some advice: We have a "Stage" object, which represents the root of our game and is a global div-wrapper. The stage can contain multiple "Scenes", which are also div-elements. We would implement a Scene for the playing task, for pause, etc. and switch between them. Each scene can therefore contain multiple "Layers", representing a canvas. These Layer contain "ObjectEntities", which represent images or other shapes like rectangles, etc. Each Objectentity has its own temporaryCanvas, to be able to draw images for one entity, whereas another contains a rectangle. We set an activeScene in our Stage, so when the game is played, just the active scene is drawn. Calling activeScene.draw(), calls all sublayers to draw, which draw their entities (calling drawImage(entity.canvas)). But is this some kind of good practice? Having multiple canvas to draw? Each game loop every layer-context is cleared and drawn again. E.g. we just have a still Background-Layer, … wouldn't it be more useful to draw this once and not to clear it every time and redraw it? Or should we use a global canvas for example in the Stage and just use this canvas to draw? But we thought this would be to expensive...

    Read the article

  • How do games like Halo 3 save in-game footage? [duplicate]

    - by CPP_Person
    This question already has an answer here: How to design a replay system 11 answers I was just wondering how games (such as Halo 3, like the title says) save in-game replay? Since it gives the ability to look around at almost every possible angle it can't be a simple recording. What is the logic behind this? Here is a good example of what Halo 3's footage looks like.

    Read the article

  • Mobile Multiplayer games and coping with high latency

    - by spaceOwl
    I'm currently researching regarding a design for an online (realtime) mobile multiplayer game. As such, i'm taking into consideration that latencies (lag) is going to be high (perhaps higher than PC/consoles). I'd like to know if there are ways to overcome this or minimize the issues of high latency? The model i'll be using is peer-to-peer (using Photon cloud to broadcast messages to all other players). How do i deal with a scenario where a message about a local object's state at time t will only get to other players at *t + HUGE_LAG* ?

    Read the article

  • How can I perform 2D side-scroller collision checks in a tile-based map?

    - by bill
    I am trying to create a game where you have a player that can move horizontally and jump. It's kind of like Mario but it isn't a side scroller. I'm using a 2D array to implement a tile map. My problem is that I don't understand how to check for collisions using this implementation. After spending about two weeks thinking about it, I've got two possible solutions, but both of them have some problems. Let's say that my map is defined by the following tiles: 0 = sky 1 = player 2 = ground The data for the map itself might look like: 00000 10002 22022 For solution 1, I'd move the player (the 1) a complete tile and update the map directly. This make the collision easy because you can check if the player is touching the ground simply by looking at the tile directly below the player: // x and y are the tile coordinates of the player. The tile origin is the upper-left. if (grid[x][y+1] == 2){ // The player is standing on top of a ground tile. } The problem with this approach is that the player moves in discrete tile steps, so the animation isn't smooth. For solution 2, I thought about moving the player via pixel coordinates and not updating the tile map. This will make the animation much smoother because I have a smaller movement unit per frame. However, this means I can't really accurately store the player in the tile map because sometimes he would logically be between two tiles. But the bigger problem here is that I think the only way to check for collision is to use Java's intersection method, which means the player would need to be at least a single pixel "into" the ground to register collision, and that won't look good. How can I solve this problem?

    Read the article

  • Driver error when using multiple shaders

    - by Jinxi
    I'm using 3 different shaders: a tessellation shader to use the tessellation feature of DirectX11 :) a regular shader to show how it would look without tessellation and a text shader to display debug-info such as FPS, model count etc. All of these shaders are initialized at the beginning. Using the keyboard, I can switch between the tessellation shader and regular shader to render the scene. Additionally, I also want to be able toggle the display of debug-info using the text shader. Since implementing the tessellation shader the text shader doesn't work anymore. When I activate the DebugText (rendered using the text-shader) my screens go black for a while, and Windows displays the following message: Display Driver stopped responding and has recovered This happens with either of the two shaders used to render the scene. Additionally: I can start the application using the regular shader to render the scene and then switch to the tessellation shader. If I try to switch back to the regular shader I get the same error as with the text shader. What am I doing wrong when switching between shaders? What am I doing wrong when displaying text at the same time? What file can I post to help you help me? :) thx P.S. I already checked if my keyinputs interrupt at the wrong time (during render or so..), but that seems to be ok Testing Procedure Regular Shader without text shader Add text shader to Regular Shader by keyinput (works now, I built the text shader back to only vertex and pixel shader) (somthing with the z buffer is stil wrong...) Remove text shader, then change shader to Tessellation Shader by key input Then if I add the Text Shader or switch back to the Regular Shader Switching/Render Shader Here the code snipet from the Renderer.cpp where I choose the Shader according to the boolean "m_useTessellationShader": if(m_useTessellationShader) { // Render the model using the tesselation shader ecResult = m_ShaderManager->renderTessellationShader(m_D3D->getDeviceContext(), meshes[lod_level]->getIndexCount(), worldMatrix, viewMatrix, projectionMatrix, textures, texturecount, m_Light->getDirection(), m_Light->getAmbientColor(), m_Light->getDiffuseColor(), (D3DXVECTOR3)m_Camera->getPosition(), TESSELLATION_AMOUNT); } else { // todo: loaded model depends on distance to camera // Render the model using the light shader. ecResult = m_ShaderManager->renderShader(m_D3D->getDeviceContext(), meshes[lod_level]->getIndexCount(), lod_level, textures, texturecount, m_Light->getDirection(), m_Light->getAmbientColor(), m_Light->getDiffuseColor(), worldMatrix, viewMatrix, projectionMatrix); } And here the code snipet from the Mesh.cpp where I choose the Typology according to the boolean "useTessellationShader": // RenderBuffers is called from the Render function. The purpose of this function is to set the vertex buffer and index buffer as active on the input assembler in the GPU. Once the GPU has an active vertex buffer it can then use the shader to render that buffer. void Mesh::renderBuffers(ID3D11DeviceContext* deviceContext, bool useTessellationShader) { unsigned int stride; unsigned int offset; // Set vertex buffer stride and offset. stride = sizeof(VertexType); offset = 0; // Set the vertex buffer to active in the input assembler so it can be rendered. deviceContext->IASetVertexBuffers(0, 1, &m_vertexBuffer, &stride, &offset); // Set the index buffer to active in the input assembler so it can be rendered. deviceContext->IASetIndexBuffer(m_indexBuffer, DXGI_FORMAT_R32_UINT, 0); // Check which Shader is used to set the appropriate Topology // Set the type of primitive that should be rendered from this vertex buffer, in this case triangles. if(useTessellationShader) { deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST); }else{ deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); } return; } RenderShader Could there be a problem using sometimes only vertex and pixel shader and after switching using vertex, hull, domain and pixel shader? Here a little overview of my architecture: TextClass: uses font.vs and font.ps deviceContext-VSSetShader(m_vertexShader, NULL, 0); deviceContext-PSSetShader(m_pixelShader, NULL, 0); deviceContext-PSSetSamplers(0, 1, &m_sampleState); RegularShader: uses vertex.vs and pixel.ps deviceContext-VSSetShader(m_vertexShader, NULL, 0); deviceContext-PSSetShader(m_pixelShader, NULL, 0); deviceContext-PSSetSamplers(0, 1, &m_sampleState); TessellationShader: uses tessellation.vs, tessellation.hs, tessellation.ds, tessellation.ps deviceContext-VSSetShader(m_vertexShader, NULL, 0); deviceContext-HSSetShader(m_hullShader, NULL, 0); deviceContext-DSSetShader(m_domainShader, NULL, 0); deviceContext-PSSetShader(m_pixelShader, NULL, 0); deviceContext-PSSetSamplers(0, 1, &m_sampleState); ClearState I'd like to switch between 2 shaders and it seems they have different context parameters, right? In clearstate methode it says it resets following params to NULL: I found following in my Direct3D Class: depth-stencil state - m_deviceContext-OMSetDepthStencilState rasterizer state - m_deviceContext-RSSetState(m_rasterState); blend state - m_device-CreateBlendState viewports - m_deviceContext-RSSetViewports(1, &viewport); I found following in every Shader Class: input/output resource slots - deviceContext-PSSetShaderResources shaders - deviceContext-VSSetShader to - deviceContext-PSSetShader input layouts - device-CreateInputLayout sampler state - device-CreateSamplerState These two I didn't understand, where can I find them? predications - ? scissor rectangles - ? Do I need to store them all localy so I can switch between them, because it doesn't feel right to reinitialize the Direct3d and the Shaders by every switch (key input)?!

    Read the article

  • Increasing speed of circle over time as linear with Box2d

    - by Whispered
    Assume that there is a circle and it can be moved by using keyboard arrows.Is required that increasing speed over time like increasing car speed. For example; max speed is 25 and time to reach max speed shall be 5 sec. Over 5 sec the speed will reach to max speed. Does Box2d handle that situation?. I tried setting linear valocity but it seems to make the circle have constant speed instead of increased speed over time. Thank You! Note: I'm using Box2DWeb Javascript port of Box2D.

    Read the article

  • Setting variable to value of form [drupal 6]

    - by N Schleder
    I have this form $form['title'] = array( '#type' => 'textfield', '#title' => t('Title of Notice'), '#description' => t('Use_underscores_as_spaces'), '#size' => 30, // '#required' => TRUE ); and I want whatever the user types in to be the value of $test I've tried $test = $form['title']; which gives me $test = array also I've tried $test = current($form['title']); which gives me $test = textfield $form['values']['title'] doesn't work dont know what else to try

    Read the article

  • Run another version of Python using virtualenv

    - by mazlor
    I apologize in advance if the question is dummy ,i use Python 3.2.3 on Windows xp ,now i need Python3.3.2 , but i can't remove Python 3.2.3 because i have many codes and packages need to be run by it. I installed virtualenv to run two versions of Python in two different environments , but after that i didn't know what to do to run a code using Python 3.3.2 , here what i did: C:\>virtualenv.exe env1 C:\>env1\Scripts\activate now i don't know what to do after a folder was created its name env1 , i downloaded Python 3.3.2 and installed it in the same folder (env1) , is that correct ? then i try the following: (env1) C:\>python3.3.2 I got the following : 'python3.3.2' is not recognized as an internal or external command, operable program or batch file. also i tried : (env1) C:\>python python33 I got the following: python: can't open file 'python33': [Errno 2] No such file or directory As i mentioned , i stuck at this point , any help will be very appreciated. Thanks

    Read the article

  • Provide local fallback for CSS from CDN

    - by BadHorsie
    I'm loading the Bootstrap CSS on my page from the CDN bootstrapcdn.com <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet"> How can I test if the stylesheet was loaded, and if not provide a local fallback? I do not want to wait for jQuery or other libraries to load before doing the test; I want all CSS to be loaded on the page first.

    Read the article

  • How to determine what the Seemingly Unrelated Regression error means in R

    - by user2154571
    I'm using the systemfit() function to conduct a seemingly unrelated regression and am getting the following error: Error in solve(sigma, tol = solvetol) : Lapack routine dsptrf returned error code 1 Yet, I'm unable to find the meaningful interpretation of what the error suggests is going on. Below is some simulated code that works to show what functions I'm using (the simulated code does not produce an error). Thanks for thoughts on this error. y <- sample(seq(1:4), 100, replace = TRUE) x1 <- sample(seq(0:1), 100, replace = TRUE) -1 x2 <- sample(seq(0:1), 100, replace = TRUE) - 1 x3 <- sample(seq(1:4), 100, replace = TRUE) frame <- as.data.frame(cbind(y,x1,x2, x3)) mod_1 <- y ~ x1 + x3 + x1:x3 mod_2 <- y ~ x2 + x3 + x2:x3 output <- systemfit(list(mod_1, mod_2), data = frame, method = "SUR")

    Read the article

  • Is it possible to split a form into multiple erb modules?

    - by Ya.
    I have a large form with multiple tabs and would like to be able to split it into multiple modules and include each as a partial. Something like: main.html.erb: <%= form_for (@myobject) do |f| %> <%= render "module1" %> .... module1.html.erb: <%= f.text_field :field1 %> ... Needless to say, when I do it like this I get an error from module1 that "f" is undefined. Is there a way to split form fields into multiple modules?

    Read the article

  • Calling HttpRequest::getRawRequestMessage() without send()

    - by danielgrad
    I am trying to call getRawRequestMessage() to get the raw HTTP content of the request described by a HttpRequest object, but I notice it always returns an empty string if I don't call send() first. Which kind of defeats my purpose (I want to send the data through other means than the HttpRequest's own send() method). Is there any other way to convert a HttpRequest object to it's raw string equivalent? To give more context: I'm working with a complex class that builds a HttpRequest object and sends requests through it and I want to add a new mode to the class that will work through raw sockets instead. The request is already built in the HttpRequest object and I would like to not have to parse the object manually to generate the HTTP message.

    Read the article

  • jQuery selector selecting all rows... why?

    - by Jagd
    I have a standard HTML table that looks something like this in structure: <table> <tbody> <tr> <td>FOOTER</td> <td> ... other td columns </td> </tr> <tr> <td>some other row that I don't want selected</td> <td> ... other td columns </td> </tr> </tbody> </table> What I would like to do is select only the tr's that contain the text FOOTER in a td, and then set the font-weight to bold for all td's under the selected tr's. My problem is that the jQuery selector I have is setting all td's within the table to bold and I'm not sure why. Here's my selector thus far: $("tr:contains('FOOTER')").children("td").css("font-weight", "bold");

    Read the article

  • Javascript function returning number with two decimals...?

    - by muzzledBYbrass
    I have a function to return points along a line and my return comes back with two decimal points...? For example, a return of my variable px will be something like -88.4029.032940598. vx is the x vector and mult is the distance of the line plus distance to calculate the point. Here is the operation that is returning these values: var mult = parseFloat(mag + theUnit); var px = coord_one.x_point + (vx * mult); console.log(px); Never have seen this before- I appreciate any and all help!

    Read the article

  • java.net.BindException How can I clear the sockets or what ever is causing it?

    - by user2266067
    I need some help with, I guess a simple networking related problem I'm having. It will also help me better understand how all this works by knowing what isn't being .close()'ed. I'm sure this is pretty simple, but for me its all very new. This is the client program. I can most likely append the server then, if I can figure this out. Thanks public class Server { public static void main(String[] args) { start(); } static int start = 0; public static void start() { try { ServerSocket serverSocket = new ServerSocket(4567); Socket socket = serverSocket.accept(); //1) Take and echo input (In this case a message) BufferedReader bf = new BufferedReader(new InputStreamReader(socket.getInputStream())); String message = bf.readLine(); System.out.println("Message recieved from Client:" + message); //2) Response of client message PrintWriter printWriter = new PrintWriter(socket.getOutputStream(), true); printWriter.println("Server echoing back the message ' " + message + " ' from Client"); } catch (IOException e) { System.out.println("e " + e); System.exit(-1); } start++; clearUp(); if (start < 5) { System.out.println("Closing binds and Restarting" + start); start(); } } public void clearUp(){ //How would I clear the stuff that is left bound so I can restart via start() and avoid the java.net.BindException: Address already in use: JVM_Bind ? } } How would I clear the stuff that is left bound so I can restart via start() and avoid java.net.BindException: Address already in use: JVM_Bind ?

    Read the article

  • How to resolve user registration and activation email error in Django registration?

    - by user2476295
    So I was just trying to setup a basic user authentication in Django and downloaded a django registration app with templates. Now when I run the server at 127.0.0.1:8000/accounts/register/ I get a basic registration page, I fill in the details and when I click submit I get this error "NoReverseMatch at /accounts/register/" Error during template rendering In template Users/sudhasinha/mysite/mysite/registration/templates/registration/activation_email.txt, error at line 4 'url' requires a non-empty first argument. The syntax changed in Django 1.5, see the docs. 1 {% load i18n %} 2 {% trans "Activate account at" %} {{ site.name }}: 3 4 http://{{ site.domain }}{**% url registration_activate activation_key %**} 5 6 {% blocktrans %}Link is valid for {{ expiration_days }} days.{% endblocktrans %} 7 This is what my activation_email.txt looks like: {% load i18n %} {% trans "Activate account at" %} {{ site.name }}: http://{{ site.domain }}{% url registration_activate activation_key %} {% blocktrans %}Link is valid for {{ expiration_days }} days.{% endblocktrans %} And this is what my registration_form.html looks like: {% extends "base.html" %} {% load i18n %} {% block content %} <form method="post" action="."> {{ form.as_p }} <input type="submit" value="{% trans 'Submit' %}" /> </form> {% endblock %} I have very minimal experience with Django and would appreciate some help to resolve this error. My urls seem to be setup correctly but I will post it if needed. Also pardon my horrible formatting

    Read the article

  • Validating Time & Date To Be At Least A Certain Amount Of Time In The Future

    - by MJH
    I've built a reservation form for a taxi company which works fine, but I'm having an issue with users making reservations that are due too soon in the future. Since the entire form is kind of long, I first want to make sure the user is not trying to make a reservation for less than an hour ahead of time, without them having to fill out the whole form. This is what I have come up with so far, but it's just not working: <?php //Set local time zone. date_default_timezone_set('America/New_York'); //Get current date and time. $current_time = date('Y-m-d H:i:s'); //Set reservation time variable $res_datetime = $_POST['res_datetime']; //Set event time. $event_time = strtotime($res_datetime); ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Check Date and Time</title> </head> <?php //Check to be sure reservation time is at least one hour in the future. if (($current_time - $event_time) <= (3600)) { echo "You must make a reservation at least one hour ahead of time."; } ?> <form name="datetime" action="" method="post"> <input name="res_datetime" type="datetime-local" id="res_datetime"> <input type="submit"> </form> <body> </body> </html> How can I create a validation check to make sure the date and time of the reservation is at least one hour ahead of time?

    Read the article

  • How can I structure my MustacheJS template to add dynamic classes based on the values from a JSON file?

    - by JGallardo
    OBJECTIVE To build an app that allows the user to search for locations. CURRENT STATE At the moment the locations listed are few, so they are just all presented when landing on the "dealers" page. BACKGROUND Previously there were only about 50 showrooms carrying a product we sell, so a static HTML page was fine. And displays as But the page size grew to about 1500 lines of code after doing this. We have gotten more and need a scalable solution so that we can add many more dealers fast. In other projects, I have previously used MustacheJS and to load in values from a JSON file. I know the ideally this will be an AJAX application. Perhaps I might be better off with database here? Below is what I have in mind so far, and it "works" up to a certain point, but seems not to be anywhere near the most sustainable solution that can be efficiently scaled. HTML <a id="{{state}}"></a> <div> <h4>{{dealer}} : {{city}}, {{state}} {{l_type}}</h4> <div class="{{icon_class}}"> <ul> <li><i class="icon-map-marker"></i></li> <li><i class="icon-phone"></i></li> <li><i class="icon-print"></i></li> </ul> </div> <div class="listingInfo"> <p>{{street}} <br>{{suite}}<br> {{city}}, {{state}} {{zip}}<br> Phone: {{phone}}<br> {{toll_free}}<br> {{fax}} </p> </div> </div> <hr> JSON { "dealers" : [ { "dealer":"Benco Dental", "City":"Denver", "state":"CO", "zip":"80112", "l_type":"Showroom", "icon_class":"listingIcons_3la", "phone":"(303) 790-1421", "toll_free":null, "fax":"(303) 790-1421" }, { "dealer":"Burkhardt Dental Supply", "City":"Portland", "state":"OR", "zip":"97220", "l_type":"Showroom", "icon_class":"listingIcons", "phone":" (503) 252-9777", "toll_free":"(800) 367-3030", "fax":"(866) 408-3488" } ]} CHALLENGES The CSS class wrapping the ul will vary based on how many fields there are. In this case there are 3, so the class is "listingIcons_3la" The "toll free" number section should only show up if in fact, there is a toll free number. the fax number should only show up if there is a value for a fax number.

    Read the article

  • Maps with a nested vector

    - by wawiti
    For some reason the compiler won't let me retrieve the vector of integers from the map that I've created, I want to be able to overwrite this vector with a new vector. The error the compiler gives me is ridiculous. Thanks for your help!! The compiler didn't like this part of my code: line_num = miss_words[word_1]; Error: [Wawiti@localhost Lab2]$ g++ -g -Wall *.cpp -o lab2 main.cpp: In function ‘int main(int, char**)’: main.cpp:156:49: error: no match for ‘operator=’ in ‘miss_words.std::map<_Key, _Tp, _Compare, _Alloc>::operator[]<std::basic_string<char>, std::vector<int>, std::less<std::basic_string<char> >, std::allocator<std::pair<const std::basic_string<char>, std::vector<int> > > >((*(const key_type*)(& word_1))) = line_num.std::vector<_Tp, _Alloc>::push_back<int, std::allocator<int> >((*(const value_type*)(& line)))’ main.cpp:156:49: note: candidate is: In file included from /usr/lib/gcc/x86_64-redhat->linux/4.7.2/../../../../include/c++/4.7.2vector:70:0, from header.h:19, from main.cpp:15: /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/vector.tcc:161:5: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>] /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/vector.tcc:161:5: note: no known conversion for argument 1 from ‘void’ to ‘const std::vector<int>&’ CODE: map<string, vector<int> > miss_words; // Creates a map for misspelled words string word_1; // String for word; string sentence; // To store each line; vector<int> line_num; // To store line numbers ifstream file; // Opens file to be spell checked file.open(argv[2]); int line = 1; while(getline(file, sentence)) // Reads in file sentence by sentence { sentence=remove_punct(sentence); // Removes punctuation from sentence stringstream pars_sentence; // Creates stringstream pars_sentence << sentence; // Places sentence in a stringstream while(pars_sentence >> word_1) // Picks apart sentence word by word { if(dictionary.find(word_1)==dictionary.end()) { line_num = miss_words[word_1]; //Compiler doesn't like this miss_words[word_1] = line_num.push_back(line); } } line++; // Increments line marker }

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19  | Next Page >