Daily Archives

Articles indexed Friday March 19 2010

Page 11/124 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • BIRT number to word as computed column

    - by Erwin
    Hi fellow programmer I want to ask how to add a computed column in BIRT that compute a number to its word representation? (ex. 100 to "one hundred") So in my data set I can have a column that holds the string I'm new at BIRT hopefully there's a pointer or two for me

    Read the article

  • Hide button on first of two UIViews, but have it visible on second...

    - by Scott
    So I have a UIViewController (main application controller is a TabBarController). On this there is a UINavigationBar, and a UIBarButtonItem. I'm PRETTY sure I hooked up everything correctly in the Interface Builder and that the outlet in the code is connected to the button in the .xib. It should be because the method works correctly. Now I have another button on this view that brings up a second view, a UIWebView. I want this UIBarButtonItem, labeled "Back", to make the UIWebView dissapear, and bring back the first UIView, which it DOES DO correctly. However, when you are on the first UIView, there is no need to see the UIBarButtonItem, so how can I hide it but then bring it up for the UIWebView. By the way, both views use the same UINavigationBar, the UIWebView is brought up inside the tab bar and the nav bar. Here is my code: #import "WebViewController.h" @implementation WebViewController @synthesize webButton; @synthesize item; @synthesize infoView; UIWebView *webView; + (UIColor*)myColor1 { return [UIColor colorWithRed:0.0f/255.0f green:76.0f/255.0f blue:29.0f/255.0f alpha:1.0f]; } // Creates Nav Bar with default Green at top of screen with given String as title + (UINavigationBar*)myNavBar1: (NSString*)input { UIView *test = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; UINavigationBar *navBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0.0, 0.0, test.bounds.size.width, 45)]; navBar.tintColor = [WebViewController myColor1]; UINavigationItem *navItem; navItem = [UINavigationItem alloc]; navItem.title = input; [navBar pushNavigationItem:navItem animated:false]; return navBar; } - (IBAction) pushWebButton { self.navigationItem.rightBarButtonItem = item; CGRect webFrame = CGRectMake(0.0, 45.0, 320.0, 365.0); webView = [[UIWebView alloc] initWithFrame:webFrame]; [webView setBackgroundColor:[UIColor whiteColor]]; NSString *urlAddress = @"http://www.independencenavigator.com"; NSURL *url = [NSURL URLWithString:urlAddress]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; webView.scalesPageToFit = YES; [webView loadRequest:requestObj]; [self.view addSubview:webView]; [webView release]; } - (void) pushBackButton { [webView removeFromSuperview]; } // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { self.navigationItem.rightBarButtonItem = nil; [super viewDidLoad]; } @end Anyone know?

    Read the article

  • CSS sidebar multi-level menu

    - by NachoF
    Can you guys point me in the right direction?? I want to add sidebar multilevel functionality to this template. So when I hover over one of the items in the main menu some subitems slide to the right... preferably using only css and mantaining the style/color/look, etc... I suck at css, please help.

    Read the article

  • what is the oldest glib version that a qt application can run with

    - by yan bellavance
    I am trying to build a standalone qt application (built on ubuntu and deployed on Red Hat 5.3, both 64 bits) after building a qt application that is statically linked to the qt library I tried to run the program on red hat and got an error saying libc.so.6 was not found and that GLIBC_2.9 or GLIBC_2.10 is not installed and needed. I tried doing a yum install glibc but then I get a message saying that glibc is up to date (its version is 2.0) I guees I am going to restart the build process but this time from a red hat installation. What do you sugges I should do in this case. My goal is to build a standalone qt application that only needs to run on red hat 5 (im pretty sure there is also going to be an issue with fontconfig.so but I can simply provide this library directly in the same directory as the app)

    Read the article

  • Django anonymous user in model

    - by jack
    I have a model defined as below: class Example(models.Model): user = models.ForeignKey(User, null=True) other = models.CharField(max_length=100) The problem is Django refuses to assign django.contrib.auth.models.AnonymousUser directly to Example.user as null field so everytime I have to check if request.user.is_authenticated() ans assign Example.user = None manually. Is there a default value for AnonymousUser to use in a model field?

    Read the article

  • How do I use test Perl modules from test Perl scripts?

    - by DVK
    If my Perl code has a production code location and "test" code location (e.g. production Perl code us in /usr/code/scripts, test Perl code is in /usr/code/test/scripts; production Perl libraries are in /usr/code/lib/perl and test versions of those libraries are in /usr/code/test/lib/perl, is there an easy way for me to achieve such a setup? The exact requirements are: The code must be THE SAME in production and test location. To clarify, to promote any code (library or script) from test to production, the ONLY thing which needs to happen is literally issuing cp command from test to prod location - both the file name AND file contents must remain identical. Test versions of scripts must call other test scripts and test libraries (if exist) or production libraries (if test libraries do not exist) The code paths must be the same between test and production with the exception of base directory (/usr/code/ vs /usr/code/test/) I will present how we solved the problem as an answer to this question, but I'd like to know if there's a better way.

    Read the article

  • Why cant partial methods be public if the implementation is in the same assembly?

    - by Simon
    According to this http://msdn.microsoft.com/en-us/library/wa80x488.aspx "Partial methods are implicitly private" So you can have this // Definition in file1.cs partial void Method1(); // Implementation in file2.cs partial void Method1() { // method body } But you cant have this // Definition in file1.cs public partial void Method1(); // Implementation in file2.cs public partial void Method1() { // method body } But why is this? Is there some reason the compiler cant handle public partial methods?

    Read the article

  • C# Hotkey, Help?

    - by Di4g0n4leye
    namespace WebBrowser { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } int GetPixel(int x, int y) { Bitmap bmp = new Bitmap(1, 1, PixelFormat.Format32bppPArgb); Graphics grp = Graphics.FromImage(bmp); grp.CopyFromScreen(new Point(x,y), Point.Empty, new Size(1,1)); grp.Save(); return bmp.GetPixel(0, 0).ToArgb(); } void Button1Click(object sender, EventArgs e) { int x = Cursor.Position.X; int y = Cursor.Position.Y; int pixel = GetPixel(x,y); textBox1.Text = pixel.ToString(); } void MainFormLoad(object sender, EventArgs e) { webBrowser1.Navigate("http://google.com"); } } } } How i want to add a hotkey that call Button1 on Press? How can that be done?

    Read the article

  • Pause and Resume AsyncTasks? (Android)

    - by Matt Swanson
    I have an AsyncTask that acts as a countdown timer for my game. When it completes the countdown it displays the out of time end screen and it also updates the timer displayed on the screen. Everything works fine, except I need to be able to pause and resume this when the pause button in the game is pressed. If I cancel it and try to re-execute it, it crashes with an IllegalStateException. If I cancel it and instantiate a new AsyncTask in its place the old one begins to run again and the new one runs at the same time. Is there a way to cancel/pause the timer and restart it using AsyncTasks or is there a different way I should be going about doing this?

    Read the article

  • Ruby IpV6 Multicast Sending and Receive

    - by Francesco Vollero
    Hi, as object i'm tring to create a client and server scripts in order to send and receive multicast packages over IPv6. In IPv4 everything work as well, but i cannot figure out how to change it in IPv6. I start as basis from Multicasting In Ruby but seems ff02::1 isnt good for MULTICAST_ADDR. Thanks in advance.

    Read the article

  • Create System.Data.Linq.Table in Code for Testing

    - by S. DePouw
    I have an adapter class for Linq-to-Sql: public interface IAdapter : IDisposable { Table<Data.User> Activities { get; } } Data.User is an object defined by Linq-to-Sql pointing to the User table in persistence. The implementation for this is as follows: public class Adapter : IAdapter { private readonly SecretDataContext _context = new SecretDataContext(); public void Dispose() { _context.Dispose(); } public Table<Data.User> Users { get { return _context.Users; } } } This makes mocking the persistence layer easy in unit testing, as I can just return whatever collection of data I want for Users (Rhino.Mocks): Expect.Call(_adapter.Users).Return(users); The problem is that I cannot create the object 'users' since the constructors are not accessible and the class Table is sealed. One option I tried is to just make IAdapter return IEnumerable or IQueryable, but the problem there is that I then do not have access to the methods ITable provides (e.g. InsertOnSubmit()). Is there a way I can create the fake Table in the unit test scenario so that I may be a happy TDD developer?

    Read the article

  • function not working in production mode

    - by maps
    I am using the rvideo gem to transcode files to a .flv format. class Video < ActiveRecord::Base include AASM aasm_column :status aasm_initial_state :initial aasm_state :initial aasm_state :converting, :exit => :transcode aasm_state :transfering , :exit => :send_s3 aasm_state :completed aasm_state :failed aasm_event :convert do transitions :from => [:initial], :to => :converting end aasm_event :transfer do transitions :from => [:converting], :to => :transfering end aasm_event :complete do transitions :from => [:transfering], :to => :completed end aasm_event :error do transitions :from => [:initial, :converting, :transfering, :completed] end has_attached_file :asset, :path => "uploads/:attachment/:id.:basename.:extension" def flash_path return self.asset.path + '.flv' end def flash_name return File::basename(self.asset.path)# + '.flv' end def flash_url return "#{AWS_HOST}/#{AWS_BUCKET}/#{self.flash_name}" end # transcode file def transcode begin RVideo::Transcoder.logger = logger file = RVideo::Inspector.new(:file => self.asset.path) command = "ffmpeg -i $input_file$ -y -s $resolution$ -ar 44100 -b 64k -r 15 -sameq $output_file$" options = { :input_file => "#{RAILS_ROOT}/#{self.asset.path}", :output_file => "#{RAILS_ROOT}/#{self.flash_path}", :resolution => "320x200" } transcoder = RVideo::Transcoder.new transcoder.execute(command, options) rescue RVideo::TranscoderError => e logger.error "Encountered error transcoding #{self.asset.path}" logger.error e.message end end The input file is added to the asset directory, but I never get an outputted file. On the view page aasm hangs on "converting".

    Read the article

  • Apache Subversion and Sudo - Why can't I resolve this hostname?

    - by Hollowsteps
    Okay, I made a mistake and I'll be the first to admit I'm new at this setup. I built a bare bones kit, installed Ubuntu on it, and attempted to set up a source control server for a project some friend and I were going to work on. Unfortunately, I screwed up. I followed a dodgy tutorial from 2005 and when it didn't work, started mixing and matching trying to get to the source of my problem. So now I sit before you, a broken and miserable man. Desperate to escape this annoying echo of 'Unable to resolve host computer.repositoryname.com', I uninstalled apache and subversion. That did not fix it. Next I tried to edit my /etc/hosts, going so far as to remove the reference to '127.0.1.1 computername'. Still I'm plagued. I know I messed up, is there any way to track down this wayward bug?

    Read the article

  • PyQt and unittest - how to handle signals and slots

    - by Einar
    Hello, some small application I'm developing uses a module I have written to check certain web services via a REST API. I've been trying to add unit tests to it so I don't break stuff, and I stumbled upon a problem. I use a lot of signal-slot connections to perform operations asynchronously. For example a typical test would be (pseudo-Python), with postDataDownloaded as a signal: def testConnection(self): "Test connection and posts retrieved" def length_test(): self.assertEqual(len(self.client.post_data), 5) self.client.postDataReady.connect(length_test) self.client.get_post_list(limit=5) Now, unittest will report this test to be "ok" when running, regardless of the result (as another slot is being called), even if asserts fail (I will get an unhandled AssertionError). Example when deliberatiely making the test fail: Test connection and posts retrieved ... ok [... more tests...] OK Traceback (most recent call last): [...] AssertionError: 4 != 5 The slot inside the test is merely an experiment: I get the same results if it's outside (instance method). I also have to add that the various methods I'm calling all make HTTP requests, which means they take a bit of time (I need to mock the request - in the mean time I'm using SimpleHTTPServer to fake the connections and give them proper data). Is there a way around this problem?

    Read the article

  • Are primitive types garbage collected in Android?

    - by snctln
    I know this may be a dumb question, but my background is more in c++ and managing my own memory. I am currently cutting down every single allocation that I can from one of my games to try and reduce the frequency of garbage collection and perceived "lag", so for every variable that I create that is an Object (String and Rect for example) I am making sure that I create it before hand in my constructor and not create temporary variables in simple 10 line functions... (I hope that makes sense) Anyways I was working though it some more tonight and I realized that I may be completely wrong about my assumption on garbage collection and primitive types (int, boolean, float) are these primitive type variables that I create in a 10 line function that gets called 20 times a second adding to my problem of garbage collection? So a year ago every few seconds I would see a message in logcat like GC freed 4010 objects / 484064 bytes in 101ms Now I see that message every 15-90 seconds or so... So to rephrase my question: Are primitive types (int, float, boolean, etc) included when seeing this message?

    Read the article

  • Efficient code to avoid circular references in c# object model

    - by Kumar
    I have an excel like grid where values can be typed referencing other rows To check for circular references when a new value is entered, i traverse the tree and create a list of values referenced thus far, if the current value is found in this list, i return an error thus avoiding a circular reference. This is infrequent enough where extreme performance is not an issue but... Question - is there a better way ? I'm told it's not the most optimal but no answer was provided so on to the experts @ SO :)

    Read the article

  • Local Declaration "x" hides instance variable xcode warning

    - by Michael Robinson
    I've been have trouble understand this problem. If I change the variable name fifthViewController the error goes away but the view controller doesn't load. Lost. Once again it's probably something simple. Thanks in advance. Here is the code: { FifthViewController *fifthViewController = [[FifthViewController alloc] initWithNibName:@"FifthView" bundle:nil]; fifthViewController.transactionID = transactionID; [self.navigationController pushViewController:fifthViewController animated:NO]; [fifthViewController release]; }

    Read the article

  • Multiple constructors in C

    - by meepz
    Hello, I am making a string class in C as a homework and I was wondering how I can make multiple constructors with the same name given the parameter. The commented out area is what I tried to do with results from a few searches but that gives me errors. Pretty much I have some cases where I want to create my new string without any parameter then in other cases create a string with a pointer to character. Here is mystring.h #include <stdio.h> #include <stdlib.h> typedef struct mystring { char * c; int length; int (*sLength)(void * s); char (*charAt)(void * s, int i); int (*compareTo)(void * s1, void * s2); struct mystring * (*concat)(void * s1, void * s2); struct mystring * (*subString)(void * s, int begin, int end); void (*printS)(void * s); } string_t; typedef string_t * String; String newString(char * c); String newString2(); int slength(void * s); char charat(void * S, int i); int compareto(void * s1, void * s2); String concat(void * s1, void * s2); String substring(void * S, int begin, int end); void printstring(void * s); And here is mystring.c #include "mystring.h" String newString(){ } String newString(char * input){ //String newString::newString(char * input) { String s; s = (string_t *) malloc(sizeof(string_t)); s->c = (char *) malloc(sizeof(char) * 20); int i = 0; if (input == NULL){ s->c[0] = '\0'; return s; } while (input[i] != '\0') { s->c[i] = input[i]; i++; } //functions s->sLength = slength; s->charAt = charat; s->compareTo = compareto; s->concat = concat; s->subString = substring; s->printS = printstring; return s; }

    Read the article

  • Looking for advice on importing large dataset in sqlite and Cocoa/Objective-C

    - by jluckyiv
    I have a fairly large hierarchical dataset I'm importing. The total size of the database after import is about 270MB in sqlite. My current method works, but I know I'm hogging memory as I do it. For instance, if I run with Zombies, my system freezes up (although it will execute just fine if I don't use that Instrument). I was hoping for some algorithm advice. I have three hierarchical tables comprising about 400,000 records. The highest level has about 30 records, the next has about 20,000, the last has the balance. Right now, I'm using nested for loops to import. I know I'm creating an unreasonably large object graph, but I'm also looking to serialize to JSON or XML because I want to break up the records into downloadable chunks for the end user to import a la carte. I have the code written to do the serialization, but I'm wondering if I can serialize the object graph if I only have pieces in memory. Here's pseudocode showing the basic process for sqlite import. I left out the unnecessary detail. [database open]; [database beginTransaction]; NSArray *firstLevels = [[FirstLevel fetchFromURL:url retain]; for (FirstLevel *firstLevel in firstLevels) { [firstLevel save]; int id1 = [firstLevel primaryKey]; NSArray *secondLevels = [[SecondLevel fetchFromURL:url] retain]; for (SecondLevel *secondLevel in secondLevels) { [secondLevel saveWithForeignKey:id1]; int id2 = [secondLevel primaryKey]; NSArray *thirdLevels = [[ThirdLevel fetchFromURL:url] retain]; for (ThirdLevel *thirdLevel in thirdLevels) { [thirdLevel saveWithForeignKey:id2]; } [database commit]; [database beginTransaction]; [thirdLevels release]; } [secondLevels release]; } [database commit]; [database release]; [firstLevels release];

    Read the article

  • Explicit disable MySQL query cache in some parts of program

    - by jack
    In a Django project, some cronjob programs are mainly used for administrative or analysis purposes, e.g. generating site usage stats, rotating user activities log, etc. We probably do not hope MySQL to cache queries in those programs to save memory usage and improve query cache efficiency. Is it possible to turn off MySQL query cache explicitly in those programs while keep it enabled for other parts including all views.py?

    Read the article

  • android getAppWidgetIds failed, what wrong?

    - by bright
    I want to use following code to get a widget id, but getAppWidgetIds always return an empty array, the num is alway 0, what wrong? Thanks! public class test extends Activity implements OnTouchListener { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ..... AppWidgetManager mAppWidgetManager; AppWidgetHost mAppWidgetHost; mAppWidgetManager = AppWidgetManager.getInstance(this.getApplicationContext()); ComponentName THIS_APPWIDGET =new ComponentName("com.android.music", "com.android.music.MediaAppWidgetProvider"); int[] appWidgetId=mAppWidgetManager.getAppWidgetIds(THIS_APPWIDGET); int num=appWidgetId.length;

    Read the article

  • Can I enable/diable groups of breakpoints in C++ Builder?

    - by mawg
    The title says it all. One specific instance, I want to set a BP on every switch(msg) handled in WndProc() - but not until my app has initialized and is 'stable'. Of course, it receives a lot of windows messages when it starts up. I can't see a way to toggle a group of breakpoints, or to save them for later, use other BPs then restore the first set.

    Read the article

  • How to convert a HTMLElement to a string

    - by Turtle
    Hi, I am going to create an xml element in javascript to exchange data with server side. I found I can do it with document.createElement.But I do not know how to convert it to string. Is there any API in browser to make it easier? Or is there any js lib incudling this API? Thanks in advance.

    Read the article

  • Which Debian to choose?

    - by Boda Cydo
    I just bought my first home server, and I want to install Debian Linux! Can anyone recommend me which one to use? I have read that there are 3 types, one for testing, one stable and then another one. But I don't know much more about it. Can you please advise me? Thanks, Boda Cydo.

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >