Search Results

Search found 516 results on 21 pages for 'alan haggai alavi'.

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

  • Optimizing sparse dot-product in C#

    - by Haggai
    Hello. I'm trying to calculate the dot-product of two very sparse associative arrays. The arrays contain an ID and a value, so the calculation should be done only on those IDs that are common to both arrays, e.g. <(1, 0.5), (3, 0.7), (12, 1.3) * <(2, 0.4), (3, 2.3), (12, 4.7) = 0.7*2.3 + 1.3*4.7 . My implementation (call it dict) currently uses Dictionaries, but it is too slow to my taste. double dot_product(IDictionary<int, double> arr1, IDictionary<int, double> arr2) { double res = 0; double val2; foreach (KeyValuePair<int, double> p in arr1) if (arr2.TryGetValue(p.Key, out val2)) res += p.Value * val2; return res; } The full arrays have about 500,000 entries each, while the sparse ones are only tens to hundreds entries each. I did some experiments with toy versions of dot products. First I tried to multiply just two double arrays to see the ultimate speed I can get (let's call this "flat"). Then I tried to change the implementation of the associative array multiplication using an int[] ID array and a double[] values array, walking together on both ID arrays and multiplying when they are equal (let's call this "double"). I then tried to run all three versions with debug or release, with F5 or Ctrl-F5. The results are as follows: debug F5: dict: 5.29s double: 4.18s (79% of dict) flat: 0.99s (19% of dict, 24% of double) debug ^F5: dict: 5.23s double: 4.19s (80% of dict) flat: 0.98s (19% of dict, 23% of double) release F5: dict: 5.29s double: 3.08s (58% of dict) flat: 0.81s (15% of dict, 26% of double) release ^F5: dict: 4.62s double: 1.22s (26% of dict) flat: 0.29s ( 6% of dict, 24% of double) I don't understand these results. Why isn't the dictionary version optimized in release F5 as do the double and flat versions? Why is it only slightly optimized in the release ^F5 version while the other two are heavily optimized? Also, since converting my code into the "double" scheme would mean lots of work - do you have any suggestions how to optimize the dictionary one? Thanks! Haggai

    Read the article

  • CSS issue in IE

    - by Ayaz Alavi
    Hi, Me website contains drop down menus at the top right corner. Dropdwon is displayed fine but when I hover over elements of drop down then IE is causing issue on rendering them on the other hand Firefox is displaying the way i want. website is http://www.textsensor.com/test. Can anybody tell me what is causing IE issue on its menu. Here is the details. Each parent at top has child div which contains child elements in a ul. I am displaying them inline with width of div container fixed so that two of them are being displayed in one line. Each child li contains two images and an anchor in between. These two images are providing rounded corners whereas anchor contains span which contains text of sub-menu item. On mouseover on span I am showing its parent anchor sibling images through javascript and also setting its bg-image to white. Images are not aligned correctly and span tag got down about 10px from top on IE only. Javascript is listed below $("#jsddm li ul li a span").hover(function(){ $(this).parent().siblings("img").show(); $(this).parent().css("border-bottom", "#a00 5px double"); }, function(){ $(this).parent().siblings("img").hide(); $(this).parent().css("border-bottom", "none"); }); Cheers Ayaz Alavi

    Read the article

  • Rails: periodically use HEAD to check for page changes

    - by Chris
    I have a Rails app implementing a game, so it's expected that a player will leave a browser open at the game page. When player Alan takes an action himself, I use AJAX requests to update the game page Alan is viewing to reflect the new state. However, when another player (Bob) takes an action, I don't have (or want) a mechanism to push the change to Alan's view. I would like Alan's page to periodically poll the Rails server to find if there have been any changes since last reload, and to reload the page (either via a whole-page GET or an AJAX call) if not. In order to play nicely with caches and proxies, I'd like to do this by issuing a periodic HTTP HEAD request, get Rails to work out the timestamp of the last change (trivially available from my DB) and respond with that in the Last-Modified header; then have the client-side act on that timestamp. How can I go about doing this?

    Read the article

  • mysql true row merge... not just a union

    - by panofish
    What is the mysql I need to achieve the result below given these 2 tables: table1: +----+-------+ | id | name | +----+-------+ | 1 | alan | | 2 | bob | | 3 | dave | +----+-------+ table2: +----+---------+ | id | state | +----+---------+ | 2 | MI | | 3 | WV | | 4 | FL | +----+---------+ I want to create a temporary view that looks like this desired result: +----+---------+---------+ | id | name | state | +----+---------+---------+ | 1 | alan | | | 2 | bob | MI | | 3 | dave | WV | | 4 | | FL | +----+---------+---------+ I tried a mysql union but the following result is not what I want. create view table3 as (select id,name,"" as state from table1) union (select id,"" as name,state from table2) table3 union result: +----+---------+---------+ | id | name | state | +----+---------+---------+ | 1 | alan | | | 2 | bob | | | 3 | dave | | | 2 | | MI | | 3 | | WV | | 4 | | FL | +----+---------+---------+ First suggestion results: SELECT * FROM table1 LEFT OUTER JOIN table2 USING (id) UNION SELECT * FROM table1 RIGHT OUTER JOIN table2 USING (id) +----+---------+---------+ | id | name | state | +----+---------+---------+ | 1 | alan | | | 2 | bob | MI | | 3 | dave | WV | | 2 | MI | bob | | 3 | WV | dave | | 4 | FL | | +----+---------+---------+

    Read the article

  • Matte or non-widescreen laptop? Do they exist?

    - by Alan Harris-Reid
    Does anyone know of any matte-screen laptops being sold now (15.6 or 17") in the UK? All I can find is the Dell Vostro 3500/3700 range, but there is a premium of around £200 over the price of their Inspiron range (for the 17" model), and I find it hard justifying the extra cost just to have a matte screen. I do not like glossy screens, but it seems the laptop industry has gone the way of "glossy is better - let's get rid of matte". I have read and heard from other developers that as long as there are no strong light sources to reflect off the screen, one can soon get used to a glossy screen, but I am yet to be convinced. I would also be interested if anyone knows of any non 16:9 screen laptops. I find this ratio too wide and not high-enough for the work I do. 16:10 or lower would be better. Any opinions would be appreciated. Alan

    Read the article

  • Does laser printer use toner when switched on/off?

    - by Alan Harris-Reid
    I have recently purchased a HP LaserJet M175nw laser printer which goes into sleep-mode after 10 minutes of non-use. I know sleep-mode uses a very small amount of power, but the flashing light on the control panel is driving me nuts! I know I can turn-off the printer via. the on/off button, but when it is turned-on manually, there is some whirring sound which I guess might be the machine warming-up. My question is... Is any toner used during this warm-up (or cleaning) cycle? Am I better-off keeping the printer in sleep mode, or is it ok to turn off manually? TIA Alan

    Read the article

  • Excluding certain file types in wget

    - by Alan Spark
    I have been using wget for a while now to mirror files from an ftp server to a local folder. My wget command is as follows: wget -mirror -w 1 -p -nH -P /var/www/ ftp://my-ftp-server However, I just noticed that it is copying over a .listing file for every folder that it visits. So, even if nothing has been changed on the ftp server, a .listing file will always be copied. My understanding is that the .listing file is created when wget opens the ftp session. Is there a way to avoid this? I've tried the -R option (e.g. -R .listing) but this didn't help. See: http://www.gnu.org/software/wget/manual/wget.html#Recursive-Accept_002fReject-Options Thanks, Alan

    Read the article

  • Syncing Large Directories/Filesystems using USB Drive [closed]

    - by Alan Lue
    Does anyone have a solution for syncing large directories/filesystems using just a USB flash drive (and specifically without using a network connection)? The objective is simply to sync a user directory between two computers. The contents of the user directory could amount to a large quantity of data—say, a quantity larger than could be stored on any single USB drive—but the aggregate size of changes that must be propagated by a single sync could easily fit on a USB drive. As an example, suppose a user directory is already synchronized between a desktop and a laptop computer. Here's a use case: Some changes are made in the user directory on the desktop. We mount a USB drive onto the desktop and copy whatever changes need to be applied to the laptop user directory in order to synchronize the desktop and laptop user directories. We now mount the USB drive onto the laptop and apply the changes. The desktop and laptop user directories are now synchronized. Any ideas? Alan

    Read the article

  • How can I persist certificates in Java's cacerts?

    - by Alan Spark
    We need to have a certificate in Java's cacerts keystore for one of our servers that is authenticated by LDAP. We are using Ubuntu server. We have successfully done this by updating the cacerts file in /usr/lib/jvm/java-6-openjdk-amd64/jre/lib/security but occasionally a Java update is installed and the cacerts file seems to be getting replaced by a default one that doesn't contain our changes. This doesn't happen very often but it is becoming a bit of a pain when it does happen. Is there a better way of adding things to cacerts so that they don't get lost when a Java update happens? Thanks, Alan

    Read the article

  • Windows XP SP3 dissapearing mapped drives

    - by Alan Spark
    I am running Windows XP Pro SP3 and I've got a few shares on my NAS that are mapped to reconnect automatically. I can access the drives soon after starting windows but after a period of inactivity I get the error "The local device name is already in use". This cannot be remedied until I restart the computer - I've tried disconnecting and re-mapping without success. This was working fine until I recently reinstalled Windows and I'm not sure what is going on. Any help would be greatly appreciated. Thanks, Alan

    Read the article

  • Syncing Large Directories/Filesystems using USB Drive

    - by Alan Lue
    Does anyone have a solution for syncing large directories/filesystems using just a USB flash drive (and specifically without using a network connection)? The objective is simply to sync a user directory between two computers. The contents of the user directory could amount to a large quantity of data—say, a quantity larger than could be stored on any single USB drive—but the aggregate size of changes that must be propagated by a single sync could easily fit on a USB drive. As an example, suppose a user directory is already synchronized between a desktop and a laptop computer. Here's a use case: Some changes are made in the user directory on the desktop. We mount a USB drive onto the desktop and copy whatever changes need to be applied to the laptop user directory in order to synchronize the desktop and laptop user directories. We now mount the USB drive onto the laptop and apply the changes. The desktop and laptop user directories are now synchronized. Any ideas? Alan

    Read the article

  • Silverlight Cream for April 21, 2010 -- #843

    - by Dave Campbell
    In this Issue: Alan Beasley, Roboblob, SilverLaw, Mike Snow, and Chris Koenig. Shoutouts: Ozymandias has a discussion up: The Three Pillars of Xbox Live on Windows Phone John Papa announced that Silverlight 4 is now on WebPI: Get Silverlight 4 – Simplified! Dan Wahlin posted the code and material from DevConnections: Code from my DevConnections Talks and Workshop Tim Heuer has a good deal posted from GoDaddy: Get a Silverlight XAP signing certificate for cheap thanks to GoDaddy From SilverlightCream.com: ListBox Styling (Part2-ControlTemplate) in Expression Blend & Silverlight Alan Beasley is back with part 2 of his ListBox styling tutorial adventure in Expression Blend... this looks like some of the stuff I was getting close to in Win32 a bunch of years back... great stuff... thanks Alan! Unit Testing Modal Dialogs in MVVM and Silverlight 4 Roboblob responds to some feedback with an expansion on his previous post with the addition of some Unit Testing. ChildWindowResizeBehavior - Silverlight 4 Blend 4 RC design time support SilverLaw has a short post about a behavior he has available at the Expression Gallery that resizes a child window with the Mouse Wheel, and also has Design-time support in Blend. Tip of the Day #111 – How to Configure your Silverlight App to run in Elevated Trust Mode Mike Snow has his latest tip up, and this one is on both ends of of the Elevated Trust Mode of OOB ... how to set it, and what your user experience is like. WP7 Part 2 – Working with Data Chris Koenig has part 2 of his WP7 exploration up ... he's tackling Nerd Dinner and pulling down Odata. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • format dojo DataGrid header row

    - by Alan Seiden
    I want to assign a background color to my programmatically created Dojo DataGrid's header row. I've tried to override the defaults by adding .dojoxGridHeader or .dojoxGrid-Header to my style sheet, but these have no effect. Is there another way, such as with a Dojo event or property? If my style sheet is the only way to go, am I using the wrong class? Thanks! Alan

    Read the article

  • CDN Rerouting on 404 (file not yet in synch with original storage)

    - by Alan Ristic
    Here is the problem. I've setup my app(on EC2) to store uploaded images directly on Amazon S3. I'd like to be able to serve static files(cdn) from my 'home' server so I wrote script that does sync from S3. But there is a window of (at least) one minute in synch. Now I see two solutions on the problem of pics not been available on 'home' server here: 1.I write script on EC2 (where the app resides) to fetch from DB pics that have status of "not-yet-synch", which is default state when user uploads picture. The script then does a ping to picture and if it gets OK response, updates DB from "not-yet-synch" to "synch". 2.Prefered solution would be to let apache (in this case) redirect request for an image if it sees 404 (e.g. doesent find image requested) to S3. This way I wouldn't need script from solution 1. So what approach do you suggest I take in solving this redundancy problem? Or what is practice in production environments? To further clarify; I'd like so serve images first from 'home' server, if that fails serve them from S3. Tnx, Alan

    Read the article

  • Understanding VS2010 C# parallel profiling results

    - by Haggai
    I have a program with many independent computations so I decided to parallelize it. I use Parallel.For/Each. The results were okay for a dual-core machine - CPU utilization of about 80%-90% most of the time. However, with a dual Xeon machine (i.e. 8 cores) I get only about 30%-40% CPU utilization, although the program spends quite a lot of time (sometimes more than 10 seconds) on the parallel sections, and I see it employs about 20-30 more threads in those sections compared to serial sections. Each thread takes more than 1 second to complete, so I see no reason for them to work in parallel - unless there is a synchronization problem. I used the built-in profiler of VS2010, and the results are strange. Even though I use locks only in one place, the profiler reports that about 85% of the program's time is spent on synchronization (also 5-7% sleep, 5-7% execution, under 1% IO). The locked code is only a cache (a dictionary) get/add: bool esn_found; lock (lock_load_esn) esn_found = cache.TryGetValue(st, out esn); if(!esn_found) { esn = pData.esa_inv_idx.esa[term_idx]; esn.populate(pData.esa_inv_idx.datafile); lock (lock_load_esn) { if (!cache.ContainsKey(st)) cache.Add(st, esn); } } lock_load_esn is a static member of the class of type Object. esn.populate reads from a file using a separate StreamReader for each thread. However, when I press the Synchronization button to see what causes the most delay, I see that the profiler reports lines which are function entrance lines, and doesn't report the locked sections themselves. It doesn't even report the function that contains the above code (reminder - the only lock in the program) as part of the blocking profile with noise level 2%. With noise level at 0% it reports all the functions of the program, which I don't understand why they count as blocking synchronizations. So my question is - what is going on here? How can it be that 85% of the time is spent on synchronization? How do I find out what really is the problem with the parallel sections of my program? Thanks.

    Read the article

  • C# wrapper for objects

    - by Haggai
    I'm looking for a way to create a generic wrapper for any object. The wrapper object will behave just like the class it wraps, but will be able to have more properties, variable, methods etc., for e.g. object counting, caching etc. Say the wrapper class be called Wrapper, and the class to be wrapped be called Square and has the constructor Square(double edge_len) and the properties/methods EdgeLength and Area, I would like to use it as follows: Wrapper<Square> mySquare = new Wrapper<Square>(2.5); /* or */ new Square(2.5); Console.Write("Edge {0} -> Area {1}", mySquare.EdgeLength, mySquare.Area); Obviously I can create such a wrapper class for each class I want to wrap, but I'm looking for a general solution, i.e. Wrapper<T> which can handle both primitive and compound types (although in my current situation I would be happy with just wrapping my own classes). Suggestions? Thanks.

    Read the article

  • How to build a client to Google wave

    - by Haggai
    Hi, By looking at current Google wave APIs, I can't find a way to create an alternative client. It's not a robot or gadget, and the embed API is very slim. Nevertheless, I do see some clients out there - such as Waver and Waveboard. How do they do it ? is it based on XMPP ?

    Read the article

  • Cisco IPSec, nat, and port forwarding don't play well together

    - by Alan
    I have two Cisco ADSL modems configured conventionally to nat the inside traffic to the ISP. That works. I have two port forwards on one of them for SMTP and IMAP from the outside to the inside this provides external access to the mail server. This works. The modem doing the port forwarding also terminates PPTP VPN traffic. There are two DNS servers one inside the office which resolves mail to the local address, one outside the office which resolves mail for the rest of the world to the external interface. That all works. I recently added an IPSec VPN between the two modems and that works for every thing EXCEPT connections over the IPSec VPN to the mail server on port 25 or 143 from workstations on the remote lan. It would seem that the modem with the port forwards is confusing traffic from the mail server destined for a machine on the other side of the IPSec VPN for traffic that should go back to a port forward connection. PPTP VPN traffic to the mail server is fine. Is this a scenario anybody is familiar with and are there any suggestions on how to work around it? Many thanks Alan But wait there is more..... This is the strategic parts of the nat config. A route map is used to exclude the lans that are reachable via IPSec tunnels from being Nated. int ethernet0 ip nat inside int dialer1 ip nat outside ip nat inside source route-map nonat interface Dialer1 overload route-map nonat permit 10 match ip address 105 access-list 105 remark *** Traffic to NAT access-list 105 deny ip 192.168.1.0 0.0.0.255 192.168.9.0 0.0.0.255 access-list 105 deny ip 192.168.1.0 0.0.0.255 192.168.48.0 0.0.0.255 access-list 105 permit ip 192.168.1.0 0.0.0.255 any ip nat inside source static tcp 192.168.1.241 25 interface Dialer1 25 ip nat inside source static tcp 192.168.1.241 143 interface Dialer1 143 At the risk of answering my own question, I resolved this outside the Cisco realm. I bound a secondary ip address to mail server 192.168.1.244, changed the port forwards to use it while leaving all the local and IPSec traffic to use 192.168.1.241 and the problem was solved. New port forwards. ip nat inside source static tcp 192.168.1.244 25 interface Dialer1 25 ip nat inside source static tcp 192.168.1.244 143 interface Dialer1 143 Obviously this is a messy solution and being able to fix this in the Cisco would be preferable.

    Read the article

  • Architectural advice - web camera remote access

    - by Alan Hollis
    I'm looking for architectural advice. I have a client who I've built a website for which essentially allows users to view their web cameras remotely. The current flow of data is as follows: User opens page to view web camera image. Javascript script polls url on server ( appended with unique timestamp ) every 1000ms Ftp connection is enabled for the cameras ftp user. Web camera opens ftp connection to server. Web camera begins taking photos. Web camera sends photo to ftp server. On image url request: Server reads latest image on hard drive uploaded via ftp for camera. Server deleted any older images from the server. This is working okay at the moment for a small amount of users/cameras ( about 10 users and around the same amount of cameras), but we're starting to worrying about the scalability of this approach. My original plan was instead of having the files read from the server, the web server would open up an ftp connection to the web server and read the latest images directly from there meaning we should have been able to scale horizontally fairly easily. But ftp connection establishment times were too slow ( mainly due to the fact that PHP out of the ox is unable to persist ftp connections ) and so we abandoned this approach and went straight for reading from the hard drive. The firmware provider for the cameras state they're able to build a http client which instead of using ftp to upload the image could post the image to a web server. This seems plausible enough to me, but I'm looking for some architectural advice. My current thought is a simple Nginx/PHP/Redis stack. Web camera issues post requests of latest image to Nginx/PHP and the latest image for that camera is stored in Redis. The clients can then pull the latest image from Redis which should be extremely quick as the images will always be stored in memory. The data flow would then become: User opens page to view web camera image. Javascript script polls url on server ( appended with unique timestamp ) every 1000ms Camera is sent an http request to start posting images to a provided url Web camera begins taking photos. Web camera sends post requests to server as fast as it can On image url request: Server reads latest image from redis Server tells redis to delete later image My questions are: Are there any greater overheads of transferring images via HTTP instead of FTP? Is there a simple way to calculate how many potential cameras we could have streaming at once? Is there any way to prevent potentially DOS'ing our own servers due to web camera requests? Is Redis a good solution to this problem? Should I abandon PHP/Ngix combination and go for something else? Is this proposed solution actually any good? Will adding HTTPs to the mix cause posting the image to become too slow? Thanks in advance Alan

    Read the article

  • ASP.NET MVC and mixed mode authentication

    - by Alan T
    Hi All I have a scenario whereby I require users to be able to authenticate against an ASP.NET MVC web application using either Windows authentication or Forms authentication. If the user is on the internal network they will use Windows authentication and if they are connecting externally they will use Forms authentication. I’ve seen quite a few people asking the question how do I configure an ASP.NET MVC web application for this, but I haven’t found a complete explanation. Please can someone provide a detailed explanation, with code examples, on how this would be done? Thanks. Alan T

    Read the article

  • SQLite data-types

    - by Alan Harris-Reid
    Hi there, When creating a table in SQLite3, I get confused when confronted with all the possible datatypes which imply similar contents, so could anyone tell me the difference between the following data-types? INT, INTEGER, SMALLINT, TINYINT DEC, DECIMAL LONGCHAR, LONGVARCHAR DATETIME, SMALLDATETIME Is there some documentation somewhere which lists the min./max. capacities of the various data-types? For example, I guess smallint holds a larger maximum value than tinyint, but a smaller value than integer, but I have no idea of what these capacities are. Any help would be appreciated. Alan Harris-Reid

    Read the article

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