Search Results

Search found 2166 results on 87 pages for 'obj'.

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

  • issue in list of dict

    - by gaggina
    class MyOwnClass: # list who contains the queries queries = [] # a template dict template_query = {} template_query['name'] = 'mat' template_query['age'] = '12' obj = MyOwnClass() query = obj.template_query query['name'] = 'sam' query['age'] = '23' obj.queries.append(query) query2 = obj.template_query query2['name'] = 'dj' query2['age'] = '19' obj.queries.append(query2) print obj.queries It gives me [{'age': '19', 'name': 'dj'}, {'age': '19', 'name': 'dj'}] while I expect to have [{'age': '23' , 'name': 'sam'}, {'age': '19', 'name': 'dj'}] I thought to use a template for this list because I'm gonna to use it very often and there are some default variable who does not need to be changed. Why does doing it the template_query itself changes? I'm new to python and I'm getting pretty confused.

    Read the article

  • how to call the methos

    - by vicky
    for (i = 0; i < 4; i++) { DeCheBX = $('MyDiv').insert(new Element('input', { 'type': 'checkbox', 'id': "Img" + obj[i].Nam, 'value': obj[i].IM, 'onClick': 'shohide()' })); document.body.appendChild(DeCheBX); DeImg = $('MyDiv').insert(new Element('img', { 'id': "Imgx" + obj[i].Nam, 'src': obj[i].IM })); document.body.appendChild(DeImg); } function shohide() { for (i = 0; i < 4; i++) { ($('Img' + obj[i].Nam).checked == true) { alert("press" + obj[i].Nam); } } }

    Read the article

  • How do I add artwork to an iTunes track with obj-c AppleScript?

    - by demonslayer319
    aTrack is an ITReference* object, value is an NSImage* object, initialized via a URL to a jpeg. [[[[[aTrack artworks] data_] set] to:value] send]; I get the following message in GDB: 2010-03-09 16:59:42.860 Sandbox[2260:a0f] Can't pack object of class NSImage (unsupported type): <NSImage 0x10054a440 Size={0, 0} Reps=( I then tried the following code: NSData *imageData = [[NSData alloc] initWithData:[value TIFFRepresentation]]; [[[[[aTrack artworks] data_] set] to:imageData] send]; and get this message instead 2010-03-09 16:46:09.341 Sandbox[2193:a0f] Can't pack object of class NSConcreteData (unsupported type): <4d4d002a 00000000> In the AppleScript documentation, it says that the "data" property of the "artwork" item is a PICTPicture image. How do I convert an NSImage to a PICT? Am I using the AppleScript all wrong?

    Read the article

  • Obj-C Error: Expected expression before ...... (why?)

    - by Horatiu Paraschiv
    Hi I have an enum declared like this: typedef enum { Top, Bottom, Center } UIItemAlignment; In my code I try to use it like this: item.alignment = UIItemAlignment.Top; I get an error like this: " Expected expression before 'UIItemAlignment' " If I use only: item.alignment = Top; everything works fine but why do I get this error if I try to use it the other way? _alignment is an NSInteger and it has a property declared like this @property (readwrite) NSInteger alignment; and I synthesized it in my implementation file. So my question is, why do I get this error?

    Read the article

  • How do I add artwork to an iTunes track with obj-c AppScript?

    - by demonslayer319
    aTrack is an ITReference* object, value is an NSImage* object, initialized via a URL to a jpeg. [[[[[aTrack artworks] data_] set] to:value] send]; I get the following message in GDB: 2010-03-09 16:59:42.860 Sandbox[2260:a0f] Can't pack object of class NSImage (unsupported type): <NSImage 0x10054a440 Size={0, 0} Reps=( I then tried the following code: NSData *imageData = [[NSData alloc] initWithData:[value TIFFRepresentation]]; [[[[[aTrack artworks] data_] set] to:imageData] send]; and get this message instead 2010-03-09 16:46:09.341 Sandbox[2193:a0f] Can't pack object of class NSConcreteData (unsupported type): <4d4d002a 00000000> In the AppScript documentation, it says that the "data" property of the "artwork" item is a PICTPicture image. How do I convert an NSImage to a PICT? Am I using the AppScript all wrong?

    Read the article

  • How To Get Type Info Without Using Generics?

    - by DaveDev
    Hi Guys I have an object obj that is passed into a helper method. public static MyTagGenerateTag<T>(this HtmlHelper htmlHelper, T obj /*, ... */) { Type t = typeof(T); foreach (PropertyInfo prop in t.GetProperties()) { object propValue = prop.GetValue(obj, null); string stringValue = propValue.ToString(); dictionary.Add(prop.Name, stringValue); } // implement GenerateTag } I've been told this is not a correct use of generics. Can somebody tell me if I can achieve the same result without specifying a generic type? If so, how? I would probably change the signature so it'd be like: public static MyTag GenerateTag(this HtmlHelper htmlHelper, object obj /*, ... */) { Type t = typeof(obj); // implement GenerateTag } but Type t = typeof(obj); is impossible. Any suggestions? Thanks Dave

    Read the article

  • Why check if your popoverController is nil? Doesn't Obj-C ignore messages to nil?

    - by Rob Fonseca-Ensor
    Pretty much everyone that writes about the UISplitView on the iPad uses the following code structure to dismiss a popover: if (popoverController != nil) { [popoverController dismissPopoverAnimated:YES]; } I though Objective-C was happy to ignore messages that are passed to nil? In fact, in the File New Project New Split View Application template, there's an example of this shortcut in the same code block (DetailsViewController.m): - (void)setDetailItem:(id)newDetailItem { if (detailItem != newDetailItem) { [detailItem release]; //might be nil detailItem = [newDetailItem retain]; // Update the view. [self configureView]; } if (popoverController != nil) { [popoverController dismissPopoverAnimated:YES]; //was checked for nil } } Why is that second if necessary?

    Read the article

  • How do I hide the text on a label in Obj-C?

    - by dbonneville
    I'm using label of a button to send a value into a function. However, I want the button to be invisible. I have the background color turned of in IB, and the text color is also set to nothing, but the text still shows up on the button. Is there another way to have a clear button that sends a value when it's clicked? If I could just turn off / hide the text on the stock UIButton that would be perfect... Thanks, Doug

    Read the article

  • What's an easy way to set up object communication in Obj-C?

    - by seaworthy
    I am trying to send a slider value from a controller object to a method of a model object. The later is implemented in the separate file and I have appropriate headers. I think the problem is that I am not sure how to instantiate the receiver in order to produce a working method for the controller. Here is the controller's method. -(IBAction)setValue:(id)slider {[Model setValue:[slider floatValue]];} @implementation Model -(void)setValue:(float)n{ printf("%f",n); } @end What I get is 'Model' may not respond to '+setValue' warning and no output in my console. Any insight is appreciated.

    Read the article

  • How do I get the server hostname from a mounted directory with cocoa/obj-c?

    - by Andrew
    Currently when I open a file with my program I can select files on a server by clicking on the server name in the sidebar in an NSOpenPanel and then selecting the file. No problem, this works fine for using the file as long as the shared directory is mounted. I get a path like "/Volumes/SHARENAME/filename.bla". My question is how do I get the server hostname of the computer it came from. For instance, if I clicked on the device with name SERVERNAME under "Shared" in the NSOpenPanel how do I get SERVERNAME from "/Volumes/SHARENAME/filename.bla". I have looked at quite a bit of documentation and have been unable to find a solution for this problem. Any help toward this will be greatly appreciated. Thank you.

    Read the article

  • get the row number from table view

    - by Faizan Tanveer
    i am new in iphone development, i am using table view to list name of the student, what i want to do is i want to get the row number of the cell the user pressed , currently i can get the name(string) of the cell, //code in didSelectRowAtIndexPath //the obj.name where is a string, it works fine obj.name=[obj.studentname objectAtIndex:indexPath.row]; //if i try obj.num , where num is nsinteger .i am getting errors of type i dnt understand obj.num=[[obj.studentname objectAtIndex:indexPath.row]count]; i even tried but i cant get the number. example if faizan lies on 12th cell. what i want to do is,is save 12 in a number and show it on the next view label.i cant put it in the variable thanks for your help in advance

    Read the article

  • Any sense to set obj = null(Nothing) in Dispose()?

    - by serhio
    Is there any sense to set custom object to null(Nothing in VB.NET) in the Dispose() method? Could this prevent memory leaks or it's useless?! Let's consider two examples: public class Foo : IDisposable { private Bar bar; // standard custom .NET object public Foo(Bar bar) { this.bar = bar; } public void Dispose() { bar = null; // any sense? } } public class Foo : RichTextBox { // this could be also: GDI+, TCP socket, SQl Connection, other "heavy" object private Bitmap backImage; public Foo(Bitmap backImage) { this.backImage = backImage; } protected override void Dispose(bool disposing) { if (disposing) { backImage = null; // any sense? } } }

    Read the article

  • when i click on checkbox ,the image should be hiden though i dont make it happen somehow and i can g

    - by user309381
    function Psend() { new Ajax.Request('Handler.ashx', { method: 'get', onSuccess: function(transport) { var response = transport.responseText || "no response text"; //alert("Success! \n\n" + response); var obj = response.evalJSON(true); for (i = 0; i < 4; i++) { DeCheBX = $('MyDiv').insert(new Element('input', { 'type': 'checkbox', 'id': "Img" + obj[i].Nam, 'value': obj[i].IM, 'onClick': 'SayHi(this,i)' })); document.body.appendChild(DeCheBX); DeImg = $('MyDiv').insert(new Element('img', { 'id': "img" + obj[i].Nam, 'src': obj[i].IM })); document.body.appendChild(DeImg); SayHi = function(x,i) { try { if ($(x).checked == true) { img = "img" + obj[i].Nam; alert(img); $('img').hide(); } } catch (e) { alert("error"); } }; } }, onFailure: function() { alert('Something went wrong...') } }); }

    Read the article

  • GridView items are displaying the wrong drawables sometimes.

    - by originalbryan
    I've implemented a GridView based on this tutorial. It works great unless open up the search dialog or rotate the screen then scroll around. When the search dialog and virtual keyboard appear, the drawables for each of my grid items shift. I can click on them and they do what I expect, except the drawable is wrong. The same problem happens when I go into landscape mode and scroll around. If I scroll down, up, the down again, the drawables are shuffled. For better illustration, let's say I have three objects, each with an image. Obj A shows an Apple Obj B shows a Banana Obj C shows a Cantaloupe When the shift occurs I end up with: Obj A shows an Cantaloupe Obj B shows a Banana Obj C shows a Apple The problem isn't consistent between the two causes (search dialog and screen rotate n' scroll), but each cause itself is consistent. Scrolling around repeatedly reveals a pattern as does the search dialog appearing. How can I stop this from happening?

    Read the article

  • Question regarding common class

    - by Rocky Singh
    I have following two classes: public class A : System.Web.UI.WebControls.Button { public virtual string X { get { object obj = ViewState["X"]; if (obj != null) return (string)obj; return null; } set { ViewState["X"] = value; } } protected override void OnLoad(EventArgs e) { X=2; } } and public class B : System.Web.UI.WebControls.TextBox { public virtual string X { get { object obj = ViewState["X"]; if (obj != null) return (string)obj; return null; } set { ViewState["X"] = value; } } protected override void OnLoad(EventArgs e) { X=2; } } As you must be seeing the class A and B have exactly the same code , my question is how can I make a common class for it and use these two classes.

    Read the article

  • How to return a value when destroying/cleaning-up an object instance

    - by Mridang Agarwalla
    When I initiate a class in Python, I give it some values. I then call method in the class which does something. Here's a snippet: class TestClass(): def __init__(self): self.counter = 0 def doSomething(self): self.counter = self.counter + 1 print 'Hiya' if __name__ == "__main__": obj = TestClass() obj.doSomething() obj.doSomething() obj.doSomething() print obj.counter As you can see, everytime I call the doSomething method, it prints some text and increments an internal variable i.e. counter. When I initiate the class, i set the counter variable to 0. When I destroy the object, I'd like to return the internal counter variable. What would be a good way of doing this? I wanted to know if there were other ways apart from doing stuff like: accessing the variable directly. Like obj.counter. creating a method like getCounter. Thanks.

    Read the article

  • How to create ignore list of several items in SVN?

    - by afsharm
    Hi, I'm creating ignore list in a windows machinge using following: svn propset svn:ignore "bin" Fardis.Test directory structure is: src\ src\Fardis.Test\ src\Fardis.Test\bin\ src\Fardis.Test\obj\ I'm running that command while my currecnt dir is src. This works good but I want to add another more folder (obj) to ignore list, it fails. I tried follwings: svn propset svn:ignore "bin obj" Fardis.Test svn propset svn:ignore "bin, obj" Fardis.Test svn propset svn:ignore "bin; obj" Fardis.Test After issuing which one of them, svn status shows that none of folders bin or obj is added to ignore list. How can I solve this?

    Read the article

  • PHP - json_decode() returns null when using echo

    - by ShatouDev
    I am using the following script to decode a json. Although the var_dump($obj) returns result (similar to one in here Example #1), the echo line doesn't return any result, as if the $obj being null. <?php $clientJSONObject = file_get_contents('php://input'); $obj = json_decode($clientJSONObject, TRUE); var_dump($obj); // working. echo $obj; // returns nothing. echo $obj["carrier"]; // returns nothing. ?> var_dump output: array(2) { ["carrier"]=> string(8) "Etisalat" ["userLanguage"]=> string(2) "ar" }

    Read the article

  • Help! Obj-C/Iphone programming: extracting string from html text and reading off line by line

    - by royden
    hihi, I have this html text response from a particular website: <tr><td valign="top"><img src="/icons/image2.gif" alt="[IMG]"></td><td><a href="crsdsdfs2221.jpg">crash-2221.jpg</a></td><td align="right">14-Jun-2010 14:29 Notice for every line, there is this href=".__", which is an image file with random name and random format. I would like to extract that string within the inverted commas out so that i can append it into a URL path and download the image. I've been looking through this documentation from apple: http://developer.apple.com/mac/library/documentation/cocoa/conceptual/strings/Articles/SearchingStrings.html#//apple_ref/doc/uid/20000149-CJBBGBAI on String programming but couldn't find one that fits my bill. Also after reading it, what code can I use to ensure that I will be reading the next line the next time my function is called( because I want to download the next picture). Hope some kind soul can help me out, thanks!

    Read the article

  • Defining private static class member

    - by mnn
    class B { /* ... */ }; class A { public: A() { obj = NULL; } private: static B* obj; }; However this produces huge mass of linker errors that symbol obj is unresolved. What's the "correct" way to have such private static class member without these linker errors? Edit: I tried this: B *A::obj = NULL; but I got about same amount of linker errors however this time about already defining A::obj. (LNK2005). Also I get LNK4006 warnings, also about A::obj

    Read the article

  • How could I pass the float number by value in obj-c?

    - by user313439
    - (void)applicationDidFinishLaunching:(UIApplication *)application{ // Override point for customization after application launch [window makeKeyAndVisible]; [self printFloat:1.3f]; } - (void)printFloat:(float)f { NSLog(@"%f",f); } I passed the "1.3f" to printFloat, but it was the wrong value (in this case, -2.000000) after "f" received. And there is a warning that "AppDelegate may not respond to -printFloat:" Where did I get it wrong? Thanks.

    Read the article

  • [iPhone Obj-C] How to move a label with the wave of the iPhone?

    - by Didi
    The code below is from the book Beginning iPhone 3 Development, chapter 15, using the accelerometer to control a ball. I want to use a label instead of the ball, and only move in the x direction. However, I donno how to revise the code to achieve this goal. Can anyone please help me? THX so much!!!! (id)initWithCoder:(NSCoder *)coder { if (self = [super initWithCoder:coder]) { self.image = [UIImage imageNamed:@"ball.png"]; self.currentPoint = CGPointMake((self.bounds.size.width / 2.0f) + (image.size.width / 2.0f), (self.bounds.size.height / 2.0f) + (image.size.height / 2.0f)); ballXVelocity = 0.0f; ballYVelocity = 0.0f; } return self; } (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { // Initialization code } return self; } (void)drawRect:(CGRect)rect { // Drawing code [image drawAtPoint:currentPoint]; } (void)dealloc { [image release]; [acceleration release]; [super dealloc]; } //#pragma mark - - (CGPoint)currentPoint { return currentPoint; } - (void)setCurrentPoint:(CGPoint)newPoint { previousPoint = currentPoint; currentPoint = newPoint; if (currentPoint.x < 0) { currentPoint.x = 0; //ballXVelocity = 0; ballXVelocity = - (ballXVelocity / 2.0); } if (currentPoint.y < 0){ currentPoint.y = 0; //ballYVelocity = 0; ballYVelocity = - (ballYVelocity / 2.0); } if (currentPoint.x > self.bounds.size.width - image.size.width) { currentPoint.x = self.bounds.size.width - image.size.width; //ballXVelocity = 0; ballXVelocity = - (ballXVelocity / 2.0); } if (currentPoint.y > self.bounds.size.height - image.size.height) { currentPoint.y = self.bounds.size.height - image.size.height; //ballYVelocity = 0; ballYVelocity = - (ballYVelocity / 2.0); } CGRect currentImageRect = CGRectMake(currentPoint.x, currentPoint.y, currentPoint.x + image.size.width, currentPoint.y + image.size.height); CGRect previousImageRect = CGRectMake(previousPoint.x, previousPoint.y, previousPoint.x + image.size.width, currentPoint.y + image.size.width); [self setNeedsDisplayInRect:CGRectUnion(currentImageRect, previousImageRect)]; } (void)draw { static NSDate *lastDrawTime; if (lastDrawTime != nil) { NSTimeInterval secondsSinceLastDraw = -([lastDrawTime timeIntervalSinceNow]); ballYVelocity = ballYVelocity + -(acceleration.y * secondsSinceLastDraw); ballXVelocity = ballXVelocity + acceleration.x * secondsSinceLastDraw; CGFloat xAcceleration = secondsSinceLastDraw * ballXVelocity * 500; CGFloat yAcceleration = secondsSinceLastDraw * ballYVelocity * 500; self.currentPoint = CGPointMake(self.currentPoint.x + xAcceleration, self.currentPoint.y +yAcceleration); } // Update last time with current time [lastDrawTime release]; lastDrawTime = [[NSDate alloc] init]; }

    Read the article

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