Search Results

Search found 4208 results on 169 pages for 'life hacks'.

Page 17/169 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Python: Recursively access dict via attributes as well as index access?

    - by Luke Stanley
    I'd like to be able to do something like this: from dotDict import dotdictify life = {'bigBang': {'stars': {'planets': [] } } } dotdictify(life) #this would be the regular way: life['bigBang']['stars']['planets'] = {'earth': {'singleCellLife': {} }} #But how can we make this work? life.bigBang.stars.planets.earth = {'singleCellLife': {} } #Also creating new child objects if none exist, using the following syntax life.bigBang.stars.planets.earth.multiCellLife = {'reptiles':{},'mammals':{}} My motivations are to improve the succinctness of the code, and if possible use similar syntax to Javascript for accessing JSON objects for efficient cross platform development.(I also use Py2JS and similar.)

    Read the article

  • When Google gives up recrawling 301 that led to 404?

    - by Easy Life
    I've transferred a domain and made a mistake in the redirects (the URL structure is identical). Even though they went to the new domain, the error caused a 404 when crawled by Google bot. 10 days after I saw and corrected my redirect mistake, and now the site should (hopefully) redirect to proper pages. Q1: The URLs of the 404 pages in the Webmaster Tools all bear the mistake and will never be available at the new site. I marked them as fixed in the tools. Do I need to do something about that, like 301 rewrite them with a condition to fix the error? Q2: Does Google bot attempt to recrawl 301 pages that pointed to a 404?

    Read the article

  • When I add a database table to a DBML file via LINQ to SQL, I get a slew of compiler errors.

    - by Zian Choy
    Whenever I add a certain table to a DBML file via LINQ to SQL, I get 102 errors in my VB NET project. Some of the errors: Error 1 Attribute 'TableAttribute' cannot be applied multiple times. C:\Documents and Settings\zchoy\My Documents\Virtual EMS Deployment\Life And Death\Life And Death\ShearwaterEMS.designer.vb 74 2 EMS Reality Check Error 2 'emptyChangingEventArgs' is already declared as 'Private Shared emptyChangingEventArgs As System.ComponentModel.PropertyChangingEventArgs' in this class. C:\Documents and Settings\zchoy\My Documents\Virtual EMS Deployment\Life And Death\Life And Death\ShearwaterEMS.designer.vb 78 17 EMS Reality Check Error 3 '_GroupID' is already declared as 'Private _GroupID As Integer' in this class. C:\Documents and Settings\zchoy\My Documents\Virtual EMS Deployment\Life And Death\Life And Death\ShearwaterEMS.designer.vb 80 10 EMS Reality Check Error 4 '_ID' is already declared as 'Private _ID As Integer' in this class. C:\Documents and Settings\zchoy\My Documents\Virtual EMS Deployment\Life And Death\Life And Death\ShearwaterEMS.designer.vb 82 10 EMS Reality Check Any suggestions for getting the table to work with LINQ to SQL will be welcomed. The table's properties: Group ID ID (Primary Key) Contact Title UseGroupAddress InternationalFormat Address1 Address2 City State ZipCode Country Phone Fax EMailAddress Notes DateAdded AddedBy DateChanged ChangedBy Active ExternalReference ChangeCounter PhoneLabel FaxLabel

    Read the article

  • What trivial real-life example do you use to explain programming to total non-programmers?

    - by anon
    Programmers seem to live in a world of their own (as this site indicates), with their own vibrant culture - and their own premises and vocabulary. Once we've been in the field for a bit, we take a lot of things for granted. But I'm often faced with the question "What do you do?" Or "What is programming?" I generally try to answer this with a small, often trivial, real-world example of how programming is prevalent in our everyday lives and keeps things running. The example I use most often is an elevator - someone has to program the logic of that... And I've seen elevators that are "smart" and ones that are quite backwards and foolish. (And you can easily understand if/decision and looping from that... incorporates a lot of important programming concepts in a very small example.) I've sometimes heard people use traffic lights as an example. What example do you / would you use to explain the concept of programming to someone completely clueless?

    Read the article

  • Is regex too slow? Real life examples where simple non-regex alternative is better

    - by polygenelubricants
    I've seen people here made comments like "regex is too slow!", or "why would you do something so simple using regex!" (and then present a 10+ lines alternative instead), etc. I haven't really used regex in industrial setting, so I'm curious if there are applications where regex is demonstratably just too slow, AND where a simple non-regex alternative exists that performs significantly (maybe even asymptotically!) better. Obviously many highly-specialized string manipulations with sophisticated string algorithms will outperform regex easily, but I'm talking about cases where a simple solution exists and significantly outperforms regex. What counts as simple is subjective, of course, but I think a reasonable standard is that if it uses only String, StringBuilder, etc, then it's probably simple.

    Read the article

  • How to handle activity life cycle involving sockets in Android?

    - by Henrik
    Hello all, I have an Android activity which in turn starts a thread. In the thread I open a persistent TCP socket connection. When the socket connects to the server dynamic data is downloaded. The thread sends messages using Handler-class to the activity when data has been received. Now if the user happens to switch from portrait to landscape mode the activity gets an onDestroy call. At this moment I close the socket and stop the thread. When Android has switched landscape mode it calls onCreate yet again and I have to do a socket re-connect. Also, all of the data the activity received needs to be downloaded once more because the server does not have the ability to know what has been sent before, i.e. there is no "resume" feature. Thus the problem is that there is alot of data which is resent all the time when landscape mode is changed. What are my options here? Should I create a service which handles the socket traffic towards the server thus I always got all the data which the server has sent in the service. Or should I disable landscape mode all together perhaps? Or would my best bet be to rewrite my server which is a VERY BIG job :-) All input is welcome :-) / Henrik

    Read the article

  • Windows Forms Dead. Long life to WPF.

    - by pho3nix
    In PDC sessions i see only Framework 4.0, Azure and WPF. My all applications is in windows forms and asp.net (codebehind) and framework 2.0 or 3.5. I see i'am obsolete, ok. But my questions is Windows Forms is dead, i need start migrate to WPF or Silverlight? or my Windows forms with Devexpress can leave more than 3 years?

    Read the article

  • IE7 is making my life miserable! Getting gaps between html table columns (w/ colspan) with css togg

    - by Art Peterson
    Copy/paste this html code snippet and try it out in IE7. When you toggle the hidden columns it leaves a gap between the columns. In Firefox it works fine, the columns touch when minimized. Haven't tried IE8 yet, would be curious to hear how it works there. Any ideas? I've tried a bunch of things in the CSS like table-layout:fixed but no luck. Note: Not looking for a different toggling method because the table I'm really dealing with is 50+ columns wide and 4000+ rows so looping/jquery techniques are too slow. Here's the code - if someone can re-post a working version of it I'll instantly give them the check and be forever in your debt! <DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <script> function toggle() { var tableobj = document.getElementById("mytable"); if (tableobj.className == "") { tableobj.className = "hide1 hide2"; } else { tableobj.className = ""; } } </script> <style> table { border-collapse: collapse; } td, th { border: 1px solid silver; } .hide1 .col1 { display: none; } .hide2 .col2 { display: none; } </style> </head> <body> <input type="button" value="toggle" onclick="toggle();" /> <table id="mytable"> <tr> <th>A</th> <th colspan="2">B</th> <th colspan="2" class="col1">B1</th> <th colspan="2">C</th> <th colspan="2" class="col2">C1</th> </tr> <tr> <td>123</td> <td>456</td> <td>789</td> <td class="col1">123</td> <td class="col1">456</td> <td>789</td> <td>123</td> <td class="col2">456</td> <td class="col2">789</td> </tr> </table> </body> </html>

    Read the article

  • Retain, alloc, properties ... Topic to make your Obj-c life easier !

    - by gotye
    Hey everyone, The more I code, the more I get lost ... so I decided to create a topic entirely dedicated to the memory management for me (and others) not to waste hours understanding obj-c basics ... I'll update it as new questions are asked ! Okay below is some examples : // myArray is property (retain) myArray = otherArray; //myArray isn't a property myArray = otherArray; //myArray is a property (retain) myArray = [[NSArray alloc] init]; //myArray isn't a property myArray = [[NSArray alloc] init]; Could you explain to me what happens in every cases ? And especially the number 3 ;) Thanks for the time. Gotye.

    Read the article

  • Will iPhone OS4 make your life easier or harder as a lone app developer?

    - by Matt
    I am interested to hear what people feel about the new iPhone OS4 release. It is obviously very exciting having access to all the new features, apparently (from apple.com) it has over 1500 new APIs. My original thoughts were "Wow, this is awesome", and I suppose it is. I was just getting comfortable with OS 3.2 development though, and now there is a raft of additional stuff to learn in order to keep up with the pack. So I am feeling quite frustrated! Do you think, when working as an individual app developer, having access to these additional features would improve your applications or just water down the quality? I guess being giving the opportunity to improve applications and provide better features should be welcomed. I think frustration comes from struggling to keep up with the continuous changes, but thats the industry we are in I suppose! Any thoughts/comments?

    Read the article

  • What's the life-time of a thread-local value in Python?

    - by Carlos Valiente
    import threading mydata = threading.local() def run(): # When will the garbage collector be able to destroy the object created # here? After the thread exits from ``run()``? After ``join()`` is called? # Or will it survive the thread in which it was created, and live until # ``mydata`` is garbage-collected? mydata.foo = object() t = threading.Thread(target=run) t.start() t.join()

    Read the article

  • Websites' color scheme generators - what to do with them in real life?

    - by Marco Demaio
    On the web there are plenty of color scheme/palette generator tools and color palettes galleries. All of these tools/gelleries show many 3 to 5 colors palette as final result. Some of these tools: http://kuler.adobe.com, http://www.colorexplorer.com I know my question might sound ridicolous to someone who is involved in web dedign, but I don't understand what to do with these color palette. I mean, if I have to create a website, how am I supposed to apply this color palette to the website. Which color goes as foreground text, which one as background, which one for the links, which one for the page titles and so on? What are these color palette generators useful for then?! Thanks!

    Read the article

  • What's Your favorite f# use? where does f# makes life (a lot) easier (compared to c#)?

    - by luckyluke
    I've skimmed the stack and did not get the overflow as there is probably no such question. I'm just learning f# and I am A seasoned c# and .net dev. I am into financial apps and currently F# helps me a lot with maths calcs like zero finding or minimum finding (although I still want some good maths library there). I see that processing multiple items (files or smth) tends to be easier, but my GUI (web, win) are still c# based. I am in the team of 5 devs and we know that the new tool is out, we are learning it after hours (to pimp ourselves up) but maybe we shouldn't bash the door somebody already opened. So in business apps, whats Your first killer part of soft You would code in F# (if You could and would know IT would be easier, faster, more testable, easier to maintain etc.? Business rules? ImageProcessing? Data processing? hope it's not to subjective. luke

    Read the article

  • How to give new life into a five years old, simple but reliable PHP form?

    - by Sam
    Hi all. I have a script in php 5.2. I want to use a simple form. I found something a programmer made for me about 5 years ago. When I use it, PHP outputs an error now unless I set register_long_arrays = On, then it works fine. On the PHP website, however, it says: Warning This feature has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged. It's recommended to turn them off, for performance reasons. Instead, use the superglobal arrays, like $_GET. Should I listen to PHP's warning, or just enable the option and keep using my old form happily? If the former, then how/where do I change this simple form, so it does not rely on the deprecated setting? Your answer is much appreciated. form.htm <html><body> <form method="POST" action="form_sent.php"> ... </form> </body></html> form_sent.php <html><body> <?php $email = $HTTP_POST_VARS[email]; $mailto = "[email protected]"; $mailsubj = "A Form was Sent from Website!"; $mailhead = "From: $email\n"; reset ($HTTP_POST_VARS); $mailbody = "Values submitted from web site form:\n"; while (list($key, $val) = each ($HTTP_POST_VARS)){$mailbody .= "$key : $val\n";} if (!eregi("\n",$HTTP_POST_VARS[email])) { mail($mailto, $mailsubj, $mailbody, $mailhead); } ?> <b>Form Sent. Thank you.</b> </body></html>

    Read the article

  • What's the reason why core data takes care of the life-cycle of modeled properties?

    - by mystify
    The docs say that I should not release any modeled property in -dealloc. For me, that feels like violating the big memory management rules. I see a big retain in the header and no -release, because Core Data seems to do it at any other time. Is it because Core Data may drop the value of a property dynamically, at any time when needed? And what's Core Data doing when dropping an managed object? If there's no -dealloc, then how and when are the properties getting freed up?

    Read the article

  • Why does my int, booleans, doubles does not work?

    - by SystemNetworks
    As you see, my code does not work. When armor1 is true, it would add my life. goldA is another class. public void goldenArmor(GameContainer gc, StateBasedGame sbg, Graphics g) { if(armor1==true) { goldA.life = life; goldA.intelligence = intelligence; goldA.power = power; goldA.lifeLeft = lifeLeft; goldA.head(); goldA.body(); goldA.legs(); } } My other class: package javagame; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.Image; import org.newdawn.slick.Input; import org.newdawn.slick.SlickException; /* Note: Copyright(C)2012 System Networks | Square NET | Julius Bryan Gambe. You cannot copy the style, story of the game and gameplay! To programmers: The int,doubles,strings,booleans are properly sorted out. Please don't mess it up. */ /* NOTE: We have loops but not for programming. The loop is: 1.show the world to user 2.Obtain input from the user 3.Shows the update, repeat step 1 */ import org.newdawn.slick.*; import org.newdawn.slick.state.*; import org.lwjgl.input.Mouse; //contents: // public class GoldenArmor{ //get it from play public int life; public double intelligence; public int lifeLeft; public double power; public GoldenArmor() { // TODO Auto-generated constructor stub } //start here public void head() { life += 10; intelligence +=0.5; } public void body() { lifeLeft += 100; } public void legs() { power += 100; } } /* SYSTEM NETWORKS(C) 2012 NET FRONT */ The life, intelligence, power, lifeLeft are nothing but to use it as just reference to prevent stack overflow. And at my main class, it becomes my real booleans, int, doubles. How do I fix this? It does not add it to my normal int.

    Read the article

  • Is text-only mode a saving or a problem for battery savings?

    - by Robottinosino
    A friend is flying to the US from Europe and asked me a very thought-provoking question, which I am not remotely able to answer with substance so I am asking it here: How to absolutely maximise battery life on an Ubuntu (laptop) install? do not rush to mark this as duplicate, there is an important point here: does -GNOME- help or worsen battery life? Let me provide some context: The only task he needs to perform is: edit text files in Vim. He is unsure whether running GNOME will drain his battery life more or actually save him some battery life given the smarts of GNOME's power management features like "switch this peripheral to -power save- after X minutes..." (GNOME might just be a configuration front-end for settings that are governed by command-line utils for all I know?) He could perfectly well boot the system in text-only mode and use the automatic 6 virtual consoles for his needs, if that's a saving at all over running tmux (I think so because of all the smart buffering/history/etc the latter does by default?) Exactly how would you advise him to run his laptop during his flight? What I told him already: power off WiFi in the BIOS, not from the "GUI" power off Bluetooth switch off the courtesy light and use low monitor brightness play music off of his phone, not mp3blaster do not use his tiny portable mouse (and do not attach any other USB gimmicks like "screen light", etc) stop development services he will not be using, especially apache2, tomcat, dovecot, postgresql, etc. Potentially: - switch off his cron jobs? (he does an rsync + tar + 7za of his "work in progress" every so often) I think the above is standard stuff one could get off StackExchange, and with many duplicates... the core of this question is, I think: __ will running Ubuntu in text-only mode be a saving in terms of battery life or a problem? why? (provide some technical arguments) __ I think it will be a saving but I am also scared about "other things" detecting and enabling advanced chipset power management features only when some services are started.. and fear these "services" may be off in text-only mode?

    Read the article

  • Unity, Unrealistic Sphere On Inclined Plane

    - by user1086516
    So I am trying to model a ball rolling down an inclined surface in Unity based on what I am observing in real life but it is still quite off. In Unity it takes the ball about 3 seconds to travel from a place to another specified place where in real life it only takes 1 second. The ball isn't as fast to react to the incline as in real life (even though I have tried giving the ball and surface low or zero friction values) The ball does not accelerate as nearly as fast as it does in real life What do I do to give the ball more realistic behavior ? I have tried messing around with mass, physics materials, drag, and angular drag on the ball and surface but it doesn't seem to be helping.

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >