Daily Archives

Articles indexed Saturday April 10 2010

Page 22/89 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • CheckBox checked state in a ListView

    - by anselmophil
    I'm using a ListView with CheckBox, but as most of you know, when you roll down the scroll, a checked CheckBox gets unchecked as you roll up back the scroll. So i've been reading and i found out that you can pass (using getView) the id of the CB to the position parameter of getView to save the CheckBox state! But i can't use getView with SimpleCursorAdapter, can i? Because i'm using bindView! Thanks

    Read the article

  • php array into mysql

    - by mckenzie
    Hello, $sql_where = ''; $exclude = '30,35,36,122,123,124,125'; if($exclude != '') { $exclude_forums = explode(',', $exclude); foreach ($exclude_forums as $id) { if ($id > 0) { $sql_where = ' AND forum_id <> ' . trim($id); } } } $sql = 'SELECT topic_title, forum_id, topic_id, topic_type, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_time FROM ' . TOPICS_TABLE . ' WHERE topic_status <> 2 AND topic_approved = 1 ' . $sql_where . ' ORDER BY topic_time DESC'; The above code i use to exclude the id of forum to be displayed on sql queries. Why doesn't it work and still display it? Any solution

    Read the article

  • converting a Tree to newick format. java

    - by Esmond
    I'm having problems converting a binary rooted tree to newick format. The full explanation for such a format can be found: http://code.google.com/p/mrsrf/wiki/NewickTree An example of a newick format would be as follows: for a tree T such as http://www.cs.mcgill.ca/~cs251/OldCourses/1997/topic8/images/completetreetwo.gif the newick representation would be: (((8,9),(10,11)),((12,13),(14,15))) the internal node will become the commas while the leaves will be retained. such trees have internal nodes which will always have 2 children. I have a problem using recursion to come out with this newick format. The output contains far too many nodes and braces. Any comments to resolve this problem is appreciated or even an iterative algorithm would be welcomed import java.util.Stack; public class Tree { .... public String inOrderNewick(Node root, String output) throws ItemNotFoundException { if (root.hasChild()) { output += "("; output += inOrderNewick(root.child1, output); output += ","; output += inOrderNewick(root.child2, output); output += ")"; return output; } else { output += root.getSeq(); return output; } } }

    Read the article

  • Practice of checking 'trueness' or 'equality' in conditional statements - does it really make sense?

    - by Senthil
    I remember many years back, when I was in school, one of my computer science teachers taught us that it was better to check for 'trueness' or 'equality' of a condition and not the negative stuff like 'inequality'. Let me elaborate - If a piece of conditional code can be written by checking whether an expression is true or false, we should check the 'trueness'. Example: Finding out whether a number is odd - it can be done in two ways: if ( num % 2 != 0 ) { // Number is odd } or if ( num % 2 == 1 ) { // Number is odd } When I was beginning to code, I knew that num % 2 == 0 implies the number is even, so I just put a ! there to check if it is odd. But he was like 'Don't check NOT conditions. Have the practice of checking the 'trueness' or 'equality' of conditions whenever possible.' And he recommended that I use the second piece of code. I am not for or against either but I just wanted to know - what difference does it make? Please don't reply 'Technically the output will be the same' - we ALL know that. Is it a general programming practice or is it his own programming practice that he is preaching to others?

    Read the article

  • Android Lightweight HTML Template Engine

    - by Anthoni Gardner
    Hello, I am after a very lightweight template engine that supports / can be embedded inside Android programs. I've looked at the MiniTemplator (I think that is how you spell it) and that looks great but it loads in only from file and I need to load templates from string and I am not fully confident in changing that code lol. Can anyone recommend a very lightweight (preferably no jars, single source files etc) that I can use ? I do not need it to parse XML or anything like, just normal HTML files with keywords embedded into them betwee %% tags etc. Regards Anthoni

    Read the article

  • Continuous integration with ClearCase and long-updating snapshot views

    - by Yulia Rogovaya
    Hi, I need to set up a continuous integration system. We use ClearCase version control and only snapshot views due to platform restrictions. I have tried setting up Hudson and Luntbuild. They both show the same behaviour. In a view, we have lots of libraries that are used for build but are strictly read-only. The CI system executes cleartool lshistory and finds a change in the VCS. After that, it executes cleartool setcs, which causes update of the view. This can take about half an hour, which is very undesirable for CI. Why wouldn't it update only the changed elements, which were previously obtained by cleartool lshistory? Is there a CI system that can do this?

    Read the article

  • UIImage - should be loaded with [UIImage imageNamed:@""] or not ?

    - by sagar
    Hello ! every one. I am having number of images with in my application. ( images more than 50 - approximately & it can extend according to client's need ) Each image are very large round about - 1024 x 768 & 150 dpi Now, I have to add all this images in a scroll view & display it. Ok, My question is as follows. According to me there are two options of loading large images imageNamed:@"" load asynchronously when viewDidLoad Called. Which is more preferable ? imgModel.image=[UIImage imageNamed:[dMain valueForKey:@"imgVal"]]; or like this. NSURL *ur=[[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:lblModelName.text ofType:@"png"] isDirectory:NO]; NSURLRequest *req=[NSURLRequest requestWithURL:ur cachePolicy:NSURLCacheStorageNotAllowed timeoutInterval:40]; [ur release]; NSURLConnection *con=[[NSURLConnection alloc] initWithRequest:req delegate:self]; if(con){ myWebData=[[NSMutableData data] retain]; } else { } -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { [myWebData setLength: 0]; } -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [myWebData appendData:data]; } -(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { [connection release]; } -(void)connectionDidFinishLoading:(NSURLConnection *)connection { NSLog(@"ImageView Ref From - %@",imgV); // my image view & set image imgV.image=[UIImage imageWithData:myWebData]; [connection release]; connection=nil; }

    Read the article

  • How to make a cell of TAdvStringGrid editable?

    - by ammu
    I am trying to implement a filter using the component TAdvStringGrid. My requirement is that I want the first row of this component to be editable when double clicked, so that the user can filter data. Borland C++ Builder is used to help achieve this task. I found this event OnCanEditCell. TCanEditCellEvent = procedure (Sender:TObject;Arow,Acol:longint;var canedit:boolean) of object; Within this function I've set canedit = true. This doesn't seem to work. Probably I need to do something more. I am new to Windows and GUI development. So any help would be great. Do I need to call this function from the OnDblClickCell event? How can I get it working? Thanks in advance

    Read the article

  • Spark-View-Engine with ASP.NET MVC2

    - by Ben
    How do you modify a ASP.NET MVC 2.0 project to work with the Spark View Engine? I tried like described here: http://dotnetslackers.com/articles/aspnet/installing-the-spark-view-engine-into-asp-net-mvc-2-preview-2.aspx But somehow it still tries to route to .aspx files. Here the code of my global.asax: public class MvcApplication : System.Web.HttpApplication { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); } protected void Application_Start() { SparkViewFactory svf = new SparkViewFactory(); PrecompileViews(svf); AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); } public static void PrecompileViews(SparkViewFactory svf) { var controllerFactory = svf; var viewFactory = new SparkViewFactory(controllerFactory.Settings); var batch = new SparkBatchDescriptor(); batch .For<HomeController>() .For<AccountController>(); viewFactory.Precompile(batch); } } }

    Read the article

  • Authlogic and password and password confirmation attributes - inaccessible?

    - by adam
    Im trying to test my successfully creates a new user after login (using authlogic). Ive added a couple of new fields to the user so just want to make sure that the user is saved properly. The problem is despite creating a valid user factory, whenever i try to grab its attributes to post to the create method, password and password confirmation are being ommitted. I presuem this is a security method that authlogic performs in the background. This results in validations failing and the test failing. Im wondering how do i get round this problem? I could just type the attributes out by hand but that doesnt seem very dry. context "on POST to :create" do context "on posting a valid user" do setup do @user = Factory.build(:user) post :create, :user => @user.attributes end should "be valid" do assert @user.valid? end should_redirect_to("users sentences index page") { sentences_path() } should "add user to the db" do assert User.find_by_username(@user.username) end end ##User factory Factory.define :user do |f| f.username {Factory.next(:username) } f.email { Factory.next(:email)} f.password_confirmation "password" f.password "password" f.native_language {|nl| nl.association(:language)} f.second_language {|nl| nl.association(:language)} end

    Read the article

  • calculating the potential effect of inaccurate triangle vertex positions on the triangle edge lenght

    - by stingrey
    i'm not sure how to solve the following problem: i have a triangle with each of the three known vertex positions A,B,C being inaccurate, meaning they can each deviate up to certain known radii rA, rB, rC into arbitrary directions. given such a triangle, i want to calculate how much the difference of two specific edge lengths (for instance the difference between lengths of edge a and edge b) of the triangle may change in the worst case. is there any elegant mathematical solution to this problem? the naive way i thought of is calculating all 360^3 angle combinations and measuring the edge differences for each case, which is a rather high overhead.

    Read the article

  • How to change the border color of a Grouped UITableView

    - by ctpenrose
    This concerns iPhoneOS-sdk-3.2 I am having difficulty changing the border color of a grouped UITableView. I can change the cell background color, separator color, text color, quite easily now, and the rounded corners clip correctly, even when highlighted with whatever colors I have chosen. However the surrounding border remains infuriatingly gray despite many different attempts. I have read all of the related posts I can find via Google, let alone stackoverflow. I have tried both a programmatic and xib-based solution and both provide the same results. I will share the programmatic version below: I have a UIViewController subclass rather than a UITableViewController subclass to act as a UITableView delegate -- I chose this route as I am coding on the iPad and UITableViewController reportedly takes over the whole screen. loadView method of my UIViewController subclass: - (void) loadView { self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; [self.view release]; self.view.backgroundColor = [UIColor blackColor]; // add and configure UITableView CGRect tableViewRect = CGRectMake(0., 0., 256., 768.); myTableView = [[UITableView alloc] initWithFrame:tableViewRect style:UITableViewStyleGrouped]; // set the tableview delegate to this object and the datasource to the datasource which has already been set myTableView.delegate = self; myTableView.dataSource = self; myTableView.sectionIndexMinimumDisplayRowCount=1; myTableView.backgroundColor = [UIColor clearColor]; myTableView.separatorColor = [UIColor whiteColor]; myTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; myTableView.opaque = NO; // add the table view to our background view [self.view addSubview:myTableView]; [myTableView release]; }

    Read the article

  • Callbacks in Thrift Asynchronous Functions?

    - by Roberto Aloi
    Hi all, In Thrift it is possible to use the oneway modifier to specify a call as asynchronous. Apparently, it's not possible to define a callback, though, to be executed when the execution of the function is completed. It seems that the only possibility I have is to give my Thrift client (PHP) some "server" capabilities, so that, when the heavy computation is completed on the server side, I can send a notification to it. This means that I should have a new .thrift file, with new definitions, new services and all the rest and that I should generate php-server side code with Thrift. Even if this is feasible, it looks like an overkill to me and I'm wondering if there's a more clever way to implement the callback. Looking forward for some feedback from you, guys.

    Read the article

  • I am getting wrong Client Ip address.

    - by Vibin Jith
    I am running an ASP.NET application. The web server is located in the same system. In the code behind I just want to get the IP address of the requesting client. I am using this code Request.UserHostAddress But I am getting a wrong address: 127.0.0.1 My system IP address is 198.162.0.27.

    Read the article

  • C++ Returning a Reference

    - by Devil Jin
    Consider the following code where I am returning double& and a string&. The thing works fine in the case of a double but not in the case of a string. Why is this difference in the behavior? In both the cases compiler does not even throws the Warning: returning address of local variable or temporary as I am returning a reference. #include <iostream> #include <string> using namespace std; double &getDouble(){ double h = 46.5; double &hours = h; return hours; } string &getString(){ string str = "Devil Jin"; string &refStr = str; return refStr; } int main(){ double d = getDouble(); cout << "Double = " << d << endl; string str = getString(); cout << "String = " << str.c_str() << endl; return 0; } Output: $ ./a.exe Double = 46.5 String =

    Read the article

  • Mixing RewriteRule and ProxyPass in Apache

    - by Taylor L
    I was working on debugging an issue today related to mixing mod_proxy and mod_rewrite together and I ended up having to use balancer://mycluster in the RewriteRule in order to stop receiving a 404 error from Apache. I have two questions: 1) Is there any other way to get the rewritten URL to go through the balancer without adding balancer://mycluster into the RewriteRule? 2) Is there a way to define all the parameters I defined in ProxyPass (stickysession=JSESSIONID|jsessionid scolonpathdelim=On lbmethod=bytraffic nofailover=Off) in either the <Proxy> or RewriteRule? I'm concerned the requests that match the new RewriteRule won't load balance in the same fashion as those that go through ProxyPass (like /app1/something.do)? Below are the relevant sections of the httpd.conf. I am using Apache 2.2. <Proxy balancer://mycluster> Order deny,allow Allow from all BalancerMember ajp://my.domain.com:8009 route=node1 BalancerMember ajp://my.domain.com:8009 route=node2 </Proxy> ProxyPass /app1 balancer://mycluster/app1 stickysession=JSESSIONID|jsessionid scolonpathdelim=On lbmethod=bytraffic nofailover=Off ProxyPassReverse /app1 ajp://my.domain.com:8009/app1 ... RewriteRule ^/static/cms/image/(.*)\.(.*) balancer://mycluster/app1/$1.$2 [P,L]

    Read the article

  • Is Git ready to be recommended to my boss?

    - by Mike Weller
    I want to recomment Git to my boss as a new source control system, since we're stuck in the 90s with VSS (ouch), but are the tools and 3rd party support good enough yet? Specifically I'm talking about GUI front-ends similar to TortoiseSVN, decent visual diff/merge support, as well as stuff like email commit notifications and general support from 3rd parties like IDEs and build systems. Even though this will be used by programmers, we really need this kind of stuff in our team. I don't want to leave everyone stuck with a new tool, and even a new source control paradigm (distributed), with nothing but a command-line app and some online tutorials. This would be a step backwards. So what do you think... is Git ready? What decent tools exist for Git and what third party development apps support it? EDIT: My original question was pretty vague so I'm updating it to specifically ask for a list of available tools and 3rd party support for Git. Maybe we can get a community wiki post with a list of stuff. I also do not consider 'use subversion' to be an adequate answer. There are other reasons to use a distributed source control system other than offline editing - private and cheap branches being one of them.

    Read the article

  • Error #1063: Argument count mismatch on com.flashden::MenuItem(). Expected 1, got 0.

    - by Suzanne
    I'm creating a new site using the below script embedded in my swf. But I keep getting this error on all the pages: Error #1063: Argument count mismatch on com.flashden::MenuItem(). Expected 1, got 0. package com.flashden { import flash.display.MovieClip; import flash.text.*; import flash.events.MouseEvent; import flash.events.*; import flash.net.URLRequest; import flash.display.Loader; public class MenuItem extends MovieClip { private var scope; public var closedX; :Number public static const OPEN_MENU = "openMenu"; public function MenuItem(scope) { // set scope to talk back to -------------------------------// this.scope = scope; // disable all items not to be clickable -------------------// txt_label.mouseEnabled = false; menuItemShine.mouseEnabled = false; menuItemArrow.mouseEnabled = false; // make background clip the item to be clicked (button) ----// menuItemBG.buttonMode = true; // add click event listener to the header background -------// menuItemBG.addEventListener(MouseEvent.CLICK, clickHandler); } private function clickHandler (e:MouseEvent) { scope.openMenuItem(this); } public function loadContent (contentURL:String) { var loader:Loader = new Loader(); configureListeners(loader.contentLoaderInfo); var request:URLRequest = new URLRequest(contentURL); loader.load(request); // place x position of content at the bottom of the header so the top is not cut off ----// loader.x = 30; // we add the content at level 1, because the background clip is at level 0 ----// addChildAt(loader, 1); } private function configureListeners(dispatcher:IEventDispatcher):void { dispatcher.addEventListener(Event.COMPLETE, completeHandler); dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler); dispatcher.addEventListener(Event.INIT, initHandler); dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); dispatcher.addEventListener(Event.OPEN, openHandler); dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler); dispatcher.addEventListener(Event.UNLOAD, unLoadHandler); } private function completeHandler(event:Event):void { //trace("completeHandler: " + event); // remove loader animation ----------------// removeChild(getChildByName("mc_preloader")); } private function httpStatusHandler(event:HTTPStatusEvent):void { // trace("httpStatusHandler: " + event); } private function initHandler(event:Event):void { //trace("initHandler: " + event); } private function ioErrorHandler(event:IOErrorEvent):void { //trace("ioErrorHandler: " + event); } private function openHandler(event:Event):void { //trace("openHandler: " + event); } private function progressHandler(event:ProgressEvent):void { //trace("progressHandler: bytesLoaded=" + event.bytesLoaded + " bytesTotal=" + event.bytesTotal); } private function unLoadHandler(event:Event):void { //trace("unLoadHandler: " + event); } } }

    Read the article

  • How to get status code of a POST with Asp.Net HttpWebRequest

    - by Hasan Gürsoy
    I'm trying to ping Google when my web site's sitemap is updated but I need to know which status code does Google or any other service returns. My code is below: HttpWebRequest rqst = (HttpWebRequest)WebRequest.Create("http://search.yahooapis.com/ping?sitemap=http%3a%2f%2fhasangursoy.com.tr%2fsitemap.xml"); rqst.Method = "POST"; rqst.ContentType = "text/xml"; rqst.ContentLength = 0; rqst.Timeout = 3000; rqst.GetResponse();

    Read the article

  • How to identify the source of a text selection event coming from a CompareEditorInput in eclipse?

    - by tangens
    In my eclipse plugin I have the following code: public class MyHandler extends AbstractHandler { @Override public Object execute( ExecutionEvent event ) throws ExecutionException { ISelection sel = HandlerUtil .getActiveWorkbenchWindowChecked( event ) .getSelectionService() .getSelection(); if( sel instanceof TextSelection ) { IEditorPart activeEditor = PlatformUI .getWorkbench() .getActiveWorkbenchWindow() .getActivePage() .getActiveEditor(); IEditorInput editorInput = activeEditor.getEditorInput(); if( editorInput instanceof CompareEditorInput ) { // here are two possible sources of the text selection, the // left or the right side of the compare editor. // How can I find out, which side it is from? } } return null; } } Here I'm handling a text selection event coming from an CompareEditorInput, i.e. the result of comparing two remote revisions of a file with subclipse. Now I want to handle the text selection properly. For that I have to know if it selects some text inside the left side editor or inside the right side editor. How can I find that out?

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >