Search Results

Search found 12130 results on 486 pages for 'paypal api'.

Page 41/486 | < Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >

  • mySQL .NET API - Delete all data from table

    - by keynesiancross
    Hi all, I'm trying to figure out if there is an easy way to delete all the data in a table using the mySQL .NET API. The only slightly more tricky part to this is that in the C# code, the business logic can be run in both cases where there is, or isn't, data in teh table. So in some regards I almost need an If statement... Currently I am using the following code, but it doesn't seem to ever delete data... string deleteSQL = "DELETE FROM `data`.`currentData`"; MySqlCommand cmd2 = new MySqlCommand(deleteSQL, conn); Any thoughts would be much appreciated! Cheers

    Read the article

  • Apache2 graceful restart stops proxying requests to passenger

    - by Rob
    Issue with apache mod proxy, it stops proxying requests after a graceful restart but not all the time. It seems to happen only on a Sunday when a graceful restart is triggered by logrotate. [Sun Sep 9 05:25:06 2012] [notice] SIGUSR1 received. Doing graceful restart [Sun Sep 9 05:25:06 2012] [notice] Apache/2.2.22 (Ubuntu) Phusion_Passenger/3.0.11 configured -- resuming normal operations [Sun Sep 9 05:25:06 2012] [error] proxy: ap_get_scoreboard_lb(492) failed in child 26153 for worker proxy:reverse [Sun Sep 9 05:25:06 2012] [error] proxy: ap_get_scoreboard_lb(486) failed in child 26153 for worker http://api.myservice.org/api [Sun Sep 9 05:25:06 2012] [error] proxy: ap_get_scoreboard_lb(487) failed in child 26153 for worker http://api.myservice.org/editor/$1 [Sun Sep 9 05:25:06 2012] [error] proxy: ap_get_scoreboard_lb(489) failed in child 26153 for worker http://api.myservice.org/build [Sun Sep 9 05:25:06 2012] [error] proxy: ap_get_scoreboard_lb(490) failed in child 26153 for worker http://api.myservice.org/help [Sun Sep 9 05:25:06 2012] [error] proxy: ap_get_scoreboard_lb(491) failed in child 26153 for worker http://api.myservice.org/motd.html [Sun Sep 9 05:25:06 2012] [error] proxy: ap_get_scoreboard_lb(480) failed in child 26153 for worker http://api.myservice.org/api [Sun Sep 9 05:25:06 2012] [error] proxy: ap_get_scoreboard_lb(481) failed in child 26153 for worker http://api.myservice.org/editor/$1 [Sun Sep 9 05:25:06 2012] [error] proxy: ap_get_scoreboard_lb(483) failed in child 26153 for worker http://api.myservice.org/build [Sun Sep 9 05:25:06 2012] [error] proxy: ap_get_scoreboard_lb(484) failed in child 26153 for worker http://api.myservice.org/help [Sun Sep 9 05:25:06 2012] [error] proxy: ap_get_scoreboard_lb(485) failed in child 26153 for worker http://api.myservice.org/motd.html [Sun Sep 9 05:25:06 2012] [error] proxy: ap_get_scoreboard_lb(479) failed in child 26153 for worker http://api.myservice.org/motd.html After these lines, the logs are flooded with 404's because the requests are not being proxied. It's worth noting that the destination is just another vhost on the same apache instance, but the vhost (http://api.myservice.org) is serving passenger (mod_rails) I was thinking that maybe there's some startup issues with the passenger workers not being ready during a graceful restart? After a full restart resolves it and everything returns to normal. //Edit Here's the vhost config, thanks :) <VirtualHost *:80> UseCanonicalName Off LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon <Directory /var/www/vhosts> RewriteEngine on AllowOverride All </Directory> RewriteEngine on RewriteCond /var/www/vhosts/%{SERVER_NAME} !-d RewriteCond /var/www/vhosts/%{SERVER_NAME} !-l RewriteRule ^ http://sitenotfound.myservice.org/ [R=302,L] VirtualDocumentRoot /var/www/vhosts/%0/current # Rewrite requests to /assets to map to the /var/file-store/<SERVER_NAME>/ RewriteMap lowercase int:tolower RewriteCond %{REQUEST_URI} ^/assets/ RewriteRule ^/assets/(.*)$ /var/file-store/${lowercase:%{SERVER_NAME}}/$1 # Map /login to /editor.html as it's far friendlier. RewriteCond %{REQUEST_URI} ^/login RewriteRule .* /editor.html [PT] # Forward some requests to the API ProxyPass /api http://api.myservice.org/api ProxyPass /site.json http://api.myservice.org/api/editor/site ProxyPassMatch ^/editor/(.*)$ http://api.myservice.org/editor/$1 ProxyPassMatch ^/api/(.*) http://api.myservice.org/api/$1 ProxyPass /build http://api.myservice.org/build ProxyPass /help http://api.myservice.org/help ProxyPass /motd.html http://api.myservice.org/motd.html <Proxy *> Order allow,deny Allow from all </Proxy> # TODO generate slightly more specific Error Documents for 401/403/500's, # but for now the 404 page is good enough ErrorDocument 401 /404.html ErrorDocument 403 /404.html ErrorDocument 404 /404.html ErrorDocument 500 /404.html </VirtualHost>

    Read the article

  • How to use Koala Facebook Graph API?

    - by reko
    I am a Rails newbie. I want to use Koala's Graph API. In my controller @graph = Koala::Facebook::API.new('myFacebookAccessToken') @hello = @graph.get_object("my.Name") When I do this, I get something like this { "id"=>"123456", "name"=>"First Middle Last", "first_name"=>"First", "middle_name"=>"Middle", "last_name"=>"Last", "link"=>"http://www.facebook.com/MyName", "username"=>"my.name", "birthday"=>"12/12/1212", "hometown"=>{"id"=>"115200305133358163", "name"=>"City, State"}, "location"=>{"id"=>"1054648928202133335", "name"=>"City, State"}, "bio"=>"This is my awesome Bio.", "quotes"=>"I am the master of my fate; I am the captain of my soul. - William Ernest Henley\r\n\r\n"Don't go around saying the world owes you a living. The world owes you nothing. It was here first.\" - Mark Twain", "work"=>[{"employer"=>{"id"=>"100751133333", "name"=>"Company1"}, "position"=>{"id"=>"105763693332790962", "name"=>"Position1"}, "start_date"=>"2010-08", "end_date"=>"2011-07"}], "sports"=>[{"id"=>"104019549633137", "name"=>"Sport1"}, {"id"=>"103992339636529", "name"=>"Sport2"}], "favorite_teams"=>[{"id"=>"105467226133353743", "name"=>"Fav1"}, {"id"=>"19031343444432369133", "name"=>"Fav2"}, {"id"=>"98027790139333", "name"=>"Fav3"}, {"id"=>"104055132963393331", "name"=>"Fav4"}, {"id"=>"191744431437533310", "name"=>"Fav5"}], "favorite_athletes"=>[{"id"=>"10836600585799922", "name"=>"Fava1"}, {"id"=>"18995689436787722", "name"=>"Fava2"}, {"id"=>"11156342219404022", "name"=>"Fava4"}, {"id"=>"11169998212279347", "name"=>"Fava5"}, {"id"=>"122326564475039", "name"=>"Fava6"}], "inspirational_people"=>[{"id"=>"16383141733798", "name"=>"Fava7"}, {"id"=>"113529011990793335", "name"=>"fava8"}, {"id"=>"112032333138809855566", "name"=>"Fava9"}, {"id"=>"10810367588423324", "name"=>"Fava10"}], "education"=>[{"school"=>{"id"=>"13478880321332322233663", "name"=>"School1"}, "type"=>"High School", "with"=>[{"id"=>"1401052755", "name"=>"Friend1"}]}, {"school"=>{"id"=>"11482777188037224", "name"=>"School2"}, "year"=>{"id"=>"138383069535219", "name"=>"2005"}, "type"=>"High School"}, {"school"=>{"id"=>"10604484633093514", "name"=>"School3"}, "year"=>{"id"=>"142963519060927", "name"=>"2010"}, "concentration"=>[{"id"=>"10407695629335773", "name"=>"c1"}], "type"=>"College"}, {"school"=>{"id"=>"22030497466330708", "name"=>"School4"}, "degree"=>{"id"=>"19233130157477979", "name"=>"c3"}, "year"=>{"id"=>"201638419856163", "name"=>"2011"}, "type"=>"Graduate School"}], "gender"=>"male", "interested_in"=>["female"], "relationship_status"=>"Single", "religion"=>"Religion1", "political"=>"Political1", "email"=>"[email protected]", "timezone"=>-8, "locale"=>"en_US", "languages"=>[{"id"=>"10605952233759137", "name"=>"English"}, {"id"=>"10337617475934611", "name"=>"L2"}, {"id"=>"11296944428713061", "name"=>"L3"}], "verified"=>true, "updated_time"=>"2012-02-24T04:18:05+0000" } How do I show this entire hash in the view in a good format? This is what I did from what ever I learnt.. In my view <% @hello.each do |key, value| %> <li><%=h "#{key.to_s} : #{value.to_s}" %></li> <% end %> This will get the entire thing converted to a list... It works awesome if its just one key.. but how to work with multiple keys and show only the information... something like when it outputs hometown : City, State rather than something like hometown : {"id"=>"115200305133358163", "name"=>"City, State"} Also for education if I just say education[school][name] to display list of schools attended? The error i get is can't convert String into Integer I also tried to do this in my controller, but I get the same error.. @fav_teams = @hello["favorite_teams"]["name"] Also, how can I save all these to the database.. something like just the list of all schools.. not their id no's? Update: The way I plan to save to my database is.. lets say for a user model, i want to save to database as :facebook_id, :facebook_name, :facebook_firstname, ...., :facebook_hometown .. here I only want to save name... when it comes to education.. I want to save.. school, concentration and type.. I have no idea on how to achieve this.. Looking forward for help! thanks!

    Read the article

  • What is the need for 'discoverability' in a REST API when the clients are not advanced enough to make use of it anyway?

    - by aditya menon
    The various talks I have watched and tutorials I scanned on REST seem to stress something called 'discoverability'. To my limited understanding, the term seems to mean that a client should be able to go to http://URL - and automatically get a list of things it can do. What I am having trouble understanding - is that 'software clients' are not human beings. They are just programs that do not have the intuitive knowledge to understand what exactly to do with the links provided. Only people can go to a website and make sense of the text and links presented and act on it. So what is the point of discoverability, when the client code that accesses such discoverable URLs cannot actually do anything with it, unless the human developer of the client actually experiments with the resources presented? This looks like the exact same thing as defining the set of available functions in a Documentation manual, just from a different direction and actually involving more work for the developer. Why is this second approach of pre-defining what can be done in a document external to the actual REST resources, considered inferior?

    Read the article

  • Was API hooking done as needed for Stuxnet to work? I don't think so

    - by The Kaykay
    Caveat: I am a political science student and I have tried my level best to understand the technicalities; if I still sound naive please overlook that. In the Symantec report on Stuxnet, the authors say that once the worm infects the 32-bit Windows computer which has a WINCC setup on it, Stuxnet does many things and that it specifically hooks the function CreateFileA(). This function is the route which the worm uses to actually infect the .s7p project files that are used to program the PLCs. ie when the PLC programmer opens a file with .s7p the control transfers to the hooked function CreateFileA_hook() instead of CreateFileA(). Once Stuxnet gains the control it covertly inserts code blocks into the PLC without the programmers knowledge and hides it from his view. However, it should be noted that there is also one more function called CreateFileW() which does the same task as CreateFileA() but both work on different character sets. CreateFileA works with ASCII character set and CreateFileW works with wide characters or Unicode character set. Farsi (the language of the Iranians) is a language that needs unicode character set and not ASCII Characters. I'm assuming that the developers of any famous commercial software (for ex. WinCC) that will be sold in many countries will take 'Localization' and/or 'Internationalization' into consideration while it is being developed in order to make the product fail-safe ie. the software developers would use UNICODE while compiling their code and not just 'ASCII'. Thus, I think that CreateFileW() would have been invoked on a WINCC system in Iran instead of CreateFileA(). Do you agree? My question is: If Stuxnet has hooked only the function CreateFileA() then based on the above assumption there is a significant chance that it did not work at all? I think my doubt will get clarified if: my assumption is proved wrong, or the Symantec report is proved incorrect. Please help me clarify this doubt. Note: I had posted this question on the general stackexchange website and did not get appropriate responses that I was looking for so I'm posting it here.

    Read the article

  • How to define template directives (from an API perspective)?

    - by Ralph
    Preface I'm writing a template language (don't bother trying to talk me out of it), and in it, there are two kinds of user-extensible nodes. TemplateTags and TemplateDirectives. A TemplateTag closely relates to an HTML tag -- it might look something like div(class="green") { "content" } And it'll be rendered as <div class="green">content</div> i.e., it takes a bunch of attributes, plus some content, and spits out some HTML. TemplateDirectives are a little more complicated. They can be things like for loops, ifs, includes, and other such things. They look a lot like a TemplateTag, but they need to be processed differently. For example, @for($i in $items) { div(class="green") { $i } } Would loop over $items and output the content with the variable $i substituted in each time. So.... I'm trying to decide on a way to define these directives now. Template Tags The TemplateTags are pretty easy to write. They look something like this: [TemplateTag] static string div(string content = null, object attrs = null) { return HtmlTag("div", content, attrs); } Where content gets the stuff between the curly braces (pre-rendered if there are variables in it and such), and attrs is either a Dictionary<string,object> of attributes, or an anonymous type used like a dictionary. It just returns the HTML which gets plunked into its place. Simple! You can write tags in basically 1 line. Template Directives The way I've defined them now looks like this: [TemplateDirective] static string @for(string @params, string content) { var tokens = Regex.Split(@params, @"\sin\s").Select(s => s.Trim()).ToArray(); string itemName = tokens[0].Substring(1); string enumName = tokens[1].Substring(1); var enumerable = data[enumName] as IEnumerable; var sb = new StringBuilder(); var template = new Template(content); foreach (var item in enumerable) { var templateVars = new Dictionary<string, object>(data) { { itemName, item } }; sb.Append(template.Render(templateVars)); } return sb.ToString(); } (Working example). Basically, the stuff between the ( and ) is not split into arguments automatically (like the template tags do), and the content isn't pre-rendered either. The reason it isn't pre-rendered is because you might want to add or remove some template variables or something first. In this case, we add the $i variable to the template variables, var templateVars = new Dictionary<string, object>(data) { { itemName, item } }; And then render the content manually, sb.Append(template.Render(templateVars)); Question I'm wondering if this is the best approach to defining custom Template Directives. I want to make it as easy as possible. What if the user doesn't know how to render templates, or doesn't know that he's supposed to? Maybe I should pass in a Template instance pre-filled with the content instead? Or maybe only let him tamper w/ the template variables, and then automatically render the content at the end? OTOH, for things like "if" if the condition fails, then the template wouldn't need to be rendered at all. So there's a lot of flexibility I need to allow in here. Thoughts?

    Read the article

  • How are undocumented functions discovered?

    - by Paska
    Hi all, I've always wondered how do you find undocumented / private API ? Example the Apple undocumented / private API, Play Station, Windows Phone 7, Win32 Kernel, Windows API, hidden callback, etc... What tools do hackers use to find out about private and undocumented functions? Where can I read about peoples' experiences delving into private APIs and reverse engineering techniques which reveal the secrets which are normally explained in API documentation? thanks, A

    Read the article

  • DirectionsDistance in google maps API v3

    - by Yawn
    Hey, I'm trying to work out how to use this to get the distance from the successful directions: http://code.google.com/apis/maps/documentation/v3/reference.html#DirectionsDistance This is the code I have so far: var googleMaps = { // HTML Nodes fromInput: google_maps_from, toInput: google_maps_to, // API Objects dirService: new google.maps.DirectionsService(), dirRenderer: new google.maps.DirectionsRenderer(), map: null, showDirections: function(dirResult, dirStatus) { if (dirStatus != google.maps.DirectionsStatus.OK) { //Here we'll handle the errors a bit better :P alert('Directions failed: ' + dirStatus); return; } else { //Get the distance here //onGDirectionsLoad(); } // Show directions googleMaps.dirRenderer.setMap(googleMaps.map); googleMaps.dirRenderer.setPanel(document.getElementById("directions")); googleMaps.dirRenderer.setDirections(dirResult); }, getSelectedTravelMode: function() { return google.maps.DirectionsTravelMode.DRIVING; }, getSelectedUnitSystem: function() { return google.maps.DirectionsUnitSystem.METRIC; }, getDirections: function() { var fromStr = googleMaps.fromInput; var toStr = googleMaps.toInput; var dirRequest = { origin: fromStr, destination: toStr, travelMode: googleMaps.getSelectedTravelMode(), unitSystem: googleMaps.getSelectedUnitSystem(), provideTripAlternatives: true }; googleMaps.dirService.route(dirRequest, googleMaps.showDirections); }, init: function() { googleMaps.map = new google.maps.Map(document.getElementById("map_canvas"), { zoom: 13, mapTypeId: google.maps.MapTypeId.ROADMAP }); // Show directions onload googleMaps.getDirections(); } }; // Onload handler to fire off the app. google.maps.event.addDomListener(window, 'load', googleMaps.init); I could do this just fine in v2, just having trouble working out the v3 equivalent :x

    Read the article

  • OAuth with Google Reader API using Objective C

    - by Dylan
    I'm using the gdata OAuth controllers to get an OAuth token and then signing my requests as instructed. [auth authorizeRequest:myNSURLMutableRequest] It works great for GET requests but POSTs are failing with 401 errors. I knew I wouldn't be able to remain blissfully ignorant of the OAuth magic. The Google Reader API requires parameters in the POST body. OAuth requires those parameters to be encoded in the signature like they were on the query string. It doesn't appear the gdata library does this. I tried hacking it in the same way it handles the query string but no luck. This is so difficult to debug as all I get is a 401 from the Google black box and I'm left to guess. I really want to use OAuth so I don't have to collect login credentials from my users but I'm about to scrap it and go with the simpler cookie based authentication that is more mature. It's possible I'm completely wrong about the reason it's failing. This is my best guess. Any suggestions for getting gdata to work or maybe an alternative iphone friendly OAuth library?

    Read the article

  • how to get all group images in facebook using FACEBOOK API

    - by From.ME.to.YOU
    Hello i'm trying to get all the images from a facebook group using facebook API i have a problem i can't get all the photos using $facebook->api_client->call_method('Photos.get', array('subj_id' => $uid)); http://wiki.developers.facebook.com/index.php/Photos.get what i'm using now is the method $albums = $facebook->api_client->photos_getAlbums($uid, NULL); http://wiki.developers.facebook.com/index.php/Photos.getAlbums and then loop for ever album on $facebook->api_client->call_method('Photos.get', array('subj_id' => $uid)); then i add every new array results to my big array $big_array = array_merge($big_array,$result_array_from_that_call); 2 problems occurs here : 1- sometimes this calls fails - i think because of too many calls per second - 2- the request takes a v.long time to process is there a better way to do that? Thanks guys Cheers EDIT :: i tried to get all the images using $facebook->api_client->call_method('Photos.get', array('subj_id' => $uid)); and using $uid as the group ID but that's doesn't work " don't know why maybe because all the images is listed in groups "

    Read the article

  • Youtube API - How to limit results for pagination?

    - by worchyld
    I want to grab a user's uploads (ie: BBC) and limit the output to 10 per page. Whilst I can use the following URL: http://gdata.youtube.com/feeds/api/users/bbc/uploads/?start-index=1&max-results=10 The above works okay. I want to use the query method instead: The Zend Framework docs: http://framework.zend.com/manual/en/zend.gdata.youtube.html State that I can retrieve videos uploaded by a user, but ideally I want to use the query method to limit the results for a pagination. The query method is on the Zend framework docs (same page as before under the title 'Searching for videos by metadata') and is similar to this: [code] $yt = new Zend_Gdata_YouTube(); $query = $yt-newVideoQuery(); $query-setTime('today'); $query-setMaxResults(10); $videoFeed = $yt-getUserUploads( NULL, $query ); // Output print ''; foreach($videoFeed as $video): print '' . $video-title . ''; endforeach; print ''; [/code] The problem is I can't do $query-setUser('bbc'). I tried setAuthor but this returns a totally different result. Ideally, I want to use the query method to grab the results in a paginated fashion. How do I use the $query method to set my limits for pagination? Thanks.

    Read the article

  • facebook connect api "Cannot use string offset as an array in" error

    - by Rees
    Please help! I have been grappling with this error for days and I cannot for the life of me figure it out. I am using facebook connect and fetching a "contact_email" attribute using their api method users_getInfo. The issue is that when I execute this PHP file, i get this error: "Cannot use string offset as an array in...". This error specifically refers to this line of code: $firstName=$user_details[0]['contact_email']; I'm thinking this is because the user_getInfo method is not returning any results... However, the most ridiculous part about all this is that, I can execute the code below several dozens of times in a row SUCCESSFULLY without the above error, BUT THEN randomly without changing ANY code at all, I will suddenly encounter this error, in which case it will begin to give me an error several dozens of times, and then AGAIN without any code change, start executing successfully again. This odd behavior occurs regardless of the attribute i am fetching.. (contact_email, first_name, last_name, etc.). I am running php 5.2.11. Is there something I'm missing?? Please Help! include_once 'site/fbconnect/config.php'; //has $api_key and $secret defined. include_once 'site/facebook-platform/client/facebook.php'; global $api_key,$secret; $fb=new Facebook($api_key,$secret); $fb-require_login(); $fb_user=$fb-get_loggedin_user(); $user_details=$fb-api_client-users_getInfo($fb_user,array('last_name','first_name','contact_email')); $email=$user_details[0]['contact_email']; $firstName=$user_details[0]['first_name']; $lastName=$user_details[0]['last_name'];

    Read the article

  • Trouble with Google Finance API

    - by BANSAL MOHIT
    When i am trying to buy shares using google finance api i am getting an exception. Please help run: Enter user ID: **@gmail.com Enter user password: ** Enter transaction type: Buy Enter transaction date (yyyy-mm-dd): 2010-03-10 Enter number of shares (optional, e.g. 100.0): Enter price (optional, e.g. 141.14): 12.0 Enter commission (optional, e.g. 20.0): 23.0 Enter currency (optional, e.g. USD, EUR, JPY): USD Enter any notes: Notes Enter portfolio ID: 1 Enter ticker (EXCHANGE:SYMBOL): NASDAQ:INFY Inserting Entry at location: http://finance.google.com/finance/feeds/default/portfolios/1/positions/NASDAQ:INFY/transactions The server had a problem handling your request. com.google.gdata.util.ServiceForbiddenException: Forbidden Exception message unavailable at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:561) at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:563) at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:536) at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:515) at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:535) at com.google.gdata.client.Service.insert(Service.java:1347) at com.google.gdata.client.GoogleService.insert(GoogleService.java:599) at financetester.Main.insertTransactionEntry(Main.java:169) at financetester.Main.main(Main.java:81) BUILD SUCCESSFUL (total time: 1 minute 4 seconds)

    Read the article

  • Facebook events api: Event member (FQL)

    - by sunil-khedar
    I am fetching the event members for facebook events. Till yesterday I was getting the proper counts of members of an event. But suddenly the counts have following issues: For lot of plans on every consecutive request, I am getting random number of members. Strange issue. Seems facebook servers are not synced properly or something similar. Earlier for the same query string (mentioned below), I was getting the correct counts. But now the count is much less. It seems that at least for a few events now they are sending only the members who are connected with our application (we are using facebook connect). Example: for the following query currently I am getting "31" members. But on event page members count is much more. FQL: FB.Facebook.apiClient.fql_query('SELECT uid, eid, rsvp_status FROM event_member WHERE eid=336671213618', function(result, error){alert(result.length);}); Event page: http://www.facebook.com/event.php?eid=109411842404023 Is there any recent change in facebook API or policies? Thanks in advance.

    Read the article

  • Exporting non-public type through public API

    - by feelgood
    What if I have few factory methods returning non-public type and pairing set of methods which gives variables of this non-public type? This results with titled warning message in NetBeans. In result public API will contain only two pairing sets of methods. The reason is to make my type hierarchy sealed (like seald classes in Scala) and allow users only instantiate these types through factory methods. So we get DSL in some sense. For example, Schedule class represented by calendar fields' contraints. There are some types of contraints - Range, Singleton, List, FullSet - with NumberSet interface as a root. We don't want to expose these types and how Schedule interact with them. We just want the specification from the user. So we make NumberSet package-private. In class Schedule we create few factory-methods for constraints: NumberSet singleton(int value); NumberSet range(int form, int to); NumberSet list(NumberSet ... components); and some methods for creating Schedule object: Schedule everyHour(NumberSet minutes); Schedule everyDay(NumberSet minutes, NumberSet hours); User can only use them in the manner: Schedule s = Schedule.everyDay( singleton(0), list(range(10-15), singleton(8)) ); Is it bad idea?

    Read the article

  • Facebook connect PHP API - friends_get() returns empty array

    - by Soufiane Hassou
    Couple of hours ago I succeed to get friends_get() to return an array of friends, but, now I don't know if it is my fault or something is wrong in facebooks' end (API problems?). Anyway I used a code from their documentation: <?php require_once 'facebook-platform/php/facebook.php'; $appapikey = ''; //CHANGE THIS $appsecret = ''; //CHANGE THIS $facebook = new Facebook($appapikey, $appsecret); //$user_id = $facebook->require_login(); $fb_user=$facebook->get_loggedin_user(); //$fb_user = $facebook->user; $friends = $facebook->api_client->friends_get(); $friends = array_slice($friends, 0, 10); $i=0; foreach ($friends as $friend) { $personArray = $facebook->api_client->users_getInfo($friend,"name"); $person[$i]=$personArray[0]; $i++; } $i=0; foreach ($person as $f) { echo " ".$f['name']; //MORE DETAILS HERE IN STEP 2 echo "<br />"; $i++; } echo "<br />"; ?> The login is working great, but, I can't retrieve the list of friends and I test also with api_client->pages_isFan and it doesn't seem to work too (says not a fan while the user is).

    Read the article

  • Does my API design violate RESTful principles?

    - by peta
    Hello everybody, I'm currently (I try to) designing a RESTful API for a social network. But I'm not sure if my current approach does still accord to the RESTful principles. I'd be glad if some brighter heads could give me some tips. Suppose the following URI represents the name field of a user account: people/{UserID}/profile/fields/name But there are almost hundred possible fields. So I want the client to create its own field views or use predefined ones. Let's suppose that the following URI represents a predefined field view that includes the fields "name", "age", "gender": utils/views/field-views/myFieldView And because field views are kind of higher logic I don't want to mix support for field views into the "people/{UserID}/profile/fields" resource. Instead I want to do the following: utils/views/field-views/myFieldView/{UserID} Though Leonard Richardson & Sam Ruby state in their book "RESTful Web Services" that a RESTful design is somehow like an "extreme object oriented" approach, I think that my approach is object oriented and therefore accords to RESTful principles. Or am I wrong? When not: Are such "object oriented" approaches generally encouraged when used with care and in order to avoid query-based REST-RPC hybrids? Thanks for your feedback in advance, peta

    Read the article

  • Dynamic Google Maps API InfoWindow HTML Content

    - by Peter Hanneman
    I am working in Flash Builder 4 with Google Map's ActionScript API. I have created a map, loaded some custom markers onto it and added some MouseEvent listeners to each marker. The trouble comes when I load an InfoWindow panel. I want to dynamically set the htmlContent based off of information stored in a database. The trouble is that this information can change every couple of seconds and each marker has a unique data set so I can not statically set it at the time I actually create the markers. I have a method that will every minute or so load all of the records from my database into an Object variable. Everything I need to display in the htmlContent is contained in this object under a unique identifier. The basic crux of the problem is that there is no way for me to uniquely identify an info window, so I can not determine what information to pull into the panel. marker.addEventListener(MapMouseEvent.ROLL_OVER, function(e:MapMouseEvent):void { showInfoWindow(e.latLng) }, false, 0, false); That is my mouse event listener. The function I call, "showInfowindow" looks like this: private function showInfoWindow(latlng:LatLng):void { var options:InfoWindowOptions = new InfoWindowOptions({title: appData[*I NEED A UNIQUE ID HERE!!!*].type + " Summary", contentHTML: appData[*I NEED A UNIQUE ID HERE!!!*].info}); this.map.openInfoWindow(latlng, options); } I thought I was onto something by being able to pass a variable in my event listener declaration, but it simply hates having a dynamic variable passed through, it only returns the last value use. Example: marker.addEventListener(MapMouseEvent.ROLL_OVER, function(e:MapMouseEvent):void { showInfoWindow(e.latLng, record.unit_id) }, false, 0, false); That solution is painfully close to working. I iterate through a loop to create my markers when I try the above solution and roll over a marker I get information, but every marker's information reflects whatever information the last marker created had. I apologize for the long explaination but I just wanted to make my question as clear as possible. Does anyone have any ideas about how to patch up my almost-there-solution that I posted at the bottom or any from the ground up solutions? Thanks in advance, Peter Hanneman

    Read the article

  • Java Sound API: Capturing sound output from a Target Port

    - by Kyle Kampy
    I'm writing a simple piece of software that streams audio over LAN. I have all of the network parts implemented, but what I'm stumbling on is using the Java Sound API. I have successfully captured audio from the microphone, and line-in, but I can't seem to capture from any target ports, like the speakers. My question is, is it possible to capture from the Master target port? Here is the piece of code that works on initializing the line. private boolean startCapture(){ try{ DataLine.Info info = new DataLine.Info( TargetDataLine.class, format); line = (TargetDataLine)AudioSystem.getLine(info); audioBuffer = new byte[bufferSize]; line.open(format); line.start(); return true; }catch(Exception e){ System.out.println("Exception thrown when capturing audio:\n" + e); return false; } } Running the code like this will just use the microphone as my line. Here is info about my sound system. Most important is probably the fact that I'm running Linux. Thanks in advance for any and all help you can give me.

    Read the article

  • Node.js fetching Twitter Streaming API - EADDRNOTAVAIL

    - by Jordan Scales
    I have the following code written in node.js to access to the Twitter Streaming API. If I curl the URL below, it works. However, I cannot get it to work with my code. var https = require('https'); https.request('https://USERNAME:[email protected]/1.1/statuses/sample.json', function(res) { res.on('data', function(chunk) { var d = JSON.parse(chunk); console.log(d); }); }); But I receive the following node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ Error: connect EADDRNOTAVAIL at errnoException (net.js:642:11) at connect (net.js:525:18) at Socket.connect (net.js:589:5) at Object.<anonymous> (net.js:77:12) at new ClientRequest (http.js:1073:25) at Object.request (https.js:80:10) at Object.<anonymous> (/Users/jordan/Projects/twitter-stream/app.js:3:7) at Module._compile (module.js:441:26) at Object..js (module.js:459:10) at Module.load (module.js:348:31) If anyone can offer an alternative solution, or explain to me why this doesn't work, I would be very grateful.

    Read the article

  • Returning a Value From the Bit.ly JS API Callback

    - by mtorbin
    Hey all, I am attempting to turn this "one shot" script into something more extensible. The problem is that I cannot figure out how to get the callback function to set a value outside of itself (please note that references to the Bit.ly API and the prototype.js frame work which are required have been left out due to login and apiKey information): CURRENTLY WORKING CODE var setShortUrl = function(data) { var resultOBJ, myURL; for(x in data.results){resultOBJ = data.results[x];} for(key in resultOBJ){if(key == "shortUrl"){myURL = resultOBJ[key];}} alert(myURL); } BitlyClient.shorten('http://www.thinkgeek.com', 'setShortUrl'); PROPOSED CHANGES var setShortUrl = function(data) { var resultOBJ, myURL; for(x in data.results){resultOBJ = data.results[x];} for(key in resultOBJ){if(key == "shortUrl"){myURL = resultOBJ[key];}} alert(myURL); return myURL; } var myTEST = BitlyClient.shorten('http://www.thinkgeek.com', 'setShortUrl'); alert(myTEST); As you can see this doesn't work the way I'm am expecting. If I could get a pointer in the right direction it would be most appreciated. Thanks, MT

    Read the article

  • Provisioning Api using java

    - by user268515
    Hi i'm working in java and tried to retrieve all the user in the domain for that i used Provisionin api............ Its working good But my idea is to Use 2-legged OAuth to retrieve the users from the domain Is it Possible? I dont how to specify the URL please Help me And i triede the following the program final String CONSUMER_KEY = "xxxxxxxxxx.com"; final String CONSUMER_SECRET = "12345678122154154df9"; final String DOMAIN = "xxxxxxxxxx.com"; GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters(); oauthParameters.setOAuthConsumerKey(CONSUMER_KEY); oauthParameters.setOAuthConsumerSecret(CONSUMER_SECRET); oauthParameters.setOAuthType(OAuthType.TWO_LEGGED_OAUTH); OAuthHmacSha1Signer signer = new OAuthHmacSha1Signer(); URL feedUrl = new URL("https://apps-apis.google.com/a/feeds/" + DOMAIN + "/user/2.0/[email protected]"); userService = new UserService("Myapplication"); userService.setOAuthCredentials(oauthParameters, signer); userService.useSsl(); UserFeed allUsers = new UserFeed(); UserFeed allpage; Link nextLink; do { allpage = userService.getFeed(feedUrl, UserFeed.class); allUsers.getEntries().addAll(allpage.getEntries()); nextLink = allpage.getLink(Link.Rel.NEXT, Link.Type.ATOM); if (nextLink != null) { feedUrl = new URL(nextLink.getHref()); } }while (nextLink != null); return allUsers; } Its returing the error as com.google.gdata.util.AuthenticationException: Unknown authorization header

    Read the article

  • JPA2 Criteria API creates invalid SQL when using groupBy

    - by Stephan
    JPA2 with the Criteria API seems to generate invalid SQL for PostgreSQL. For this code: Root<DBObjectAccessCounter> from = query.from(DBObjectAccessCounter.class); Path<DBObject> object = from.get(DBObjectAccessCounter_.object); Expression<Long> sum = builder.sumAsLong(from.get(DBObjectAccessCounter_.count)); query.multiselect(object, sum).groupBy(object); I get the following exception: ERROR: column "dbobject1_.id" must appear in the GROUP BY clause or be used in an aggregate function The generated SQL is: select dbobjectac0_.object_id as col_0_0_, sum(dbobjectac0_.count) as col_1_0_, dbobject1_.id as id1001_, dbobject1_.name as name1013_, dbobject1_.lastChanged as lastChan2_1013_, dbobject1_.type_id as type3_1013_ from DBObjectAccessCounter dbobjectac0_ inner join DBObject dbobject1_ on dbobjectac0_.object_id=dbobject1_.id group by dbobjectac0_.object_id Obviously, the first item of the select statement (dbobjectac0_.object_id) does not match the group by clause. Simplified example It does not even work for this simple example: Root<DBObjectAccessCounter> from = query.from(DBObjectAccessCounter.class); Path<DBObject> object = from.get(DBObjectAccessCounter_.object); query.select(object).groupBy(object); which returns select dbobject1_.id as id924_, dbobject1_.name as name933_, dbobject1_.lastChanged as lastChan2_933_, dbobject1_.type_id as type3_933_ from DBObjectAccessCounter dbobjectac0_ inner join DBObject dbobject1_ on dbobjectac0_.object_id=dbobject1_.id group by dbobjectac0_.object_id Does anyone know how to fix this?

    Read the article

  • Problem with twitter API: cannot update status

    - by PainBringer
    I am trying to create Google Chrome extension that will send interesting links to twitter. But, I am unable to connect to the Twitter. The server gets my request, but the response is always the same: "You do not have permission to access /1/statuses/update.json on this server (403 Forbidden)." I am using Wireshark to inspect Http responses. Here is the code of the function i am using: function setStatus(msg) { var status = "status="+msg; var client = new XMLHttpRequest(); client.open("POST","http://api.twitter.com/1/statuses/update.json"); client.setRequestHeader("Authorization", "Basic <user credentials>"); client.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); client.onreadystatechange = function(){ if(client.readyState ==4){ //whatever } } client.send(status); Am I doing something wrong? I am using Basic Auth. I use this tool to do the encoding, and just put the result instead of . Also, can someone give me an example of OAuth?

    Read the article

  • How to use Festival Text To Speech C/C++ API

    - by Peeyush
    I want to use Festival TTS with my C++ programme. So i have downloaded all files form http://www.cstr.ed.ac.uk/downloads/festival/2.0.95/ then i start reading manual(http://www.cstr.ed.ac.uk/projects/festival/manual/festival_28.html) for C++ API but in manual they says that: In order to use Festival you must include festival/src/include/festival.h' which in turn will include the necessary other include files infestival/src/include' and speech_tools/include' you should ensure these are included in the include path for you your program. Also you will need to link your program withfestival/src/lib/libFestival.a', speech_tools/lib/libestools.a',speech_tools/lib/libestbase.a' and `speech_tools/lib/libeststring.a' as well as any other optional libraries such as net audio. " I am using UBUNTU 10.04(festival package is by default installed and i can use it form terminal by festival command) and GCC 4.4.3 but the problem is that i am new to GCC and i am not understanding which files i have to include in order to run my C++ code and i also don't know how to link libraries with my c++ code. So please tell me exactly which files i have to include and how to link with libraries if anyone already use festival tts with c++ then please post your code Thanks

    Read the article

< Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >