Daily Archives

Articles indexed Thursday March 18 2010

Page 7/133 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • MVVM Madness: Commands

    - by JP
    I like MVVM. I don't love it, but like it. Most of it makes sense. But, I keep reading articles that encourage you to write a lot of code so that you can write XAML and don't have to write any code in the code-behind. Let me give you an example. Recently I wanted to hookup a command in my ViewModel to a ListView MouseDoubleClickEvent. I wasn't quite sure how to do this. Fortunately, Google has answers for everything. I found the following articles: http://blog.functionalfun.net/2008/09/hooking-up-commands-to-events-in-wpf.html http://joyfulwpf.blogspot.com/2009/05/mvvm-invoking-command-on-attached-event.html http://sachabarber.net/?p=514 http://geekswithblogs.net/HouseOfBilz/archive/2009/08/27/adventures-in-mvvm-ndash-binding-commands-to-any-event.aspx http://marlongrech.wordpress.com/2008/12/13/attachedcommandbehavior-v2-aka-acb/ While the solutions were helpful in my understanding of commands, there were problems. Some of the aforementioned solutions rendered the WPF designer unusable because of a common hack of appending "Internal" after a dependency property; the WPF designer can't find it, but the CLR can. Some of the solutions didn't allow multiple commands to the same control. Some of the solutions didn't allow parameters. After experimenting for a few hours I just decided to do this: private void ListView_MouseDoubleClick(object sender, MouseButtonEventArgs e) { ListView lv = sender as ListView; MyViewModel vm = this.DataContext as MyViewModel; vm.DoSomethingCommand.Execute(lv.SelectedItem); } So, MVVM purists, please tell me what's wrong with this? I can still Unit test my command. This seems very practical, but seems to violate the guideline of "ZOMG... you have code in your code-behind!!!!" Please share your thoughts. Thanks in advance.

    Read the article

  • SPSiteDataQuery Returns Only One List Type At A Time

    - by Brian Jackett
    The SPSiteDataQuery class in SharePoint 2007 is very powerful, but it has a few limitations.  One of these limitations that I ran into this morning (and caused hours of frustration) is that you can only return results from one list type at a time.  For example, if you are trying to query items from an out of the box custom list (list type = 100) and document library (list type = 101) you will only get items from the custom list (SPSiteDataQuery defaults to list type = 100.)  In my situation I was attempting to query multiple lists (created from custom list templates 10001 and 10002) each with their own content types. Solution     Since I am only able to return results from one list type at a time, I was forced to run my query twice with each time setting the ServerTemplate (translates to ListTemplateId if you are defining custom list templates) before executing the query.  Below is a snippet of the code to accomplish this. SPSiteDataQuery spDataQuery = new SPSiteDataQuery(); spDataQuery.Lists = "<Lists ServerTemplate='10001' />"; // ... set rest of properties for spDataQuery   var results = SPContext.Current.Web.GetSiteData(spDataQuery).AsEnumerable();   // only change to SPSiteDataQuery is Lists property for ServerTemplate attribute spDataQuery.Lists = "<Lists ServerTemplate='10002' />";   // re-execute query and concatenate results to existing entity results = results.Concat(SPContext.Current.Web.GetSiteData(spDataQuery).AsEnumerable());   Conclusion     Overall this isn’t an elegant solution, but it’s a workaround for a limitation with the SPSiteDataQuery.  I am now able to return data from multiple lists spread across various list templates.  I’d like to thank those who commented on this MSDN page that finally pointed out the limitation to me.  Also a thanks out to Mark Rackley for “name dropping” me in his latest article (which I humbly insist I don’t belong in such company)  as well as encouraging me to write up a quick post on this issue above despite my busy schedule.  Hopefully this post saves some of you from the frustrations I experienced this morning using the SPSiteDataQuery.  Until next time, Happy SharePoint’ing all.         -Frog Out   Links MSDN Article for SPSiteDataQuery http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsitedataquery.lists.aspx

    Read the article

  • Office 2008 Mac Calendar Wizard

    - by radioactive21
    I remember Office 2004 had a calendar wizard so that I can generate monthly calendars for a range of months. Like print out calendars from Jan 2010 to July 2010. I cant seem to find the wizard or the function to create calendars in Office 2008.

    Read the article

  • SQL SERVER – Mirroring Configured Without Domain – The server network address TCP://SQLServerName:50

    - by pinaldave
    Regular readers of my blog will be aware of my friend who called me few days ago with very a funny SQL Problem SQL SERVER – SSMS Query Command(s) completed successfully without ANY Results. This time, it did not take long before he called me up with another interesting problem, although the issue he was facing this time was not that interesting and also very specific to him, however, he insisted me to share with all of you. Let us understand his situation at first. My friend is preparing for DBA exam Exam 70-450: PRO: Designing, Optimizing and Maintaining a Database Server Infrastructure using Microsoft SQL Server 2008 and for the same, he was trying to set up replication on his local laptop. He had installed two different instances of SQL Server on his computer and every time when he started the mirroring, it failed with common error message. The server network address “TCP://SQLServer:5023? cannot be reached or does not exist. Check the network address name and that the ports for the local and remote endpoints are operational. (Microsoft SQL Server, Error: 1418) Well, before he contacted me, he searched online and checked my article written on the error in mirroring. However, he tried all the four suggestions, but it did not solve his problem. He called me at a reasonable time of late evening (unlike last time, which was midnight!). I even tried all the seven different suggestions myself, as previously proposed in my article; however, none of them worked. While looking at closely at services, I noticed something very simple. He was running all the instances on ‘Network Services’. In fact, his computer was a stand-alone computer. There was no network at all. Also, there was no domain or any other advance network concepts implemented. I just changed services from ‘Network Services’ to ‘Local System’ as his SQL Server was running on his local system and there were no network services. This prompted to restart the services. As this was not the production server and his development machine, we restarted the services on the laptop (do not restart services on production server without proper planning). After changing the ‘services log on’ account to localsystem, when he attempted to reconfigure the mirroring it worked right away. As usually in production server, proper domains are configured and advance network concepts are implemented I had never faced this type of problem earlier. My friend insisted to post this solution to his situation, wherein there was no domain configured and setting up mirroring was throwing an error. According to him, this is bound to help people, like him, who are preparing for certification using single system. Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: Pinal Dave, SQL, SQL Authority, SQL Error Messages, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology Tagged: SQL Certifications, SQL Mirroring

    Read the article

  • HT create a new vector in data frame that takes correlation of existing vectors

    - by Milktrader
    I have a time series of two indexes, with each row representing the closing price on the same day. I'd like to go to row 30 and lookback over the last 30 'days' and calculate the pearson correlation. And then store that value in a new vector. Then, repeat the calculation for the entire time series. It is a trivial task in Excel, so I'm convinced it can be done in R. I don't know the method to use though.

    Read the article

  • How to deal with symbolic links when going between Linux and Windows?

    - by Jesse Beder
    I have a django project that runs on a Linux server, and I've been working on it both on Linux and OS X. I've noticed that some of the pages are a bit off, to put it politely, in Internet Explorer, and so I checked out the subversion repository on Windows and tried to run a local server. My media directory has symbolic links to all of the media from each different app, and obviously Windows doesn't know what to do with them. I could simply hard-copy or link everything manually in Windows, but then I wouldn't be able to check that in (since the site runs on a Linux server), so it'd be a pain in the neck. What is typically done in this case?

    Read the article

  • First Test Crashes using MSTEST with ASP.NET MVC 1

    - by Trey Carroll
    I'm trying to start using Unit Testing and I want to test the following Controller: public class AjaxController : Controller { ... public JsonResult RateVideo( int userRating, long videoId ) { string userName = User.Identity.Name; ... } } I have a created a TestClass with the following method: [ TestMethod public void TestRateVideo() { //Arrange AjaxController c = new AjaxController(); //Act JsonResult jr = c.RateVideo(1, 1); //Assert //Not implemented yet } I select debug and run the test. When the code reaches the 1st statement: string username = User.Identity.Name; Debugging stops and I am presented with a message that says that the test failed. Any guidance you can offer would be appreciated.

    Read the article

  • Passing youtube video id from video feed to flash

    - by Grant Anderson
    I'm working on a flash web application (Actionscript 2.0) for my honours project but am having trouble embedding youtube videos. Basically the user selects symbols which queries the youtube api with certain tags depending on the symbols chosenand a random video is then picked from the first 30 videos. I have this working using the following code: on (release) { url="http://gdata.youtube.com/feeds/api/videos?q=danger+passion&orderby=published&start-index="+random(30)+"&max-results=1&v=2" getURL(url); } but this just displays a webpage with a link to the youtube video. This is the code I'll be using as the foundations for the player: // create a MovieClip to load the player into var ytplayer:MovieClip = _root.createEmptyMovieClip("ytplayer", 1); // create a listener object for the MovieClipLoader to use var ytPlayerLoaderListener:Object = { onLoadInit: function() { // When the player clip first loads, we start an interval to // check for when the player is ready loadInterval = setInterval(checkPlayerLoaded, 250); } }; var loadInterval:Number; function checkPlayerLoaded():Void { // once the player is ready, we can subscribe to events, or in the case of // the chromeless player, we could load videos if (ytplayer.isPlayerLoaded()) { ytplayer.addEventListener("onStateChange", onPlayerStateChange); ytplayer.addEventListener("onError", onPlayerError); clearInterval(loadInterval); } } function onPlayerStateChange(newState:Number) { trace("New player state: "+ newState); } function onPlayerError(errorCode:Number) { trace("An error occurred: "+ errorCode); } // create a MovieClipLoader to handle the loading of the player var ytPlayerLoader:MovieClipLoader = new MovieClipLoader(); ytPlayerLoader.addListener(ytPlayerLoaderListener); // load the player ytPlayerLoader.loadClip("http://www.youtube.com/v/pv5zWaTEVkI", ytplayer); can anyone help me on how to get the id of the video (for example: pv5zWaTEVkI) from the feed? Or how to send a query from flash which will return the video url/id as opposed to the url of a feed. Any help would be much appreciated as my hand in rather soon. Thanks

    Read the article

  • Postgres user drop

    - by Grasper
    I am trying to drop a user: drop user testUser; I want to force this to work in a simple manner (Not a million calls)... How can I do this easily? I get this output: ERROR: role "testUser" cannot be dropped because some objects depend on it DETAIL: access to table main.tap_db_version access to table main.user_instance access to table main.target_type access to table main.status_code access to table main.state_space_profile access to table main.service_subscription access to table main.service_instance access to table main.sa_ordnance_weapon_type access to table main.operation access to table main.mission_class access to table main.map_symbol access to table main.ada_weapon_type access to table main.active_process access to table main.acft_type_00_only access to table main.abp_create_params access to table main.exercise access to table main.decl access to table main.data_set access to table main.cancellation_notice access to table main.ato_family_tree access to table main.apportionment_cat_cd access to table main.abp access to table main.alert_settings access to table main.alert_log access to table main.airspace_usage_category access to schema main access to view testUser.top_priority access to view testUser.target_ssm_msn_count access to view testUser.target_air_msn_count access to view testUser.sortie_sum access to view testUser.ref_info access to view testUser.preview_rmk_count access to view testUser.preview_pgm_las_count access to view testUser.preview_pgm_desi_count access to view testUser.preview_objective_count access to view testUser.preview_gfriend_count access to view testUser.preview_escort_msn_req access to view testUser.preview_chaff_data access to view testUser.preview_airmove_seg access to view testUser.preview_aircraft_total access to view testUser.offload_total access to view testUser.objective_count access to view testUser.fuel_planned access to view testUser.ew_data access to view testUser.dual access to view testUser.current_base_inventory access to view testUser.cell_total access to view testUser.asgn_sortie_sum access to view testUser.appor_sorties_planned access to view testUser.airmove_seg access to view testUser.aircraft_total access to view testUser.abp access to table testUser.req_msn_task access to table testUser.req_task_source_req access to table testUser.req_ssm_msn access to table testUser.req_ssm_source access to table testUser.req_msn access to table testUser.req_msn_warnings access to table testUser.req_air_msn access to table testUser.req_src_header access to table testUser.req_msn_ids access to table testUser.req_msn_comment access to table testUser.req_c2_msn access to table testUser.req_c2_source access to table testUser.req_ada_msn access to table testUser.req_ada_vertex access to table testUser.weather_forecast access to table testUser.weather_coords access to table testUser.weather_area access to table testUser.weapon_option access to table testUser.wag_activity access to table testUser.unit_remark access to table testUser.unit_location_turn access to table testUser.unit_iff access to table testUser.unit_coordination access to table testUser.unit_code access to table testUser.trace_point access to table testUser.tasking_agency access to table testUser.task_unit access to table testUser.target_type access to table testUser.tap_db_version access to table testUser.status_code access to table testUser.state_space_threat access to table testUser.state_space_profile access to table testUser.state_space access to table testUser.ssm_mission access to table testUser.spins_section_id access to table testUser.spins_codes access to table testUser.spins access to table testUser.unit_location access to table testUser.ship_target_request access to table testUser.service_subscription access to table testUser.service_instance access to table testUser.sa_ordnance_weapon_type access to table testUser.runway access to table testUser.restricted_codes access to table testUser.response_entity access to table testUser.residual_mission access to table testUser.request_objective access to table testUser.request and 194 other objects (see server log for list)

    Read the article

  • memristor is a new paradigm (fourth element in integrated circuits)? [closed]

    - by lsalamon
    The memristor will bring a new paradigm of programming, opened enormous opportunities to enable the machines to gain knowledge, creating a new paradigm toward the intelligence altificial. Do you believe that we are paving the way for the era of intelligent machines? More info about : Brain-like systems? "As for the human brain-like characteristics, memristor technology could one day lead to computer systems that can remember and associate patterns in a way similar to how people do. This could be used to substantially improve facial recognition technology or to provide more complex biometric recognition systems that could more effectively restrict access to personal information. These same pattern-matching capabilities could enable appliances that learn from experience and computers that can make decisions." [EDITED] The way is open. News on the subject Brain-Like Computer Closer to Realization

    Read the article

  • Memory Bandwidth Performance for Modern Machines

    - by porgarmingduod
    I'm designing a real-time system that occasionally has to duplicate a large amount of memory. The memory consists of non-tiny regions, so I expect the copying performance will be fairly close to the maximum bandwidth the relevant components (CPU, RAM, MB) can do. This led me to wonder what kind of raw memory bandwidth modern commodity machine can muster? My aging Core2Duo gives me 1.5 GB/s if I use 1 thread to memcpy() (and understandably less if I memcpy() with both cores simultaneously.) While 1.5 GB is a fair amount of data, the real-time application I'm working on will have have something like 1/50th of a second, which means 30 MB. Basically, almost nothing. And perhaps worst of all, as I add multiple cores, I can process a lot more data without any increased performance for the needed duplication step. But a low-end Core2Due isn't exactly hot stuff these days. Are there any sites with information, such as actual benchmarks, on raw memory bandwidth on current and near-future hardware? Furthermore, for duplicating large amounts of data in memory, are there any shortcuts, or is memcpy() as good as it will get? Given a bunch of cores with nothing to do but duplicate as much memory as possible in a short amount of time, what's the best I can do?

    Read the article

  • Accessing class member variables inside a BackgroundWorker's DoWork event handler, and other Backgro

    - by Justin
    Question 1 In the DoWork event handler of a BackgroundWorker, is it safe to access (for both reading and writing) member variables of the class that contains the BackgroundWorker? Is it safe to access other variables that are not declared inside the DoWork event handler itself? Obviously DoWork should not be accessing any UI objects of, say, a WinForms application, as the UI should only be updated from the UI thread. But what about accessing other (not UI-related) member variables? The reason why I ask is that I've seen the occasional comment come up while Googling saying that accessing member variables is not allowed. The only example I can find at the moment is a comment on this MSDN page, which says: Note, that the BGW can cause exceptions if it attempts to access or modify class level variables. All data must be passed to it by delegates and events. And also: NEVER. NEVER. Never try to reference variables not declared inside of DoWork. It may seem to work at times, but in reality you are just getting lucky. As far as I know, MSDN itself does not document any restrictions of this kind (although if I'm wrong, I'd appreciate a link). But comments like these do seem to pop up every now and again. (Of course if DoWork does access/modify a member variable that could be accessed/modified by the main thread at the same time, it is necessary to synchronise access to that field, eg by using a locking object. But the above quotes seem to require a blanket ban of accessing member variables, rather than just synchronising access!) Question 2 To make this into a more general question, are there any other (not documented?) restrictions that users of the BackgroundWorker should be aware of, aside from the above? Any "best practices", perhaps?

    Read the article

  • Do MSDTC and disaster recovery go together?

    - by DevDelivery
    Our application writes to multiple Sql Server databases within a distributed transaction. The Ops guys are saying that this messes up their disaster recovery plan because while the transactions on the live tables may commit at the same time, the log shipping on the separate databases happen at slightly different times. So in in a disaster recovery situation, there will be a few partial transactions. Is there a method for maintaining separate but synced databases in DR? Or do we have to re-design to relatively independent databases (or a single database)?

    Read the article

  • trace an asp.net website in production - c#/asp.net

    - by uno
    Is there a way that I can trace every method, basically a line trace, in an asp.net web site in production environment? I dont want to go about creating db logging for every line - i see an intermittent error and would like to see every line called and performed by the website per user.

    Read the article

  • Postback problem downloading zip file

    - by Chris Conway
    I've got a problem on a webforms application where a user selects some criteria from dropdowns on the page and hits a button on the page which calls this method: protected void btnSearch_Click(object sender, EventArgs e) They then click on button to download a zip file based on the criteria which calls this method: protected void btnDownload_Click(object sender, EventArgs e) In IE, they are prompted with the bar at the top of the browser that tells them "To help protect your security, Internet Explorer blocked this site from downloading files to your computer". When they click on that bar to download the file, it fires the btnSearch_Click event again. Response.ContentType and Response.AddHeader has been set up correctly. The problem is, that btnSearch appends criteria so basically it is being appended twice and causing problems. Is there something I can do to prevent this? This is a vs2008 web app using c# 3.5 for what it's worth. Thanks!

    Read the article

  • Web App Server hardware question. Which configuration?

    - by JBeckton
    I am pricing some new servers and I am not sure which configuration to get. The server will be running some web applications for our company. Some of them are ASP.Net sites and some are ColdFusion. The OS will be Win Server 2008 Web or Standard Edition. Do I need 2 processors or will a single quad core handle it? Xeon multi core Hyperthreading or non Hyperthreading? I am going 64bit so I can go higher than 4 Gigs of Ram. I am shopping at Dell and there are so many options, i do not want to get too much hardware and not use half of it because that would be a waste of money and I do not want to get too little and have to ask for more money to upgrade it later.

    Read the article

  • Correct way to treat iptables init failure?

    - by chris_l
    Hi, I'm initializing my iptables rules via /etc/network/if-pre-up.d/iptables, using iptables-restore. This works fine, but I'm a bit worried about what would happen, if that script failed for some reason (maybe the saved iptables file is corrupt or whatever). In case the script failed, I'd like to: Start up my network interfaces without any iptables rules Start up OpenSSH server But not any other services like web server, ... (and maybe stop running instances) Is there a good canonical way to do that? Going into a lower init stage? - I haven't done that in a long time, and I think a lot about init has changed in recent years (?) - which stage should I drop to, and would the OpenSSH server and my network interfaces still run? Thanks Chris (On Debian Lenny)

    Read the article

  • SCCM 2007 R2 Win 7 Deployment client restarting after WinPE boot

    - by JohnyV
    Hi, I have tried to deploy windows 7 through SCCM, I have it all setup. On the first deployment the PC boots into PXE gets an IP then loads the WinPE. It then shows a starting windows box. The box then disappears and after a few seconds the computer restarts. Any Ideas? Which logs should I be checking I have also tried to inject the drivers for that PCs network adapter but this didnt work.

    Read the article

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