Daily Archives

Articles indexed Friday June 11 2010

Page 19/114 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • Too many local variables in ASP.NET

    - by Yongwei Xing
    Hi all I wrote a control, and use a tool to do the code analysis. There is a test that I didn't pass. Avoid excessive locals, http://msdn.microsoft.com/library/ms182263(VS.90).aspx. In my CreateChildControls function, I built a big table with lots of field. I need to create a lot of TableRow and TableCell to construct the table. But these are not field or property of control. Thery are local variables in the function, which are created dynamically. Should I make these TableCells and TableRows as fields of the control? Or I just keep them as the local variables in the CreateChildControl function? Best Regards,

    Read the article

  • Cannot manage to have the main form to show scrollbars if bigger

    - by Philippe Watel
    Hi everyone I have developped an app on 22inch monitor at its max resolution when I run this on a laptop with a different ratio and a smaller resolution well the form is too big - to be expected but no scroll bar appear automaticaly to see the whole thing if needed I have tempered with all options but could not figure it out I have tried autoscroll of course but nothing I am sure it is not so difficult but I am stuck So if anyone could indicate me what properties to change I'll be most greatful or even better some easy strategy or components (even paying) to achieve a better screen resolution independance but the scrollbar would be great to start with Thanks & Regards Philippe Watel

    Read the article

  • java I/O is blocked while reading on socket when i put off the battery from device.

    - by gunjan goyal
    hi, i m working on client socket connection. client is a GPRS hardware device. i m receiving request from this client on my serversocket and then opening multiple threads. my problem is that when device/client close the socket then my IO detects that throws an exception but when i put off the battery from the device while sending the request to the serversocket it is blocked without throwing any exception. please help me out. thanks in advance. this is my code. try { while ((len = inputStream.read(mainBuffer)) -1) { System.out.println("len= " + len); }//end of while System.out.println("out of while loop");//which is never printed on screen. } catch (IOException e) { e.printStackTrace(); } regards gunjan goyal

    Read the article

  • Hibernate: how to maintain insertion order

    - by jwaddell
    I have a list of entities where creation order is important, but they do not contain a timestamp to use for sorting. Entities are added to the end of the list as they are created so they will be ordered correctly in the list itself. After persisting the list using Hibernate the entities appear in the database table in the order that they were created. However when retrieving the list using a new Hibernate session the list is now in reverse order of insertion/creation. Is this expected behaviour? Is there any way to retrieve the list in the same order as it appears in the table? The primary key is a UUID, and the list of entities should always have been created on the same IP address and JVM. This mean sorting by UUID is a possibility but I'd rather not make assumptions. Another possibility is if the list is guaranteed to always come out in reverse order I could always just work through it backwards.

    Read the article

  • A question in rails db:migrate

    - by Small Wolf
    Now , I execute the command line "rake db:migrate" on the window OS, but I got the problem in the console. it print couldn't find HOME environment -- expanding~/.ruby-uuid'` who can help me to solve this ? Thank you and best regards!

    Read the article

  • PHP URL encoding retaining invalid url characters

    - by Keyo
    I need to replace url invalid characters with something url valid then convert it back again. This is for a search page with a url like http://my.site/search/this-is-a-search, the search form POSTS then the user redirected to the new url. Php has functions urlencode and urldecode however these do not work at all, and leave invalid characters in my url. Surely I don't need to reinvent the wheel here.

    Read the article

  • what is a fast way to output h5py dataset to text?

    - by user362761
    I am using the h5py python package to read files in HDF5 format. (e.g. somefile.h5) I would like to write the contents of a dataset to a text file. For example, I would like to create a text file with the following contents: 1,20,31,75,142,324,78,12,3,90,8,21,1 I am able to access the dataset in python using this code: import h5py f = h5py.File('/Users/Me/Desktop/thefile.h5', 'r') group = f['/level1/level2/level3'] dset = group['dsetname'] My naive approach is too slow, because my dataset has over 20000 entries: # write all values to file for index in range(len(dset)): # do not add comma after last value if index == len(dset)-1: txtfile.write(repr(dset[index])) else: txtfile.write(repr(dset[index])+',') txtfile.close() return None Is there a faster way to write this to a file? Perhaps I could convert the dataset into a NumPy array or even a Python list, and then use some file-writing tool? (I could experiment with concatenating the values into a larger string before writing to file, but I'm hoping there's something entirely more elegant)

    Read the article

  • Where can I buy a good rackmount workstation?

    - by yan bellavance
    We have a product which consists of a GUI program and all the hardware goes in a rack. Our department bought a rackmount server for the first unit, but I dont think this is adequate for applications that use graphics (correct me if I'm wrong - we bought a Dell R710). Could you tell me of a good rackmount workstation we could buy for our product? Also, would it be risky for us to build our own rackmount?

    Read the article

  • Is FreeBSD better than CentOS for firing 40k concurrent connections (for Jmeter)?

    - by blacklotus
    Hi, I am trying to run Jmeter to simulate 40k concurrent users and stress test a particular system. Putting aside the possibility that Jmeter may not be able to push such a high number (although I have read that it is at least possible to handle 10k concurrent threads on a very powerful machine), is FreeBSD a better OS as compare to CentOS to be used for my Jmeter machine? Reason for asking this is that, I have found articles on FreeBSD for tuning and optimizing for maximum outbound connections, but seem to have little luck with CentOS. Personally however, I am more familiar with CentOS and would like to stick with it if possible. Any input is greatly appreciated!

    Read the article

  • Ubuntu 10.4 No internet

    - by Keeper780
    I have Ubuntu 10.4 dual booted with Windows Vista on a work Lenovo R61 laptop. The home and work wireless connection were working fine. I lost all internet connection at work. The IT guy clearly knew nothing about Linux. Since he 'fixed' it get nothing, no wlan signal the Network manager icon was gone, no internet. I still have the live disc and if I run from the live disc the connections are there and everything works perfectly. How do I restore the internet easily on my laptop. I have been using Linux for 3 Years but I am still a bit of a newbie, this is the first major problem I've had in three years. It's driving me nuts. Thanks

    Read the article

  • xmlhttp.responseText and xmlhttp.readyState works fine with localhost but if i use IP address it is

    - by hemant
    Hi All, xmlhttp.responseText and xmlhttp.readyState works fine with localhost but if i use IP address it is not returning values same as localhost. function getFilenames() { xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Browser does not support HTTP Request"); return; } var url="GetFileNames.php"; xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("GET",url,true); xmlhttp.send(null); } function stateChanged() { if (xmlhttp.readyState == 4) { StringFileName = xmlhttp.responseText; } else { StringFileName = null; } } Regards Hemant

    Read the article

  • How to update assmebly version info with new build and revision during build?

    - by hrushikesh
    I have to update the build number in assembly version of assemblyinfo.cs file. I have written a custom tasks which updates all the assmeblyinfo.cs under a solution before starting build. But when i change this file and try to build then some of my dlls which has reference of other dlls not able to compile as they dont find the specific version assembly. I have some files which uses strong name assembly also. Not sure how to update their version. I have tried setting specific version to false,but still same error is coming. Can you anybody tell me the good way to update the assemblyinfo.cs with incremental build number? P.S. i am using NANT tasks for automating by builds.

    Read the article

  • Cannot run unit tests for an application developed with Compact Framework for Windows CE 6.0 platfor

    - by Thomasek
    I'm developing a solution for Windows CE 6.0 using GuD_AtomKit X86 Device emulator. I'm not able to run any unit tests, because I get following error message: The test adapter ('Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') required to execute this test could not be loaded. Check that the test adapter is installed properly. Exception of type 'Microsoft.VisualStudio.SmartDevice.TestHostAdapter.DeviceAgent.TestAlreadyRunningException' was thrown. But there's no unit test running on the device. I would really appreciate your help.

    Read the article

  • Anyone else unable to listen to uncaughtErrorEvent when loaded by another swf?

    - by aaaidan
    When I try to access the uncaughtErrorEvents dispatcher when loaded directly, everything works well. But when I try the same code when loaded by another swf I get a reference error. protected function onAddedToStage(e:Event):void { trace("Flash version: " + Capabilities.version); try { loaderInfo.uncaughtErrorEvents.addEventListener("uncaughtError", onUncaughtError); trace("YAY!"); } catch (e:Error) { trace(e); } } Output when loaded directly (in browser): Flash version: MAC 10,1,53,64 YAY! Output when loaded by another "loader" SWF: Flash version: MAC 10,1,53,64 ReferenceError: Error #1069: Property uncaughtErrorEvents not found on flash.display.LoaderInfo and there is no default value. If others can replicate this I'd be appreciative. EDIT: Also have tried this with stage.loaderInfo, instead of just loaderInfo. Same issue...

    Read the article

  • How to color HTML elements based on a user command string

    - by Anonymous the Great
    When you type something like "red:Hi:" it will type "Hi" in red. The following script does not work and I do not know why, (The one who made the sorting PHP function is Graphain, thanks again!) <?php function getit($raw) { # If the value was posted $raw = isset($raw) ? $raw : ""; # Split it based on ':' $parsed = explode(':', $raw); $colorClass = ""; $text = ""; if (count($parsed) >= 2) { $colorClass = $parsed[0]; $text = $parsed[1]; $text = "~~~" . $text . "~~~" . $colorClass; return $text; } } ?> <script type="text/javascript"> function postit() { var preview = document.getElementById("preview").value; var submit = document.getElementById("post").value; var text = <?php getit(submit); ?> var t = text[0]; preview = t; } </script> <textarea id="preview" cols=70 rows=5 readonly>Preview box</textarea> <p> <textarea id="post" cols=70 rows=5/>Submit box</textarea> <p> <input type="button" onclick="postit();" value="Submit"/>

    Read the article

  • designing an ASP.NET MVC partial view - showing user choices within a large set of choices

    - by p.campbell
    Consider a partial view whose job is to render markup for a pizza order. The desire is to reuse this partial view in the Create, Details, and Update views. It will always be passed an IEnumerable<Topping>, and output a multitude of checkboxes. There are lots... maybe 40 in all (yes, that might smell). A-OK so far. Problem The question is around how to include the user's choices on the Details and Update views. From the datastore, we've got a List<ChosenTopping>. The goal is to have each checkbox set to true for each chosen topping. What's the easiest to read, or most maintainable way to achieve this? Potential Solutions Create a ViewModel with the List and List. Write out the checkboxes as per normal. While writing each, check whether the ToppingID exists in the list of ChosenTopping. Create a new ViewModel that's a hybrid of both. Perhaps call it DisplayTopping or similar. It would have property ID, Name and IsUserChosen. The respective controller methods for Create, Update, and Details would have to create this new collection with respect to the user's choices as they see fit. The Create controller method would basically set all to false so that it appears to be a blank slate. The real application isn't pizza, and the organization is a bit different from the fakeshot, but the concept is the same. Is it wise to reuse the control for the 3 different scenarios? How better can you display the list of options + the user's current choices? Would you use jQuery instead to show the user selections? Any other thoughts on the potential smell of splashing up a whole bunch of checkboxes?

    Read the article

  • javscript delay output

    - by tazim
    I have written some code to display server's current date and time on browser every time user clicks the button . I have done this using ajax in django with the help of jquery. Now my, problem is I have to continously display the date and time once the button is clicked . Some Sample code or utilities allowing such kind of delay will be helpful . Thanks in advance The template is : $(document).ready(function() { $("button").click(function() { $.ajax({ type: "POST", url :"/showdate/", datatype: "json ", success : function(data){ var s = data.currentdate; var sd = s $(sd).appendTo("div"); } }); }); }); <button type="button">Click Me</button> <div id="someid"></div> The view function is : def showdate(request): now = datetime.datetime.now() string_now = str(now) return_dict = {'currentdate':string_now} json = simplejson.dumps(return_dict) return HttpResponse(json,mimetype="application/json")

    Read the article

  • Using new to allocate an array of class elements with an overloaded constructor in C++.

    - by GordoN
    As an example say I have a class foo that does not have a default constructor but one that looks like this foo:foo(int _varA,int _varB) { m_VarA = _varA; m_VarB = _varB; } How would I allocate an array of these. I seem to remember trying somthing like this unsuccessfully. foo* MyArray = new foo[100](25,14). I don't think this will work either. foo* MyArray = new foo[100](25,14) Can this be done? I typically do this by writing the default constructor using some preset values for _varA and _varB. Then adding a function to reset _varA and _varB for each element but that will not work for this case. Thanks for the help.

    Read the article

  • xml append issue in ie,chrome

    - by 3gwebtrain
    Hi, I am creating a html page, using xml data. in which i am using the following function. It works fine with firefox,opera,safari. but in case of ie7,ie8, and chrome the data what i am getting from xml, is not appending properly. any one help me to solve this issue? in case any special thing need to concentrate on append funcation as well let me know.. $(function(){ var thisPage; var parentPage; $('ul.left-navi li a').each(function(){ $('ul.left-navi li a').removeClass('current'); var pathname = (window.location.pathname.match(/[^\/]+$/)[0]); var currentPage = $(this).attr('href'); var pathArr = new Array(); pathArr = pathname.split("."); var file = pathArr[pathArr.length - 2]; thisPage = file; if(currentPage==pathname){ $(this).addClass("active"); } }) $.get('career-utility.xml',function(myData){ var myXml = $(myData).find(thisPage); parentPage = thisPage; var overviewTitle = myXml.find('overview').attr('title'); var description = myXml.find('discription').text(); var mainsublinkTitle = myXml.find('mainsublink').attr('title'); var thisTitle = myXml.find("intro").attr('title'); var thisIntro = myXml.find("introinfo").text(); $('<h3>'+overviewTitle+'</h3>').appendTo('.overViewInfo'); $('<p>'+description+'</p>').appendTo('.overViewInfo'); var sublinks = myXml.find('mainsublink').children('sublink'); $('#intro h3').append(thisTitle); $('#intro').append(thisIntro); sublinks.each(function(numsub){ var newSubLink = $(this); var sublinkPage = $(this).attr('pageto'); var linkInfo = $(this).text(); $('ul.career-link').append('<li><a href="'+sublinkPage+'">'+linkInfo+'</a></li>'); }) $(myXml).find('listgroup').each(function(index){ var count = index; var listGroup = $(this); var listGroupTitle = $(this).attr('title'); var shortNote = $(this).attr('shortnote'); var subLink = $(this).find('sublist'); var firstList = $(this).find('list'); $('.grouplist').append('<div class="list-group"><h3>'+listGroupTitle+'</h3><ul class="level-one level' + count + '"></ul></div>'); firstList.each(function(listnum) { $(this).wrapInner('<li>') .find('sublistgroup').wrapInner('<ul>').children().unwrap() .find('sublist').wrapInner('<li>').children().unwrap(); $('ul.level'+count).append($(this).children()); }); }); }); }) Thanks for advance..

    Read the article

  • Can I write a test that succeeds if and only if a statement does not compile?

    - by Billy ONeal
    I'd like to prevent clients of my class from doing something stupid. To that end, I have used the type system, and made my class only accept specific types as input. Consider the following example (Not real code, I've left off things like virtual destructors for the sake of example): class MyDataChunk { //Look Ma! Implementation! }; class Sink; class Source { virtual void Run() = 0; Sink *next_; void SetNext(Sink *next) { next_ = next; } }; class Sink { virtual void GiveMeAChunk(const MyDataChunk& data) { //Impl }; }; class In { virtual void Run { //Impl } }; class Out { }; //Note how filter and sorter have the same declaration. Concrete classes //will inherit from them. The seperate names are there to ensure only //that some idiot doesn't go in and put in a filter where someone expects //a sorter, etc. class Filter : public Source, public Sink { //Drop objects from the chain-of-command pattern that don't match a particular //criterion. }; class Sorter : public Source, public Sink { //Sorts inputs to outputs. There are different sorters because someone might //want to sort by filename, size, date, etc... }; class MyClass { In i; Out o; Filter f; Sorter s; public: //Functions to set i, o, f, and s void Execute() { i.SetNext(f); f.SetNext(s); s.SetNext(o); i.Run(); } }; What I don't want is for somebody to come back later and go, "Hey, look! Sorter and Filter have the same signature. I can make a common one that does both!", thus breaking the semantic difference MyClass requires. Is this a common kind of requirement, and if so, how might I implement a test for it?

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >