Daily Archives

Articles indexed Tuesday May 4 2010

Page 15/117 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Can you selectively enable or disable 'FilterDescriptors' in silverlight 4?

    - by Simon_Weaver
    In Silverlight with RIA services it is very easy to implement simple data filtering with 'FilterDescriptor' instances. However I've got a case where I have several filters and I want to enable or disable them based on other filters. It seems like a simple 'Enabled' property would make this really easy - but there is none. Is there a way to achieve this without just manually defining all the filters I need every time the relevant checkbox is checked.

    Read the article

  • Why won't my CATiledLayer scroll in a UIScrollView after zooming?

    - by Brodie4598
    I'm currently having the following problem with CATiledLayer: when the view first loads, the scrolling works perfectly, but then when you zoom once, the view snaps to the anchor point (top left corner) and it can no longer scroll at all. The zooming works in that it will zoom in and out, but it will only zoom to the top left corner. My code is as follows: #import <QuartzCore/QuartzCore.h> #import "PracticeViewController.h" @implementation practiceViewController //@synthesize image; - (void)viewDidLoad { NSString *path = [[NSBundle mainBundle] pathForResource:@"H-5" ofType:@"jpg"]; NSData *data = [NSData dataWithContentsOfFile:path]; image = [UIImage imageWithData:data]; CGRect pageRect = CGRectMake(0, 0, image.size.width, image.size.height); CATiledLayer *tiledLayer = [CATiledLayer layer]; tiledLayer.anchorPoint = CGPointMake(0.0f, 1.0f); tiledLayer.delegate = self; tiledLayer.tileSize = CGSizeMake(1000, 1000); tiledLayer.levelsOfDetail = 6; tiledLayer.levelsOfDetailBias = 0; tiledLayer.bounds = pageRect; tiledLayer.transform = CATransform3DMakeScale(1.0f, -1.0f, 0.3f); myContentView = [[UIView alloc] initWithFrame:self.view.bounds]; [myContentView.layer addSublayer:tiledLayer]; UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds]; scrollView.delegate = self; scrollView.contentSize = pageRect.size; scrollView.minimumZoomScale = .2; scrollView.maximumZoomScale = 1; [scrollView addSubview:myContentView]; [self.view addSubview:scrollView]; } - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView { return myContentView; } - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx { NSString *path = [[NSBundle mainBundle] pathForResource:@"H-5" ofType:@"jpg"]; NSData *data = [NSData dataWithContentsOfFile:path]; image = [UIImage imageWithData:data]; CGRect imageRect = CGRectMake (0.0, 0.0, image.size.width, image.size.height); CGContextDrawImage (ctx, imageRect, [image CGImage]); } @end

    Read the article

  • Avoiding stack overflows in wrapper DLLs

    - by peachykeen
    I have a program to which I'm adding fullscreen post-processing effects. I do not have the source for the program (it's proprietary, although a developer did send me a copy of the debug symbols, .map format). I have the code for the effects written and working, no problems. My issue now is linking the two. I've tried two methods so far: Use Detours to modify the original program's import table. This works great and is guaranteed to be stable, but the user's I've talked to aren't comfortable with it, it requires installation (beyond extracting an archive), and there's some question if patching the program with Detours is valid under the terms of the EULA. So, that option is out. The other option is the traditional DLL-replacement. I've wrapped OpenGL (opengl32.dll), and I need the program to load my DLL instead of the system copy (just drop it in the program folder with the right name, that's easy). I then need my DLL to load the Cg framework and runtime (which relies on OpenGL) and a few other things. When Cg loads, it calls some of my functions, which call Cg functions, and I tend to get stack overflows and infinite loops. I need to be able to either include the Cg DLLs in a subdirectory and still use their functions (not sure if it's possible to have my DLLs import table point to a DLL in a subdirectory) or I need to dynamically link them (which I'd rather not do, just to simplify the build process), something to force them to refer to the system's file (not my custom replacement). The entire chain is: Program loads DLL A (named opengl32.dll). DLL A loads Cg.dll and dynamically links (GetProcAddress) to sysdir/opengl32.dll. I now need Cg.dll to also refer to sysdir/opengl32.dll, not DLL A. How would this be done? Edit: How would this be done easily without using GetProcAddress? If nothing else works, I'm willing to fall back to that, but I'd rather not if at all possible. Edit2: I just stumbled across the function SetDllDirectory in the MSDN docs (on a totally unrelated search). At first glance, that looks like what I need. Is that right, or am I misjudging? (off to test it now) Edit3: I've solved this problem by doing thing a bit differently. Instead of dropping an OpenGL32.dll, I've renamed my DLL to DInput.dll. Not only does it have the advantage of having to export one function instead of well over 120 (for the program, Cg, and GLEW), I don't have to worry about functions running back in (I can link to OpenGL as usual). To get into the calls I need to intercept, I'm using Detours. All in all, it works much better. This question, though, is still an interesting problem (and hopefully will be useful for anyone else trying to do crazy things in the future). Both the answers are good, so I'm not sure yet which to pick...

    Read the article

  • Why do people keep parsing HTML using regex? [closed]

    - by polygenelubricants
    As much as I love regular expressions, it's obvious to me that it's not the best tool for parsing HTML, especially given the numerous good HTML parsers out there. And yet there are numerous questions on stackoverflow that attempts to parse HTML using regex. And people would always point out what a bad idea that is in the comments. And the accepted answer would often have a disclaimer how this isn't really the ideal way of doing things. But based on the constant flow of questions, it still seems that people keep parsing HTML using regex, despite the perceived difficulty in reading and maintaining it (and that's putting correctness aside for now). So my question is: why? Is it because it's easy to learn? Is it because it's faster? Is it because it's the industry standard? Is it because there are already so many reusable regexes to build from? Is it because 100% correctness is never really the objective? (90% good enough?) etc... I'd also like to hear from the downvoters why they did so. Is it because: There's absolutely nothing wrong with using regex to parse HTML and asking "Why?" is just dumb? The premise of the question is flawed because the people who are using regex to parse HTML is such a small minority?

    Read the article

  • Adobe AIR: problem with OpenID / rpxnow logins

    - by michael
    Does Adobe Air work with OpenID/rpxnow? I'm having a developer build me an AIR app to work with my website so I can have access to desktop photos. However, my site uses OpenID logins via the rpxnow.com implementation. Works fine in the web version, but my developer has told me that he cannot do rpxnow/openid logins from the AIR app because it doesn't allow pop-ups and/or redirects. Has anyone found a workaround? m.

    Read the article

  • Need to use DART, can't access windows at all

    - by Jack
    I have an install of windows server R2. After installing two patches, the system is stuck in a reboot loop. I wish to uninstall these patches to revert my stsem to normal. I have looked at dism, but it does not seem to provide a way to uninstall specific MSP patches. I don't believe I can utilize msiexec in WinRE to uninstall the patches. And so, I believe DART is what I need, which will allow me to uninstall specific patches. However, I cannot access my install of windows at all, which is what is apparently needed to make the dart media. Is there any way around this?

    Read the article

  • get JSON object attribute name

    - by Laurent Luce
    I know that I can retrieve "session" by using item.fields.name but what if I don't know in advance that the attribute is called "name". How can I retrieve the list of the attributes names in fields first. [ { "pk": 2, "model": "auth.group", "fields": { "name": "session" } } ]

    Read the article

  • F# replace ref variable with something fun

    - by Stephen Swensen
    I have the following F# functions which makes use of a ref variable to seed and keep track of a running total, something tells me this isn't in the spirit of fp or even particular clear on its own. I'd like some direction on the clearest (possible fp, but if an imperative approach is clearer I'd be open to that) way to express this in F#. Note that selectItem implements a random weighted selection algorithm. type WeightedItem(id: int, weight: int) = member self.id = id member self.weight = weight let selectItem (items: WeightedItem list) (rand:System.Random) = let totalWeight = List.sumBy (fun (item: WeightedItem) -> item.weight) items let selection = rand.Next(totalWeight) + 1 let runningWeight = ref 0 List.find (fun (item: WeightedItem) -> runningWeight := !runningWeight + item.weight !runningWeight >= selection) items let items = [new WeightedItem(1,100); new WeightedItem(2,50); new WeightedItem(3,25)] let selection = selectItem items (new System.Random())

    Read the article

  • Simplified iphone In-app store implementation for built-in product features

    - by Joey
    This question is for those familiar with implementing the iphone in-app store functionality. The app I'm building has only built-in features that are unlocked when features are purchased. Further, any modifications or additions to store items will require an app update. Also, it is only in English so has no localized languages for the items. If we take those assumptions, is it feasible to skip the step of retrieving the product info with SKProductsRequest and simply use hardcoded data within the app? While I may want to extend my app to greater complexity in the future, I'd like to know if this step to keep it simple would introduce some serious issues. One issue might be, for instance, if we have to expect a few of the items to occasionally be unavailable due to issues on Apple's side and simply trying to purchase it and letting it fail would not be a permissible or workable option in that case (especially if it is uncommon). Thanks.

    Read the article

  • c# - pull records from database without timeout

    - by BhejaFry
    Hi folks, i have a sql query with multiple joins & it pulls data from a database for processing. This is supposed to be running on some scheduled basis. So day 1, it might pull 500, day 2 say 400. Now, if the service is stopped for some reason & the data not processed, then on day3 there could be as much as 1000 records to process. This is causing timeout on the sql query. How best to handle this situation without causing timeout & gradually reducing workload to process? TIA

    Read the article

  • Searching and comparing ActiveRecord attributes to find largest value

    - by NS
    I have a model that would look something like: my_diet = Diet.new my_diet.food_type_1 = "beef" my_diet.food_type_1_percentage = 40 my_diet.food_type_2 = "carrots" my_diet.food_type_2_percentage = 50 my_diet.food_type_3 = "beans" my_diet.food_type_3_percentage = 5 my_diet.food_type_4 = "chicken" my_diet.food_type_4_percentage = 5 I need to find which food_type has the highest percentage. So far I've tried creating a hash out of the attibutes and percentages then sorting the hash (see below) but it feels like there must be a cleaner way to do it. food_type_percentages = { :food_type_1 => my_diet.foo_type_percentage_1_percentage.nil? ? 0 : my_dient.food_type_1_percentage, :food_type_2 => my_diet.foo_type_percentage_2_percentage.nil? ? 0 : my_dient.food_type_2_percentage, :food_type_3 => my_diet.foo_type_percentage_3_percentage.nil? ? 0 : my_dient.food_type_3_percentage, :food_type_4 => my_diet.foo_type_percentage_4_percentage.nil? ? 0 : my_dient.food_type_4_percentage } food_type_percentages.sort {|a,b| a[1]<=>b[1]}.last Any ideas? Thanks!

    Read the article

  • Opening read-only OLEDB connection to MS Access back-end database while allowing updates via separat

    - by djdilicious
    I have a back-end MS Access 2002-2003 database which stores blog entries. I created a separate front-end database with the forms for entering blog posts into the backend database. Finally, I have a website utilizing ASP to display the blog entries. The website connects directly to the backend database using an OLEDB connection object. Whenever I open the form for creating a new post in MS Access, loading the blog post page on the website displays the error: Could not use "; file already in use. I would like to be able to display the older blog posts even though the newest one is in the process of being added.

    Read the article

  • Native XML WebService Without Authentication

    - by tom
    So this my first question here, let's look how it works. I'm working on a project, which has to to provide a "Native XML WebService" on a SQL Server 2005. The web service and the WSDL generation works fine. But there are troubles with the authentication. Is it possible to turn the authentication off (The tests and the documentation by Microsoft say no.)? And if so how?

    Read the article

  • Is HashMap in Java collision safe

    - by changed
    Hi I am developing a parser that needs to put key value pairs in hashmap. But a key can have multiple values which i can do in this way HashMap<String,ArrayList<String>> . But what happens if number of keys are very large and it start matching with other key's hashcode. Will that rewrite previous key's value ? thanks -devSunday

    Read the article

  • Are there any nasty side affects if i lock the HttpContext.Current.Cache.Insert method

    - by Ekk
    Apart from blocking other threads reading from the cache what other problems should I be thinking about when locking the cache insert method for a public facing website. The actual data retrieval and insert into the cache should take no more than 1 second, which we can live with. More importantly i don't want multiple thread potentially all hitting the Insert method at the same time. The sample code looks something like: public static readonly object _syncRoot = new object(); if (HttpContext.Current.Cache["key"] == null) { lock (_syncRoot) { HttpContext.Current.Cache.Insert("key", "DATA", null, DateTime.Now.AddMinutes(5), Cache.NoSlidingExpiration, CacheItemPriority.Normal, null); } } Response.Write(HttpContext.Current.Cache["key"]);

    Read the article

  • Does a laptop with a GPU also use IGP?

    - by blee
    I have a Thinkpad T60 with dual screen setup: The laptop's LCD: Is normal looking. VGA external monitor: Looks "wavy," but I hooked it up to another computer and it looked fine. Does this imply my GPU is connected to the VGA-out and the built-in LCD is driven by IGP? Is this typically how a laptop with one GPU works? Thanks.

    Read the article

  • Is there any Disk Cache solution for ASP.NET?

    - by silent
    My client has a busy traffic site with a big amount of pages, ASP.NET's built-in cache solutions is good, but it only stores content into the memory. Since the site has a big amount of pages, so I think disk caching would be a better idea. But after searching I didn't find a solution, any suggestions?

    Read the article

  • Best Python IDE for my situation

    - by ChrisC
    I want to write a database app in Python, using SQLite and wxPython. My only "experience" is 1 class on basic C++ console programming and OOP concepts. Which IDE would be best for my situation? In case it matters, I only need my new program to run on Windows, and I do want to make it "portable". Thank you.

    Read the article

  • Reading column header and column values of a data table using LAMBDA(C#3.0)

    - by Newbie
    Consider the folowing where I am reading the data table values and writing to a text file using (StreamWriter sw = new StreamWriter(@"C:\testwrite.txt",true)) { DataPreparation().AsEnumerable().ToList().ForEach(i => { string col1 = i[0].ToString(); string col2 = i[1].ToString(); string col3 = i[2].ToString(); string col4 = i[3].ToString(); sw.WriteLine( col1 + "\t" + col2 + "\t" + col3 + "\t" + col4 + Environment.NewLine ); }); } The data preparation function is as under private static DataTable DataPreparation() { DataTable dt = new DataTable(); dt.Columns.Add("Col1", typeof(string)); dt.Columns.Add("Col2", typeof(int)); dt.Columns.Add("Col3", typeof(DateTime)); dt.Columns.Add("Col4", typeof(bool)); for (int i = 0; i < 10; i++) { dt.Rows.Add("String" + i.ToString(), i, DateTime.Now.Date, (i % 2 == 0) ? true : false); } return dt; } It is working fine. Now in the above described program, it is known to me the Number of columns and the column headers. How to achieve the same in case when the column headers and number of columns are not known at compile time using the lambda expression? I have already done that which is as under public static void WriteToTxt(string directory, string FileName, DataTable outData, string delimiter) { FileStream fs = null; StreamWriter streamWriter = null; using (fs = new FileStream(directory + "\\" + FileName + ".txt", FileMode.Append, FileAccess.Write)) { try { streamWriter = new StreamWriter(fs); streamWriter.BaseStream.Seek(0, SeekOrigin.End); streamWriter.WriteLine(); DataTableReader datatableReader = outData.CreateDataReader(); for (int header = 0; header < datatableReader.FieldCount; header++) { streamWriter.Write(outData.Columns[header].ToString() + delimiter); } streamWriter.WriteLine(); int row = 0; while (datatableReader.Read()) { for (int field = 0; field < datatableReader.FieldCount; field++) { streamWriter.Write(outData.Rows[row][field].ToString() + delimiter); } streamWriter.WriteLine(); row++; } } catch (Exception ex) { throw ex; } } } I am using C#3.0 and framework 3.5 Thanks in advance

    Read the article

  • Silverlight 4 Drag and Drop Alternatives

    - by Eric J.
    I want to add the ability to drag a user control from one part of a Silverlight 4 page onto another user control on the same page (not talking about the new Silverlight 4 ability to drag a file from the OS onto the page). What approach is most straightforward? What approach offers the most flexibility? Here are some alternatives I found so far SO drag-and-drop-control-for-silverlight. Same question but answers apply to SL 2. Alex van Beek's DragManager. Written for SL3. Silverlight Drag Drop. Also written for SL3.

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >