Daily Archives

Articles indexed Sunday April 18 2010

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

  • Detecting first time login of user into application (Google Appengine)

    - by Jake
    My app requires users to login using their google account. I have this set in my App.yamp file: url: /user/.* script: user.py login: required Now when any user tries to access files under /user/secret.py he will need to authenticate via google, which will redirect the user back to /user/secret.py after successful authentication. Now the problem I am facing is when the user is redirected back to the app, I cannot be sure if this is the first time the user has logged in or is it a regular user to my site who has come back again from just the user object which google passes using users.get_current_user() . I thus need to maintain state in the datastore to check if the user already exists or not everytime. If he does not exist i need to create a new entry with other application specific settings. My question is: Is there some easier way to handle this? without having to query the datastore to figure if this is a first time user or a regular one?

    Read the article

  • Unwanted Log4J output in a Tomcat app

    - by Bytecode Ninja
    I have the following log4j config setup for my Web app which is being deployed to Tomcat: # Set root logger level to DEBUG and its only appender to A1. log4j.rootLogger=INFO, A1 # A1 is set to be a ConsoleAppender. log4j.appender.A1=org.apache.log4j.ConsoleAppender # A1 uses PatternLayout. log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%m%n log4j.logger.org.hibernate=WARN log4j.logger.org.apache=WARN And it is being picked up by the Log4J as modifying the ConversionPattern affects the logs printed to the console. However there are unwanted and unasked-for logging outputs interleaving my log outputs as it can be seen in the following example: Apr 18, 2010 4:14:55 PM com.acme.web.OpenSessionInViewFilter doFilter INFO: Closing session Apr 18, 2010 4:14:56 PM com.acme.web.OpenSessionInViewFilter doFilter INFO: Entering Apr 18, 2010 4:14:57 PM com.acme.web.OpenSessionInViewFilter doFilter INFO: Commiting transaction Apr 18, 2010 4:14:57 PM com.acme.web.OpenSessionInViewFilter doFilter INFO: Closing session Why are "Apr 18, 2010 4:14:57 PM com.acme.web.OpenSessionInViewFilter doFilter" and other similar log statements printed on the console? Also why are they not formatted according to my Log4J config? Thanks in advance.

    Read the article

  • Space-based architecture?

    - by rcampbell
    One chapter in Pragmatic Programmer recommends looking at a blackboard/space-based architecture + a rules engine as a more flexible alternative to a traditional workflow system. The project I'm working on currently uses a workflow engine, but I'd like to evaluate alternatives. I really feel like a SBA would be a better solution to our business problems, but I'm worried about a total lack of community support/user base/venders/options. JavaSpaces is dead, and the JINI spin-off Apache River seems to be on life support. SemiSpace looks perfect, but it's a one-man show. The only viable solution seems to be GigaSpaces. I'd like to hear your thoughts on space based architecture and any experiences you've had with real world implementations.

    Read the article

  • Resolve HTTP 304 - not modified in AJAX call made via GWT

    - by Salvin Francis
    We are using an application made in GWT with the server as tomcat. The project runs fine normally, however there are situations where the server is restarted. At such point of time, the ajax call made by the code below returns blank text with the status code as 304 RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.POST, URL.encode(serverUrl)); //-- serverUrl is the url to which this call is posted to. requestBuilder.setHeader("Content-Type", "application/x-www-form-urlencoded"); requestBuilder.setHeader("Expires","0"); requestBuilder.sendRequest( postData, new RequestCallback() { public void onError(Request request, Throwable exception) { //Do nothing } public void onResponseReceived(Request request, Response response) { //sometimes when the server is restarted, I get response.getStatusCode() = 304 and the response.getText() as blank } } ); normally we get back some data from the server inside this response text. How do we now get the data when the response itself is blank ?

    Read the article

  • how sequence events while upload heavy file to Amazon S3 ?

    - by coolpawan4u
    Here i am getting problem while uploading heavy files e.g. 100MB. Files go to amazon s3 successfully but after that scripts waiting for if($flag == 1) and does not execute the rest of code. Can any one tell me the solution for this ? if($s3-putObjectFile($uploadDIR, $bucket, $name, S3::ACL)) { $flag = 1; } if($flag == 1) { //countine code }

    Read the article

  • Why does Java read its default settings from the system

    - by Bozho
    Java is reading the locale, timezone and encoding information (and perhaps more) from the system it is installed on. This often brings bad surprises (brought me one just yesterday). Say your development and production servers are set to have TimeZone GMT+2. Then you deploy on a production server set to GMT. a 2-hour shift may not be easy to observe immediately. And although you can pass a TimeZone to your calendars, APIs might be instantiating calendars (or dates) using the default timezone. Now, I know one should be careful with these settings, but are easy to miss, hence make programs more error-prone. So, why doesn't Java have its own defaults - UTF-8, GMT, en_US (yes, I'm on non-en_US locale, but having it as default is fine). Applications could read the system settings via some API, if needed. Thus programs would be more predictable. So, what is the reason behind this decision?

    Read the article

  • ifstream Open function not working

    - by Dave Swersky
    I've been all over the ifstream questions here on SO and I'm still having trouble reading a simple text file. I'm working with Visual Studio 2008. Here's my code: // CPPFileIO.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <fstream> #include <conio.h> #include <iostream> #include <string> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { ifstream infile; infile.open("input.txt", ifstream::in); if (infile.is_open()) { while (infile.good()) cout << (char) infile.get(); } else { cout << "Unable to open file."; } infile.close(); _getch(); return 0; } I have confirmed that the input.txt file is in the correct "working directory" by checking the value of argv[0]. The Open method just won't work. I'm also having trouble debugging- should I not be able to set a watch on "infile.good()" or "infile.is_open()"? I keep getting "Error: member function not present." EDIT: Updated code listing with full code from .CPP file. UPDATE: The file was NOT in the Current Working Directory. This is the directory where the project file is located. Moved it there and it works when debugging in VS.NET.

    Read the article

  • Clipping different parts of an image with path

    - by huggie
    I've recently asked a question about clipping an image via path at view's drawRect method. http://stackoverflow.com/questions/2570653/iphone-clip-image-with-path Krasnyk's code is copied below. - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGMutablePathRef path = CGPathCreateMutable(); //or for e.g. CGPathAddRect(path, NULL, CGRectInset([self bounds], 10, 20)); CGPathAddEllipseInRect(path, NULL, [self bounds]); CGContextAddPath(context, path); CGContextClip(context); CGPathRelease(path); [[UIImage imageNamed:@"GC.png"] drawInRect:[self bounds]]; } It works very well. However, when my image is larger than the view itself, how do I show different parts of the image? I tried tweaking around with translation on the locations (show as bounds above) of ellipse and/or UIImage drawInRect but some complex effects (Unwanted clipping, weird elipse size) I can't explain happens.

    Read the article

  • Hiding Command Prompt with CodeDomProvider

    - by j-t-s
    Hi All I've just got my own little custom c# compiler made, using the article from MSDN. But, when I create a new Windows Forms application using my sample compiler, the MSDOS window also appears, and if I close the DOS window, my WinForms app closes too. How can I tell the Compiler? not to show the MSDOS window at all? Thank you :) Here's my code: using System; namespace JTS { public class CSCompiler { protected string ot, rt, ss, es; protected bool rg, cg; public string Compile(String se, String fe, String[] rdas, String[] fs, Boolean rn) { System.CodeDom.Compiler.CodeDomProvider CODEPROV = System.CodeDom.Compiler.CodeDomProvider.CreateProvider("CSharp"); ot = fe; System.CodeDom.Compiler.CompilerParameters PARAMS = new System.CodeDom.Compiler.CompilerParameters(); // Ensure the compiler generates an EXE file, not a DLL. PARAMS.GenerateExecutable = true; PARAMS.OutputAssembly = ot; PARAMS.CompilerOptions = "/target:winexe"; PARAMS.ReferencedAssemblies.Add(typeof(System.Xml.Linq.Extensions).Assembly.Location); PARAMS.LinkedResources.Add("this.ico"); foreach (String ay in rdas) { if (ay.Contains(".dll")) PARAMS.ReferencedAssemblies.Add(ay); else { string refd = ay; refd = refd + ".dll"; PARAMS.ReferencedAssemblies.Add(refd); } } System.CodeDom.Compiler.CompilerResults rs = CODEPROV.CompileAssemblyFromFile(PARAMS, fs); if (rs.Errors.Count > 0) { foreach (System.CodeDom.Compiler.CompilerError COMERR in rs.Errors) { es = es + "Line number: " + COMERR.Line + ", Error number: " + COMERR.ErrorNumber + ", '" + COMERR.ErrorText + ";" + Environment.NewLine + Environment.NewLine; } } else { // Compilation succeeded. es = "Compilation Succeeded."; if (rn) System.Diagnostics.Process.Start(ot); } return es; } } }

    Read the article

  • Disturbing Ruby on Rails Behavior

    - by User
    Environment.rb ActionMailer::Base.delivery_method = :sendmail ActionMailer::Base.sendmail_settings = { :address => "mail.example.org", :domain => "example.org", :port => 25, :authentication => :login, :user_name => "email+email.org", :password => "password" } ActionMailer::Base.perform_deliveries = true ActionMailer::Base.raise_delivery_errors = true ActionMailer::Base.default_charset = "utf-8" Development.log Sent mail to [email protected] Date: Sat, 17 Apr 2010 19:38:08 -0500 From: example.org To: [email protected] Subject: Hello Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 The process of sending email is ok but when I check my email I didn't recive any. What seems to be wrong?

    Read the article

  • How to get back to an active minibuffer prompt in emacs without the mouse

    - by Ryan Thompson
    In emacs, sometimes I will be in the middle of finding a file or switching buffers or doing something in the minibuffer, and I will click somewhere else for some reason. When I go back, the only way to make the minibuffer prompt active again is to click inside the minibuffer, which is annoying because it is a thin area. Is there any way to switch back to an active minibuffer prompt without using the mouse?

    Read the article

  • Image compression and thumbnail creation for PHP

    - by Saif Bechan
    I need some PHP classes that deal with image processing in a good manner. I have made a thumbnail creator myself but the end result quality is just horrible. Is it also possible to let PHP convert and save all images to one type. For example take an image(jpg,png,gif), compress it, resize it, and save as png. Can anyone recommend some good classes for this.

    Read the article

  • javascript add prototype method to all functions?

    - by salmane
    Is there a way to add a method to all javascript functions without using the prototype library? something along the lines of : Function.prototype.methodName = function(){ return dowhateverto(this) }; this is what i tried so far but it didnt work. Perhaps it is a bad idea also if so could you please tell me why? if so can I add it to a set of functions i choose something like : MyFunctions.prototype.methodName = function(){ return dowhateverto(this) }; where MyFunctions is an array of function names thank you

    Read the article

  • Databinding in windows forms on an object graph with possible null properties?

    - by Fredrik
    If I have an object graph like this: class Company { public Address MainAddress {...} } class Address { public string City { ... } } Company c = new Company(); c.MainAddress = new Address(); c.MainAddress.City = "Stockholm"; and databind to a control using: textBox1.DataBinding.Add( "Text", c, "MainAddress.City" ); Everything is fine, but If I bind to: Company c2 = new Company(); c2 using the same syntax it crashes since the MainAddress property is null. I wonder if there is a custom Binding class that can set up listeners for all the possible paths here and bind to the actual object dynamically when/if I sometime later in the application set the MainAddress property.

    Read the article

  • how do i filter my lucene search results?

    - by Andrew Bullock
    Say my requirement is "search for all users by name, who are over 18" If i were using SQL, i might write something like: Select * from [Users] Where ([firstname] like '%' + @searchTerm + '%' OR [lastname] like '%' + @searchTerm + '%') AND [age] >= 18 However, im having difficulty translating this into lucene.net. This is what i have so far: var parser = new MultiFieldQueryParser({ "firstname", "lastname"}, new StandardAnalyser()); var luceneQuery = parser.Parse(searchterm) var query = FullTextSession.CreateFullTextQuery(luceneQuery, typeof(User)); var results = query.List<User>(); How do i add in the "where age = 18" bit? I've heard about .SetFilter(), but this only accepts LuceneQueries, and not IQueries. If SetFilter is the right thing to use, how do I make the appropriate filter? If not, what do I use and how do i do it? Thanks! P.S. This is a vastly simplified version of what I'm trying to do for clarity, my WHERE clause is actually a lot more complicated than shown here. In reality i need to check if ids exist in subqueries and check a number of unindexed properties. Any solutions given need to support this. Thanks

    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

  • Use of ebay API

    - by Hab
    I am given a task to R& D ebay api. As i have tried to explore on net i still have no clear idea that how and why to use it in my apps. Also are there many ebay api's for different purposes? Any sample code available using this api in objective c for iPhone. Any doc available providing general info about it.

    Read the article

  • Hiding Command Prompt with CodeDomProvider

    - by j-t-s
    Hi All I've just got my own little custom c# compiler made, using the article from MSDN. But, when I create a new Windows Forms application using my sample compiler, the MSDOS window also appears, and if I close the DOS window, my WinForms app closes too. How can I tell the Compiler? not to show the MSDOS window at all? Thank you :) Here's my code: using System; namespace JTS { public class CSCompiler { protected string ot, rt, ss, es; protected bool rg, cg; public string Compile(String se, String fe, String[] rdas, String[] fs, Boolean rn) { System.CodeDom.Compiler.CodeDomProvider CODEPROV = System.CodeDom.Compiler.CodeDomProvider.CreateProvider("CSharp"); ot = fe; System.CodeDom.Compiler.CompilerParameters PARAMS = new System.CodeDom.Compiler.CompilerParameters(); // Ensure the compiler generates an EXE file, not a DLL. PARAMS.GenerateExecutable = true; PARAMS.OutputAssembly = ot; PARAMS.CompilerOptions = "/target:winexe"; PARAMS.ReferencedAssemblies.Add(typeof(System.Xml.Linq.Extensions).Assembly.Location); PARAMS.LinkedResources.Add("this.ico"); foreach (String ay in rdas) { if (ay.Contains(".dll")) PARAMS.ReferencedAssemblies.Add(ay); else { string refd = ay; refd = refd + ".dll"; PARAMS.ReferencedAssemblies.Add(refd); } } System.CodeDom.Compiler.CompilerResults rs = CODEPROV.CompileAssemblyFromFile(PARAMS, fs); if (rs.Errors.Count > 0) { foreach (System.CodeDom.Compiler.CompilerError COMERR in rs.Errors) { es = es + "Line number: " + COMERR.Line + ", Error number: " + COMERR.ErrorNumber + ", '" + COMERR.ErrorText + ";" + Environment.NewLine + Environment.NewLine; } } else { // Compilation succeeded. es = "Compilation Succeeded."; if (rn) System.Diagnostics.Process.Start(ot); } return es; } } }

    Read the article

  • Someone selling my GPL theme

    - by PaKK
    I'm having a tough time trying to figure out the best way to handle this. I've created a few themes last year, released them under a GPL license, and pretty much forgot about them. My goal was to put them out publicly as samples of my work. I've recently come across a site and was shocked they are selling one of my themes among several other themes (not mine) and other support and package systems. Anyway needless to say I'm not happy about this. I did not intend for those themes to be sold, and if they are to be sold, at least I would expect a percentage of those sales. I contacted the website asking how many they sold and that I'm the author of one of the themes they were selling. I eventually received a reply that my theme is a GPL theme and that this license allows them to sell it without compensation to me. WTF? Just the way the reply was worded pissed me off. There is no way to comment on the site to inform possible buyers that those themes can be downloaded from my site. What can I do about this? I realize now it was a bad choice to release them under that license. Is it possible to take back the theme from public distribution or is it out forever. Can I change it from GPL to another license at this point? Will that be sufficient to stop the sale of my theme in the future? Any insights are appreciated.

    Read the article

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