Daily Archives

Articles indexed Tuesday June 1 2010

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

  • What the performance impact of enabling WebSphere PMI

    - by Andrew Whitehouse
    I am currently looking at some JProfiler traces from our WebSphere-based application, and am noticing that a significant amount of CPU time is being spent in the class com.ibm.io.async.AsyncLibrary.getCompletionData2. I am guessing, but I am wondering whether this is PMI-related (and we do have this enabled). My knowledge of PMI is limited, as this is managed by another team. Is it expected that PMI can have this sort of impact? (If so) Is the only option to turn it off completely? Or are there some types of data capture that have a particularly high overhead?

    Read the article

  • Where does respository resides in after converting CVS repository into SVN using cvs2svn ?

    - by thetna
    I am using cvs2svn for converting already existing CVS repository into svn repository. While doing it using command line , it makes all the passes and creates a repository in the SVN. But i am not able to find all the files in the particular directory. Where does that repository resides? I used following command to convert the CVS to SVN repository. cvs2svn -s /home/user/Subversion/repos /home/usr/cvsrepo

    Read the article

  • information need to display below in Form using Swing

    - by vamshikpd
    Hi All, I am using SunJavaStudio Enterprise 8 , using swing framework I created form,In form I added Jlable,JFormattedTextfield,Jpanle1,Jpanel2 and Jpanel3 in order wise.I am using GridBag layout.Above order displayed in form first line onwards, I want , In Form ,above will some gap and middle layer display the added fields . how to arrange the Form? Please help me,its urgent

    Read the article

  • NoSQL with RavenDB and ASP.NET MVC - Part 2

    - by shiju
    In my previous post, we have discussed on how to work with RavenDB document database in an ASP.NET MVC application. We have setup RavenDB for our ASP.NET MVC application and did basic CRUD operations against a simple domain entity. In this post, let’s discuss on domain entity with deep object graph and how to query against RavenDB documents using Indexes.Let's create two domain entities for our demo ASP.NET MVC appplication  public class Category {       public string Id { get; set; }     [Required(ErrorMessage = "Name Required")]     [StringLength(25, ErrorMessage = "Must be less than 25 characters")]     public string Name { get; set;}     public string Description { get; set; }     public List<Expense> Expenses { get; set; }       public Category()     {         Expenses = new List<Expense>();     } }    public class Expense {       public string Id { get; set; }     public Category Category { get; set; }     public string  Transaction { get; set; }     public DateTime Date { get; set; }     public double Amount { get; set; }   }  We have two domain entities - Category and Expense. A single category contains a list of expense transactions and every expense transaction should have a Category.Let's create  ASP.NET MVC view model  for Expense transaction public class ExpenseViewModel {     public string Id { get; set; }       public string CategoryId { get; set; }       [Required(ErrorMessage = "Transaction Required")]            public string Transaction { get; set; }       [Required(ErrorMessage = "Date Required")]            public DateTime Date { get; set; }       [Required(ErrorMessage = "Amount Required")]     public double Amount { get; set; }       public IEnumerable<SelectListItem> Category { get; set; } } Let's create a contract type for Expense Repository  public interface IExpenseRepository {     Expense Load(string id);     IEnumerable<Expense> GetExpenseTransactions(DateTime startDate,DateTime endDate);     void Save(Expense expense,string categoryId);     void Delete(string id);  } Let's create a concrete type for Expense Repository for handling CRUD operations. public class ExpenseRepository : IExpenseRepository {   private IDocumentSession session; public ExpenseRepository() {         session = MvcApplication.CurrentSession; } public Expense Load(string id) {     return session.Load<Expense>(id); } public IEnumerable<Expense> GetExpenseTransactions(DateTime startDate, DateTime endDate) {             //Querying using the Index name "ExpenseTransactions"     //filtering with dates     var expenses = session.LuceneQuery<Expense>("ExpenseTransactions")         .WaitForNonStaleResults()         .Where(exp => exp.Date >= startDate && exp.Date <= endDate)         .ToArray();     return expenses; } public void Save(Expense expense,string categoryId) {     var category = session.Load<Category>(categoryId);     if (string.IsNullOrEmpty(expense.Id))     {         //new expense transaction         expense.Category = category;         session.Store(expense);     }     else     {         //modifying an existing expense transaction         var expenseToEdit = Load(expense.Id);         //Copy values to  expenseToEdit         ModelCopier.CopyModel(expense, expenseToEdit);         //set category object         expenseToEdit.Category = category;       }     //save changes     session.SaveChanges(); } public void Delete(string id) {     var expense = Load(id);     session.Delete<Expense>(expense);     session.SaveChanges(); }   }  Insert/Update Expense Transaction The Save method is used for both insert a new expense record and modifying an existing expense transaction. For a new expense transaction, we store the expense object with associated category into document session object and load the existing expense object and assign values to it for editing a existing record.  public void Save(Expense expense,string categoryId) {     var category = session.Load<Category>(categoryId);     if (string.IsNullOrEmpty(expense.Id))     {         //new expense transaction         expense.Category = category;         session.Store(expense);     }     else     {         //modifying an existing expense transaction         var expenseToEdit = Load(expense.Id);         //Copy values to  expenseToEdit         ModelCopier.CopyModel(expense, expenseToEdit);         //set category object         expenseToEdit.Category = category;       }     //save changes     session.SaveChanges(); } Querying Expense transactions   public IEnumerable<Expense> GetExpenseTransactions(DateTime startDate, DateTime endDate) {             //Querying using the Index name "ExpenseTransactions"     //filtering with dates     var expenses = session.LuceneQuery<Expense>("ExpenseTransactions")         .WaitForNonStaleResults()         .Where(exp => exp.Date >= startDate && exp.Date <= endDate)         .ToArray();     return expenses; }  The GetExpenseTransactions method returns expense transactions using a LINQ query expression with a Date comparison filter. The Lucene Query is using a index named "ExpenseTransactions" for getting the result set. In RavenDB, Indexes are LINQ queries stored in the RavenDB server and would be  executed on the background and will perform query against the JSON documents. Indexes will be working with a lucene query expression or a set operation. Indexes are composed using a Map and Reduce function. Check out Ayende's blog post on Map/Reduce We can create index using RavenDB web admin tool as well as programmitically using its Client API. The below shows the screen shot of creating index using web admin tool. We can also create Indexes using Raven Cleint API as shown in the following code documentStore.DatabaseCommands.PutIndex("ExpenseTransactions",     new IndexDefinition<Expense,Expense>() {     Map = Expenses => from exp in Expenses                     select new { exp.Date } });  In the Map function, we used a Linq expression as shown in the following from exp in docs.Expensesselect new { exp.Date };We have not used a Reduce function for the above index. A Reduce function is useful while performing aggregate functions based on the results from the Map function. Indexes can be use with set operations of RavenDB.SET OperationsUnlike other document databases, RavenDB supports set based operations that lets you to perform updates, deletes and inserts to the bulk_docs endpoint of RavenDB. For doing this, you just pass a query to a Index as shown in the following commandDELETE http://localhost:8080/bulk_docs/ExpenseTransactions?query=Date:20100531The above command using the Index named "ExpenseTransactions" for querying the documents with Date filter and  will delete all the documents that match the query criteria. The above command is equivalent of the following queryDELETE FROM ExpensesWHERE Date='2010-05-31' Controller & ActionsWe have created Expense Repository class for performing CRUD operations for the Expense transactions. Let's create a controller class for handling expense transactions.   public class ExpenseController : Controller { private ICategoryRepository categoyRepository; private IExpenseRepository expenseRepository; public ExpenseController(ICategoryRepository categoyRepository, IExpenseRepository expenseRepository) {     this.categoyRepository = categoyRepository;     this.expenseRepository = expenseRepository; } //Get Expense transactions based on dates public ActionResult Index(DateTime? StartDate, DateTime? EndDate) {     //If date is not passed, take current month's first and last dte     DateTime dtNow;     dtNow = DateTime.Today;     if (!StartDate.HasValue)     {         StartDate = new DateTime(dtNow.Year, dtNow.Month, 1);         EndDate = StartDate.Value.AddMonths(1).AddDays(-1);     }     //take last date of startdate's month, if endate is not passed     if (StartDate.HasValue && !EndDate.HasValue)     {         EndDate = (new DateTime(StartDate.Value.Year, StartDate.Value.Month, 1)).AddMonths(1).AddDays(-1);     }       var expenses = expenseRepository.GetExpenseTransactions(StartDate.Value, EndDate.Value);     if (Request.IsAjaxRequest())     {           return PartialView("ExpenseList", expenses);     }     ViewData.Add("StartDate", StartDate.Value.ToShortDateString());     ViewData.Add("EndDate", EndDate.Value.ToShortDateString());             return View(expenses);            }   // GET: /Expense/Edit public ActionResult Edit(string id) {       var expenseModel = new ExpenseViewModel();     var expense = expenseRepository.Load(id);     ModelCopier.CopyModel(expense, expenseModel);     var categories = categoyRepository.GetCategories();     expenseModel.Category = categories.ToSelectListItems(expense.Category.Id.ToString());                    return View("Save", expenseModel);          }   // // GET: /Expense/Create   public ActionResult Create() {     var expenseModel = new ExpenseViewModel();               var categories = categoyRepository.GetCategories();     expenseModel.Category = categories.ToSelectListItems("-1");     expenseModel.Date = DateTime.Today;     return View("Save", expenseModel); }   // // POST: /Expense/Save // Insert/Update Expense Tansaction [HttpPost] public ActionResult Save(ExpenseViewModel expenseViewModel) {     try     {         if (!ModelState.IsValid)         {               var categories = categoyRepository.GetCategories();                 expenseViewModel.Category = categories.ToSelectListItems(expenseViewModel.CategoryId);                               return View("Save", expenseViewModel);         }           var expense=new Expense();         ModelCopier.CopyModel(expenseViewModel, expense);          expenseRepository.Save(expense, expenseViewModel.CategoryId);                       return RedirectToAction("Index");     }     catch     {         return View();     } } //Delete a Expense Transaction public ActionResult Delete(string id) {     expenseRepository.Delete(id);     return RedirectToAction("Index");     }     }     Download the Source - You can download the source code from http://ravenmvc.codeplex.com

    Read the article

  • In IE8, When File Download Completes, No Save Dialog Appears

    For quite some time now, when I download file using IE8, the file finishes downloading and there is no pop up that allows me to open the containing folder, or open the file itself.  Ive had to... This site is a resource for asp.net web programming. It has examples by Peter Kellner of techniques for high performance programming...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Dynamically apply and change Theme with the Silverlight Toolkit

    This tutorial shows you how to Theme your Silverlight app and allow the user to switch Theme dynamically.   Introduction Its been a while since Silverlight Toolkit has Theming support, but with the April 2010 version and the new features of Silverlight 4 it is now easier than ever to apply those themes. What you need to know: ImplicitStyleManager was removed from the Toolkit, this is because implicit styles are now supported in Silverlight 4. The Toolkit has now a Theme control...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • SQL SERVER Precision of SMALLDATETIME A 1 MinutePrecision

    I am myself surprised that I am writing this post today. I am going to present one of the very known facts of SQL Server SMALLDATETIME datatype. Even though this is a very well-known datatype, many a time, I have seen developers getting confused with precision of the SMALLDATETIME datatype. The precision of the datatype [...]...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • WinXP 64bit cannot see files on dfs

    - by Kvad
    Hi, I have Server1 Win2008 Storage Server Running DFS Access-based enumeration - off Offline settings - disabled Workstation1 WinXP SP3 32bit Workstation2 WinXP SP2 64bit I have a shared folder on Server1 on the DFS share. Workstation1 can see all files and folders. Workstation2 does not. I have tested with multiple WinXP 64bit PCs and the same files across these machines do not show up. Going directly to the files via the address bar works.

    Read the article

  • How to convert lots of database file from MSSQL 2000 to MSSQL 2005?

    - by Tech
    Hi all, I am moving the SQL Server from MSSQL 2000 to MSSQL 2005, and I found the article in the web like this: http://www.aspfree.com/c/a/MS-SQL-Server/Moving-Data-from-SQL-Server-2000-to-SQL-Server-2005/ It works, but the problem is, it only move database one by one. Because I have so many database, is there any easy way to do so? or is there provides any batches / untitlty allow me to do so? thz u.

    Read the article

  • How do I use modulus for float/double?

    - by ShrimpCrackers
    I'm creating an RPN calculator for a school project. I'm having trouble with the modulus operator. Since we're using the double data type, modulus won't work on floating point numbers. For example, 0.5 % 0.3 should return 0.2 but I'm getting a division by zero exception. The instruction says to use fmod(). I've looked everywhere for fmod(), including javadocs but I can't find it. I'm starting to think it's a method I'm going to have to create? edit: hmm, strange. I just plugged in those numbers again and it seems to be working fine...but just in case. Do I need to watch out using the mod operator in Java when using floating types? I know something like this can't be done in C++ (I think).

    Read the article

  • Trying to debug a 'Assertion failure in -[UIActionSheet showInView:]' error....

    - by dsobol
    I am working through "Beginning iPad Application Development" and am getting hung up in Chapter 3 where I have created a project that works with an Action Sheet. As it stands now, my application loads into the simulator just fine with no errors that I am aware of, but as it runs, it crashes with the following errors showing up in the debugger window: 2010-05-31 19:44:39.703 UsingViewsActionSheet[49538:207] * Assertion failure in -[UIActionSheet showInView:], /SourceCache/UIKit_Sim/UIKit-1145.66/UIAlert.m:7073 2010-05-31 19:44:39.705 UsingViewsActionSheet[49538:207] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: view != nil' I am sure that this is the block where the app breaks based upon my use of breakpoints. //Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { UIActionSheet *action = [[UIActionSheet alloc] initWithTitle:@"This is my Action Sheet!" delegate:self cancelButtonTitle:@"OK" destructiveButtonTitle:@"Delete Message!" otherButtonTitles:@"Option 1", @"Option 2", @"Option 3", nil]; [action showInView:self.view]; // <-- This line seems to trigger the crash.... [action release]; [super viewDidLoad]; } Am I missing something obvious, or is there more to the problem than is shown here? I have looked at the abstract for showInView and cannot divine anything there yet. I appreciate any and all asssitance. Regards, Steve O'Sullivan

    Read the article

  • Path String Concatenation Question in C#.

    - by Nano HE
    Hello. I want to output D:\Learning\CS\Resource\Tutorial\C#LangTutorial But can't work. Compiler error error CS0165: Use of unassigned local variable 'StrPathHead Please give me some advice about how to correct my code or other better solution for my case. Thank you. static void Main(string[] args) { string path = "D:\\Learning\\CS\\Resource\\Book\\C#InDeepth"; int n = 0; string[] words = path.Split('\\'); foreach (string word in words) { string StrPathHead; string StrPath; Console.WriteLine(word); if (word == "Resource") { StrPath = StrPathHead + word + "\\Tutorial\\C#LangTutorial"; } else { StrPathHead += words[n++] + "\\"; } } }

    Read the article

  • Combining Two Models in Rails for a Form

    - by matsko
    Hey Guys. I'm very new with rails and I've been building a CMS application backend. All is going well, but I would like to know if this is possible? Basically I have two models: @page { id, name, number } @extended_page { id, page_id, description, image } The idea is that there are bunch of pages but NOT ALL pages have extended_content. In the event that there is a page with extended content then I want to be able to have a form that allows for editing both of them. In the controller: @page = Page.find(params[:id]) @extended= Extended.find(:first, :conditions = ["page_id = ?",@page.id]) @combined = ... #merge the two somehow So in the view: <%- form_for @combined do |f| % <%= f.label :name % <%= f.text_field :name % ... <%= f.label :description % <%= f.text_field :description % <%- end This way in the controller, there only has to be one model that will be updated (which will update to both). Is this possible?

    Read the article

  • Memory Efficient file append

    - by lboregard
    i have several files whose content need to be merged into a single file. i have the following code that does this ... but it seems rather inefficient in terms of memory usage ... would you suggest a better way to do it ? the Util.MoveFile function simply accounts for moving files across volumes private void Compose(string[] files) { string inFile = ""; string outFile = "c:\final.txt"; using (FileStream fsOut = new FileStream(outFile + ".tmp", FileMode.Create)) { foreach (string inFile in files) { if (!File.Exists(inFile)) { continue; } byte[] bytes; using (FileStream fsIn = new FileStream(inFile, FileMode.Open)) { bytes = new byte[fsIn.Length]; fsIn.Read(bytes, 0, bytes.Length); } //using (StreamReader sr = new StreamReader(inFile)) //{ // text = sr.ReadToEnd(); //} // write the segment to final file fsOut.Write(bytes, 0, bytes.Length); File.Delete(inFile); } } Util.MoveFile(outFile + ".tmp", outFile); }

    Read the article

  • Changing the language for NSLocalizedString() in run time

    - by user117758
    I have an iPhone application which has a button to change display language in run time. I have looked at NSLocalizedString() which will return the appropriate strings according to system preference. What are my options rather than hard coding all the display strings and return according to user language selection in run time? Any pointers will be much appreciated.

    Read the article

  • python imaging library draw text new line how to?

    - by joven
    i have a word that will be putted on a image but the problem is that the word continues even though the word exceeds the width of the image is there anyway that the word shift's down if the word exceeds the width of the image or on a certain point the word shift's down if it exceeds the given point

    Read the article

  • 2d terrain generation in real time

    - by Skoder
    Hey, I'm trying to create a game similar to this (Note:When you click 'play', there are SFX in the game which you can't seem to turn off, so you may want to check volume). In particular, I'm interested in knowing how the 'infinite' landscape is generated. Are there any tutorials/articles describing this? I came across procedural generation, but I'm not quite sure what topics I should be looking for (or if it's even procedural generation). (I'm using C#, but I don't mind the language as I assume the theory behind it remains the same) Thanks for any suggestions

    Read the article

  • Need help with changing text with combobox state change

    - by Mirage
    I have one text box and one combobox. I want it such that when someone changes the combobox value, the text should change in the text field. priceText is the name of text box My code is below; it's not working: var comboFar:ComboBox = new ComboBox(); addChild(comboFar); var items2:Array = [ {label:"Arizona", data:"87.97"}, {label:"Colorado", data:"91.97"}, ]; comboFar.dataProvider = new DataProvider(items2); comboFar.addEventListener("change",testFar()); function testFar(event):void { priceText.text =event_obj.target.selectedItem.data; }

    Read the article

  • What's the most concise cross-browser way to access an <iframe> element's window and document?

    - by Bungle
    I'm trying to figure out the best way to access an <iframe> element's window and document properties from a parent page. The <iframe> may be created via JavaScript or accessed via a reference stored in an object property or a variable, so, if I understand correctly, that rules out the use of document.frames. I've seen this done a number of ways, but I'm unsure about the best approach. Given an <iframe> created in this way: var iframe = document.createElement('iframe'); document.getElementsByTagName('body')[0].appendChild(iframe); I'm currently using this to access the document, and it seems to work OK across the major browsers: var doc = iframe.contentWindow || iframe.contentDocument; if (doc.document) { doc = doc.document; } I've also see this approach: var iframe = document.getElementById('my_iframe'); iframe = (iframe.contentWindow) ? iframe.contentWindow : (iframe.contentDocument.document) ? iframe.contentDocument.document : iframe.contentDocument; iframe.document.open(); iframe.document.write('Hello World!'); iframe.document.close(); That confuses me, since it seems that if iframe.contentDocument.document is defined, you're going to end up trying to access iframe.contentDocument.document.document. There's also this: var frame_ref = document.getElementsByTagName('iframe')[0]; var iframe_doc = frame_ref.contentWindow ? frame_ref.contentWindow.document : frame_ref.contentDocument; In the end, I guess I'm confused as to which properties hold which properties, whether contentDocument is equivalent to document or whether there is such a property as contentDocument.document, etc. Can anyone point me to an accurate/timely reference on these properties, or give a quick briefing on how to efficiently access an <iframe>'s window and document properties in a cross-browser way (without the use of jQuery or other libraries)? Thanks for any help!

    Read the article

  • Why does calling abort() on ajax request cause error in ASP.Net MVC (IE8)

    - by user169867
    I use jquery to post to an MVC controller action that returns a table of information. The user of the page triggers this by clicking on various links. In the event the user decides to click a bunch of these links in quick succession I wanted to cancel any previous ajax request that may not have finished. I've found that when I do this (although its fine from the client's POV) I will get errors on the web application saying that "The parameters dictionary contains a null entry for parameter srtCol of non-nullable type 'System.Int32'" Now the ajax post deffinately passes in all the parameters, and if I don't try and cancel the ajax request it works just fine. But if I do cancel the request by calling abort() on the XMLHttpRequest object that ajax() returns before it finishes I get the error from ASP.Net MVC. Example: //Cancel any pevious request if (req) { req.abort(); req = null; } //Make new request req= $.ajax({ type: 'POST', url: "/Myapp/GetTbl", data: {srtCol: srt, view: viewID}, success: OnSuccess, error: OnError, dataType: "html" }); I've noticed this only happen is IE8. In FF it seems to not cuase a problem. Does anyone know how to cancel an ajax request in IE8 without causing errors for MVC? Thanks for any help.

    Read the article

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