Search Results

Search found 19539 results on 782 pages for 'pretty print'.

Page 64/782 | < Previous Page | 60 61 62 63 64 65 66 67 68 69 70 71  | Next Page >

  • Project Euler 1: (Iron)Python

    - by Ben Griswold
    In my attempt to learn (Iron)Python out in the open, here’s my solution for Project Euler Problem 1.  As always, any feedback is welcome. # Euler 1 # http://projecteuler.net/index.php?section=problems&amp;id=1 # If we list all the natural numbers below 10 that are # multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of # these multiples is 23. Find the sum of all the multiples # of 3 or 5 below 1000. import time start = time.time() print sum([x for x in range(1000) if x % 3== 0 or x % 5== 0]) print "Elapsed Time:", (time.time() - start) * 1000, "millisecs" a=raw_input('Press return to continue') # Also cool def constraint(x): return x % 3 == 0 or x % 5 == 0 print sum(filter(constraint, range(1000)))

    Read the article

  • Hard Copies VS Soft Copies

    - by Garet Claborn
    Where do you draw the line and say, "OK, I'm actually going to print out this piece of code, spec, formula, or other info and carry it around but these pieces can stay on disk." Well, more importantly why do you draw the line there? I've encountered this a number of times and have some sort of vague conceptions beyond "oh now I'm REALLY stuck, better print this out." I've also found some quicksheets of basic specs to be handy. Really though, I have no particular logic behind what is useful to physically have available in the design and development process. I have a great pile of 'stuff' papers that seemed at least partially relevant at the time, but I only really use about a third of them ever and often end up wishing I had different info on hand. Edit: So this is what I'm hearing in a nutshell: Major parts of the design pattern Common, fairly static and prominently useful code (reference or specs) Some representation of data useful in collaborating or sharing with team Extreme cases of tough problem solving Overwhelmingly,almost never print anything.

    Read the article

  • I have 20 Ubuntu 12.04 LTS machines Some are unable to network with other machines , they all have same workgroup viz. Ubuntu

    - by Gaurang Agrawal
    During installation I updated my workgroup to "Workgroup" , after installation I changed it to ubuntu as I was unable to access computers in network . What changes do I need to make in samba configuration ? I don't know if this is related , shared@shared:~$ testparm Load smb config files from /etc/samba/smb.conf rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384) Processing section "[printers]" Processing section "[print$]" Loaded services file OK. Server role: ROLE_STANDALONE Press enter to see a dump of your service definitions [global] workgroup = UBUNTU server string = %h server (Samba, Ubuntu) encrypt passwords = No map to guest = Bad User obey pam restrictions = Yes pam password change = Yes passwd program = /usr/bin/passwd %u passwd chat = Enter\snew\s\spassword:* %n\n Retype\snew\s\spassword:* %n\n password\supdated\ssuccessfully . username map = /etc/samba/smbusers unix password sync = Yes syslog = 0 log file = /var/log/samba/log.%m max log size = 1000 name resolve order = bcast host dns proxy = No usershare allow guests = Yes panic action = /usr/share/samba/panic-action %d idmap config * : backend = tdb [printers] comment = All Printers path = /var/spool/samba create mask = 0700 printable = Yes print ok = Yes browseable = No [print$] comment = Printer Drivers path = /var/lib/samba/printers smbclient -L 192.168.1.108 Enter shared's password: Connection to 192.168.1.108 failed (Error NT_STATUS_HOST_UNREACHABLE)

    Read the article

  • Very heavy .PDF file. How to handle it?

    - by Luigi
    I should print this file on paper, but it is heavy (2,3 MB) and the printing process is very slow. But this is not the whole problem. I should first create another .pdf file (grayscale) with four pages on each sheet. When I try to print this file as a .pdf file, the process of creation of the new file is even slower than the printing process, and the output file is much heavier than the original (hundreds of megabytes). How can I shrink the pdf file? Is there a way to create a printer friendly .pdf version of the file? Before you ask, I can't simply print it on pages. I must create this .pdf file with four pages on each sheet.

    Read the article

  • How can I change the wallpaper using a Python script?

    - by furtelwart
    I want to change my wallpaper in Ubuntu 11.10 (with Unity) in a small Python script. I found the possibility to change it via the gconf-editor in /desktop/gnome/background/picture_filename. With python-gconf, I'm able to change the necessary values. Apparently, the gconf string is not read out. If I change it (either via a script or via gconf-editor), the wallpaper remains and in the menu of "Change wallpaper", the old wallpaper is shown. How am I able to change the wallpaper for Unity via a Python script? The following code does work. Apparently, the gsettings are only applied, if some Gtk code is executed. #!/usr/bin/python # -*- coding: utf-8 -*- from gi.repository import Gtk, Gio class BackgroundChanger(): SCHEMA = 'org.gnome.desktop.background' KEY = 'picture-uri' def change_background(self, filename): gsettings = Gio.Settings.new(self.SCHEMA) print(gsettings.get_string(self.KEY)) print(gsettings.set_string(self.KEY, "file://" + filename)) Gtk.Window() print(gsettings.get_string(self.KEY)) if __name__ == "__main__": BackgroundChanger().change_background("/home/user/existing.jpg")

    Read the article

  • Execure a random command from .txt file?

    - by Alberto Burgos
    I have a Ubuntu server, and I'm trying to print a Twitter quote using the app "twidge". So I made a list of tweets on a .txt file. I want to print one tweet (per line) from that file and send it to Twitter via twidge (or what ever other method was possible). I can print a random phrase with shuf: shuf -n 1 /var/www/tweets.txt and it works. It sends me back one of the tweets, but, it does not send it to Twitter, even if the "in line" phrase is a command. i.e: twidge update "bla bla bla" It just prints on the screen, but don't send it to Twitter. I tried turning the .txt to .sh, but don't work... any idea? by the way, i want to use it with crontab, something like this: 15 * * * * shuf -n 1 /var/www/tweets.txt

    Read the article

  • I am trying to delete a string from list then write it back to a file [closed]

    - by bradb
    def mang (grocerystock): mangchoice=int(input("What would you like to do? \n 1):Add a new product to the list? \n 2): Remove a product from the list? \n 3: Change the quantity of an item \n 4): Change the price of an item \n 5): View items and their quantity and price")) if mangchoice == 1: infile=open("grocery_stock.txt", 'a') name=input("Please enter the new product's name would you like to add:") quant=int(input("Please enter the new product's quantity")) price=float(input("Please enter the new product's price")) grocerystock[0]=name grocerystock[1]=quant grocerystock[2]=price gS=str(grocerystock) gs=gS.strip("[',']") infile.write(gs + '\n') if mangchoice == 2: namedelete=input("what item would you like to remove") a=open("grocery_stock.txt", 'r') data_list= a.readlines() a.close() print (data_list) del data_list[namedelete] b= open ("grocery_stock.txt", 'w') b.writelines(data_list) b.close() def intro(): choice=(int(input("Would you like to go to Managerial mode or Shop mode?(press 1 for Managerial and 2 for shop mode, to quit press 3)"))) if choice == 1: print ('lets go') mang(grocerystock) elif choice == 0 : print ('loser') grocerystock= ["","",""] intro() This is all the code i have written so far any ideas? The code that i am trying to delte is under if mangchoice == 2:

    Read the article

  • Keypress Left is called twice in Update when key is pressed only once

    - by Simran kaur
    I have a piece of code that is changing the position of player when left key is pressed. It is inside of Update() function. I know, Update is called multiple times, but since I have an ifstatement to check if left arrow is pressed, it should update only once. I have tested using print statement that once pressed, it gets called twice. Problem: Position updated twice when key is pressed only once. Below given is the structure of my code: void Update() { if (Input.GetKeyDown (KeyCode.LeftArrow)) { print ("PRESSEEEEEEEEEEEEEEEEEEDDDDDDDDDDDDDD"); } } I looked up on web and what was suggested id this: if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.LeftArrow) { print("pressed"); } But, It gives me an error that says: Object reference not set to instance of an object How can I fix this?

    Read the article

  • LibreOffice prints everything half size

    - by oldmankit
    Ever since I printed a document from Evince in landscape orientation, LibreOffice Calc / Writer refuses to print anything correctly. It is scaling everything by 0.5x and rotating it. To get the same effect, go to print - page layout tab - pages per sheet = 2. However, I don't want 2. I want 1. I have wizzed through all of the printing options a few times but can't get to the bottom of this. I've restarted my printer and computer several times. I have done sudo apt-get purge libreoffice* and reinstalled again. Still it will not print full size. (Of course I have checked that the page settings are set to A4 and portrait.) Update: this problem is specific to one printer only, to printing from within LibreOffice (Calc, Writer). With other printers / programs I have no problems.

    Read the article

  • Printing Tip Handling User Initiated Dialogs Exceptions

    I see this question every so often so it makes sense to share it through a quick post. When using the print API in Silverlight 4 you can run into the dreaded exception: System.Security.SecurityException: Dialogs must be user-initiated Then you examine your code and confirm that your code where you invoke the PrintDocuments Print method are indeed being handled by a user-initiated event. If you are not invoking Print in a user-initiated event then your know your solution :) Here is some sample...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Nashorn ?? JDBC ? Oracle DB ?????·?? 3

    - by Homma
    ???? Nashorn ?? JavaScript ??????? JDBC ? Oracle DB ???????????????????? Oracle DB ????? SQL ??????????????? ???????????????????????????????? ????????? URL ? https://blogs.oracle.com/nashorn_ja/entry/nashorn_jdbc_3 ??? JDBC ??????????????? JDBC ????????????????? Nashorn ????? JavaScript ????????????? ???????? JDBC OCI ???????????????????????????????? ????? ?? Java ??????????????? Nashorn ? JavaScript ???????????????? // Invoke jjs with -scripting option. /* * This sample can be used to check the JDBC installation. * Just run it and provide the connect information. It will select * "Hello World" from the database. */ var OracleDataSource = Java.type("oracle.jdbc.pool.OracleDataSource"); function main() { // Prompt the user for connect information print("Please enter information to test connection to the database"); var user, password, database; user = readLine("user: "); slash_index = user.indexOf('/'); if (slash_index != -1) { password = user.substring(slash_index + 1) user = user.substring(0, slash_index); } else password = readLine("password: "); database = readLine("database(a TNSNAME entry): "); java.lang.System.out.print("Connecting to the database..."); java.lang.System.out.flush(); print("Connecting..."); // Open an OracleDataSource and get a connection var ods = new OracleDataSource(); ods.setURL("jdbc:oracle:oci:@" + database); ods.setUser(user); ods.setPassword(password); var conn = ods.getConnection(); print("connected."); // Create a statement var stmt = conn.createStatement(); // Do the SQL "Hello World" thing var rset = stmt.executeQuery("select 'Hello World' from dual"); while (rset.next()) print(rset.getString(1)); // close the result set, the statement and the connection rset.close(); stmt.close(); conn.close(); print("Your JDBC installation is correct."); } main(); oracle.jdbc.pool.OracleDataSource ? Java.type() ?????Nashorn ??????????????????????????? Java ? System.out.println() ? System.out.flush() ? java.lang. ???????????????? Java ?????????? readEntry() ????? Nashorn ? readLine() ???????????? Java ????????????????????????JavaScript ?????????????????? ?? Java ??????????????????????????? Java ???????????????? JavaScript ?????????????????? ???????? JDBC OCI ???????????????? LD_LIBRARY_PATH ????????????????? ???Nashorn ? readLine() ??????????jjs ????? -scripting ????????????????? $ export LD_LIBRARY_PATH=${ORACLE_HOME}/lib $ jjs -scripting -cp ${ORACLE_HOME}/jdbc/lib/ojdbc6.jar JdbcCheckup.js Please enter information to test connection to the database user: test password: test database(a TNSNAME entry): orcl Connecting to the database...Connecting... connected. Hello World Your JDBC installation is correct. JDBC OCI ????????????????? "select 'Hello World' from dual" ??? SQL ?????????????? ?????????????????database ???? :: ??????????? ??? ??? Oracle DB ????? SQL ???????????????? Java ? JDBC ??????????????????????????? Nashorn ??????????????????????????????????

    Read the article

  • Bitmask data insertions in SSDT Post-Deployment scripts

    - by jamiet
    On my current project we are using SQL Server Data Tools (SSDT) to manage our database schema and one of the tasks we need to do often is insert data into that schema once deployed; the typical method employed to do this is to leverage Post-Deployment scripts and that is exactly what we are doing. Our requirement is a little different though, our data is split up into various buckets that we need to selectively deploy on a case-by-case basis. I was going to use a SQLCMD variable for each bucket (defaulted to some value other than “Yes”) to define whether it should be deployed or not so we could use something like this in our Post-Deployment script: IF ($(DeployBucket1Flag) = 'Yes')BEGIN   :r .\Bucket1.data.sqlENDIF ($(DeployBucket2Flag) = 'Yes')BEGIN   :r .\Bucket2.data.sqlENDIF ($(DeployBucket3Flag) = 'Yes')BEGIN   :r .\Bucket3.data.sqlEND That works fine and is, I’m sure, a very common technique for doing this. It is however slightly ugly because we have to litter our deployment with various SQLCMD variables. My colleague James Rowland-Jones (whom I’m sure many of you know) suggested another technique – bitmasks. I won’t go into detail about how this works (James has already done that at Using a Bitmask - a practical example) but I’ll summarise by saying that you can deploy different combinations of the buckets simply by supplying a different numerical value for a single SQLCMD variable. Each bit of that value’s binary representation signifies whether a particular bucket should be deployed or not. This is better demonstrated using the following simple script (which can be easily leveraged inside your Post-Deployment scripts): /* $(DeployData) is a SQLCMD variable that would, if you were using this in SSDT, be declared in the SQLCMD variables section of your project file. It should contain a numerical value, defaulted to 0. In this example I have declared it using a :setvar statement. Test the affect of different values by changing the :setvar statement accordingly. Examples: :setvar DeployData 1 will deploy bucket 1 :setvar DeployData 2 will deploy bucket 2 :setvar DeployData 3   will deploy buckets 1 & 2 :setvar DeployData 6   will deploy buckets 2 & 3 :setvar DeployData 31  will deploy buckets 1, 2, 3, 4 & 5 */ :setvar DeployData 0 DECLARE  @bitmask VARBINARY(MAX) = CONVERT(VARBINARY,$(DeployData)); IF (@bitmask & 1 = 1) BEGIN     PRINT 'Bucket 1 insertions'; END IF (@bitmask & 2 = 2) BEGIN     PRINT 'Bucket 2 insertions'; END IF (@bitmask & 4 = 4) BEGIN     PRINT 'Bucket 3 insertions'; END IF (@bitmask & 8 = 8) BEGIN     PRINT 'Bucket 4 insertions'; END IF (@bitmask & 16 = 16) BEGIN     PRINT 'Bucket 5 insertions'; END An example of running this using DeployData=6 The binary representation of 6 is 110. The second and third significant bits of that binary number are set to 1 and hence buckets 2 and 3 are “activated”. Hope that makes sense and is useful to some of you! @Jamiet P.S. I used the awesome HTML Copy feature of Visual Studio’s Productivity Power Tools in order to format the T-SQL code above for this blog post.

    Read the article

  • How do I cap rendering of tiles in a 2D game with SDL?

    - by farmdve
    I have some boilerplate code working, I basically have a tile based map composed of just 3 colors, and some walls and render with SDL. The tiles are in a bmp file, but each tile inside it corresponds to an internal number of the type of tile(color, or wall). I have pretty basic collision detection and it works, I can also detetc continuous presses, which allows me to move pretty much anywhere I want. I also have a moving camera, which follows the object. The problem is that, the tile based map is bigger than the resolution, thus not all of the map can be displayed on the screen, but it's still rendered. I would like to cap it, but since this is new to me, I pretty much have no idea. Although I cannot post all the code, as even though I am a newbie and the code pretty basic, it's already quite a few lines, I can post what I tried to do void set_camera() { //Center the camera over the dot camera.x = ( player.box.x + DOT_WIDTH / 2 ) - SCREEN_WIDTH / 2; camera.y = ( player.box.y + DOT_HEIGHT / 2 ) - SCREEN_HEIGHT / 2; //Keep the camera in bounds. if(camera.x < 0 ) { camera.x = 0; } if(camera.y < 0 ) { camera.y = 0; } if(camera.x > LEVEL_WIDTH - camera.w ) { camera.x = LEVEL_WIDTH - camera.w; } if(camera.y > LEVEL_HEIGHT - camera.h ) { camera.y = LEVEL_HEIGHT - camera.h; } } set_camera() is the function which calculates the camera position based on the player's positions. I won't pretend I know much about it. Rectangle box = {0,0,0,0}; for(int t = 0; t < TOTAL_TILES; t++) { if(box.x < (camera.x - TILE_WIDTH) || box.y > (camera.y - TILE_HEIGHT)) apply_surface(box.x - camera.x, box.y - camera.y, surface, screen, &clips[tiles[t]]); box.x += TILE_WIDTH; //If we've gone too far if(box.x >= LEVEL_WIDTH) { //Move back box.x = 0; //Move to the next row box.y += TILE_HEIGHT; } } This is basically my render code. The for loop loops over 192 tiles stored in an int array, each with their own unique value describing the tile type(wall or one of three possible colored tiles). box is an SDL_Rect containing the current position of the tile, which is calculated on render. TILE_HEIGHT and TILE_WIDTH are of value 80. So the cap is determined by if(box.x < (camera.x - TILE_WIDTH) || box.y > (camera.y - TILE_HEIGHT)) However, this is just me playing with the values and see what doesn't break it. I pretty much have no idea how to calculate it. My screen resolution is 1024/768, and the tile map is of size 1280/960.

    Read the article

  • Why jquery have problem with onbeforeprint even?

    - by Cesar Lopez
    Hi all, I have the following function. $(function() { $(".sectionHeader:gt(0)").click(function() { $(this).next(".fieldset").slideToggle("fast"); }); $("img[alt='minimize']").click(function(e) { $(this).closest("table").next(".fieldset").slideUp("fast"); e.stopPropagation(); return false; }); $("img[alt='maximize']").click(function(e) { $(this).closest("table").next(".fieldset").slideDown("fast"); e.stopPropagation(); return false; }); }); <script type="text/javascript"> window.onbeforeprint = expandAll; function expandAll(){ $(".fieldset:gt(0)").slideDown("fast"); } </script> For this html <table class="sectionHeader" ><tr ><td>Heading 1</td></tr></table> <div style="display:none;" class="fieldset">Content 1</div> <table class="sectionHeader" ><tr ><td>Heading 2</td></tr></table> <div style="display:none;" class="fieldset">Content 2</div> I have several div class="fieldset" over the page, but when I do print preview or print, I can see all divs sliding down before opening the print preview or printing but on the actual print preview or print out they are all collapse. I would appreciate if anyone comes with a solution for this. Anyone have any idea why is this or how to fix it? Thanks. PS:Using a does not work either ( I assume because jquery using toggle) and its not the kind of question I am looking for.

    Read the article

  • How to write to Tomcat log files

    - by Ankur
    What is the easiest way to print out something in a Tomcat Log file. I was under the impression that System.out.println() would print to one of the log files. I just want to print out the value of a string, so the simplest solution would be best. If there is no simple/trivial solution I guess I will use Log4J

    Read the article

  • Creating a Reverse Proxy using Jpcap

    - by Ramon Marco Navarro
    I need to create a program that receives HTTP request and forwards those requests to the web servers. I have successfully made this using only Java Sockets but the client needed the program to be implemented in Jpcap. I'd like to know if this is possible and what literature I should be reading for this project. This is what I have now by stitching together pieces from the Jpcap tutorial: import java.net.InetAddress; import java.io.*; import jpcap.*; import jpcap.packet.*; public class Router { public static void main(String args[]) { //Obtain the list of network interfaces NetworkInterface[] devices = JpcapCaptor.getDeviceList(); //for each network interface for (int i = 0; i < devices.length; i++) { //print out its name and description System.out.println(i+": "+devices[i].name + "(" + devices[i].description+")"); //print out its datalink name and description System.out.println(" datalink: "+devices[i].datalink_name + "(" + devices[i].datalink_description+")"); //print out its MAC address System.out.print(" MAC address:"); for (byte b : devices[i].mac_address) System.out.print(Integer.toHexString(b&0xff) + ":"); System.out.println(); //print out its IP address, subnet mask and broadcast address for (NetworkInterfaceAddress a : devices[i].addresses) System.out.println(" address:"+a.address + " " + a.subnet + " "+ a.broadcast); } int index = 1; // set index of the interface that you want to open. //Open an interface with openDevice(NetworkInterface intrface, int snaplen, boolean promics, int to_ms) JpcapCaptor captor = null; try { captor = JpcapCaptor.openDevice(devices[index], 65535, false, 20); captor.setFilter("port 80 and host 192.168.56.1", true); } catch(java.io.IOException e) { System.err.println(e); } //call processPacket() to let Jpcap call PacketPrinter.receivePacket() for every packet capture. captor.loopPacket(-1,new PacketPrinter()); captor.close(); } } class PacketPrinter implements PacketReceiver { //this method is called every time Jpcap captures a packet public void receivePacket(Packet p) { JpcapSender sender = null; try { NetworkInterface[] devices = JpcapCaptor.getDeviceList(); sender = JpcapSender.openDevice(devices[1]); } catch(IOException e) { System.err.println(e); } IPPacket packet = (IPPacket)p; try { // IP Address of machine sending HTTP requests (the client) // It's still on the same LAN as the servers for testing purposes. packet.dst_ip = InetAddress.getByName("192.168.56.2"); } catch(java.net.UnknownHostException e) { System.err.println(e); } //create an Ethernet packet (frame) EthernetPacket ether=new EthernetPacket(); //set frame type as IP ether.frametype=EthernetPacket.ETHERTYPE_IP; //set source and destination MAC addresses // MAC Address of machine running reverse proxy server ether.src_mac = new MacAddress("08:00:27:00:9C:80").getAddress(); // MAC Address of machine running web server ether.dst_mac = new MacAddress("08:00:27:C7:D2:4C").getAddress(); //set the datalink frame of the packet as ether packet.datalink=ether; //send the packet sender.sendPacket(packet); sender.close(); //just print out a captured packet System.out.println(packet); } } Any help would be greatly appreciated. Thank you.

    Read the article

  • problem in fonts type and fonts size on printing

    - by user1400
    hello i have a application on php that i show a report in the table , i want to print this page i can see my page fine in print preview , but when i send thuis page to printer ,the fonts are small and diffrent fonts that i set in css file this is my css file @page { size: A4 landscape; margin-top:2cm; margin-bottom:1cm; margin-left:1cm; margin-right:1cm; } table.print{ text-align:right; border:#999 1px solid; } table.print td.e1{ border-top:#999 1px solid; padding:5px 2px; text-align: right; font-size: 20pt; font-family:"stencil"; } table.print td.e2{ border-top:#999 1px solid; padding:5px 2px; text-align: right; font-size: 120%; font-family:"tahoma"; } thanks

    Read the article

  • UnboundLocalError: local variable 'rows' referenced before assignment

    - by patrick
    i'm trying to make a database connection by an other script. But the script didn't work propperly. and if I do a 'print' on the rows then I get the value 'null' But if I use a 'select * from incidents' query then i get the result from the table incidents. import database rows = database.database("INSERT INTO incidents VALUES(3 ,'test_title1', 'test', TO_DATE('25-07-2012', 'DD-MM-YYYY'), CURRENT_TIMESTAMP, 'sector', 50, 60)") #print database.database() print rows database.py script: import psycopg2 import sys import logfile def database(query): logfile.log(20, 'database.py', 'Executing...') con = None try: con = psycopg2.connect(database='incidents', user='ipfit5', password='tester') cur = con.cursor() #print query cur.execute(query) rows = cur.fetchall() con.commit() #test row does work #cur.execute("INSERT INTO incidents VALUES(3 ,'test_titel1', 'test', TO_DATE('25-07-2012', 'DD-MM-YYYY'), CURRENT_TIMESTAMP, 'sector', 50, 60)") except: logfile.log(40, 'database.py', 'Er is iets mis gegaan') logfile.log(40, 'database.py', str(sys.exc_info())) finally: if con: con.close() return rows

    Read the article

  • Ruby IRC bot don't works.

    - by JavaNoob
    require "socket" server = "irc.rizon.net" port = "6667" nick = "Ruby IRC Bot" channel = "#0x40" s = TCPSocket.open(server, port) s.print("USER Testing", 0) s.print("NICK #{nick}", 0) s.print("JOIN #{channel}", 0) This irc bot don't connect to the IRC server, What are i'm doing wrong?

    Read the article

  • Why do I get 'use: command not found' when I run my Perl script?

    - by [email protected]
    I'm new to Perl. And I have used following code from one forum to connect to one of the server. but throwing error messages [root@Cus]# cat tt.pl #!/usr/bin/perl use Net::Telnet; $telnet = new Net::Telnet ( Timeout=>2, Errmode=>'die'); $telnet->open('10.0.0.28'); $telnet->waitfor('/login:/'); $telnet->print('administrator'); $telnet->waitfor('/Password:/'); $telnet->print('test'); $telnet->waitfor('/switch8-12>/'); $telnet->print('whoamI'); $output=$telnet->waitfor('/switch8-12>/'); print $output; But throwing following error messages. [root@Cus]# ./tt.pl ./tt.pl: line 3: use: command not found ./tt.pl: line 4: syntax error near unexpected token `(' ./tt.pl: line 4: `$telnet = new Net::Telnet ( Timeout=>2, Errmode=>'die');'

    Read the article

  • drupal - override form action?

    - by n00b0101
    I originally started this question in another thread, but that thread was sorta, kinda answered, and now I primarily want to know how to specify another form action... I tried using the code below, but the form action, when output, remains unchanged, although looking at the print_r($form), it's correctly changed... Why isn't it picking up? function mytheme_user_profile_form($form) { global $user; $uid = $user->uid; //print '<pre>'; print_r($form); print '</pre>'; $category = $form['_category']['#value']; switch($category) { case 'account': $form['#action'] = '/user/'.$uid.'/edit?destination=user/'.$uid; break; case 'education': $form['#action'] = '/user/'.$uid.'/edit/education?destination=user/'.$uid; break; case 'experience': $form['#action'] = '/user/'.$uid.'/edit/experience?destination=user/'.$uid; break; case 'publications': $form['#action'] = '/user/'.$uid.'/edit/publications?destination=user/'.$uid; break; case 'conflicts': $form['#action'] = '/user/'.$uid.'/edit/conflicts?destination=user/'.$uid; break; } //print '<pre>'; print_r($form); print '</pre>'; //print $form['#action']; $output .= drupal_render($form); return $output;

    Read the article

  • Connect to remote server

    - by [email protected]
    Hi All, I'm new to perl. And I have used following code from one forum to connect to one of the server. but throwing error messages [root@Cus]# cat tt.pl #!/usr/bin/perl use Net::Telnet; $telnet = new Net::Telnet ( Timeout=>2, Errmode=>'die'); $telnet->open('10.0.0.28'); $telnet->waitfor('/login:/'); $telnet->print('administrator'); $telnet->waitfor('/Password:/'); $telnet->print('test'); $telnet->waitfor('/switch8-12>/'); $telnet->print('whoamI'); $output=$telnet->waitfor('/switch8-12>/'); print $output; But throwing following error messages. [root@Cus]# ./tt.pl ./tt.pl: line 3: use: command not found ./tt.pl: line 4: syntax error near unexpected token `(' ./tt.pl: line 4: `$telnet = new Net::Telnet ( Timeout=>2, Errmode=>'die');'

    Read the article

  • Use a System.Drawing.Printing.PrintDocument to generate a PDF in memory

    - by MarkB29
    Does anyone know if the following is possible and if so what the best way of doing it is for free? I am generating a PrintDocument in a project I am currently working on and displaying a print dialog box so a user can choose which printer they want to use etc. The is currently a windows form application and if a user wants to print to a PDF they can select to print to CutePDF or something similar. However I am now putting a ASP.Net web frontend on the application and want to use the same code to generate the PrintDocument but want to print it to a PDF on the fly and serve it up via the Response stream in the format of a PDF download. So my question is....How can I use the current PrintDocument and generate a PDF in memory from it?? Thanks

    Read the article

< Previous Page | 60 61 62 63 64 65 66 67 68 69 70 71  | Next Page >