Daily Archives

Articles indexed Saturday January 8 2011

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

  • Is there a more efficent way to randomise a set of linq results?

    - by Matthew De'Loughry
    Hi just wondering if you could help I've produced a function to get back a random set of submission depnding on the amount passed to it, but I worry that even though it works now with a small amount of data when the a large amount is passed through it would become efficent and cause problems. Just wondering if you could suggest a more efficent way of doing the following: public List<Submission> GetRandomWinners(int id) { List<Submission> submissions = new List<Submission>(); int amount = (DbContext().Competitions .Where(s => s.CompetitionId == id).FirstOrDefault()).NumberWinners; for(int i = 1 ; i <= amount; i++) { bool added = false; while (!added) { bool found = false; var randSubmissions = DbContext().Submissions .Where(s => s.CompetitionId == id && s.CorrectAnswer).ToList(); int count = randSubmissions.Count(); int index = new Random().Next(count); foreach (var sub in submissions ) { if (sub == randSubmissions.Skip(index).FirstOrDefault()) found = true; } if (!found) { submissions.Add(randSubmissions.Skip(index).FirstOrDefault()); added = true; } } } return submissions; } As I say I have this fully working and bringing back the wanted result just I'm not liking the foreach and while checks in there and my head has just turned to mush now try to come up with the above soloution. Thanks Matt

    Read the article

  • iphone how to customize UITableViewCell cell.textlabel and cell.detailtextlabel programmatically

    - by Prerak
    Hi! In my iPhone App In table view cell I want to dispaly one main title and 5 subtitlessubtitles suppose item1 as main title and item2 , item3 , item4 , item5 and item6 as subtitles, for that i have saperate two arrays for passing the values in table view cell one for cell.textLabel.text= second for cell.detailTextLabel.text now I want the flexibility to make item2 as maintitle and want to add item1 to subtitle How can I set title and subtitle programmatically from single array? and any of them as Please Help and Suggest, Thank You.

    Read the article

  • SEO: A whois server that work for .SE domains?

    - by Niels Bosma
    I'm developing a small domain checker and I can't get .SE to work: public string Lookup(string domain, RecordType recordType, SeoToolsSettings.Tld tld) { TcpClient tcp = new TcpClient(); tcp.Connect(tld.WhoIsServer, 43); string strDomain = recordType.ToString() + " " + domain + "\r\n"; byte[] bytDomain = Encoding.ASCII.GetBytes(strDomain.ToCharArray()); Stream s = tcp.GetStream(); s.Write(bytDomain, 0, strDomain.Length); StreamReader sr = new StreamReader(tcp.GetStream(), Encoding.ASCII); string strLine = ""; StringBuilder builder = new StringBuilder(); while (null != (strLine = sr.ReadLine())) { builder.AppendLine(strLine); } tcp.Close(); if (tld.WhoIsDelayMs > 0) System.Threading.Thread.Sleep(tld.WhoIsDelayMs); return builder.ToString(); } I've tried whois servers whois.nic-se.se and whois.iis.se put I keep getting: # Copyright (c) 1997- .SE (The Internet Infrastructure Foundation). # All rights reserved. # The information obtained through searches, or otherwise, is protected # by the Swedish Copyright Act (1960:729) and international conventions. # It is also subject to database protection according to the Swedish # Copyright Act. # Any use of this material to target advertising or # similar activities is forbidden and will be prosecuted. # If any of the information below is transferred to a third # party, it must be done in its entirety. This server must # not be used as a backend for a search engine. # Result of search for registered domain names under # the .SE top level domain. # The data is in the UTF-8 character set and the result is # printed with eight bits. "domain google.se" not found. Edit: I've tried changing to UTF8 with no other result. When I try using whois from sysinternals I get the correct result, but not with my code, not even using SE.whois-servers.net. /Niels

    Read the article

  • Thou shalt not put code on a piedestal - Code is a tool, no more, no less

    - by Ralf Westphal
    “Write great code and everything else becomes easier” is what Paul Pagel believes in. That´s his version of an adage by Brian Marick he cites: “treat code as an end, not just a means.” And he concludes: “My post-Agile world is software craftsmanship.” I wonder, if that´s really the way to go. Will “simply” writing great code lead the software industry into the light? He´s alluding to the philosopher Kant who proposed, a human beings should never be treated as a means, but always as an end. But should we transfer this ethical statement into the world of software? I doubt it.   Reason #1: Human beings are categorially different from code. They are autonomous entities who need to find a way of living happily together. To Kant it seemed this goal could only be reached if nobody (ab)used a human being for his/her purposes. Because using a human being, i.e. treating it as a means, would contradict the fundamental autonomy and freedom of human beings. People should hold up a symmetric view of their relationships: Since nobody wants to be (ab)used, nobody should (ab)use anybody else. If you want to be treated decently, with respect, in accordance with your own free will - which means as an end - then do the same to other people. Code is dead, it´s a product, it´s a tool for people to reach their goals. No company spends any money on code other than to save money or earn money in the long run. Code is not a puppy. Enterprises do not commission software development to just feel good in its company. Code is not a buddy. Code is a slave, if you will. A mechanical slave, a non-tangible robot. Code is a tool, is a tool. And if we start to treat it differently, if we elevate its status unduely… I guess that will contort our relationship in a contraproductive way. Please get me right: Just because something is “just a tool”, “just a product” does not mean we should not be careful while designing, building, using it. Right to the contrary. We should be very careful when writing code – but not for the code´s sake! We should be careful because we respect our customers who are fellow human beings who should be treated as an end. If we are careless, neglectful, ignorant when producing code on their behalf, then we´re using them. Being sloppy means you´re caring more for yourself that for your customer. You´re then treating the customer as a means to fulfill some of your own needs. That´s plain unethical behavior.   Reason #2: The focus should always be on your purpose, not on any tool. But if code is treated as an end, then the focus is on the code. That might sound right, because where else should be your focus as a software developer? But, well, I´d say, your focus should be on delivering value to your customer. Because in the end your customer does not care if you write a single line of code. She just wants her problem to be solved. Solving problems is the purpose of any contractor. Code must be treated just as a means, a tool we know how to handle very well. But if we´re really trying to be craftsmen then we should be conscious about exactly that and act ethically. That means we must never be so focused on our tool as to be unable to suggest better solutions to the problems of our customers than code.   I´m all with Paul when he urges us to “Write great code”. Sure, if you need to write code, then by all means do so. Write the best code you can think of – and then try to improve it. Paul has all the best intentions when he signs Brians “treat code as an end” - but as we all know: “The road to hell is paved with best intentions” ;-) Yes, I can imagine a “hell of code focus”. In fact, I don´t need to imagine it, I´m seeing it quite often. Because code hell is whereever two developers stand together and are so immersed in talking about all sorts of coding tricks, design patterns, code smells, technologies, platforms, tools that they lose sight of the big picture. Talking about TDD or SOLID or refactoring is a sign of consciousness – relative to the “cowboy coders” view of the world. But from yet another point of view TDD, SOLID, and refactoring are just cures for ailments within a system. And I fear, if “Writing great code” is the only focus or the main focus of software development, then we as an industry lose the ability to see that. Focus draws a line around something, it defines a horizon for perceptions and thinking. So if we focus on code our horizon ends where “the land of code” ends. I don´t think that should be our professional attitude.   So what about Software Craftsmanship as the next big thing after Agility? I think Software Craftsmanship has an important message for all software developers and beyond. But to make it the successor of the Agility movement seems to miss a point. Agility never claimed to solve all software development problems, I´d say. So to blame it for having missed out on certain aspects of it is wrong. If I had to summarize Agility in one word I´d say “Value”. Agility put value for the customer back in software development. Focus on delivering value early and often – that´s Agility´s mantra. All else follows from that. And I ask you: Is that obsolete? Is delivering value not hip anymore? No, sure not. That´s our very purpose as software developers. So how can Agility become obsolete and need to be replaced? We need to do away with this “either/or”-thinking. It´s either Agility or Lean or Software Craftsmanship or whatnot. Instead we should start integrating concepts and movements. Think “both/and”. Think Agility plus Software Craftsmanship plus Lean plus whatnot. We don´t neet to tear down anything from a piedestal and replace it with a new idol. Instead we should do away with piedestals and arrange whatever is helpful is a circle. Then we can turn to concepts, movements for whatever they are best. After 10 years of Agility we should be able to identify what it was good at – and keep that. Keep Agility around and add whatever Agility was lacking or never concerned with. Add whatever is at the core of Software Craftsmanship. Add whatever is at the core of Lean etc. But don´t call out the age of Post-Agility. Because it better never will end. Because once we start to lose Agility´s core we´re losing focus of the customer.

    Read the article

  • IIS: redirect everything to another URL, except for one Directory

    - by DrStalker
    I have an IIS server (IIS 6, Win 2003) that hosts the site http://www.foo.com. I want any request to http://foo.com (no matter what path/filename is used) to redirect to http://www.bar.org/AwesomePage.html UNLESS the request is for http://www.foo.com/specialdir, in which case the HTML files in the local directory specialdir should be used. The problem I have is once the redirect is set it also affects /specialdir - even if I right click on that directory and select "content should come from ... local directory" that change does not take effect, and the directory still shows as redirecting to http://www.bar.org/AwesomePage.html. The same thing happens if I try to set individual files to load from the local system instead of redirecting - IIS gives no error, but the change does not take effect and the files still show as being redirected. How can I set specialdir to override the redirection to the new URL?

    Read the article

  • Apache port forwarding with ZTE ZXV10 W300 router (provider specific firmware)

    - by dannote
    I'm trying to configure port forwarding for Apache 2.2 installed on Windows XP SP3 with ZTE ZXV10 W300 router. The computer has a static IP 192.168.1.2. Port forwarding is configured as following: Enable true Name Apache Protocol TCP (also tried TCP and UPD) WAN Host Start IP Address empty WAN Host End IP Address empty WAN Connection stream WAN Start Port 8080 WAN End Port 8080 LAN Host IP Address 192.168.1.2 LAN Host Start Port 8080 LAN Host End Port 8080 Port 8080 is open for both TCP and UPD in Windows Brandmauer. Apache configuration: Listen 192.168.1.2:8080 Router Firmware: Hardware Version V1.0.01 Software Version V8.0.02T03_CFA Boot Loader Version V1.1.2 The provider is COMSTAR. I'm not sure but it's said they flash routers with modified firmware. I have also tried to set up Bitcomet port forwarding on port 13514 and failed.

    Read the article

  • MySQL/Apache: Replace spaces with underscores only in certain URLs

    - by javipas
    I'm having a problem with some images I'm using on my WordPress blog. After a migration I renamed every image replacing spaces with underscores, so HIDDEN_264_4062_FOTO_IDF los MID.jpg was renamed to HIDDEN_264_4062_FOTO_IDF_los_MID.jpg But althought the trick was necessary and worked for most of the posts, some of them try to find the old image, with spaces: This is not found http://www.example.com/files/HIDDEN_264_4062_FOTO_IDF%20los%20MID.jpg and this should be the right URL http://www.example.com/files/HIDDEN_264_4062_FOTO_IDF_los_MID.jpg Careful, though, 'cause the "%20" is only shown on the browser: the text on the database shows spaces, not "%20". I'd like to know if maybe I could make a SQL query in my WordPress MySQL database that replaces spaces in .jpg files with underscores. The path of the images is always the same, so the rule should transform this: /files/HIDDEN_264_4062_FOTO_IDF los MID.jpg /files/HIDDEN_264_4062_FOTO_IDF_los_MID.jpg the "/files/HIDDEN_264_" part is always the same, but the rest varies. Is some way to perform this? Maybe a rewrite rule on Apache (our current webserver)?

    Read the article

  • Good free software to track and graph memory and CPU usage on Windows?

    - by TheLQ
    There are many questions on Linux memory tracking, but I haven't seen any for Windows. In my case however its a Windows XP Pro box I need to track the memory and CPU usage of. The reason I need it is due to a server program I'm trying that is eating all my processor and some of my memory which is freezing my RDP session and System Explorer and even makes it difficult to login physically. As this is a very constrained server I'm working off of (768 MB RAM with Pentium 4 which disappears with this program), I need a program that doesn't run/require a webserver. I can give it a MySQL database if necessary however. Is there any suggestions for such a program?

    Read the article

  • Windows System Recovery: Is it needed?

    - by starcorn
    Hello, I just recently deactivated system recovery on Vista, which saved me a huge amount of space. But I wonder is it necessary to have it activated? I can't remember that I any time had any use of system recovery anyway. And since it is Microsoft it probably would do a sloppy job anyway or? This question is for Windows XP, Vista, and 7. Do you have it activated? You can leave a comment if you have any opinion about the system recovery

    Read the article

  • New Upgrade Technical Reference for SQL Server 2008 R2

    - by Greg Low
    Hi Folks, A year or two back, I was involved in a project with my colleagues from SolidQ (led by Ron Talmage) to construct an Upgrade Technical Reference for SQL Server 2008. It seemed to be well received. We've updated it now to SQL Server 2008 R2 and it's just been published. You'll find it on this web site: http://www.microsoft.com/sqlserver/en/us/product-info/why-upgrade.aspx You'll need to click on the Upgrade Guide link towards the middle of the RHS under the "Why Upgrade" whitepaper. Enjoy!...(read more)

    Read the article

  • Will knowing just Magento ruin my career?

    - by Devendra Sharma
    Hello everyone, I have some career doubts and need your kind advise. I have just started my career in PHP. A company is offering a job to me as Magento developer, but the condition is that i have to stay with the company for atleast one year. This company just works on Magento. I doubt, that after a year, I would be knowing just Magento and nothing else in php. Please guide me that should i join the company or not.

    Read the article

  • how to learn Java

    - by Sarang
    This question I am asking because I couldn't find any source which gives complete overview of java development. I just want to know where java technology currently in market & what is preferable for development ! Java always remain top programming language for development point of view. However, java is combo of, j2ee, j2me, jsp, jsf, spring, other frameworks, ui components, jndi, networking tools and various other "J" are there ! However, learning java is definitely dependent on the development requirement, but still, to be a well-experienced java developer, what is the organised way of learning java? What is preferable in current technology ? and what is deprecated, currently ?

    Read the article

  • Overhead of serving pages - JSPs vs. PHP vs. ASPXs vs. C

    - by John Shedletsky
    I am interested in writing my own internet ad server. I want to serve billions of impressions with as little hardware possible. Which server-side technologies are best suited for this task? I am asking about the relative overhead of serving my ad pages as either pages rendered by PHP, or Java, or .net, or coding Http responses directly in C and writing some multi-socket IO monster to serve requests (I assume this one wins, but if my assumption is wrong, that would actually be most interesting). Obviously all the most efficient optimizations are done at the algorithm level, but I figure there has got to be some speed differences at the end of the day that makes one method of serving ads better than another. How much overhead does something like apache or IIS introduce? There's got to be a ton of extra junk in there I don't need. At some point I guess this is more a question of which platform/language combo is best suited - please excuse the in-adroitly posed question, hopefully you understand what I am trying to get at.

    Read the article

  • encryption in c#

    - by Raja
    i am implementing on algorithm in c#. it has encrypt one word . i have check using decrypt also. now i am using a textbox. want to pass a string in that text box that gives my whole string as cypher text. i dont know how to use. i have mad one loop there and calacated the string length. now suppose my function is it is PasswordEncryptor.cs file public static double REncryptText(double m) {// code } this fuction is doing a single number convertion into the encrpt and in code i know this is wrong i want try in this for (int i = 0; i <= 32; i++) { int [] cyph = new int[5]; // cyph=PasswordEncryptor.REncryptText(i); cypherText.Text = c; } i want that after entering the string into textbox it will call that string till string length and and by adding all the part of string one by one, i will get a final encrpytion code and will use further please help me in doing this

    Read the article

  • current page highlights on child pages

    - by user557318
    Im trying to achieve current page highlights on wordpress similar to this site Alex Soth. I'm very nearly there with my css. At present i have current page highlights on pages, ie. home,calendar, projects. However when it come to current page highlights on child pages i have a problem. the indented child page list appears on hover when selecting a child page, but after page selection the menu reverts back to the standard pages menu with no visible child menus? unlike the link to the Alex Soth site where the extended menu stays and current page is highlighted I know that the answer will be a simple piece of css involving current_page_item and possible position:relative to obtain the menu staying visible after selection. But i can for the life of me work it out. Any ideas Ive attached my relivant pieces of css below?? thanks /* =Link Styles ------------------------------------------------------------------*/ input#submit { cursor: pointer; } input#searchsubmit { background: url(images/search.png) no-repeat center; } input#searchsubmit:hover { background: url(images/search.png) no-repeat center #3399FF !important; cursor: pointer; } .navigation a:hover, input#submit { background: #3399FF; color: #3399FF !important; } a { color: #666; } a:hover, a:hover span { color: #c11501 !important;background-color: #fae100; } .entry sup a, #main_nav .current_page_item a, #main_nav .current_page_ancestor a { color: #666 !important; } #main_nav h1.masthead a { color: #666; } #main_nav h1.masthead a:hover { border-right: none; } h2 a, #main_nav a { color: #3399FF; } img a, img a:hover { text-decoration: none; } .post a, .navigation a { font-weight: bold; color: #000; } .navigation a { background: #EEE; color: #666; font-weight: normal; padding: 3px 0px; border-radius: 0px; -webkit-border-radius: 0px; -moz-border-radius: 0px; } .post sup { font-size: 11px; color: #aaa; } .post sup a { border: 0; margin: 0; font-weight: normal; font-size: 10px; } #supplementary .post_nav ul.about_nav li a, #supplementary .post_nav ul.single_post_meta a, #supplementary ul.contact_key li a { color: #888888; border-bottom: 0; } /* =Main Menu ------------------------------------------------------------------*/ #main_nav ul.menu li { position: relative; } #main_nav ul.menu li:hover ul.sub-menu, #main_nav ul.menu li:hover ul.children { display: block; }

    Read the article

  • WPF customer control and direct content support

    - by Mmarquee
    I am fairly new to WPF, and am a bit stuck, so any help would be appreciated. I am trying to write WPF custom control that encapsulates several elements of functionality that I already having working (i.e sorting, filtering, standard menus, etc.), but in a nice neat package to avoid repetition. Anyway I have created the custom control (based on control), and then have the following in the Generic.Xaml <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Controls.ListViewExtended"> <Style TargetType="{x:Type local:ListViewExtended}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:ListViewExtended}"> <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> <ListView> <ListView.View> <GridView> <!-- Content goes here --> </GridView> </ListView.View> </ListView> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> </ResourceDictionary> When I try to add GridViewColumns (or any control really), as below ... <elv:ListViewExtended> <GridView> <GridViewColumn Width="140" Header="Column 1" /> <GridViewColumn Width="140" Header="Column 2" /> <GridViewColumn Width="140" Header="Column 3" /> </GridView> </elv:ListViewExtended> I get the "... does not support direct content" error. I have created a dependancy property (again below) that allows the adding of GridView, but it still doesn't work. public static DependencyProperty GridViewProperty; public static string GridViewHeader(DependencyObject target) { return (string)target.GetValue(GridViewProperty); } public static void GridViewHeader(DependencyObject target, string value) { target.SetValue(GridViewProperty, value); } Thanks in advance

    Read the article

  • .htaccess password and forced login

    - by Boco
    I have password protected website with .htaccess. What I want to do now is to force users to login from the index.html page and not from any other which they can do now. ie. I have index.html (the main page) and I have two other pages 1.html and 2. html also protected with .htaccess password. Users can now type http://www.mypage.com/1.html and they will be asked for login data but I would like to force them (before they are asked for login details) to index.html to login. After they are loggedin they can use any link (ie.1.html or 2.html) as they want. Can this be done by using .htaccess? I would need the whole code. Thank you!

    Read the article

  • ActiveRecord exceptions not rescued

    - by zoopzoop
    I have the following code block: unless User.exist?(...) begin user = User.new(...) # Set more attributes of user user.save! rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique => e # Check if that user was created in the meantime user = User.exists?(...) raise e if user.nil? end end The reason is, as you can probably guess, that multiple processes might call this method at the same time to create the user (if it doesn't already exist), so while the first one enters the block and starts initializing a new user, setting the attributes and finally calling save!, the user might already be created. In that case I want to check again if the user exists and only raise the exception if it still doesn't (= if no other process has created it in the meantime). The problem is, that regularly ActiveRecord::RecordInvalid exceptions are raised from the save! and not rescued from the rescue block. Any ideas? EDIT: Alright, this is weird. I must be missing something. I refactored the code according to Simone's tip to look like this: unless User.find_by_email(...).present? # Here we know the user does not exist yet user = User.new(...) # Set more attributes of user unless user.save # User could not be saved for some reason, maybe created by another request? raise StandardError, "Could not create user for order #{self.id}." unless User.exists?(:email => ...) end end Now I got the following exception: ActiveRecord::RecordNotUnique: Mysql::DupEntry: Duplicate entry '[email protected]' for key 'index_users_on_email': INSERT INTO `users` ... thrown in the line where it says 'unless user.save'. How can that be? Rails thinks the user can be created because the email is unique but then the Mysql unique index prevents the insert? How likely is that? And how can it be avoided?

    Read the article

  • Regex in javascript for enum datatype of mysql

    - by himadri
    Hello, I am working with php and mysql. I have one dropdown box where I am asking datatype of mysql field. Now, I want to put javascript validation for it. I am confused with the enum datatype. I am using regular expression /^[']{1}[^',^\\]+[']{1}$/. This is for one single value of enum values. It is working fine but issue is when I put single quote or backslash with backslash, it is valid but this regular expression shows it as invalid. For eg, 'a'b' is invalid but 'a\'b' is valid.

    Read the article

  • SQL change "like" to "contains"

    - by Paul
    products table (mySQL) record_id categories (comma-delimited list) --------- -------------------------------- 1 960|1,957|1,958|1 I have the following dynamic query (simplified for the purposes of this question). The query is passed specified categories, each in the format xxxx|yyyy, and I need to return products having the passed category in its comma-delimited list of categories. The current query looks like: select p.* from products p where (p.categories like '%27|0%' or p.categories like '%972|1%' or p.categories like '%969|1%') But, the LIKE clause sometimes permits anomalies. I would like to write the query more like: select p.* from products p where (p.categories contains '27|0' or p.categories contains'972|1' or p.categories contains '969|1') How would I do this?

    Read the article

  • Problem creating PostGIS template database

    - by omat
    I am trying to build a template geographic database for PostGIS (1.5) on Mac OS X Snow Leopard (10.6) for my GeoDjango application. I am following: http://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#creating-a-spatial-database-template-for-postgis I've managed to come up to the point where the provided postgis.sql should be run (i.e. psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql) At that point I am getting an error at the first SQL statement that is tried to be run. When I try that on the psql prompt the result is as follows: template_postgis=# CREATE OR REPLACE FUNCTION st_spheroid_in(cstring) RETURNS spheroid AS '/usr/local/pgsql/lib/postgis-1.5','ellipsoid_in' LANGUAGE 'C' IMMUTABLE STRICT; NOTICE: type "spheroid" is not yet defined DETAIL: Creating a shell type definition. ERROR: could not load library "/usr/local/pgsql/lib/postgis-1.5.so": dlopen(/usr/local/pgsql/lib/postgis-1.5.so, 10): Symbol not found: _DatumGetFloat4 Referenced from: /usr/local/pgsql/lib/postgis-1.5.so Expected in: /opt/local/lib/postgresql83/bin/postgres in /usr/local/pgsql/lib/postgis1.5.so Any ideas what might have been messed up?

    Read the article

  • Two view App with root template view

    - by Tieman
    Hi I was wanted to do Application witch have a root template view with a nice logo on top or something adn load other views just below (here is what I have right now: Test App ) But I have a little problem. If I'll remove a comment in file TestAppDelegate.m on line 58 //[currentView release]; Application will crash with bunch of errors when I try to switch views. But if I comment this line Project analyzer is telling me that I have a potential leak with currentView variable. Can somebody spare some time and see in that code what I did wrong?

    Read the article

  • Url routing asp.net 4

    - by user510336
    Hello all , I am trying to create url routing like this http://msdn.microsoft.com/en-us/magazine/dd347546.aspx but I am having few questions , first why he is adding lines to the web.config , I tested it and it didnt appear that they're doing something as I commented them and nothing major appeared second I am having this line of code that is crashing var display = BuildManager.CreateInstanceFromVirtualPath(_virtualPath,typeof(Page)) as IProfileHandler; when casted as ihttphandler it's working , but when I am casting it to iprofilehandler(which is implemeting ihttphandler) it's giving null !

    Read the article

  • Using locks inside a loop

    - by Xaqron
    // Member Variable private readonly object _syncLock = new object(); // Now inside a static method foreach (var lazyObject in plugins) { if ((string)lazyObject.Metadata["key"] = "something") { lock (_syncLock) { if (!lazyObject.IsValueCreated) lazyObject.value.DoSomething(); } return lazyObject.value; } } Here I need synchronized access per loop. There are many threads iterating this loop and based on the key they are looking for, a lazy instance is created and returned. lazyObject should not be created more that one time. Although Lazy class is for doing so and despite of the used lock, under high threading I have more than one instance created (I track this with a Interlocked.Increment on a volatile shared int and log it somewhere). The problem is I don't have access to definition of Lazy and MEF defines how the Lazy class create objects. My questions: 1) Why the lock doesn't work ? 2) Should I use an array of locks instead of one lock for performance improvement ?

    Read the article

  • Java FMJ is not cross platfrom ? How can it be fixed ?

    - by Stackfan
    I was trying to use FMJ (for windows/linux/mac). Where JMF was not working for me (so decided to work with FMJ as it is cross platfaorm). But when ever i am trying FMJ it never works, where you can see the difference in the screen shot. ex: http://i.imgur.com/AjcJh.png Thanks & Regards Note: I have two camera connected in the same PC and Flash detects always both of them without any issue. But FMJ is never working ?????.

    Read the article

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