Daily Archives

Articles indexed Tuesday June 15 2010

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

  • Android Notification Bar Number

    - by JonF
    I've been able to successfully display the notification number count on the Android emulator. However, it doesn't display anything when I use it on an actual Android phone. Any suggestions on why there might be a difference?

    Read the article

  • Lightbox not loading.

    - by Nimbuz
    // Lightbox $('a.lightbox').click(function () { $.getScript("js/lightbox.js", function () { alert('Load Complete'); $("a.lightbox").lightbox({ 'type': 'iframe', 'overlayOpacity': 0.6, 'width': 940, 'hideOnContentClick': false }); }); }); I want to load script on first request, but it doesn't seem to work, the page just redirects to the linked website, does not open iframe in lightbox. Thanks for your help.

    Read the article

  • Iterating through list of keys for associative array in JSON

    - by Simon_Weaver
    I have an associative array in JSON var dictionary = {"cats":[1,2,37,38,40,32,33,35,39,36], "dogs", [4,5,6,3,2]}; Can I get the keys from this? I tried in Visual studio putting a breakpoint but can't see any property that represents keys. Is it not possible? I'm fine creating a separate array if necessary, but was just hoping it wasnt : var keys = ["cats", "dogs"];

    Read the article

  • belongs_to with multiple models

    - by julie p
    Hi there! I am a Rails noob and have a question. I have a feed aggregator that is organized by this general concept: Feed Category (books, electronics, etc) Feed Site Section (home page, books page, etc) Feed (the feed itself) Feed Entry So: class Category < ActiveRecord::Base has_many :feeds has_many :feed_entries, :through => :feeds, :limit => 5 validates_presence_of :name attr_accessible :name, :id end class Section < ActiveRecord::Base has_many :feeds has_many :feed_entries, :through => :feeds, :limit => 5 attr_accessible :name, :id end class Feed < ActiveRecord::Base belongs_to :categories belongs_to :sections has_many :feed_entries validates_presence_of :name, :feed_url attr_accessible :name, :feed_url, :category_id, :section_id end class FeedEntry < ActiveRecord::Base belongs_to :feed belongs_to :category belongs_to :section validates_presence_of :title, :url end Make sense? Now, in my index page, I want to basically say... If you are in the Category Books, on the Home Page Section, give me the feed entries grouped by Feed... In my controller: def index @section = Section.find_by_name("Home Page") @books = Category.find_by_name("Books") end In my view: <%= render :partial => 'feed_list', :locals => {:feed_group => @books.feeds} -%> This partial will spit out the markup for each feed entry in the @books collection of Feeds. Now what I need to do is somehow combine the @books with the @section... I tried this: <%= render :partial => 'feed_list', :locals => {:feed_group => @books.feeds(:section_id => @section.id)} -%> But it isn't limiting by the section ID. I've confirmed the section ID by using the same code in the console... Make sense? Any advice? Thanks!

    Read the article

  • SQL SERVER Shrinking NDF and MDF Files ReadersOpinion

    Previously, I had written a blog post about SQL SERVER Shrinking NDF and MDF Files A Safe Operation. After that, I have written the following blog post that talks about the advantage and disadvantage of Shrinking and why one should not be Shrinking a file SQL SERVER SHRINKFILE and TRUNCATE Log File [...]...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • how to setup VS 2010 to allow debugging of Silverlight 3 and Silverlight 4

    - by J__
    Hi, I have some code which is in Silverlight 3. I am unable to move to SL4 at this time. I would however like to use VS 2010 to do my SL 3 development... and SL4 development. The idea of both runtimes coexisting on 1 machine i thought I heard Microsoft got right this time in VS 2010. is this correct? if yes, then Where can I find the instructions how to set this up? thanks for any help you can provide, Sincerely, J

    Read the article

  • Oauth for Google API example using Python / Django

    - by DrDee
    Hi, I am trying to get Oauth working with the Google API using Python. I have tried different oauth libraries such as oauth, oauth2 and djanog-oauth but I cannot get it to work (including the provided examples). For debugging Oauth I use Google's Oauth Playground and I have studied the API and the Oauth documentation With some libraries I am struggling with getting a right signature, with other libraries I am struggling with converting the request token to an authorized token. What would really help me if someone can show me a working example for the Google API using one of the above-mentioned libraries. EDIT: My initial question did not lead to any answers so I have added my code. There are two possible causes of this code not working: 1) Google does not authorize my request token, but not quite sure how to detect this 2) THe signature for the access token is invalid but then I would like to know which oauth parameters Google is expecting as I am able to generate a proper signature in the first phase. This is written using oauth2.py and for Django hence the HttpResponseRedirect. REQUEST_TOKEN_URL = 'https://www.google.com/accounts/OAuthGetRequestToken' AUTHORIZATION_URL = 'https://www.google.com/accounts/OAuthAuthorizeToken' ACCESS_TOKEN_URL = 'https://www.google.com/accounts/OAuthGetAccessToken' CALLBACK = 'http://localhost:8000/mappr/mappr/oauth/' #will become real server when deployed OAUTH_CONSUMER_KEY = 'anonymous' OAUTH_CONSUMER_SECRET = 'anonymous' signature_method = oauth.SignatureMethod_HMAC_SHA1() consumer = oauth.Consumer(key=OAUTH_CONSUMER_KEY, secret=OAUTH_CONSUMER_SECRET) client = oauth.Client(consumer) request_token = oauth.Token('','') #hackish way to be able to access the token in different functions, I know this is bad, but I just want it to get working in the first place :) def authorize(request): if request.GET == {}: tokens = OAuthGetRequestToken() return HttpResponseRedirect(AUTHORIZATION_URL + '?' + tokens) elif request.GET['oauth_verifier'] != '': oauth_token = request.GET['oauth_token'] oauth_verifier = request.GET['oauth_verifier'] OAuthAuthorizeToken(oauth_token) OAuthGetAccessToken(oauth_token, oauth_verifier) #I need to add a Django return object but I am still debugging other phases. def OAuthGetRequestToken(): print '*** OUTPUT OAuthGetRequestToken ***' params = { 'oauth_consumer_key': OAUTH_CONSUMER_KEY, 'oauth_nonce': oauth.generate_nonce(), 'oauth_signature_method': 'HMAC-SHA1', 'oauth_timestamp': int(time.time()), #The timestamp should be expressed in number of seconds after January 1, 1970 00:00:00 GMT. 'scope': 'https://www.google.com/analytics/feeds/', 'oauth_callback': CALLBACK, 'oauth_version': '1.0' } # Sign the request. req = oauth.Request(method="GET", url=REQUEST_TOKEN_URL, parameters=params) req.sign_request(signature_method, consumer, None) tokens =client.request(req.to_url())[1] params = ConvertURLParamstoDictionary(tokens) request_token.key = params['oauth_token'] request_token.secret = params['oauth_token_secret'] return tokens def OAuthAuthorizeToken(oauth_token): print '*** OUTPUT OAuthAuthorizeToken ***' params ={ 'oauth_token' :oauth_token, 'hd': 'default' } req = oauth.Request(method="GET", url=AUTHORIZATION_URL, parameters=params) req.sign_request(signature_method, consumer, request_token) response =client.request(req.to_url()) print response #for debugging purposes def OAuthGetAccessToken(oauth_token, oauth_verifier): print '*** OUTPUT OAuthGetAccessToken ***' params = { 'oauth_consumer_key': OAUTH_CONSUMER_KEY, 'oauth_token': oauth_token, 'oauth_verifier': oauth_verifier, 'oauth_token_secret': request_token.secret, 'oauth_signature_method': 'HMAC-SHA1', 'oauth_timestamp': int(time.time()), 'oauth_nonce': oauth.generate_nonce(), 'oauth_version': '1.0', } req = oauth.Request(method="GET", url=ACCESS_TOKEN_URL, parameters=params) req.sign_request(signature_method, consumer, request_token) response =client.request(req.to_url()) print response return req def ConvertURLParamstoDictionary(tokens): params = {} tokens = tokens.split('&') for token in tokens: token = token.split('=') params[token[0]] = token[1] return params

    Read the article

  • Regular expression help

    - by user268375
    I need a regular expression for which: the string is alphanumeric and have exactly 6 characters in the first half followed by hyphen(optional) followed by optional 4 characters:(cannot have more than 4 characters in the second half) so any of the following is valid 11111A 111111-1 111111-yy yyyyy-989 yyyyyy-9090 I have ^[a-zA-Z0-9]{5}(-[a-zA-Z0-9]{1,3})?$ as the regex expression what if i want to add another condition stating that the first half cannot have all zeros and also the whole expression cannot have zeros so 00000 or 00000-000 is invalid

    Read the article

  • Make a Button Appear Focused When Not

    - by Bret
    The Find and Replace dialog in Visual Studio is a perfect example of what im trying to accomplish. Notice how the "Find what" text field has keyboard focus but the "Find Next" button appears bluish as if it has keyboard focus also even though it does not. How can I accomplish this myself? I've tried messing with FocusManager and Focus Scopes without much luck. I suspect i may be barking up the wrong tree? Any advice is appreciated! Thanks

    Read the article

  • Having trouble plugging jQuery FullCalendar into Squarespace page

    - by ellenchristine
    When I test the fullcalendar widget locally, it works fine. However, when I try to integrate it with Squarespace, it doesn't show up. Here is what is in my head tag: <link rel='stylesheet' type='text/css' href='storage/scripts/fullcalendar.css' /> <script type='text/javascript' src='storage/scripts/jquery.js'></script> <script type='text/javascript' src='storage/scripts/fullcalendar.js'></script> <script type='text/javascript'> $(document).ready(function() { // page is now ready, initialize the calendar... $('#calendar').fullCalendar({ aspectRatio:2 }) }); </script> I have this in my body tag: <div id="calendar" style="width:500px; height:330px; background-color:#CCCCCC;"></div> The div displays but the calendar doesn't appear at all. I can't figure out why this isn't working! The calendar should definitely fit in the div space (at least it does locally). I've used jQuery with Squarespace before, and I don't see where my error is.

    Read the article

  • Is boost shared_ptr <XXX> thread safe?

    - by sxingfeng
    I have a question about boost :: shared_ptr. There are lots of thread. class CResource { xxxxxx } class CResourceBase { public: void SetResource(shared_ptr<CResource> res) { m_Res = res; } shared_ptr<CResource> GetResource() { return m_Res; } private: shared_ptr<CResource> m_Res; } CResourceBase base; //---------------------------------------------- Thread A: while (true) { ...... shared_ptr<CResource> nowResource = base.GetResource(); nowResource.doSomeThing(); ... } Thread B: shared_ptr<CResource> nowResource; base.SetResource(nowResource); ... //----------------------------------------------------------- If thread A do not care the nowResource is the newest . Will this part of code have problem? I mean when ThreadB do not SetResource completely, Thread A get a wrong smart point by GetResource? Another question : what does thread-safe mean? If I do not care about whether the resource is newest, will the shared_ptr nowResource crash the program when the nowResource is released or will the problem destroy the shared_point?

    Read the article

  • How to detect if Safari is disabled on iPhone

    - by zorro2b
    How can you detect whether Safari has been disabled by parental controls on the iPhone? I know it is possible because the App X3Watch refuses to work until Safari is disabled. As far as I can see there is no api for the parental controls, so what technique can be used for this?

    Read the article

  • Isthere an equivalent in CDI(WELD) to Guice modules and Inject ?

    - by mP
    I like the way Guice makes it fairly straight forward to manually create your own modules each with their own bindings done in code. CDI on the other hand seems to rely more on magic rather than programmatic access to sest bindings. Am i wrong or how can one achieve the same effect with WELD. Any code sample would be appreciated...

    Read the article

  • Android Application Icon Change

    - by soclose
    Hi, Is it possible to change the android application icon at run time? I've read through Changing the application icon text dynamically in Android and How can i change an application icon programmatically in Android?. All answered can't. I use Android 1.6. Is there any way?

    Read the article

  • Refreshing a UITableView

    - by MihaiD
    I have a UITableView subclass and a UITableViewCell sublass that I'm using for cells. I'm bulding all my cells in advance and store them in an array from where I use them in cellForRowAtIndexPath. Aside from this I have a thread that loads some images in each cell, in the background. The problem is that the cells don't get refreshed as fast as the images are loaded. For example, if I don't scroll my table view, the first cells only get refreshed when all cells have been modified and the thread has exited. Any ideas on how I can effectively refresh my tableview/cell?

    Read the article

  • SQL Server Date Comparison Functions

    - by HighAltitudeCoder
    A few months ago, I found myself working with a repetitive cursor that looped until the data had been manipulated enough times that it was finally correct.  The cursor was heavily dependent upon dates, every time requiring the earlier of two (or several) dates in one stored procedure, while requiring the later of two dates in another stored procedure. In short what I needed was a function that would allow me to perform the following evaluation: WHERE MAX(Date1, Date2) < @SomeDate The problem is, the MAX() function in SQL Server does not perform this functionality.  So, I set out to put these functions together.  They are titled: EarlierOf() and LaterOf(). /**********************************************************                               EarlierOf.sql   **********************************************************/ /**********************************************************   Return the later of two DATETIME variables.   Parameter 1: DATETIME1 Parameter 2: DATETIME2   Works for a variety of DATETIME or NULL values. Even though comparisons with NULL are actually indeterminate, we know conceptually that NULL is not earlier or later than any other date provided.   SYNTAX: SELECT dbo.EarlierOf('1/1/2000','12/1/2009') SELECT dbo.EarlierOf('2009-12-01 00:00:00.000','2009-12-01 00:00:00.521') SELECT dbo.EarlierOf('11/15/2000',NULL) SELECT dbo.EarlierOf(NULL,'1/15/2004') SELECT dbo.EarlierOf(NULL,NULL)   **********************************************************/ USE AdventureWorks GO   IF EXISTS       (SELECT *       FROM sysobjects       WHERE name = 'EarlierOf'       AND xtype = 'FN'       ) BEGIN             DROP FUNCTION EarlierOf END GO   CREATE FUNCTION EarlierOf (       @Date1                              DATETIME,       @Date2                              DATETIME )   RETURNS DATETIME   AS BEGIN       DECLARE @ReturnDate     DATETIME         IF (@Date1 IS NULL AND @Date2 IS NULL)       BEGIN             SET @ReturnDate = NULL             GOTO EndOfFunction       END         ELSE IF (@Date1 IS NULL AND @Date2 IS NOT NULL)       BEGIN             SET @ReturnDate = @Date2             GOTO EndOfFunction       END         ELSE IF (@Date1 IS NOT NULL AND @Date2 IS NULL)       BEGIN             SET @ReturnDate = @Date1             GOTO EndOfFunction       END         ELSE       BEGIN             SET @ReturnDate = @Date1             IF @Date2 < @Date1                   SET @ReturnDate = @Date2             GOTO EndOfFunction       END         EndOfFunction:       RETURN @ReturnDate   END -- End Function GO   ---- Set Permissions --GRANT SELECT ON EarlierOf TO UserRole1 --GRANT SELECT ON EarlierOf TO UserRole2 --GO                                                                                             The inverse of this function is only slightly different. /**********************************************************                               LaterOf.sql   **********************************************************/ /**********************************************************   Return the later of two DATETIME variables.   Parameter 1: DATETIME1 Parameter 2: DATETIME2   Works for a variety of DATETIME or NULL values. Even though comparisons with NULL are actually indeterminate, we know conceptually that NULL is not earlier or later than any other date provided.   SYNTAX: SELECT dbo.LaterOf('1/1/2000','12/1/2009') SELECT dbo.LaterOf('2009-12-01 00:00:00.000','2009-12-01 00:00:00.521') SELECT dbo.LaterOf('11/15/2000',NULL) SELECT dbo.LaterOf(NULL,'1/15/2004') SELECT dbo.LaterOf(NULL,NULL)   **********************************************************/ USE AdventureWorks GO   IF EXISTS       (SELECT *       FROM sysobjects       WHERE name = 'LaterOf'       AND xtype = 'FN'       ) BEGIN             DROP FUNCTION LaterOf END GO   CREATE FUNCTION LaterOf (       @Date1                              DATETIME,       @Date2                              DATETIME )   RETURNS DATETIME   AS BEGIN       DECLARE @ReturnDate     DATETIME         IF (@Date1 IS NULL AND @Date2 IS NULL)       BEGIN             SET @ReturnDate = NULL             GOTO EndOfFunction       END         ELSE IF (@Date1 IS NULL AND @Date2 IS NOT NULL)       BEGIN             SET @ReturnDate = @Date2             GOTO EndOfFunction       END         ELSE IF (@Date1 IS NOT NULL AND @Date2 IS NULL)       BEGIN             SET @ReturnDate = @Date1             GOTO EndOfFunction       END         ELSE       BEGIN             SET @ReturnDate = @Date1             IF @Date2 > @Date1                   SET @ReturnDate = @Date2             GOTO EndOfFunction       END         EndOfFunction:       RETURN @ReturnDate   END -- End Function GO   ---- Set Permissions --GRANT SELECT ON LaterOf TO UserRole1 --GRANT SELECT ON LaterOf TO UserRole2 --GO                                                                                             The interesting thing about this function is its simplicity and the built-in NULL handling functionality.  Its interesting, because it seems like something should already exist in SQL Server that does this.  From a different vantage point, if you create this functionality and it is easy to use (ideally, intuitively self-explanatory), you have made a successful contribution. Interesting is good.  Self-explanatory, or intuitive is FAR better.  Happy coding! Graeme

    Read the article

  • Do I really need mod_security?

    - by Rob
    I'm doing a clean install of my server and I'm looking for some advice on whether or not I actually need the Apache mod_security module. I consider myself to be a bit security paranoid when it comes to my servers, but is it worth going through all the hassle to install and debug a new config of mod_security?

    Read the article

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