Search Results

Search found 5718 results on 229 pages for 'apply'.

Page 141/229 | < Previous Page | 137 138 139 140 141 142 143 144 145 146 147 148  | Next Page >

  • google collections ordering on map values

    - by chris-gr
    I would like to order a map based on the values. Function<Map.Entry<A, Double>, Double> getSimFunction = new Function<Map.Entry<A, Double>, Double>() { public Double apply(Map.Entry<A, Double> entry) { return entry.getValue(); } }; final Ordering<Map.Entry<A, Double>> entryOrdering = Ordering.natural().onResultOf(getSimFunction); ImmutableSortedMap.orderedBy(entryOrdering).putAll(....).build(); How can I create a new sortedMap based on the ordering results or a sortedset based on the map.keyset()?

    Read the article

  • Any experience with the Deliverance system ?

    - by e-satis
    My new boss went to a speech where Deliverance, a kind of proxy allowing to add skin to any html output on the fly, was presented. He decided to use it right after that, no matter how young it is. More here : http://www.openplans.org/projects/deliverance/introduction In theory, the system sounds great when you want a newbie to tweak your plone theme without having to teach him all the complex mechanisms behind the zope products. And apply the same theme on a Drupal web site in one row. But I don't believe in theory, and would like to know if anybody tried this out in the real world :-)

    Read the article

  • Can't detect MIME type when using Zend Zend_File_Transfer_Adapter_Http !

    - by mrblue
    Hi all, I am writing a small script to upload and detect MIME type, using Zend Framework. For the design purpose, I can't use Zend_Form but normal instead. And I simply apply from the manual : $adapter = new Zend_File_Transfer_Adapter_Http(); $files = $adapter-getFileInfo(); $mime = $files-getMimeType(); But the system inform that the funcion getMimeType() does not existed. Then, I tried: $adapter = new Zend_File_Transfer(); $files = $adapter-getFileInfo(); $mime = $files-getMimeType(); This time, it didn't work either. So, how can I get the MIME type ? Thank you so much for your help

    Read the article

  • Redirect before rewrite

    - by Kirk Strobeck
    Had an issue where I need to redirect old URLs, but not disable the mod_rewrite for page structure. redirect 301 /home.html http://www.url.com/ It needs to live on the Symphony 2.0 .htaccess file ### Symphony 2.0.x ### Options +FollowSymlinks -Indexes <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / ### DO NOT APPLY RULES WHEN REQUESTING "favicon.ico" RewriteCond %{REQUEST_FILENAME} favicon.ico [NC] RewriteRule .* - [S=14] ### IMAGE RULES RewriteRule ^image\/(.+\.(jpg|gif|jpeg|png|bmp))$ extensions/jit_image_manipulation/lib/image.php?param=$1 [L,NC] ### CHECK FOR TRAILING SLASH - Will ignore files RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !/$ RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^(.*)$ $1/ [L,R=301] ### ADMIN REWRITE RewriteRule ^symphony\/?$ index.php?mode=administration&%{QUERY_STRING} [NC,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^symphony(\/(.*\/?))?$ index.php?symphony-page=$1&mode=administration&%{QUERY_STRING} [NC,L] ### FRONTEND REWRITE - Will ignore files and folders RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*\/?)$ index.php?symphony-page=$1&%{QUERY_STRING} [L] </IfModule> ######

    Read the article

  • Floating images with multiple sizes in CSS

    - by Jamie Chapman
    I'm wanting to be able to create a banner of floating images based on what are uploaded via users. The tool needs to have images of 50x50 and 100x100. At the moment, I just want to randomly display the images and tried to apply float:left. However, as you can see below - it leaves gaps. Is there an easy way to do this without programatically positioning the images? If you want the code so far, it's here: .wall { width: 300px; background-color: red; display: table; } .wall img { float: left; } and <div class="wall"> <img src="man1.png" alt=""/> <!-- ETC... !--> </div>

    Read the article

  • Compute rolling window covariance matrix

    - by user1665355
    I am trying to compute a rolling window (shifting by 1 day) covariance matrix for a number of assets. Say my df looks like this: df <- data.frame(x = 0:4, y = 5:9,z=1:5,u=4:8) How would a possible for loop look like if I want to calculate a covariance matrix on a rolling basis by shifting the rolling window by 1 day? Or should I use some apply family function? What time series class would be preferrable if I want to create a time series object for the loop above? I simply can't get it... Best Regards

    Read the article

  • Jquery: How can I Get/Set html of a String Variable by using Jquery Selectors ?

    - by ryan.dingy
    Hi all. Firstly, sorry for my English (I'm from China). By reading this article(http://stackoverflow.com/questions/2421719/how-to-apply-jquery-element-selection-to-a-string-variable), I can successfully get Elements from a String which stores HTML text. For example: var htmlstr = "<div><ul><li>some text 1</li></ul></div><div><ul id=list><li>some text 2</li></ul></div>"; var s = $('ul#list', $(htmlstr)).html(); s will be <li>some text 2</li>. It's what I want. But the question is, if I want to add another LI element to this string (htmlstr) how can I do? I set s = new html string but htmlstr doesn't change. Thanks

    Read the article

  • Errors in Decimal Calcs within def clean method?

    - by allanhenderson
    I'm attempting a few simple calculations in a def clean method following validation (basically spitting out a euro conversion of retrieved uk product price on the fly). I keep getting a TypeError. Full error reads: Cannot convert {'product': , 'invoice': , 'order_discount': Decimal("0.00"), 'order_price': {...}, 'order_adjust': None, 'order_value': None, 'DELETE': False, 'id': 92, 'quantity': 8} to Decimal so I guess django is passing through the entire cleaned_data form to Decimal method. Not sure where I'm going wrong - the code I'm working with is: def clean_order_price(self): cleaned_data = self.cleaned_data data = self.data order_price = cleaned_data.get("order_price") if not order_price: try: existing_price = ProductCostPrice.objects.get(supplier=data['supplier'], product_id=cleaned_data['product'], is_latest=True) except ProductCostPrice.DoesNotExist: existing_price = None if not existing_price: raise forms.ValidationError('No match found, please enter new price') else: if data['invoice_type'] == 1: return existing_price.cost_price_gross elif data['invoice_type'] == 2: exchange = EuroExchangeRate.objects.latest('exchange_date') calc = exchange.exchange_rate * float(existing_price.cost_price_gross) calc = Decimal(str(calc)) return calc return cleaned_data If the invoice is of type 2 (a euro invoice) then the system should grab the latest exchange rate and apply that to the matching UK pound price pulled through to get euro result. Should performing a decimal conversion be a problem within def clean method? Thanks

    Read the article

  • Adding name and id properties to textarea (struts)

    - by reg3n
    Hi, i mostly do CSS and php so i'm kind'a lost here, so no idea if this is possible the way i want it anyway, this is it: I have this code <html:textarea rows="10" cols="70" property="thankYouMessage" /> And i want this textarea to render an id of "textareaID" and a name like "textareaname" how can i go about this?... if i use styleID, the page just won't load anymore... i need to apply some css to that markup so that's the thing. Thanks in advance!

    Read the article

  • How to bind value to its parent element value?

    - by KentZhou
    Silverlight provides element to element binding. How to apply it this is case: I have a xaml as below: <TextBlock Text="{Binding ABC}" > <ToolTipService.ToolTip> <local:MyControl Title="{Binding ...}" /> </ToolTipService.ToolTip> </TextBlock> I want to bind MyControl Title to the same data as its parent Textblock Text, but I don't want set x:Name for its parent Textblock. I know there is one solution to bind Title to same data source: <local:MyControl Title="{Binding ABC}" /> This may cause two times to call "{Binding ABC}", with my case, there ValurConverter for this binding. I don't want to use this way.

    Read the article

  • PHP Code- How to check duplicate entries in Mysql Database

    - by yash bhavnani
    Hi guys, I am working on Google checkout API notification URL. I want to apply a check in my php code which will see if transaction ID present in transaction table of my DB, it will exit not process. I am struggling into applying here. Can somebody help? I want to check if trasaction ID exists in table of DB it will exit, it will not process: *case "new-order-notification": $sql = "update transactions set remote_trans_id=\"".$_REQUEST["google-order-number"]."\", updated=now() where id=".$_REQUEST["shopping-cart_items_item-1_merchant-item-id"]." "; execute($sql, $conn); break;* Regards

    Read the article

  • multiple rows of a single table

    - by Amanjot Singh
    i am having a table with 3 col. viz id,profile_id,plugin_id.there can be more than 1 plugins associated with a single profile now how can i fetch from the database all the plugins associated with a profile_id which comes from the session variable defined in the login page when I try to apply the query for the same it returns the data with the plugin_id of the last record the query is as follows SqlCommand cmd1 = new SqlCommand("select plugin_id from profiles_plugins where profile_id=" + Convert.ToInt32(Session["cod"]), con); SqlDataReader dr1 = cmd1.ExecuteReader(); if (dr1.HasRows) { while (dr1.Read()) { Session["edp1"] = Convert.ToInt32(dr1[0]); } } dr1.Close(); cmd1.Dispose();

    Read the article

  • Microsoft learning support for VS2010

    - by John
    OK, I am a big fan of WPF, and while it is large area to fully understand, Microsoft has been great in posting loads of training video at http://windowsclient.net/learn/videos_wpf.aspx However with the release of 2010 it all seams to have gone very quiet. I expected a lot of the support to be updated for 2010 and I also expected a lot of new videos on the best way to use the new features in 2010. Currently I find myself working through videos based on 2008 (or even 2005) and trying to apply them to 2010. Don't get me wrong it not that I mind doing this, it just that I fear I may be learning methods which have better or different solutions in 2010. It is just me expecting too much of Microsoft, or have I missed out on a new website?

    Read the article

  • Better name needed for applying a function on elements of a container

    - by stefaanv
    I have a container class (containing a multi-index container) for which I have a public "foreach" member-function, so users can pass a functor to apply on all elements. While implementing, I had a case where the functor should only be applied to some elements of a range in the container, so I overloaded the foreach, to pass some valid range. Now, in some cases, it was worthwhile to stop on a certain condition, so practically, I let the foreach stop based on the return-value of the function. I'm pleased with how the system works, but I have one concern: How should a "foreach" on a range, with stop conditions be called? Anyone knows a generic, clear and concise name?

    Read the article

  • Where is the chink in Google Chrome's armor?

    - by kudlur
    While browsing with Chrome, I noticed that it responds extremely fast (in comparison with IE and Firefox on my laptop) in terms of rendering pages, including JavaScript heavy sites like gmail. This is what googlebook on Chrome has to say tabs are hosted in process rather than thread. compile javascript using V8 engine as opposed to interpreting. Introduce new virtual machine to support javascript heavy apps introduce "hidden class transitions" and apply dynamic optimization to speed up things. Replace inefficient "Conservative garbage colllection" scheme with more precise garbage collection scheme. Introduce their own task scheduler and memory manager to manage the browser environment. All this sounds so familiar, and Microsoft has been doing such things for long time.. Windows os, C++, C# etc compilers, CLR, and so on. So why isn't Microsoft or any other browser vendor taking Chrome's approach? Is there a flaw in Chrome's approach? If not, is the rest of browser vendor community caught unaware with Google's approach?

    Read the article

  • MDX filter members in a sum-function

    - by Radagast2005
    I have an SSAS cube containing customers and their purchased memberships (let's say magazines). I want to calculate the retention. I.e. how many customers remain a customer. To do this I specify a set (males, 30yrs, 1 january 2011). I want to see if this set - identified by a customer number - is still present in the following months. I named my set MySet2. What I try to do is: sum(measures.amount, [membership].[name].&[X], MySet2, [date].[date].currentmember) However, the result is incorrect. The number is far to low. I suspect it still tries to account for all the males of 30 years old, but after a year they're not 30 anymore. What am I missing? I looked at scope and filter, but I'm not sure how to apply it.

    Read the article

  • Select calls seems to not time out.

    - by martsbradley
    HI Folks, I have a threaded C++ program where up to three threads are calling select on a three separate socket descriptors waiting for data to become available. Each thread handles one socket and adds it to the readfds with a timeout of 300 seconds. After select returns if there is data available I'm calling recv to read it. Is there anything that I need to be aware of with winsock and threads because for some reason after a number of hours the select calls all seem to be not timing out. Can a multi threaded program select from a number of threads without issue? I know that I should have one thread listening to all three sockets however that would be a large change for this app and I'm only looking to apply a bug fix. cheers, Martin.

    Read the article

  • Does django take SCRIPT_NAME into account when using the default LOGIN_URL

    - by DanJ
    Hi, I'm using Django 1.0.2 and trying to figure out how to get the @login_required working correctly. When I use the built-in server it redirects to the default login_url, or my LOGIN_URL as defined in settings.py as expected. What is not clear to me is how to deploy to the server where my site is not at the root. In my templates I use the url template tag, and in the views I can access request.META['SCRIPT_NAME'], but for some reason it doesn't seem to apply to the LOGIN_URL used. What am I missing? Thanks.

    Read the article

  • acl.allow not working in mercurial

    - by sagar
    When I am trying to apply some authentication in .hg/hgrc file on Ubuntu machine its not working. I have added below code to hgrc file on Ubuntu [web] allow_push=* allow_read=* push_ssl =false [hooks] pretxnchangegroup.acl=python:hgext.acl.hook [acl.allow] /home/test/testrepository/*=myid When I am pushing some data from my Windows repository to testrepository on Ubuntu giving below message pushing to http://ubantuip:8000 searching for changes remote: adding changesets remote: adding manifests remote: adding file changes remote: added 1 changesets with 1 changes to 1 files remote: error: pretxnchangegroup.acl hook failed: acl: access denied for changes et 69f00e372c67 remote: transaction abort! remote: rollback completed remote: abort: acl: access denied for changeset 69f00e372c67 why I am not able to push the changes?

    Read the article

  • byte-sized bit pattern in C and its relevance?

    - by Nikunj Banka
    I a reading Kerninghan and Ritchie's C programming language book and on page 37 it mentions byte sized bit patterns like : '\013' for vertical tab . '\007' for bell character . My doubts : What is byte sized in it and and what's a bit pattern ? What relevance does this hold and where can I apply it ? Is it in any sense related to escape sequences ? I can't seem to find any information what so ever about these byte sized bit patterns on the web . please help . thanks .

    Read the article

  • mapping list of different types implementing same function?

    - by sisif
    I want to apply a function to every element in a list (map) but the elements may have different types but all implement the same function (here "putOut") like an interface. However I cannot create a list of this "interface" type (here "Outputable"). How do I map a list of different types implementing the same function? main :: IO () main = do map putOut lst putStrLn "end" where lst :: [Outputable] -- ERROR: Class "Outputable" used as a type lst = [(Out1 1),(Out2 1 2)] class Outputable a where putOut :: a -> IO () -- user defined: data Out1 = Out1 Int deriving (Show) data Out2 = Out2 Int deriving (Show) instance Outputable Out1 where putOut out1 = putStrLn $ show out1 instance Outputable Out2 where putOut out2 = putStrLn $ show out2 I cannot define it this way: data Out = Out1 Int | Out2 Int Int putOut Out1 = ... putOut Out2 = ... because this is a library and users should be able to extend Out with their own types

    Read the article

  • How to write syntax highlighting? c++

    - by ML
    Hi All, I am embarking on some learning and I want to write my own syntax highlighting for files in C++. Can anyone give me ideas on how to go about doing this? To me it seems that when a file is opened: 1. it would need to be parsed and decided what type of source file it is. Trusting the extension might not be full-proof a way to know what keywords/commands apply to what language a way to decide what color each keyword/command gets I want to do this on OS X, C++ or Objective-C Can anyone provide pointers on how I might get started with this?

    Read the article

  • Stable separation for two classes of elements in an array

    - by AndreyT
    Consider the following problem. We are given an array of elements belonging to one two classes: either red or blue. We have to rearrange the elements of the array so that all blue elements come first (and all red elements follow). The rearrangement must be done is stable fashion, meaning that the relative order of blue elements must be preserved (same for red ones). Is there a clever algorithm that would perform the above rearrangement in-place? A non-in place solution is, of course, straightforward. An obvious in-place solution would be to apply any stable sorting algorithm to the array. However, using a full-fledged sorting algorithm on an array intuitively feels like an overkill, especially taking into account the fact that we are only dealing with two classes of elements. Any ideas greatly appreciated.

    Read the article

  • R get rid of rows with duplicate attribute

    - by CatholicEvangelist
    hi there I have a big dataframe with columns such as: ID, time, OS, IP Each row of that dataframe corresponds to one entry. Within that dataframe for some IDs serveral entries (rows) exist. I would like to get rid of those multiple rows (obviously the other attributes will differ for the same ID). Or put different: I only want one single entry (row) for each ID. Could anyone be so kind and help me out on this one? When I use unique, on the ID column, I only recieve the levels (or each unique ID), but I want to keep the other attributes as well... I have tried to use apply(x,2,unique(data$ID)), but this does not work either... Any help is highly appreciated!

    Read the article

  • UIAcceleration filtering

    - by Ilya
    Hi, I found the following piece of code in apple guidelines: - (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration { //Use a basic low-pass filter to only keep the gravity in the accelerometer values accel[0] = acceleration.x * kFilteringFactor + accel[0] * (1.0 - kFilteringFactor); accel[1] = acceleration.y * kFilteringFactor + accel[1] * (1.0 - kFilteringFactor); accel[2] = acceleration.z * kFilteringFactor + accel[2] * (1.0 - kFilteringFactor); } What does it exactly do? What is this low-pass filter? Why do I have to apply it? Thank you in advance.

    Read the article

< Previous Page | 137 138 139 140 141 142 143 144 145 146 147 148  | Next Page >