Daily Archives

Articles indexed Sunday May 2 2010

Page 17/69 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Better viewing of postfix mail queue files than postcat?

    - by Geekman
    So I got a call early this morning about a client needing to see what email they have waiting to be delivered sitting in our secondary mail server. Their link for the main server had (still is) been down for two days and they needed to see their email. So I wrote up a quick perl script to use mailq in combination with postcat to dump each email for their address into separate files, tar'd it up and sent it off. Horrible code, I know, but it was urgent. My solution works OK in that it at least gives a raw view, but I thought tonight it would be nice if I had a solution where I could provide their email attachments and maybe remove some "garbage" header text as well. Most of the important emails seem to have a PDF or similar attached. I've been looking around but the only method of viewing queue files I can see is the postcat command, and I really don't want to write my own parser - so I was wondering if any of you have already done so, or know of a better command to use? Here's the code for my current solution: #!/usr/bin/perl $qCmd="mailq | grep -B 2 \"someemailaddress@isp\" | cut -d \" \" -f 1"; @data = split(/\n/, `$qCmd`); $i = 0; foreach $line (@data) { $i++; $remainder = $i % 2; if ($remainder == 0) { next; } if ($line =~ /\(/ || $line =~ /\n/ || $line eq "") { next; } print "Processing: " . $line . "\n"; `postcat -q $line > $line.email.txt`; $subject=`cat $line.email.txt | grep "Subject:"`; #print "SUB" . $subject; #`cat $line.email.txt > \"$subject.$line.email.txt\"`; } Any advice appreciated.

    Read the article

  • MySQL/SQL: Update with correlated subquery from the updated table itself

    - by Roee Adler
    I have a generic question that I will try to explain using an example. Say I have a table with the fields: "id", "name", "category", "appearances" and "ratio" The idea is that I have several items, each related to a single category and "appears" several times. The ratio field should include the percentage of each item's appearances out of the total number of appearances of items in the category. In pseudo-code what I need is the following: For each category find the total sum of appearances for items related to it. For example it can be done with (select sum("appearances") from table group by category) For each item set the ratio value as the item's appearances divided by the sum found for the category above Now I'm trying to achieve this with a single update query, but can't seem to do it. What I thought I should do is: update Table T set T.ratio = T.appearances / ( select sum(S.appearances) from Table S where S.id = T.id ) But MySQL does not accept the alias T in the update column, and I did not find other ways of achieving this. Any ideas?

    Read the article

  • What to write in "Web location" field when starting an "New website" in Visual Studio 2010?

    - by Ivan
    I want a website to be deployed automatically to a local IIS (built in Windows XP Pro SP3), avoiding VisualStudio-built-in server if possible. I'd like development source files to be stored in a project folder outside wwwroot (I wouldn't mind built files to be copied to wwwroot each time I press F5). I don't store my projects inside default directories inside "My documents". What should I specify as in "Web location" when starting an "New website" in Visual Studio 2010? A deployment path in wwwroot, a folder where I'd like to save my project, or something else? I want the website to be a part of a complex solution in VS 2010, also icludinc a class libray project, a WinForms application project, a Windows Service project and a common Entitity Framework data model.

    Read the article

  • Entity Framework model and foreign key property

    - by verror
    I have 2 tables that I import to EF model. First table has a property [section] that acts as foreign key to the second table. When I map this property in model to the table and try to compile I get this error: Problem in Mapping Fragments starting at lines 158, 174: Non-Primary-Key column(s) [Section] are being mapped in both fragments to different conceptual side properties - data inconsistency is possible because the corresponding conceptual side properties can be independently modified. If i remove this property from the model it passes, but when I query the data I don't have the section field. I know that I can get it by using the navigation field and reading this property from the second table, but to make it work I must include the other table in my query. var res = from name in Context.Table1.Include("Table2")... Why do I need to include the association just for one field?

    Read the article

  • In my cakephp project the save function is not working?

    - by Faheem
    My controller action is: function add() { if (!empty($this-data)) { $this-Customer-create(); if ($this-Customer-save($this-data)) { $this-Session-setFlash('A new Customer has been added'); $this-redirect(array('action'='index')); } else { $this-Session-setFlash('The customer cannot be added this time. Try again later.'); $this-redirect(array('action'='index')); } } } My model is: class Customer extends AppModel { var $name = 'Customer'; var $validate = array( 'name' = array( 'length'= array( 'rule' = array('between', 4,50), 'message' = 'Name must be minimum 4 and maximum 50 characters long.' ), 'checkUnique'= array( 'rule' = 'isUnique', 'message' = 'This Name is already registered' ) )); and this is my view: create('Customer',array('action'='add'));? input('Customer.name'); echo $form-input('Customer.balance',array('type'='hidden','default'=0)); ? end('Submit');? every time I submit the form it splashes: The customer cannot be added this time. Try again later.

    Read the article

  • Why is it so hard to build a gtk programe without console using cmake in windows?

    - by Runner
    I'm following the tuto: http://zetcode.com/tutorials/gtktutorial/firstprograms/ It works but each time I double click on the executable,there is a console which I don't want it there. How do I get rid of that console? I tried this: add_executable(Cmd WIN32 cmd.c) But got this fatal error: MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup Cmd.exe : fatal error LNK1120: 1 unresolved externals While using gcc directly works: gcc -o Cmd cmd.c -mwindows .. I'm guessing it has something to do with the entry function: int main( int argc, char *argv[]),but why gcc works? How can I make it work with cmake?

    Read the article

  • Outlook 2007 Archiving through macros

    - by Balaji V
    In Outlook 2007, the Archiving options are very forbidding. I DONT want Outllok to Auto Archive, I prefer to do it manually. Having said that, I want Outlook to ARCHIVE only a selected set of folders. In older version, unchecking the "include in auto arhive" option excludes these folders. Unfortunately 2007 makes life more complicated. A. Can someone help me how to exclude a set of sub-folders from archiving while doing a manual archiving. B. Is there a way I can use Macros to archive folders, this will solve all my problems.

    Read the article

  • SEO and dynamic javascript HTML switching

    - by Gazow
    just wondering if anyone knows anything of using javascript to set html to new content instead of linking to new pages, if this is generally a bad idea or if it kind of hurts SEO(which im kind of new to) Basically the home page displays given content, and the links to like contact pages and stuff, just change the body content to what would normally be a separate html page. my OCD kinda bugs me when pages reload and either flash the background or its offset somehow, so i wanted to know if making sites like this was a bad idea or whatever- i suppose at the least, i could create duplicates/hidden pages for SEO purposes

    Read the article

  • Problem with user login validation by authlogic

    - by Andrei
    Hi, I want to use email for signing in, and to allow users to have similar names. One way to do this is to rename login/username field to something different. However, I want to do it just by setting up authlogic. I tried the following acts_as_authentic do |c| c.login_field :email c.validate_login_field false c.validate_email_field true end but it still complains that the login already exists. What must be done to avoid username validation without renaming the field?

    Read the article

  • twitter like tweet update notification in asp.net

    - by dianuh
    we are adding new functionality in our application where in there would be some users posting short comments and on the other side there would be some users monitoring the activity or comments posted by the other users within the same application. my question is, what is the best way of implementing the notification of new comment availability(similar to tweet update notification)? FYI the application is on .Net 3.5.

    Read the article

  • gen_server with a dict vs mnesia table vs ets

    - by pablo
    Hi, I'm building an erlang server. Users sends http requests to the server to update their status. The http request process on the server saves the user status message in memory. Every minute the server sends all messages to a remote server and clear the memory. If a user update his status several times in a minute, the last message overrides the previous one. It is important that between reading all the messages and clearing them no other process will be able to write a status message. What is the best way to implement it? gen_server with a dict. The key will be the userid. dict:store/3 will update or create the status. The gen_server solves the 'transaction' issue. mnesia table with ram_copies. Handle transactions and I don't need to implement a gen_server. Is there too much overhead with this solution? ETS table which is more light weight and have a gen_server. Is it possible to do the transaction in ETS? To lock the table between reading all the messages and clearing them? Thanks

    Read the article

  • Row level user permissions, help with design

    - by bambam
    Hi, Say I am creating a forums application, I understand how to design a forum level permission system with Groups. i.e. you create a forum to group mapping, and assign users to a group to give them access to a particular forum. How can I refine the permissions to allow for row level permissions (or in forum terms, post level).

    Read the article

  • Conditional root_url (index)

    - by vise
    I'd like my application to display different data on the frontpage depending on whether the user has been logged in or not. def index if current_user # render another controllers action else # render another controllers action end end I can achieve this by using render_component. However it has been obsolete for some time. Although I can still use it as a plugin, I'm interested if anyone has a better approach. Just take in mind that rendering another controller's view directly is not an option. Thanks.

    Read the article

  • Pass parameters to Flash Main (Document) class

    - by loto
    In Flash CSn/AS3 you associate a Main class with a flash file which when loaded in the flash player "automatically creates an instance of the program's main class." I'd like to know how to pass arguments to the main class, since you don't write it yourself (you put its name in the Document textfield in the IDE).

    Read the article

  • Need to constantly monitor serial data in Python

    - by jakke34
    Right now I am using an arduino to send data from an analog sensor to COM4. I am trying to make a python script that continuously monitors that data and looks for a certain parameter. I tried something like this but it isn't outputing the data like I want. import serial port = "COM4" ser = serial.Serial(port,9600, timeout =1) value = 0 while 1: value = ser.read() print value

    Read the article

  • different amazon image with/without ebs boot?

    - by user41999
    i'm at http://alestic.com/ and can see Ubuntu 10.04 Lucid Canonical, ubuntu@ Ubuntu 10.04 Lucid Canonical, ubuntu@EBS boot 1.what is the different between with/without EBS boot? any article explaining this? 2. can provide advantage/disadvantages of using not using ebs boot?

    Read the article

  • OWA web access calendar view missing items

    - by Marrie
    I have a user syncing calendar items - uses Outlook 2003, uses iPhone and uses OWA web access to view calendar....some recurring all day events are not showing up in OWA web access view, they are viewable in both iPhone and Outlook (client)....any ideas? ...Using Outlook Web Access version: 8.1.240.5 with Exchange Server 2007 Version: 08.01.0240.006

    Read the article

  • Question about Benchmark funcion in Mysql ( Incredible results ).

    - by xRobot
    I have 2 tables: author with 3 millions of rows. book with 20 miles rows. . So I have benchmarked this query with a join: SELECT BENCHMARK(100000000, 'SELECT book.title, author.name FROM `book` , `author` WHERE book.id = author.book_id ') And this is the result: Query took 0.7438 sec ONLY 0.7438 seconds for 100 millions of query with a join ??? Do I make some mistakes or this is the right result ?

    Read the article

  • html parsing with libxml

    - by zajcev
    In another thread I got convinced into using HTML parsers instead of regexps for HTML parsing (I thought they would work fine, but they didn't ;) ). I thought of using libxml (it has some HTML parser built in), but failed to find any useful tutorial. I also found this site and it says here it should do fine even with severly broken HTML. Could you give me some examples of HTML parsing with libxml, or maybe recommend some different free library for Linux? I'm using C++. I just thought someone would have some example code, so that I don't have to analyze the headers ;)

    Read the article

  • How to remove a tagged block of text in a file?

    - by EmpireJones
    How can I remove all instances of tagged blocks of text in a file with sed, grep, or another program? If I have a file which contains: random text // START TEXT internal text // END TEXT more random // START TEXT asdf // END TEXT text how can I remove all blocks of text within the start/end lines, produce the following? random text more random text

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >