Search Results

Search found 427 results on 18 pages for 'geo papas'.

Page 7/18 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Scala capture group using regex

    - by Geo
    Let's say I have this code: val string = "one493two483three" val pattern = """two(\d+)three""".r pattern.findAllIn(string).foreach(println) I expected findAllIn to only return 483, but instead, it returned two483three. I know I could use unapply to extract only that part, but I'd have to have a pattern for the entire string, something like: val pattern = """one.*two(\d+)three""".r val pattern(aMatch) = string println(aMatch) // prints 483 Is there another way of achieving this, without using the classes from java.util directly, and without using unapply?

    Read the article

  • ADO.NET parameters from TextBox

    - by Geo Ego
    I'm trying to call a parameterized stored procedure from SQL Server 2005 in my C# Winforms app. I add the parameters from TextBoxeslike so (there are 88 of them): cmd.Parameters.Add("@CustomerName", SqlDbType.VarChar, 100).Value = CustomerName.Text; I get the following exception: "System.InvalidCastException: Failed to convert parameter value from a TextBox to a String. ---> System.InvalidCastException: Object must implement IConvertible." The line throwing the error is when I call the query: cmd.ExecuteNonQuery(); I also tried using the .ToString() method on the TextBoxes, which seemed pointless anyway, and threw the same error. Am I passing the parameters incorrectly?

    Read the article

  • What Amazon S3 .NET Library is most useful and efficient?

    - by Geo
    There are two main open source .net Amazon S3 libraries. Three Sharp LitS3 I am currently using LitS3 in our MVC demo project, but there is some criticism about it. Has anyone here used both libraries so they can give an objective point of view. Below some sample calls using LitS3: On demo controller: private S3Service s3 = new S3Service() { AccessKeyID = "Thekey", SecretAccessKey = "testing" }; public ActionResult Index() { ViewData["Message"] = "Welcome to ASP.NET MVC!"; return View("Index",s3.GetAllBuckets()); } On demo view: <% foreach (var item in Model) { %> <p> <%= Html.Encode(item.Name) %> </p> <% } %> EDIT 1: Since I have to keep moving and there is no clear indication of what library is more effective and kept more up to date, I have implemented a repository pattern with an interface that will allow me to change library if I need to in the future. Below is a section of the S3Repository that I have created and will let me change libraries in case I need to: using LitS3; namespace S3Helper.Models { public class S3Repository : IS3Repository { private S3Service _repository; #region IS3Repository Members public IQueryable<Bucket> FindAllBuckets() { return _repository.GetAllBuckets().AsQueryable(); } public IQueryable<ListEntry> FindAllObjects(string BucketName) { return _repository.ListAllObjects(BucketName).AsQueryable(); } #endregion If you have any information about this question please let me know in a comment, and I will get back and edit the question. EDIT 2: Since this question is not getting attention, I integrated both libraries in my web app to see the differences in design, I know this is probably a waist of time, but I really want a good long run solution. Below you will see two samples of the same action with the two libraries, maybe this will motivate some of you to let me know your thoughts. WITH THREE SHARP LIBRARY: public IQueryable<T> FindAllBuckets<T>() { List<string> list = new List<string>(); using (BucketListRequest request = new BucketListRequest(null)) using (BucketListResponse response = service.BucketList(request)) { XmlDocument bucketXml = response.StreamResponseToXmlDocument(); XmlNodeList buckets = bucketXml.SelectNodes("//*[local-name()='Name']"); foreach (XmlNode bucket in buckets) { list.Add(bucket.InnerXml); } } return list.Cast<T>().AsQueryable(); } WITH LITS3 LIBRARY: public IQueryable<T> FindAllBuckets<T>() { return _repository.GetAllBuckets() .Cast<T>() .AsQueryable(); }

    Read the article

  • Email function using templates. Includes via ob_start and global vars

    - by Geo
    I have a simple Email() class. It's used to send out emails from my website. <? Email::send($to, $subj, $msg, $options); ?> I also have a bunch of email templates written in plain HTML pierced with a few PHP variables. E.g. /inc/email/templates/account_created.php: <p>Dear <?=$name?>,</p> <p>Thank you for creating an account at <?=$SITE_NAME?>. To login use the link below:</p> <p><a href="https://<?=$SITE_URL?>/account" target="_blank"><?=$SITE_NAME?>/account</a></p> In order to have the PHP vars rendered I had to include the template into my function. But since include does not return the contents but rather just sends it directly to the output, I had to wrap it with the buffer functions: <? abstract class Email { public static function send($to, $subj, $msg, $options = array()) { /* ... */ ob_start(); include '/inc/email/templates/account_created.php'; $msg = ob_get_clean(); /* ... */ } } After that I realized that the PHP vars are not rendered as they are being inside of the function scope, so I had to globalize the variables inside of the template: <? global $SITE_NAME, $SITE_URL, $name; ?> <p>Dear <?=$name?>,</p> ... So the question is whether there is a more elegant solution to this? Mainly I am concerned about my workarounds using ob_start() and global. For some reason that seems to me odd. Or this is pretty much the common practice?

    Read the article

  • How can I make this Perl regex work?

    - by Geo
    I have this line ( it's a single line, SO makes it seem like 2 ): /Od /D "WIN32" /D "_DEBUG" /FD /EHa /MDd /Fo"Debug" /Fd"Debug\vc80.pdb" /W3 /c /Zi /clr /TP .\main.cpp" And I want to extract the .\main.cpp. I thought the following would do the trick: if($string =~ /.*\s+(.*)$/i) { print "matched ",$1,"\n"; } because this same regex works in Ruby, and extracts the string I required. How can I get it working?

    Read the article

  • Pull image of rendered HTML from a specific browser

    - by Geo Ego
    I am working on an app that will be able to pull an image of rendered HTML from a specific browser. I would like the user to be able to select a specific browser to render an HTML file in, and capture the rendered output in an image file. I am starting with IE8, and I'm not sure where to begin to get the actual rendered output. I can easily open the file in that browser with Process.Start(), but I don't know how to return the rendered output. I have looked a little bit at sinking events, but I don't understand how that works or if that's the right way to go. I would just like some direction, and perhaps some resources to send me on the right path.

    Read the article

  • Questions about serving static files from a servlet

    - by Geo
    I'm very new to servlets. I'd like to serve some static files, some css and some javascript. Here's what I got so far: in web.xml: <servlet> <description></description> <display-name>StaticServlet</display-name> <servlet-name>StaticServlet</servlet-name> <servlet-class>StaticServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>StaticServlet</servlet-name> <url-pattern>/static/*</url-pattern> </servlet-mapping> I'm assuming in the StaticServlet I'd have to work with request.getPathInfo to see what was requested, get a mime type, read the file & write it to the client. If this is not the way to go, or is not a viable way of doing things, please suggest a better way. I'm not really sure where to place the static directory, because if I try to print new File(".") it gives me the directory of my Eclipse installation. Is there a way to find out the project's directory?

    Read the article

  • How do I make my Log::Log4perl logger work?

    - by Geo
    Here's the code I have: use strict; use warnings; use Log::Log4perl qw(:easy); Log::Log4perl->init({ level => $DEBUG }); my $logger = Log::Log4perl->get_logger("my.logger"); my $appender = Log::Log4perl::Appender->new("Log::Log4perl::Appender::File",filename => "my.file"); $appender->layout(Log::Log4perl::Layout::SimpleLayout->new); $logger->add_appender($appender); $logger->info("this is an info"); all I want to do is log a message to a file, and have the level show up. I understood that is what the SimpleLayout is for . I'd like to do this without a configuration file. Running the code above shows the following message: Log::Log4perl configuration looks suspicious: No loggers defined

    Read the article

  • How can I decode UTF-16 data in Perl?

    - by Geo
    If I open a file ( and specify an encoding directly ) : open(my $file,"<:encoding(UTF-16)","some.file") || die "error $!\n"; while(<$file>) { print "$_\n"; } close($file); I can read the file contents nicely. However, if I do: use Encode; open(my $file,"some.file") || die "error $!\n"; while(<$file>) { print decode("UTF-16",$_); } close($file); I get the following error: UTF-16:Unrecognised BOM d at F:/Perl/lib/Encode.pm line 174 How can I make it work with decode?

    Read the article

  • Django models & Python class attributes

    - by Geo
    The tutorial on the django website shows this code for the models: from django.db import models class Poll(models.Model): question = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') class Choice(models.Model): poll = models.ForeignKey(Poll) choice = models.CharField(max_length=200) votes = models.IntegerField() Now, each of those attribute, is a class attribute, right? So, the same attribute should be shared by all instances of the class. A bit later, they present this code: class Poll(models.Model): # ... def __unicode__(self): return self.question class Choice(models.Model): # ... def __unicode__(self): return self.choice How did they turn from class attributes into instance attributes? Did I get class attributes wrong?

    Read the article

  • Can I use Lotus Notes to send mail ?

    - by Geo
    I have to code an app that at some point in time will have to send some reports using Lotus Notes. My questions are : Can I send mail through the Lotus Notes client, or something related to Lotus Notes ( a command line tool maybe? )? If so, where could I find information related to this? I would prefer not having to do it in C/C++, but if no other options' present, that would do. How can I find out the server's address? The GUI is not intuitive, and I can't find the server address. The server's located on another computer on the network.

    Read the article

  • How can I decode UTF-16 data in Perl when I don't know the byte order?

    - by Geo
    If I open a file ( and specify an encoding directly ) : open(my $file,"<:encoding(UTF-16)","some.file") || die "error $!\n"; while(<$file>) { print "$_\n"; } close($file); I can read the file contents nicely. However, if I do: use Encode; open(my $file,"some.file") || die "error $!\n"; while(<$file>) { print decode("UTF-16",$_); } close($file); I get the following error: UTF-16:Unrecognised BOM d at F:/Perl/lib/Encode.pm line 174 How can I make it work with decode?

    Read the article

  • Detecting struckout text in a cell using JExcelApi

    - by Geo
    I need to detect whether the text within a cell is struck out or not. I'm using this: Cell cc = sheet.getCell("B1"); CellFormat format = cc.getCellFormat(); System.out.println(format.getFont().isStruckout()); but I remember I read somewhere that CellFormat is deprecated and CellFeatures should be used instead. How could one find out whether a text is struck out using CellFeatures?

    Read the article

  • How to use Java on Google App Engine without exceeding minute quotas?

    - by Geo
    A very simple java code inside a doGet() servlet is getting more than a second of cpu time on GAE. I have read some quota related documentation and apparently I am not doing anything wrong. //Request the user Agent info String userAgent = req.getHeader("User-Agent"); I wanted to know what was using the CPU the most, I use a google help recommendation. //The two lines below will get the CPU before requesting User-Agent Information QuotaService qs = QuotaServiceFactory.getQuotaService(); long start = qs.getCpuTimeInMegaCycles(); //Request the user Agent info String userAgent = req.getHeader("User-Agent"); //The three lines below will get the CPU after requesting User-Agent Information // and informed it to the application log. long end = qs.getCpuTimeInMegaCycles(); double cpuSeconds = qs.convertMegacyclesToCpuSeconds(end - start); log.warning("CPU Seconds on geting User Agent: " + cpuSeconds); The only thing that the code above tells me is that inspecting the header will use more than a second (1000ms) of cpu time, which for Google is a warning on the log panel. That seems to be a very simple request and still is using more than a second of cpu. What I am missing?

    Read the article

  • Decoding utf16 in Perl?

    - by Geo
    If I open a file ( and specify an encoding directly ) : open(my $file,"<:encoding(UTF-16)","some.file") || die "error $!\n"; while(<$file>) { print "$_\n"; } close($file); I can read the file contents nicely. However, if I do: use Encode; open(my $file,"some.file") || die "error $!\n"; while(<$file>) { print decode("UTF-16",$_); } close($file); I get the following error: UTF-16:Unrecognised BOM d at F:/Perl/lib/Encode.pm line 174 How can I make it work with decode?

    Read the article

  • When should I implement globalization and localization in C#?

    - by Geo Ego
    I am cleaning up some code in a C# app that I wrote and really trying to focus on best practices and coding style. As such, I am running my assembly through FXCop and trying to research each message it gives me to decide what should and shouldn't be changed. What I am currently focusing on are locale settings. For instance, the two errors that I have currently are that I should be specifying the IFormatProvider parameter for Convert.ToString(int), and setting the Dataset and Datatable locale. This is something that I've never done, and never put much thought into. I've always just left that overload out. The current app that I am working on is an internal app for a small company that will very likely never need to run in another country. As such, it is my opinion that I do not need to set these at all. On the other hand, doing so would not be such a big deal, but it seems like it is unneccessary and could hinder readability to a degree. I understand that Microsoft's contention is to use it if it's there, period. Well, I'm technically supposed to call Dispose() on every object that implements IDisposable, but I don't bother doing that with Datasets and Datatables, so I wonder what the practice is "in the wild."

    Read the article

  • What's the benefit of calling new on an object instance?

    - by Geo
    I'm reading [Programming Perl][1], and I found this code snippet: sub new { my $invocant = shift; my $class = ref($invocant) || $invocant; my $self = { color => "bay", legs => 4, owner => undef, @_, # Override previous attributes }; return bless $self, $class; } With constructors like this one, what's the benefit of calling new on an object instance? I assume that it's what it's for, right? My guess is that if anyone would want to write such a constructor, he would have to add some more code that copies the attributes of the first object to the one about to be created.

    Read the article

  • SQL Server 2005 - Find minimum unused value within a range

    - by Geo Ego
    I have a situation similar to the following question: Insert Data Into SQL Table Where my scenario differs is that I have a non-auto-incrementing primary key field that can have a range between 1000 and 1999. We only have about a hundred values in it thus far, but the maximum value has already been taken (1999), and there are gaps in the numbering sequence. Thus, I need to find a value that is between 1000-1999 and not taken. For instance, if my current values are, for example, 1000, 1001, 1003, and 1999, I would want the query to return 1002.

    Read the article

  • How we run a .NET 32-bit application in a 64-bit Windows server?

    - by Geo
    We are installing a third party application in one of our 64-bit Windows servers. This application apparently was build with the compiler option set to choose the platform at run time. When we run the application it gives us an error: System.BadImageFormatException: is not a valid Win32 application. I have seen in MSDN forums that in order to fix this error I have to build the application set to 32-bit, and that way it will run fine on a 64-bit server. I check on other StackOverflow links Other Posts. How to get around this situation? For everyone that wants to know more information: The application is running fine in a 32-bit test server. IIS version 6 using SQL Server Express 2005 On the Web Service Extension there are both Framework64\v2.0.50727\aspnet_isapi.dll and Framework\v2.0.50727\aspnet_isapi.dll

    Read the article

  • PHP array checkbox and radio default value

    - by Arg Geo
    I have the code below in my wordpress options page. I can't define the default values for checkbox and radio. array( "name" => "Post Thumbnails", "desc" => "Choose if you want to display <strong>post thumbnails</strong> or not.", "id" => $shortname."_post_thumbs", "type" => "checkbox", "std" => "checked" ), array( "name" => "Example", "desc" => " The Descriptions", "id" => $shortname."_case_thumb", "type" => "radio", "options" => array("nothumb" => " Display nothing", "defthumb" => " Display thumbnail"), "std" => "nothumb" ), For the checkbox tried also "std" => "true" and "std" => " "... but didn't work. Thanks!

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >