Daily Archives

Articles indexed Monday November 26 2012

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

  • RoR model field without validators, has*, delegates, etc

    - by jackr
    How can I declare a field, in the Rails model, when it doesn't have any "has_" relations, or validations, or delegations? I just need to ensure its existence and column width in the schema. Currently, I have no mention of the field in the "schema section" of the model file, but it's referenced in various methods that use it, and this seems to work. However, depending on my exact creation workflow, the underlying database table may be created as t.binary "field_name", :limit => 32 or t.binary "field_name", :limit => 255 This is not a restriction on the value (any binary value is valid, even NULL), only on the table column declaration. As it happens, 32 is enough -- it never receives any larger value, it's only ever written to like this: self.field_name = SecureRandom.random_bytes(32)

    Read the article

  • Qt/C++, Problems with large QImage

    - by David Günzel
    I'm pretty new to C++/Qt and I'm trying to create an application with Visual Studio C++ and Qt (4.8.3). The application displays images using a QGraphicsView, I need to change the images at pixel level. The basic code is (simplified): QImage* img = new QImage(img_width,img_height,QImage::Format_RGB32); while(do_some_stuff) { img->setPixel(x,y,color); } QGraphicsPixmapItem* pm = new QGraphicsPixmapItem(QPixmap::fromImage(*img)); QGraphicsScene* sc = new QGraphicsScene; sc->setSceneRect(0,0,img->width(),img->height()); sc->addItem(pm); ui.graphicsView->setScene(sc); This works well for images up to around 12000x6000 pixel. The weird thing happens beyond this size. When I set img_width=16000 and img_height=8000, for example, the line img = new QImage(...) returns a null image. The image data should be around 512,000,000 bytes, so it shouldn't be too large, even on a 32 bit system. Also, my machine (Win 7 64bit, 8 GB RAM) should be capable of holding the data. I've also tried this version: uchar* imgbuf = (uchar*) malloc(img_width*img_height*4); QImage* img = new QImage(imgbuf,img_width,img_height,QImage::Format_RGB32); At first, this works. The img pointer is valid and calling img-width() for example returns the correct image width (instead of 0, in case the image pointer is null). But as soon as I call img-setPixel(), the pointer becomes null and img-width() returns 0. So what am I doing wrong? Or is there a better way of modifying large images on pixel level? Regards, David

    Read the article

  • Updating UISearchDisplayController with Core Data results using GCD

    - by Brian Halpin
    I'm having trouble displaying the results from Core Data in my UISearchDisplayController when I implement GCD. Without it, it works, but obviously blocks the UI. In my SearchTableViewController I have the following two methods: - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString { // Tell the table data source to reload when text changes [self filterContentForSearchText:searchString]; // Return YES to cause the search result table view to be reloaded. return YES; } // Update the filtered array based on the search text -(void)filterContentForSearchText:(NSString*)searchText { // Remove all objects from the filtered search array [self.filteredLocationsArray removeAllObjects]; NSPredicate *predicate = [CoreDataMaster predicateForLocationUsingSearchText:@"Limerick"]; CoreDataMaster *coreDataMaster = [[CoreDataMaster alloc] init]; // Filter the array using NSPredicate self.filteredLocationsArray = [NSMutableArray arrayWithArray: [coreDataMaster fetchResultsFromCoreDataEntity:@"City" UsingPredicate:predicate]]; } You can probably guess that my problem is with returning the array from [coreDataMaster fetchResultsFromCoreDataEntity]. Below is the method: - (NSArray *)fetchResultsFromCoreDataEntity:(NSString *)entity UsingPredicate:(NSPredicate *)predicate { NSMutableArray *fetchedResults = [[NSMutableArray alloc] init]; dispatch_queue_t coreDataQueue = dispatch_queue_create("com.coredata.queue", DISPATCH_QUEUE_SERIAL); dispatch_async(coreDataQueue, ^{ NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entityDescription = [NSEntityDescription entityForName:entity inManagedObjectContext:self.managedObjectContext]; NSSortDescriptor *nameSort = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES]; NSArray *sortDescriptors = [NSArray arrayWithObjects:nameSort, nil]; [fetchRequest setEntity:entityDescription]; [fetchRequest setSortDescriptors:sortDescriptors]; // Check if predicate is set if (predicate) { [fetchRequest setPredicate:predicate]; } NSError *error = nil; NSArray *fetchedManagedObjects = [self.managedObjectContext executeFetchRequest:fetchRequest error:&error]; for (City *city in fetchedManagedObjects) { [fetchedResults addObject:city]; } NSDictionary *userInfo = [NSDictionary dictionaryWithObject:[NSArray arrayWithArray:fetchedResults] forKey:@"results"]; [[NSNotificationCenter defaultCenter] postNotificationName:@"fetchResultsComplete" object:nil userInfo:userInfo]; }); return [NSArray arrayWithArray:fetchedResults]; } So the thread hasn't finished executing by the time it returns the results to self.filteredLocationsArray. I've tried added a NSNotification which passes the NSDictionary to this method: - (void)updateSearchResults:(NSNotification *)notification { NSDictionary *userInfo = notification.userInfo; NSArray *array = [userInfo objectForKey:@"results"]; self.filteredLocationsArray = [NSMutableArray arrayWithArray:array]; [self.tableView reloadData]; } I've also tried refreshing the searchViewController like [self.searchDisplayController.searchResultsTableView reloadData]; but to no avail. I'd really appreciate it if someone could point me in the right direction and show me where I might be going wrong. Thanks

    Read the article

  • Using Range Function

    - by Michael Alexander Riechmann
    My goal is to make a program that takes an input (Battery_Capacity) and ultimately spits out a list of the (New_Battery_Capacity) and the Number of (Cycle) it takes for it ultimately to reach maximum capacity of 80. Cycle = range (160) Charger_Rate = 0.5 * Cycle Battery_Capacity = float(raw_input("Enter Current Capacity:")) New_Battery_Capacity = Battery_Capacity + Charger_Rate if Battery_Capacity < 0: print 'Battery Reading Malfunction (Negative Reading)' elif Battery_Capacity > 80: print 'Battery Reading Malfunction (Overcharged)' elif float(Battery_Capacity) % 0.5 !=0: print 'Battery Malfunction (Charges Only 0.5 Interval)' while Battery_Capacity >= 0 and Battery_Capacity < 80: print New_Battery_Capacity I was wondering why my Cycle = range(160) isn't working in my program?

    Read the article

  • Android - Parsing XML with XPath

    - by Ruben Deig Ramos
    First of all, thanks to all the people who's going to spend a little time on this question. Second, sorry for my english (not my first language! :D). Well, here is my problem. I'm learning Android and I'm making an app which uses a XML file to store some info. I have no problem creating the file, but trying to read de XML tags with XPath (DOM, XMLPullParser, etc. only gave me problems) I've been able to read, at least, the first one. Let's see the code. Here is the XML file the app generates: <dispositivo> <id>111</id> <nombre>Name</nombre> <intervalo>300</intervalo> </dispositivo> And here is the function which reads the XML file: private void leerXML() { try { XPathFactory factory=XPathFactory.newInstance(); XPath xPath=factory.newXPath(); // Introducimos XML en memoria File xmlDocument = new File("/data/data/com.example.gps/files/devloc_cfg.xml"); InputSource inputSource = new InputSource(new FileInputStream(xmlDocument)); // Definimos expresiones para encontrar valor. XPathExpression tag_id = xPath.compile("/dispositivo/id"); String valor_id = tag_id.evaluate(inputSource); id=valor_id; XPathExpression tag_nombre = xPath.compile("/dispositivo/nombre"); String valor_nombre = tag_nombre.evaluate(inputSource); nombre=valor_nombre; } catch (Exception e) { e.printStackTrace(); } } The app gets correctly the id value and shows it on the screen ("id" and "nombre" variables are assigned to a TextView each one), but the "nombre" is not working. What should I change? :) Thanks for all your time and help. This site is quite helpful! PD: I've been searching for a response on the whole site but didn't found any.

    Read the article

  • How to add values accordingly of the first indices of a dictionary of tuples of a list of strings? Python 3x

    - by TheStruggler
    I'm stuck on how to formulate this problem properly and the following is: What if we had the following values: {('A','B','C','D'):3, ('A','C','B','D'):2, ('B','D','C','A'):4, ('D','C','B','A'):3, ('C','B','A','D'):1, ('C','D','A','B'):1} When we sum up the first place values: [5,4,2,3] (5 people picked for A first, 4 people picked for B first, and so on like A = 5, B = 4, C = 2, D = 3) The maximum values for any alphabet is 5, which isn't a majority (5/14 is less than half), where 14 is the sum of total values. So we remove the alphabet with the fewest first place picks. Which in this case is C. I want to return a dictionary where {'A':5, 'B':4, 'C':2, 'D':3} without importing anything. This is my work: def popular(letter): '''(dict of {tuple of (str, str, str, str): int}) -> dict of {str:int} ''' my_dictionary = {} counter = 0 for (alphabet, picks) in letter.items(): if (alphabet[0]): my_dictionary[alphabet[0]] = picks else: my_dictionary[alphabet[0]] = counter return my_dictionary This returns duplicate of keys which I cannot get rid of. Thanks.

    Read the article

  • jquery animation - when do they finish?

    - by Naor
    I have two jquery animations one by other: books.animate({ left: left1 }, { duration: this.slideDuration, easing: this.easing, complete: complete }); laptops.animate({ left: left2 }, { duration: this.slideDuration, easing: this.easing, complete: complete }); I want the animations to run simultanusly so I use {queue: false}: books.animate({ left: left1 }, { duration: this.slideDuration, easing: this.easing, queue: false, complete: complete }); laptops.animate({ left: left2 }, { duration: this.slideDuration, easing: this.easing, queue: false, complete: complete }); But now the completed callback called twice! How can I know exactly when does the both animations are done?

    Read the article

  • C read part of file into cache

    - by Pete Jodo
    I have to do a program (for Linux) where there's an extremely large index file and I have to search and interpret the data from the file. Now the catch is, I'm only allowed to have x-bytes of the file cached at any time (determined by argument) so I have to remove certain data from the cache if it's not what I'm looking for. If my understanding is correct, fopen (r) doesn't put anything in the cache, only when I call getc or fread(specifying size) does it get cached. So my question is, lets say I use fread and read 100 bytes but after checking it, only 20 of the 100 bytes contains the data I need; how would I remove the useless 80 bytes from cache (or overwrite it) in order to read more from the file.

    Read the article

  • Confused about NoMethodError in Ruby

    - by E L
    In a simple Ruby example, I'm getting an error that does not occur in irb. name = "Joe" def say_hi "\"Hi there!\" said #{self}" end response = name.say_hi puts response This code should return, "Hi there!" said Joe. It works perfectly fine in irb. However, when I attempt to put the same code in a file and run the file, I get this error: say_hi.rb:8:in `<main>': private method `say_hi' called for "Joe":String (NoMethodError) Any suggestion about why this happens?

    Read the article

  • Returning Null values with COUNT

    - by Randy B.
    With this query, I get a result that is two short of the table because they are not included in count, and I would like get the NULL values in the result. To do this, I am pretty sure I need to use a subquery of some kind, but I am not sure how, since the attribute in question is an aggregate. SELECT Equipment.SerialNo , Name, COUNT(Assignment.SerialNo) FROM Equipment INNER JOIN Assignment ON Assignment.SerialNo = Equipment.SerialNo GROUP BY Equipment.SerialNo, Name

    Read the article

  • Dynamically add data stored in php to nested json

    - by HoGo
    I am trying to dynamicaly generate data in json for jQuery gantt chart. I know PHP but am totally green with JavaScript. I have read dozen of solutions on how dynamicaly add data to json, and tried few dozens of combinations and nothing. Here is the json format: var data = [{ name: "Sprint 0", desc: "Analysis", values: [{ from: "/Date(1320192000000)/", to: "/Date(1322401600000)/", label: "Requirement Gathering", customClass: "ganttRed" }] },{ name: " ", desc: "Scoping", values: [{ from: "/Date(1322611200000)/", to: "/Date(1323302400000)/", label: "Scoping", customClass: "ganttRed" }] }, <!-- Somoe more data--> }]; now I have all data in php db result. Here it goes: $rows=$db->fetchAllRows($result); $rowsNum=count($rows); And this is how I wanted to create json out of it: var data=''; <?php foreach ($rows as $row){ ?> data['name']="<?php echo $row['name'];?>"; data['desc']="<?php echo $row['desc'];?>"; data['values'] = {"from" : "/Date(<?php echo $row['from'];?>)/", "to" : "/Date(<?php echo $row['to'];?>)/", "label" : "<?php echo $row['label'];?>", "customClass" : "ganttOrange"}; } However this does not work. I have tried without loop and replacing php variables with plain text just to check, but it did not work either. Displays chart without added items. If I add new item by adding it to the list of values, it works. So there is no problem with the Gantt itself or paths. Based on all above I assume the problem is with adding plain data to json. Can anyone please help me to fix it?

    Read the article

  • Issue with Sliding Up/Down a Hidden Div using .toggle()

    - by user1760110
    Can you please take a look at this JSFIDDLE sample which I am trying to create a smooth animate of hidden div from down to up on mouse hover. As you can see the div appears from left down corner but I would like to animate it from bottom to top. I tried to use animate() but I didn't know how to change the hidden div statue from hidden? here is the code I am using: $(document).ready(function() { $('#handler').hover(function(){$('#hidden').toggle(1000)}); });? Can you please let me know how i can use jQuery easing plugin for something like this? Thanks

    Read the article

  • Need to have JProgress bar to measure progress when copying directories and files

    - by user1815823
    I have the below code to copy directories and files but not sure where to measure the progress. Can someone help as to where can I measure how much has been copied and show it in the JProgress bar public static void copy(File src, File dest) throws IOException{ if(src.isDirectory()){ if(!dest.exists()){ //checking whether destination directory exisits dest.mkdir(); System.out.println("Directory copied from " + src + " to " + dest); } String files[] = src.list(); for (String file : files) { File srcFile = new File(src, file); File destFile = new File(dest, file); copyFolder(srcFile,destFile); } }else{ InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dest); byte[] buffer = new byte[1024]; int length; while ((length = in.read(buffer)) > 0){ out.write(buffer, 0, length); } in.close(); out.close(); System.out.println("File copied from " + src + " to " + dest); }

    Read the article

  • Compile Qt Project To Run On A Linux System

    - by ForgiveMeI'mAN00b
    I have a Qt project. It uses the cross platform libraries SDL, OpenGL and FLTK. I want to be able to compile the project so that it can run on a Linux computer. I'm looking at a bunch of articles I have seen so far two ways to do this. Use a cross compiler, which seems to me a rather complicated thing to setup and compile with, or, the other options, is to compile the project simply on a Linux computer, simply the Linux version of Qt creator/SDK. My question is, If I have a Qt project that uses only cross platform libraries, then is creating a Windows version easy as compiling it in Qt/Windows, and creating the Linux version as easy as doing it in Qt/Linux? PS. Please don't ask/complain about why I didn't just try to see if it works myself, I don't have any Linux OS's installed on my computer right now, and I don't want to risk going into the trouble of installing a whole new OS just to have it not work in the end.

    Read the article

  • Fusion Table Layer Caching issue

    - by user1854791
    I have created a series of fusion table layers and apply filtering to one of the layers in response to checkbox click events. The base layer of the map contains a gradient applied over county boundaries. When the base layer is unchecked, the filtered layer loses it's styling. I have added unique timestamps to all queries to avoid caching, however I get the feeling that these image tiles are still be cached for this situation. Is there any way to force the google fusion tables api to invalidate a cached image? Test site here: http://map.inquestmarketing.com/new.html Unchecking the Other - Consumer Prospects checkbox reproduces the issue. This is a pure client app, all of the source is in the single page.

    Read the article

  • enable / disable CrossHaires by external button

    - by Younes
    tooltip: { crosshairs: [{ dashStyle: 'dash' },{ dashStyle: 'dash' }] }, .... $("#toggleCrossHaire").click(function(){ if(chart.tooltip.crosshaires){ chart.tooltip.crosshaires : [false,false]; }eles{ chart.tooltip.crosshaires : [true,true]; } }); enable or disable and change dashStyle of Crosshairs . to solid and dash . by an external button?? this example for more explication

    Read the article

  • TFS 2012 fresh install on fresh Windows Server 2008 warning that reporting services are not installed

    - by jshin47
    I am attempting to evaluate TFS 2012 for our organization but cannot seem to get past the first step of configuring the server using the "Standard Single Server" configuration wizard. In particular, in the service account selection screen, I am warned that: Reporting services are not installed on this computer. You need to install Reporting Services to complete TFS installation with this wizard. This is disheartening because the way I understand it, this should have been installed with the default TFS installation (in fact, no installation options are even provided) and this is a fresh and up-to-date Windows Server 2008 VM. I know I could install SQL Server 2008 or 2012 from MSDN, but shouldn't this work "out of the box?" I'd really rather use the default, small, integrated version of SQL Server that comes with TFS 2012 rather than rolling my own. If it matters, this server is joined to a domain and I am running TFS installation wizard as a domain administrator.

    Read the article

  • R Random Data Sets within loops

    - by jugossery
    Here is what I want to do: I have a time series data frame with let us say 100 time-series of length 600 - each in one column of the data frame. I want to pick up 4 of the time-series randomly and then assign them random weights that sum up to one (ie 0.1, 0.5, 0.3, 0.1). Using those I want to compute the mean of the sum of the 4 weighted time series variables (e.g. convex combination). I want to do this let us say 100k times and store each result in the form ts1.name, ts2.name, ts3.name, ts4.name, weight1, weight2, weight3, weight4, mean so that I get a 9*100k df. I tried some things already but R is very bad with loops and I know vector oriented solutions are better because of R design. Thanks Here is what I did and I know it is horrible The df is in the form v1,v2,v2.....v100 1,5,6,.......9 2,4,6,.......10 3,5,8,.......6 2,2,8,.......2 etc e=NULL for (x in 1:100000) { s=sample(1:100,4)#pick 4 variables randomly a=sample(seq(0,1,0.01),1) b=sample(seq(0,1-a,0.01),1) c=sample(seq(0,(1-a-b),0.01),1) d=1-a-b-c e=c(a,b,c,d)#4 random weights average=mean(timeseries.df[,s]%*%t(e)) e=rbind(e,s,average)#in the end i get the 9*100k df } The procedure runs way to slow. EDIT: Thanks for the help i had,i am not used to think R and i am not very used to translate every problem into a matrix algebra equation which is what you need in R. Then the problem becomes a little bit complex if i want to calculate the standard deviation. i need the covariance matrix and i am not sure i can if/how i can pick random elements for each sample from the original timeseries.df covariance matrix then compute the sample variance (t(sampleweights)%*%sample_cov.mat%*%sampleweights) to get in the end the ts.weighted_standard_dev matrix Last question what is the best way to proceed if i want to bootstrap the original df x times and then apply the same computations to test the robustness of my datas thanks

    Read the article

  • User controls Stopped working after Migration from 3.7 to 5.2

    - by user1400290
    I recently Migrated my 3.7 sp4 project to 5.2, but I had issues while doing so. Currently, my user controls are not working after migration in 5.2 project. Below is the code: User Control Code: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="SiteMenu.ascx.cs" Inherits="UserControls_Nav_SiteMenu" %> <%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %> <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" /> <telerik:RadMenu ID="RadMenu1" runat="server" DataSourceID="SitemapDataSource1" OnItemDataBound="RadMenu1_ItemDataBound"> </telerik:RadMenu> User Control's Class code: using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.ComponentModel; using System.Drawing; using Telerik; using Telerik.Cms; using Telerik.Cms.Web; using Telerik.Web.UI; using Telerik.Caching; using Telerik.Cms.Web.UI; [DefaultProperty("StartingNodeOffset")] public partial class UserControls_Nav_SiteMenu : System.Web.UI.UserControl, ICacheableObject { protected void Page_Load(object sender, EventArgs e) { } protected override void Render(HtmlTextWriter writer) { // Checks if this is called by the Search Indexer and does not render anything if so. // Navigation controls are present in every page and should NOT be indexed multiple times. if (!CmsContext.IsRequestCrawler(this.Context)) base.Render(writer); } #region Data Fields private bool hideUrlForGroupPages = false; private string selectedItemCssClass = "selectedItem"; #endregion #region Properties [Browsable(true)] [Category("Behavior")] public int LastExpandLevel { get { if (this.RadMenu1.MaxDataBindDepth < 0) return 0; return this.RadMenu1.MaxDataBindDepth; } set { if (value == 0) this.RadMenu1.MaxDataBindDepth = -1; else this.RadMenu1.MaxDataBindDepth = value; } } [Browsable(true)] [Category("Behavior")] public int ExpandDelay { get { return this.RadMenu1.ExpandDelay; } set { this.RadMenu1.ExpandDelay = value; } } [Browsable(true)] [Category("Behavior")] public bool ClickToOpen { get { return this.RadMenu1.ClickToOpen; } set { this.RadMenu1.ClickToOpen = value; } } [Browsable(true)] [Category("Behavior")] [DefaultValue(false)] public bool HideUrlForGroupPages { get { return this.hideUrlForGroupPages; } set { this.hideUrlForGroupPages = value; } } [Browsable(true)] [Category("Appearance")] public string SelectedItemCssClass { get { return this.selectedItemCssClass; } set { this.selectedItemCssClass = value; } } [Browsable(true)] [Category("Appearance")] public string CssClass { get { return this.RadMenu1.CssClass; } set { this.RadMenu1.CssClass = value; } } [Browsable(true)] public RadMenu Menu { get { return this.RadMenu1; } set { this.RadMenu1 = value; } } [Browsable(true)] [Category("Navigation")] public int StartingNodeOffset { get { return this.SiteMapDataSource1.StartingNodeOffset; } set { this.SiteMapDataSource1.StartingNodeOffset = value; } } [WebEditor("Telerik.Cms.Web.UI.UrlEditorWrapper, Telerik.Cms")] [Browsable(true)] [Category("Navigation")] public string StartingNodeUrl { get { return this.SiteMapDataSource1.StartingNodeUrl; } set { this.SiteMapDataSource1.StartingNodeUrl = value; } } [Browsable(true)] [Category("Navigation")] public bool StartFromCurrentNode { get { return this.SiteMapDataSource1.StartFromCurrentNode; } set { this.SiteMapDataSource1.StartFromCurrentNode = value; } } [Browsable(true)] [Category("Navigation")] public bool ShowStartingNode { get { return this.SiteMapDataSource1.ShowStartingNode; } set { this.SiteMapDataSource1.ShowStartingNode = value; } } /// <summary>(Exposed from contained RadMenu.)</summary> [Browsable(true)] [Category("Appearance")] public string SkinID { get { return this.RadMenu1.SkinID; } set { this.RadMenu1.SkinID = value; } } [Browsable(true)] [Category("Appearance")] public string Skin { get { return this.RadMenu1.Skin; } set { this.RadMenu1.Skin = value; } } #endregion #region Methods public void RadMenu1_ItemDataBound(object sender, RadMenuEventArgs e) { CmsSiteMapNode node = e.Item.DataItem as CmsSiteMapNode; if (this.hideUrlForGroupPages) { if (node != null) { // save the PageID in the attributes of the menu item e.Item.Attributes.Add("PageID", node.Key); if (node.PageType == CmsPageType.Group) { e.Item.NavigateUrl = ""; } } } if (node.CmsPage != null) { if (node.CmsPage.PageType == CmsPageType.External) { e.Item.Target = "_blank"; } } } #endregion #region ICacheableObject Members public System.Web.Caching.CacheDependency[] GetDependencies() { CmsSiteMapProvider provider = null; if (!String.IsNullOrEmpty(this.SiteMapDataSource1.SiteMapProvider)) provider = SiteMap.Providers[this.SiteMapDataSource1.SiteMapProvider] as CmsSiteMapProvider; else provider = SiteMap.Provider as CmsSiteMapProvider; if (provider != null) { return new System.Web.Caching.CacheDependency[]{ provider.CloneCacheDependency()}; } return null; } #endregion } When I edit the Template(in Admin mode), the following error is displayed in control location: Both DataSource and DataSourceID are defined on 'RadMenu1'. Remove one definition. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: Both DataSource and DataSourceID are defined on 'RadMenu1'. Remove one definition. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [InvalidOperationException: Both DataSource and DataSourceID are defined on 'RadMenu1'. Remove one definition.] System.Web.UI.WebControls.DataBoundControl.ConnectToDataSourceView() +3234866 System.Web.UI.WebControls.DataBoundControl.OnLoad(EventArgs e) +28 System.Web.UI.Control.LoadRecursive() +71 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.AddedControl(Control control, Int32 index) +11422584 System.Web.UI.Control.EnsureChildControls() +182 System.Web.UI.Control.PreRenderRecursiveInternal() +60 System.Web.UI.Control.PreRenderRecursiveInternal() +222 System.Web.UI.Control.PreRenderRecursiveInternal() +222 System.Web.UI.Control.PreRenderRecursiveInternal() +222 System.Web.UI.Control.PreRenderRecursiveInternal() +222 System.Web.UI.Control.PreRenderRecursiveInternal() +222 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4201 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272 but I searched in my code as you can see above there's only DataSourceID is defined. What should I do? Thanks

    Read the article

  • Using Joda DateTime as a Jersey parameter?

    - by HolySamosa
    I'd like to use Joda's DateTime for query parameters in Jersey, but this isn't supported by Jersey out-of-the-box. I'm assuming that implementing an InjectableProvider is the proper way to add DateTime support. Can someone point me to a good implementation of an InjectableProvider for DateTime? Or is there an alternative approach worth recommending? (I'm aware I can convert from Date or String in my code, but this seems like a lesser solution). Thanks. Solution: I modified Gili's answer below to use the @Context injection mechanism in JAX-RS rather than Guice. import com.sun.jersey.core.spi.component.ComponentContext; import com.sun.jersey.spi.inject.Injectable; import com.sun.jersey.spi.inject.PerRequestTypeInjectableProvider; import java.util.List; import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import javax.ws.rs.ext.Provider; import org.joda.time.DateTime; /** * Enables DateTime to be used as a QueryParam. * <p/> * @author Gili Tzabari */ @Provider public class DateTimeInjector extends PerRequestTypeInjectableProvider<QueryParam, DateTime> { private final UriInfo uriInfo; /** * Creates a new DateTimeInjector. * <p/> * @param uriInfo an instance of {@link UriInfo} */ public DateTimeInjector( @Context UriInfo uriInfo) { super(DateTime.class); this.uriInfo = uriInfo; } @Override public Injectable<DateTime> getInjectable(final ComponentContext cc, final QueryParam a) { return new Injectable<DateTime>() { @Override public DateTime getValue() { final List<String> values = uriInfo.getQueryParameters().get(a.value()); if( values == null || values.isEmpty()) return null; if (values.size() > 1) { throw new WebApplicationException(Response.status(Status.BAD_REQUEST). entity(a.value() + " may only contain a single value").build()); } return new DateTime(values.get(0)); } }; } }

    Read the article

  • Mobile Safari text selection after input field focus

    - by Andy
    I have some legacy html that needs to work on old and new browsers (down to IE7) as well as the iPad. The iPad is the biggest issues because of how text selection is handled. On a page there is a textarea as well as some text instructions. The instructions are in a <div> and the user needs to be able to select the instructions. The problem is that once focus is placed in the textarea, the user cannot subsequently select the text instructions in the <div>. This is because the text cannot receive focus. According to the Safari Web Content Guide: Handling Events (especially, "Making Elements Clickable"), you can add a onclick event handler to the div you want to receive focus. This solution works (although it is not ideal) in iOS 6x but it does not work in iOS 5x. Does anyone have a suggestion that minimizes changes to our existing code and produces consistant user interaction. Here is sample code that shows the problem. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <script src="http://code.jquery.com/jquery-1.8.2.js"></script> <!-- Resources: Safari Web Content Guide: Handling Events (especially, "Making Elements Clickable") http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW1 --> </head> <body> <div style="width:550"> <div onclick='function() { void(0); }'> <p>On the iPad, I want to be able to select this text after the textarea has had focus.</p> </div> <textarea rows="20" cols="80">After focus is in the textarea, can you select the text above?</textarea> </div> </body> </html>

    Read the article

  • Why is i-- faster than i++ in loops? [closed]

    - by Afshin Mehrabani
    Possible Duplicate: JavaScript - Are loops really faster in reverse…? I don't know if this question is valid in other languages or not, but I'm asking this specifically for JavaScript. I see in some articles and questions that the fastest loop in JavaScript is something like: for(var i = array.length; i--; ) Also in Sublime Text 2, when you try to write a loop, it suggests: for (var i = Things.length - 1; i >= 0; i--) { Things[i] }; I want to know, why is i-- faster than i++ in loops?

    Read the article

  • MC75 using symbol.imaging.device libraries for program

    - by Christy
    UPDATE: I found another library in the Windows Mobile - CameraCaptureDialog - this did the job - never did figure out the zero length available devices... Hi all, I have a .net application running on a symbol mc75 (motorola) using the scanner. I am now trying to add functionality for the camera and I am running into issues. To find the 'devices' you are supposed to use the library's 'available devices' function. With the barcode it is symbol.barcode.devices.availabledevices and it returns two items (you can scan from the scanner or using the camera device) However, when I do the camera library it does not find any devices - symbol.imaging.devices.availabledevices returns 0 I can take a picture using the software on the mc75, so I know the functionality is there, I just can't figure out how to get to it programmatically.... Does anyone have any ideas? Thanks for any help!

    Read the article

  • Dartisans ep 15 - A re-introduction to Dart Editor for the first time, again.

    Dartisans ep 15 - A re-introduction to Dart Editor for the first time, again. You've seen Dart Editor before, but not like this. Well, maybe you have. If you are new to Dart, you'll be amazed at how many features are in the editor. I'll show off features like code completion, code navigation, debugging, and more. When scaling up to hundreds of thousands of lines of code, you'll be very happy you have a tool that can watch your back. For more info on Dart, please visit www.dartlang.org From: GoogleDevelopers Views: 0 0 ratings Time: 01:00:00 More in Science & Technology

    Read the article

  • Dartisans Ep. 16: Dart and Web Components Reloaded

    Dartisans Ep. 16: Dart and Web Components Reloaded In this episode of Dartisans, Dimitri Glazkov (one of the godfathers of Web Components) will give a presentation on Web Components. Also, John Messerly and Siggi Cherem (who helped build the dart-lang/dart-web-components library) will give a presentation on using Web Components in Dart. A lot of things have changed since our last episode focused on Web Components, and this is shaping up to be an awesome edition of Dartisans! From: GoogleDevelopers Views: 0 0 ratings Time: 01:00:00 More in Science & Technology

    Read the article

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