Hello,
I am having a bit of trouble with my rails application. It short, its a social networking app where users have a profile, have submissions, and can comment on submissions.
My routes are as follows:
map.connect '/:username', :controller => 'users', :action => 'show'
map.connect '/:username/:id', :controller => 'submissions', :...
I have a bunch of strings I need to extract numbers from. They're in the format:
XXXX001
XXXXXXX004
XX0234X
There's a lot of these, and i need to loop over them all and extract all the numbers.
So what's the quickest/most efficient way, using ASP.NET 3.5, to find the first instance of a number within a string?
Update
I should've inc...
I've got a set of files in a web root that all contain special characters that I'd like to remove (Â,€,â,etc).
My command
find . -type f -name '*.*' -exec grep -il "Â" {} \;
finds & lists out the files just fine, but my command
find . -type f -name '*.*' -exec tr -d 'Â' '' \;
doesn't produce the results I'm looking for.
Any thou...
I am building a financial reporting app with Ruby on Rails. In the app I have monthly financial statement objects (with 'revenue' as an attribute). For any single financial statement, I want show (1) year-to-date revenue, and (2) last-year-to-date revenue (calendar years are fine). Each object also has a Date (not Datetime) attribute c...
I recently found out about oEmbed which is "a fomat for allowing an embedded representation of a URL" basically you enter the url of a youtube video that you like and oEmbed will return the embedded code of the video in this page.
I want to give my users the option to either enter a url or embed code in a textbox. If is embed code it s...
I'm using Mysql with collation utf8_general_ci and for most of my searches it is good. But for one model and one field I want to find a record with case sensitive. How to do it?
...
Using STL, I want to find the last instance of a certain value in a sequence.
This example will find the first instance of 0 in a vector of ints.
#include <algorithm>
#include <iterator>
#include <vector>
typedef std::vector<int> intvec;
intvec values;
// ... ints are added to values
intvec::const_iterator split = std::find(values.beg...
A user will give me an absolute path - say "C:\src" (passed into %1 in the batch file). Then, I need to find the directory entitled "SQLScripts" that is in some subfolder of "C:\src".
How can I find the absolute path to the "SQLScripts" directory? Also, I'm not worrying about multiple instances of the SQLScripts directory existing.
Fro...
How can I get how many times a string occurs in a textbox?
I thought the find function would return the number of times found but it seems to return the location of it.
...
Howdy,
I'm generating UTF-8 encoded web content that includes characters using diacritical marks, typically "accented" characters, e.g. "é". Firefox's Find (find in page) function requires that such characters be typed in order to find them, which makes sense, but makes for a usability problem. This is tricky for users who don't know ...
Hello,
I have a model who holds 2 properties: valid_from and valid_to.
I need to select all instances that are currently valid, i.e. valid_from <= today and valid_to >= today.
i have the following find :
Mymodel.find(:all, :conditions => ["valid_from <= ? and valid_to >= ?", Date.today, Date.today])
I already thought about storing D...
I have 2 tables :products and :providers with has_and_belongs_to_many association.
I would like to do this
@list = Product.find(
:select => "id,title",
:include => {
:providers => {
:select => "id,title"
}
}
)
How can specify fields for included table?
Thx!
...
So I'm working on a project and I have to use the set library on class objects. Those objects have many attributes, ID being one of them.
What I wanted to do was search for an object inside a "set" by its ID. The problem is set only has find and I don't know how to search for an ID this way since I'd have to use find(class object) and n...
I want to make an alias which would work like this:
vf hello.c would execute a find command to search for hello.c and open it in the vim editor.
What is the best way to do it? I've tried the following (doesn't work):
alias vf "find -name $* -exec vi {} \;"
alias vf "vi `find -name $*`"
Can anyone help ?
...
Hi,
I'm trying to find the key number in a array matching a string.
I tried array_search in this way
$key = array_search("foo", $array);
echo $array[$key];
but that prints $array[0]
Is there another way to do this?
Thanks :)
...
I am using strpos() to find the needle in the haystack. But, I want it to only find the needle with the same string length. E.g.:
$mystring = '123/abc';
$findme = 'abc';
$pos = strpos($mystring, $findme); // THIS IS FINE
$mystring = '123/abcdefghijk';
$findme = 'abc';
$pos = strpos($mystring, $findme); // THIS IS NOT FINE
So, I...
I have a multi-select box named Manufacturer Name that is displaying correctly, even clickable for multi search. When I run the search I am not getting any results from my database using the complex find conditions I set. I've tried to use Complex-Find-Conditions from the bakery, and other various websites but no avail.
//This my in...
What is wrong in my code?
#!/bin/sh
LOOK_FOR="$1"
for i in `find $2 -name "*jar"`; do
echo "Looking in $i ..."
#jar tvf $i | grep $LOOK_FOR > /dev/null
jar tvf "$i" | grep "$LOOK_FOR"
if [ $? == 0 ] ; then
echo "==> Found \"$LOOK_FOR\" in $i"
fi
done #line 13
Output
wk@wk-laptop:$ sh lookjar.sh org/apache/axis/mes...
Goal, is to extract the content for the CKEDITOR Text Editor, and then only obtain the FIRST paragraph. For some reason the bellow isn't working... Ideas?
Given the following JavaScript:
var newTitle = CKEDITOR.instances.meeting_notes.getData();
newTitle = $(newTitle).find("p:first").text();
...
Hi
I want to copy files found by find (with exec cp option) but, i'd like to change name of those files - e.g find ... -exec cp '{}' test_path/"test_"'{}' , which to my test_path should copy all files found by find but with prefix 'test'. but it ain't work.
I'd be glad if anyone could give me some ideas how to do it.
best regards
...