My app receives numerous text strings which may or may not contain a URL anywhere within the string. What would be the best method to extract a URL from within a string? Thank you.
I'm running R via Rpy on a redhat linux distribution. Periodically I'll encounter this error message:
*** caught segfault ***
address (nil), cause 'unknown'
And the entire program dies right there. It usually occurs when I run a lot of regression r.lm(). But by simply running the identical code again, the problem may or may not go away (so not always reproduceable). Does anyone know what might be causing this, and/or how I can prevent it from happening?
I have a bunch of strings which may of may not have random symbols and numbers in them. Some examples are:
contains(reserved[j])){
close();
i++){
letters[20]=word
I want to find any character that is NOT a letter, and replace it with a white space, so the above examples look like:
contains reserved j
close
i
letters word
What is the best way to do this?
To help support and anyone who may use one of my applications I tend to log a few things during the application startup.
Currently I log:
Start Time
App Name
App Author
App Version
App Classpath
Current working directory
Java vendor
Java version
Max heap size
Taking into consideration this application may be used / supported by a whole host of people can anyone think of any other vital details which we / others should log for good practice?
Hi,
I have a text file. I would like to retrieve the content from one line to another line.
For example, the file may be 200K lines. I want to read the content from line 78 to line 2735. Since the file may be very large, I do not want to read the whole content into the memory.
thanks
Frank
It's possible to do interesting things with what would ordinarily be thought of as typesetting languages. For example, you can construct the Mandelbrot set using postscript.
It is suggested in this MathOverflow question that LaTeX may be Turing-complete. This implies the ability to write arbitrary programs (although it may not be easy!). Does anyone know of any concrete example of such a program in LaTeX, which does something highly unusual with the language?
Hi,
I have a jquery datepicker with the numberOfMonths set to 3, currently when I click on the datepicker, the left side month is the current month. In most cases, the user is only going to be selecting a date prior to todays date so I would prefer the current month selected to be the last calendar i.e. March, April, May instead of the current implementation which is May, June, July.
Greatly appreciate any help!
I am running Symfony 1.3.2 on Ubuntu. I need to write a batch script that can:
Access the database using the ORM
Send email(s)
IIRC, this was in a previous cookback, but I thing that was for an earlier version of Symfony (the API may have changed since).
Does anyone know how I may access the database via the ORM layer in a batch script and also how to send out email(s) in a batch script?
I'm not sure what happened, but my installer is in a weird state--when I install my MSI, it doesn't seem to be running the current version of the code (I'm using Custom Actions). I verified it by placing some MessageBox.Shows and sure enough, they are not popping up.
It's possible I may have had a few unsuccessful installs previously which may have put the installer in a bad state...but how do I go about resolving this?
Thanks...
Here's the scenario:
You have a Windows server that users remotely connect to via RDP. You want your program (which runs as a service) to know who is currently connected. This may or may not include an interactive console session.
Please note that this is the not the same as just retrieving the current interactive user.
I'm guessing that there is some sort of API access to Terminal Services to get this info?
I have some strings like below:
ffffffffcfdeee^dddcdeffffffffdddcecffffc^cbcb^cb`cdaba`eeeeeefeba[NNZZcccYccaccBBBBBBBBBBBBBBBBBBBBBB
eedeedffcc^bb^bccccbadddba^cc^e`eeedddda`deca_^^\```a```^b^`I^aa^bb^`_b\a^b```Y_\`b^`aba`cM[SS\ZY^BBB
Each string MAY (or may not) end with a stretch of trailing "B" of varied length.
I'm just wondering if we can simply use bash code to remove the "B" stretch?
thx
We may use the following code to clear keyboard buffer:
while PeekMessage(Msg, 0, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE or PM_NOYIELD) do;
But how may I clear mouse click buffer?
Hi,
Having assertions for unexpected conditions is considered to be good defensive coding practice. I happen to place assertions whenever i think something unexpected may happen, but that now seems to be an overkill to me.
Additionally, sometimes mild unexpected conditions that don't necessarily lead to crash may even cause failure on customer end.
Is there a hard and fast rule to put assertions?
Thanks.
I'm writing an open source software that is licensed under the GPL. Now I'm offering that other users can translate the software, starting from an english translation I made by myself. What license or range of license may be best for translation of text strings, dialogs, etc.? As GPL is a software license, I thought about a Creative Commons license. The goal is so that all translations remain free and may be updated by other translators.
I want to create a class that doesn't gives an Attribute Error on call of any method that may or may not exists:
My class:
class magic_class:
...
# How to over-ride method calls
...
Expected Output:
ob = magic_class()
ob.unknown_method()
# Prints 'unknown_method' was called
ob.unknown_method2()
# Prints 'unknown_method2' was called
Now, unknown_method and unknown_method2 doesn't actually exists in the class, but how can we intercept the method call in python ?
If the value after the shift operator
is greater than the number of bits in
the left-hand operand, the result is
undefined. If the left-hand operand is
unsigned, the right shift is a logical
shift so the upper bits will be filled
with zeros. If the left-hand operand
is signed, the right shift may or may
not be a logical shift (that is, the
behavior is undefined).
Can somebody explain me what the above lines mean??
Hello,
I am using a regular expression search to match up and replace some text. The text can span multiple lines (may or may not have line breaks).
Currently I have this:
$regex = "\<\?php eval.*?\>"
Get-ChildItem -exclude *.bak | Where-Object {$_.Attributes -ne "Directory"} |ForEach-Object {
$text = [string]::Join("`n", (Get-Content $_))
$text -replace $RegEx ,"REPLACED"}
I have a byte array that may or may not have null bytes at the end of it. After converting it to a string I have a bunch of blank space at the end. I tried using Trim() to get rid of it, but it doesn't work. How can I remove all the blank space at the end of the string after converting the byte array?
I am writing this is C#.
I have lines of text, all with the same structure, and would like to make a permutation of 2 elements on all lines:
1257654 some text (which may be long) #Foo
1543098 some other text #Barbar
1238769 whatever #Baz
2456874 something else #Quux
I want to obtain :
#Foo some text (which may be long) 1257654
#Barbar some other text 1543098
#Baz whatever 1238769
#Quux something else 2456874
This is where I am stuck :
:%s/\(\d\{7\}\)\(#.\{-}\)/\2\1/
Where did I go wrong ?
This is code:
http://www.dpaste.de/Ij0S/
1,if there is a erorr (networking erorr,or Unhandled error in Deferred), the code stop.
I need this code running until all urls finish request. (May be the parallel function not work? )
2,when I write image to local filesystem, if meet erorr, there images may not complete.
Thanks!
Anybody can help me to get date formated with Zend framework
What I do is:
<?php echo new Zend_Date(2010-05-23, false, 'en');?>
Result I get is: May 22, 2010 12:00:00 AM
I what I need is: May 22, 2010
Thanks.
If you look at the top right you'll see on a radar an enemy unit line of sight.
I was wondering what is the most efficient or easiest way (little code, fairly accurate. doesnt need to be perfect) to detect if something is in your line of sight? I may or may not need to render it (i likely wont).
I dont know the formula nor used any math libs/namespaces in C#
Imagine that we have a query like this:
select a.col1, b.col2
from t1 a
inner join t2 b on a.col1 = b.col2
where a.col1 = 'abc'
Both col1 and col2 don't have any index.
If I add another restriction on the where clause, one that is always correct but with a column with an index:
select a.col1, b.col2
from t1 a
inner join t2 b on a.col1 = b.col2
where a.col1 = 'abc'
and a.id >= 0 -- column always true and with index
May the query perform faster since it may use the index on id column?