Search Results

Search found 56333 results on 2254 pages for 'set cookie'.

Page 5/2254 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to set Grub to automatically load Xen kernel

    - by Cerin
    How do you configure Grub to automatically use the Xen kernel under Ubuntu 11.10? No matter what I do, it loads the first menuentry. The only way I can get it to load Xen is to manually select the kernel, which I can't do if I have to reboot the server remotely, or there's a power failure and the machine automatically boots up when power's restored, etc. It's driving me nuts. In my /boot/grub/grub.cfg, the Xen kernel is at index 4 (i.e. it's the 5th menuentry). So I've tried: Setting GRUB_DEFAULT=4, and running sudo update-grub Setting GRUB_DEFAULT=saved and GRUB_SAVEDEFAULT=true, and running sudo update-grub Setting GRUB_DEFAULT="Ubuntu GNU/Linux, with Xen 4.1-amd64 and Linux 3.0.0-16-server", and running sudo update-grub None of these work. It continues to load the first menuentry, which is "Ubuntu, with Linux 3.0.0-16-server". Below is my current /boot/grub/grub.cfg. What am I doing wrong? # # DO NOT EDIT THIS FILE # # It is automatically generated by grub-mkconfig using templates # from /etc/grub.d and settings from /etc/default/grub # ### BEGIN /etc/grub.d/00_header ### if [ -s $prefix/grubenv ]; then set have_grubenv=true load_env fi set default="Ubuntu GNU/Linux, with Xen 4.1-amd64 and Linux 3.0.0-16-server" if [ "${prev_saved_entry}" ]; then set saved_entry="${prev_saved_entry}" save_env saved_entry set prev_saved_entry= save_env prev_saved_entry set boot_once=true fi function savedefault { if [ -z "${boot_once}" ]; then saved_entry="${chosen}" save_env saved_entry fi } function recordfail { set recordfail=1 if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi } function load_video { insmod vbe insmod vga insmod video_bochs insmod video_cirrus } insmod raid insmod mdraid1x insmod part_msdos insmod part_msdos insmod ext2 set root='(mduuid/be73165bc31d6f5cd00d05036c7b964f)' search --no-floppy --fs-uuid --set=root d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac if loadfont /usr/share/grub/unicode.pf2 ; then set gfxmode=auto load_video insmod gfxterm insmod raid insmod mdraid1x insmod part_msdos insmod part_msdos insmod ext2 set root='(mduuid/be73165bc31d6f5cd00d05036c7b964f)' search --no-floppy --fs-uuid --set=root d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac set locale_dir=($root)/boot/grub/locale set lang=en_US insmod gettext fi terminal_output gfxterm if [ "${recordfail}" = 1 ]; then set timeout=-1 else set timeout=2 fi ### END /etc/grub.d/00_header ### ### BEGIN /etc/grub.d/05_debian_theme ### set menu_color_normal=white/black set menu_color_highlight=black/light-gray if background_color 44,0,30; then clear fi ### END /etc/grub.d/05_debian_theme ### ### BEGIN /etc/grub.d/10_linux ### if [ ${recordfail} != 1 ]; then if [ -e ${prefix}/gfxblacklist.txt ]; then if hwmatch ${prefix}/gfxblacklist.txt 3; then if [ ${match} = 0 ]; then set linux_gfx_mode=keep else set linux_gfx_mode=text fi else set linux_gfx_mode=text fi else set linux_gfx_mode=keep fi else set linux_gfx_mode=text fi export linux_gfx_mode if [ "$linux_gfx_mode" != "text" ]; then load_video; fi menuentry 'Ubuntu, with Linux 3.0.0-16-server' --class ubuntu --class gnu-linux --class gnu --class os { recordfail set gfxpayload=$linux_gfx_mode insmod gzio insmod raid insmod mdraid1x insmod part_msdos insmod part_msdos insmod ext2 set root='(mduuid/be73165bc31d6f5cd00d05036c7b964f)' search --no-floppy --fs-uuid --set=root d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac linux /boot/vmlinuz-3.0.0-16-server root=UUID=d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac ro initrd /boot/initrd.img-3.0.0-16-server } menuentry 'Ubuntu, with Linux 3.0.0-16-server (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os { recordfail insmod gzio insmod raid insmod mdraid1x insmod part_msdos insmod part_msdos insmod ext2 set root='(mduuid/be73165bc31d6f5cd00d05036c7b964f)' search --no-floppy --fs-uuid --set=root d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac echo 'Loading Linux 3.0.0-16-server ...' linux /boot/vmlinuz-3.0.0-16-server root=UUID=d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac ro recovery nomodeset echo 'Loading initial ramdisk ...' initrd /boot/initrd.img-3.0.0-16-server } submenu "Previous Linux versions" { menuentry 'Ubuntu, with Linux 3.0.0-12-server' --class ubuntu --class gnu-linux --class gnu --class os { recordfail set gfxpayload=$linux_gfx_mode insmod gzio insmod raid insmod mdraid1x insmod part_msdos insmod part_msdos insmod ext2 set root='(mduuid/be73165bc31d6f5cd00d05036c7b964f)' search --no-floppy --fs-uuid --set=root d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac linux /boot/vmlinuz-3.0.0-12-server root=UUID=d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac ro initrd /boot/initrd.img-3.0.0-12-server } menuentry 'Ubuntu, with Linux 3.0.0-12-server (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os { recordfail insmod gzio insmod raid insmod mdraid1x insmod part_msdos insmod part_msdos insmod ext2 set root='(mduuid/be73165bc31d6f5cd00d05036c7b964f)' search --no-floppy --fs-uuid --set=root d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac echo 'Loading Linux 3.0.0-12-server ...' linux /boot/vmlinuz-3.0.0-12-server root=UUID=d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac ro recovery nomodeset echo 'Loading initial ramdisk ...' initrd /boot/initrd.img-3.0.0-12-server } } ### END /etc/grub.d/10_linux ### ### BEGIN /etc/grub.d/20_linux_xen ### submenu "Xen 4.1-amd64" { menuentry 'Ubuntu GNU/Linux, with Xen 4.1-amd64 and Linux 3.0.0-16-server' --class ubuntu --class gnu-linux --class gnu --class os --class xen { insmod raid insmod mdraid1x insmod part_msdos insmod part_msdos insmod ext2 set root='(mduuid/be73165bc31d6f5cd00d05036c7b964f)' search --no-floppy --fs-uuid --set=root d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac echo 'Loading Xen 4.1-amd64 ...' multiboot /boot/xen-4.1-amd64.gz placeholder echo 'Loading Linux 3.0.0-16-server ...' module /boot/vmlinuz-3.0.0-16-server placeholder root=UUID=d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac ro echo 'Loading initial ramdisk ...' module /boot/initrd.img-3.0.0-16-server } menuentry 'Ubuntu GNU/Linux, with Xen 4.1-amd64 and Linux 3.0.0-16-server (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os --class xen { insmod raid insmod mdraid1x insmod part_msdos insmod part_msdos insmod ext2 set root='(mduuid/be73165bc31d6f5cd00d05036c7b964f)' search --no-floppy --fs-uuid --set=root d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac echo 'Loading Xen 4.1-amd64 ...' multiboot /boot/xen-4.1-amd64.gz placeholder echo 'Loading Linux 3.0.0-16-server ...' module /boot/vmlinuz-3.0.0-16-server placeholder root=UUID=d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac ro single echo 'Loading initial ramdisk ...' module /boot/initrd.img-3.0.0-16-server } menuentry 'Ubuntu GNU/Linux, with Xen 4.1-amd64 and Linux 3.0.0-12-server' --class ubuntu --class gnu-linux --class gnu --class os --class xen { insmod raid insmod mdraid1x insmod part_msdos insmod part_msdos insmod ext2 set root='(mduuid/be73165bc31d6f5cd00d05036c7b964f)' search --no-floppy --fs-uuid --set=root d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac echo 'Loading Xen 4.1-amd64 ...' multiboot /boot/xen-4.1-amd64.gz placeholder echo 'Loading Linux 3.0.0-12-server ...' module /boot/vmlinuz-3.0.0-12-server placeholder root=UUID=d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac ro echo 'Loading initial ramdisk ...' module /boot/initrd.img-3.0.0-12-server } menuentry 'Ubuntu GNU/Linux, with Xen 4.1-amd64 and Linux 3.0.0-12-server (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os --class xen { insmod raid insmod mdraid1x insmod part_msdos insmod part_msdos insmod ext2 set root='(mduuid/be73165bc31d6f5cd00d05036c7b964f)' search --no-floppy --fs-uuid --set=root d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac echo 'Loading Xen 4.1-amd64 ...' multiboot /boot/xen-4.1-amd64.gz placeholder echo 'Loading Linux 3.0.0-12-server ...' module /boot/vmlinuz-3.0.0-12-server placeholder root=UUID=d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac ro single echo 'Loading initial ramdisk ...' module /boot/initrd.img-3.0.0-12-server } } ### END /etc/grub.d/20_linux_xen ### ### BEGIN /etc/grub.d/20_memtest86+ ### menuentry "Memory test (memtest86+)" { insmod raid insmod mdraid1x insmod part_msdos insmod part_msdos insmod ext2 set root='(mduuid/be73165bc31d6f5cd00d05036c7b964f)' search --no-floppy --fs-uuid --set=root d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac linux16 /boot/memtest86+.bin } menuentry "Memory test (memtest86+, serial console 115200)" { insmod raid insmod mdraid1x insmod part_msdos insmod part_msdos insmod ext2 set root='(mduuid/be73165bc31d6f5cd00d05036c7b964f)' search --no-floppy --fs-uuid --set=root d72bad3f-9ed7-44b9-b3d1-d7af9f62a8ac linux16 /boot/memtest86+.bin console=ttyS0,115200n8 } ### END /etc/grub.d/20_memtest86+ ### ### BEGIN /etc/grub.d/30_os-prober ### ### END /etc/grub.d/30_os-prober ### ### BEGIN /etc/grub.d/40_custom ### # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. ### END /etc/grub.d/40_custom ### ### BEGIN /etc/grub.d/41_custom ### if [ -f $prefix/custom.cfg ]; then source $prefix/custom.cfg; fi ### END /etc/grub.d/41_custom ###

    Read the article

  • if cookies are disabled, does asp.net store the cookie as a session cookie instead or not?

    - by Erx_VB.NExT.Coder
    basically, if cookeis are disabled on the client, im wondering if this... dim newCookie = New HttpCookie("cookieName", "cookieValue") newCookie.Expires = DateTime.Now.AddDays(1) response.cookies.add(newCookie) notice i set a date, so it should be stored on disk, if cookies are disabled does asp.net automatically store this cookie as a session cookie (which is a cookie that lasts in browser memory until the user closes the browser, if i am not mistaken).... OR does asp.net not add the cookie at all (anywhere) in which case i would have to re-add the cookie to the collection without the date (which stores as a session cookie)... of course, this would require me doing the addition of a cookie twice... perhaps the second time unnecessarily if it is being stored in browsers memory anyway... im just trying not to store it twice as it's just bad code!! any ideas if i need to write another line or not? (which would be)... response.cookies.add(New HttpCookie("cookieName", "cookieValue") ' session cookie in client browser memory thanks guys

    Read the article

  • Response is not available in this context when creation cookie's

    - by Sadegh
    hi i defined one class to create cookie by received parameter's from user. when i want to add cookie to context i receive an exception. My Class public static class ManageCookies { public static void Create(string name, string value) { HttpCookie cookie = new HttpCookie(name); cookie.Value = value; cookie.Expires = DateTime.Now.AddYears(1); HttpContext.Current.Response.Cookies.Add(cookie); } } Occured Exception: Response is not available in this context.

    Read the article

  • Any algorithm to dedicate a set of known resources to a set of known requirements (scheduling)

    - by Saeed Neamati
    I'm developing an application to help school principals in dedicating teachers to classes and courses over the hours of a week (scheduling). The scenario is roughly something like this: User enters the list of teachers and their free times into the system User enters the list of courses for this semester User enters the list of available classes into the system Well, up to here, there is no big deal. Just simple CRUD operations and nothing extraordinary. However, now what makes this system useful is that the application should automatically and based on an algorithm create the semester scheduling. I think you've got the main idea here. For example application should suggest that teacher A should go to class 1 for mathematics, and at the same time teacher B should go to class 2 for physics. This way all of the classes would be dedicated to lessons and teacher times won't overlap each other. Piece a cake for school principal. However, I can't find a good algorithm for this resource dedication. I mean it seems hard to me. Searching Google resulted in articles from different websites, but they are of no help and use to me. For example: http://en.wikipedia.org/wiki/Resource_allocation or http://en.wikipedia.org/wiki/Scheduling_(production_processes) Is there any algorithm out there, or any application or engine which can help me here? Does this requirements have a known name, like for example time scheduling engine? Any help would be appreciated.

    Read the article

  • Set Valid IP On Vmware Vm's Help Please

    - by Shahin At
    I Have a VPS.And i on my vps installed vmware workstation version 9.now i have 3 valid ip's: XXX.152.193.66 XXX.152.193.101 XXX.152.193.103 Gateway: XXX.152.193.65 now tow ip's set in host and i want to 1 ip set on vm. network vm is bridge and set ip on vm but this ip from out of internal network not ping and in vm not ping to gateway. What can I do to solve this problem? my ip is unassigned and only set on vm and use bridge network mode.and gw,mask,dns is set.but not ping. i set this ip on host and without problems is worked, But I do not know why on vm not worked. my host OS Is Windows Server 2003 and firewall is off and RRAs(routing and remote access) For VPN service is Enable. Do not host or virtual machines to create a IP route?

    Read the article

  • Browser forgets about registered cookie after leaving domain

    - by Sergej Andrejev
    I have following problem. I register a cookie Set-Cookie EhdSite_SessionId=b0ptrr45xgclea55kjqp2o45; path=/; HttpOnly Do something on the same host (user always sends cookie header) Cookie EhdSite_SessionId=b0ptrr45xgclea55kjqp2o45 then I redirect user to other host After filling all the required data user went back to first host Here user doesn't send the cookie Does that mean that without expiration date cookie is destroyed by browser not when closing browser but when leaving the domain

    Read the article

  • jQuery cookie behaves differently on local machine vs production server

    - by user1810414
    I'm setting a jQuery cookie for some site javascript effects. I'm setting expiration date to 30 days. On local development machine cookie expiration is set properly, whereas on production expiration is being set to end of session. After inspecting the created cookies with web develoer tools, everything is identical except production machine cookie is marked as "session cookie" and setting expiration is disallowed, while cookie created on local development machine is not set to "session" and expiration date is editable. Is there a way to make production machine cookie accept the expiration date? This is how I set the cookie: $.cookie('skip_animation','skip', 2592000); Using jQuery 1.6.4 (legacy site) All browsers behave the same way

    Read the article

  • why javascript can not read the cookie in asp.net ?

    - by MemoryLeak
    I want to read the sessionid in cookie which is automatically generated by asp.net. such as ASP.NET_SessionId. but when i use javascript: document.cookie = "ASP.NET_SessionId=;" since i want to set the ASP.NET_SessionId to be empty. but after the javascript executed, i found instead of change the ASP.NET_SessionId to empty, system generate a new cookie with ASP.NET_SessionId equal to empty. why system not modify the cookie but generate a new one ? Thanks!

    Read the article

  • HAProxy appsession vs cookie precedence

    - by user1139473
    I am trying to find the best solution for balancing and keeping persistence on our application behind HAProxy. Here is our basic configuration: https://gist.github.com/endzyme/1804046b23c37beba520 After playing around with taking members down and up and also reloading the haproxy (with -sf) I have noticed that appsession isn't 100% effective, it would appear that sometimes it doesn't always 'request-learn'. I also tried to add a cookie JSESSION prefix to balance in case request-learn didn't take. Unfortunately it would present scenarios where the prefix would list svr2 but it was balanced to a different server. I am assuming it's because the appsession table takes first then sticks on that before using the cookie parameter. I have not tested with using cookie as an inserted option (not prefix on existing cookie) but I am thinking it would yield similar results. My question is: Which one is checked first, appsession or cookie, and is it an immediate catch after it reads the first one, or a fall through? Also as a follow up - is it not recommended to use both in the same backend? Cookie as I understand takes less memory resources, is agnostic to reloads and has way better reliability of persistence. Appsession I assume takes less cpu resource, since it's reading not writing. (Bonus Question: is there a way to inspect appsession/cookie table map? socket show table doesn't show anything except stick-tables) Many thanks in advance, -Nick

    Read the article

  • jQuery Collapse (with cookies), default open instead of closed?

    - by Christian
    Hi. I've got a jQuery snippet which basically allows a user to toggle a div, open or closed - their preference is saved in a cookie. (function($) { $.fn.extend({ collapse: function(options) { var defaults = { inactive : "inactive", active : "active", head : ".trigger", group : ".wrap-me-up", speed : 300, cookie : "collapse" }; // Set a cookie counter so we dont get name collisions var op = $.extend(defaults, options); cookie_counter = 0; return this.each(function() { // Increment cookie name counter cookie_counter++; var obj = $(this), sections = obj.find(op.head).addClass(op.inactive), panel = obj.find(op.group).hide(), l = sections.length, cookie = op.cookie + "_" + cookie_counter; // Look for existing cookies for (c=0;c<=l;c++) { var cvalue = $.cookie(cookie + c); if ( cvalue == 'open' + c ) { panel.eq(c).show(); panel.eq(c).prev().removeClass(op.inactive).addClass(op.active); }; }; sections.click(function(e) { e.preventDefault(); var num = sections.index(this); var cookieName = cookie + num; var ul = $(this).next(op.group); // If item is open, slide up if($(this).hasClass(op.active)) { ul.slideUp(op.speed); $(this).removeClass(op.active).addClass(op.inactive); $.cookie(cookieName, null, { path: '/', expires: 10 }); return } // Else slide down ul.slideDown(op.speed); $(this).addClass(op.active).removeClass(op.inactive); var cookieValue = 'open' + num; $.cookie(cookieName, cookieValue, { path: '/', expires: 10 }); }); }); } }); })(jQuery); Demo: http://christianbullock.com/demo/ I'm just wondering how I can display the list open as default, and have the div collapse when the header is clicked? Many thanks. Christian.

    Read the article

  • how to set(get) cookie value in ext.net

    - by user591587
    scene: when I click item in ext:ComboBox and want to set the item selected value to cookie variable. Finally, after I click ext:Button, the ext:Label get cookie value and display it. But I get a error :Ext.Ajax Communication Failure , any help will be appreciated. aspx: <ext:ComboBox ID="ComboBox1" runat="server" StoreID="Store1" Width="100" Editable="false" DisplayField="name" ValueField="value" Mode="Local" TriggerAction="All`enter code here`" EmptyText="Select a locale..."> ..... aspx.cs protected void lngIndexChanged(object sender, DirectEventArgs e) { //Sets the cookie that is to be used by Global.asax HttpCookie cookie = new HttpCookie("CultureInfo"); cookie.Value = ComboBox1.SelectedItem.Value ; Response.Cookies.Add(cookie); Label1.Text = cookie.Value; //Set the culture and reload for immediate effect. //Future effects are handled by Global.asax Thread.CurrentThread.CurrentCulture = new CultureInfo(ComboBox1.SelectedItem.Value); Thread.CurrentThread.CurrentUICulture = new CultureInfo(ComboBox1.SelectedItem.Value); }

    Read the article

  • Setting cookie in LiftFilter

    - by Gero
    Hi, How do I set a cookie in a LiftFilter.doFilter method? I tried to set the cookie as follows (stripped some code): class AuthenticationFilter extends LiftFilter { override def doFilter(request: ServletRequest, response: ServletResponse , chain: FilterChain) { val cookie = new HTTPCookie("SomeCookie", Full("" + System.nanoTime), Empty, Full("/authentication"), Full(60 * 60 * 24 * 14), Empty, Empty) cookie.setPath("/somePath") S.addCookie(cookie) val httpResp = response.asInstanceOf[HttpServletResponse] httpResp.sendRedirect("/some/page.html") } } However, when I check the browsers cookie, no cookie is set (apart from JSESSIONID), and I know the doFilter method is being executed because of logging messages and the fact that the browser is redirected to /some/page.html. I'm using Scala 2.8, Lift 2.1-SNAPSHOT and the app is running is GAE (1.3.6, only tested on dev_appserver so far). Any ideas? Thanks, Gero

    Read the article

  • If cookie found, get data, else create cookie, is this good logic?

    - by Ryan
    I have an Action that basically adds an item to a cart, the only way the cart is known is by checking the cookie, here is the flow of logic, please let me know if you see any issue... /order/add/[id] is called via GET action checks for cookie, if no cookie found, it makes a new cart, writes the identifier to the cookie, and adds the item to the database with a relation to the cart created if cookie is found, it gets the cart identifier from the cookie, gets the cart object, adds the item to the database with a relation to the cart found so it's basically like... action add(int id){ if(cookie is there) cart = getcart(cookievalue) else cart = makecart() createcookie(cart.id) additemtocart(cart.id, id) return "success"; } Seem right? I can't really thing of another way that would make sense.

    Read the article

  • Can AdSense crawler view pages that require cookies?

    - by moomoochoo
    Details I require users to agree to terms and conditions before they can view several pages on my site. Once they have agreed a cookie is set and they can proceed to the webpage. If a user somehow manages to end up on the webpage without a cookie they will not be able to access the page's content. My question(s) Is the AdSense crawler able to set the cookie and visit these pages? If yes, how will it know to agree to the TOS? Is there some way to allow it access to the pages even if it couldn't use cookies?

    Read the article

  • ASP.NET MVC Cookie loses value when page is changed

    - by Jova
    When a user logs in to my site, I create a cookie with some info in it. However, whenever they change page from logging in, the cookie loses it's value. Cookie is still there but it's empty. I've checked my code and the cookie doesn't get rewritten by anything I've done. Does anyone have any idea to why the cookie becomes empty when the page is changed?

    Read the article

  • client generated double submit cookie, cross site request forgery prevention

    - by james
    in a double-submitted cookie csrf prevention scheme, is it necessary for the server to provide the cookie? it seems i could have javascript on the clients page generate and set a cookie "anti_csrf", then double submit that (once as a cookie, done by the browser, and once in the body of the request). a foreign domain would not be able to read or write the "anti_csrf" cookie to include it in the body of a request. is this secure, or am i overlooking something?

    Read the article

  • Read an invalid cookie with Java (jsp)?

    - by jsumners
    I have a cookie that is formatted like partA:partB. The colon is not escaped in any fashion. I need to read this cookie in a JSP script, and request.getCookies() is only returning partA. I can't change the cookie because it is used in multiple applications, and fixing the cookie would break production code. Any ideas how I can read the full value of this cookie?

    Read the article

  • how to set a cookie in the address bar?

    - by Craig Angus
    I want to add a cookie so that I can exclude my interaction with my website from google analytics (I don't have access to put files on server as is third party application) Is it possible to set a cookie with javascript by executing code in teh address bar of the browser?

    Read the article

  • Go - Using a map for its set properties with user defined types

    - by Seth Hoenig
    I'm trying to use the built-in map type as a set for a type of my own (Point, in this case). The problem is, when I assign a Point to the map, and then later create a new, but equal point and use it as a key, the map behaves as though that key is not in the map. Is this not possible to do? // maptest.go package main import "fmt" func main() { set := make(map[*Point]bool) printSet(set) set[NewPoint(0, 0)] = true printSet(set) set[NewPoint(0, 2)] = true printSet(set) _, ok := set[NewPoint(3, 3)] // not in map if !ok { fmt.Print("correct error code for non existent element\n") } else { fmt.Print("incorrect error code for non existent element\n") } c, ok := set[NewPoint(0, 2)] // another one just like it already in map if ok { fmt.Print("correct error code for existent element\n") // should get this } else { fmt.Print("incorrect error code for existent element\n") // get this } fmt.Printf("c: %t\n", c) } func printSet(stuff map[*Point]bool) { fmt.Print("Set:\n") for k, v := range stuff { fmt.Printf("%s: %t\n", k, v) } } type Point struct { row int col int } func NewPoint(r, c int) *Point { return &Point{r, c} } func (p *Point) String() string { return fmt.Sprintf("{%d, %d}", p.row, p.col) } func (p *Point) Eq(o *Point) bool { return p.row == o.row && p.col == o.col }

    Read the article

  • How to set/check cookies in iPhone app?

    - by Channing
    Hi, I am trying to set a cookie and also check if it is there, does anybody have any sample code for this? All I found was this, but it would be helpful if I could see an implementation example. http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSHTTPCookieStorage_Class/Reference/Reference.html

    Read the article

  • ASPXAUTH cookie is not being saved.

    - by kripto_ash
    Hi, Im working on a web project in ASP .NET MVC 2. In this project we store some info inside an ecripted cookie (the ASPXAUTH cookie) to avoid the need to query the db for every request. The thing is the code for this part has suddenly stopped working. I reviewed the changes made to the code on the source control server for anything that could be causing it, I found nothing. I even reverted to a known working copy (working on some other persons PC, same code, etc) but after debugging, it seems the .ASPXAUTH cookie is not getting saved anymore. Instead the ASP.NET_SessionId cookie is being set... (wich before wasn't) I changed the web.config file to turn off the sessionState. This eliminated the ASP.NET_SessionId cookie from being set, but it is still not saving the auth cookie. Ive recently installed some Microsoft Windows XP Updates, but the other person (whos PC runs the application just fine) also did. After googling, some info i found pointed out to a problem with the expiration date of the cookie. Ether cus the pc didnt have the right time/date (this was not the case) and others cus of the cookie expiration date being wrongly set. (I checked and it is being set correctly)... The problem persists with other browsers besides the one im using (Chrome) i tried it with IE6. Any ideas on why this is happening? Ill continue to post any helpful information i can find. Thanks in advance.

    Read the article

  • Javascript Cookie Function not working for Domain

    - by danit
    Here are the functions Im using: Set Cookie: function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure ) { var cookie_string = name + "=" + escape ( value ); if ( exp_y ) { var expires = new Date ( exp_y, exp_m, exp_d ); cookie_string += "; expires=" + expires.toGMTString(); } if ( path ) cookie_string += "; path=" + escape ( path ); if ( domain ) cookie_string += "; domain=" + escape ( domain ); if ( secure ) cookie_string += "; secure"; document.cookie = cookie_string; } Read Cookie: function get_cookie ( cookie_name ) { var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' ); if ( results ) return ( unescape ( results[2] ) ); else return null; } Delete Cookie: function delete_cookie ( cookie_name ) { var cookie_date = new Date ( ); // current date & time cookie_date.setTime ( cookie_date.getTime() - 1 ); document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString(); } The Jquery I use to construct the cookie: if(get_cookie('visible')== 'no') { $("#wrapper").hide(); $(".help").hide(); $("#slid .show").show(); $("#slid .hide").hide(); } else { $("#slid .show").hide(); $("#slid .hide").show(); } $("#slider").click(function() { if(get_cookie('visible')== null) { set_cookie('visible','no', 2020, 01,01, '/', 'domain.com'); } else { delete_cookie('visible'); } $(".help").slideToggle(); $("#wrapper").animate({ opacity: 1.0 },200).slideToggle(200, function() { $("#slid img").toggle(); }); }); Im trying to set the cookie for all pages that exist under domain.com with the path '/'. However using these functions and jQuery it doesn't appear to be working, any anyone give me an idea of where im going wrong?

    Read the article

  • VBA - Instead of ActiveExplorer.Selection to set folder, explicitly set folder path

    - by Mike
    Sub MoveItems() Dim Messages As Selection Dim Msg As MailItem Dim NS As NameSpace Set NS = Application.GetNamespace("MAPI") Set Messages = ActiveExplorer.Selection If Messages.Count = 0 Then Exit Sub End If For Each Msg In Messages Msg.Move NS.Folders("Personal Folders").Folders("SavedMail") Next End Sub This code will move all email messages from the currently selected folder in outlook to another folder (SavedMail). I would like to edit the code so that instead of using the currently selected folder as the source for the messages, there would be a hard-coded folder - something like Set Messages = NS.Folders("Personal Folders").Folders("Moved"). I'm a VBA rookie and tried just replacing the Set Messages line with this which resulted in a Run-time error '13': Type mismatch which I think refers to a mismatch of the Dim Messages and the Set Messages commands. I've tried using different Dim definitions with no luck. I'm guessing that someone who knows VBA will see the way to do this right away. Any help would be greatly appreciated. Thanks.

    Read the article

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