Search Results

Search found 15316 results on 613 pages for 'coding style'.

Page 65/613 | < Previous Page | 61 62 63 64 65 66 67 68 69 70 71 72  | Next Page >

  • How can I change the arrow style in a JComboBox

    - by Stephane Grenier
    Let's say I want to use a custom image for the arrow in JComboBox, how can I do this? I understand it's possible using the synth xml files, or maybe even UIManager.put(...), but I don't know how. All I want to do at this time is change the arrow image to something else, either programatically or even just overriding the image it uses. How exactly can I do this?

    Read the article

  • GUI style question: Icons in context menus?

    - by Andrew White
    Hi, It seems like not so long ago that it was standard to have icons/images in context menus and Microsoft seems to keep this up. But nowadays it seems to have disappeared in other apps: Chrome, iTunes etc. Anyone have an opinion / idea why this has happened or is it just completely personal taste (I for one like the images). A.

    Read the article

  • ASP.NET MVC twitter/myspace style routing

    - by Astrofaes
    Hi guys, This is my first post after being a long-time lurker - so please be gentle :-) I have a website similar to twitter, in that people can sign up and choose a 'friendly url', so on my site they would have something like: mydomain.com/benjones I also have root level static pages such as: mydomain.com/about and of course my homepage: mydomain.com/ I'm new to ASP.NET MVC 2 (in fact I just started today) and I've set up the following routes to try and achieve the above. public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.IgnoreRoute("content/{*pathInfo}"); routes.IgnoreRoute("images/{*pathInfo}"); routes.MapRoute("About", "about", new { controller = "Common", action = "About" } ); // User profile sits at root level so check for this before displaying the homepage routes.MapRoute("UserProfile", "{url}", new { controller = "User", action = "Profile", url = "" } ); routes.MapRoute("Home", "", new { controller = "Home", action = "Index", id = "" } ); } For the most part this works fine, however, my homepage is not being triggered! Essentially, when you browser to mydomain.com, it seems to trigger the User Profile route with an empty {url} parameter and so the homepage is never reached! Any ideas on how I can show the homepage?

    Read the article

  • Can highlight the current menu item, but can't add the class= to style unhighleted menu items

    - by bradpotts
    <?php $activesidebar[$currentsidebar]="id=isactive";?> <div class="span3"> <div class="well sidebar-nav hidden-phone"> <ul class="nav nav-list"> <li class="nav-header" <?php echo $activesidebar[1] ?>>Marketing Services</li> <li><a href="#">Marketing Technology</a></li> <li><a href="#">Generate More Sales</a></li> <li><a href="#">Direct Email Marketing</a></li> <li class="nav-header" <?php echo $activesidebar[2] ?>>Advertising Services</li> <li><a href="../services-advertising-mass-media-network.php">Traditional Medias</a></li> <li><a href="#">Online & Social Medias</a></li> <li><a href="#">Media Planing & Purchasing</a></li> <li class="nav-header" <?php echo $activesidebar[3] ?>>Technology Services</li> <li><a href="#">Managed Websites</a></li> <li><a href="#">Managed Web Servers</a></li> <li><a href="#">Managed Databases</a></li> <li class="nav-header" <?php echo $activesidebar[4] ?>>About Us</li> <li><a href="../aboutus-contactus.php">Contact Us</a></li> </ul> </div> This is added to the current page I want to add this on. <?php $currentsidebar =2; include('module-sidebar-navigation.php');?> I had programmed this menu individually on each page, but to make my website dynamic I used one file and use php includes to load the file. I can get the menu to highlight on the current page assigning an id="isactive", how can I assign id="notactive" to the other 3 menu items that are not active on that page. Is there an else or elseif I have to include?

    Read the article

  • WinForm-style Invoke() in unmanaged C++

    - by Matt Green
    I've been playing with a DataBus-type design for a hobby project, and I ran into an issue. Back-end components need to notify the UI that something has happened. My implementation of the bus delivers the messages synchronously with respect to the sender. In other words, when you call Send(), the method blocks until all the handlers have called. (This allows callers to use stack memory management for event objects.) However, consider the case where an event handler updates the GUI in response to an event. If the handler is called, and the message sender lives on another thread, then the handler cannot update the GUI due to Win32's GUI elements having thread affinity. More dynamic platforms such as .NET allow you to handle this by calling a special Invoke() method to move the method call (and the arguments) to the UI thread. I'm guessing they use the .NET parking window or the like for these sorts of things. A morbid curiosity was born: can we do this in C++, even if we limit the scope of the problem? Can we make it nicer than existing solutions? I know Qt does something similar with the moveToThread() function. By nicer, I'll mention that I'm specifically trying to avoid code of the following form: if(! this->IsUIThread()) { Invoke(MainWindowPresenter::OnTracksAdded, e); return; } being at the top of every UI method. This dance was common in WinForms when dealing with this issue. I think this sort of concern should be isolated from the domain-specific code and a wrapper object made to deal with it. My implementation consists of: DeferredFunction - functor that stores the target method in a FastDelegate, and deep copies the single event argument. This is the object that is sent across thread boundaries. UIEventHandler - responsible for dispatching a single event from the bus. When the Execute() method is called, it checks the thread ID. If it does not match the UI thread ID (set at construction time), a DeferredFunction is allocated on the heap with the instance, method, and event argument. A pointer to it is sent to the UI thread via PostThreadMessage(). Finally, a hook function for the thread's message pump is used to call the DeferredFunction and de-allocate it. Alternatively, I can use a message loop filter, since my UI framework (WTL) supports them. Ultimately, is this a good idea? The whole message hooking thing makes me leery. The intent is certainly noble, but are there are any pitfalls I should know about? Or is there an easier way to do this?

    Read the article

  • ActionScript Aligning Graphics Line Style Stroke?

    - by TheDarkIn1978
    is it possible to align the stroke of a graphic with actionscript? for example, the following code creates a black rounded rect with a grey stroke that is automatically centre aligned. var t:Sprite = new Sprite(); t.graphics.lineStyle(5, 0x555555); t.graphics.beginFill(0, 1); t.graphics.drawRoundRect(25, 25, 200, 75, 25, 25); t.graphics.endFill(); the lineStyle function doesn't seem to offer any built-in functionality for aligning the stroke. in Adobe Illustrator, you can align a stroke to be either centre (default), inside or outside.

    Read the article

  • How to replicate this screenshot in WebForms?

    - by AngryHacker
    I need to replicate the following in ASP.NET WebForms using a GridView. But I am not sure where to start. Basically I need 3 columns. The checkbox (which sometimes needs to be disabled), and 2 standard text columns. I've gone through the tutorial and I can see how to basically dump text data into a GridView, but not clear on how to implement checkboxes, particularly ones that needs to be disabled once in a while. And I have to replicate the style of the screenshot (e.g. border on the bottom). Having trouble with that as well. How do I swing something like that?

    Read the article

  • Factory vs instance constructors

    - by Neil N
    I can't think of any reasons why one is better than the other. Compare these two implementations: public class MyClass { public myClass(string fileName) { // some code... } } as opposed to: public class MyClass { private myClass(){} public static Create(string fileName) { // some code... } } There are some places in the .Net framework that use the static method to create instances. At first I was thinking, it registers it's instances to keep track of them, but regular constructors could do the same thing through the use of private static variables. What is the reasoning behind this style?

    Read the article

  • typeof === "undefined" vs. != null

    - by Thor Thurn
    I often see JavaScript code which checks for undefined parameters etc. this way: if (typeof input !== "undefined") { // do stuff } This seems kind of wasteful, since it involves both a type lookup and a string comparison, not to mention its verbosity. It's needed because 'undefined' could be renamed, though. My question is: How is that code any better than this approach: if (input != null) { // do stuff } As far as I know, you can't redefine null, so it's not going to break unexpectedly. And, because of the type-coercion of the != operator, this checks for both undefined and null... which is often exactly what you want (e.g. for optional function parameters). Yet this form does not seem widespread, and it even causes JSLint to yell at you for using the evil != operator. Why is this considered bad style?

    Read the article

  • overloading "<<" with a struct (no class) cout style

    - by monkeyking
    I have a struct that I'd like to output using either 'std::cout' or some other output stream. Is this possible without using classes? Thanks #include <iostream> #include <fstream> template <typename T> struct point{ T x; T y; }; template <typename T> std::ostream& dump(std::ostream &o,point<T> p) const{ o<<"x: " << p.x <<"\ty: " << p.y <<std::endl; } template<typename T> std::ostream& operator << (std::ostream &o,const point<T> &a){ return dump(o,a); } int main(){ point<double> p; p.x=0.1; p.y=0.3; dump(std::cout,p); std::cout << p ;//how? return 0; } I tried different syntax' but I cant seem to make it work.

    Read the article

  • Initializing AngularJS service factory style

    - by wisemanIV
    I have a service that retrieves data via REST. I want to store the resulting data in service level variable for use in multiple controllers. When I put all the REST logic directly into controllers everything works fine but when I attempt to move the retrieval / storing of data into a service the controller is not being updated when the data comes back. I've tried lots of different ways of maintain the binding between service and controller. Controller: myApp.controller('SiteConfigCtrl', ['$scope', '$rootScope', '$route', 'SiteConfigService', function ($scope, $rootScope, $route, SiteConfigService) { $scope.init = function() { console.log("SiteConfigCtrl init"); $scope.site = SiteConfigService.getConfig(); } } ]); Service: myApp.factory('SiteConfigService', ['$http', '$rootScope', '$timeout', 'RESTService', function ($http, $rootScope, $timeout, RESTService) { var siteConfig = {} ; RESTService.get("https://domain/incentiveconfig", function(data) { siteConfig = data; }); return { getConfig:function () { console.debug("SiteConfigService getConfig:"); console.debug(siteConfig); return siteConfig; } }; } ]);

    Read the article

  • C# style properties in python

    - by 3D-Grabber
    I am looking for a way to define properties in Python similar to C#, with nested get/set definitions. This is how far I got: #### definition #### def Prop(fcn): f = fcn() return property(f['get'], f['set']) #### test #### class Example(object): @Prop def myattr(): def get(self): return self._value def set(self, value): self._value = value return locals() # <- how to get rid of this? e = Example() e.myattr = 'somevalue' print e.myattr The problem with this is, that it still needs the definition to 'return locals()'. Is there a way to get rid of it? Maybe with a nested decorator?

    Read the article

  • Javascript style objects in Objective-C

    - by awolf
    Background: I use a ton of NSDictionary objects in my iPhone and iPad code. I'm sick of the verbose way of getting/setting keys to these state dictionaries. So a little bit of an experiment: I just created a class I call Remap. Remap will take any arbitrary set[VariableName]:(NSObject *) obj selector and forward that message to a function that will insert obj into an internal NSMutableDictionary under the key [vairableName]. Remap will also take any (zero argument) arbitrary [variableName] selector and return the NSObject mapped in the NSMutableDictionary under the key [variableName]. e.g. Remap * remap = [[Remap alloc] init]; NSNumber * testNumber = [NSNumber numberWithInt:46]; [remap setTestNumber:testNumber]; testNumber = [remap testNumber]; [remap setTestString:@"test string"]; NSString * testString = [remap testString]; NSMutableDictionary * testDict = [NSMutableDictionary dictionaryWithObject:testNumber forKey:@"testNumber"]; [remap setTestDict:testDict]; testDict = [remap testDict]; where none of the properties testNumber, testString, or testDict are actually defined in Remap. The crazy thing? It works... My only question is how can I disable the "may not respond to " warnings for JUST accesses to Remap? P.S. : I'll probably end up scrapping this and going with macros since message forwarding is quite inefficient... but aside from that does anyone see other problems with Remap? Here's Remap's .m for those who are curious: #import "Remap.h" @interface Remap () @property (nonatomic, retain) NSMutableDictionary * _data; @end @implementation Remap @synthesize _data; - (void) dealloc { relnil(_data); [super dealloc]; } - (id) init { self = [super init]; if (self != nil) { NSMutableDictionary * dict = [[NSMutableDictionary alloc] init]; [self set_data:dict]; relnil(dict); } return self; } - (void)forwardInvocation:(NSInvocation *)anInvocation { NSString * selectorName = [NSString stringWithUTF8String: sel_getName([anInvocation selector])]; NSRange range = [selectorName rangeOfString:@"set"]; NSInteger numArguments = [[anInvocation methodSignature] numberOfArguments]; if (range.location == 0 && numArguments == 4) { //setter [anInvocation setSelector:@selector(setData:withKey:)]; [anInvocation setArgument:&selectorName atIndex:3]; [anInvocation invokeWithTarget:self]; } else if (numArguments == 3) { [anInvocation setSelector:@selector(getDataWithKey:)]; [anInvocation setArgument:&selectorName atIndex:2]; [anInvocation invokeWithTarget:self]; } } - (NSMethodSignature *) methodSignatureForSelector:(SEL) aSelector { NSString * selectorName = [NSString stringWithUTF8String: sel_getName(aSelector)]; NSMethodSignature * sig = [super methodSignatureForSelector:aSelector]; if (sig == nil) { NSRange range = [selectorName rangeOfString:@"set"]; if (range.location == 0) { sig = [self methodSignatureForSelector:@selector(setData:withKey:)]; } else { sig = [self methodSignatureForSelector:@selector(getDataWithKey:)]; } } return sig; } - (NSObject *) getDataWithKey: (NSString *) key { NSObject * returnValue = [[self _data] objectForKey:key]; return returnValue; } - (void) setData: (NSObject *) data withKey:(NSString *)key { if (key && [key length] >= 5 && data) { NSRange range; range.length = 1; range.location = 3; NSString * firstChar = [key substringWithRange:range]; firstChar = [firstChar lowercaseString]; range.length = [key length] - 5; // the 4 we have processed plus the training : range.location = 4; NSString * adjustedKey = [NSString stringWithFormat:@"%@%@", firstChar, [key substringWithRange:range]]; [[self _data] setObject:data forKey:adjustedKey]; } else { //assert? } } @end

    Read the article

  • "Winamp style" spectrum analyzer

    - by cvb
    I have a program that plots the spectrum analysis (Amp/Freq) of a signal, which is preety much the DFT converted to polar. However, this is not exactly the sort of graph that, say, winamp (right at the top-left corner), or effectively any other audio software plots. I am not really sure what is this sort of graph called (if it has a distinct name at all), so I am not sure what to look for. I am preety positive about the frequency axis being base two exponential, the amplitude axis puzzles me though. Any pointers?

    Read the article

  • Tools for displaying text, powerpoint style, in linux

    - by Will Mc
    I have a problem where I need a way to display a repeating series of "images" on a computer monitor. Specifically, given a series of text files, I'd like a way to display the contents of said files on a screen in a way much like a powerpoint would. My current thoughts are to find some tool that will take in a text file of some format, and then output an image which contains the text from the file. Then I'd put it in a directory and have some Slideshow program continuously go between the images in that directory. It's a very hacky solution, obviously. So, does anyone know of tools that would do such a thing? Or is there a better way to do this? I've looked into the library libgd2, but it doesn't seem to support text-wrapping for images, which is something I'd need. Thanks!

    Read the article

  • Generic applet style system for publishing mathematics demonstrations?

    - by Alex
    Anyone who's tried to study mathematics using online resources will have come across these Java applets that demonstrate a particular mathematical idea. Examples: http://www.math.ucla.edu/~tao/java/Mobius.html http://www.mathcs.org/java/programs/FFT/index.html I love the idea of this interactive approach because I believe it is very helpful in conveying mathematical principles. I'd like to create a system for visually designing and publishing these 'mathlets' such that they can be created by teachers with little programming experience. So in order to create this app, i'll need a GUI and a 'math engine'. I'll probably be working with .NET because thats what I know best and i'd like to start experimenting with F#. Silverlight appeals to me as a presentation framework for this project (im not worried about interoperability right now). So my questions are: does anything like this exist already in full form? are there any GUI frameworks for displaying mathematical objects such as graphs & equations? are there decent open source libraries that exposes a mathematical framework (Math.NET looks good, just wondering if there is anything else out there) is there any existing work on taking mathematical models/demos built with maple/matlab/octave/mathematica etc and publishing them to the web?

    Read the article

  • T-SQL stored procedure to return google style "suggested" search results

    - by stephen776
    Ok, using SQL Server 2008. On my web page I have a textbox with jQuery-UI AutoComplete hooked up. Now I need a stored procedure to search across all columns of a single table(or multiple joined tables I suppose) for a search string coming from the textbox/autocomplete AJAX call, and return "suggested" search strings. I am using the AdventureWorks db for testing(Products table) So for example, the product table has columns for product name and product number(among others) and I want to return suggested search strings based on user input where they may enter a product name and/or a product number. I have it working across a single column which was simple. Any ideas?

    Read the article

  • Javascript code refactoring and assessment

    - by neitony
    I'm using javascript to toggle the display state of some objects based on the time of day. A sample of the code is given below. I was wondering if anyone could give a suggestion as to how I can refactor this code while at the same time improving the logic. switch(tcode) { case 'eur' : eur.setAttribute('style', 'display:block; opacity:0.5'); us.style.display = 'none'; asia.style.display = 'none'; us_inactive.style.display = 'block'; asia_inactive.style.display = 'block'; break; case 'us' : us.style.display = 'block'; eur.style.display = 'none'; asia.style.display = 'none'; eur_inactive.style.display = 'block'; asia_inactive.style.display = 'block'; break; case 'asia' : asia.setAttribute('style', 'display:block; opacity:0.5'); us.style.display = 'none'; eur.style.display = 'none'; eur_inactive.style.display = 'block'; us_inactive.style.display = 'block';

    Read the article

  • Why TR not taking style?

    - by metal-gear-solid
    CSS table tr {border-bottom:1px solid #008999} HTML <table width="100%" cellspacing="0" cellpadding="0"> <thead> <tr> <th scope="col">one</th> <th scope="col">two</th> <th scope="col">three</th> </tr> </thead> <tbody> <tr> <th scope="row">Hello</th> <td>&nbsp;</td> <td>&nbsp;</td> </tr> </tbody> </table>

    Read the article

  • CSS Print Style Sheets - Examples

    - by bsreekanth
    Trying to learn about how to effectively use print.css, so that graphical and navigational elements are not shown in print preview/print. Read some articles, and part of print css of html5 boilerplate. Two sites, which was quite impressive the way they change the look during print are http://css-tricks.com/ http://bottlerocketcreative.com/ But I cannot see the css related to print. Can you please point to the css they use to learn how to do similar transformation. thanks.

    Read the article

  • Declaring an integer Range with step != 1 in Ruby

    - by Dan Tao
    Hey guys, I'm completely new to Ruby, so be gentle. Say I want to iterate over the range of even numbers from 2 to 100; how would I do that? Obviously I could do: (2..100).each do |x| if x % 2 == 0 # my code end end But, obviously (again), that would be pretty stupid. I know I could do something like: i = 2 while i <= 100 # my code i += 2 end I believe I could also write my own custom class that provides its own each method (?). I am almost sure that would be overkill, though. I'm interested in two things: Is it possible to do this with some variation of the standard Range syntax (i.e., (x..y).each)? Either way, what would be the most idiomatic "Ruby way" of accomplishing this (using a Range or otherwise)? Like I said, I'm new to the language; so any guidance you can offer on how to do things in a more typical Ruby style would be much appreciated.

    Read the article

  • In Eclipse, how do I change the default modifiers in the class/type template?

    - by gustafc
    Eclipse's default template for new types (Window Preferences Code Style Code Templates New Java Files) looks like this: ${filecomment} ${package_declaration} ${typecomment} ${type_declaration} Creating a new class, it'll look something like this: package pkg; import blah.blah; public class FileName { // Class is accessible to everyone, and can be inherited } Now, I'm fervent in my belief that access should be as restricted as possible, and inheritance should be forbidden unless explicitly permitted, so I'd like to change the ${type_declaration} to declare all classes as final rather than public: package pkg; import blah.blah; final class FileName { // Class is only accessible in package, and can't be inherited } That seems easier said than done. The only thing I've found googling is a 2004 question on Eclipse's mailing list which was unanswered. So, the question in short: How can I change the default class/type modifiers in Eclipse? I'm using Eclipse Galileo (3.5) if that matters.

    Read the article

< Previous Page | 61 62 63 64 65 66 67 68 69 70 71 72  | Next Page >