Search Results

Search found 392 results on 16 pages for 'luis oscar'.

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

  • Better way to clean this messy bool method

    - by Luís Custódio
    I'm reading Fowler Clean Code book and I think that my code is a little messy, I want some suggestions: I have a simple business requirement that is return the date of new execution of my Thread. I've two class fields: _hour and _day. If actual day is higher than my _day field I must return true, so I'll add a month to "executionDate" If the day is the same, but the actual hour is higher than _hour I should return true too. So I did this simple method: private bool ScheduledDateGreaterThanCurrentDate (DateTime dataAtual) { if (dateActual.Day > _day) { return true; } if (dateActual.Day == _day && dateActual.Hour > _hour) { return true; } if (dateActual.Day == _day && dateActual.Hour == _hour) if (dateActual.Minute>0 || dateActual.Second>0) return true; return false; } I'm programming with TDD, so I know that the return is correct, but this is bad maintain code right?

    Read the article

  • Custom UILabel does not show text.

    - by Oscar
    Hi! I've made an custom UILabel class in which i draw a red line at the bottom of the frame. The red line is showing but i cant get the text to show. #import <UIKit/UIKit.h> @interface LetterLabel : UILabel { } @end #import "LetterLabel.h" @implementation LetterLabel - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { // Initialization code } return self; } - (void)drawRect:(CGRect)rect { CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 2.0); CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 1.0, 0.0, 0.0, 1.0); CGContextBeginPath(UIGraphicsGetCurrentContext()); CGContextMoveToPoint(UIGraphicsGetCurrentContext(), 0.0, self.frame.size.height); CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), self.frame.size.width, self.frame.size.height); CGContextStrokePath(UIGraphicsGetCurrentContext()); } - (void)dealloc { [super dealloc]; } @end #import <UIKit/UIKit.h> #import "Word.h" @interface WordView : UIView { Word *gameWord; } @property (nonatomic, retain) Word *gameWord; @end @implementation WordView @synthesize gameWord; - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { self.backgroundColor = [UIColor whiteColor]; LetterLabel *label = [[LetterLabel alloc] initWithFrame:CGRectMake(0, 0, 20, 30)]; label.backgroundColor = [UIColor cyanColor]; label.textAlignment = UITextAlignmentCenter; label.textColor = [UIColor blackColor]; [label setText:@"t"]; [self addSubview:label]; } return self; } - (void)drawRect:(CGRect)rect { // Drawing code } - (void)dealloc { [gameWord release]; [super dealloc]; } @end

    Read the article

  • How do I make nested options for plugins in jQuery

    - by Oscar Godson
    I know how to do plugins, but how do I do nested options like: var defaults = { spacing:10, shorten_to:50, from_start:0, from_end:2, classes: { test:'testing' } }; i know that isn't right, i just dont know how to write the proper syntax when I want to do something like this: $('#breadcrumbs').breadcrumbs({classes{test:'new_example'},spacing:12}) other suggestions are welcome, im in need of the ability to custom class names and there are 7, so rather than making something like test_class, example_class, etc id like it cleaner and neater like the example above.

    Read the article

  • Redirect Desktop Internal Pages to Correct Mobile Internal Pages with Htaccess

    - by Luis Alejandro Ramrez Gallardo
    I have built a Mobile site in a sub-domain. I have successfully implemented the redirect 302 from: www.domain.com to m.domain.com in htaccess. What I'm looking to achieve now it to redirect users from: www.domain.com/internal-page/ > 302 > m.domain.com/internal-page.html Notice that URL name for desktop and mobile is not the same. The code I'm using looks like this: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress # Mobile Redirect # Verify Desktop Version Parameter RewriteCond %{QUERY_STRING} (^|&)ViewFullSite=true(&|$) # Set cookie and expiration RewriteRule ^ - [CO=mredir:0:www.domain.com:60] # Prevent looping RewriteCond %{HTTP_HOST} !^m.domain.com$ # Define Mobile agents RewriteCond %{HTTP_ACCEPT} "text\/vnd\.wap\.wml|application\/vnd\.wap\.xhtml\+xml" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "sony|symbian|nokia|samsung|mobile|windows ce|epoc|opera" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "mini|nitro|j2me|midp-|cldc-|netfront|mot|up\.browser|up\.link|audiovox"[NC,OR] RewriteCond %{HTTP_USER_AGENT} "blackberry|ericsson,|panasonic|philips|sanyo|sharp|sie-"[NC,OR] RewriteCond %{HTTP_USER_AGENT} "portalmmm|blazer|avantgo|danger|palm|series60|palmsource|pocketpc"[NC,OR] RewriteCond %{HTTP_USER_AGENT} "smartphone|rover|ipaq|au-mic,|alcatel|ericy|vodafone\/|wap1\.|wap2\.|iPhone|android"[NC] # Verify if not already in Mobile site RewriteCond %{HTTP_HOST} !^m\. # We need to read and write at the same time to set cookie RewriteCond %{QUERY_STRING} !(^|&)ViewFullSite=true(&|$) # Verify that we previously haven't set the cookie RewriteCond %{HTTP_COOKIE} !^.*mredir=0.*$ [NC] # Now redirect the users to the Mobile Homepage RewriteRule ^$ http://m.domain.com [R] RewriteRule $/internal-page/ http://m.domain.com/internal-page.html [R,L]

    Read the article

  • What is `objc_msgSend_fixup`, exactly?

    - by Luis Antonio Botelho O. Leite
    I'm messing around with the Objective-C runtime, trying to compile objective-c code without linking it against libobjc, and I'm having some segmentation fault problems with a program, so I generated an assembly file from it. I think it's not necessary to show the whole assembly file. At some point of my main function, I've got the following line (which, by the way, is the line after which I get the seg fault): callq *l_objc_msgSend_fixup_alloc and here is the definition for l_objc_msgSend_fixup_alloc: .hidden l_objc_msgSend_fixup_alloc # @"\01l_objc_msgSend_fixup_alloc" .type l_objc_msgSend_fixup_alloc,@object .section "__DATA, __objc_msgrefs, coalesced","aw",@progbits .weak l_objc_msgSend_fixup_alloc .align 16 l_objc_msgSend_fixup_alloc: .quad objc_msgSend_fixup .quad L_OBJC_METH_VAR_NAME_ .size l_objc_msgSend_fixup_alloc, 16 I've reimplemented objc_msgSend_fixup as a function (id objc_msgSend_fixup(id self, SEL op, ...)) which returns nil (just to see what happens), but this function isn't even being called (the program crashes before calling it). So, my question is, what is callq *l_objc_msgSend_fixup_alloc supposed to do and what is objc_msgSend_fixup (after l_objc_msgSend_fixup_alloc:) supposed to be (a function or an object)? Edit To better explain, I'm not linking my source file against the objc library. What I'm trying to do is implement some parts of the libray, just to see how it works. Here is an approach of what I've done: #include <stdio.h> #include <objc/runtime.h> @interface MyClass { } +(id) alloc; @end @implementation MyClass +(id) alloc { // alloc the object return nil; } @end id objc_msgSend_fixup(id self, SEL op, ...) { printf("Calling objc_msgSend_fixup()...\n"); // looks for the method implementation for SEL in self's vtable return nil; // Since this is just a test, this function doesn't need to do that } int main(int argc, char *argv[]) { MyClass *m; m = [MyClass alloc]; // At this point, according to the assembly code generated // objc_msgSend_fixup should be called. So, the program should, at least, print // "Calling objc_msgSend_fixup()..." on the screen, but it crashes before // objc_msgSend_fixup() is called... return 0; } If the runtime needs to access the object's vtable to find the correct method to call, what is the function which actually does this? I think it is objc_msgSend_fixup, in this case. So, when objc_msgSend_fixup is called, it receives an object as one of its parameters, and, if this object hasn't been initialized, the function fails. So, I've implemented my own version of objc_msgSend_fixup. According to the assembly source above, it should be called. It doesn't matter if the function is actually looking for the implementation of the selector passed as parameter. I just want objc_msgSend_lookup to be called. But, it's not being called, that is, the function that looks for the object's data is not even being called, instead of being called and cause a fault (because it returns a nil (which, by the way, doesn't matter)). The program seg fails before objc_msgSend_lookup is called...

    Read the article

  • Load XML file on seperate thread, overwrite old , and save.

    - by Luis Tovar
    Hey everyone... so Im trying to figure out how to do this. I have bounced around alot of forums to try and find my answer, but no success. Either their process it too complicated for me to understand, or is just overkill. What I am trying to do is this. I have an XML file within my app. Its a 500k xml file that i dont want the user to have to wait on when loading. SO... I put it in my app which kills the load time, and makes the app available offline. What i want to do is, when the app loads, in the background (seperate thread) download the SAME xml file which MIGHT be updated with new data. Once the xml file is complete, i want to REPLACE the xml file that was used to load the file. Any suggestions or code hints would be greatly appreciated. Thanks in advance!

    Read the article

  • help with linq query

    - by Luis
    Hi, i am trying to get some data, but i dont know how can i do a if in linq, this is how i am trying to do from so in db.Operations where ((opType!= "0" ? so.Operation == int.Parse(opType) : false) && (idState!=0 ? so.State == idState : false) && (start != null ? so.StartDate == start : false) && (end !=null ? so.EndDate == end : false)) select so the optype is a Int, the idState is a Int, end is a datetime, start is a datime what i am trying to do is, if those aren't null they add to the query function, so i can get all data together

    Read the article

  • Call a c# method from Javascript

    - by Luis
    Hi i want to call a C# method.. I already tryed with webmethod, but in the c# method i will not have acces to textbox or others controls. this is how i done without success.. http://www.singingeels.com/Articles/Using_Page_Methods_in_ASPNET_AJAX.aspx With static works, but i want without static, so i can access to the controls in the aspx and validate the page. how can i do it?

    Read the article

  • Clean checkout from TFS 2008

    - by Luis Medel
    Hi all, I want to pass a project to a colleague without SCC bindings to avoid accidental changes in my repository. Is it possible to do a clean checkout from a TFS 2008 repo? I'm going crazy finding such an option in VS2008. Thanks in advance.

    Read the article

  • Resizing a UIButton programmatically by maintaining a margin

    - by Oscar Del Ben
    Hello, I'm adding a UIButton to a tableView footer programmatically. This button has a left and right margin that is equal to the tableView margin: UIButton *deleteButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; deleteButton.frame = CGRectMake(10, 60, 300, 34); deleteButton.autoresizingMask = UIViewAutoresizingFlexibleWidth I'm adding autoresizingMask because I want to support rotation. However, it does not work as I want, as the button stretches all the way down to the right, as shown by the image below. Any idea how to fix it? If I remove the autosizing property then the margin is correct.

    Read the article

  • Change the content type of a pop up window.

    - by Oscar Reyes
    This question brought a new one: I have a html page and I need it to change the content type when the user press "save" button so the browser prompt to save the file to disk I've been doing this in the server side to offer "excel" versions of the page ( which is basically a html table ) <c:if test="${page.asExcelAction}"> <% response.setContentType("application/vnd.ms-excel"); %> What I'm trying to do now is to do the same, but in the client side with javacript but I can't manage to do it so. This is what I've got so far: <html> <head> <script> function saveAs(){ var sMarkup = document.getElementById('content').innerHTML; //var oNewDoc = document.open('application/vnd.ms-excel'); var oNewDoc = document.open('text/html'); oNewDoc.write( sMarkup ); oNewDoc.close(); } </script> </head> <body> <div id='content'> <table> <tr> <td>Stack</td> <td>Overflow</td> </tr> </table> </div> <input type="button" value="Save as" onClick="saveAs()"/> </body> </html>

    Read the article

  • Disposing underlying object from finalizer in an immutable object

    - by Juan Luis Soldi
    I'm trying to wrap around Awesomium and make it look to the rest of my code as close as possible to NET's WebBrowser since this is for an existing application that already uses the WebBrowser. In this library, there is a class called JSObject which represents a javascript object. You can get one of this, for instance, by calling the ExecuteJavascriptWithResult method of the WebView class. If you'd call it like myWebView.ExecuteJavascriptWithResult("document", string.Empty).ToObject(), then you'd get a JSObject that represents the document. I'm writing an immutable class (it's only field is a readonly JSObject object) called JSObjectWrap that wraps around JSObject which I want to use as base class for other classes that would emulate .NET classes such as HtmlElement and HtmlDocument. Now, these classes don't implement Dispose, but JSObject does. What I first thought was to call the underlying JSObject's Dispose method in my JSObjectWrap's finalizer (instead of having JSObjectWrap implement Dispose) so that the rest of my code can stay the way it is (instead of having to add using's everywhere and make sure every JSObjectWrap is being properly disposed). But I just realized if more than two JSObjectWrap's have the same underlying JSObject and one of them gets finalized this will mess up the other JSObjectWrap. So now I'm thinking maybe I should keep a static Dictionary of JSObjects and keep count of how many of each of them are being referenced by a JSObjectWrap but this sounds messy and I think could cause major performance issues. Since this sounds to me like a common pattern I wonder if anyone else has a better idea.

    Read the article

  • Collections of generics

    - by Luis Sep
    According to what I've read, I think this can't be done, but I'd like to be sure. I have a class OpDTO and several other *DTO extends OpDTO. Then, I want to have a method to extract just certain elements from lists of these child DTOs, and return the extracted elements in another list: public List<? extends OpDTO> getLastOp (List<? extends OpDTO> listDTOs) { List<? extends OpDTO> last = new ArrayList<? extends OpDTO>(); //compile error: Cannot instantiate the type ArrayList<? extends OpDTO> //processing return last; } I want ult to be a list of elements of the same kind as elements in listDTOs, and use only OpDTO's methods, but it produces a compile error: Cannot instantiate the type ArrayList<? extends OpDTO> I also tried doing something like: public <T> List<T> getLastOp (List<T> listDTOs) { List<T> last = new ArrayList<T>(); //processing return last; } But then I can't enforce elements in listDTOs to be a subclass of OpDTO, and can't instantiate T. Any idea?

    Read the article

  • keyDown works but i get beeps

    - by Oscar
    I just got my keydown method to work. But i get system beep everytime i press key. i have no idea whats wrong. Googled for hours and all people say is that if you have your keyDown method you should also implement the acceptsFirstResponder. did that to and it still doesn't work. #import <Cocoa/Cocoa.h> #import "PaddleView.h" #import "BallView.h" @interface GameController : NSView { PaddleView *leftPaddle; PaddleView *rightPaddle; BallView * ball; CGPoint ballVelocity; int gameState; int player1Score; int player2Score; } @property (retain) IBOutlet PaddleView *leftPaddle; @property (retain) IBOutlet PaddleView *rightPaddle; @property (retain) IBOutlet BallView *ball; - (void)reset:(BOOL)newGame; @end #import "GameController.h" #define GameStateRunning 1 #define GameStatePause 2 #define BallSpeedX 0.2 #define BallSpeedY 0.3 #define CompMoveSpeed 15 #define ScoreToWin 5 @implementation GameController @synthesize leftPaddle, rightPaddle, ball; - (id)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; if(self) { gameState = GameStatePause; ballVelocity = CGPointMake(BallSpeedX, BallSpeedY); [NSTimer scheduledTimerWithTimeInterval:0.001 target:self selector:@selector(gameLoop) userInfo:nil repeats:YES]; } return self; } - (void)gameLoop { if(gameState == GameStateRunning) { [ball setFrameOrigin:CGPointMake(ball.frame.origin.x + ballVelocity.x, ball.frame.origin.y + ballVelocity.y)]; if(ball.frame.origin.x + 15 > self.frame.size.width || ball.frame.origin.x < 0) { ballVelocity.x =- ballVelocity.x; } if(ball.frame.origin.y + 35 > self.frame.size.height || ball.frame.origin.y < 0) { ballVelocity.y =- ballVelocity.y; } } if(CGRectIntersectsRect(ball.frame, leftPaddle.frame)) { if(ball.frame.origin.x > leftPaddle.frame.origin.x) { ballVelocity.x =- ballVelocity.x; } } if(CGRectIntersectsRect(ball.frame, rightPaddle.frame)) { if(ball.frame.origin.x +15 > rightPaddle.frame.origin.x) { ballVelocity.x =- ballVelocity.x; } } if(ball.frame.origin.x <= self.frame.size.width / 2) { if(ball.frame.origin.y < leftPaddle.frame.origin.y + 75 && leftPaddle.frame.origin.y > 0) { [leftPaddle setFrameOrigin:CGPointMake(leftPaddle.frame.origin.x, leftPaddle.frame.origin.y - CompMoveSpeed)]; } if(ball.frame.origin.y > leftPaddle.frame.origin.y +75 && leftPaddle.frame.origin.y < 700 - leftPaddle.frame.size.height ) { [leftPaddle setFrameOrigin:CGPointMake(leftPaddle.frame.origin.x, leftPaddle.frame.origin.y + CompMoveSpeed)]; } } if(ball.frame.origin.x <= 0) { player2Score++; [self reset:(player2Score >= ScoreToWin)]; } if(ball.frame.origin.x + 15 > self.frame.size.width) { player1Score++; [self reset:(player1Score >= ScoreToWin)]; } } - (void)reset:(BOOL)newGame { gameState = GameStatePause; [ball setFrameOrigin:CGPointMake((self.frame.size.width + 7.5) / 2, (self.frame.size.height + 7.5)/2)]; if(newGame) { if(player1Score > player2Score) { NSLog(@"Player 1 Wins!"); } else { NSLog(@"Player 2 Wins!"); } player1Score = 0; player2Score = 0; } else { NSLog(@"Press key to serve"); } NSLog(@"Player 1: %d",player1Score); NSLog(@"Player 2: %d",player2Score); } - (void)moveRightPaddleUp { if(rightPaddle.frame.origin.y < 700 - rightPaddle.frame.size.height) { [rightPaddle setFrameOrigin:CGPointMake(rightPaddle.frame.origin.x, rightPaddle.frame.origin.y + 20)]; } } - (void)moveRightPaddleDown { if(rightPaddle.frame.origin.y > 0) { [rightPaddle setFrameOrigin:CGPointMake(rightPaddle.frame.origin.x, rightPaddle.frame.origin.y - 20)]; } } - (BOOL)acceptsFirstResponder { return YES; } - (void)keyDown:(NSEvent *)theEvent { if ([theEvent modifierFlags] & NSNumericPadKeyMask) { NSString *theArrow = [theEvent charactersIgnoringModifiers]; unichar keyChar = 0; if ( [theArrow length] == 0 ) { return; // reject dead keys } if ( [theArrow length] == 1 ) { keyChar = [theArrow characterAtIndex:0]; if ( keyChar == NSLeftArrowFunctionKey ) { gameState = GameStateRunning; } if ( keyChar == NSRightArrowFunctionKey ) { } if ( keyChar == NSUpArrowFunctionKey ) { [self moveRightPaddleUp]; } if ( keyChar == NSDownArrowFunctionKey ) { [self moveRightPaddleDown]; } [super keyDown:theEvent]; } } else { [super keyDown:theEvent]; } } - (void)drawRect:(NSRect)dirtyRect { } - (void)dealloc { [ball release]; [rightPaddle release]; [leftPaddle release]; [super dealloc]; } @end

    Read the article

  • Alternative to WhitePages API?

    - by Oscar Godson
    I'm using the WhitePages API ( developer.whitepages.com ) to get a phone type (landline or cellular) and the phone's service provider (Verizon, T-Mobile, etc), but they only have a personal API which limits you to 2 calls a second and/or 1,500 calls a day. The paid version, or "Pro", is a minimum of $500 a month and/or $0.10 a call. Does anyone know another service where I can get that information for free or cheaper than $500 / $0.10 a call? If not I'll have to try to cache everything and it'll technically be against their TOS...

    Read the article

  • Very basic question about Hadoop and compressed input files

    - by Luis Sisamon
    I have started to look into Hadoop. If my understanding is right i could process a very big file and it would get split over different nodes, however if the file is compressed then the file could not be split and wold need to be processed by a single node (effectively destroying the advantage of running a mapreduce ver a cluster of parallel machines). My question is, assuming the above is correct, is it possible to split a large file manually in fixed-size chunks, or daily chunks, compress them and then pass a list of compressed input files to perform a mapreduce?

    Read the article

  • Dynamically add new HTML elements on page load after getting JSON data from Web API

    - by Luis D Urraca
    I'm building an hybrid Android App using Phonegap/Apache Cordova. My app should get data from my web api. I'm using JSON to serve the data to the APP. So i got a the following code: function init() { document.addEventListener('deviceready', onDeviceReady, false); var url = "http://23.21.128.153:3000/regions.json";var jsonresults; $.getJSON(url,function(data){ jsonresults = data; $.each(jsonresults, function(i,v){ $('#main-content').append('<li>'+jsonresults[i].name+'</li>'); }); }); } and also on the body of the html i have a div called main-content. Everythings works fine in the Eclipse browser, but on the Android Emulator is not working. Not sure if there's another way to pull data from Web API using JSON and dinamically create HMTL elements after getting the data. https://gist.github.com/2956660

    Read the article

  • Custom Date Format with jax-rs in apache cxf?

    - by Oscar Chan
    Hi, I have been googling to figure out how I can customize the Date format when I use jax-rs on apache CXF. I looked at the codes, and it seems that it only support primitives, enum and a special hack that assume the type associated with @ForumParam has a constructor with a single string parameter. This force me to use String instead of Date if I want to use ForumParam. it is kind of ugly. Is there a better way to do it? @POST @Path("/xxx") public String addPackage(@FormParam("startDate") Date startDate) { ... } Thanks

    Read the article

  • How to select the first property with unknown name and first item from array in JSON

    - by Oscar Godson
    I actually have two questions, both are probably simple, but for some odd reason I cant figure it out... I've worked with JSON 100s of times before too! but here is the JSON in question: {"69256":{ "streaminfo":{ "stream_ID":"1025", "sourceowner_ID":"2", "sourceowner_avatar":"http:\/\/content.nozzlmedia.com\/images\/sourceowner_avatar2.jpg", "sourceownertype_ID":"1", "stream_name":"Twitter", "streamtype":"Social media" "appsarray":[] }, "item":{ "headline":"Charboy", "main_image":"http:\/\/content.nozzlmedia.com\/images\/author_avatar173212.jpg", "summary":"ate a tomato and avocado for dinner...", "nozzl_captured":"2010-05-12 23:02:12", "geoarray":[{ "state":"OR", "county":"Multnomah", "city":"Portland", "neighborhood":"Downtown", "zip":"97205", "street":"462 SW 11th Ave", "latitude":"45.5219", "longitude":"-122.682" }], "full_content":"ate a tomato and avocado for dinner tonight. such tasty foods. just enjoyable.", "body_text":"ate a tomato and avocado for dinner tonight. such tasty foods. just enjoyable.", "author_name":"Charboy", "author_avatar":"http:\/\/content.nozzlmedia.com\/images\/author_avatar173212.jpg", "fulltext_url":"http:\/\/twitter.com\/charboy\/statuses\/13889868936", "leftovers":{ "twitter_id":"tag:search.twitter.com,2005:13889868936", "date":"2010-05-13T02:59:59Z", "location":"iPhone: 45.521866,-122.682262" }, "wordarray":{ "0":"ate", "1":"tomato", "2":"avocado", "3":"dinner", "4":"tonight", "5":"tasty", "6":"foods", "7":"just", "8":"enjoyable", "9":"Charboy", "11":"Twitter", "13":"state:OR", "14":"county:Multnomah, OR", "15":"city:Portland, OR", "16":"neighborhood:Downtown", "17":"zip:97205" } } } } Question 1: How do I loop through each item (69256) when the number is random? e.g. item 1 is 123, item2 is 646? Like, for example, a normal JSON feed would have something like: {'item':{'blah':'lorem'},'item':{'blah':'ipsum'}} the JS would be like console.log(item.blah) to return lorem then ipsum in a loop How do I do it when i dont know the first item of the object? Question 2: How do I select items from the geoarray object? I tried: json.test.item.geoarray.latitude and json.test.item.geoarray['latitude']

    Read the article

  • Pass a range into a custom function from within a cell

    - by Luis
    Hi I'm using VBA in Excel and need to pass in the values from two ranges into a custom function from within a cell's formula. The function looks like this: Public Function multByElement(range1 As String, range2 As String) As Variant Dim arr1() As Variant, arr2() As Variant arr1 = Range(range1).value arr2 = Range(range2).value If UBound(arr1) = UBound(arr2) Then Dim arrayA() As Variant ReDim arrayA(LBound(arr1) To UBound(arr1)) For i = LBound(arr1) To UBound(arr1) arrayA(i) = arr1(i) * arr2(i) Next i multByElement = arrayA End If End Function As you can see, I'm trying to pass the string representation of the ranges. In the debugger I can see that they are properly passed in and the first visible problem occurs when it tries to read arr1(i) and shows as "subscript out of range". I have also tried passing in the range itself (ie range1 as Range...) but with no success. My best suspicion was that it has to do with the Active Sheet since it was called from a different sheet from the one with the formula (the sheet name is part of the string) but that was dispelled since I tried it both from within the same sheet and by specifying the sheet in the code. BTW, the formula in the cell looks like this: =AVERAGE(multByElement("A1:A3","B1:B3")) or =AVERAGE(multByElement("My Sheet1!A1:A3","My Sheet1!B1:B3")) for when I call it from a different sheet.

    Read the article

  • Attaching an event to an Iframe that contains more iframes

    - by Oscar Godson
    I have an editor which is in my window that contains a wrapping iframe and then 2 more iframes inside like (the HTML inside the <iframe> element is inserted via write() in JS, not hardcoded like this): <iframe class="parent"> <div class="wrapper"> <iframe class="editor"></iframe> <iframe class="previewer"></iframe> </div> </iframe> One is an editor, the other is a previewer. The first one that contains the two (we'll call this the parent) has an eventListener for mousemove attached to it, but nothing is firing. If i add a 5px border for example, the event will fire when I move my mouse on the border of the parent, but not when i hover over the middle which contains the editor or previewer (previewer is display:none while the editor is visible, and vice versa). So, the blue area in the following i can mousemove, but the rest I can't. It's most likely because of the stacking order, but how can I attach an event to fire on the entire frame? I need mousemove because on mousemove I display a menu in the bottom right. I want the same menu to display whether or not the editor or the previewer is visible.

    Read the article

  • Regex with dynamic <textarea>

    - by Oscar Godson
    How can I do this with the JS replace() method: Make \n\n change to <p>$1</p> Change single \n to <br> Then back again. I think I have this part, see the JS at the bottom. Example HTML: <p>Hello</p><p>Wor<br>ld</p> The <textarea> would look like: Hello Wor ld So, how can I achieve this? It's an AJAX form where when you click on this div it changes to a <textarea> and back, and fourth, etc. So, I need to it to go from <p>s and <br>s to \n\n and \n. For the going to <textarea> from HTML I have: $(this).html().replace(/\s?<\/?(p|br\s?\/?)>\s?/g,"\n")

    Read the article

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