My sample file is like below:
H343423 Something1 Something2
C343423 0
A23423432 asdfasdf sdfs
#2342323
I have the following regex:
if (line =~ /^[HC]\d+\s/) != nil
puts line
end
Basically I want to read everything that starts with H or C and is followed by numbers and I want to stop reading when space is encountered (I want to read one word).
Output I want is:
H343423
C343423
Output my RegEx is getting is:
H343423 Something1 Something2
C343423 0
So it is fetching the whole line but I just want it to stop after first word is read.
Any help?
I'm digging through Akamai logs, downloading excel sheets, and then manually joining them so that I can do sorting of data to find top videos and referrers. Are there any tools you know of to help with this kind of processing? I'm looking for something like Urchin used to be for Apache logs, but for Akamai logs. Thanks!
Hi,
I believe that some one is running shell commands to my server via my site, Could any one offer any help on how the user could be doing this ?
also how could I stop this?
Could someone help explain what is going on in this precommit hook? I thought changing files would cause them to be restaged.
http://snipplr.com/view/28523/git-precommit-hook-to-fix-trailing-whitespace/
Hi,
I have the following code which recording the scroll Y position in my ListView whenever my activity is paused.
protected void onSaveInstanceState (Bundle outState) {
super.onSaveInstanceState(outState);
int scroll = mListView.getScrollY();
System.out.println (" scrollY" + scroll);
}
But regardless where I scroll my ListView vertically, the value of getScrollY() always return 0. Can anyone please help me?
Thank you.
During the following months I'll have some spare time so I thought of picking up a new programming language.I've been reading some articles about Go and Io and both of them look interesting and very promising so I'm stuck making a decision about which one to pick up next.
I'm mainly interested in distributed systems and concurrency.
Any help is greatly appreciated. Thanks.
i cant seem to get my avd built and i dont understand why i got all the tools i even have GIT but when i try to do the command avd devices it will say no such command can any on helpme please and thank you
Please helpme to prevent my data from SQL injection.
I have replaced ' with '' (single quote with 2 quote) while doing any operation on sql server.
Please tell me what all i need to do , to prevent my application from SQL injection. my application is in asp.net 2.0
I have a database containing multiple tables (Person, Parents, etc)
Person table has certain attributes particularly ssn, countryofbirth and currentcountry.
Parents table has ssn, and fathersbirthcountry
I'm trying to output the SSNs of all people who have the same countryofbirth as their fathersbirthcountry and also have same currentcountry as fathersbirthcountry.
SELECT Person.ssn
FROM Person, Parents
WHERE fathersbirthcountry = countryofbirth
AND currentcountry = fathersbirthcountry;
the above doesn't seem to be working, could anyone please helpme out?
I'm having a great deal of difficulty trying to figure out the logic behind this problem. I have developed everything else, but I really could use some help, any sort of help, on the part I'm stuck on.
Back story:
*A group of actors waits in a circle. They "count
off" by various amounts. The last few to audition
are thought to have the best chance of getting the
parts and becoming stars.
Instead of actors having names, they are identified
by numbers. The "Audition Order" in the table tells,
reading left-to-right, the "names" of the actors who
will be auditioned in the order they will perform.*
Sample output:
etc, all the way up to 10.
What I have so far:
using System;
using System.Collections;
using System.Text;
namespace The_Last_Survivor
{
class Program
{
static void Main(string[] args)
{
//Declare Variables
int NumOfActors = 0;
System.DateTime dt = System.DateTime.Now;
int interval = 3;
ArrayList Ring = new ArrayList(10);
//Header
Console.Out.WriteLine("Actors\tNumber\tOrder");
//Add Actors
for (int x = 1; x < 11; x++)
{
NumOfActors++;
Ring.Insert((x - 1), new Actor(x));
foreach (Actor i in Ring)
{
Console.Out.WriteLine("{0}\t{1}\t{2}", NumOfActors, i, i.Order(interval, x));
}
Console.Out.WriteLine("\n");
}
Console.In.Read();
}
public class Actor
{
//Variables
protected int Number;
//Constructor
public Actor(int num)
{
Number = num;
}
//Order in circle
public string Order(int inter, int num)
{
//Variable
string result = "";
ArrayList myArray = new ArrayList(num);
//Filling Array
for (int i = 0; i < num; i++)
myArray.Add(i + 1);
//Formula
foreach (int element in myArray)
{
if (element == inter)
{
result += String.Format(" {0}", element);
myArray.RemoveAt(element);
}
}
return result;
}
//String override
public override string ToString()
{
return String.Format("{0}", Number);
}
}
}
}
The part I'm stuck on is getting some math going that does this:
Can anyone offer some guidance and/or sample code?
I want calling actionScript 2.0 function from c# , I using ExternalInterface.addCallback;
In flash:
ExternalInterface.addCallback("test", function (text : String) : Void
{
//code
});
in C#: I using shockwave flash object
player.CallFunction("" + "myString" + "");
but error: Error HRESULT E_FAIL has been returned from a call to a COM component. in C#
I using cs4 and VS2008, please help me!
As a self-taught programmer I find myself sometimes thinking how to improve my learning skills.
Are there any books out there that you recommend, that help a self-taught learning aproach?
When I ask about books here, please I`m not reffering about programming books, but something more like metacognition and the process of learning.
I know a little bit of regex, but not mutch. What is the best way to get just the number out of the following html. (I want to have 32 returned). the values of width,row span, and size are all different in this horrible html page. Any help?
<td width=14 rowspan=2 align=right><font size=2 face="helvetica">32</font></td>
Hey im a noob in flash cs3 and i want to create a jeopardy game where when a button is pressed we go in to the main question scene and when we come back the button the we pressed is now disabled via 'button._visible=flase'...pls any help...any suggestions or links to tutorials or tutorials from you guys or girls will grateful thanx...
Hi All,
I am trying to compare to textbox values on an aspx form. Both the values represent dates. The are formatted like "dd/MMM/yyyy". How can I compare them in javascript to see if they are not equal and which one is greater etc... Does javascript have a date constructor for strings like this? Any tips would be appreciated. Thanks for the help.
Cheers,
~ck in San Diego
I have to tables as follows;
Employees: Name nvarchar(50), Job Title nvarchar(50) and Salary int.
Employers: Name nvarchar(50), Job Title nvarchar(50)
I would like to select every item from the 'Employers' table where 'Job Title' does NOT show up in the 'Employees' table.
I know this is a simple query but it has me stumped.
I'd be grateful for any help. Thanks.
I am getting the following error and do not know how to fix it....any help would be great...Thanks
Exception in thread "main" java.lang.NullPointerException
at Polynomial.add(Polynomial.java:115)
at PolyTest.main(PolyTest.java:18)
Hi,
I am Rashmi.I have two forms in a single JSP page which are developed using JSF.Each form has one required field input and a submit button.On click of any of the button from any form,both forms should get validated and display required message.Please need help..........
sample code:
in advance
Thanks.
I want to do this:
foo.com/xxx= foo.com/somepage.php?id=xxx
This is how I do it:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^([^/]+)$ http://foo.com/somepage.php?id=$1 [L]
the problem now, is that foo.com doesn't work any more.
I can't see foo.com neither foo.com/index.php
help me! :)
hey all,
I'm creating an FWT application in FAN (http://www.fandev.org/) and every time I run my application, the ms-dos command prompt window appears (as well as my main application form). I don't want this ms-dos window to be shown, but i also don't know how to get rid of it, please help somebody :( it's giving me nightmares
I am new to programming PHP and am trying to validate a field in a form.
The field if for a RAL color code and so would look something like : RAL 1001.
so the letters RAL and then 4 numbers.
Can someone helpme set them into a regular expression to validate them.
i have tried this with no success:
$string_exp = "/^[RAL][0-9 .-]+$/i";
What can I say but sorry for being a complete NOOB at PHP.
Cheers
Ben
hi. plz tel me to how to collect data for my project. as my projct relate to "sustainable urban infrastructure" so helpme that what what data should i put to my project.i dont had any idea that how to do vit data analysis .so please direct me .