Displaying 20 results from an estimated 900 matches similar to: "How to get mime extension with file_column"
2006 Mar 03
7
Meta Programming Help
I have the following two methods:
def ProductFile::find_images(mode, prod_id)
# convert to symbol in case it is not (most commonly it may be a String)
mode = mode.to_sym
case mode
when :all, :first
ProductFile::find(mode, :conditions => ["product_id = ? AND
file_type LIKE ?", prod_id, "image%"])
end
end
def ProductFile::find_documents(mode,
2006 Feb 28
6
How To Validate Boolean Form Field
Hello all.
I''ve got the following in my model:
class Individual < ActiveRecord::Base
validates_presence_of :first_name, :last_name, :street, :city,
:state, :zip
validates_acceptance_of :AZ_resident, :message => "You must be an
Arizona resident."
end
The AZ_resident field is present and defined as boolean (PostgreSQL
8.1), but validation will not occur.
2006 Mar 16
0
problem with file_column storing images and other files
I have a model called ProductFiles which associates an arbitrary
amount of image and documents with a product. I am using the
file_column plugin to manage the upload and storage of the images,
like so:
class ProductFile < ActiveRecord::Base
# Accepted MIME types, mime types that are not part of this list are rejected
MIME_EXTENSIONS = {
"image/gif" => "gif",
2006 Mar 02
2
url_for_file_column not returning correct path
I added this test towards the end of the included
file_column_helper_test.rb that shipped with the file_column plugin:
def test_url_for_file_column_different_root_path
Entry.file_column :image, :root_path => File.join(RAILS_ROOT,
"public/files")
e = Entry.new(:image => upload(f("skanthak.png")))
assert_match %r{/public/files/entry/image},
2006 Mar 02
17
can''t get rails to connect to mySQL - HELP!!!!!!!!!
Sorry, but this is really NOT as easy as the tutorials/books make out.
I''m really struggling at the first hurdle here. And while I''m not a
programmer by design I do know my way around most stuff. And if I can''t
get this to work I suspect more people will have the same issues. There
seems to be too many variables to address.
I have winXP, I have ruby and rails all
2006 Jun 22
3
Compare against array
I have a database field called file_type. I want to compare it against
an array of types to either display it as an image or just create a link
to it. I am sure there is an easy way to do this but I can''t think of
it.
I don''t want to do this:
<% if resource.file_type == ".png" OR resource.file_type == ".jpg" ...
%>
I would like to do:
<% if
2012 Jun 19
0
[LLVMdev] llvm/include/Support/FileSystem.h
This is a proposed patch to enhance FileSystem.h to add functionality (getting and setting permission bits and mapping an unmapping files). This implementation follows the N3365 proposal regarding permission bits.
This functionality is needed for my next patch which will implement llvm/include/Support/FileOutputBuffer.h which is needed by lld.
-------------- next part --------------
A
2012 May 18
2
[LLVMdev] [RFC] llvm/include/Support/FileOutputBuffer.h
On Fri, May 18, 2012 at 3:07 PM, Michael Spencer <bigcheesegs at gmail.com> wrote:
>
>> + error_code ec = sys::fs::status(filePathTwine, stat);
>
> stat is undefined if ec isn't success. ec will be success even in the case of
> file_not_found.
Actually I was wrong. The Windows and UNIX implementation disagree on
this point. I'm going to change it to match
2010 Mar 10
2
Windows API to connect UnixOdbc is not functional in Wine
Hello,
I have configured Wine in Ubuntu 9.04 to use the built-in odbc32.dll which in turn uses the Linux's unixodbc package.
When I am trying to run my windows application which actually uses Windows API connecting to Unix ODBC is not working.
The API uses is SQLDriverConnect (), that returns me error
[unixODBC][Driver Manager]Can't open lib '/usr/lib/libtdsodbc.so' file not
2006 Mar 13
3
unit tests executed for every page load ?
After I installed the very sweet file_column plugin I get strange output
on my html pages. At the very end I always get something like this:
"Loaded suite dispatch.cgi Started Finished in 0.000218 seconds. 0
tests, 0 assertions, 0 failures, 0 errors "
Seems like there is executed a non existent test suite for every page
load. Can anybody help me find the lines that force this
2006 Mar 01
2
SQLite in small production environment
I apologize if this has been asked before, but couldn''t search the
forum-mailing-list bridge. It seems the search feature is currently
disabled.
I wanted to know if SQLite will work for my company in a production environment.
My company''s current website gets about 15,000 hits/month. The most
hits it ever got in a day was about 1,500.
I will be deploying my application on a
2015 Aug 18
3
Supporting symbolic links in Path library routines
include/llvm/Support/FileSystem.h has file_type which enumerates the file system’s view of the file type. One of the values is “symlink_file”.
But because the Unix implementation of status() calls stat() instead of lstat(), if the path refers to a symbolic link, the link is followed. There’s no way to get information about the symbolic link itself.
I think changing status() to call lstat() is
2007 Sep 21
3
TextMate Bundle and exception when switching to alternate file.
Hey,
sorry if this is something better suited to another list.
I''ve encountered a strange problem with the RSpec.tmbundle in trunk -
namely that it was raising an exception when pressing
ctrl-shift-downarrow (switch between spec and source - "Alternate
File").
I tracked down the issue to be handling of the file_type in
switch_command.rb#content_for() - the code expected the
2019 Jan 30
2
SELinux policy vs. static web content
Hi,
Some time ago I wrote an introductory article about SELinux on my blog.
I'm currently updating it for my new blog, and I found a curious change
in SELinux policy. Here goes.
For demonstration purposes, I'm using some static webpages, more exactly
the default pages found in /usr/share/httpd/noindex, which I simply
copied over to /var/www/html.
As a first practical example, I'm
2006 Mar 03
5
avoiding nil object error?
I''m a total Rails newbie and i''ve been struggling for hours today
with one (prolly very silly) problem:
I have a table portfolios that has many images:
class Portfolio < ActiveRecord::Base
has_many :images
end
class Image < ActiveRecord::Base
belongs_to :portfolios
end
In the controller i define a list of active portfolios:
@active_portfolios =
2006 May 03
2
How do you use the ''vendor'' directory with 3rd party libraries?
Hi,
I''m wondering how to use the ''vendor'' directory in a Rails app. I
know that you can put plugins and engines into the ''vendor/plugins''
directory and that svn:externals can be used for that, but I was
wondering how & where I put a 3rd party library? My specific case is
the pdf-writer code, which I''d rather have inside my app than as a
2018 Dec 03
3
[supermin PATCH] build: ignore empty files
Do not error out on empty files, just ignore them.
---
src/mode_build.ml | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/mode_build.ml b/src/mode_build.ml
index b5f5fa6..9cd0a21 100644
--- a/src/mode_build.ml
+++ b/src/mode_build.ml
@@ -46,6 +46,7 @@ and file_content =
| Packages
| Hostfiles
| Excludefiles
+| Empty
let rec string_of_file_type = function
|
2006 Apr 27
1
Whats this for a block?
Hi,
I have got a question concerning directory entries. I have the following
block containing exactly the filenames I had in one specified folder on
the same file system:
http://www.sbox.tugraz.at/home/n/nobaq/ext2.dat
I really hoped that this is an directory block which could point me to
the inode of the files.
But when I try to extract the data, I only get garbage. I'm reading the
2018 Feb 15
1
[PATCH] daemon: tsk: handle new enum values in sleuthkit 4.5
Resort to a version check for them, as they do not exist in older
versions.
---
daemon/tsk.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/daemon/tsk.c b/daemon/tsk.c
index af803d749..ad10d74fe 100644
--- a/daemon/tsk.c
+++ b/daemon/tsk.c
@@ -241,6 +241,9 @@ file_type (TSK_FS_FILE *fsfile)
case TSK_FS_NAME_TYPE_SHAD: return 'h';
case TSK_FS_NAME_TYPE_WHT: return
2011 Oct 18
5
[PATCH febootstrap] Some cleanups for Debian and Ubuntu
I just tried to get libguestfs to compile on Ubuntu 11.10 using the
latest febootstrap, and the following patches were necessary for me.
They are all just reasonable code cleanups *except* for patch 5/5
which is a gross hack for something I don't understand about how
Ubuntu 11.10 multiarch support works.
Rich.