Posts Tagged ‘api’

stdClass Object problems

Monday, August 23rd, 2010

I’m struggling to parse the below data using PHP. An API returns it, and I’ve tried various syntaxes. How do I return the data in a non-object way? Or, what’s the syntax to call the data using the stdClass?

Could I convert this to one data based array, or even two? I’m lost when it comes to object-based data sets.

stdClass Object
(
    [0] => stdClass Object
        (
            [district] => stdClass Object
                (
                    [state] => NY
                    [number] => 29
                )

        )

    [1] => stdClass Object
        (
            [district] => stdClass Object
                (
                    [state] => NY
                    [number] => 26
                )

        )

)

When i create the object on my own, and then do a var_dump, I get this:

object(stdClass)#8 (2) {
  [0]=>
  object(stdClass)#4 (1) {
    ["district"]=>
    object(stdClass)#5 (2) {
      ["state"]=>
      string(2) "NY"
      ["number"]=>
      string(2) "29"
    }
  }
  [1]=>
  object(stdClass)#6 (1) {
    ["district"]=>
    object(stdClass)#7 (2) {
      ["state"]=>
      string(2) "NY"
      ["number"]=>
      string(2) "26"
    }
  }
}

stdClass Object problems

Monday, August 23rd, 2010

I’m struggling to parse the below data using PHP. An API returns it, and I’ve tried various syntaxes. How do I return the data in a non-object way? Or, what’s the syntax to call the data using the stdClass?

Could I convert this to one data based array, or even two? I’m lost when it comes to object-based data sets.

stdClass Object
(
    [0] => stdClass Object
        (
            [district] => stdClass Object
                (
                    [state] => NY
                    [number] => 29
                )

        )

    [1] => stdClass Object
        (
            [district] => stdClass Object
                (
                    [state] => NY
                    [number] => 26
                )

        )

)

When i create the object on my own, and then do a var_dump, I get this:

object(stdClass)#8 (2) {
  [0]=>
  object(stdClass)#4 (1) {
    ["district"]=>
    object(stdClass)#5 (2) {
      ["state"]=>
      string(2) "NY"
      ["number"]=>
      string(2) "29"
    }
  }
  [1]=>
  object(stdClass)#6 (1) {
    ["district"]=>
    object(stdClass)#7 (2) {
      ["state"]=>
      string(2) "NY"
      ["number"]=>
      string(2) "26"
    }
  }
}

Symbolic Link, not accessible from network computer. getting error ?The symbolic link cannot be followed because its type is disabled?

Monday, August 23rd, 2010

Hi,

I have created symbolic link for shared folder on my machine and this symbolic link is present in another share folder on same machine. i can access this folder content using symbolic link from the same machine. however when i try to access the symbolic link from another machine. i am getting access denied error on windows xp. and windows 2008 shows access denied error with “The symbolic link cannot be followed because its type is disabled”

i have also used fsutil behavior set SymlinkEvaluation R2R:1 L2R:1 R2L:1 to create symbolic link on my machine( windows 7). i have created symbolic link using kernel32 API CreateSymbolicLink.

i am usign following code to create symbolic link,

[DllImport("kernel32.dll")]
static extern bool CreateSymbolicLink(string lpSymlinkFileName, string lpTargetFileName, int dwFlags);
static int SYMLINK_FLAG_DIRECTORY = 1;

string finalTargetD = @”abhande-win2k8CopiedFiles”;
string sharedDirectory = @”abhande-xpSharedFiles”;

public static void CreateSymLink()
{
using (WindowsImpersonationContext ctx = WindowsIdentity.GetCurrent().Impersonate())
{

if(CreateSymbolicLink(sharedDirectory, finalTargetD, SYMLINK_FLAG_DIRECTORY))
{
//symbolic link created successfully
}
}

}

Do any one have idea why symbolic link is not accessible from another network machine.

Thanks Arvind

Google App Engine with Picasa and JavaScript preview

Monday, August 23rd, 2010

Hi

Does anyone have example code on Google App Engine platform with Picasa API and JavaScript preview?

Pete

OAuth Issue for Connecting to Twitter API to make user search (users/search)

Monday, August 23rd, 2010

I am using Twitter API for retrieving user information for specific name searches. The method I am using is users/search. You can find details of this method here: http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-users-search.

Right now I am trying to use OAuth in my application as Twitter announced that they will no longer support basic authentication. The issue with using QAuth is that I don’t require the users to connect to their Twitter account and so I can not generate user token. My application is using Twitter just for showing information about people, it’s not posting/updating anything. I will really appreciate if anyone has any suggestions on using OAuth for Twitter without using Twitter user’s login information.

Google Maps w/ counties overlay?

Monday, August 23rd, 2010

I have no experience working with Google Maps, but I’d like to embed a “Choose your county” map in my webapp. My app only targets California, so it only needs to support one state, but I can’t find any easy way to do this (without manually drawing overlay polygons for all the county lines).

I assumed I’d easily be able to find examples of “Choose your county”-style interfaces on Google somehow, but the only thing I found was this — http://maps.huge.info/county.htm — and I’m leaning towards hitting their API to pull the geometry for the whole state if I can’t find a better option.

Does anyone have any experience or insight to help make this a little easier? Thanks!

Anything below froyo can’t read method in 3rd party library

Sunday, August 22nd, 2010

I’m using the jexcel api in my android application. It works great on devices running Android 2.2, but any other device just gives a blank String when I try to get the contents of a cell.

I’ve narrowed the thing thats not working to the Cell.getContents() method in the jexcel api. All android version below 2.2 are able to get the workbook, get the sheets, get the number of sheets, and they can get the cells, but when trying to get the contents within that cell, it return a blank string.

Is there something wrong with the library, or is it an android problem

Anyone know how to get historical stock data for free in ASP.NET?

Sunday, August 22nd, 2010

I’m looking for an API that can be accessed via C# implementation where I can get access to free stock market historical information (index and individual companies).

Creating a leaderboard using Facebook APIs and the PHP SDK

Sunday, August 22nd, 2010

Hi All,

I’m a new Facebook developer. I’m creating a game and want to include a leader board.

I’d like to build a fairly detailed leader board including the following information:

1) Name
2) Pic_Square or profile_pic
3) A general location (UK, USA or LONDON, NY)
4) Score

I’m aware of how to get a current users basic information from the either the old REST API or the Graph API. However from what I understand of the Facebook rules I can’t store the information I want to use from the API.

This leads me to the conclusion I should be polling the Facebook API using the information I can store (FB user ID’s). When querying the API for specific user ID’s (the ones for the test users I have generated) API methods (user.getInfo and fql.query) return either just the ID of the user or the fields I have requested with null values.

When querying my own ID I can access all the data.

Are there any methods to obtain publicly available data via the any of the APIs?

Thanks for your help!

Ben

How to 3DES encrypt in Python using the M2Crypto wrapper?

Sunday, August 22nd, 2010

I have a working test of a hardware device that uses RSA encryption, in Python using M2Crypto. Now I need to test a similar device that uses 3DES encryption. But I can’t figure out how to use M2Crypto to do triple DES encryption.

I know it should be possible from this chart. But unfortunately the documentation of M2Crypto I’ve found is sketchy. (The homepage at http://chandlerproject.org/ seems to be gone, along with Chandler.)

I’ve searched for 3DES and “OpenSSL API” and found some hard to grok C code for decrypting which makes it look like I need to use M2Crypto.EVP.Cipher. But I haven’t found any examples of using it for DES. The closest I’ve found is this blog post on using it for AES encryption. It looks like I just need to figure out the correct arguments to M2Crypto.EVP.Cipher.__init__(). I’ll keep digging, but I thought it worth posting this question.