Search Results

Search found 28584 results on 1144 pages for 'google map v3'.

Page 159/1144 | < Previous Page | 155 156 157 158 159 160 161 162 163 164 165 166  | Next Page >

  • Is it possible to apply a Theme to Google Chrome when it's in "Application Mode"?

    - by lewen7er9
    I've applied the "brushed" theme (https://tools.google.com/chrome/intl/en/themes/theme%5Fbrushed.html) to my main google chrome browser windows without any problem. However none of the "application mode" shortcuts I created pick up this theme. For example, running chrome as follows does not pick up the "brushed" theme: chrome.exe --app=gmail.com I want to be able to apply themes to google chrome in application mode.

    Read the article

  • How do I activate my gizmo5 phone number in Google Voice? [closed]

    - by Sorin Sbarnea
    I wasn't able to activate my gizmo5 number because Google Voice activation(verification) requires you to enter two dial tones (DTMF) and they did not work at least not with these two variants: Using gizmo5 PC client using fring from Iphone as gizmo5 SIP client Redirecting gizmo5 to a US mobile number None of the above methods worked for me. Any ideas? More info: http://www.google.com/support/forum/p/voice/thread?tid=1d8c1d99721e3509&hl=en http://googlevoices.blogspot.com/2009/04/forwarding-sip-calls-to-google-voice.html

    Read the article

  • How to modify Chrome newtab.css from within a Chrome theme?

    - by user143423
    I want to modify the CSS for new tab page. NOT make new tab page. I already made a new tab page, but many users installing my themes won't also install the new tab page extension. So I want to modify the CSS on the new tab page for those who ONLY want my theme. It is my understanding that chrome://theme/css/newtab.css is the stylesheet I need to change. Feel free to tell other ways to add CSS to the ORIGINAL new tab page in Chrome.

    Read the article

  • Gmail - Ways to have more than 20 items per page in the search results

    - by Andrei
    Gmail has the notorious limitation of 20 results per page when searching your mail. Is there an extension (Chrome - preferable, Firefox, etc.) that can fix this (i.e. allow more than 20 items per page)? Based on my experience this should be entirely doable (have the extension move across pages in the background and then collect the results). Is there an extension that can already do this? I'm asking because I couldn't find one.

    Read the article

  • How to make Chrome open bookmarks and URLs in new tabs?

    - by MBraedley
    I principally use Firefox both at home and at work, but on occasion I use Chrome. I have Firefox working the way I like it by having it open bookmarks in a new tab when left clicked, as well, URLs open in new tabs. Although having URLs open in a new tab can be annoying if I type a bad URL, I still prefer it, but that's neither here nor there. I would like to replicate this behaviour in Chrome, and can't seem to find anything relavent in the settings. Is there any way of doing this without an extension? If not, can you point me towards an appropriate extension (I've already done a search and can't find what I'm looking for)?

    Read the article

  • Installing Chrome OS on HP Pavilion

    - by Lenny K
    Trying to install Chrome OS on HP Pavillion tx1000. I changed the BIOS to boot from USB before hard drive, and created a bootable USB drive (SanDisk Cruzer 4GB). No matter how many ways I try to make the USB drive, the laptop hangs on the startup screen, and trying to open the Boot Order Options freezes on "Fixed disk 0: ...". On the other hand, without the USB plugged in, the computer continues, and displays "Initialized Mouse", and then onto the Boot Order Options. If you let it boot normally from the beginning, it starts up fine into Windows Vista. I am using Hexxeh's Chrome OS build. Here are the different methods I've tried for making the Bootable USB Drive: Hexxeh's Image Creator (for Mac) Making the USB device bootable (using these directions). I wrote the image using Win32DiskImager. Writing the image using Win32DiskImager (without making it bootable).

    Read the article

  • If I let Google handle my emails for my domain, my Wordpress site won't send out emails anymore

    - by Fulvio
    Since I decided to let Google handle all my emails for my domain, while the domain is hosted on a 3rd party server, emails send out by a Wordpress installation no longer work. My supposition is that since all email is being routed to Google, my specific account on that server for that domain is unable to send out emails. I definitely wish to keep using google services for handling my emails since it comes with all the advantages connected to a Google account. However I need my Wordpress installation to send out administrative emails. I run my server with CPanel. How to configure that specific account and/or Wordpress to keep it able to send out emails? I don't need people to answer these emails sent out from server (eventually I might set a reply-to-address perhaps) thanks

    Read the article

  • How to make Chrome open bookmarks and URLs in new tabs?

    - by MBraedley
    I principally use Firefox both at home and at work, but on occasion I use Chrome. I have Firefox working the way I like it by having it open bookmarks in a new tab when left clicked, as well, URLs open in new tabs. Although having URLs open in a new tab can be annoying if I type a bad URL, I still prefer it, but that's neither here nor there. I would like to replicate this behaviour in Chrome, and can't seem to find anything relavent in the settings. Is there any way of doing this without an extension? If not, can you point me towards an appropriate extension (I've already done a search and can't find what I'm looking for)?

    Read the article

  • How can I disable chrome extensions (when Chrome is unresponsive)?

    - by John
    I'm having a problem where Chrome won't ever fully start (cursor just spins indefinitely and can't use the any menus or buttons in Chrome). I think it is due to an extension I installed but since the browser is unresponsive, I can't do anything through Chrome itself. Is there a flag to disable all extensions for Chrome or a config file I can manually edit to disable extensions so I can figure out what exactly is causing it? I'd prefer to not have to blow it away and reinstall as I might just install the offending extension again (assuming that is what is causing the issue).

    Read the article

  • Is it possible with Google searches to ban any and all results from a domain? [closed]

    - by Stu Thompson
    Is it possible to configure Google somehow to permanently ban search results from domains that I know 100% are never, ever going to make me happy? Something cookie/session based maybe? E.g. I want to ban (permanently, forever and always) results from experts-exchange.com. Every time I click results that take me to their page I just want to scream. Update! Google has released a Chrome Extension to allow users to block individual site from Google search results! Personal Blocklist (by Google). (Since this question has been closed, I cannot answer it.)

    Read the article

  • .bat file - Nagios v3.2 service check and start if stopped

    - by LbakerIT
    I'm just barely getting into programming so I do apologize for my ignorance. I'm trying to create a .bat file that will check if a service is running on XP Pro. If service is running it will exit 0. If the service is stopped start service wait 10 seconds (via ping i'm guessing) check if service is running if service is running exit 0 if service is stopped start service wait 10 seconds Do this check a total of 3 times. if service does not come up within that time: exit 2 Exit 0 = ok exit 1 = warning exit 3 = critical (and this will alert) I need to do this for 3 different services but i'm expecting that it would be better to create one per service. That way you get notified on the specific service that is not coming back up. The goal is that if the service stops it will start it. If after 30 seconds it is unable to start the service then it will send an alert. The reason I'm trying to do it with a .bat is this is consistent with all other scripts and I did not want to complicate it further by adding different kinds of code. Yay for consistency! Again I do apologize for my ignorance I've been thrown into this project last minute. Thank you for the help and reading my question!

    Read the article

  • How to implement a birds eye view of 2D Grid Map using Android

    - by IM_Adan
    I'm a true beginner with using the android platform and I'm having difficulties on implementing a 2D grid system for a tower defense type game. Where I can place towers on a specific tile and enemies will be able to traverse through tiles etc. What I would like is a practical explanation of how I could tackle this. A step by step guide for dummies. This is what I believe are the necessary steps to take, I think I might be wrong but I hope someone could help me out. Calculate the Width and Height of the view I'm working with. Based on that, determine the number of tiles required and their dimensions, (Still not sure how I would do this) Create each tile as a Rectangle object and draw these rectangle on a canvas I would really be grateful if someone could steer me in the right direction on how to implement a 2D Grid Map using android. I hope the answer to this questions helps the TRUE beginners out there like me. I have looked at the following links below yet I still feel that I don't trully understand what's going on. For XNA: 2D Grid based game - how should I draw grid lines? How to Create a Grid for a 2D Game? Also a quick note: All my previous game development has been in Java, mostly using Java SE and Swing. I also have good understanding of the game development process, it is only android thats confusing me :S

    Read the article

  • Thematic map contd.

    - by jsharma
    The previous post (creating a thematic map) described the use of an advanced style (color ranged-bucket style). The bucket style definition object has an attribute ('classification') which specifies the data classification scheme to use. It's values can be one of {'equal', 'quantile', 'logarithmic', 'custom'}. We use logarithmic in the previous example. Here we'll describe how to use a custom algorithm for classification. Specifically the Jenks Natural Breaks algorithm. We'll use the Javascript implementation in geostats.js The sample code above needs a few changes which are listed below. Include the geostats.js file after or before including oraclemapsv2.js <script src="geostats.js"></script> Modify the bucket style definition to use custom classification Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}    bucketStyleDef = {       numClasses : colorSeries[colorName].classes,       classification: 'custom', //'logarithmic',  // use a logarithmic scale       algorithm: jenksFromGeostats,       styles: theStyles,       gradient:  useGradient? 'linear' : 'off'     }; The function, which implements the custom classification scheme, is specified as the algorithm attribute value. It must accept two input parameters, an array of OM.feature and the name of the feature attribute (e.g. TOTPOP) to use in the classification, and must return an array of buckets (i.e. an array of or OM.style.Bucket  or OM.style.RangedBucket in this case). However the algorithm also needs to know the number of classes (i.e. the number of buckets to create). So we use a global to pass that info in. (Note: This bug/oversight will be fixed and the custom algorithm will be passed 3 parameters: the features array, attribute name, and number of classes). So createBucketColorStyle() has the following changes Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} var numClasses ; function createBucketColorStyle( colorName, colorSeries, rangeName, useGradient) {    var theBucketStyle;    var bucketStyleDef;    var theStyles = [];    //var numClasses ; numClasses = colorSeries[colorName].classes; ... and the function jenksFromGeostats is defined as Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} function jenksFromGeostats(featureArray, columnName) {    var items = [] ; // array of attribute values to be classified    $.each(featureArray, function(i, feature) {         items.push(parseFloat(feature.getAttributeValue(columnName)));    });    // create the geostats object    var theSeries = new geostats(items);    // call getJenks which returns an array of bounds    var theClasses = theSeries.getJenks(numClasses);    if(theClasses)    {     theClasses[theClasses.length-1]=parseFloat(theClasses[theClasses.length-1])+1;    }    else    {     alert(' empty result from getJenks');    }    var theBuckets = [], aBucket=null ;    for(var k=0; k<numClasses; k++)    {             aBucket = new OM.style.RangedBucket(             {low:parseFloat(theClasses[k]),               high:parseFloat(theClasses[k+1])             });             theBuckets.push(aBucket);     }     return theBuckets; } A screenshot of the resulting map with 5 classes is shown below. It is also possible to simply create the buckets and supply them when defining the Bucket style instead of specifying the function (algorithm). In that case the bucket style definition object would be    bucketStyleDef = {      numClasses : colorSeries[colorName].classes,      classification: 'custom',        buckets: theBuckets, //since we are supplying all the buckets      styles: theStyles,      gradient:  useGradient? 'linear' : 'off'    };

    Read the article

  • Sampling Heightmap Edges for Normal map

    - by pl12
    I use a Sobel filter to generate normal maps from procedural height maps. The heightmaps are 258x258 pixels. I scale my texture coordinates like so: texCoord = (texCoord * (256/258)) + (1/258) Yet even with this I am left with the following problem: As you can see the edges of the normal map still proves to be problematic. Putting the texture wrap mode to "clamp" also proved no help. EDIT: The Sobel Filter function by sampling the 8 surrounding pixels around a given pixel so that a derivative can be calculated in order to find the "normal" of the given pixel. The texture coordinates are instanced once per quad (for the quadtree that makes up the world) and are created as follows (it is quite possible that the problem results from the way I scale and offset the texCoords as seen above): Java: for(int i = 0; i<vertices.length; i++){ Vector2f coord = new Vector2f((vertices[i].x)/(worldSize), (vertices[i].z)/( worldSize)); texCoords[i] = coord; } the quad used for input here rests on the X0Z plane. 'worldSize' is the diameter of the planet. No negative texCoords are seen as the quad used for input for this method is not centered around the origin. Is there something I am missing here? Thanks.

    Read the article

  • Calculate travel time on road map with semaphores

    - by Ivansek
    I have a road map with intersections. At intersections there are semaphores. For each semaphore I generate a red light time and green light time which are represented with syntax [R:T1, G:T2], for example: 119 185 250 A ------- B: [R:6, G:4] ------ C: [R:5, G:5] ------ D I want to calculate a car travel time from A - D. Now I do this with this pseudo code: function get_travel_time(semaphores_configuration) { time = 0; for( i=1; i<path.length;i++) { prev_node = path[i-1]; next_node = path[i]); cost = cost_between(prev_node, next_node) time += (cost/movement_speed) // movement_speed = 50px per second light_times = get_light_times(path[i], semaphore_configurations) lights_cycle = get_lights_cycle(light_times) // Eg: [R,R,R,G,G,G,G], where [R:3, G:4] lights_sum = light_times.green_time+light_times.red_light; // Lights cycle time light = lights_cycle[cost%lights_sum]; if( light == "R" ) { time += light_times.red_light; } } return time; } So for distance 119 between A and B travel time is, 119/50 = 2.38s ( exactly mesaured time is between 2.5s and 2.6s), then we add time if we came at a red light when at B. If we came at a red light is calculated with lines: lights_cycle = get_lights_cycle(light_times) // Eg: [R,R,R,G,G,G,G], where [R:3, G:4] lights_sum = light_times.green_time+light_times.red_light light = lights_cycle[cost%lights_sum]; if( light == "R" ) { time += light_times.red_light; } This pseudo code doesn't calculate exactly the same times as they are mesaured, but the calculations are very close to them. Any idea how I would calculate this?

    Read the article

  • jquery ondrag map load only what has not been viewed

    - by David
    When a person mouse down, moves the mouse, and mouses up the system gets the different in the mouse down coord and the mouse up coords and loads in the new map items. However, the problem is it loads them every time so I want a way to track what has been loaded without too much work on checking or storing checks. Most promising. Came up with while typing this. Section the screen into 250x250 sectors and check if that sector has been loaded. Keep track of each corner of the screen and see if there is an area of those that have not loaded. Keep a record of the corners of the screen. When mouse up coords are greater then load the different. Problem is if they are at coord 10,000 then it will load from -10k to 10k positive and that is a lot of items to load. Check every item on the page to see if it is loaded. If I do this I might as well reload the whole page. If anyone has some suggestions; feel free to pass them on.

    Read the article

  • Approaches for a clickable map of nations (such as a Risk game) with Spritekit

    - by Vukovitch
    I would like to create a political map where each country is clickable by tapping but I'm not sure the best way to determine which nation was selected. Imagine Risk where each country can be individually clicked to bring up additional information. My current approach is to make a sprite for each nation where every image is the size of the screen The images are mostly transparent except for the country, that way when all of the images are displayed the countries are in the correct place relative to one another. To determine if a click occurs on an individual country I look to see if the tapped location is a non transparent pixel and check that the sprite's name is one of the countries. Additionally the nation needs to glow or something when tapped as an indicator, however my current solution is yet another sprite that is displayed. This seems like a terrible approach and I was wondering what other solutions might achieve the same results. I'm pretty new to SpriteKit so I'm not entirely sure. The other idea I had was creating a single texture where each country is a different shade of gray, then when I get the tap location I do a lookup on the color at that location and get the corresponding country. However, I'm not sure how to create a hilight or glowing country effect with that method.

    Read the article

  • Selecting objects on a 2D map

    - by Dave
    I have a object selection function by checking the mouse click and getting the relevant object. How ever there is a rare situation where if one object is partially behind the other then both objects are in the given area so im wondering how I can make the game know which one was selected, as currently my method does not know. This is my function that works it out: function getobj(e){ mx = e.pageX - curleft; //mouse click x my = e.pageY - curtop; //mouse click y function searchSprites(sprites, x, y) { var matches = [], i = 0, data = null; for (i = 0; i < spritea.length; ++i) { data = spritea[i].data; if (x > data[0] && y > data[1] && x < data[2] && y < data[3]) { var imageData = ctx2.getImageData(x, y, 1, 1); if(imageData.data[3] !== 0){ return [spritea[i].id]; i = spritea.length; } } } } res = searchSprites(spritea, mx, my); bid = res[0]; if(bid === '1'){ alert('You selected the skyscraper in front!'); }else if(bid === '3'){ alert('You selected the skyscraper behind!'); } } Image of the map: It keeps telling me I clicked the skyscraper behind which is not necessarily what the user is trying to do. How can I improve the accuracy of this ?

    Read the article

  • How to join a Windows Domain an Map NEtwork Drives on Ubuntu Partition

    - by AgainstClint
    I just installed the current build for Ubuntu on a partition for my work computer. I am a novice when it comes to Linux/Ubuntu, which is why I installed it along side windows. I want to learn how to operate and use Ubuntu much more than I do now, so I figured installing it and trying to do day to day functions here would be a "Thrown into the pool with sharks" way to do it, and I like that way. I did however have a few questions: We are on a Domain in Windows, is there any way to join that domain using the Ubuntu partition? We Also have 16 mapped network drives. I don't actually need ALL of them mapped for Ubuntu, but is there a way to Map at least one of them to see/use here in Ubuntu. Outlook Corporate email, how can I sign in/use it while...well, you get the idea. As I said earlier, I am VERY new to Ubuntu, i've only played around with it a bit at home and never at the office. If you could simplify it down for me a bit, that would be great.

    Read the article

  • Map rendering Libgdx Java

    - by user3165683
    Ok, so I am trying to create a 2D non-movable random tiled map. This is what I have so far: private void generateTile(){ System.out.print("tiletry1"); while(loadedTiles != 8100){ System.out.print("tiletry"); Texture currentTile = null; int tileX = 0; int tileY = 0; if (tileX == 120); tileY = 16; tileX = 0; game.batch.begin(); switch(MathUtils.random(2)){ case 0: //game.batch.draw(tile1, tileX, tileY); System.out.print("tile1"); currentTile = tile1; break; case 1: //game.batch.draw(tile2, tileX, tileY); System.out.print("tile2"); currentTile = tile2; break; case 2: //game.batch.draw(tile3, tileX, tileY); System.out.print("tile3"); currentTile = tile3; break; } tileX+=16; loadedTiles ++; game.batch.draw(currentTile, tileX, tileY); game.batch.end(); } } However, I can't see any of the tiles and the screen just looks green. This method is above my render method which I have: camera.update(); batch.setProjectionMatrix(camera.combined); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); game.batch.begin(); //other render stuff Why am I not able to see the tiles?

    Read the article

  • Help with selecting objects on a map

    - by Dave
    I have a object selection function by checking the mouse click and getting the relevant object. How ever there is a rare situation where if one object is partially behind the other then both objects are in the given area so im wondering how i can make the game know which one was selected, as currently my method does not know. This is my function that works it out: function getobj(e){ mx = e.pageX - curleft; //mouse click x my = e.pageY - curtop; //mouse click y function searchSprites(sprites, x, y) { var matches = [], i = 0, data = null; for (i = 0; i < spritea.length; ++i) { data = spritea[i].data; if (x > data[0] && y > data[1] && x < data[2] && y < data[3]) { var imageData = ctx2.getImageData(x, y, 1, 1); if(imageData.data[3] !== 0){ return [spritea[i].id]; i = spritea.length; } } } } res = searchSprites(spritea, mx, my); bid = res[0]; if(bid === '1'){ alert('You selected the skyscraper in front!'); }else if(bid === '3'){ alert('You selected the skyscraper behind!'); } } Image of the map: http://i.imgur.com/qcKij.jpg It keeps telling me i clicked the skyscraper behind which is not necessarily what the user is trying to do... how can i improve the accuracy of this ?

    Read the article

  • Google App Engine - Secure Cookies

    - by tponthieux
    I'd been searching for a way to do cookie based authentication/sessions in Google App Engine because I don't like the idea of memcache based sessions, and I also don't like the idea of forcing users to create google accounts just to use a website. I stumbled across someone's posting that mentioned some signed cookie functions from the Tornado framework and it looks like what I need. What I have in mind is storing a user's id in a tamper proof cookie, and maybe using a decorator for the request handlers to test the authentication status of the user, and as a side benefit the user id will be available to the request handler for datastore work and such. The concept would be similar to forms authentication in ASP.NET. This code comes from the web.py module of the Tornado framework. According to the docstrings, it "Signs and timestamps a cookie so it cannot be forged" and "Returns the given signed cookie if it validates, or None." I've tried to use it in an App Engine Project, but I don't understand the nuances of trying to get these methods to work in the context of the request handler. Can someone show me the right way to do this without losing the functionality that the FriendFeed developers put into it? The set_secure_cookie, and get_secure_cookie portions are the most important, but it would be nice to be able to use the other methods as well. #!/usr/bin/env python import Cookie import base64 import time import hashlib import hmac import datetime import re import calendar import email.utils import logging def _utf8(s): if isinstance(s, unicode): return s.encode("utf-8") assert isinstance(s, str) return s def _unicode(s): if isinstance(s, str): try: return s.decode("utf-8") except UnicodeDecodeError: raise HTTPError(400, "Non-utf8 argument") assert isinstance(s, unicode) return s def _time_independent_equals(a, b): if len(a) != len(b): return False result = 0 for x, y in zip(a, b): result |= ord(x) ^ ord(y) return result == 0 def cookies(self): """A dictionary of Cookie.Morsel objects.""" if not hasattr(self,"_cookies"): self._cookies = Cookie.BaseCookie() if "Cookie" in self.request.headers: try: self._cookies.load(self.request.headers["Cookie"]) except: self.clear_all_cookies() return self._cookies def _cookie_signature(self,*parts): self.require_setting("cookie_secret","secure cookies") hash = hmac.new(self.application.settings["cookie_secret"], digestmod=hashlib.sha1) for part in parts:hash.update(part) return hash.hexdigest() def get_cookie(self,name,default=None): """Gets the value of the cookie with the given name,else default.""" if name in self.cookies: return self.cookies[name].value return default def set_cookie(self,name,value,domain=None,expires=None,path="/", expires_days=None): """Sets the given cookie name/value with the given options.""" name = _utf8(name) value = _utf8(value) if re.search(r"[\x00-\x20]",name + value): # Don't let us accidentally inject bad stuff raise ValueError("Invalid cookie %r:%r" % (name,value)) if not hasattr(self,"_new_cookies"): self._new_cookies = [] new_cookie = Cookie.BaseCookie() self._new_cookies.append(new_cookie) new_cookie[name] = value if domain: new_cookie[name]["domain"] = domain if expires_days is not None and not expires: expires = datetime.datetime.utcnow() + datetime.timedelta( days=expires_days) if expires: timestamp = calendar.timegm(expires.utctimetuple()) new_cookie[name]["expires"] = email.utils.formatdate( timestamp,localtime=False,usegmt=True) if path: new_cookie[name]["path"] = path def clear_cookie(self,name,path="/",domain=None): """Deletes the cookie with the given name.""" expires = datetime.datetime.utcnow() - datetime.timedelta(days=365) self.set_cookie(name,value="",path=path,expires=expires, domain=domain) def clear_all_cookies(self): """Deletes all the cookies the user sent with this request.""" for name in self.cookies.iterkeys(): self.clear_cookie(name) def set_secure_cookie(self,name,value,expires_days=30,**kwargs): """Signs and timestamps a cookie so it cannot be forged""" timestamp = str(int(time.time())) value = base64.b64encode(value) signature = self._cookie_signature(name,value,timestamp) value = "|".join([value,timestamp,signature]) self.set_cookie(name,value,expires_days=expires_days,**kwargs) def get_secure_cookie(self,name,include_name=True,value=None): """Returns the given signed cookie if it validates,or None""" if value is None:value = self.get_cookie(name) if not value:return None parts = value.split("|") if len(parts) != 3:return None if include_name: signature = self._cookie_signature(name,parts[0],parts[1]) else: signature = self._cookie_signature(parts[0],parts[1]) if not _time_independent_equals(parts[2],signature): logging.warning("Invalid cookie signature %r",value) return None timestamp = int(parts[1]) if timestamp < time.time() - 31 * 86400: logging.warning("Expired cookie %r",value) return None try: return base64.b64decode(parts[0]) except: return None uid=1234|1234567890|d32b9e9c67274fa062e2599fd659cc14 Parts: 1. uid is the name of the key 2. 1234 is your value in clear 3. 1234567890 is the timestamp 4. d32b9e9c67274fa062e2599fd659cc14 is the signature made from the value and the timestamp

    Read the article

  • Google I/O 2011: Fireside Chat with the App Engine Team

    Google I/O 2011: Fireside Chat with the App Engine Team Max Ross, Max is a Software Engineer on the App Engine team where he leads the development of the datastore & occasionally tinkers with the Java runtime. He is also the founder of the Hibernate Shards project. Alon Levi, Sean Lynch, Greg Dalesandre, Guido van Rossum, Brett Slatkin, Peter Magnusson, Mickey Kataria, Peter McKenzie Fireside chat with the App Engine team From: GoogleDevelopers Views: 2045 5 ratings Time: 01:01:25 More in Entertainment

    Read the article

< Previous Page | 155 156 157 158 159 160 161 162 163 164 165 166  | Next Page >