Daily Archives

Articles indexed Saturday April 24 2010

Page 9/78 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Is there any significant benefit to reading string directly from control instead of moving it into a

    - by Kevin
    sqlInsertFrame.Parameters.AddWithValue("@UserName", txtUserName.txt); Given the code above...if I don't have any need to move the textbox data into a string variable, is it best to read the data directly from the control? In terms of performance, it would seem smartest to not create any unnecessary variables which use up memory if its not needed. Or is this a situation where its technically true but doesn't yield any real world results due to the size of the data in question. Forgive me, I know this is a very basic question.

    Read the article

  • Using php's magic methods outside a class

    - by Greelmo
    Is it possible to use PHP magic methods (specifically __get()) outside a defined class? I'm wanting to use it in a configuration file for quick loading. The configuration file has a single array, $config, with many keys. Therefore, I'd like to override __get() to return the key in the array.

    Read the article

  • Matching an IP address with an IP range?

    - by Legend
    I have a MySQL table setup as follows: +---------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------------+-------------+------+-----+---------+----------------+ | ipaddress_s | varchar(15) | YES | MUL | NULL | | | ipaddress_e | varchar(16) | YES | | NULL | | +---------------+-------------+------+-----+---------+----------------+ where, ipaddress_s and ipaddress_e look something like: 4.100.159.0-4.100.159.255 Now is there a way I can actually get the row that contains a given IP address? For instance, given the IP address: "4.100.159.5", I want the above row to be returned. So I am trying for a query that looks something like this (but of course this is wrong because in the following I am considering IPs as strings): SELECT * FROM ranges WHERE ipaddress_s<"4.100.159.5" AND ipaddress_e>"4.100.159.5" Any suggestions?

    Read the article

  • O(log n) algorithm for computing rank of union of two sorted lists?

    - by Eternal Learner
    Given two sorted lists, each containing n real numbers, is there a O(log?n) time algorithm to compute the element of rank i (where i coresponds to index in increasing order) in the union of the two lists, assuming the elements of the two lists are distinct? I can think of using a Merge procedure to merge the 2 lists and then find the A[i] element in constant time. But the Merge would take O(n) time. How do we solve it in O(log n) time?

    Read the article

  • Understanding 400 Bad Request Exception

    - by imran_ku07
        Introduction:          Why I am getting this exception? What is the cause of this error. Developers are always curious to know the root cause of an exception, even though they found the solution from elsewhere. So what is the reason of this exception (400 Bad Request).The answer is security. Security is an important feature for any application. ASP.NET try to his best to give you more secure application environment as possible. One important security feature is related to URLs. Because there are various ways a hacker can try to access server resource. Therefore it is important to make your application as secure as possible. Fortunately, ASP.NET provides this security by throwing an exception of Bad Request whenever he feels. In this Article I am try to present when ASP.NET feels to throw this exception. You will also see some new ASP.NET 4 features which gives developers some control on this situation.   Description:   http.sys Restrictions:           It is interesting to note that after deploying your application on windows server that runs IIS 6 or higher, the first receptionist of HTTP request is the kernel mode HTTP driver: http.sys. Therefore for completing your request successfully you need to present your validity to http.sys and must pass the http.sys restriction.           Every http request URL must not contain any character from ASCII range of 0x00 to 0x1F, because they are not printable. These characters are invalid because these are invalid URL characters as defined in RFC 2396 of the IETF. But a question may arise that how it is possible to send unprintable character. The answer is that when you send your request from your application in binary format.           Another restriction is on the size of the request. A request containg protocal, server name, headers, query string information and individual headers sent along with the request must not exceed 16KB. Also individual header should not exceed 16KB.           Any individual path segment (the portion of the URL that does not include protocol, server name, and query string, for example, http://a/b/c?d=e,  here the b and c are individual path) must not contain more than 260 characters. Also http.sys disallows URLs that have more than 255 path segments.           If any of the above rules are not follow then you will get 400 Bad Request Exception. The reason for this restriction is due to hack attacks against web servers involve encoding the URL with different character representations.           You can change the default behavior enforced by http.sys using some Registry switches present at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\HTTP\Parameters    ASP.NET Restrictions:           After passing the restrictions enforced by the kernel mode http.sys then the request is handed off to IIS and then to ASP.NET engine and then again request has to pass some restriction from ASP.NET in order to complete it successfully.           ASP.NET only allows URL path lengths to 260 characters(only paths, for example http://a/b/c/d, here path is from a to d). This means that if you have long paths containing 261 characters then you will get the Bad Request exception. This is due to NTFS file-path limit.           Another restriction is that which characters can be used in URL path portion.You can use any characters except some characters because they are called invalid characters in path. Here are some of these invalid character in the path portion of a URL, <,>,*,%,&,:,\,?. For confirming this just right click on your Solution Explorer and Add New Folder and name this File to any of the above character, you will get the message. Files or folders cannot be empty strings nor they contain only '.' or have any of the following characters.....            For checking the above situation i have created a Web Application and put Default.aspx inside A%A folder (created from windows explorer), then navigate to, http://localhost:1234/A%25A/Default.aspx, what i get response from server is the Bad Request exception. The reason is that %25 is the % character which is invalid URL path character in ASP.NET. However you can use these characters in query string.           The reason for these restrictions are due to security, for example with the help of % you can double encode the URL path portion and : is used to get some specific resource from server.   New ASP.NET 4 Features:           It is worth to discuss the new ASP.NET 4 features that provides some control in the hand of developer. Previously we are restricted to 260 characters path length and restricted to not use some of characters, means these characters cannot become the part of the URL path segment.           You can configure maxRequestPathLength and maxQueryStringLength to allow longer or shorter paths and query strings. You can also customize set of invalid character using requestPathInvalidChars, under httpruntime element. This may be the good news for someone who needs to use some above character in their application which was invalid in previous versions. You can find further detail about new ASP.NET features about URL at here           Note that the above new ASP.NET settings will not effect http.sys. This means that you have pass the restriction of http.sys before ASP.NET ever come in to the action. Note also that previous restriction of http.sys is applied on individual path and maxRequestPathLength is applied on the complete path (the portion of the URL that does not include protocol, server name, and query string). For example, if URL is http://a/b/c/d?e=f, then maxRequestPathLength will takes, a/b/c/d, into account while http.sys will take a, b, c individually.   Summary:           Hopefully this will helps you to know how some of initial security features comes in to play, but i also recommend that you should read (at least first chapter called Initial Phases of a Web Request of) Professional ASP.NET 2.0 Security, Membership, and Role Management by Stefan Schackow. This is really a nice book.

    Read the article

  • Missing features in Visual Studio?

    - by Sean Kearon
    What features do you want to see in Visual Studio that are not included out of the box? I'd like to be able to: Add projects and references by dragging to the Solution Explorer. Collapse to project definitions in the Solution Explorer. Although the second can be achieved with a macro. PS: R# is does not count as a feature!

    Read the article

  • Using LINQ to XML, how can I join two sets of data based on ordinal position?

    - by Donald Hughes
    Using LINQ to XML, how can I join two sets of data based on ordinal position? <document> <set1> <value>A</value> <value>B</value> <value>C</value> </set1> <set2> <value>1</value> <value>2</value> <value>3</value> </set2> </document> Based on the above fragment, I would like to join the two sets together such that "A" and "1" are in the same record, "B" and "2" are in the same record, and "C" and "3" are in the same record.

    Read the article

  • ASP.NET MVC submitting json array to controller as regular post request (nonajax)

    - by j3ko
    All the examples of json I can find online only show how to submit json arrays w/ the jquery command $.ajax(). I'm submitting some data from a custom user control as a json array. I was wondering if it's possible to submit a json array as a regular post request to the server (like a normal form) so the browser renders the page returned. Controller: [JsonFilter(Param = "record", JsonDataType = typeof(TitleViewModel))] public ActionResult SaveTitle(TitleViewModel record) { // save the title. return RedirectToAction("Index", new { titleId = tid }); } Javascript: function SaveTitle() { var titledata = GetData(); $.ajax({ url: "/Listing/SaveTitle", type: "POST", data: titledata, contentType: "application/json; charset=utf-8", }); } Which is called from a save button. Everything works fine but the browser stays on the page after submitting. I was thinking of returning some kind of custom xml from the server and do javascript redirect but it seems like a very hacky way of doing things. Any help would be greatly appreciated.

    Read the article

  • jQuery : add css class to menu item based on browser scroller position

    - by antosha
    Hi, I have a menu: <ul class="menu-bottom"> <li id="m1" class="active"><a id="1" href="#"><span>Link 1</span></a></li> <li id="m2"><a id="2" href="#"><span>Link 2</span></a></li> <li id="m3"><a id="3" href="#"><span>Link 3</span></a></li> </ul> I want that depending of browser's scroller position, the "active" class goes the correct < li element. This is how I see it : if ($(document).height() == 500) { $('#m1').parent().addClass('active'). siblings().removeClass('active'); } if ($(document).height() == 1000) { $('#m2').parent().addClass('active'). siblings().removeClass('active'); } if ($(document).height() == 1500) { $('#m2').parent().addClass('active'). siblings().removeClass('active'); } I am not very familiar with jQuery Dimensions properties so this code doesn't make much sense, but I hope you get the idea. If someone could tell me how to make this work, it would be really cool. Thanks :)

    Read the article

  • Is it good to add line-height in body?

    - by metal-gear-solid
    Is it good to add line-height in body{line-height:1.5} or it would be better if i add separately for tag by tag like p{ line height:1em} etc. Edit: body {line-height:in em} create problem with if we put image with float inside Edit: 24 April 2010: If i have to add different line heights to elements like p { 1.4} h1 {1.6} h2 { 1.2} ul li { 1.1} then shouldn't i use line height in body { 1.4} if body { 1.4} and h1 {1.6} then what would be line height for h1?

    Read the article

  • Hosting a complex online service

    - by jonathanconway
    I have an idea for a web-based service. The implementation is very complex. There will be very few users, and the traffice will be fairly low, but the server-side code could require a lot of resources. Ideally I'd need to have as much control over the servers as possible. How should I arrange hosting for this, when it comes time to release it to the public? Should I do the hosting myself, from my own servers? Trouble is, since I'm not quite an expert on .NET hosting, it might take time to learn and I might make big mistakes. The trouble with using a hosting company is, they might steal my idea, or else, it might cost a lot. Since I'm an un-funded startup I don't have a lot of money to throw at this.

    Read the article

  • How to iterate over every property of an object in javascript?

    - by OverloadUT
    Is there a way to iterate over every property of an object using the Prototype JavaScript framework? Here's the situation: I am getting an AJAX response in JSON that looks something like this: {foo: 1, bar: 2, barobj: {75: true, 76: false, 85: true}} If I evaluate that json response in to a variable response, I want to be able to iterate over each property in the response.barobj object to see which indexes are true and which are false. Prototype has both Object.keys() and Object.values() but oddly seems to not have a simple Object.each() function! I could take the results of Object.keys() and Object.values() and cross-reference the other as I iterate through one, but that is such a hack that I am sure there is a proper way to do it!

    Read the article

  • Linux Kernel - Slab Allocator Question

    - by Drex
    I am playing around with the kernel and am looking at the kmem_cache files_cachep belonging to fork.c. It detects the sizeof(files_struct). My question is this: I have altered files_struct and added a rb_root (red/black tree root) using the built-in functionality in linux/rbtree.h. I can properly insert values into this tree. However, at some point, a segfault occurs and GDB backtraces the following information: (gdb) backtrace 0 0x08066ad7 in page_ok (page=) at arch/um/os-Linux/sys-i386/task_size.c:31 1 0x08066bdf in os_get_top_address () at arch/um/os-Linux/sys-i386/task_size.c:100 2 0x0804a216 in linux_main (argc=1, argv=0xbfb05f14) at arch/um/kernel/um_arch.c:277 3 0x0804acdc in main (argc=1, argv=0xbfb05f14, envp=0xbfb05f1c) at arch/um/os-Linux/main.c:150 I have spent many hours trying to figure out why there is a segfault given that the red/black tree inserts properly. I'm thinking it's a memory allocation issue with new processes made by fork() of a parent process. Could this be the case and could it have something to do with kmem_cache files_cachep?

    Read the article

  • O(log n) algorithm to find the element having rank i in union of pre-sorted lists

    - by Eternal Learner
    Given two sorted lists, each containing n real numbers, is there a O(log?n) time algorithm to compute the element of rank i (where i coresponds to index in increasing order) in the union of the two lists, assuming the elements of the two lists are distinct? I can think of using a Merge procedure to merge the 2 lists and then find the A[i] element in constant time. But the Merge would take O(n) time. How do we solve it in O(log n) time?

    Read the article

  • How to add classes for styling to Drupal when using menu_block?

    - by VoY
    I'm using the menu_block module in Drupal for my menus. This works very well, but I want my menu items styled as an image menu. This cannot be done nicely with the default settings - the menu items look something like this: <li class="leaf first menu-mlid-199"><a href="/this/is/some/nice/url" title="Homepage">Homepage</a></li> I'm guessing I could used the menu-mlid-199 class to get the styling I want, because it's a unique id of each menu item, but that seems rather ugly to me. Is there any other way to add reasonably named classes to my menu items, e.g. generate them from the page title or url alias? Even just a sequence would seem nicer - like menu-item-1 and so on.

    Read the article

  • Livros oficiais Microsoft para download

    - by johnywercley
    A MSPress liberou download dos livros Introducing Microsoft SQL Server 2008 R2 e Understanding Virtualization Solutions from Desktop to the Datacenter . O download foi permitido por alguns dias depois será bloqueado. Introducing Microsoft SQL Server 2008 R2 216 páginas do livro são: PART I Database Administration CHAPTER 1 SQL Server 2008 R2 Editions and Enhancements CHAPTER 2 Multi-Server Administration CHAPTER 3 Data-Tier Applications CHAPTER 4 High Availability and Virtualization Enhancements...(read more)

    Read the article

  • Best way to reformat/recover in Windows when your CD key is no longer valid?

    - by CSarnia
    I have a copy of Windows 7 Professional that I have downloaded from the MSDN e-academy (thanks to my school). Now, the problem is that these license keys are one-use only. If I need to reformat or do a factory reset, what is the best way for me to do so, without invalidating my license and screwing me out of an operating system? Edit: I would also like to know some information on the "restore to factory settings" option in Windows 7 recovery center. Does it do exactly as the name implies and starts you off as if you had just done a fresh install? If I had some kind of nasty trojan or virus, would it be able to survive through the factory reset? The recovery center also has an option for reformatting, though I don't think that it's an actual format - it just backs up your stuff into a Windows.old folder or something like that. Does that require a valid license key?

    Read the article

  • wich adserver is the best?

    - by rrodrigo
    I am so sick of OpenX, please recommend me a new Adserver that i can install on my server. Doesnt matter if its not free, we want to make money so its an investment. Thanks a lot! LAMP environment btw.

    Read the article

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