Search Results

Search found 1530 results on 62 pages for 'killer pl'.

Page 52/62 | < Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >

  • Oracle why does creating trigger fail when there is a field called timestamp?

    - by Omar Kooheji
    I've just wasted the past two hours of my life trying to create a table with an auto incrementing primary key bases on this tutorial, The tutorial is great the issue I've been encountering is that the Create Target fails if I have a column which is a timestamp and a table that is called timestamp in the same table... Why doesn't oracle flag this as being an issue when I create the table? Here is the Sequence of commands I enter: Creating the Table: CREATE TABLE myTable (id NUMBER PRIMARY KEY, field1 TIMESTAMP(6), timeStamp NUMBER, ); Creating the Sequence: CREATE SEQUENCE test_sequence START WITH 1 INCREMENT BY 1; Creating the trigger: CREATE OR REPLACE TRIGGER test_trigger BEFORE INSERT ON myTable REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT test_sequence.nextval INTO :NEW.ID FROM dual; END; / Here is the error message I get: ORA-06552: PL/SQL: Compilation unit analysis terminated ORA-06553: PLS-320: the declaration of the type of this expression is incomplete or malformed Any combination that does not have the two lines with a the word "timestamp" in them works fine. I would have thought the syntax would be enough to differentiate between the keyword and a column name. As I've said I don't understand why the table is created fine but oracle falls over when I try to create the trigger... CLARIFICATION I know that the issue is that there is a column called timestamp which may or may not be a keyword. MY issue is why it barfed when I tried to create a trigger and not when I created the table, I would have at least expected a warning. That said having used Oracle for a few hours, it seems a lot less verbose in it's error reporting, Maybe just because I'm using the express version though. If this is a bug in Oracle how would one who doesn't have a support contract go about reporting it? I'm just playing around with the express version because I have to migrate some code from MySQL to Oracle.

    Read the article

  • SQL command to get field of a maximum value, without making two select

    - by António Capelo
    I'm starting to learn SQL and I'm working on this exercise: I have a "books" table which holds the info on every book (including price and genre ID). I need to get the name of the genre which has the highest average price. I suppose that I first need to group the prices by genre and then retrieve the name of the highest.. I know that I can get the results GENRE VS COST with the following: select b.genre, round(avg(b.price),2) as cost from books b group by b.genre; My question is, to get the genre with the highest AVG price from that result, do I have to make: select aux.genre from ( select b.genre, round(avg(b.price),2) as cost from books b group by b.genre ) aux where aux.cost = (select max(aux.cost) from ( select b.genre, round(avg(b.price),2) as cost from books l group by b.genre ) aux); Is it bad practice or isn't there another way? I get the correct result but I'm not confortable with creating two times the same selection. I'm not using PL SQL so I can't use variables or anything like that.. Any help will be appreciated. Thanks in advance!

    Read the article

  • core dump during std::_List_node_base::unhook()

    - by Ron
    I have a program where std::list is used. The program uses threads which act on the std::list as producers and consumers. When a message is dealt with by the consumer, it is removed from the list using pop_front(). But, during pop_front, there is a core dump. The gdb trace is as below. could you help getting me some insights into this issue? (gdb) bt full 0 0xf7531d7b in std::_List_node_base::unhook () from /usr/lib/libstdc++.so.6 No symbol table info available. 1 0x0805c600 in std::list ::_M_erase (this=0x806b08c, __position={_M_node = 0x8075308}) at /opt/target/usr/include/c++/4.2.0/bits/stl_list.h:1169 __n = (class std::_List_node<myMsg> *) 0x0 2 0x0805c6af in std::list ::pop_front (this=0x806b08c) at /opt/target/usr/include/c++/4.2.0/bits/stl_list.h:750 No locals. 3 0x0805afb6 in Base::run () at ../../src/Base.cc:342 nSentBytes = 130 tmpnm = {_vptr.myMsg = 0x80652c0, m_msg = 0x8075140 "{0130,MSG_TYPE=ND_FUNCTION,ORG_PNAME=P01vm01Ax,FUNCTION=LOG,PARAM_CNT=3,DATETIME=06/12/2010 02:59:26.187,LOGNAME=N,ENTRY=Debug 0 }", m_from = 0x8096ee0 "P01vm01Ax", m_to = 0x0, static m_logged = false, static m_pLogMutex = {_data = {_lock = 0, __count = 0, __owner = 0, __kind = 0, _nusers = 0, {_spins = 0, _list = {_next = 0x0}}}, __size = '\0' , __align = 0}} newMsg = {_vptr.myMsg = 0x80652c0, m_msg = 0x0, m_from = 0x0, m_to = 0x0, static m_logged = false, static m_pLogMutex = {_data = {_lock = 0, __count = 0, __owner = 0, __kind = 0, _nusers = 0, {_spins = 0, _list = {_next = 0x0}}}, __size = '\0' , __align = 0}} strBuffer = "{0440,MSG_TYPE=NG_FUNCTION,ORG_PNAME=mach01./opt/abc/VAvsk/abc/comp/DML/gendrs.pl.17560,DST_PNAME=P01vm01Ax,FUNCTION=DRS_REPLICATE,CAUSE_DML_ERROR=N,CORRUPT_DATA=N,CORRUPT_HEADER=N,DEBUG=Y,EXTENDED_RU"... fds = {{fd = 5, events = 1, revents = 0}} retval = 0 iWaitTime = 0 4 0x0805b277 in startRun () at ../../src/Base.cc:454 No locals. 5 0xf7effe7b in start_thread () from /lib/libpthread.so.0 No symbol table info available. 6 0xf744d82e in clone () from /lib/libc.so.6 No symbol table info available.

    Read the article

  • What java web application framework to use?

    - by frohiky
    One of the main products of my company is an Oracle Forms (and Reports) based application, that "needs" to be re-written in another technology. Why? Users want a more rich interface experience, and we want, preferably, to reduce costs with an open source application server. For this (HUGE) project, we intend to use a java web application framework, keep these points in mind: We have: hundreds of tables on our database (the ORM must be as flexible as possible); some logic which is (and will still be) based on PL/SQL procedures/functions/packages; a lot of CRUDs (the application itself is of an considerable size); a demand to work with/generate documents and workflows; an intranet based user environment; We want: to offer a RIA interface experience; use (if possible) an open source app server; a rapid (as possible) development framework; a somewhat mature framework with a "wise" roadmap (and a considerable community support); a MVC approach combined with JS or GWT widgets (e.g. Vaadin or SmartGWT); Well, in the past weeks I've read a lot of posts, Q&As on stackoverflow, and much more: Wicket, JSF, Tapestry, Grails, GWT, Struts2, Play, Spring, Seam, Echo, .... the list goes on! I've even researched about Alfresco..! The obvious question: Which one to use? At this time, any insight, recommendation, shared experience, advice will be more then welcome!

    Read the article

  • Brackets matching using BIT

    - by amit.codename13
    edit: I was trying to solve a spoj problem. Here is the link to the problem : http://spoj.pl/problems/BRCKTS I can think of two possible data structures for solving the problem one using segment tree and the other using a BIT. I have already implemented the solution using a segment tree. I have read about BIT but i can't figure out how to do a particular thing with it(which i have mentioned below) I am trying to check if brackets are balanced in a given string containing only ('s or )'s. I am using a BIT(Binary indexed tree) for solving the problem. The procedure i am following is as follows: I am taking an array of size equal to the number of characters in the string. I am assigning -1 for ) and 1 for ( to the corresponding array elements. Brackets are balanced in the string only if the following two conditions are true. The cumulative sum of the whole array is zero. Minimum cumulative sum is non negative. i.e the minimum of cumulative sums of all the prefixes of the array is non-negative. Checking condition 1 using a BIT is trivial. I am facing problem in checking condition 2.

    Read the article

  • How can I diagnose "Cannot determine peer address" in my Perl TCP script?

    - by MadBoy
    I've this little script which does it's job pretty well but sometimes it tends to fail. It fails in 2 cases: with error send: Cannot determine peer address at ./tcp-new.pl line 52 with no output or anything, it just fails to deliver what it got to connected Tcp Client. Usually it happens after I disconnect from server, go home and connect it again. To fix this restart is required and it starts working. Sometimes this problem is followed by problem mentioned in point 1. Note: it's not problem when I disconnect and reconnect to it again within short amount of time (unless error nr 1 happens). So can anyone help me make this code be a bit more stable so I don't have to restart it every day? #!/usr/bin/perl use strict; use warnings; use IO::Socket; use IO::Select; my $tcp_port = "10008"; my $udp_port = "2099"; my $tcp_socket = IO::Socket::INET->new( Listen => SOMAXCONN, LocalPort => $tcp_port, Proto => 'tcp', ReuseAddr => 1, ); my $udp_socket = IO::Socket::INET->new( LocalPort => $udp_port, Proto => 'udp', ); my $read_select = IO::Select->new(); my $write_select = IO::Select->new(); $read_select->add($tcp_socket); $read_select->add($udp_socket); while (1) { my @read = $read_select->can_read(); foreach my $read (@read) { if ($read == $tcp_socket) { my $new_tcp = $read->accept(); $write_select->add($new_tcp); } elsif ($read == $udp_socket) { my $recv_buffer; $udp_socket->recv($recv_buffer, 1024, undef); my @write = $write_select->can_write(); foreach my $write (@write) { $write->send($recv_buffer); } } } }

    Read the article

  • Perl : get substring which matches refex error

    - by Michael Mao
    Hi all: I am very new to Perl, so please bear with my simple question: Here is the sample output: Most successful agents in the Emarket climate are (in order of success): 1. agent10896761 ($-8008) 2. flightsandroomsonly ($-10102) 3. agent10479475hv ($-10663) Most successful agents in the Emarket climate are (in order of success): 1. agent10896761 ($-7142) 2. agent10479475hv ($-8982) 3. flightsandroomsonly ($-9124) I am interested only in agent names as well as their corresponding balances, so I am hoping to get the following output: agent10896761 -8008 flightsandroomsonly -10102 agent10479475hv -10663 agent10896761 -7142 agent10479475hv -8982 flightsandroomsonly -9124 For later processes. This is the code I've got so far: #!/usr/bin/perl -w open(MYINPUTFILE, $ARGV[0]); while(<MYINPUTFILE>) { my($line) = $_; chomp($line); # regex match test if($line =~ m/agent10479475/) { if($line =~ m/($-[0-9]+)/) { print "$1\n"; } } if($line =~ m/flightsandroomsonly/) { print "$line\n"; } } The second regex match has nothing wrong, 'cause that is printing out the whole line. However, for the first regex match, I've got some other output such like: $ ./compareResults.pl 3.txt 2. flightsandroomsonly ($-10102) 0479475 0479475 3. flightsandroomsonly ($-9124) 1. flightsandroomsonly ($-8053) 0479475 1. flightsandroomsonly ($-6126) 0479475 If I "escape" the braces like this if($line =~ m/\($-[0-9]+\)/) { print "$1\n"; } Then there is never a match for the first regex... So I stuck with a problem of making that particular regex work. Any hints for this? Many thanks in advance.

    Read the article

  • Why does Perl's DBI complain about "failed: ERROR OCIEnvNlsCreate" when I try to connect to Oracle 1

    - by John
    I am getting the following error connecting to an Oracle 11g database using a simple Perl script: failed: ERROR OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings, permissions, etc. at The script is as follows: #!/usr/local/bin/perl use strict; use DBI; if ($#ARGV < 3) { print "Usage: perl testDbAccess.pl dataBaseUser dataBasePassword SID dataBasePort\n"; exit 0; } my ($user, $pwd, $sid, $port) = @ARGV; my $host = `hostname`; my $dbh; my $sth; my $dbname = "dbi:Oracle:HOST=$host;SID=$sid;PORT=$port"; openDbConnection(); closeDbConnection(); sub openDbConnection() { $dbh = DBI->connect ($dbname, $user ,$pwd , { RaiseError => 1}) || die "Database connection not made: $DBI::errstr"; } sub closeDbConnection() { #$sth->finish(); $dbh->disconnect(); } Anyone seen this problem before?

    Read the article

  • wordpress extended_valid_elements for script tag?

    - by John
    Can someone tell me how to tell Wordpress' tinymce editor to NOT strip out script tags? I looked in wp-admin/includes/post.php and added 'extended_valid_elements'=>'script[charset|defer|language|src|type]', to the $initArray. When I do a view source on the CMS post editor, I see taht it does show up like so: <script type="text/javascript"> /* <![CDATA[ */ tinyMCEPreInit = { base : "http://dev.esolar.ca/wp-includes/js/tinymce", suffix : "", query : "ver=327-1235", mceInit : {mode:"specific_textareas", editor_selector:"theEditor", width:"100%", theme:"advanced", skin:"wp_theme", theme_advanced_buttons1:"bold,italic,strikethrough,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,|,link,unlink,wp_more,|,spellchecker,fullscreen,wp_adv", theme_advanced_buttons2:"formatselect,underline,justifyfull,forecolor,|,pastetext,pasteword,removeformat,|,charmap,|,outdent,indent,|,undo,redo,wp_help", theme_advanced_buttons3:"", theme_advanced_buttons4:"", language:"en", spellchecker_languages:"+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv", theme_advanced_toolbar_location:"top", theme_advanced_toolbar_align:"left", theme_advanced_statusbar_location:"bottom", theme_advanced_resizing:"1", theme_advanced_resize_horizontal:"", dialog_type:"modal", relative_urls:"", remove_script_host:"", convert_urls:"", apply_source_formatting:"", remove_linebreaks:"1", gecko_spellcheck:"1", entities:"38,amp,60,lt,62,gt", accessibility_focus:"1", tabfocus_elements:"major-publishing-actions", media_strict:"", paste_remove_styles:"1", paste_remove_spans:"1", paste_strip_class_attributes:"all", wpeditimage_disable_captions:"", plugins:"safari,inlinepopups,spellchecker,paste,wordpress,media,fullscreen,wpeditimage,wpgallery,tabfocus"}, load_ext : function(url,lang){var sl=tinymce.ScriptLoader;sl.markDone(url+'/langs/'+lang+'.js');sl.markDone(url+'/langs/'+lang+'_dlg.js');} }; /* ]]> */ </script> But for some reason ,my editor still doesn't save <script> tags. What am I doing wrong?

    Read the article

  • Creating A Single Threaded Server with AnyEvent (Perl)

    - by David Williams
    I'm working on creating a local service to listen on localhost and provide a basic call and response type interface. What I'd like to start with is a baby server that you can connect to over telnet and echoes what it receives. I've heard AnyEvent is great for this, but the documentation for AnyEvent::Socket does not give a very good example how to do this. I'd like to build this with AnyEvent, AnyEvent::Socket and AnyEvent::Handle. Right now the little server code looks like this: #!/usr/bin/env perl use AnyEvent; use AnyEvent::Handle; use AnyEvent::Socket; my $cv = AnyEvent->condvar; my $host = '127.0.0.1'; my $port = 44244; tcp_server($host, $port, sub { my($fh) = @_; my $cv = AnyEvent->condvar; my $handle; $handle = AnyEvent::Handle->new( fh => $fh, poll => "r", on_read => sub { my($self) = @_; print "Received: " . $self->rbuf . "\n"; $cv->send; } ); $cv->recv; }); print "Listening on $host\n"; $cv->wait; This doesn't work and also if I telnet to localhost:44244 I get this: EV: error in callback (ignoring): AnyEvent::CondVar: recursive blocking wait attempted at server.pl line 29. I think if I understand how to make a mini, single threaded server that simply prints out whatever its given and then waits for more input, I could take it a lot further from there. Any ideas?

    Read the article

  • Is there a standard pattern for scanning a job table executing some actions?

    - by Howiecamp
    (I realize that my title is poor. If after reading the question you have an improvement in mind, please either edit it or tell me and I'll change it.) I have the relatively common scenario of a job table which has 1 row for some thing that needs to be done. For example, it could be a list of emails to be sent. The table looks something like this: ID Completed TimeCompleted anything else... ---- --------- ------------- ---------------- 1 No blabla 2 No blabla 3 Yes 01:04:22 ... I'm looking either for a standard practice/pattern (or code - C#/SQL Server preferred) for periodically "scanning" (I use the term "scanning" very loosely) this table, finding the not-completed items, doing the action and then marking them completed once done successfully. In addition to the basic process for accomplishing the above, I'm considering the following requirements: I'd like some means of "scaling linearly", e.g. running multiple "worker processes" simultaneously or threading or whatever. (Just a specific technical thought - I'm assuming that as a result of this requirement, I need some method of marking an item as "in progress" to avoid attempting the action multiple times.) Each item in the table should only be executed once. Some other thoughts: I'm not particularly concerned with the implementation being done in the database (e.g. in T-SQL or PL/SQL code) vs. some external program code (e.g. a standalone executable or some action triggered by a web page) which is executed against the database Whether the "doing the action" part is done synchronously or asynchronously is not something I'm considering as part of this question.

    Read the article

  • Unhandled Exception error message

    - by Joshua Green
    Does anyone know why including a term such as: t = PL_new_term_ref(); would cause an Unhandled Exception error message: 0xC0000005: Access violation reading location 0x0000000c. (Visual Studio 2008) I have a header file: class UserTaskProlog : public ArAction { public: UserTaskProlog( const char* name = " sth " ); ~UserTaskProlog( ); AREXPORT virtual ArActionDesired *fire( ArActionDesired currentDesired ); private: term_t t; }; and a cpp file: UserTaskProlog::UserTaskProlog( const char* name ) : ArAction( name, " sth " ) { char** argv; argv[ 0 ] = "libpl.dll"; PL_initialise( 1, argv ); PlCall( "consult( 'myProg.pl' )" ); } UserTaskProlog::~UserTaskProlog( ) { } ArActionDesired *UserTaskProlog::fire( ArActionDesired currentDesired ) { cout << " something " << endl; t = PL_new_term_ref( ); } Without t=PL_new_term_ref() everything works fine, but when I start adding my Prolog code (declarations first, such as t=PL_new_term_ref), I get this Access Violation error message. I'd appreciate any help. Thanks,

    Read the article

  • What should a self-taught programmer with no degree learn/read?

    - by sjbotha
    I am a self-taught programmer and I do do not have any degrees. I started pretty young and I've got about 7 years of actual programming work experience. I believe I'm a pretty good programmer, but I admit that I have not played much with algorithms or delved into any really low-level aspects of programming such as how compilers work. I have worked with other programmers with and without degrees. Some were good and some not; having a degree didn't seem to make any difference as to which pot they fell into. Since then I've come to realize that it does depend on the school where the degree is obtained. Some people suggest that you really should get a degree; that there are things you'll learn in the process that you won't learn in the real world. Of course there is personal growth and discipline learned from completing a task of that magnitude, but let's just concentrate on the technical knowledge. What would I have been taught in a GOOD CS course that would aid me today and what can I read to fill the gap? I've heard the book "Algorithms" mentioned and I plan on reading that. What other books would you recommend? Edit: Clarification on 'actual work experience': Have worked for 2 small companies on teams with fewer than 5 people. About 2 years experience with Perl, Python, PHP, C, C++. About 5 years experience in Java, Applets, RMI, T-SQL, PL/SQL, VB6. 7 years experience in HTML, Javascript, bash, SQL. Most recently in Java designed and helped build an N-tier Java app with web frontend and RMI.

    Read the article

  • Sorting out POCO, Repository Pattern, Unit of Work, and ORM

    - by CoffeeAddict
    I'm reading a crapload on all these subjects: POCO Repository Pattern Unit of work Using an ORM mapper ok I see the basic definitions of each in books, etc. but I can't visualize this all together. Meaning an example structure (DL, BL, PL). So what, you have your DL objects that contain your CRUD methods, then your BL objects which are "mapped" using an ORM back to your DL objects? What about DTOs...they're your DL objects right? I'm confused. Can anyone really explain all this together or send me example code? I'm just trying to put this together. I am determining whether to go LINQ to SQL or EF 4 (not sure about NHibrernate yet). Just not getting the concepts as in physical layers and code layers here and what each type of object contains (just properties for DTOs, and CRUDs for your core DL classes that match the table fields???). I just need some guidance here. I'm reading Fowler's books and starting to read Evans but just not all there yet.

    Read the article

  • How can I create a "dynamic" WHERE clause?

    - by TheChange
    Hello there, First: Thanks! I finished my other project and the big surprise: now everything works as it should :-) Thanks to some helpful thinkers of SO! So here I go with the next project. I'd like to get something like this: SELECT * FROM tablename WHERE field1=content AND field2=content2 ... As you noticed this can be a very long where-clause. tablename is a static property which does not change. field1, field2 , ... (!) and the contents can change. So I need an option to build up a SQL statement in PL/SQL within a recursive function. I dont really know what to search for, so I ask here for links or even a word to search for.. Please dont start to argue about wether the recursive function is really needed or what its disadvanteges - this is not in question ;-) If you could help me to create something like an SQL-String which will later be able to do a successful SELECT this would be very nice! Iam able to go through the recursive function and make a longer string each time, but I cannot make an SQL statement from it.. Oh, one additional thing: I get the fields and contents by a xmlType (xmldom.domdocument etc) I can get the field and the content for example in a clob from the xmltype

    Read the article

  • Get Image from Byte Aarray.

    - by Arun Thakkar
    Hello Everyone!! Hope You all are fine and also in one of your best of moods!! Hope You all are Enjoying iPhone development. I herewith one issue that i am not able to solve, may be i don't know the depth concept of iPhone. So Its my humble requet to you to guide me or suggest or share your ideas. I do find an issue with getting an image from Bytes array. I am calling a webservice which returns an image in form of Bytes Array as response. I have Converted this bytes array in to form of NSData, Now i have NSData, But When i Try to get an image from this NSData, It shows nil. I Did lots of R&D and Find one suggestion to use base64 encoder, But unfortunately because of not proper guidance I was not able to Implement that. I was also suggested to use OPenSSL Library for base64 from url http://www.cocoadev.com/index.pl?BaseSixtyFour But again i was not able to include #include #include these two files. as in Newer Version of SDK 3.X family Apple has depreciated those (as i guess). So Now i need help from you guys. kindly help me if you have solution or if you know the steps to solve these. Looking Forwards. Regards, Arun Thakkar

    Read the article

  • OmniCppComplete: Completing on Class Members which are STL containers

    - by Robert S. Barnes
    Completion on class members which are STL containers is failing. Completion on local objects which are STL containers works fine. For example, given the following files: // foo.h #include <string> class foo { public: void set_str(const std::string &); std::string get_str_reverse( void ); private: std::string str; }; // foo.cpp #include "foo.h" using std::string; string foo::get_str_reverse ( void ) { string temp; temp.assign(str); reverse(temp.begin(), temp.end()); return temp; } /* ----- end of method foo::get_str ----- */ void foo::set_str ( const string &s ) { str.assign(s); } /* ----- end of method foo::set_str ----- */ I've generated the tags for these two files using: ctags -R --c++-kinds=+pl --fields=+iaS --extra=+q . When I type temp. in the cpp I get a list of string member functions as expected. But if I type str. omnicppcomplete spits out "Pattern Not Found". I've noticed that the temp. completion only works if I have the using std::string; declaration. How do I get completion to work on my class members which are STL containers?

    Read the article

  • CSS style refresh in IE after dynamic removal of style link

    - by rybz
    Hi! I've got a problem with the dynamic style manipulation in IE7 (IE8 is fine). Using javascript I need to add and remove the < link / node with the definition of css file. Adding and removing the node as a child of < head / works fine under Firefox. Unfortunately, after removing it in the IE, although The tag is removed properly, the page style does not refresh. In the example below a simple css (makes background green) is appended and removed. After the removal in FF the background turns default, but in IE stays green. index.html <html> <head> </head> <script language="javascript" type="text/javascript"> var node; function append(){ var headID = document.getElementsByTagName("head")[0]; node = document.createElement('link'); node.type = 'text/css'; node.rel = 'stylesheet'; node.href = "s.css"; node.media = 'screen'; headID.appendChild(node); } function remove(){ var headID = document.getElementsByTagName("head")[0]; headID.removeChild(node); } </script> <body> <div onClick="append();"> add </div> <div onClick="remove();"> remove </div> </body> </html> And the style sheet: s.css body { background-color:#00CC33 } Here is the live example: http://rlab.pl/dynamic-style/ Is there a way to get it working?

    Read the article

  • Why does my Jabber bot only work if I'm debugging my Perl script?

    - by TheGNUGuy
    I am trying to make a jabber bot from scratch and my script is acting funny. I was originally developing the bot on a remote CentOS box, but I have switched to a local Win7 machine. Right now I'm using ActiveState Perl and I'm using Eclipse with the Perl plugin to run a debug the script. The funny behavior I'm experiencing occurs when I run or debug the script. If I run the script using the debugger it works fine, meaning I can send messages to the bot and it can send messages to me. However when I just execute the script normally the bot sends the successful connection message then it disconnects from my jabber server and the script ends. I'm a novice when it comes to Perl and I can't figure out what I'm doing wrong. My guess is it has something to do with the subroutines and sending the presence of the bot. (I know for sure that it has something to do with sending the bot's presence because if the presence code is removed, the script behaves as expected except the bot doesn't appear to be online.) If anyone can help me with this that would be great. I originally had everything in 1 file but separated them into several trying to figure out my problem here are the pastebin links to my source code. jabberBot.pl: http://pastebin.com/cVifv0mm chatRoutine.pm: http://pastebin.com/JXmMT7av trimSpaces.pm: http://pastebin.com/SkeuWtu1 Thanks again for any help!

    Read the article

  • DataSets to POCOs - an inquiry regarding DAL architecture

    - by alexsome
    Hello all, I have to develop a fairly large ASP.NET MVC project very quickly and I would like to get some opinions on my DAL design to make sure nothing will come back to bite me since the BL is likely to get pretty complex. A bit of background: I am working with an Oracle backend so the built-in LINQ to SQL is out; I also need to use production-level libraries so the Oracle EF provider project is out; finally, I am unable to use any GPL or LGPL code (Apache, MS-PL, BSD are okay) so NHibernate/Castle Project are out. I would prefer - if at all possible - to avoid dishing out money but I am more concerned about implementing the right solution. To summarize, there are my requirements: Oracle backend Rapid development (L)GPL-free Free I'm reasonably happy with DataSets but I would benefit from using POCOs as an intermediary between DataSets and views. Who knows, maybe at some point another DAL solution will show up and I will get the time to switch it out (yeah, right). So, while I could use LINQ to convert my DataSets to IQueryable, I would like to have a generic solution so I don't have to write a custom query for each class. I'm tinkering with reflection right now, but in the meantime I have two questions: Are there any problems I overlooked with this solution? Are there any other approaches you would recommend to convert DataSets to POCOs? Thanks in advance.

    Read the article

  • User input in Perl with IO::Socket

    - by David
    I am trying to make a perl program which allows a user to input the host and the port number of a foreign host to connect to using IO::Socket. It allows me to run the program and input a host and a port but it never connects and says "Could not connect to [host] at c:\users\USER\Documents\code\perl\sql.pl line 18, line 2." What am i doing wrong with this code shown below? And also, how can i have input validation on my host, which can either be a host name or an ip address? Thanks a bunch! Code Below use IO::Socket print "Host to connect to: "; chomp ($host = <STDIN>); print "Port to connect with: "; chomp ($port = <STDIN>); while(($port > 65535) || ($port <= 0)){ print "Port to connect with [Port > 0 < 65535] : "; chomp ($port = <STDIN>); } print "\nConnecting to host $host on port $port\n"; $socket = new IO::Socket::INET ( LocalHost => '$host', LocalPort => '$port', Proto => 'tcp', Listen => 5, Reuse => 1 ); die "Could not connect to $host";

    Read the article

  • How can I define an empty array in a Perl construtor?

    - by Laimoncijus
    I am just beginner with Perl, so if it sounds stupid - sorry for that :) My problem is - I am trying to write a class, which has an empty array, defined in constructor of a class. So I am doing this like this: package MyClass; use strict; sub new { my ($C) = @_; my $self = { items => () }; bless $self, ref $C || $C; } sub get { return $_[0]->{items}; } 1; Later I am testing my class with simple script: use strict; use Data::Dumper; use MyClass; my $o = MyClass->new(); my @items = $o->get(); print "length = ", scalar(@items), "\n", Dumper(@items); And while running the script I get following: $ perl my_test.pl length = 1 $VAR1 = undef; Why am I doing wrong what causes that I get my items array filled with undef? Maybe someone could show me example how the class would need to be defined so I would not get any default values in my array?

    Read the article

  • How to count the Chinese word in a file using regex in perl?

    - by Ivan
    I tried following perl code to count the Chinese word of a file, it seems working but not get the right thing. Any help is greatly appreciated. The Error message is Use of uninitialized value $valid in concatenation (.) or string at word_counting.pl line 21, <FILE> line 21. Total things = 125, valid words = which seems to me the problem is the file format. The "total thing" is 125 that is the string number (125 lines). The strangest part is my console displayed all the individual Chinese words correctly without any problem. The utf-8 pragma is installed. #!/usr/bin/perl -w use strict; use utf8; use Encode qw(encode); use Encode::HanExtra; my $input_file = "sample_file.txt"; my ($total, $valid); my %count; open (FILE, "< $input_file") or die "Can't open $input_file: $!"; while (<FILE>) { foreach (split) { #break $_ into words, assign each to $_ in turn $total++; next if /\W|^\d+/; #strange words skip the remainder of the loop $valid++; $count{$_}++; # count each separate word stored in a hash ## next comes here ## } } print "Total things = $total, valid words = $valid\n"; foreach my $word (sort keys %count) { print "$word \t was seen \t $count{$word} \t times.\n"; } ##---Data---- sample_file.txt ??????,???????,????.??????.????:"?????????????,??????,????????.????????,?????????, ???????????.????????,???????????,??????,??????.???:`??,???????????.'?????, ??????????."??????,??????.????.???, ????????????,????,??????,?????????,??????????????. ????????,??????,???????????,????????,????????.????,????,???????, ??????????,??????,????????.??????.

    Read the article

  • excel graphs using perl

    - by user1822725
    i amfacing problem when i ran the script its giving error like Can't locate object method "add_chart" via package "Spreadsheet::WriteExcel" at chart_column.pl line 33. May i know what is the problem here? And i am using perl, v5.8.5 built for x86_64-linux. #!/usr/bin/perl -w ############################################################################### # # A simple demo of Column charts in Spreadsheet::WriteExcel. # # reverse('©'), December 2009, John McNamara, [email protected] # use strict; use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new( 'chart_column.xls' ); my $worksheet = $workbook->add_worksheet(); my $bold = $workbook->add_format( bold => 1 ); # Add the worksheet data that the charts will refer to. my $headings = [ 'Category', 'Values 1', 'Values 2' ]; my $data = [ [ 2, 3, 4, 5, 6, 7 ], [ 1, 4, 5, 2, 1, 5 ], [ 3, 6, 7, 5, 4, 3 ], ]; $worksheet->write( 'A1', $headings, $bold ); $worksheet->write( 'A2', $data ); ############################################################################### # # Example 1. A minimal chart. # my $chart1 = $workbook->add_chart( type => 'column' ); # Add values only. Use the default categories. $chart1->add_series( values => '=Sheet1!$B$2:$B$7' ); # Insert the chart into the main worksheet. $worksheet->insert_chart( 'E2', $chart1 );

    Read the article

  • How do I use Spreadsheet::WriteExcel to create a chart from numeric log data?

    - by yaohung
    I used csv2xls.pl to convert a text log into .xls format, and then I create a chart as in the following: my $chart3 = $workbook->add_chart( type => 'line' , embedded => 1); # Configure the series. $chart3->add_series( categories => '=Sheet1!$B$2:$B$64', values => '=Sheet1!$C$2:$C$64', name => 'Test data series 1', ); # Add some labels. $chart3->set_title( name => 'Bridge Rate Analysis' ); $chart3->set_x_axis( name => 'Packet Size ' ); $chart3->set_y_axis( name => 'BVI Rate' ); # Insert the chart into the main worksheet. $worksheet->insert_chart( 'G2', $chart3 ); I can see the chart in the .xls file. However, all the data are in text format, not numeric, so the chart looks wrong. How do I convert text into number before applying this create-chart function? Also, how do I sort the .xls file before creating the chart?

    Read the article

< Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >