Search Results

Search found 701 results on 29 pages for 'justin tanner'.

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

  • C# - WebBrowser control seems to cache screenshots

    - by Justin
    Hey, I'm using the WebBrowser control in an ASP.NET MVC 2 app (don't judge, I'm doing it in an admin section only to be used by me), here's the code: public static class Screenshot { private static string _url; private static int _width; private static byte[] _bytes; public static byte[] Get(string url) { // This method gets a screenshot of the webpage // rendered at its full size (height and width) return Get(url, 50); } public static byte[] Get(string url, int width) { //set properties. _url = url; _width = width; //start screen scraper. var webBrowseThread = new Thread(new ThreadStart(TakeScreenshot)); webBrowseThread.SetApartmentState(ApartmentState.STA); webBrowseThread.Start(); //check every second if it got the screenshot yet. //i know, the thread sleep is terrible, but it's the secure section, don't judge... int numChecks = 20; for (int k = 0; k < numChecks; k++) { Thread.Sleep(1000); if (_bytes != null) { return _bytes; } } return null; } private static void TakeScreenshot() { try { //load the webpage into a WebBrowser control. using (WebBrowser wb = new WebBrowser()) { wb.ScrollBarsEnabled = false; wb.ScriptErrorsSuppressed = true; wb.Navigate(_url); while (wb.ReadyState != WebBrowserReadyState.Complete) { Application.DoEvents(); } //set the size of the WebBrowser control. //take Screenshot of the web pages full width. wb.Width = wb.Document.Body.ScrollRectangle.Width; //take Screenshot of the web pages full height. wb.Height = wb.Document.Body.ScrollRectangle.Height; //get a Bitmap representation of the webpage as it's rendered in the WebBrowser control. var bitmap = new Bitmap(wb.Width, wb.Height); wb.DrawToBitmap(bitmap, new Rectangle(0, 0, wb.Width, wb.Height)); //resize. var height = _width * (bitmap.Height / bitmap.Width); var thumbnail = bitmap.GetThumbnailImage(_width, height, null, IntPtr.Zero); //convert to byte array. var ms = new MemoryStream(); thumbnail.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); _bytes = ms.ToArray(); } } catch(Exception exc) {//TODO: why did screenshot fail? string message = exc.Message; } } This works fine for the first screenshot that I take, however if I try to take subsequent screenshots of different URL's, it saves screenshots of the first url for the new url, or sometimes it'll save the screenshot from 3 or 4 url's ago. I'm creating a new instance of WebBrowser for each screenshot and am disposing of it properly with the "using" block, any idea why it's behaving this way? Thanks, Justin

    Read the article

  • MUL instruction help

    - by Tanner Babcock
    I've read a few tutorials and examples, but I cannot wrap my head around how the MUL instruction works. I've used ADD and SUB without problems. So apparently this instruction multiplies its operand by the value in a register. What register (eax, ebp, esp, etc.) is multiplied by the first operand? And what register is the result stored in, so I can move it to the stack? Sorry, I'm just learning x86 assembly. When I try to compile this line... mull $9 I get, "Error: suffix or operands invalid for 'mul'". Can anyone help me out? Thanks. EDIT: OK Madhur, I replaced "mull" with "mul" and I'm still getting the same error. Here's the whole source. .globl _main _main: pushl %ebp movl %esp, %ebp subl $8, %esp movl $7, %eax mul $9 movl %eax, (%esp) call _putchar xorl %eax, %eax leave ret

    Read the article

  • What is the impact of Thread.Sleep(1) in C#?

    - by Justin Tanner
    In a windows form application what is the impact of calling Thread.Sleep(1) as illustrated in the following code: public Constructor() { Thread thread = new Thread(Task); thread.IsBackground = true; thread.Start(); } private void Task() { while (true) { // do something Thread.Sleep(1); } } Will this thread hog all of the available CPU? What profiling techniques can I use to measure this Thread's CPU usage ( other than task manager )?

    Read the article

  • Push different views from a table.

    - by Tanner
    Hello All, Ive been following a tutorial to implement a search bar ( http://www.iphonesdkarticles.com/2009/01/uitableview-searching-table-view.html ) However I cant seem to push different views. Here is what my didsSelectRowAtIndexPath looks like. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSString *selectedCountry = nil; if(searching) selectedCountry = [copyListOfItems objectAtIndex:indexPath.row]; else { NSDictionary *dictionary = [listOfItems objectAtIndex:indexPath.section]; NSArray *array = [dictionary objectForKey:@"Countries"]; selectedCountry = [array objectAtIndex:indexPath.row]; } //Initialize the detail view controller and display it. if ([[listOfItems objectAtIndex:indexPath.row] isEqual:@"neon"]){ Neon *abo = [[Neon alloc] initWithNibName:@"Neon" bundle:nil]; //dvController.selectedCountry = selectedCountry; [self.navigationController pushViewController:abo animated:YES]; [abo release]; } } And here is the debuger message when I click on neon: 2010-05-09 08:47:27.516 iTeachU[3821:307] * Terminating app due to uncaught exception 'NSRangeException', reason: ' -[NSMutableArray objectAtIndex:]: index 60 beyond bounds [0 .. 0]' ** Call stack at first throw: terminate called after throwing an instance of 'NSException' Program received signal: “SIGABRT”. If anyone has a way to push views based on the cells text it would be greatly appreciated. Thanks

    Read the article

  • Aero Glass Buttons Like Windows Media Player?

    - by Tanner
    Hi everybody, I am making making a program and I want to have a Aero Glass set of controls just like Windows Media Player, I found this: http://blogs.msdn.com/b/tims/archive/2006/04/18/578637.aspx but it just draws black. I also found a control that had the media player controls built in right ton the glass but it was no good it didn't want to render right and made different parts of my program not work. Any controls, or ways to extend the Aero glass so I can at least add my own buttons would be greatly appreciated. Thanks :) BTW C# only. :)

    Read the article

  • linq to sql dynamic data modify object before insert and update

    - by Dan Tanner
    I'm using Dynamic Data and LINQ to SQL for some admin pages on a .NET 3.5 web app. All my admin tables a CreatedBy, CreatedDate, UpdatedBy, and UpdatedDate. I'm looking for a way to inject the setting of these properties before the objects are inserted and updated. I've seen an object_inserting hook if you have a linq to sql datasource in the web form, but I'm using dynamic data...is there an easy way to generically set that? And I've also looked at modifying each of the partial classes for my admin objects, but the closest hook I see is to implement the OnValidate method with the Insert action. Any suggestions? TIA.

    Read the article

  • Getting RSSIValue from IOBluetoothHostController

    - by Tanner Ezell
    I'm trying to write a simple application that gathers the RSSIValue and displays it via NSLog, my code is as follows: #import <Foundation/Foundation.h> #import <Cocoa/Cocoa.h> #import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h> #import <IOBluetooth/objc/IOBluetoothDevice.h> #import <IOBluetooth/objc/IOBluetoothHostController.h> #import <IOBluetooth/IOBluetoothUtilities.h> @interface getRSSI: NSObject {} -(void) readRSSIForDeviceComplete:(id)controller device:(IOBluetoothDevice*)device info:(BluetoothHCIRSSIInfo*)info error:(IOReturn)error; @end @implementation getRSSI - (void) readRSSIForDeviceComplete:(id)controller device:(IOBluetoothDevice*)device info:(BluetoothHCIRSSIInfo*)info error:(IOReturn)error { if (error != kIOReturnSuccess) { NSLog(@"readRSSIForDeviceComplete return error"); CFRunLoopStop(CFRunLoopGetCurrent()); } if (info->handle == kBluetoothConnectionHandleNone) { NSLog(@"readRSSIForDeviceComplete no handle"); CFRunLoopStop(CFRunLoopGetCurrent()); } NSLog(@"RSSI = %i dBm ", info->RSSIValue); [NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 5]]; [device closeConnection]; [device openConnection]; [controller readRSSIForDevice:device]; } @end int main (int argc, const char * argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSLog(@"start"); IOBluetoothHostController *hci = [IOBluetoothHostController defaultController]; NSString *addrStr = @"xx:xx:xx:xx:xx:xx"; BluetoothDeviceAddress addr; IOBluetoothNSStringToDeviceAddress(addrStr, &addr); IOBluetoothDevice *device = [[IOBluetoothDevice alloc] init]; device = [IOBluetoothDevice withAddress:&addr]; [device retain]; [device openConnection]; getRSSI *rssi = [[getRSSI alloc] init]; [hci setDelegate:rssi]; [hci readRSSIForDevice:device]; CFRunLoopRun(); [hci release]; [rssi release]; [pool release]; return 0; } The problem I am facing is that the readRSSIForDeviceComplete seems to work just fine, info passes along a value. The problem is that the RSSI value is drastically different from the one I can view from OS X via option clicking the bluetooth icon at the top. It is typical for my application to print off 1,2,-1,-8,etc while the menu displays -64 dBm, -66, -70, -42, etc. I would really appreciate some guidance.

    Read the article

  • How do I call a basic YUI3 function from within a normal JavaScript function?

    - by Justin Tanner
    I'd like to call a simple YUI3 function from within a JavaScript function. Here is some code that does what I want in a very verbose way: function changeContent (message) { YUI().use("node", function(Y) { Y.all('#content-div').setContent(message); }); } Is there a better way to do this? NOTE: I don't want to attach this function to any event, I just want a global changeContent() function available.

    Read the article

  • Is there away to store info, without a database?

    - by Tanner
    HI, I was wondering is there any way to store data, like say I wanted to make a login form and save the usernames and passwords, without using a database or .txt file? Seems like alot of work to set up stuff like that, for something simple, and I was just wondering if there was another way. :) And if any one has some tutorials on how to use a database Access/Sql/Local Database please post.

    Read the article

  • Undo button for System.Drawing?

    - by Tanner
    Hi guys, I am making a image editor kinda for own enjoyment and was wondering how could I make a undo button to undo the last paints I did? I want to know how I would about this, a tutorial or sample code would be nice or at least something pointing me in the right direction. Thanks!

    Read the article

  • How can you push a new view with a grouped table?

    - by Tanner
    Hi All, Ive been trying to push a new view when a cell is tapped but absolutely nothing happens. I figured grouped style pushed the same as plain. Here is my code: -(void)viewDidLoad { [super viewDidLoad]; contactArray = [[NSArray alloc] initWithObjects:@"iPhone",@"iPod",@"MacBook",@"MacBook Pro",nil]; shareArray = [[NSArray alloc] initWithObjects:@"Flex",@"AIR",@"PhotoShop",@"Flash",nil]; } -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 2; } // Customize the number of rows in the table view. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if(section == 0) return [contactArray count]; else return [shareArray count]; } -(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ if(section == 0){ return @"Contact"; }else{ return @"Share"; } } -(NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section{ if(section == 0){ return @"Footer for Apple Products"; }else{ return @"Footer for Adobe Softwares"; } } // Customize the appearance of table view cells. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; } // Set up the cell... if(indexPath.section == 0){ cell.text = [contactArray objectAtIndex:indexPath.row]; }else{ cell.text = [shareArray objectAtIndex:indexPath.row]; } return cell; } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //NextViewController *nextController = [[NextViewController alloc] initWithNibName:@"NextView" bundle:nil]; //[self.navigationController pushViewController:nextController animated:YES]; if([contactArray objectAtIndex:indexPath.row] == @"iPhone"){ LandscapeHydrogen *abo = [[LandscapeHydrogen alloc] initWithNibName:@"LandscapeHydrogen" bundle:nil]; [self.navigationController pushViewController:abo animated:NO]; [abo release]; } } Any help is appreciated.

    Read the article

  • Why won't the debugger update?

    - by Tanner
    Hello everyone, Ive had this problem multiple times and it ruins my projects, I make some changes, like say I have a button in the top left corner of the form and move it to the top right corner, then I press debug but nothing happens to the form, it doesn't change the button is still in the top left-hand corner instead of the top right, and it also doesn't except any new code, its like it saved the project right there and won't move on. Does any one know why or had this problem before? Please, Help!!!! Additional Details: Compiler: Microsoft Visual C# 2008 Express Edition I once fixed this problem by rebuilding the solution, but its never worked again.

    Read the article

  • Protect Files from Git

    - by Tanner
    I'm using Git with WindRiver to manage a project of mine. The code is being managed, however the project files (such as .cproject, .project, .wrmakefile, and .wrproject) are not. However when I switch branches, Git deletes those files spite them being in .gitignore, thereby removing my ability to compile the code without having to revert commits or keeping a backup. So, is there a way to say to Git - ignore these files and don't touch them no matter what?

    Read the article

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