Daily Archives

Articles indexed Tuesday June 15 2010

Page 15/118 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • jQuery image preload/cache halting browser

    - by Nathan Loding
    In short, I have a very large photo gallery and I'm trying to cache as many of the thumbnail images as I can when the first page loads. There could be 1000+ thumbnails. First question -- is it stupid to try to preload/cache that many? Second question -- when the preload() function fires, the entire browser stops responding for a minute to two. At which time the callback fires, so the preload is complete. Is there a way to accomplish "smart preloading" that doesn't impede on the user experience/speed when attempting to load this many objects? The $.preLoadImages function is take from here: http://binarykitten.me.uk/dev/jq-plugins/107-jquery-image-preloader-plus-callbacks.html Here's how I'm implementing it: $(document).ready(function() { setTimeout("preload()", 5000); }); function preload() { var images = ['image1.jpg', ... 'image1000.jpg']; $.preLoadImages(images, function() { alert('done'); }); } 1000 images is a lot. Am I asking too much?

    Read the article

  • How to exclude a particular package form a dependancy?

    - by asela38
    When specifing a dependancies using ant ivy, is there a way to exclude a particular package? eg: I am putting a dependency to MyJar.jar it has packages com.test.one com.test.one.first com.test.one.second com.test.two etc. i want to exclude the package com.text.one.first if there is a way, how can i do that?

    Read the article

  • Home key press behaviour

    - by Arnab
    While developing a sample android application i have constructed two activities 1)Activity 1 2)Activity 2 Now Activity 2 is the foreground activity whereas Activity 1 is the background one. Now user presses Home key. The application(i.e. both the activities) dissappear. Now is we relaunch the application we see Activity 1 as the foreground activity. My question is: 1)Does the platform maintain any history entry when pressed home key? 2)How do we take the user to the last launch activity on relaunching the application?

    Read the article

  • iphone tabbar with custom buttons and scrollvie

    - by chunjai
    i'm trying to get a tab bar effect not unlike russel quinn's 'creative review' app. the tabbar swipes across, which i have figured out, but the tabbar style itself is unlike anything i've seen on the iphone (though it looks so simple!). it has square buttons with a space between, and each button has a select/active/inactive state. i'm having a hard time seeing how this can be tabbar, but i don't know any other way. can someone explain this? here's the example :: http://bit.ly/c8CeBC. any help is appreciated.

    Read the article

  • How to implement a simple queue properly?

    - by Stephen Hsu
    The current Go library doesn't provide the queue container. To implement a simple queue, I use circle array as the underlying data structure. It follows algorithms mentioned in TAOCP: Insert Y into queue X: X[R]<-Y; R<-(R+1)%M; if R=F then OVERFLOW. Delete Y from queue X: if F=R then UNDERFLOW; Y<-X[F]; F<-(F+1) % M. F: Front, R: Rear, M: Array length. Following is the code: package main import ( "fmt" ) type Queue struct { len int head, tail int q []int } func New(n int) *Queue { return &Queue{n, 0, 0, make([]int, n)} } func (p *Queue) Enqueue(x int) bool { p.q[p.tail] = x p.tail = (p.tail + 1) % p.len return p.head != p.tail } func (p *Queue) Dequeue() (int, bool) { if p.head == p.tail { return 0, false } x := p.q[p.head] p.head = (p.head + 1) % p.len return x, true } func main() { q := New(10) for i := 1; i < 13; i++ { fmt.Println(i, q.Enqueue(i)) } fmt.Println() for i := 1; i < 13; i++ { fmt.Println(q.Dequeue()) } } But the output is obviously wrong: 1 true 2 true 3 true 4 true 5 true 6 true 7 true 8 true 9 true 10 false 11 true 12 true 11 true 12 true 0 false 0 false 0 false 0 false 0 false 0 false 0 false 0 false 0 false 0 false I think I need one more field to make the code work properly. What do you suggest?

    Read the article

  • Calculating Screen Resolutions Using WPF

    - by Jeff Ferguson
    WPF measures all elements in device independent pixels (DIPs). These DIPs equate to device pixels if the current display monitor is set to the default of 96 DPI. However, for monitors set to a DPI setting that is different than 96 DPI, then WPF DIPs will not correspond directly to monitor pixels. Consider, for example, the WPF properties SystemParameters.PrimaryScreenHeight and SystemParameters.PrimaryScreenWidth. If your monitor resolution is set to 1024 pixels wide by 768 pixels high, and your monitor is set to 96 DPI, then WPF will report the value of SystemParameters.PrimaryScreenHeight as 768 and the value of SystemParameters.PrimaryScreenWidth as 1024. No problem. This aligns nicely because the WPF device independent pixel value (96) matches your monitor's DPI setting (96). However, if your monitor is not set to display pixels at 96 DPI, then SystemParameters.PrimaryScreenHeight and SystemParameters.PrimaryScreenWidth will not return what you expect. The values returned by these properties may be greater than or less than what you expect, depending on whether or not your monitor's DPI value is less than or greater than 96. Since the SystemParameters.PrimaryScreenHeight and SystemParameters.PrimaryScreenWidth properties are WPF properties, their values are measured in WPF DIPs, rather than taking monitor DPI into effect. Once again: WPF measures all elements in device independent pixels (DIPs). To combat this issue, you must take your monitor's DPI settings into effect if you're looking for the monitor's width and height using the monitor's DPI settings. The handy code block below will help you calculate these values regardless of the DPI setting on your monitor: Window MainWindow = Application.Current.MainWindow; PresentationSource MainWindowPresentationSource = PresentationSource.FromVisual(MainWindow); Matrix m = MainWindowPresentationSource.CompositionTarget.TransformToDevice; DpiWidthFactor = m.M11; DpiHeightFactor = m.M22; double ScreenHeight = SystemParameters.PrimaryScreenHeight * DpiHeightFactor; double ScreenWidth = SystemParameters.PrimaryScreenWidth * DpiWidthFactor; The values of ScreenHeight and ScreenWidth should, after this code is executed, match the resolution that you see in the display's Properties window.

    Read the article

  • Putting shortcuts onto user's machines using AD

    - by Rod
    I just handled a small task, which I would like to automate through Active Directory. We’ve written a few Intranet applications which get used a lot here. Occasionally someone will have to go to the front desk and work on something there, while one of the receptionists are away. They’ll always call us to have us put a shortcut onto their desktop linking to these Intranet applications. It’s just a bit of a nuisance, and I’m sure that AD could be used to automate creating shortcuts on user’s desktops pointing to our Intranet applications. The only thing is, I don’t know how to do this, and being a small shop that we are, we don’t have a system administrator at this time. So, how do we automate the creation of desktop shortcuts to websites, using AD in a Windows 2003 Server environment?

    Read the article

  • Lazy loading the addthis script? (or lazy loading external js content dependent on already fired eve

    - by Keith Bentrup
    I want to have the addthis widget available for my users, but I want to lazy load it so that my page loads as quickly as possible. However, after trying it via a script tag and then via my lazy loading method, it appears to only work via the script tag. In the obfuscated code, I see something that looks like it's dependent on the DOMContentLoaded event (at least for firefox). Since the DOMContentLoaded event has already fired, the widget doesn't render properly. What to do? I could just use a script tag (slower)... or could I fire (in a cross browser way) the DOMContentLoaded (or equivalent) event? I have a feeling this may not be possible b/c I believe that (like jQuery) there are multiple tests of the content ready event, and so multiple simulated events would have to occur. Nonetheless, this is an interesting problem b/c I have seen a couple widgets now assume that you are including their stuff via static script tags. It would be nice if they wrote code that was more useful to developers concerned about speed, but until then, is there a work around?? And/or are any of my assumptions wrong? Edit: Because the 1st answer to the question seemed to miss the point of my problem, I wanted to clarify the situation. This is about a specific problem. I'm not looking for yet another lazy load script or check if some dependencies are loaded script. Specifically this problem deals with external widgets that you do not have control over and may or may not be obfuscated delaying the load of the external widgets until they are needed or at least, til substantially after everything else has been loaded including other deferred elements b/c of the how the widget was written, precludes existing, typical lazy loading paradigms While it's esoteric, I have seen it happen with a couple widgets - where the widget developers assume that you're just willing to throw in another script tag at the bottom of the page. I'm looking to save those 500-1000 ms** though as numerous studies by yahoo, google, and amazon show it to be important to your user's experience. **My testing with hammerhead and personal experience indicates that this will be my savings in this case.

    Read the article

  • JQuery invert table selection

    - by Lars Tackmann
    I have page part like this <div id="inbox"> <h1>Headline</h1> <p>First paragraph</p> <table> <tbody> <tr> <td>table stuff</td> </tr> </tbody> </table> <p>Second paragraph</p> </div> I want to assign a handler to everything within the #inbox div that is not a part (a child) of the table. I tried to do something like $('#inbox:not(:has(table))').click(function(){ alert('hello inbox'); }); But that does not work, so how do I invert the selection of the table inside the #inbox ?

    Read the article

  • Ruby class variable is reset after rails app initialized

    - by Phuong Nguy?n
    I tried to assign a class static variable like this class QueryLogger < Logger @@query_logger_default_instance = nil def self.default_instance # Use global variable because static variable doesn't work @@query_logger_default_instance ||= self.new(STDOUT) end end In initializers folder of my rails app, I added a file with this code block ActiveRecord::Base.logger = QueryLogger.default_instance In a request (action of controller), I make a call to this: QueryLogger.default_instance. My assumption is that the call to default_instance will always report the same. However, it does not. Now I try to watch stuff in NetBeans by setting breakpoint inside default_instance. Thing happen as expected, the default_instance get called twice, one due to the initializer block and one due to the call to my action. Surprising thing is, in both times, @@query_logger_default_instance report nil inside NetBeans inspector. The first nil report is correct, but the second shocked me. It's look like static variable gets reset after rails app initialized. Is there some magic there?

    Read the article

  • aws-s3 can't find xml-simple, but in gem list

    - by Dan Donaldson
    I'm transitioning to heroku, and need to have AWS-s3 connections to deal with a variety of graphics. I've installed the aws-s3 gem, but one of its dependencies is not being found: xml-simple. My belief is that this is a standard part of RoR, and it is in the gem list. When I deploy to heroku, all is fine, but on my development server, it isn't being found when the code uses it to check the existence of a graphic. It works fine from the console, using s3sh. I'm not quite sure why this is -- what do I need to check? Using OS X 10.6, on a 64 bit machine -- can this be part of it?

    Read the article

  • Implementing Communication Protocols on CC2420 motes powered by TinyOS

    - by stanigator
    I would like to load TinyOS on CC2420 radio motes to operate on certain communication protocols (e.g. epidemic routing, probabilistic routing, etc.). However, I have no prior experience in programming motes to perform the protocols I want. I'm just wondering about the most applicable resources for reference and how difficult (if not impossible) was implementing such mentioned protocols. It would be great to hear from you. Thanks in advance!

    Read the article

  • PHP/Codeigniter processing a list with javascript

    - by user270797
    I have a list of items that the user can select. I want it to be more user friendly than standard checkboxes so I have seperate div's each with a unique id. When user clicks an item, I use javascript to display a tick on top of that item and change the style to show that it is highlighted. Im trying to work out how I can pass the list of id's when the form is submitted. Remember, if the user unticks an item, it should be removed from the list, I was thinking of using comma seperated values in a hidden text field but couldnt work out how to remove items from the start of the list if they were deselected

    Read the article

  • gwt get array button value

    - by graybow
    My gwt project have flexTable show data of image and button on each row and coll. But my button won't work properly. this is my current code: private Button[] b = new Button[]{new Button("a"),...,new Button("j")}; private int z=0; ... public void UpdateTabelGallery(JsArray str){ for(int i=0; i str.length(); i++){ b[i].setText(str.gettitle()); UpdateTabelGallery(str.get(i)); } } public void UpdateTabelGallery(GalleryData str){ Image img = new Image(); img.setUrl(str.getthumburl()); HTML himage= new HTML("a href="+str.geturl()+""+ img +"/a" + b[z] ); TabelGaleri.setWidget(y, x, himage); //is here th right place? b[z].addClickHandler(new ClickHandler(){ @Override public void onClick(ClickEvent event) { Window.alert("I wan to show the clicked button text" + b[z].getText()); } }); z++; } I'm still confuse where I should put my button handler. With this current code seems the clickhandler didn't work inside a looping. And if I put it outside loop its not working because I need to know which button clicked. I need to get my index button.but how? Is there any option than array button? thanks

    Read the article

  • Hidden features of WPF and XAML?

    - by Sauron
    Here is a large number of hidden features discussed for variety of languages. Now I am curious about some hidden features of XAML and WPF? One I have found is the header click event of a ListView <ListView x:Name='lv' Height="150" GridViewColumnHeader.Click="GridViewColumnHeaderClickedHandler"> The GridViewColumnHeader.Click property is not listed. Some of relevant features so far: Multibinding combined with StringFormat TargetNullValue to bindings TextTrimming property Markup extensions Adding Aero effect to Window Advanced "caption" properties XAML Converters See also: Hidden features of C# Hidden features of Python Hidden features of ASP.NET Hidden features of Perl Hidden features of Java Hidden features of VB.NET Hidden features of PHP Hidden features of Ruby Hidden features of C And So On........

    Read the article

  • Modeling complex hierarchies

    - by jdn
    To gain some experience, I am trying to make an expert system that can answer queries about the animal kingdom. However, I have run into a problem modeling the domain. I originally considered the animal kingdom hierarchy to be drawn like -animal -bird -carnivore -hawk -herbivore -bluejay -mammals -carnivores -herbivores This I figured would allow me to make queries easily like "give me all birds", but would be much more expensive to say "give me all carnivores", so I rewrote the hierarchy to look like: -animal -carnivore -birds -hawk -mammals -xyz -herbivores -birds -bluejay -mammals But now it will be much slower to query "give me all birds." This is of course a simple example, but it got me thinking that I don't really know how to model complex relationships that are not so strictly hierarchical in nature in the context of writing an expert system to answer queries as stated above. A directed, cyclic graph seems like it could mathematically solve the problem, but storing this in a relational database and maintaining it (updates) would seem like a nightmare to me. I would like to know how people typically model such things. Explanations or pointers to resources to read further would be acceptable and appreciated.

    Read the article

  • How to use UIWebView to get scrolling text ?

    - by srikanth rongali
    Hi, In my iPhone application I need a scrolling text. I had the text to be displayed and scrolled up and down but I could not get customized text. I mean all the text is of same font. I need some different font size text . I am using UITextView, but UITextView do not support customized text in it. How can I have the scrolling text which has different font size. I read that to use UIWebView for this. But, I could not understand how to use it. the text contains no url's no editing.(It need to be just static text to read). How can I do this ? Thank you.

    Read the article

  • When is it worth using a BindingSource?

    - by Justin
    I think I understand well enough what the BindingSource class does - i.e. provide a layer of indirection between a data source and a UI control. It implements the IBindingList interface and therefore also provides support for sorting. And I've used it frequently enough, without too many problems. But I'm wondering if I use it more often than I should. Perhaps an example would help. Let's say I have just a simple textbox on a form (using WinForms), and I'd like to bind that textbox to a simple property inside a class that returns a string. Is it worth using a BindingSource in this situation? Now let's say I have a grid on my form, and I'd like to bind it to a DataTable. Should I use a BindingSource now? In the latter case, I probably would not use a BindingSource, as a DataTable, from what I can gather, provides the same functionality that the BindingSource itself would. The DataTable will fire the the right events when a row is added, deleted, etc so that the grid will automatically update. But in the first case with the textbox being bound to a string, I would probably have the class that contains the string property implement INotifyPropertyChanged, so that it could fire the PropertyChanged event when the string changes. I would use a BindingSource so that it could listen to these PropertyChanged events so that it could update the textbox automatically when the string changes. How does this sound so far? I still feel like there's a gap in my understanding that's preventing me from seeing the whole picture. This has been a pretty vague question so far, so I'll try to ask some more specific questions - ideally the answers will reference the above examples or something similar... (1) Is it worth using a BindingSource in either of the above examples? (2) It seems that developers just "assume" that the DataTable class will do the right thing, in firing PropertyChanged events at the right time. How does one know if a data source is capable of doing this? Is there a particular interface that a data source should implement in order for developers to be able to assume this behaviour? (3) Does it matter what Control is being bound to, when considering whether or not to use a BindingSource? Or is it only the data source that should affect the decision? Perhaps the answer is (and this would seem logical enough): the Control needs to be intelligent enough to listen to the PropertyChanged events, otherwise a BindingSource is required. So how does one tell if the Control is capable of doing this? Again, is there a particular interface that developers can look for that the Control must implement? It is this confusion that has, in the past, led to me always using a BindingSource. But I'd like to understand better exactly when to use one, so that I do so only when necessary.

    Read the article

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