Daily Archives

Articles indexed Thursday April 29 2010

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

  • Parsing a complicated array with GetJSON Jquery

    - by Ozaki
    TLDR: Started with this question simplified it after got some of it working and continuing it here. I need to 'GET' the JSON array Format it correctly and for each within the array place it in the corresponding DIV. ?? It works. This is a followup from this question to simplify and continue. I need to some complicated JSON data from an array. With it I need the title and it's value. The reason why I am doing this is because I will know what the array is called but not the data that is being generated inside it. Lets say this new array looks as follows: {"Days": ["Sunday":"10.00", "Monday":"12.00", "Tuesday":"09.00", "Wednesday":"10.00", "Thursday":"02.00", "Friday":"05.00", "Saturday":"08.00"] } I would need it to get Sunday & 10.00 as well as the same for all of the others. My code to parse this at the moment is as follows: $.getJSON(url, function(data){ $.each(data, function(i,item){ $('.testfield').append('<p>' + item + '</p>'); }); }); Without the added times on each date it will parse the data as follows: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday With the times added to the days in the array Firebug no longer recognizes it as a JSON string. So I am guessing I have formatted something wrong here. Also, I need each day & time to be on a new line I thought that $('.testfield').append('<p>' + item + '</p>' + '<br />'); Would have applied each one to a new line but that did not work. How do I get each day or item to be on a new line? How do I get the $getjson to parse the data correctly day and its value, into a div?

    Read the article

  • Why String.replaceAll() don't work on this String ?

    - by Aloong
    //This source is a line read from a file String src = "23570006,music,**,wu(),1,exam,\"Monday9,10(H2-301)\",1-10,score,"; //This sohuld be from a matcher.group() when Pattern.compile("\".*?\"") String group = "\"Monday9,10(H2-301)\""; src = src.replaceAll("\"", ""); group = group.replaceAll("\"", ""); String replacement = group.replaceAll(",", "#@"); System.out.println(src.contains(group)); src = src.replaceAll(group, replacement); System.out.println(group); System.out.println(replacement); System.out.println(src); I'm trying to replace the "," between \"s so I can ues String.split() latter. But the above just not working , the result is: true Monday9,10(H2-301) Monday9#@10(H2-301) 23570006,music,**,wu(),1,exam,Monday9,10(H2-301),1-10,score, but when I change the src string to String src = "123\"9,10\"123"; String group = "\"9,10\""; It works well true 9,10 9#@10 1239#@10123 What's the matter with the string???

    Read the article

  • How do I include external Libraries in CodeIgniter?

    - by user259954
    I'm new to codeigniter, and I'm trying to integrate amazon's FPS into my page. There are a bunch of libraries and models that go with Amazon FPS, which I would need included to make the appropriate calls. How do I include them in CodeIgniter? I tried placing the entire Amazon folder inside the system/libraries directory, and then tried including libraries with $this-load-library( 'Amazon/FPS/Client' ); However, I run into problems with the relative path there, because Client.php contains the statement require_once ('Amazon/FPS/Interface.php'); ... which is in the same folder. There has to be a better way to do all this - can anyone please help? Thanks!!

    Read the article

  • Drupal - how to register a MENU_CALLBACK that is accessable to all users(even anonymous ones)?

    - by rubayeet
    I'm trying to learn Drupal 6. I want to register the path '/topic' to a MENU_CALLBACK using hook_menu(). Here's what I have: function mymodule_menu() { $items = array() $items['foo'] = array( 'page callback' => 'show_page_foo', 'access callback' => 'user_access', 'access arguements' => array('access foo content'), 'type' => MENU_CALLBACK ); } function show_page_foo() { //show foo page } This works fine for a logged in user. But when I visit the path as an anonymous user it shows 'Access Denied' message. What must be the 'access callback' and 'access arguments' values to have this accessible to all visitors? I remember I made this work by simply saying 'access' => TRUE in Drupal 5. No longer works in Drupal 6.

    Read the article

  • Creating multiple log files of different content with log4j

    - by Daniel
    Is there a way to configure log4j so that it outputs different levels of logging to different appenders? I'm trying to set up multiple log files. The main log file would catch all INFO and above messages for all classes. (In development, it would catch all DEBUG and above messages, and TRACE for specific classes.) Then, I would like to have a separate log file. That log file would catch all DEBUG messages for a specific subset of classes, and ignore all messages for any other class. Is there a way to get what I'm after? Thanks, Dan

    Read the article

  • Penetration testing - common examples?

    - by Mirek
    Hi, I was charged to do some basic penetration testing on our system. I tried to find some favoured practices but I was not successful. I guess SYN attack is retired (no NT here). Could anyone advice some basic steps of what to test in order to proceed at least very basic penetration test? Thanks

    Read the article

  • is it incorrect to define an hashcode of an object as the sum, multiplication, whatever, of all clas

    - by devoured elysium
    Let's say I have the following class: class ABC { private int myInt = 1; private double myDouble = 2; private String myString = "123"; private SomeRandomClass1 myRandomClass1 = new ... private SomeRandomClass2 myRandomClass2 = new ... //pseudo code public int myHashCode() { return 37 * myInt.hashcode() * myDouble.hashCode() * ... * myRandomClass.hashcode() } } Would this be a correct implementation of hashCode? This is not how I usually do it(I tend to follow Effective Java's guide-lines) but I always have the temptation to just do something like the above code. Thanks

    Read the article

  • For eBook which control i should use and how to start

    - by Aamir Khurshid
    Hi , i want to develop such an application through which i can read book ,currently i am using the Richtextbox in flow document,i dont want to use the scroll ,i prefer the navigation style i.e prev page next page start and end ,book may contains images tables so and so ,and how do i import books in my application How can i achieve? Regards, Aamir

    Read the article

  • UIImagePickerController crashing

    - by Mike
    I am developing a project based on iPhone OS 3.2 This project uses UIImagePickerController to pick videos. I have managed to put a video inside the iPad simulator. Photos.app can see and play the video, that was created using an iPhone 3GS, but whey I try to use the UIImagePickerController, it simply crashes my app. THis is the code I am using: if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypePhotoLibrary]) { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; picker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:picker.sourceType];//shows movies and photos on iPhone picker.delegate = self; picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker]; CGRect myRect = CGRectMake(0,0,100,100); // this is a random rect just for testing [popover presentPopoverFromRect:myRect inView:myMainView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; } after running this, the app crashes miserably with the following message Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Popovers cannot be presented from a view which does not have a window.' Is there something wrong with the code or it is just the simulator crashing because it is unable to pick videos? please refrain from recommending me to test on a real device. The problem is that I live outside the US and there's no iPad here soon. thanks.

    Read the article

  • While remote deubgging how are the pdb located (VS 2008)

    - by Saar
    When the deubgger is attached to a process on remote server - What locations are searched for the pdb? In what order? (e.g. is it searched on the remote server (debuggee) or on the local client (deubger)) When I use the deubgger to manually load pdb file from specific location - is the deubbger looking for the file locally or is it the remote debugger monitor looking for the file on the? Is there any article that describes that process?

    Read the article

  • Accessing 2D array and passing string to label.text

    - by Amir
    Hi. I'm trying to create 2D array and initialize it with NSStrings. When I try to copy content of a cell from the array to a label.text, the application crashes. NSMutableArray *array = [NSMutableArray arrayWithCapacity:0]; [array addObject:[NSMutableArray arrayWithObjects: [NSArray arrayWithObjects: @"0-0", @"0-1", @"0-2", nil], [NSArray arrayWithObjects: @"1-0", @"1-1", @"1-2", nil], [NSArray arrayWithObjects: @"2-0", @"2-1", @"2-2", nil], nil]]; label.text = [[array objectAtIndex:0] objectAtIndex:0]; Any idea why and what am I doing wrong?

    Read the article

  • Optimized 2D Tile Scrolling in OpenGL

    - by silicus
    Hello, I'm developing a 2D sidescrolling game and I need to optimize my tiling code to get a better frame rate. As of right now I'm using a texture atlas and 16x16 tiles for 480x320 screen resolution. The level scrolls in both directions, and is significantly larger than 1 screen (thousands of pixels). I use glTranslate for the actual scrolling. So far I've tried: Drawing only the on-screen tiles using glTriangles, 2 per square tile (too much overhead) Drawing the entire map as a Display List (great on a small level, way to slow on a large one) Partitioning the map into Display Lists half the size of the screen, then culling display lists (still slows down for 2-directional scrolling, overdraw is not efficient) Any advice is appreciated, but in particular I'm wondering: I've seen Vertex Arrays/VBOs suggested for this because they're dynamic. What's the best way to take advantage of this? If I simply keep 1 screen of vertices plus a bit of overdraw, I'd have to recopy the array every few frames to account for the change in relative coordinates (shift everything over and add the new rows/columns). If I use more overdraw this doesn't seem like a big win; it's like the half-screen display list idea. Does glScissor give any gain if used on a bunch of small tiles like this, be it a display list or a vertex array/VBO Would it be better just to build the level out of large textures and then use glScissor? Would losing the memory saving of tiling be an issue for mobile development if I do this (just curious, I'm currently on a PC)? This approach was mentioned here Thanks :)

    Read the article

  • Convert String to java.util.Date

    - by Vinayak.B
    Hi Folks, I storing the date to SQLite database in the format d-MMM-yyyy,HH:mm:ss aaa And again retrieving it with the same format, the problem now is, I am gettin every thing fine exepth the Hour. Hour I am geting 00 every time, Here the print statement String date--->29-Apr-2010,13:00:14 PM After convrting Date--->1272479414000--Thu Apr 29 00:00:14 GMT+05:30 2010 Please where I am doing wrong. Cheers, Vinayak

    Read the article

  • Localization approach for XSLT + RESX in ASP.NET

    - by frankadelic
    I have an ASP.NET web app where the back end data (XML format) is transformed using XSLT, producing XHTML which is output into the page. Simplified code: XmlDocument xmlDoc = MyRepository.RetrieveXmlData(keyValue); XslCompiledTransform xsl = new XslCompiledTransform(); xsl.Load(pathToXsl, XsltSettings.TrustedXslt, null); StringWriter stringWriter = new StringWriter(); xsl.Transform(xmlDoc, null, stringWriter); myLiteral.Text = stringWriter.ToString(); Currently my XSL file contains the XHTML markup elements, as well as text labels, which are currently in English. for example: <p>Title:<br /> <xsl:value-of select="title"/> </p> <p>Description:<br /> <xsl:value-of select="desc"/> </p> I would like the text labels (Title and Description above) to be localized. I was thinking of using .NET resource files (.resx), but I don't know how the resx string resources would get pulled in to the XSLT when the transformation takes place. I would prefer not to have locale-specific copies of the XSLT file, since that means a lot of duplicate transformation logic. (NOTE: the XML data is already localized, so I don't need to change that)

    Read the article

  • Java: Cleaning up what causes a connection reset

    - by Zombies
    There seems to be some confusion as well contradicting statements on various SO answers: http://stackoverflow.com/questions/585599/whats-causing-my-java-net-socketexception-connection-reset . You can see here that the accepted answer states that the connection was closed by other side. But this is not true, closing a connection doesn't cause a connection reset. It is cauesed by "an underlying TCP/IP error." What I want to know is if a SocketException: Connection reset means really besides "unerlying TCP/IP Error." What really causes this? As I doubt it has anything to do with the connection being closed (since closing a connection isn't an exception worthy flag, and reading from a closed connection is, but that isn't an "underlying TCP/IP error." My hypothesis is this Connection reset is caused from a server's failure to acknowledge an ACK packet (either wholly or just improperly as per TCP/IP). And that a SocketTimeoutException is generated only when no data is generated to be read (since this is thrown during a read after a certain duration, and read is waiting for data, but is not concerned with ACK packets). In other words, read() throws SocketTimeoutException if it didn't read any bytes of actual data (DATA LAYER) in its allotted time.

    Read the article

  • Six Cool PHP Tricks You May Not Know

    <b>PHP Builder:</b> "Over the years I've come across some useful tricks in PHP that are not obvious, but are worth mentioning. This is not meant to be a comprehensive list of all the useful tricks that you can do with PHP."

    Read the article

  • Netbook without Windows?

    - by drewk
    I have been looking around for a netbook without Windows and with Ubuntu preinstalled. Almost all I have seen have Windows. The main issue is making sure that the computer ships with the right Ubuntu drivers and, hopefully, saving a little without having to pay for Windows. So far, I cannot find one.

    Read the article

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