Daily Archives

Articles indexed Wednesday April 21 2010

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

  • Using the StopWatch class to calculate the execution time of a block of code

    - by vik20000in
      Many of the times while doing the performance tuning of some, class, webpage, component, control etc. we first measure the current time taken in the execution of that code. This helps in understanding the location in code which is actually causing the performance issue and also help in measuring the amount of improvement by making the changes. This measurement is very important as it helps us understand the problem in code, Helps us to write better code next time (as we have already learnt what kind of improvement can be made with different code) . Normally developers create 2 objects of the DateTime class. The exact time is collected before and after the code where the performance needs to be measured.  Next the difference between the two objects is used to know about the time spent in the code that is measured. Below is an example of the sample code.             DateTime dt1, dt2;             dt1 = DateTime.Now;             for (int i = 0; i < 1000000; i++)             {                 string str = "string";             }             dt2 = DateTime.Now;             TimeSpan ts = dt2.Subtract(dt1);             Console.WriteLine("Time Spent : " + ts.TotalMilliseconds.ToString());   The above code works great. But the dot net framework also provides for another way to capture the time spent on the code without doing much effort (creating 2 datetime object, timespan object etc..). We can use the inbuilt StopWatch class to get the exact time spent. Below is an example of the same work with the help of the StopWatch class.             Stopwatch sw = Stopwatch.StartNew();             for (int i = 0; i < 1000000; i++)             {                 string str = "string";             }             sw.Stop();             Console.WriteLine("Time Spent : " +sw.Elapsed.TotalMilliseconds.ToString());   [Note the StopWatch class resides in the System.Diagnostics namespace] If you use the StopWatch class the time taken for measuring the performance is much better, with very little effort. Vikram

    Read the article

  • Certain web pages are suddenly not rendering properly in FireFox

    - by LeopardSkinPillBoxHat
    I am using FireFox 3.6.3. I noticed in the last couple of days that several webpages which I visit regularly are not rendering properly. A lot of the text is overlapping with other text and it basically looks like the style sheet is completely screwed up. I have tried disabling all of my Add-Ons and it doesn't make a difference. When I use Coral IE Tab to render the pages using IE they display without any problems. The websites which are not rending properly for me are: The Age Google Reader One interesting thing I noticed is that if I modify the Google Reader URL to not use SSL (i.e. change https to http) it renders without any issues. However, The Age website is not using SSL, and that still doesn't render properly. I have also disabled my Proxy Server (I normally use one at work) but this doesn't make a difference either.

    Read the article

  • Few Deadly SEO Mistakes!

    With so many websites sprouting all around like mushrooms, the business of designing, development and other site related works are on a brilliant business spree. Even Search Engine Optimization has a splendor demand everywhere.

    Read the article

  • The Benefits of Using a SEO Company

    Being number one on the net can sometimes be a very hard task and process. There are lots of things that should be thought about in order to get there like by doing search engine optimization. That is a process that improves the quality or volume of traffic to a web page or site from things such as blogs, or search engines.

    Read the article

  • What is Linkvana?

    Linkvana is a wonderful search engine optimization service that makes it possible to have as many back links as you want. You can have these back links to multiple third party websites. You are completely free to choose your own anchor text for these back links. There is a network of articles and another one that comprises of blogs. You can create a custom anchor text in a very short time. Usually the process takes less than the time taken to write a hundred words long post on your blog or website. It is very easy and intuitive to create number of back links to several pages deep in your site navigation with the help of Linkvana.

    Read the article

  • Top 3 Mistakes Linkbuilders Make

    Back linking is one single process which is most important to have a satisfactory Google Page Rank. May be you have just started spreading your links on the web without considering the quality and value of the link. Here are top 3 common mistakes that linkbuilders make.

    Read the article

  • Unconventional Methods of Link Building

    You can find hundreds of link building methods online. Not all methods are suitable for everyone. Whereas the basics of link building are same every time, you can choose entirely different strategy to get the job done. Search engine optimization is a serious matter and you have to check every corner to find the hidden treasure in the form of a top page rank. Here are a few unconventional methods that you can use.

    Read the article

  • The Benefits of Website Creation Software

    Building your own website can be time consuming and costly if you are not technically inclined. But building one or more websites using site building software is the easy, quick and efficient way to do it for quicker profits.

    Read the article

  • Converting long value to unichar* in objective-c

    - by conmulligan
    I'm storing large unicode characters (0x10000+) as long types which eventually need to be converted to NSStrings. Smaller unicode characters can be created as a unichar, and an NSString can be created using [NSString stringWithCharacters:(const unichar *)characters length:(NSUInteger)length] So, I imagine the best way to get an NSString from the unicode long value would be to first get a unichar* from the long value. Any idea on how I might go about doing this?

    Read the article

  • Simple Scala syntax - trying to define "==" operator - what am I missing?

    - by Alex R
    While experimenting with some stuff on the REPL, I got to a point where I needed something like this: scala class A(x:Int) { println(x); def ==(a:A) : Boolean = { this.x == a.x; } } Just a simple class with an "==" operator. Why doesn't it work??? Here's the result: :10: error: type mismatch; found : A required: ?{val x: ?} Note that implicit conversions are not applicable because they are ambiguous: both method any2ArrowAssoc in object Predef of type [A](x: A)ArrowAssoc[A] and method any2Ensuring in object Predef of type [A](x: A)Ensuring[A] are possible conversion functions from A to ?{val x: ?} class A(x:Int) { println(x); def ==(a:A) : Boolean = { this.x == a.x; } } ^ This is scala 2.8 RC1. Thanks

    Read the article

  • mysql partitioning

    - by Yang
    just want to verify that database partition is implemented only at the database level, when we query a partitioned table, we still do our normal query, nothing special with our queries, the optimization is performed automatically when parsing the query, is that correct? e.g. we have a table called 'address' with a column called 'country_code' and 'city'. so if i want to get all the addresses in New York, US, normally i wound do something like this: select * from address where country_code = 'US' and city = 'New York' if now the table is partitioned by 'country_code', and i know that now the query will only be executed on the partition which contains country_code = US. My question is do I need to explicitly specify the partition to query in my sql statement? or i still use the previous statement and the db server will optimize it automatically? Thanks in advance!

    Read the article

  • tetris rotation

    - by Samuel
    Hey, For university we're supposed to write a game (the language is modula2 little chance you know it). Each tetromino is defined through a central piece and 3 relative pieces, Now when it comes to rotation i just rotate the relative blocks (linear algebra). What i am asking myself is how to handle the rotations a user does when the piece has already "landed" because than the user has a little time left to move his pieve quickly into the desired position but in tetris versions all over the web you can "rotate over" other pieces, but i dont seem to get it with my rotation. Over what piece do i need to rotate? are there guidelines? Thanks

    Read the article

  • how can I capture response from twitter.com? ( ruby + twitter gem)

    - by Radek
    how can I capture response from twitter.com? To make sure that everything went ok? I am using ruby and ruby twitter gem and the my code is basically like that oauth = Twitter::OAuth.new('consumer token', 'consumer secret') oauth.authorize_from_access('access token', 'access secret') client = Twitter::Base.new(oauth) client.update('Heeeyyyyoooo from Twitter Gem!')

    Read the article

  • How do I use PowerShell background jobs which require windows authentication

    - by Scott Weinstein
    I'm trying to run some funtions in the background of a PoSh script. The job never completes, but works fine when called normall. I've narrowed the problem down to the following line: This line works fine: $ws = New-WebServiceProxy "http://host/Service?wsdl" -UseDefaultCredential but this line blocks forever start-job { New-WebServiceProxy "same url" -UseDefaultCredential } ` | wait-job | Receive-Job Some details: the service is local, and requires windows authentication. Client is XP & server 2003. Why? How do get it to work?

    Read the article

  • Small web-framework like Sinatra, Ramaze etc in .NET

    - by Christian W
    Are there any similar frameworks like Sinatra, Ramaze etc in .NET? I'm in theory after a framework that let's me create an entire webapp with just one classfile (conceptually) like Sinatra. I'm going to use it for something work-internal, where ASP.NET MVC is too "big" (and I get confused by it's usage) and I have WebForms up to my ears right now (doing a big webforms based project, currently hating it ;) ) Any suggestions? Oh, and I need to be able to host it in IIS. I would go for IronRuby with Sinatra, but I can't find a step-by-step tut for setting it up in IIS ;)

    Read the article

  • ezpublish for practical e-commerce?

    - by Olaseni
    For while now I have been using ezpublish as a framework, and CMS when my web projects are based on PHP, and I must say, I have grown accustomed to it because of its flexibility for most scenarios. However, I've had to build e-commerce sites now and then, and ezpublish includes a webshop that caters for the e-commerce needs of your installation, and of-course with all the tools you need to extend, should you need to. Is it worthwhile and optimal to use the inbuilt webshop for an e-commerce solution, or should I rather go with an all out e-commerce solution like Magento, which has made a significant impact in that sector?

    Read the article

  • Xen guests accessing LUNs

    - by mechcow
    We are using RHEL5.3 with a Clarion SAN attached by FC. Our situation is that we have a number of LUNs presented to Hosts and we want to dynamically present the LUNs to Xen Guests. We are not sure on what the best practice approach is to set this up. The Xen guests will form a cluster together and need the LUNs only for data partitions, i.e. when they are actively running services. So one approach would be to always present all disks to all Xen guests, and then rely up on the cluster software, and mount itself, to not mount the disk twice in two locations. This sounds kinda risky and also is not very secure (one cracked guest can see/destroy all the data). Another approach would be to dynamically add and remove the disks from the Xen guests at the dom0 level (using xm block-attach). This could work but sounds slightly complicated, I'm wondering whether Red Hat Cluster Suite supports this in some way or whether there are scripts to do this. Yet another approach would be to have the LUNs endpointed at the Xen guests themselves - I'm not sure whether this is technically possible since the multipathing has to be done at the Host level.

    Read the article

  • SSH onto Ubuntu box using RSA keys

    - by jex
    I recently installed OpenSSH on one of my Ubuntu machines and I've been running into problems getting it to use RSA keys. I've generated the RSA key on the client (ssh-keygen), and appended the public key generated to both the /home/jex/.ssh/authorized_keys and /etc/ssh/authorized_keys files on the server. However, when I try to login (ssh -o PreferredAuthorizations=publickey jex@host -v [which forces the use of public key for login]) I get the following output: debug1: Host 'pentheon.local' is known and matches the RSA host key. debug1: Found key in /home/jex/.ssh/known_hosts:2 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received Banner message debug1: Authentications that can continue: publickey,keyboard-interactive debug1: Next authentication method: publickey debug1: Offering public key: /home/jex/.ssh/id_rsa debug1: Authentications that can continue: publickey,keyboard-interactive debug1: Trying private key: /home/jex/.ssh/identity debug1: Trying private key: /home/jex/.ssh/id_dsa debug1: No more authentication methods to try. Permission denied (publickey,keyboard-interactive). I'm not entirely sure where I've gone wrong. I am willing to post my /etc/ssh/sshd_config if needed.

    Read the article

  • SQL SERVER – When are Statistics Updated – What triggers Statistics to Update

    - by pinaldave
    If you are an SQL Server Consultant/Trainer involved with Performance Tuning and Query Optimization, I am sure you have faced the following questions many times. When is statistics updated? What is the interval of Statistics update? What is the algorithm behind update statistics? These are the puzzling questions and more. I searched the Internet as well many official MS documents in order to find answers. All of them have provided almost similar algorithm. However, at many places, I have seen a bit of variation in algorithm as well. I have finally compiled the list of various algorithms and decided to share what was the most common “factor” in all of them. I would like to ask for your suggestions as whether following the details, when Statistics is updated, are accurate or not. I will update this blog post with accurate information after receiving your ideas. The answer I have found here is when statistics are expired and not when they are automatically updated. I need your help here to answer when they are updated. Permanent table If the table has no rows, statistics is updated when there is a single change in table. If the number of rows in a table is less than 500, statistics is updated for every 500 changes in table. If the number of rows in table is more than 500, statistics is updated for every 500+20% of rows changes in table. Temporary table If the table has no rows, statistics is updated when there is a single change in table. If the number of rows in table is less than 6, statistics is updated for every 6 changes in table. If the number of rows in table is less than 500, statistics is updated for every 500 changes in table. If the number of rows in table is more than 500, statistics is updated for every 500+20% of rows changes in table. Table variable There is no statistics for Table Variables. If you want to read further about statistics, I suggest that you read the white paper Statistics Used by the Query Optimizer in Microsoft SQL Server 2008. Let me know your opinions about statistics, as well as if there is any update in the above algorithm. Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: Pinal Dave, Readers Question, SQL, SQL Authority, SQL Optimization, SQL Performance, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology Tagged: SQL Statistics

    Read the article

  • SQL Saturday #39 in NYC

    - by roman
    This weekend I will be speaking at the NYC SQL Saturday . The whole event was supposed to be BI focused but now the schedule shows a lot of non BI stuff as well. I will be presenting SQL Server 2008 Reporting Services Programming , one of my favorite topics to present on. It seems that the event if fully booked. I'll be coming down on my bike taking scenic roads through MA and CT so I will not make it to the speaker dinner. But the forecast looks good so I am pretty psyched to finally venture out...(read more)

    Read the article

  • Previous power of 2

    - by Horacio
    There is a lot of information on how to find the next power of 2 of a given value (see refs) but I cannot find any to get the previous power of two. The only way I find so far is to keep a table with all power of two up to 2^64 and make a simple lookup. Acius' Snippets gamedev Bit Twiddling Hacks Stack Overflow

    Read the article

  • Display value of a django form field in a template?

    - by Eran Kampf
    I have a form with an email property. When using {{ form.email }} in case of some validation error, django still renders the previous value in the input tag's value attribute: <input type="text" id="id_email" maxlength="75" class="required" value="[email protected]" name="email"> I want to render the input tag myself (to add some javascript code and an error class in case of an error). For example this is my template instead of {{ form.email }}: <input type="text" autocomplete="on" id="id_email" name="email" class="email {% if form.email.errors %}error{% endif %}"> However this does not display the errorneous value ("[email protected]" in this example) to the user. How do I get the field's value in the template?

    Read the article

  • Implementing a Mutex Lock in C

    - by Adam
    I'm trying to make a really mutex in C and for some reason I'm getting cases where two threads are getting the lock at the same time, which shouldn't be possible. Any ideas why it's not working? void mutexLock(mutex_t *mutexlock, pid_t owner) { int failure; while(mutexlock->mx_state == 0 || failure || mutexlock->mx_owner != owner) { failure = 1; if (mutexlock->mx_state == 0) { asm( "test:" "movl $0x01,%%eax\n\t" // move 1 to eax "xchg %%eax,%0\n\t" // try to set the lock bit "mov %%eax,%1\n\t" // export our result to a test var "test %%eax,%%eax\n\t" "jnz test\n\t" :"=r"(mutexlock->mx_state),"=r"(failure) :"r"(mutexlock->mx_state) :"%eax" ); } if (failure == 0) { mutexlock->mx_owner = owner; //test to see if we got the lock bit } } }

    Read the article

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