Search Results

Search found 88 results on 4 pages for 'cw'.

Page 3/4 | < Previous Page | 1 2 3 4  | Next Page >

  • MCTS exam 70-526 vs 70-505

    - by doug.stanhope
    I guess this should be CW but I don't know how to post a question as such, so if anyone can help out... What I would like to know is the following: I have taken exam 70-526 a couple of years ago and I still have the training kit laying around. Now my boss wants me to prepare for the upgrade exam 70-505. Do you know if both exams are similar or otherwise put: do you think I have to get the new training kit to prepare for this exam or will the old one do? I haven't done a whole lot of Windows Forms programming these past few years so I'll have to re-learn much of what's in the book.

    Read the article

  • Perl equivalent to Java's "throws" clause

    - by Konerak
    Is there a way in Perl to declare that a method can throw an error (or die)? EDIT: What interests me the most is a way to get the compiler or IDE to tell me I have an unchecked exception somewhere in my code. I always loved how in Java, a method could handle an Exception and/or throw it. The method signature allows to put "throws MyException", so a good IDE/compiler would know that if you use said method somewhere in your code, you'd have to check for the Exception or declare your function to "throws" the Exception further. I'm unable to find something alike in Perl. A collegue of mine wrote a method which "dies" on incorrect input, but I forget to eval-if($@) it... offcourse the error was only discovered while a user was running the application. (offcourse I doubt if there is any existing IDE that could find these kind of things for Perl, but atleast perl -cw should be able to, no?)

    Read the article

  • Rough/near equivalents of Java and .NET technologies/frameworks

    - by Paul Sasik
    I work in a shop that is a mix of mostly Java and .NET technologists. When discussing new solutions and architectures we often encounter impedance in trying to compare the various technologies, frameworks, APIs etc. in use between the two camps. It seems that each camp knows little about the other and we end up comparing apples to oranges and forgetting about the bushels. While researching the topic I found this: Java -- .Net rough equivalents It's a nice list but it's not quite exhaustive and is missing the key .NET 3.0 technologies and a few other tidbits. To complete that list: what are the near/rough equivalents (or a combination of technologies) in Java to the following in .NET? WCF WPF Silverlight WF Generics Lambda expressions Linq (not Linq-to-SQL) ...have i missed anything else? Note that I omitted technologies that are already covered in the linked article. I would also like to hear feedback on whether the linked article is accurate. Thanks. (Will CW if requested.)

    Read the article

  • How do I antialias the clip boundary on Android's canvas?

    - by Jesse Wilson
    I'm using Android's android.graphics.Canvas class to draw a ring. My onDraw method clips the canvas to make a hole for the inner circle, and then draws the full outer circle over the hole: clip = new Path(); clip.addRect(outerCircle, Path.Direction.CW); clip.addOval(innerCircle, Path.Direction.CCW); canvas.save(); canvas.clipPath(clip); canvas.drawOval(outerCircle, lightGrey); canvas.restore(); The result is a ring with a pretty, anti-aliased outer edge and a jagged, ugly inner edge: What can I do to antialias the inner edge? I don't want to cheat by drawing a grey circle in the middle because the dialog is slightly transparent. (This transparency isn't as subtle on on other backgrounds.)

    Read the article

  • Can the Perl compiler tell me if I have an unchecked exception in my code?

    - by Konerak
    Is there a way in Perl to declare that a method can throw an error (or die)? EDIT: What interests me the most is a way to get the compiler or IDE to tell me I have an unchecked exception somewhere in my code. I always loved how in Java, a method could handle an Exception and/or throw it. The method signature allows to put "throws MyException", so a good IDE/compiler would know that if you use said method somewhere in your code, you'd have to check for the Exception or declare your function to "throws" the Exception further. I'm unable to find something alike in Perl. A collegue of mine wrote a method which "dies" on incorrect input, but I forget to eval-if($@) it... offcourse the error was only discovered while a user was running the application. (offcourse I doubt if there is any existing IDE that could find these kind of things for Perl, but atleast perl -cw should be able to, no?)

    Read the article

  • What is the worst programming mistake you have made?

    - by George Edison
    Most of us are not perfect. (Well, except Jon Skeet) Have you made a terrible mistake that you would like to share? The idea is that we could all learn from our mistakes and by collecting them together here, we can avoid some common ones and discover some no-so-common ones we may have overlooked. Oh, and this question is CW, of course. Edit: This question is different than http://stackoverflow.com/questions/1928002/what-is-the-worst-programming-mistake-you-have-ever-seen because we are sharing our own mistakes. Edit again: And this one http://stackoverflow.com/questions/130965/what-is-the-worst-code-youve-ever-written is different too - it asks for code. My question does not have that restriction!

    Read the article

  • code for TouchPad works, but not for DPAD ...please help me to fix this..

    - by Chandan
    package org.coe.twoD; import android.app.Activity; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; //import android.graphics.Path; import android.graphics.Rect; //import android.graphics.RectF; import android.os.Bundle; //import android.util.Log; import android.util.Log; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; public class TwoD extends Activity implements OnClickListener { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); View draw2d = findViewById(R.id.draw_button); draw2d.setOnClickListener(this); } public void onClick(View v) { if (R.id.draw_button == v.getId()) { setContentView(new draw2D(this)); } } public class draw2D extends View { private static final String TAG = "Sudoku"; private float width; // width of one tile private float height; // height of one tile private int selX; // X index of selection private int selY; // Y index of selection private final Rect selRect = new Rect(); public draw2D(Context context) { super(context); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { width = w / 9f; height = h / 9f; getRect(selX, selY, selRect); Log.d(TAG, "onSizeChanged: width " + width + ", height " + height); super.onSizeChanged(w, h, oldw, oldh); } @Override protected void onDraw(Canvas canvas) { // Draw the background... Paint background = new Paint(); background.setColor(getResources().getColor(R.color.background)); canvas.drawRect(0, 0, getWidth(), getHeight(), background); // Draw the board... // Define colors for the grid lines Paint dark = new Paint(); dark.setColor(getResources().getColor(R.color.dark)); Paint hilite = new Paint(); hilite.setColor(getResources().getColor(R.color.hilite)); Paint light = new Paint(); light.setColor(getResources().getColor(R.color.light)); // Draw the minor grid lines for (int i = 0; i < 9; i++) { canvas.drawLine(0, i * height, getWidth(), i * height, light); canvas.drawLine(0, i * height + 1, getWidth(), i * height + 1, hilite); canvas.drawLine(i * width, 0, i * width, getHeight(), light); canvas.drawLine(i * width + 1, 0, i * width + 1, getHeight(), hilite); } // Draw the major grid lines for (int i = 0; i < 9; i++) { if (i % 3 != 0) continue; canvas.drawLine(0, i * height, getWidth(), i * height, dark); canvas.drawLine(0, i * height + 1, getWidth(), i * height + 1, hilite); canvas.drawLine(i * width, 0, i * width, getHeight(), dark); canvas.drawLine(i * width + 1, 0, i * width + 1, getHeight(), hilite); } /* * dark.setColor(Color.MAGENTA); Path circle= new Path(); * circle.addCircle(150, 150, 100, Path.Direction.CW); * canvas.drawPath(circle, dark); * * * Path rect=new Path(); * * RectF rectf= new RectF(150,200,250,300); rect.addRect(rectf, * Path.Direction.CW); canvas.drawPath(rect, dark); * * * canvas.drawRect(0, 0,250, 250, dark); * * * canvas.drawText("Hello", 200,200, dark); */ Paint selected = new Paint(); selected.setColor(Color.GREEN); canvas.drawRect(selRect, selected); } /* * public boolean onTouchEvent(MotionEvent event){ * if(event.getAction()!=MotionEvent.ACTION_DOWN) return * super.onTouchEvent(event); * select((int)(event.getX()/width),(int)(event.getY()/height)); * * * return true; } */ private void select(int x, int y) { invalidate(selRect); selX = Math.min(Math.max(x, 0), 8); selY = Math.min(Math.max(y, 0), 8); getRect(selX, selY, selRect); invalidate(selRect); } @Override public boolean onKeyUp(int keyCode, KeyEvent event) { return super.onKeyUp(keyCode, event); } @Override public boolean onTouchEvent(MotionEvent event) { if (event.getAction() != MotionEvent.ACTION_DOWN) return super.onTouchEvent(event); select((int) (event.getX() / width), (int) (event.getY() / height)); // game.showKeypadOrError(selX, selY); Log.d(TAG, "onTouchEvent: x " + selX + ", y " + selY); return true; } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { Log.d(TAG, "onKeyDown: keycode=" + keyCode + ", event=" + event); switch (keyCode) { case KeyEvent.KEYCODE_DPAD_UP: select(selX, selY - 1); break; case KeyEvent.KEYCODE_DPAD_DOWN: select(selX, selY + 1); break; case KeyEvent.KEYCODE_DPAD_LEFT: select(selX - 1, selY); break; case KeyEvent.KEYCODE_DPAD_RIGHT: select(selX + 1, selY); break; default: return super.onKeyDown(keyCode, event); } return true; } private void getRect(int x, int y, Rect rect) { rect.set((int) (x * width), (int) (y * height), (int) (x * width + width), (int) (y * height + height)); } } }

    Read the article

  • If you're not supposed to use Regular Expressions to parse HTML, then how are HTML parsers written?

    - by Andy E
    I see questions every day asking how to parse or extract something from some HTML string and the first answer/comment is always "Don't use RegEx to parse HTML, lest you feel the wrath!" (that last part is sometimes omitted). This is rather confusing for me, I always thought that in general, the best way to parse any complicated string is to use a regular expression. So how does a HTML parser work? Doesn't it use regular expressions to parse. One particular argument for using a regular expression is that there's not always a parsing alternative (such as JavaScript, where DOMDocument isn't a universally available option). jQuery, for instance, seems to manage just fine using a regex to convert a HTML string to DOM nodes. Not sure whether or not to CW this, it's a genuine question that I want to be answered and not really intended to be a discussion thread.

    Read the article

  • What languages have a while-else type control structure, and how does it work?

    - by Dan
    A long time ago, I thought I saw a proposal to add an else clause to for or while loops in C or C++... or something like that. I don't remember how it was supposed to work -- did the else clause run if the loop exited normally but not via a break statement? Anyway, this is tough to search for, so I thought maybe I could get some CW answers here for various languages. What languages support adding an else clause to something other than an if statement? What is the meaning of that clause? One language per answer please.

    Read the article

  • How to write "good" user interface texts?

    - by Roddy
    Many applications are let down by the quality of the 'writing' in their user interfaces: typically, poor spelling, grammar, inconsistent tone, and worse yet, "humour" are the usual offenders. Are there good resources that can help developers to write UI messages that give a professional and positive impression to your customers, even when your code's going to hell in a handcart? Thanks, all — Some great resources here, so I will CW this question. I'm accepting Adam Sill's answer because it's the one that (as a developer of desktop apps) I found most pertinent.

    Read the article

  • Poll: Require Semicolons and Forbid Tables?

    - by George Bailey
    There are a few very serious but opinionated and subjective arguments that I know of. Two of them are Whether or not to use semicolons in the event they are optional. There is a vote as here that also includes reasons Whether or not to use tables for non tabular data. There more information here Since the semicolon question arises often in JavaScript and the tables thing in HTML then there are probably many who run into both. I sort of expect a person who is strict with semicolons also to be strict about avoiding tables. I will post four CW answers here to vote on. Please vote what you think is right. If you want to talk about the reasons then please use Semicolons: Do you recommend using semicolons after every statement in JavaScript? Tables: Start your own question under the polls tag and follow the design of the semicolons question.

    Read the article

  • Style question: Writing "this." before instance variable and methods: good or bad idea?

    - by Uri
    One of my nasty (?) programming habits in C++ and Java is to always precede calls or accesses to members with a this. For example: this.process(this.event). A few of my students commented on this, and I'm wondering if I am teaching bad habits. My rationale is: 1) Makes code more readable — Easier to distinguish fields from local variables. 2) Makes it easier to distinguish standard calls from static calls (especially in Java) 3) Makes me remember that this call (unless the target is final) could end up on a different target, for example in an overriding version in a subclass. Obviously, this has zero impact on the compiled program, it's just readability. So am I making it more or less readable? Related Question Note: I turned it into a CW since there really isn't a correct answer.

    Read the article

  • How to write "good" user interface text?

    - by Roddy
    Many applications are let down by the quality of the 'writing' in their user interfaces: typically, poor spelling, grammar, inconsistent tone, and worse yet, "humour" are the usual offenders. Are there good resources that can help developers to write UI messages that give a professional and positive impression to your customers, even when your code's going to hell in a handcart? Thanks, all — Some great resources here, so I will CW this question. I'm accepting Adam Sill's answer because it's the one that (as a developer of desktop apps) I found most pertinent.

    Read the article

  • Determine coordinates of rotated rectangle

    - by MathieuK
    I'm creating an utility application that should detect and report the coordinates of the corners of a transparent rectangle (alpha=0) within an image. So far, I've set up a system with Javascript + Canvas that displays the image and starts a floodfill-like operation when I click inside the transparent rectangle in the image. It correctly determines the bounding box of the floodfill operation and as such can provide me the correct coordinates. Here's my implementation so-far: http://www.scriptorama.nl/image/ (works in recent Firefox / Safari ). However, the bounding box approach breaks down then the transparent rectangle is rotated (CW or CCW) as the resulting bounding box no longer properly represents the proper width and height. I've tried to come up with a few alternatives to detect to corners, but have not been able to think up a proper solution. So, does anyone have any suggestions on how I might approach this so I can properly detect the coordinates of 4 corners of the rotated rectangle?

    Read the article

  • In the generic programming/TMP world what exactly is a model / a policy and a "concept" ?

    - by Hassan Syed
    I'd like to know the precise yet succinct definitions of these three concepts in one place. The quality of the answer should depend on the following two points. Show a simple code snippet to show how and what the concept/technique is used for. Be simple enough to understand so that a programmer without any exposure to this area can grasp it. Note: There are probably many correct answers since each concept has many different facets. If there are a lot of good answers I will eventually turn the question into CW and aggregate the answers. -- Post Accept Edit -- Boost has a nice article on generic programming concepts

    Read the article

  • Is there a 'catch' with FastFormat?

    - by Roddy
    I just read about the FastFormat C++ i/o formatting library, and it seems too good to be true: Faster even than printf, typesafe, and with what I consider a pleasing interface: // prints: "This formats the remaining arguments based on their order - in this case we put 1 before zero, followed by 1 again" fastformat::fmt(std::cout, "This formats the remaining arguments based on their order - in this case we put {1} before {0}, followed by {1} again", "zero", 1); // prints: "This writes each argument in the order, so first zero followed by 1" fastformat::write(std::cout, "This writes each argument in the order, so first ", "zero", " followed by ", 1); This looks almost too good to be true. Is there a catch? Have you had good, bad or indifferent experiences with it? CW on this question, as there's probably no right answer...

    Read the article

  • Serialization of a TChan String

    - by J Fritsch
    I have declared the following type KEY = (IPv4, Integer) type TPSQ = TVar (PSQ.PSQ KEY POSIXTime) type TMap = TVar (Map.Map KEY [String]) data Qcfg = Qcfg { qthresh :: Int, tdelay :: Rational, cwpsq :: TPSQ, cwmap :: TMap, cw chan :: TChan String } deriving (Show) and would like this to be serializable in a sense that Qcfg can either be written to disk or be sent over the network. When I compile this I get the error No instances for (Show TMap, Show TPSQ, Show (TChan String)) arising from the 'deriving' clause of a data type declaration Possible fix: add instance declarations for (Show TMap, Show TPSQ, Show (TChan String)) or use a standalone 'deriving instance' declaration, so you can specify the instance context yourself When deriving the instance for (Show Qcfg) I am now not quite sure whether there is a chance at all to serialize my TChan although all individual nodes in it are members of the show class. For TMap and TPSQ I wonder whether there are ways to show the values in the TVar directly (because it does not get changed, so there should no need to lock it) without having to declare an instance that does a readTVar ?

    Read the article

  • Simple end-to-end load and bottleneck monitoring for DB-based web sites

    - by T.J. Crowder
    What tools do you use / would you recommend for monitoring a Linux-based, DB-based website's servers for bottlenecks and load? The obvious goal being to know when growth has gotten to the point where it's necessary to scale up (or out) one or more of the bits and pieces because the current system won't be managing the load if an observed trend continues. I'm looking for general recommendations based on standard Linux load metrics, disk I/O metrics, network I/O metrics, etc., but if specifics are helpful: It'll be Tomcat6 using APR (possibly with a Varnish or similar caching and balancing front-end), MySQL, and either Ubuntu 8.04 LTS or 10.04 LTS depending on timing. I know about top, vmstat, iostat, bwmon and the like that collect and parse info from the /proc file system (et. al.); and obviously MySQL provides a lot of queriable performance information. I could use those directly, probably automating periodic monitoring logs with scripts and such. But I have a suspicion that I'd be reinventing a wheel... For example, Hyperic HQ seems to be along the lines of what I'm looking for. Others? Meta: I tend to think of "recommendation" questions as needing to be CW because there's no one right answer, but I see a lot of these here that aren't CWs, so I haven't marked it as one. I'll happily do so if enough people think I should.

    Read the article

  • Numbers not adding up? (What am I not understanding here?) [closed]

    - by Milo
    I have the following output: Short version: The last numbers on the S= lines increase by H and SHOULD theoretically be linearly decreasing, ex: -285,-290,-295...but the fourth one jumps to -252. Yet, every other number is linearly increasing. Why is that and how could I fix that? To explain the numbers, it comes from slider value changed. I have a slider whose value is used to generate the float on the next line. Everything should be growing linearly here. This value is used to determine the size of a flow layout and it is also used in conjunction with a scrollbar. But basically I have a background for the flow layout and that number is the start location for rendering it. The numbers should linearly change to create a smooth transition but when that one jumps, it looks weird on screen and I dont understand why the numbers are jumping every X slider value changes. Mathematically what could be causing this? Here is the code for rendering the background and the function that is called when value changes: void LobbyTableManager::renderBG( GraphicsContext* g, agui::Rectangle& absRect, agui::Rectangle& childRect ) { float scale = 0.35f; int w = m_bgSprite->getWidth() * getTableScale() * scale; int h = m_bgSprite->getHeight() * getTableScale() * scale; int numX = ceil(absRect.getWidth() / (float)w) + 2; int numY = ceil(absRect.getHeight() / (float)h) + 2; int startY = childRect.getY(); int numAttempts = 0; while(startY + h < absRect.getY() && numAttempts < 1000) { startY += h; if(moo) { std::cout << startY << ","; } numAttempts++; } g->holdDrawing(); for(int i = 0; i < numX; ++i) { for(int j = 0; j < numY; ++j) { g->drawScaledSprite(m_bgSprite,0,0,m_bgSprite->getWidth(),m_bgSprite->getHeight(), absRect.getX() + (i * w) + (offsetX),absRect.getY() + (j * h) + startY,w,h,0); } } g->unholdDrawing(); g->setClippingRect(cx,cy,cw,ch); } void LobbyTableManager::setTableScale( float scale ) { scale += 0.3f; scale *= 2.0f; float scrollRel = m_vScroll->getRelativeValue(); setScale(scale); rescaleTables(); resizeFlow(); updateScrollBars(); float newVal = scrollRel * m_vScroll->getMaxValue(); m_vScroll->setValue(newVal); } void LobbyTableManager::valueChanged( agui::VScrollBar* source,int val ) { m_flow->setLocation(0,-val); } Any insight on mathematically why the anomaly might happen every Nth time would be helpful. I just dont understand why if every number linearly increates it jumps from -295 to -252! Thanks

    Read the article

  • Quantis Quantum Random Number Generator (QRNG) - any reviews?

    - by Tim Post
    I am thinking about getting one of these (PCI) to set up an internal entropy pool similar to this service who incidentally brought us fun captcha challenges. Prior to lightening my wallet, I'm hoping to gather feedback from people who may be using this device. As there is no possible 'correct' answer, I am making this CW and tagging it as subjective. I'm undertaking a project to help write Monte Carlo simulations for a non profit that distributes mosquito nets in Malaria stricken areas. The idea is to model areas to determine the best place to distribute mosquito nets. During development, I expect to consume gigs if not more of the RNG output. We really need our own source. Is this device reliable? Does it have to be re-started often? Is its bandwidth really as advertised? It passes all tests, as far as randomness goes (i.e. NIST/DIEHARD). What I don't want is something in deadlock due to some ioctl in disk sleep that does nothing but radiate heat. This is not a spamvertisement, I'm helping out of pocket and I really, really want to know if such a large purchase will bear fruit. I can't afford to build a HRNG based on radioactive decay, this looks like the next best thing. Any comments are appreciated. I will earn zero rep for this, please do not vote to close. This is no different than questions regarding the utilization of some branded GPU for some odd purpose. Answers pointing to other solutions will be gladly accepted, I'm not married to this idea.

    Read the article

  • ASP.NET MVC Using Castle Windsor IoC

    - by Mad Halfling
    I have an app, modelled on the one from Apress Pro ASP.NET MVC that uses castle windsor's IoC to instantiate the controllers with their respective repositories, and this is working fine e.g. public class ItemController : Controller { private IItemsRepository itemsRepository; public ItemController(IItemsRepository windsorItemsRepository) { this.itemsRepository = windsorItemsRepository; } with using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Castle.Windsor; using Castle.Windsor.Configuration.Interpreters; using Castle.Core.Resource; using System.Reflection; using Castle.Core; namespace WebUI { public class WindsorControllerFactory : DefaultControllerFactory { WindsorContainer container; // The constructor: // 1. Sets up a new IoC container // 2. Registers all components specified in web.config // 3. Registers all controller types as components public WindsorControllerFactory() { // Instantiate a container, taking configuration from web.config container = new WindsorContainer(new XmlInterpreter(new ConfigResource("castle"))); // Also register all the controller types as transient var controllerTypes = from t in Assembly.GetExecutingAssembly().GetTypes() where typeof(IController).IsAssignableFrom(t) select t; foreach (Type t in controllerTypes) container.AddComponentWithLifestyle(t.FullName, t, LifestyleType.Transient); } // Constructs the controller instance needed to service each request protected override IController GetControllerInstance(Type controllerType) { return (IController)container.Resolve(controllerType); } } } controlling the controller creation. I sometimes need to create other repository instances within controllers, to pick up data from other places, can I do this using the CW IoC, if so then how? I have been playing around with the creation of new controller classes, as they should auto-register with my existing code (if I can get this working, I can register them properly later) but when I try to instantiate them there is an obvious objection as I can't supply a repos class for the constructor (I was pretty sure that was the wrong way to go about it anyway). Any help (especially examples) would be much appreciated. Cheers MH

    Read the article

  • Why is XmlSerializer so hard to use?

    - by mafutrct
    I imagine to use XML serialization like this: class Foo { public Foo (string name) { Name1 = name; Name2 = name; } [XmlInclude] public string Name1 { get; private set; } [XmlInclude] private string Name2; } StreamWriter wr = new StreamWriter("path.xml"); new XmlSerializer<Foo>().Serialize (wr, new Foo ("me")); But this does not work at all: XmlSerializer is not generic. I have to cast from and to object on (de)serialization. Every property has to be fully public. Why aren't we just using Reflection to access private setters? Private fields cannot be serialized. I'd like to decorate private fields with an attribute to have XmlSerializer include them. Did I miss something and XmlSerializer is actually offering the described possibilities? Are there alternate serializers to XML that handle these cases more sophisticatedly? If not: We're in 2010 after all, and .NET has been around for many years. XML serialization is often used, totally standard and should be really easy to perform. Or is my understanding possibly wrong and XML serialization ought not to expose the described features for a good reason? (Feel free to adjust caption or tags. If this should be CW, please just drop a note.)

    Read the article

  • iPhone Landscape FAQ and Solutions

    - by Johannes Rudolph
    There has been a lot of confusion and a set of corresponding set of questions here on SO how iPhone applications with proper handling for Landscape/Portrait mode autorotation can be implemented. It is especially difficult to implement such an application when starting in landscape mode is desired. The most common observed effect are scrambled layouts and areas of the screen where touches are no longer recognized. A simple search for questions tagged iphone and landscape reveals these issues, which occur under certain scenarios: Landscape only iPhone app with multiple nibs: App started in Landscape mode, view from first nib is rendered fine, everything view loaded from a different nib is not displayed correctly. Iphone Landscape mode switching to Portraite mode on loading new controller: Self explanatory iPhone: In landscape-only, after first addSubview, UITableViewController doesn’t rotate properly: Same issue as above. iPhone Landscape-Only Utility-Template Application: Layout errors, controller does not seem to recognize the view should be rotated but displays a clipped portrait view in landscape mode, causing half of the screen to stay blank. presentModalViewController in landscape after portrait viewController: Modal views are not correctly rendered either. A set of different solutions have been presented, some of them including completely custom animation via CoreGraphics, while others build on the observation that the first view controller loaded from the main nib is always displayed correct. I have spent a significant amount of time investigating this issue and finally found a solution that is not only a partial solution but should work under all these circumstances. It is my intend with this CW post to provide sort of a FAQ for others having issues with UIViewControllers in Landscape mode. Please provide feedback and help improve the quality of this Post by incorporating any related observations. Feel free to edit and post other/better answers if you know of any.

    Read the article

  • The Coolest Parts of Windows API

    - by Andreas Rejbrand
    I have noticed that there are quite a few community wikis about "Tips & Tricks" or "Hidden Features" in programming languages and APIs here at Stack Overflow. But I could not find any about my own personal favourites: Win32 API and Delphi. Therefore I start my "own" CW about Win32 API. There are (at least) two kinds of Win API users: those that have been brought up using Windows API in C/C++, and those that have been brought up using some level of abstraction above the Windows API. I belong to the latter category, being brought up using Delphi's VCL. But over the last five years, I have become increasingly interested in the underlaying API of the Windows operating system, and today I work a lot with it. Depending on which category a programmer belongs to, he (or possibly she) will think that different things are "cool" in the Windows API. For instance, whereas a VCL-brought up developer might think it it very cool to var errIcon: HICON; begin errIcon := LoadIcon(0, IDI_ERROR); DrawIcon(Canvas.Handle, 10, 10, errIcon), a programmer brought up using Windows API in C will not be as impressed. But no matter how you are "brought up": what are the coolest "tricks" in Windows API? I start by listing a few of my own favourites, some of which are more "cool" than "useful", though: LoadIcon and MessageBeep can load/play system default icons and sounds. Open the CD tray: mciSendString('Set cdaudio door open wait', nil, 0, 0); Fade out the screen (Windows Vista and later) and turn of the monitor: SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 2); GetWindowDC(GetDesktopWindow) returns the DC of the desktop.

    Read the article

  • What objects would get defined in a Bridge scoring app (Javascript)

    - by Alex Mcp
    I'm writing a Bridge (card game) scoring application as practice in javascript, and am looking for suggestions on how to set up my objects. I'm pretty new to OO in general, and would love a survey of how and why people would structure a program to do this (the "survey" begets the CW mark. Additionally, I'll happily close this if it's out of range of typical SO discussion). The platform is going to be a web-app for webkit on the iPhone, so local storage is an option. My basic structure is like this: var Team = { player1: , player2: , vulnerable: , //this is a flag for whether or //not you've lost a game yet, affects scoring scoreAboveLine: , scoreBelowLine: gamesWon: }; var Game = { init: ,//function to get old scores and teams from DB currentBid: , score: , //function to accept whether bid was made and apply to Teams{} save: //auto-run that is called after each game to commit to DB }; So basically I'll instantiate two teams, and then run loops of game.currentBid() and game.score. Functionally the scoring is working fine, but I'm wondering if this is how someone else would choose to break down the scoring of Bridge, and if there are any oversights I've made with regards to OO-ness and how I've abstracted the game. Thanks!

    Read the article

< Previous Page | 1 2 3 4  | Next Page >