Daily Archives

Articles indexed Sunday January 2 2011

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

  • Multiple errors while adding searching to app

    - by Thijs
    Hi, I'm fairly new at iOS programming, but I managed to make a (in my opinion quite nice) app for the app store. The main function for my next update will be a search option for the app. I followed a tutorial I found on the internet and adapted it to fit my app. I got back quite some errors, most of which I managed to fix. But now I'm completely stuck and don't know what to do next. I know it's a lot to ask, but if anyone could take a look at the code underneath, it would be greatly appreciated. Thanks! // // RootViewController.m // GGZ info // // Created by Thijs Beckers on 29-12-10. // Copyright 2010 __MyCompanyName__. All rights reserved. // #import "RootViewController.h" // Always import the next level view controller header(s) #import "CourseCodes.h" @implementation RootViewController @synthesize dataForCurrentLevel, tableViewData; #pragma mark - #pragma mark View lifecycle // OVERRIDE METHOD - (void)viewDidLoad { [super viewDidLoad]; // Go get the data for the app... // Create a custom string that points to the right location in the app bundle NSString *pathToPlist = [[NSBundle mainBundle] pathForResource:@"SCSCurriculum" ofType:@"plist"]; // Now, place the result into the dictionary property // Note that we must retain it to keep it around dataForCurrentLevel = [[NSDictionary dictionaryWithContentsOfFile:pathToPlist] retain]; // Place the top level keys (the program codes) in an array for the table view // Note that we must retain it to keep it around // NSDictionary has a really useful instance method - allKeys // The allKeys method returns an array with all of the keys found in (this level of) a dictionary tableViewData = [[[dataForCurrentLevel allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)] retain]; //Initialize the copy array. copyListOfItems = [[NSMutableArray alloc] init]; // Set the nav bar title self.title = @"GGZ info"; //Add the search bar self.tableView.tableHeaderView = searchBar; searchBar.autocorrectionType = UITextAutocorrectionTypeNo; searching = NO; letUserSelectRow = YES; } /* - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; } */ /* - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; } */ /* - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; } */ /* - (void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear:animated]; } */ //RootViewController.m - (void) searchBarTextDidBeginEditing:(UISearchBar *)theSearchBar { searching = YES; letUserSelectRow = NO; self.tableView.scrollEnabled = NO; //Add the done button. self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneSearching_Clicked:)] autorelease]; } - (NSIndexPath *)tableView :(UITableView *)theTableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath { if(letUserSelectRow) return indexPath; else return nil; } //RootViewController.m - (void)searchBar:(UISearchBar *)theSearchBar textDidChange:(NSString *)searchText { //Remove all objects first. [copyListOfItems removeAllObjects]; if([searchText length] &gt; 0) { searching = YES; letUserSelectRow = YES; self.tableView.scrollEnabled = YES; [self searchTableView]; } else { searching = NO; letUserSelectRow = NO; self.tableView.scrollEnabled = NO; } [self.tableView reloadData]; } //RootViewController.m - (void) searchBarSearchButtonClicked:(UISearchBar *)theSearchBar { [self searchTableView]; } - (void) searchTableView { NSString *searchText = searchBar.text; NSMutableArray *searchArray = [[NSMutableArray alloc] init]; for (NSDictionary *dictionary in listOfItems) { NSArray *array = [dictionary objectForKey:@"Countries"]; [searchArray addObjectsFromArray:array]; } for (NSString *sTemp in searchArray) { NSRange titleResultsRange = [sTemp rangeOfString:searchText options:NSCaseInsensitiveSearch]; if (titleResultsRange.length &gt; 0) [copyListOfItems addObject:sTemp]; } [searchArray release]; searchArray = nil; } //RootViewController.m - (void) doneSearching_Clicked:(id)sender { searchBar.text = @""; [searchBar resignFirstResponder]; letUserSelectRow = YES; searching = NO; self.navigationItem.rightBarButtonItem = nil; self.tableView.scrollEnabled = YES; [self.tableView reloadData]; } //RootViewController.m - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { if (searching) return 1; else return [listOfItems count]; } // Customize the number of rows in the table view. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (searching) return [copyListOfItems count]; else { //Number of rows it should expect should be based on the section NSDictionary *dictionary = [listOfItems objectAtIndex:section]; NSArray *array = [dictionary objectForKey:@"Countries"]; return [array count]; } } - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { if(searching) return @""; if(section == 0) return @"Countries to visit"; else return @"Countries visited"; } // 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(searching) cell.text = [copyListOfItems objectAtIndex:indexPath.row]; else { //First get the dictionary object NSDictionary *dictionary = [listOfItems objectAtIndex:indexPath.section]; NSArray *array = [dictionary objectForKey:@"Countries"]; NSString *cellValue = [array objectAtIndex:indexPath.row]; cell.text = cellValue; } return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //Get the selected country 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. DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]]; dvController.selectedCountry = selectedCountry; [self.navigationController pushViewController:dvController animated:YES]; [dvController release]; dvController = nil; } //RootViewController.m - (void) searchBarTextDidBeginEditing:(UISearchBar *)theSearchBar { //Add the overlay view. if(ovController == nil) ovController = [[OverlayViewController alloc] initWithNibName:@"OverlayView" bundle:[NSBundle mainBundle]]; CGFloat yaxis = self.navigationController.navigationBar.frame.size.height; CGFloat width = self.view.frame.size.width; CGFloat height = self.view.frame.size.height; //Parameters x = origion on x-axis, y = origon on y-axis. CGRect frame = CGRectMake(0, yaxis, width, height); ovController.view.frame = frame; ovController.view.backgroundColor = [UIColor grayColor]; ovController.view.alpha = 0.5; ovController.rvController = self; [self.tableView insertSubview:ovController.view aboveSubview:self.parentViewController.view]; searching = YES; letUserSelectRow = NO; self.tableView.scrollEnabled = NO; //Add the done button. self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneSearching_Clicked:)] autorelease]; } // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations. return YES; } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Relinquish ownership any cached data, images, etc that aren't in use. } - (void)viewDidUnload { // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand. // For example: self.myOutlet = nil; } - (void)dealloc { [dataForCurrentLevel release]; [tableViewData release]; [super dealloc]; } #pragma mark - #pragma mark Table view methods // DATA SOURCE METHOD - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } // DATA SOURCE METHOD - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // How many rows should be displayed? return [tableViewData count]; } // DELEGATE METHOD - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // Cell reuse block static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } // Configure the cell's contents - we want the program code, and a disclosure indicator cell.textLabel.text = [tableViewData objectAtIndex:indexPath.row]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; return cell; } //RootViewController.m - (void)searchBar:(UISearchBar *)theSearchBar textDidChange:(NSString *)searchText { //Remove all objects first. [copyListOfItems removeAllObjects]; if([searchText length] &gt; 0) { [ovController.view removeFromSuperview]; searching = YES; letUserSelectRow = YES; self.tableView.scrollEnabled = YES; [self searchTableView]; } else { [self.tableView insertSubview:ovController.view aboveSubview:self.parentViewController.view]; searching = NO; letUserSelectRow = NO; self.tableView.scrollEnabled = NO; } [self.tableView reloadData]; } //RootViewController.m - (void) doneSearching_Clicked:(id)sender { searchBar.text = @""; [searchBar resignFirstResponder]; letUserSelectRow = YES; searching = NO; self.navigationItem.rightBarButtonItem = nil; self.tableView.scrollEnabled = YES; [ovController.view removeFromSuperview]; [ovController release]; ovController = nil; [self.tableView reloadData]; } // DELEGATE METHOD - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // In any navigation-based application, you follow the same pattern: // 1. Create an instance of the next-level view controller // 2. Configure that instance, with settings and data if necessary // 3. Push it on to the navigation stack // In this situation, the next level view controller is another table view // Therefore, we really don't need a nib file (do you see a CourseCodes.xib? no, there isn't one) // So, a UITableViewController offers an initializer that programmatically creates a view // 1. Create the next level view controller // ======================================== CourseCodes *nextVC = [[CourseCodes alloc] initWithStyle:UITableViewStylePlain]; // 2. Configure it... // ================== // It needs data from the dictionary - the "value" for the current "key" (that was tapped) NSDictionary *nextLevelDictionary = [dataForCurrentLevel objectForKey:[tableViewData objectAtIndex:indexPath.row]]; nextVC.dataForCurrentLevel = nextLevelDictionary; // Set the view title nextVC.title = [tableViewData objectAtIndex:indexPath.row]; // 3. Push it on to the navigation stack // ===================================== [self.navigationController pushViewController:nextVC animated:YES]; // Memory manage it [nextVC release]; } /* // Override to support conditional editing of the table view. - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { // Return NO if you do not want the specified item to be editable. return YES; } */ /* // Override to support editing the table view. - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { // Delete the row from the data source. [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; } else if (editingStyle == UITableViewCellEditingStyleInsert) { // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view. } } */ /* // Override to support rearranging the table view. - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { } */ /* // Override to support conditional rearranging of the table view. - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { // Return NO if you do not want the item to be re-orderable. return YES; } */ @end

    Read the article

  • Writing Resources from filesystem in Android

    - by Markus
    Hi, as I need to get a specific Frame from a Website I want to display in an WebView, I decided to grab the .html from the net and save it under file:///data/data//files/file.html. Stroed there I can edit it using regex or String methods. Now two questions: Is there a way to bind this file to an resource. e.g. to /res/raw/file.html and get it updated dynamically as i edit it? Or can i write the File directly to the resources? Is this whole stuff I do there any good or performant at all? I mean maybe there is a better way to get the .html code between two tags from a Webpage and display it via WebView. Kind regards Markus

    Read the article

  • Implement subitem in SQLite

    - by Mohit Deshpande
    How could I implement a sub item where the item would have a parent to that of the same item. For example, I have a database that holds tasks/todos. Each todo has a title(TEXT), completed(INTEGER [1 if true, 0 if false]), and due date(TEXT) column. I would like to add functionality to have subtasks, where a task could possibly have a parent task. How would I implement this in SQLite for Android? NOT IN SQL! So no foreign keys (triggers are allow, though)! Could I just have a separate table (subtask) and have a foreign key trigger to link subtask(INTEGER parent) to task(INTEGER PRIMARY KEY AUTOINCREMENT _id)? Or should I add a column to my original task table(INTEGER parent)? How could I implement this?

    Read the article

  • Is object remain fixed when scrolling background in cocos2d.

    - by russell
    I have one question when infinite background scrolling is done, is the object remain fixed(like doodle in doodle jump, papy in papi jump) or these object really moves.Is only background move or both (background and object )move.plz someone help me.I am searching for this solution for 4/5 days,but can't get the solution.So plz someone help me. And if object does not move how to create such a illusion of object moving.

    Read the article

  • update query with multiple values

    - by ozlem
    I want to write an update query in MS Access 2003. I have a field called product_code. If product code is (between 110 and 752) OR (between 910 and 1124), I want to update product code=15. If product code is (between 1210 and 1213) OR (1310 and 1423) I want to assign product code=16. If product code is some other value I will assign 18, and so on I don't think I can use CASE statement for this since I have many values to be updated. I tried to use multiple UPDATE/SET statements but it didn't work.

    Read the article

  • Serving static media in django application

    - by Ed
    I notice that when I reference my java scripts and static image files from my templates, they show up in development, but not from the production server. From development, I access them as such: <img src="/my_proj/media/css/images/collapsed.png" /> but from production, I have to remove the project directory: <img src="/media/css/images/collapsed.png" /> I'm assuming I'm doing something wrong with regard to serving static media. I'm caught between a number of seemingly different options for serving static media in Django. On one hand, it's been recommended that I use django-staticfiles to serve media. On the other I see reference to STATIC_ROOT and STATIC_URL in the documentation (with caveats about use in production). I have small .png files of "plus" and "minus" symbols for use in some of my jQuery scripts. In addition, the scripts themselves need to be referenced. 1) Am I correctly categorizing scripts and site images as static media? 2) What is the best method to access this media (from production)?

    Read the article

  • JSF2 - use view scope managed bean to pass value between navigation

    - by Fekete Kamosh
    Hi all, I am solving how to pass values from one page to another without making use of session scope managed bean. For most managed beans I would like to have only Request scope. I created a very, very simple calculator example which passes Result object resulting from actions on request bean (CalculatorRequestBean) from 5th phase as initializing value for new instance of request bean initialized in next phase lifecycle. In fact - in production environment we need to pass much more complicated data object which is not as primitive as Result defined below. What is your opinion on this solution which considers both possibilities - we stay on the same view or we navigate to the new one. But in both cases I can get to previous value stored passed using view scoped managed bean. Calculator page: <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"> <h:head> <title>Calculator</title> </h:head> <h:body> <h:form> <h:panelGrid columns="2"> <h:outputText value="Value to use:"/> <h:inputText value="#{calculatorBeanRequest.valueToAdd}"/> <h:outputText value="Navigate to new view:"/> <h:selectBooleanCheckbox value="#{calculatorBeanRequest.navigateToNewView}"/> <h:commandButton value="Add" action="#{calculatorBeanRequest.add}"/> <h:commandButton value="Subtract" action="#{calculatorBeanRequest.subtract}"/> <h:outputText value="Result:"/> <h:outputText value="#{calculatorBeanRequest.result.value}"/> <h:outputText value="DUMMY" rendered="#{resultBeanView.dummy}"/> </h:panelGrid> </h:form> </h:body> Object to be passed through lifecycle: package cz.test.calculator; import java.io.Serializable; /** * Data object passed among pages. * Lets imagine it holds something much more complicated than primitive int */ public class Result implements Serializable { private int value; public void setValue(int value) { this.value = value; } public int getValue() { return value; } } Request scoped managed bean used on view "calculator.xhtml" package cz.test.calculator; import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedProperty; import javax.faces.bean.RequestScoped; @ManagedBean @RequestScoped public class CalculatorBeanRequest { @ManagedProperty(value="#{resultBeanView}") ResultBeanView resultBeanView; private Result result; private int valueToAdd; /** * Should perform navigation to */ private boolean navigateToNewView; /** Creates a new instance of CalculatorBeanRequest */ public CalculatorBeanRequest() { } @PostConstruct public void init() { // Remember already saved result from view scoped bean result = resultBeanView.getResult(); } // Dependency injections public void setResultBeanView(ResultBeanView resultBeanView) { this.resultBeanView = resultBeanView; } public ResultBeanView getResultBeanView() { return resultBeanView; } // Getters, setter public void setValueToAdd(int valueToAdd) { this.valueToAdd = valueToAdd; } public int getValueToAdd() { return valueToAdd; } public boolean isNavigateToNewView() { return navigateToNewView; } public void setNavigateToNewView(boolean navigateToNewView) { this.navigateToNewView = navigateToNewView; } public Result getResult() { return result; } // Actions public String add() { result.setValue(result.getValue() + valueToAdd); return isNavigateToNewView() ? "calculator" : null; } public String subtract() { result.setValue(result.getValue() - valueToAdd); return isNavigateToNewView() ? "calculator" : null; } } and finally view scoped managed bean to pass Result variable to new page: package cz.test.calculator; import java.io.Serializable; import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import javax.faces.context.FacesContext; @ManagedBean @ViewScoped public class ResultBeanView implements Serializable { private Result result = new Result(); /** Creates a new instance of ResultBeanView */ public ResultBeanView() { } @PostConstruct public void init() { // Try to find request bean ManagedBeanRequest and reset result value CalculatorBeanRequest calculatorBeanRequest = (CalculatorBeanRequest)FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get("calculatorBeanRequest"); if(calculatorBeanRequest != null) { setResult(calculatorBeanRequest.getResult()); } } /** No need to have public modifier as not used on view * but only in managed bean within the same package */ void setResult(Result result) { this.result = result; } /** No need to have public modifier as not used on view * but only in managed bean within the same package */ Result getResult() { return result; } /** * To be called on page to instantiate ResultBeanView in Render view phase */ public boolean isDummy() { return false; } }

    Read the article

  • Is there a Chromeless player solution for videos hosted elsewhere besides Youtube?

    - by Classer
    I am looking for the abilities that Youtube's Chromeless player has to offer but for non-Youtube hosted videos such as Metacafe, Vimeo, Viddler, etc. Abilities I will need are : Mute/Unmute (toggle) Volume Loop Resize video dimensions Current play back position Load bar Can I use Chromeless player for videos hosted on other sites besides Youtube? If not is there a solution out there? If not, what languages/APIs would I need use and know to create such an application?

    Read the article

  • Send data to LPT on windows XP

    - by gigi
    I want to send data to a printer on LPT1 and i trying exactly this but my CreateFile returns -1 (The system cannot find the file specified.Exception from HRESULT:0x80070002). How to open LPT1 port and send data to? I am trying this on XP and after that in win7 64 bit because from what i've read working with LPT in win7 64 bit is a bit of a problem, or should i say 64 bit of a problem:) PS:Since it's my first post this year: Happy New year to everybody.

    Read the article

  • Getting a PasteScript error when I try to serve an existing Pylons app.

    - by Sarah
    I'm trying to serve an existing Python 2.5 Pylons application on OS X Snow Leopard. I've already installed Python 2.5 and set it as the default Python installation, installed paster, and installed the version of Pylons the app needs (0.9.6.1) as well as other eggs... but when I cd to the main folder and do "paster serve development.ini" I get the following: File "/usr/local/bin/paster", line 5, in <module> from pkg_resources import load_entry_point File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 2603, in <module> File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 666, in require File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 565, in resolve pkg_resources.DistributionNotFound: PasteScript==1.7.3 I definitely have done "easy_install PasteScript==1.7.3" and I still get this error. Is there something really obvious I'm missing? Help? Thanks in advance.

    Read the article

  • an asp.net routing issue

    - by Adam Right
    my route implementation on Global.asax protected void Application_Start(object sender, EventArgs e) { this.intRoutes(RouteTable.Routes); } void intRoutes(RouteCollection Rts) { Rts.MapPageRoute("search", "{language}/{page}", "~/search.aspx"); Rts.MapPageRoute("category", "{language}/{name}/{no}/{categoryname}", "~/category.aspx"); Rts.MapPageRoute("product", "{language}/{name}/{no}/{productname}", "~/product.aspx"); } the problem is; if i use product routing on a hyperlink, like as follows; <asp:HyperLink ID="hyProduct" NavigateUrl='<%#HttpUtility.UrlDecode(((Page)HttpContext.Current.Handler).GetRouteUrl("product", new{ language=getUIFromHelper(),name=getNameFromHelper(),no=Eval("code"),productname=getProductNameFromHelper(Eval("name"))})) %>' runat="server" Text="something" /> everything goes fine, the link is written as expected like /en/products/06.008.001.150.0510/davis-fish-seeker-green but when i click that link the category.aspx page runs insted of product.aspx. am i missing out something ?

    Read the article

  • Disable browser zoom on certain elements in Firefox

    - by Jonathan Morgan
    Is it possible to disable the in-browser, full-page zoom in Firefox (activated by Ctrl +) for a webpage? How about for certain elements in a webpage? I just notice that sometimes elements look really weird when they are zoomed, and it might be nice to just disable the zooming completely for those elements. Note: I know there a few ways to find the zoom level, but this is really wanting to actively work around it (which might not be a good idea anyway).

    Read the article

  • Connecting slots and events in PyQt4 in a loop

    - by LukaD
    Im trying to build a calculator with PyQt4 and connecting the 'clicked()' signals from the buttons doesn't as expected. Im creating my buttons for the numbers inside a for loop where i try to connect them afterwards. def __init__(self): for i in range(0,10): self._numberButtons += [QPushButton(str(i), self)] self.connect(self._numberButtons[i], SIGNAL('clicked()'), lambda : self._number(i)) def _number(self, x): print(x) When I click on the buttons all of them print out '9'. Why is that so and how can i fix this?

    Read the article

  • Normalized Device Coordinates to window coordinates

    - by okoman
    I just read some stuff about the theory behind 3d graphics. As I understand it, normalized device coordinates (NDC) are coordinates that describe a point in the interval from -1 to 1 on both the horizontal and vertical axis. On the other hand window coordinates describe a point somewhere between (0,0) and (width,height) of the window. So my formula to convert a point from the NDC coordinate system to the window system would be xwin = width + xndc * 0.5 * width ywin = height + ynfv * 0.5 * height The problem now is that in the OpenGL documentation for glViewport there is an other formula: xwin = ( xndc + 1 ) * width * 0.5 + x ywin = ( yndc + 1 ) * height * 0.5 + y Now I'm wondering what I am getting wrong. Especially I'm wondering what the additional "x" and "y" mean. Hope the question isn't too "not programming related", but I thought somehow it is related to graphics programming.

    Read the article

  • Extract object (*.o) files from an iPhone static library

    - by Brett
    I have a set of iPhone static libraries (a *.a file) in which I only call a few of the classes from. I have used AR in the past (with linux libraries) to extract the object files from the static library, remove the unwanted object files and rearchive. However, when I try this with an iPhone compliled static library, I get the following error: ar: CustomiPhoneLib.a is a fat file (use libtool(1) or lipo(1) and ar(1) on it) ar: CustomiPhoneLib.a: Inappropriate file type or format Does anyone know how to extract the object files from an iphone compiled static library? Doing thie could potentially reduce the final file size.

    Read the article

  • ParentViewController returns nil

    - by Andreas Johannessen
    Hi I know there are many questions on this, but I don't get it to work. I present a UITabBarController with the presentModalViewController. However when I try to get title from the navigationItem title attribute in the UINavigationController class that presents the tabcontroller, it returns nil no matter what I do. I have the NSLog in the viewDidLoad method in tabcontroller class. I also cast the UIViewController which is returned by the self.parentViewController property. Then I try to access the title through: NSLog(@"%@", castedViewController.navigationItem.title); Any suggestions?

    Read the article

  • gcc check if file is main (#if __BASE_FILE__ == __FILE__)

    - by Marcin Raczkowski
    Hello. In ruby there's very common idiom to check if current file is "main" file: if __FILE__ == $0 # do something here (usually run unit tests) end I'd like to do something similar in C after reading gcc documentation I've figured that it should work like this: #if __FILE__ == __BASE_FILE__ // Do stuff #endif the only problem is after I try this: $ gcc src/bitmap_index.c -std=c99 -lm && ./a.out src/bitmap_index.c:173:1: error: token ""src/bitmap_index.c"" is not valid in preprocessor expressions Am I using #if wrong?

    Read the article

  • How do I make a multiple file upload?

    - by Bluemagica
    I am trying to make a multiple image uploader. The file upload fields are being added in the form dynamically using jquery. I tried making an array of the fields since I don't want to have a hidden field. so my generated upload fields look like <input type="file" id="img0" name="img[]"/> <input type="file" id="img1" name="img[]"/> <input type="file" id="img2" name="img[]"/> ..... .. And on the php side I did something like if(isset($_FILES['img'])) { foreach($_FILES['img'] as $k=>$v) { if($v!="") { uploadImage($k,0,0,0,"content/gallery/"); } } } Now I know I am way too wrong, since in that code I am looping through the 'img' file's properties instead of all images....but I have no idea how to fix this. PS: uploadImage is a function I wrote which expects the file input field's name as the first parameter.

    Read the article

  • What are the typical methods used to scale up/out email storage servers?

    - by nareshov
    Hi, What I've tried: I have two email storage architectures. Old and new. Old: courier-imapds on several (18+) 1TB-storage servers. If one of them show signs of running out of disk space, we migrate a few email accounts to another server. the servers don't have replicas. no backups either. New: dovecot2 on a single huge server with 16TB (SATA) storage and a few SSDs we store fresh mails on the SSDs and run a doveadm purge to move mails older than a day to the SATA disks there is an identical server which has a max-15min-old rsync backup from the primary server higher-ups/management wanted to pack in as much storage as possible per server in order to minimise the cost of SSDs per server the rsync'ing is done because GlusterFS wasn't replicating well under that high small/random-IO. scaling out was expected to be done with provisioning another pair of such huge servers on facing disk-crunch issues like in the old architecture, manual moving of email accounts would be done. Concerns/doubts: I'm not convinced with the synchronously-replicated filesystem idea works well for heavy random/small-IO. GlusterFS isn't working for us yet, I'm not sure if there's another filesystem out there for this use case. The idea was to keep identical pairs and use DNS round-robin for email delivery and IMAP/POP3 access. And if one the servers went down for whatever reasons (planned/unplanned), we'd move the IP to the other server in the pair. In filesystems like Lustre, I get the advantage of a single namespace whereby I do not have to worry about manually migrating accounts around and updating MAILHOME paths and other metadata/data. Questions: What are the typical methods used to scale up/out with the traditional software (courier-imapd / dovecot)? Do traditional software that store on a locally mounted filesystem pose a roadblock to scale out with minimal "problems"? Does one have to re-write (parts of) these to work with an object-storage of some sort - such as OpenStack object storage?

    Read the article

  • router w/ WOL out-of-the-box, or is known to work with open firmware

    - by Jaroslav Záruba
    I'm looking for a new WiFi router, and one key feature for me is WOL. Seems like many routers won't do this w/ factory firmware. Given my last router (Asus WL-520g) turned into a disco-brick couple hours after flashed to dd-wrt I'd prefer if the new one supported WOL out-of-the-box. other required features would be: dyndns service support port forwarding sometimes it is called "virtual server" I guess NAT loopback so I can access services running in my own network using dyndns hostname or public IP w/o getting too old (for example DIR-615 with factory firmware lets you wait literally minutes) did I mention WiFi? preferably w/ some range extending technology, if such stuff works at all

    Read the article

  • "pdf_open: Not a PDF 1.[1-5] file." when typesetting TeX file in TextMate

    - by Manti
    I have a TeX file, which is typeset by XeLaTeX. The file has \includegraphics{coverimage.eps} on the first page, and coverimage.eps is located in the same directory as the TeX file. OS: MacOS 10.6.5, TextMate 1.5.10, xelatex 3.1415926-2.2-0.9997.4 (TeX Live 2010) If I run xelatex doc.tex in console, file compiles without errors, and eps file is included. If I typeset it in TextMate (xelatex engine is selected in preferences), I get the following error: ** WARNING ** pdf_open: Not a PDF 1.[1-5] file. ** WARNING ** Failed to include image file "./coverimage.eps" ** WARNING ** >> Please check if ** WARNING ** >> rungs -q -dNOPAUSE -dBATCH -sPAPERSIZE=a0 -sDEVICE=pdfwrite -dCompatibilityLevel=%v -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -sOutputFile=%o %i -c quit ** WARNING ** >> %o = output filename, %i = input filename, %b = input filename without suffix ** WARNING ** >> can really convert "./coverimage.eps" to PDF format image. ** WARNING ** pdf: image inclusion failed for "coverimage.eps". ** WARNING ** Failed to read image file: coverimage.eps ** WARNING ** Interpreting special command PSfile (ps:) failed. ** WARNING ** >> at page="1" position="(107.149, 124.566)" (in PDF) ** WARNING ** >> xxx "PSfile="coverimage.eps" llx=0 lly=0 urx=408 ury=526 rwi=3809 and there is no image included in the resulting file (but text looks ok). I am not sure whether it is the error of xelatex or TextMate LaTeX bundle. What I tried to do: As I said, xelatex doc.tex from console works. The exact command line that TextMate uses is: xelatex -interaction=nonstopmode -file-line-error-style -synctex=1 But it works from console too. If I convert the image to pdf (and fix the .tex file accordingly), typesetting from TextMate works too. I tried running rungs with parameters specified in the error message, and got valid .pdf file with image as a result. I compared .log files from typesetting in TextMate and in console, they are absolutely identical except for this error message (in particular, version of xelatex is the same). Does anyone know what can cause this? Please tell me if you need any additional information. Thank you in advance.

    Read the article

  • How to copy symlinks to target as normal folders

    - by Marek
    Hi i have a folder with symlinks: marek@marek$ ls -al /usr/share/solr/ razem 36 drwxr-xr-x 5 root root 4096 2010-11-30 08:25 . drwxr-xr-x 358 root root 12288 2010-11-26 12:25 .. drwxr-xr-x 3 root root 4096 2010-11-24 14:29 admin lrwxrwxrwx 1 root root 14 2010-11-24 14:29 conf -> /etc/solr/conf i want to copy it to ~/solrTest but i want to copy files from symlink as well when i try to cp -r /usr/share/solr/ ~/solrTest i will have symlink here: marek@marek$ ls -al ~/solrTest razem 36 drwxr-xr-x 5 root root 4096 2010-11-30 08:25 . drwxr-xr-x 358 root root 12288 2010-11-26 12:25 .. drwxr-xr-x 3 root root 4096 2010-11-24 14:29 admin lrwxrwxrwx 1 root root 14 2010-11-24 14:29 conf -> /etc/solr/conf

    Read the article

  • Why Can't SSMS Access The Documents Folder in Windows 7?

    - by AaronSieb
    I have a database backup located in my Windows 7 Documents folder (c:\Users\Aaron\Documents...), and I'm trying to restore it using SQL Server Management Studio. However, the program is unable to access anything within the Users\Aaron directory using its non-standard file selection dialog, even when run as an Administrator. I'm brand new to Windows 7... Is there some sort of security setting that I need to trigger to give programs access to these files?

    Read the article

  • What you don't like in your web-framework of "choice"?

    - by 0101
    Most of the time we don't have a choice were it comes to web-frameworks, in Java every company is using a different one(big thanks to web-framework developers - you will burn in hell). However now I have a choice of picking which framework we will use, I will probably pick the one I know the best since I know how to by-pass its downfalls. In every comparation we will only see what is good in that frameworks and any downfalls will be swept under the carpet. What are the downfalls of most known frameworks?

    Read the article

  • How do I get one monitor on top of the other in Ubuntu 10.10?

    - by Jan
    I'm using a laptop and a monitor (wall mounted) over my laptop. I would like to reflect this physical hardware setup in my software screen setup. So that I can move my mouse upward, out of my laptop screen and use the monitor on the wall. I have been searching for a solution for a while, and I hope somone can help me out. I'm using Ubuntu 10.10 "out of the box". Side by side screen setups works just fine, over/under is doesn't work.

    Read the article

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