Search Results

Search found 1725 results on 69 pages for 'token'.

Page 18/69 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • Java to C# code converter

    - by acadia
    Hello, Are there any converters available that converts Java code to C#? I need to convert the below code into C# String token = new String(""); URL url1 =new URL( "http", domain, Integer.valueOf(portnum), "/Workplace/setCredentials?op=getUserToken&userId="+username+"&password="+password +"&verify=true"); URLConnection conn1=url1.openConnection(); ((HttpURLConnection)conn1).setRequestMethod("POST"); InputStream contentFileUrlStream = conn1.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(contentFileUrlStream)); token=br.readLine(); String encodedAPIToken = URLEncoder.encode(token); String doubleEncodedAPIToken ="ut=" + encodedAPIToken;//.substring(0, encodedAPIToken.length()-1); //String doubleEncodedAPIToken ="ut=" + URLEncoder.encode(encodedAPIToken); //String userToken = "ut=" + URLEncoder.encode(token, "UTF-8"); //URLEncoder.encode(token); String vsId = "vsId=" + URLEncoder.encode(docId.substring(5, docId.length()), "UTF-8"); url="http://" + domain + ":" + portnum + "/Workplace/getContent?objectStoreName=RMROS&objectType=document&" + vsId + "&" +doubleEncodedAPIToken; String vsId = "vsId=" + URLEncoder.encode(docId.substring(5, docId.length()), "UTF-8"); url="http://" + domain + ":" + portnum + "/Workplace/getContent?objectStoreName=RMROS&objectType=document&" + vsId + "&" +doubleEncodedAPIToken; Thanks in advance

    Read the article

  • RESTful principles question

    - by auser
    An intelligent coworker friend of mine brought up a question to me that I was uncertain how to answer and I'd like to pose it to the world. If a RESTful endpoint uses token-based authentication, aka a time-based token is required to access a resource and that token expires after a certain amount of time, would this violate the RESTful principle? In other words, if the same URL expires after a certain amount of time, so the resource returns a different response depending when it was requested, is that breaking REST?

    Read the article

  • In IIS6, how to provide authenticated access to static files on remote server

    - by frankadelic
    We have a library of ZIP files that we would like to make available for download at an ASP.NET site. The files are sitting on a NAS device that is accessible from out web farm. Here is our initial strategy: Map an IIS virtual directory to the shared drive at path /zipfiles Users can download the zip files when given the URL However, if users share links to the files, anyone can download them. We would instead like to make use of the ASP.NET forms authentication in our site to validate users' requests before initiating the file transfer. A few problems: A request for a zip file is handled by IIS, not ASP.NET. So it is not subject to forms authentication. In addition, we don't want ASP.NET to handle the request, because it uses up an ASP.NET thread and is not scalable for download of large files. So, configuring the asp.net dll to handle *.zip requests is not an option. Any ideas on this? One idea we've tossed around is this: Initial request for download will be for an ashx handler. This handler will, after authentication, generate a download token which is saved to a database. Then, the user is redirected to the file with token appended in QueryString (e.g. /files/xyz.zip?token=123456789). An ISAPI plugin will be used to check the token. Also, the token will expire after x amount of time. Any thoughts on this? I have not implemented an ISAPI plugin so I'm not sure if this will even work. I would like to avoid custom coding since security is an issue and I'd prefer to use a time-tested solution.

    Read the article

  • facebook graph api don´t publish to news feed

    - by rizidoro
    hi, im trying to update my news feed on facebook. Im using the new graph api. I can connect to graph, but when i try to publish some content to the feed object, nothing happens. here´s my code: <?php $token = "xxxx"; $fields = "message=test&access_token=$token"; $c = curl_init("http://graph.facebook.com/me/feed"); curl_setopt($c,"CURLOPT_POST", true); curl_setopt($c,"CURLOPT_POSTFIELDS",$fields); $r = curl_exec($c); print_r($r); this returns: {"error":{"type":"QueryParseException","message":"An active access token must be used to query information about the current user."}}1 then I try to pass access_token via GET: $c = curl_init("http://graph.facebook.com/me/feed?access_token=$token"); this returns: {"data":[]}1 Am I doing something wrong? thanks

    Read the article

  • SOAPUI Extract data from SOAP Response and use in REST request

    - by Adrian
    I have been looking at the answer to this question: Pulling details from response to new request SoapUI which is similar to what I am looking for but I can't get it to work. I have a small SOAPUI testsuite and I need to extract a value from the response of a SOAP request and then use this value in a subsequent REST request. The response to my SOAP request is: <ns0:session xmlns:ns0="http://www.someurl.com/la/la/v1_0"> <token>AQIC5wM2xAAIwMg==#</token> </ns0:session> so I need the token to use in my REST request. I know it involves using Property Transfer and some XPath / XQuery but I just can't get it right. At the moment my property transfer window points to Source: SOAP test Property: Response and has data(/session/token/text()) in the text box. In target it has Target: REST testcase Property: newProp and I have Use XQuery checked. Any help greatly appreciated. Thanks, Adrian

    Read the article

  • How to save bytes to an image and access it from Bottle

    - by Graham Smith
    I'm working on an API wrapper for Snapchat using Python and Bottle, but in order to return the file (retrieved by the Python script) I have to save the bytes (returned by Snapchat) to a .jpg file. I'm not quite sure how I will do this and still be able to access the file so that it can be returned. Here's what I have so far, but it returns a 404. @route('/image') def image(): username = request.query.username token = request.query.auth_token img_id = request.query.id return get_blob(username, token, img_id) def get_blob(usr, token, img_id): # Form URL and download encrypted "blob" blob_url = "https://feelinsonice.appspot.com/ph/blob?id={}".format(img_id) blob_url += "&username=" + usr + "&timestamp=" + str(timestamp()) + "&req_token=" + req_token(token) enc_blob = requests.get(blob_url).content # Save decrypted image FileUpload.save('/images/' + img_id + '.jpg') img = open('images/' + img_id + '.jpg', 'wb') img.write(decrypt(enc_blob)) img.close() return static_file(img_id + '.jpg', root='/images/')

    Read the article

  • How do I best do balanced quoting with Perl's Regexp::Grammars?

    - by Evan Carroll
    Using Damian Conway's Regexp::Grammars, I'm trying to match different balanced quoting ('foo', "foo", but not 'foo") mechanisms -- such as parens, quotes, double quotes, and double dollars. This is the code I'm currently using. <token: pair> \'<literal>\'|\"<literal>\"|\$\$<literal>\$\$ <token: literal> [\S]+ This generally works fine and allows me to say something like: <rule: quote> QUOTE <.as>? <pair> My question is how do I reform the output, to exclude the needles notation for the pair token? { '' => 'QUOTE AS \',\'', 'quote' => { '' => 'QUOTE AS \',\'', 'pair' => { 'literal' => ',', '' => '\',\'' } } }, Here, there is obviously no desire to have pair in between, quote, and the literal value of it. Is there a better way to match 'foo', "foo", and $$foo$$, and maybe sometimes ( foo ) without each time creating a needless pair token? Can I preprocess-out that token or fold it into the above? Or, write a better construct entirely that eliminates the need for it?

    Read the article

  • problem to create session of facebook

    - by khoyendra
    try { HttpClient http = new HttpClient(); http.setParams(new HttpClientParams()); //http.getHostConfiguration().setHost("http://www.facebook.com/"); http.setState(new HttpState()); String api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; String secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // String appId=124812364218050; //http://www.facebook.com/developers/editapp.php?app_id=124812364218050 FacebookRestClient client = new FacebookRestClient(api_key, secret); client.setIsDesktop(true); // String sessionKey = request.getParameter(FacebookParam.SESSION_KEY.toString()); // boolean b = client.users_setStatus("This is a test..."); // System.out.println("User Status RESULT : " + b); String token = client.auth_createToken(); final String loginId = "http://www.facebook.com/login.php"; GetMethod get = new GetMethod(loginId + "?api_key=" + api_key + "&v=1.0&auth_token=" +token); System.out.println("Get="+get); http.executeMethod(get); PostMethod post = new PostMethod(loginId); post.addParameter(new NameValuePair("api_key", api_key)); post.addParameter(new NameValuePair("v", "1.0")); post.addParameter(new NameValuePair("auth_token", token)); post.addParameter(new NameValuePair("fbconnect","true")); post.addParameter(new NameValuePair("return_session","true")); post.addParameter(new NameValuePair("session_key_only","true")); post.addParameter(new NameValuePair("req_perms","read_stream,publish_stream")); post.addParameter(new NameValuePair("email", email)); post.addParameter(new NameValuePair("pass", password)); System.out.println("Token ="+token); int postStatus = http.executeMethod(post); System.out.println("Response : " + postStatus); session = client.auth_getSession(token); // Here I am getting error System.out.println("Session string: " + session); long userid = client.users_getLoggedInUser(); System.out.println("User Id is : " + userid); } catch (Exception e) { e.printStackTrace(); } please solve my problem i cannot create session of facebook.

    Read the article

  • Create a Task list, with tasks without executing

    - by Ernesto Araya Eguren
    I have an async method private async Task DoSomething(CancellationToken token) a list of Tasks private List<Task> workers = new List<Task>(); and I have to create N threads that runs that method public void CreateThreads(int n) { tokenSource = new CancellationTokenSource(); token = tokenSource.Token; for (int i = 0; i < n; i++) { workers.Add(DoSomething(token)); } } but the problem is that those have to run at a given time public async Task StartAllWorkers() { if (0 < workers.Count) { try { while (0 < workers.Count) { Task finishedWorker = await Task.WhenAny(workers.ToArray()); workers.Remove(finishedWorker); finishedWorker.Dispose(); } if (workers.Count == 0) { tokenSource = null; } } catch (OperationCanceledException) { throw; } } } but actually they run when i call the CreateThreads Method (before the StartAllWorkers). I searched for keywords and problems like mine but couldn't find anything about stopping the task from running. I've tried a lot of different aproaches but anything that could solve my problem entirely. For example, moving the code from DoSomething into a workers.Add(new Task(async () => { }, token)); would run the StartAllWorkers(), but the threads will never actually start. There is another method for calling the tokenSource.Cancel().

    Read the article

  • How to define a static operator<<?

    - by Pietro M
    Is it possible to define a static insertion operator which operates on the static members of a class only? Something like: class MyClass { public: static std::string msg; static MyClass& operator<< (const std::string& token) { msg.append(token); return *this; // error, static } }; alternatively: static MyClass& operator<< (MyClass&, const std::string &token) { MyClass::msg.append(token); return ?; } This is how I would like to use it: MyClass << "message1" << "message2"; Thank you!

    Read the article

  • are push notification tokens unique across all apps for a single device?

    - by scootklein
    i will have multiple applications on the app store and 1 urban airship account to send push notifications to all of these devices. what i want to know is if each apple device has the same "push token" across all applications? this is more of a database architecture thing so that I don't duplicate a push token many times if one single device uses many of my apps if each apple device generates a unique push token for each application it has installed my architecture needs to change.

    Read the article

  • Java Client interoperating with WSE 3.0 Web Service

    - by Dee
    I have a Interoperable Security Token Service (STS) that authenticates the User and then issues a SAML token. I also have transaction services that expects the SAML token in the incoming SOAP request header. For a client to make a call to transaction service, it first needs to authenticate with the STS, get the SAML token and then make a call to the transaction services. The STS is an interoperable service and can be invoked from a Java client. The Transaction services are build using WSE 3.0 framework, but the WSDL that it generates is not good enough for a Java client to understand it. I want my Java client to explicitly call the STS and then using the received SAML token make a call to Transaction Services. I tried with Netbeans and Metro WSIT toolkit. I was able to call the Transaction Services if it were implemented using WCF. With WCF Transaction Service the WSDL generated has complete information using which the Java client can figure out how to call to STS and then call the WCF Transaction service. How can my Java client explicitly call the STS and then in turn call the WSE 3.0 transaction services?

    Read the article

  • PHP OAuth Twitter

    - by Sandhurst
    I have created a twitter app which I am using to post tweets. The problem that I am not able to resolve is everytime I have to allow access to my application. so lets say I need to tweet three messages, so all the three times I have to allow access to my app. I just need that once user has allowed access to my app, next time he should only be asked to allow acces is that when he/she relogins. Here's my code that I am using Share content on twitter"; include 'lib/EpiCurl.php'; include 'lib/EpiOAuth.php'; include 'lib/EpiTwitter.php'; include 'lib/secret.php'; $twitterObj = new EpiTwitter($consumer_key, $consumer_secret); $oauth_token = $_GET['oauth_token']; if($oauth_token == '') { $url = $twitterObj-getAuthorizationUrl(); echo ""; echo "Sign In with Twitter"; echo ""; } else { $twitterObj-setToken($_GET['oauth_token']); $token = $twitterObj-getAccessToken(); $twitterObj-setToken($token-oauth_token, $token-oauth_token_secret); $_SESSION['ot'] = $token-oauth_token; $_SESSION['ots'] = $token-oauth_token_secret; $twitterInfo= $twitterObj-get_accountVerify_credentials(); $twitterInfo-response; $username = $twitterInfo-screen_name; $profilepic = $twitterInfo-profile_image_url; include 'update.php'; } if(isset($_POST['submit'])) { $msg = $_REQUEST['tweet']; $twitterObj-setToken($_SESSION['ot'], $_SESSION['ots']); $update_status = $twitterObj-post_statusesUpdate(array('status' = $msg)); $temp = $update_status-response; header("Location: MessageStatus.html"); exit(); } ?

    Read the article

  • VS2010 final does only link project on "rebuild all", not on "build changed"

    - by Sam
    I've just migrated a solution containing c++ and c# projects from VS2008 to VS2010 and got a strange problem. When I select "rebuild all", everything compiles and links as I would expect it to do. Then I change some c++ source file (just add a space), build the project, I get several thousands of linking errors like these: GDlgPackerListe.obj : error LNK2028: Nicht aufgelöstes Token (0A0000C7) ""public: bool __thiscall LList::Add(class LBString const &)" (?Add@LList@@$$FQAE_NABVLBString@@@Z)", auf das in Funktion ""public: virtual void __thiscall LRcPackerListe::HookRunReport(class LFortschritt &)" (?HookRunReport@LRcPackerListe@@$$FUAEXAAVLFortschritt@@@Z)" verwiesen wird. Db_Lieferschein2.obj : error LNK2020: Nicht aufgelöstes Token (0A0000E6) "public: bool __thiscall LList::Add(class LBString const &)" (?Add@LList@@$$FQAE_NABVLBString@@@Z). bmed.obj : error LNK2028: Nicht aufgelöstes Token (0A00014D) ""public: bool __thiscall LList::Add(class LBString const &)" (?Add@LList@@$$FQAE_NABVLBString@@@Z)", auf das in Funktion ""public: virtual long __thiscall MENUKB::Methode(long,long)" (?Methode@MENUKB@@$$FUAEJJJ@Z)" verwiesen wird. GDlgPackerListe.obj : error LNK2028: Nicht aufgelöstes Token (0A0000C9) ""public: void __thiscall LList::Sort(void)" (?Sort@LList@@$$FQAEXXZ)", auf das in Funktion ""public: virtual void __thiscall LRcPackerListe::HookRunReport(class LFortschritt &)" (?HookRunReport@LRcPackerListe@@$$FUAEXAAVLFortschritt@@@Z)" verwiesen wird. Dlg_Gutschrift.obj : error LNK2020: Nicht aufgelöstes Token (0A000128) "public: virtual __thiscall LBaseType::~LBaseType(void)" (??1LBaseType@@$$FUAE@XZ). Module_Damals.lib(svSuchAltLink.obj) : error LNK2001: Nicht aufgelöstes externes Symbol ""public: __thiscall SView::SView(void)" (??0SView@@QAE@XZ)". Module_Damals.lib(svShowEMF.obj) : error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual void __thiscall SView::HookValueChanged(unsigned __int64)" (?HookValueChanged@SView@@UAEX_K@Z)". When I hit "rebuild all" it recompiles and links without any errors or even warnings and produces a working exe. I'm using Visual Studio 2010 final (german edition). Whats going on here? Or, more important: how do I get the linker to work correctly??

    Read the article

  • Critique my heap debugger

    - by FredOverflow
    I wrote the following heap debugger in order to demonstrate memory leaks, double deletes and wrong forms of deletes (i.e. trying to delete an array with delete p instead of delete[] p) to beginning programmers. I would love to get some feedback on that from strong C++ programmers because I have never done this before and I'm sure I've done some stupid mistakes. Thanks! #include <cstdlib> #include <iostream> #include <new> namespace { const int ALIGNMENT = 16; const char* const ERR = "*** ERROR: "; int counter = 0; struct heap_debugger { heap_debugger() { std::cerr << "*** heap debugger started\n"; } ~heap_debugger() { std::cerr << "*** heap debugger shutting down\n"; if (counter > 0) { std::cerr << ERR << "failed to release memory " << counter << " times\n"; } else if (counter < 0) { std::cerr << ERR << (-counter) << " double deletes detected\n"; } } } instance; void* allocate(size_t size, const char* kind_of_memory, size_t token) throw (std::bad_alloc) { void* raw = malloc(size + ALIGNMENT); if (raw == 0) throw std::bad_alloc(); *static_cast<size_t*>(raw) = token; void* payload = static_cast<char*>(raw) + ALIGNMENT; ++counter; std::cerr << "*** allocated " << kind_of_memory << " at " << payload << " (" << size << " bytes)\n"; return payload; } void release(void* payload, const char* kind_of_memory, size_t correct_token, size_t wrong_token) throw () { if (payload == 0) return; std::cerr << "*** releasing " << kind_of_memory << " at " << payload << '\n'; --counter; void* raw = static_cast<char*>(payload) - ALIGNMENT; size_t* token = static_cast<size_t*>(raw); if (*token == correct_token) { *token = 0xDEADBEEF; free(raw); } else if (*token == wrong_token) { *token = 0x177E6A7; std::cerr << ERR << "wrong form of delete\n"; } else { std::cerr << ERR << "double delete\n"; } } } void* operator new(size_t size) throw (std::bad_alloc) { return allocate(size, "non-array memory", 0x5AFE6A8D); } void* operator new[](size_t size) throw (std::bad_alloc) { return allocate(size, " array memory", 0x5AFE6A8E); } void operator delete(void* payload) throw () { release(payload, "non-array memory", 0x5AFE6A8D, 0x5AFE6A8E); } void operator delete[](void* payload) throw () { release(payload, " array memory", 0x5AFE6A8E, 0x5AFE6A8D); }

    Read the article

  • [Facebook Graph API - Android] I want to know the HTTPSConnection redirected to which URL?

    - by Mohammad Abdelaziz
    I am building an application that uses the Facebook Graph API. To get the access token I should send the following request https://graph.facebook.com/oauth/authorize? client_id=...& redirect_uri=http://www.example.com/callback It redirects to the redirect_uri with the code to be used as access token. How can I capture that the HttpsURLConnection is redirected and how to get the code? Is it possible or I need to have server that gets the access token?

    Read the article

  • Check something before django server starts

    - by Vijay Shankar Kalyanaraman
    I am running my api behind a django server and say I have a one time token that is needed by the django application and used through out its existence until the process quits. To check if I can proceed and serve requests (using the django server) I need to validate this token against a database entry. Now, I can have a script that hits the db, then issues the run server command if the token is valid. But if the db used by the django applications change, I will have to change the script also to point to the same db. Is there a way I can pass this token into the runserver command as an additional parameter (along with hostname:port) and validate this before django serves any requests? How can I access this parameter that is sent into ./manage.py runserver. Thanks.

    Read the article

  • Twitter oauth php problems

    - by Patrick Gates
    I'm writing some backend script for a twitter app and heres how it's going On the app you click a button that sends you to login.php on my server which logs into my database connects to twitter with my consumer key and secret: $to = new TwitterOAuth($consumer_key, $consumer_secret); $tok = $to->getRequestToken(); $request_link = $to->getAuthorizeURL($tok); and then writes the token and secret to the database, sets a session equal to the id in the database of the token and secret and then redirects to the "$request_link" You then go through the process of logging in and such on twitter and it redirects you to callback.php on my server Callback.php consists of logging into the database again, getting the new token and secret, and then writing the new token and secret to the database and then prompts you to go back to the app Then on the app, all I'm trying to do is access the basic credentials$to->get('account/verify_credentials') and it keeps coming back "could not authenticate you" What am I doing wrong?? Thank you for all the help :)

    Read the article

  • Can't authenticate mobile client with node.js (using passport.js)

    - by Pazinio
    I'm trying to build some CRUD application with node.js as a back-end API (express) and web-app (backbone) and mobile client (native android) as front-ends.(I'm node.js beginner) My server solution is based on the following great tutorial 'easy-node-authentication'. In my android app I have managed to get the user Google-Token after I completed the authentication step with Google Plus SDK.(mobile to google-plus directly request). I'm trying to understand and find right and elegant way to re-use a given google-token and authenticate again my android user through Google-Plus account to ensure the mobile client holds real token, then add a new entry (id, token, email, name) to my users table DB within my node back-end. The question is: what should be my next step in case I want to keep my back-end without changes? should I send a GET request with the token as a cookie to /auth/google? maybe to /auth/google/callback? another URL? Does this make sense at all? Please note: I'm aware to the fact the mentioned above 'easy-node-auth' solution is based on sessions and cookies. having said that, i'm still trying to understand if there is a convenient way to integrate both (android and node) as it works good for my web-app and node. Thanks in advance.

    Read the article

  • How to reserve public API to internal usage in .NET?

    - by mark
    Dear ladies and sirs. Let me first present the case, which will explain my question. This is going to be a bit long, so I apologize in advance :-). I have objects and collections, which should support the Merge API (it is my custom API, the signature of which is immaterial for this question). This API must be internal, meaning only my framework should be allowed to invoke it. However, derived types should be able to override the basic implementation. The natural way to implement this pattern as I see it, is this: The Merge API is declared as part of some internal interface, let us say IMergeable. Because the interface is internal, derived types would not be able to implement it directly. Rather they must inherit it from a common base type. So, a common base type is introduced, which would implement the IMergeable interface explicitly, where the interface methods delegate to respective protected virtual methods, providing the default implementation. This way the API is only callable by my framework, but derived types may override the default implementation. The following code snippet demonstrates the concept: internal interface IMergeable { void Merge(object obj); } public class BaseFrameworkObject : IMergeable { protected virtual void Merge(object obj) { // The default implementation. } void IMergeable.Merge(object obj) { Merge(obj); } } public class SomeThirdPartyObject : BaseFrameworkObject { protected override void Merge(object obj) { // A derived type implementation. } } All is fine, provided a single common base type suffices, which is usually true for non collection types. The thing is that collections must be mergeable as well. Collections do not play nicely with the presented concept, because developers do not develop collections from the scratch. There are predefined implementations - observable, filtered, compound, read-only, remove-only, ordered, god-knows-what, ... They may be developed from scratch in-house, but once finished, they serve wide range of products and should never be tailored to some specific product. Which means, that either: they do not implement the IMergeable interface at all, because it is internal to some product the scope of the IMergeable interface is raised to public and the API becomes open and callable by all. Let us refer to these collections as standard collections. Anyway, the first option screws my framework, because now each possible standard collection type has to be paired with the respective framework version, augmenting the standard with the IMergeable interface implementation - this is so bad, I am not even considering it. The second option breaks the framework as well, because the IMergeable interface should be internal for a reason (whatever it is) and now this interface has to open to all. So what to do? My solution is this. make IMergeable public API, but add an extra parameter to the Merge method, I call it a security token. The interface implementation may check that the token references some internal object, which is never exposed to the outside. If this is the case, then the method was called from within the framework, otherwise - some outside API consumer attempted to invoke it and so the implementation can blow up with a SecurityException. Here is the modified code snippet demonstrating this concept: internal static class InternalApi { internal static readonly object Token = new object(); } public interface IMergeable { void Merge(object obj, object token); } public class BaseFrameworkObject : IMergeable { protected virtual void Merge(object obj) { // The default implementation. } public void Merge(object obj, object token) { if (!object.ReferenceEquals(token, InternalApi.Token)) { throw new SecurityException("bla bla bla"); } Merge(obj); } } public class SomeThirdPartyObject : BaseFrameworkObject { protected override void Merge(object obj) { // A derived type implementation. } } Of course, this is less explicit than having an internally scoped interface and the check is moved from the compile time to run time, yet this is the best I could come up with. Now, I have a gut feeling that there is a better way to solve the problem I have presented. I do not know, may be using some standard Code Access Security features? I have only vague understanding of it, but can LinkDemand attribute be somehow related to it? Anyway, I would like to hear other opinions. Thanks.

    Read the article

  • Use Enum or #define ?

    - by sub
    I'm building a toy interpreter and I have implemented a token class which holds the token type and value. The token type is usually an integer, but how should I abstract the int's? What would be the better idea: // #defines #define T_NEWLINE 1; #define T_STRING 2; #define T_BLAH 3; /** * Or... */ // enum enum TokenTypes { t_newline, t_string, t_blah };

    Read the article

  • program to determine number of duplicates in a sentence

    - by bhavna raghuvanshi
    public class duplicate { public static void main(String[] args)throws IOException { System.out.println("Enter words separated by spaces ('.' to quit):"); Set<String> s = new HashSet<String>(); Scanner input = new Scanner(System.in); while (true) { String token = input.next(); if (".".equals(token)) break; if (!s.add(token)) System.out.println("Duplicate detected: " + token); } System.out.println(s.size() + " distinct words:\n" + s); } } my program detects and prints duplicate words but i need to print the number of duplicate words also. pls help me do it.

    Read the article

  • Is it possible to authenticate user manually with oauth2

    - by iixi
    I want to authenticate a user with oauth2 to access google drive. I can get the access token required when using AccountManager to retrieve an account and then get the token with: mgr.blockingGetAuthToken(account, ApiConst.DRIVE_AUTH_SCOPE, true); But I want the user to be able to authenticate by providing username and password instead of using the account added to the phone. Is this possible? EDIT So I have tried to implement the authorization in a WebView. I followed this example. I have extracted the code request parameter but the code used to retrieve the access token seems to be deprecated and not compatible with the packages used by Google Drive SDK. This is the code used to retrieve the access token in the example: AccessTokenResponse accessTokenResponse = new GoogleAuthorizationCodeGrant(new NetHttpTransport(), new JacksonFactory(), OAuth2ClientCredentials.CLIENT_ID, OAuth2ClientCredentials.CLIENT_SECRET, code, OAuth2ClientCredentials.REDIRECT_URI).execute(); Can this be done in some other way or should I just give up?

    Read the article

  • C++: Enum or #define

    - by sub
    I'm building a toy interpreter and I have implemented a token class which holds the token type and value. The token type is usually an integer, but how should I abstract the int's? What would be the better idea: // #defines #define T_NEWLINE 1; #define T_STRING 2; #define T_BLAH 3; /** * Or... */ // enum enum TokenTypes { t_newline, t_string, t_blah };

    Read the article

  • Creating folders and uploading a file without using a web browser

    - by Ashpak
    I am using the Java Api We have a web application wherein we want our file to be uploaded on an on_click even on some submit button. We don't want the browser to prompt us to enter the username and password to get the access token. Instead, we can provide the username and the password through the code so that we get the access token and the file will be uploaded directly. Right now, OAuth 2 requires that we enter the username and password to be entered through the browser. Reading through the post, I see that we can authenticate for the first time, obtain a refresh token and then keep on refreshing that token periodically. But our application requirements does not allow for this work-flow. Is there any way to automate the process of entering the user credentials using Java code. or Is there any library that will keep the browser away from the process.

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >