Daily Archives

Articles indexed Tuesday March 23 2010

Page 3/130 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Easiest way to support multiple orientations? How do I load a custom NIB when the application is in

    - by Peter Hajas
    Hi there, I have an application in which I would like to support multiple orientations. I have two .xib files that I want to use, myViewController.xib and myViewControllerLandscape.xib. myViewController.xib exists in project/Resources and myViewControllerLandscape.xib exists in the root project directory. What I want to do is use a separate NIB (myViewControllerLandscape.xib) for my rotations. I try detecting rotation in viewDidLoad like this: if((self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (self.interfaceOrientation == UIInterfaceOrientationLandscapeRight)) { NSLog(@"Landscape detected!"); [self initWithNibName:@"myViewControllerLandscape" bundle:nil]; } But I can see in gdb that this isn't executed when the app is started with the device in landscape. The NSLog message doesn't fire. Why is this? What have I done wrong? Also, if I explicitly put the initWithNibName function call in the viewDidLoad method, that nib is not loaded, and it continues with the myViewController.xib file. What's wrong with my call? Should I specify a bundle? Thanks!

    Read the article

  • C++ Array vs vector

    - by blue_river
    when using C++ vector, time spent is 718 milliseconds, while when I use Array, time is almost 0 milliseconds. Why so much performance difference? int _tmain(int argc, _TCHAR* argv[]) { const int size = 10000; clock_t start, end; start = clock(); vector<int> v(size*size); for(int i = 0; i < size; i++) { for(int j = 0; j < size; j++) { v[i*size+j] = 1; } } end = clock(); cout<< (end - start) <<" milliseconds."<<endl; // 718 milliseconds int f = 0; start = clock(); int arr[size*size]; for(int i = 0; i < size; i++) { for(int j = 0; j < size; j++) { arr[i*size+j] = 1; } } end = clock(); cout<< ( end - start) <<" milliseconds."<<endl; // 0 milliseconds return 0; }

    Read the article

  • SQL Server 2008 table variable error: Must declare the scalar variable "@RESULT".

    - by Trindaz
    I'm using table values for the first time as a parameter to a function in SQL Server 2008. The code below produces this error: Must declare the scalar variable "@RESULT". Why?! I'm declaring it on the first line of the function! ALTER FUNCTION f_Get_Total_Amount_Due( @CUSTOMER_LIST [tpCSFM_CUSTOMER_SET_FOR_MONEY] READONLY ) RETURNS [tpCSFM_CUSTOMER_SET_FOR_MONEY] AS BEGIN --Prepare the return value, start with initial customer list DECLARE @RESULT AS [tpCSFM_CUSTOMER_SET_FOR_MONEY] INSERT INTO @RESULT SELECT * FROM @CUSTOMER_LIST --Todo: populate with real values UPDATE @RESULT SET tpCSAM_MONEY_VALUE = 100 --return total amounts as currency RETURN @RESULT END

    Read the article

  • How to pass a class method as an argument for another function in C++ and openGL?

    - by tsubasa
    I know this thing works: void myDisplay() { ... } int main() { ... glutDisplayFunc(myDisplay) ... } so I tried to include myDisplay() function to a class that I made. Because I want to overload it in the future with a different class. However, the compiler complains that argument of type 'void (ClassBlah::)()' does not match 'void(*)()' . Here is the what I try to make: class ClassBlah { .... void myDisplay() .... } ...... int main() { ... ClassBlah blah glutDisplayFunc(blah.myDisplay) ... } Does anybody knows how to fix this problem? Many thanks.

    Read the article

  • SDL with Code::Blocks and Visual Studio 2008 VC++ Compiler

    - by macattack
    I've looked around on Google for tutorials on setting up SDL with it. The problem is that all the tutorials for linking to SDL with Code::Blocks is with the Mingw compiler, and never with VC++ 2008 Compiler. I have the SDL for VS downloaded at C:\SDL. The problem is, I can't get it to work with Code::Blocks. What do I need to do? I tried following the tutorials for Mingw but they don't seem to work.

    Read the article

  • Visual Studio solution parser

    - by gsirianni
    I'm looking for a tool that reads a .sln file and parses out all the sub projects and then parses all the sub project files into a list so that I can write a build list for a release? I just want the directory structure of the entier solution minus any excess that may exist in the solution's directory structure.

    Read the article

  • How does UIImage work in low-memory situations?

    - by kubi
    According to the UIImage documentation: In low-memory situations, image data may be purged from a UIImage object to free up memory on the system. Does anyone know how this works? It appears that this process is completely transparent and will occur in the background with no input from me, but I can't find any definitive documentation one way or the other. Second, will this data-purge occur when the image is not loaded by me? (I'm getting the image from UIImagePicker). Here's the situation: I'm taking a picture with the UIImagePickerController and and immediately taking that image and sending it to a new UIViewController for display. Sending the raw image to the new controller crashes my app with memory warnings about 30% of the time. Resizing the image takes a few moments, time that I'd rather not spend if there's a 3rd option available to me.

    Read the article

  • Styles for XAML (Silverlight &amp; WPF)

    - by GeekAgilistMercenary
    This is a quick walk through of how to setup things for skinning within a XAML Application.  First thing, find the App.xaml file within the WPF or Silverlight Project. Within the App.xaml file set some default styles for your controls.  I set the following for a button, label, and border control for an application I am creating. Button Control <Style x:Key="ButtonStyle" TargetType="Button"> <Setter Property="FontFamily" Value="Arial" /> <Setter Property="FontWeight" Value="Bold" /> <Setter Property="FontSize" Value="14" /> <Setter Property="Width" Value="180" /> <Setter Property="Height" Value="Auto" /> <Setter Property="Margin" Value="8" /> <Setter Property="Padding" Value="8" /> <Setter Property="Foreground" Value="AliceBlue" /> <Setter Property="Background" > <Setter.Value> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="Black" Offset="0" /> <GradientStop Color="#FF5B5757" Offset="1" /> </LinearGradientBrush> </Setter.Value> </Setter> </Style> Label Control <Style x:Key="LabelStyle" TargetType="Label"> <Setter Property="Width" Value="Auto"/> <Setter Property="Height" Value="28" /> <Setter Property="Foreground" Value="Black"/> <Setter Property="Margin" Value="8"/> </Style> Border Control <Style x:Key="BorderStyle" TargetType="Border"> <Setter Property="BorderThickness" Value="4"/> <Setter Property="Width" Value="Auto"/> <Setter Property="Height" Value="Auto" /> <Setter Property="Margin" Value="0,8,0,0"/> <Setter Property="CornerRadius" Value="18"/> <Setter Property="BorderBrush"> <Setter.Value> <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"> <GradientStop Color="CornflowerBlue" Offset="0" /> <GradientStop Color="White" Offset="1" /> </LinearGradientBrush> </Setter.Value> </Setter> </Style> These provide good examples of setting individual properties to a default, such as; <Setter Property="Width" Value="Auto"/> <Setter Property="Height" Value="Auto" /> Also for settings a more complex property, such as with a LinearGradientBrush; <Setter Property="BorderBrush"> <Setter.Value> <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"> <GradientStop Color="CornflowerBlue" Offset="0" /> <GradientStop Color="White" Offset="1" /> </LinearGradientBrush> </Setter.Value> </Setter> These property setters should be located between the opening and closing <Application.Resources></Application.Resources> tags. <Application x:Class="ScorecardAndDashboard.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml"> <Application.Resources> </Application.Resources> </Application> Now in the pages, user controls, or whatever you are marking up with XAML, for the Style Property just set a StaticResource such as shown below. <!-- Border Control --> <Border Name="borderPollingFrequency" Style="{StaticResource BorderStyle}"> <!-- Label Control --> <Label Content="Trigger Name:" Style="{StaticResource LabelStyle}"></Label> <!-- Button Control --> <Button Content="Save Schedule" Name="buttonSaveSchedule" Style="{StaticResource ButtonStyle}" HorizontalAlignment="Right"/> That's it.  Simple as that.  There are other ways to setup resource files that are separate from the App.xaml, but the App.xaml file is always a good quick place to start.  As moving the styles to a specific resource file later is a mere copy and paste. Original post is available along with other technical ramblings.

    Read the article

  • Exchange Out of Office Reply reset

    - by Richard West
    I have a question. We have an employee that is going to be on maternity leave for the next 8 weeks. I think that Outlook/Exchange is designed to send one out of office message to each person that sends an email to my user for the duration of the out of office reply. Meaning that if someone sends an email to my user each week they are only going to receive one out of office message - the first time they send her an e-mail. My concern is that over time people might forget that she is out of the office. Since they are not receiving any type of reply when they send an email this would seem possible. Does anyone know if Exchange ever resets the out of message notification after a certain amount of time? Like a week or so? I'm not looking for every message to get an out of office message, but I think more than one over the course of 8 weeks would be appropriate. I know that I can turn off and turn back on the out of office assistant to "reset" the replies, but I'm curious if Exchange performs a reset after a certain period of time automatically.

    Read the article

  • Bash script to create mass series of directories

    - by Volomike
    I need to create a Bash script to go into every user's home folder, seek out a wp-content folder, create a directory uploads under it, and then chmod 0756 uploads. How do I achieve this? I imagine I need to use find with a regexp/regex, and then tell it to run another bash script on the results.

    Read the article

  • Do Online Businesses Really Need High Bandwidth Hosting?

    Irrespective of the amount of information available on the internet it still feels like the need for more to us. People say that there is no distinction between a upcoming businessman and an already victorious businessman in terms of having complete knowledge of ones business. It is the most difficult decision for a new entrepreneur to make as to going in for a high bandwidth hosting or an average hosting plan.

    Read the article

  • Spring Web Service Client Tutorial or Example Required

    - by Nirmal
    Hello All... I need to jump into the Spring Web Service Project, in that I required to implement the Spring Web Service's Client Only.. So, I have already gone through with Spring's Client Reference Document. So, I got the idea of required classes for the implementation of Client. But my problem is like I have done some googling, but didn't get any proper example of both Client and Server from that I can implement one sample for my client. So, if anybody gives me some link or tutorial for proper example from that I can learn my client side implementation would be greatly appreciated. Thanks in advance...

    Read the article

  • Why won't C++ allow this default value

    - by nieldw
    Why won't GCC allow a default parameter here? template<class edgeDecor, class vertexDecor, bool dir> Graph<edgeDecor,int,dir> Graph<edgeDecor,vertexDecor,dir>::Dijkstra(vertex s, bool print = false) const { This is the output I get: graph.h:82: error: default argument given for parameter 2 of ‘Graph<edgeDecor, int, dir> Graph<edgeDecor, vertexDecor, dir>::Dijkstra(Vertex<edgeDecor, vertexDecor, dir>, bool)’ graph.h:36: error: after previous specification in ‘Graph<edgeDecor, int, dir> Graph<edgeDecor, vertexDecor, dir>::Dijkstra(Vertex<edgeDecor, vertexDecor, dir>, bool)’ Can anyone see why I'm getting this?

    Read the article

  • Force ruby to use dbi Gem instead of dbi in site_ruby

    - by sutch
    I'm using: Windows 7 Ruby 1.8.6 One-Click Installer DBI version 0.4.3 installed using RubyGems What I see when executing these commands: C:ruby -v ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] C:gem -v 1.3.1 C:ruby -r rubygems -r dbi -e "puts DBI::VERSION" 0.2.2 C:gem list dbi *** LOCAL GEMS *** dbi (0.4.3) Why do ruby scripts use the DBI installed in site_ruby rather than the DBI installed with RubyGems? Updated to respond to Luis Lavena's answer... Here's what happened when I attempted what you suggest: C:ruby -r rubygems -e "require 'rubygems'; puts DBI::VERSION" -e:1: uninitialized constant DBI (NameError) And when I updated to require DBI: C:ruby -r rubygems -e "require 'rubygems' ; require 'dbi' ; puts DBI::VERSION" 0.2.2 Why wouldn't RubyGems override the built-in library?

    Read the article

  • stripping a query string with php (preg_replace)

    - by pg
    http://www.chuckecheese.com/rotator.php?cheese=4&id=1 I want to take out the id, leaving the cheese to stand alone. I tried: $qs = preg_replace("[^&id=*]" ,'',$_SERVER[QUERY_STRING]); But that said I was using an improper modifier. I want to remove "$id=" and whatever number comes after it. Are regexp really as hard as they seem for me?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >