Search Results

Search found 11930 results on 478 pages for 'media center'.

Page 104/478 | < Previous Page | 100 101 102 103 104 105 106 107 108 109 110 111  | Next Page >

  • Can't install Parallels Tools on Debian 7.2.0

    - by jfm429
    (Parallels Desktop 9, latest version) As per instructions, I switch to root: $ su - root $ whoami root $ echo $EUID 0 and then execute the installer: $ cd /media/cdrom0 $ ./install and I get this error: sudo: unable to execute ./install: Permission denied What? I'm root! What's with this? I double check to make sure the execute bit is set: $ ls -lA | grep install$ -r-xr-xr-x 1 root root 17284 Oct 25 09:22 install Yep. People online are saying that you need to drag the install script to the terminal after typing sudo. So I do that, and this command is what's formed: $ sudo '/media/cdrom0/install' sudo: unable to execute /media/cdrom0/install: Permission denied What's the solution here?

    Read the article

  • Math for a geodesic sphere

    - by Marcelo Cantos
    I'm trying to create a very specific geodesic tessellation, but I can't find anything online about it. It is normal to subdivide the triangles of an icosahedron into triangle patches and project them onto the sphere. However, I noticed an animated GIF on the Wikipedia entry for Geodesic Domes that appears not to follow this scheme. Geodesic spheres generally comprise a mixture of mostly hexagonal triangle patches, with pentagonal patches forming at the vertices of the original icosahedron; in most cases, these pentagons are linked together; that is, following a straight edge from the center of one pentagon leads to the center of another pentagon. In the Wikipedia animation, however, the edge from the center of one pentagon doesn't appear to intersect the center of an adjacent pentagons; instead it intersects the side of the other pentagon. Hopefully the drawing below makes this clear: Where can I go to learn about the math behind this particular geometry? Ideally, I'd like to know of an algorithm for generating such tessellations.

    Read the article

  • Sharing an external hard drive in Ubuntu using Samba

    - by cambraca
    /media/MYDISK is where my hard drive is mounted automatically. I created a symlink using: ln -s /media/MYDISK /home/camilo/MYDISK chmod 777 /home/camilo/MYDISK I'm setting up smb.conf like this: [myshare1] comment = external disk browsable = yes path = /home/camilo/MYDISK guest ok = yes read only = no create mask = 0775 Also, in the [global] section I tried adding the following lines: follow symlinks = yes wide links = yes unix extensions = no The problem is that when browsing the shared folder in Windows 7, I get a "\\etc\myshare1 is not accessible" error. When pointing the path to a regular folder it works fine. Also, when I point it directly to /media/MYDISK, it shows the same error. EDIT: to make it more interesting, I have no graphical interface, so I need to touch the config files directly..

    Read the article

  • Sharing an external hard drive in Ubuntu using Samba

    - by cambraca
    /media/MYDISK is where my hard drive is mounted automatically. I created a symlink using: ln -s /media/MYDISK /home/camilo/MYDISK chmod 777 /home/camilo/MYDISK I'm setting up smb.conf like this: [myshare1] comment = external disk browsable = yes path = /home/camilo/MYDISK guest ok = yes read only = no create mask = 0775 Also, in the [global] section I tried adding the following lines: follow symlinks = yes wide links = yes unix extensions = no The problem is that when browsing the shared folder in Windows 7, I get a "\\etc\myshare1 is not accessible" error. When pointing the path to a regular folder it works fine. Also, when I point it directly to /media/MYDISK, it shows the same error. EDIT: to make it more interesting, I have no graphical interface, so I need to touch the config files directly..

    Read the article

  • S.M.A.R.T - Predictive Failure Count

    - by Bastien974
    I'm monitoring my IBM ServeRAID M5015 controller for RAID status with MegaCLI, I have this on one of the disk : Enclosure Device ID: 252 Slot Number: 6 Enclosure position: 0 Device Id: 14 Sequence Number: 2 Media Error Count: 32 Other Error Count: 0 Predictive Failure Count: 18 Last Predictive Failure Event Seq Number: 8119 PD Type: SAS Raw Size: 279.396 GB [0x22ecb25c Sectors] Non Coerced Size: 278.896 GB [0x22dcb25c Sectors] Coerced Size: 278.464 GB [0x22cee000 Sectors] Firmware state: Online, Spun Up SAS Address(0): 0x5000c50042c319c9 SAS Address(1): 0x0 Connected Port Number: 5(path0) Inquiry Data: IBM-ESXSST9300653SS B6336XN04HC10525B633 IBM FRU/CRU: 81Y9671 FDE Capable: Not Capable FDE Enable: Disable Secured: Unsecured Locked: Unlocked Needs EKM Attention: No Foreign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Hard Disk Device Drive: Not Certified Drive Temperature :33 Celsius What does this mean exactly ? I can't find an exact description, is there a way to have more details ? The RAID array has the Optimal state. Media Error Count: 32 Predictive Failure Count: 18 Is there a way through the CLI to power-on the front LED so I physically know which disk I need to replace ?

    Read the article

  • problem in exporting a partition on a usb stick as nfs volume

    - by Bond
    I have a USB disk which has 2 partitions.I exported one of them (on NFS) and now I am trying to mount it at client machine. Each time it gets error mount -t nfs 192.168.1.19:/media/vol2 /mnt/nfs/ mount.nfs: access denied by server while mounting 192.168.1.19:/media/vol2 Here is the /etc/exports file entry showmount -e on nfs server gives Export list for bond: /media/vol2 */24 On the client machine nfs-client package is installed. What more I need to check? Is it logged some where?

    Read the article

  • Div tags, how to create rows with them

    - by Daniel
    How to you define a row in div tags High level example in pseudo code: [DIV TAGS LEFT] [DIV TAGS CENTER] [DIV TAGS RIGHT] [WHAT GOES HERE?????] [DIV TAGS LEFT] [DIV TAGS CENTER] [DIV TAGS RIGHT] [WHAT GOES HERE?????] [DIV TAGS LEFT] [DIV TAGS CENTER] [DIV TAGS RIGHT]

    Read the article

  • Nginx proxy to s3 bucket gets 400 Invalid Argument

    - by elssar
    I have a Django app in which I serve media files through an nginx proxy to s3. The relevant python code response = HttpResponse() response['X-Accel-Redirect'] = '/s3_redirect/%s' % filefield.url.replace('http://', '') response['Content-Disposition'] = 'attachment; filename=%s' % filefield.name return response The nginx block for the internal redirect is location ~* ^/s3_redirect/(.*) { internal; set $full_url http://$1; proxy_pass $full_url; And the request logged by s3 is. REST.GET.OBJECT <media file> "GET <media file>" 400 InvalidArgument 354 - 4 - "http://<referer>" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1" - I, for the life of me, can't figure out what's wrong. The url send to nginx by the app is valid, it works in the browser. And nginx is sending a request to s3.

    Read the article

  • How to execute programs on mounted partition

    - by DevNoob
    This is the aplication I want to run. -rwxr-xr-x 1 manuel manuel 582841 Nov 22 09:51 PromServerMain This is the fstab entry /dev/sda8 /media/data0 ext4 defaults,user 0 2 This is the mountpoint lrwxrwxrwx 1 manuel manuel 5 Nov 16 14:23 data -> data0 drwxrwxr-x 9 manuel manuel 4096 Nov 22 09:26 data0 This is what I get manuel@P5KC /media/data/Projekte/PromServer/src $ ./PromServerMain bash: ./PromServerMain: Keine Berechtigung manuel@P5KC /media/data/Projekte/PromServer/src $ sudo ./PromServerMain sudo: unable to execute ./PromServerMain: Permission denied Even as root. I have no clue whats wrong. Any suggestions? System is Debian Wheezy Xfce.

    Read the article

  • Cannot get Backup Exec to backup Exchange.

    - by Shawn Gradwell
    I have a media server, Windows Server 2008 SP2 running Backup Exec 2010 R2. The SQL and other Windows agents work but I cannot backup the Exchange 2010 server running Windows Server2008 R2. I have the correct license for the Exchange agent - installed on the media server, and I installed Exchange Management tools on the media server. The 'Microsoft Exchange Database Availability Group' option is greyed out and if I select the server under a new backup job I can expand the 'Microsoft Information Store' option and see the mail database name but showing 0Kb. When I try to back it up it gives an error displaying: The job failed with the following error: Backup Exec attempted to back up an Exchange database according to the job settings. The database was not found, however. Update the selection list and run the job again.

    Read the article

  • Stacking two pictures with captions side by side and centered in Wordpress

    - by Jim
    Hi all - this is driving me absolutely nuts. I'm not the most experienced with CSS, so I'm hoping it is something simple. I'm running Wordpress 2.9.2 with "The Morning After" theme. I am trying to write a post where I want to display two small pictures, with captions, side-by-side and centered in the middle of the page. Here is the HTML code I am using to display the images: [caption align="alignnone" width="150" caption="Protein rest"] <a href="http://www.mysite.com/wp-content/uploads/2008/06/protein-rest.jpg"> <img title="Mash during protein rest" src="http://www.mysite.com/wp-content/uploads/2008/06/protein-rest-150x144.jpg" alt="Mash during protein rest" width="150" height="144" /> </a>[/caption] [caption align="alignnone" width="143" caption="Saccharification rest" captionalign="center"] <a href="http://www.mysite.com/wp-content/uploads/2008/06/saccharification-rest.jpg"> <img title="Mash during saccharification rest" src="http://www.mysite.com/wp-content/uploads/2008/06/saccharification-rest-143x150.jpg" alt="Mash during saccharification rest" width="143" height="150" /> </a>[/caption] I tried using "aligncenter" and "alignleft" for the caption align - if I use "alignleft" the pictures are lined up perfectly, but all the way to the left of the page. If I use "aligncenter" the pics are in the center, but stacked one on top of the other. My first thought was to wrap the images in a div using: <div style="text-align:center;">image code</div> but that doesn't work. Now, if I wrap in a centered div like that and omit the [caption] tags, it works, but I need the captions. Those caption tags are translated by Wordpress into it's own div of class wp-caption. I've also tried wrapping each separate image in its own div within a parent centered div wrapper. Here is the pertinent parts of the style.css - please let me know if you need any other info, and if you can help me, I will postpone jumping off the nearest bridge! Thanks!! Style.css: .aligncenter, div.aligncenter { display: block; margin: 14px auto; } .alignleft { float: left; margin: 0 14px 10px 0; } .alignright { float: right; margin: 0 0 10px 14px; } .wp-caption { border: 1px solid #ddd; text-align: center; background-color: #f3f3f3; padding-top: 4px; /* optional rounded corners for browsers that support it */ -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; } .wp-caption img { margin: 0; padding: 0; border: 0 none; } .wp-caption p.wp-caption-text { font-size: 11px; line-height: 14px; padding: 5px 4px 5px 5px; margin: 0; } PS - I am aware of the Gallery feature available in Wordpress, but would like to avoid it and would love to understand why wrapping in a div doesn't move the whole kit to the center. Finally, just for the sake of completeness, here is the source of the page when loaded using the div wrapper and image code as above (so you can see how Wordpress translates the caption tags): <div style="text-align:center;"> <div class="wp-caption alignnone" style="width: 160px"> <a href="http://www.mysite.com/wp-content/uploads/2008/06/protein-rest.jpg"> <img title="Mash during protein rest" src="http://www.mysite.com/wp-content/uploads/2008/06/protein-rest-150x144.jpg" alt="Mash during protein rest" width="150" height="144" /> </a> <p class="wp-caption-text" style="text-align:center">Protein rest</p> </div> <div class="wp-caption alignnone" style="width: 153px"> <a href="http://www.mysite.com/wp-content/uploads/2008/06/saccharification-rest.jpg"> <img title="Mash during saccharification rest" src="http://www.mysite.com/wp-content/uploads/2008/06/saccharification-rest-143x150.jpg" alt="Mash during saccharification rest" width="143" height="150" /> </a> <p class="wp-caption-text" style="text-align:center">Saccharification rest</p> </div> </div>

    Read the article

  • Privacy setting using Graph API

    - by Anthony
    Hello, I'm currently trying to se privacy setting on post I do through Graph API, code is: function graphStreamPublish(){ message1 = document.getElementById('message').value; FB.api('/me/feed', 'post', { message: message1 }, privacy: {value: "CUSTOM", friends: "SOME_FRIENDS", network: "1", allow: "204506204", deny: "515592311", function(response) { if (response && response.post_id) { alert('Post was not published.'); } else { alert('Post was published.'); } }); } Then I just call this function for the things I right on textarea: <center><textarea id="message" cols="50" rows="5">Test goes here!</textarea></center> <br /> <center><a href="" onclick="graphStreamPublish(); return false;">Post message now!</a></center> This does not work however woth the privacy part but works fine without. Am i doing something wrong? Thanks.

    Read the article

  • Crossover LAN connection between Ubuntu And Windows 7 is not working

    - by brett
    my question is closely related to: How do I connect Ubuntu 10.04 and Windows 7 with an Ethernet cable? What I am after is: Windows 7-------wireless-----\ Wifi router Ubuntu 10.04----wireless-----/ Windows 7-------wireless-----\ | cross_over_cable Wifi router | Ubuntu 10.04----wireless-----/ What I did was On Windows edit system32\drivers\etc\hosts Add the following line: 192.168.253.2 my_ubuntu_computer_name_&-wired //?not sure if this is right On Ubuntu: sudo gedit /etc/hosts Add the following line: 192.168.253.1 my_pc_computer_name&-wired //?not sure if this is right and then Ubuntu 12.04 as the host Right click on the Network Manager applet, click Edit Connections... In the Wired tab, click Auto eth0, then click Edit... In the IPv4 Settings tab, change Method: to Shared to other computers. Click Apply and enter your password when it asks you. Close everything and reboot. Plug the Ethernet cable into both computers. But, I can connect to my windows network folders from ubuntu via wifi I can't connect to my ubuntu network folders from windows via wifi(in fact this bit was working before - so my wifi connection is worse) my ubuntu Auto Ethernet seems to be on From Ubuntu eth0 Link encap:Ethernet HWaddr 00:11:2f:f3:43:8d inet addr:10.42.0.1 Bcast:10.42.0.255 Mask:255.255.255.0 inet6 addr: fe80::211:2fff:fef3:438d/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:172 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:27279 (27.2 KB) Interrupt:19 Base address:0xe400 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:1147 errors:0 dropped:0 overruns:0 frame:0 TX packets:1147 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:94380 (94.3 KB) TX bytes:94380 (94.3 KB) wlan0 Link encap:Ethernet HWaddr 00:03:c9:e9:6f:bf inet addr:10.1.1.7 Bcast:10.1.1.255 Mask:255.255.255.0 inet6 addr: fe80::203:c9ff:fee9:6fbf/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:13186 errors:0 dropped:0 overruns:0 frame:0 TX packets:12187 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1598882 (1.5 MB) TX bytes:1189555 (1.1 MB) From Windows: Windows IP Configuration Ethernet adapter Bluetooth Network Connection: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Wireless LAN adapter Wireless Network Connection: Connection-specific DNS Suffix . : BoB Link-local IPv6 Address . . . . . : fe80::ecf7:c445:3725:b9c1%12 IPv4 Address. . . . . . . . . . . : 10.1.1.4 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 10.1.1.1 Tunnel adapter Local Area Connection* 15: Connection-specific DNS Suffix . : IPv6 Address. . . . . . . . . . . : 2001:0:4137:9e76:1423:3ae3:f5fe:fefb Link-local IPv6 Address . . . . . : fe80::1423:3ae3:f5fe:fefb%23 Default Gateway . . . . . . . . . : :: Tunnel adapter isatap.BoB: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : BoB Tunnel adapter isatap.{D0C8EBA1-335D-4620-8570-6C36E8786D72}: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . :

    Read the article

  • Centering background image, using css

    - by Jean
    Hello, I want to center a background image. There is no div used, this is the css style body{ background-position:center; background-image:url(../images/images2.jpg) no-repeat; } The above CSS tiles all over and does center it, but half the image is not seen, it just kind of moves up. What I want to do is center the image. Could I adopt the image to view even on a 21". Appreciate help. Thanks Jean

    Read the article

  • error echo id when i want to echo id for edit

    - by Prasanta Baidya
    I have a entry and edit page of a branch, I want echo id, when I mouse over into edit link in edit button, its show error,: branchedit.php?id=Note:Undefined index:id in line 101, but it work properly in localhost. error picture page link : https://www.dropbox.com/s/i1vu62lz3pezia0/id%20error.JPG My code: <?php include 'include/config.php'; include 'include/opendb.php'; include 'loginheader.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Branch</title> <!--Requered Validation --> <link rel="stylesheet" type="text/css" media="screen" href="jqueryvalidation/demo/css/screen.css" /> <script src="jqueryvalidation/jquery.js" type="text/javascript"></script> <script src="jqueryvalidation/jquery.validate.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $("#commentForm").validate(); }); </script> <!--End Requered Validation --> <style type="text/css"> <!-- body { background-color: #cccccc; } --> </style> <style type="text/css"> <!-- --> </style> <link href="css/usercss.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- .style7 { color: #000000; font-weight: bold; } .style8 {color: #FFFFFF} --> </style> </head> <body> <div id="container"> <table width="453" border="0" align="left" cellpadding="0" cellspacing="1"> <tr> <td width="451"><form name="cmxform" id="commentForm" method="post" action="insert_ac.php"> <table width="100%" border="0" cellspacing="1" cellpadding="3"> <tr> <td colspan="3" class="style2">Insert Branch into Database </td> </tr> <tr> <td width="100" height="46">Branch Code</td> <td width="18">:</td> <td width="309"><input name="branch_code" type="text" id="branch_code" minlength="3" class="required"></td> </tr> <tr> <td height="51">Branch Name</td> <td>:</td> <td><input name="branch_name" type="text" id="branch_name" class="required" ></td> </tr> <tr> <td height="47" colspan="3" align="center"> <div align="right"> <input name="Submit" type="submit" class="submit_button" value="Submit" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div></td> </tr> </table> </form></td> </tr> </table> <!--Branch List --> <?php $sql="SELECT * FROM dc_master"; $result=mysql_query($sql); ?> <table width="436" border="1" cellpadding="2" cellspacing="0" class="table" id="list"> <tr> <td colspan="4"><div align="center" class="style7">List of Branches </div></td> </tr> <tr class="style4" > <td width="87" align="center"><span class="style8">Branch Code</span></td> <td width="176" align="center" ><span class="style8">Branch Name</span></td> <td width="70" align="center" ><span class="style8">Edit</span></td> <td width="77" align="center" ><span class="style8">Delete</span></td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td height="28"><div align="center" class="style3"><?php echo $rows['branch_code']; ?></div></td> <td class="style3">&nbsp;&nbsp;&nbsp;<?php echo $rows['dc_name']; ?></td> <!--link to update.php and send value of id --> <td align="center"><a href="branchedit.php?id=<?php echo $rows['id']; ?>" class="style3 style5 style5">Edit</a></td> <td align="center"><a href="delete.php?id=<?php echo $rows['id']; ?>" class="style3 style5 style5" onclick="return confirm('Are you sure, you want to delete? (After delete you can not undo or get it again) <?php ?>')">Delete</a></td> </tr> <?php } ?> </table> <span class="footer">Programmer : Prasanta Baidya / Mobile : 09830980840 / Email id : [email protected]</span></div> <?php mysql_close(); ?> </body> </html>

    Read the article

  • RHEL kickstart with external DVDrom drive

    - by AndyM
    HI I've an old Dell poweredge server with an CDROM drive. I've attached a USB DVDROM and USB stick with my ks.cfg on so I can install RHEL from DVD not loads of CDs :-) I can boot from the RHEL media in DVDROM and point the installer to the USB ks.cfg. This works but the ks.cfg script has the cdrom keyword in it. The install then stops and asks for the RHEL media to be in the CDROM drive not the DVDROM. How can I change the ks.cfg so it uses the external DVDROM for the install media not servers builtin cdrom drive ? I know I can go and rebuild my DVD image to include the ks.cfg , but this is an extra step I dont want to do if I have to. Regards Andy

    Read the article

  • How to set the size of a wx.aui.AuiManager Pane that is centered?

    - by aF
    Hello, I have three panes with the InfoPane center option. I want to know how to set their size. Using this code: import wx import wx.aui class MyFrame(wx.Frame): def __init__(self, parent, id=-1, title='wx.aui Test', pos=wx.DefaultPosition, size=(800, 600), style=wx.DEFAULT_FRAME_STYLE): wx.Frame.__init__(self, parent, id, title, pos, size, style) self._mgr = wx.aui.AuiManager(self) # create several text controls text1 = wx.TextCtrl(self, -1, 'Pane 1 - sample text', wx.DefaultPosition, wx.Size(200,150), wx.NO_BORDER | wx.TE_MULTILINE) text2 = wx.TextCtrl(self, -1, 'Pane 2 - sample text', wx.DefaultPosition, wx.Size(200,150), wx.NO_BORDER | wx.TE_MULTILINE) text3 = wx.TextCtrl(self, -1, 'Main content window', wx.DefaultPosition, wx.Size(200,150), wx.NO_BORDER | wx.TE_MULTILINE) # add the panes to the manager self._mgr.AddPane(text1, wx.CENTER) self._mgr.AddPane(text2, wx.CENTER) self._mgr.AddPane(text3, wx.CENTER) # tell the manager to 'commit' all the changes just made self._mgr.Update() self.Bind(wx.EVT_CLOSE, self.OnClose) def OnClose(self, event): # deinitialize the frame manager self._mgr.UnInit() # delete the frame self.Destroy() app = wx.App() frame = MyFrame(None) frame.Show() app.MainLoop() I want to know what is called when we change the size of the panes. If you tell me that, I can do the rest by myself :)

    Read the article

  • A "region code" restriction for a custom created video dvd file

    - by user180820
    I want to create a video dvd ( no menus, just "plug and play" ) from a few video files. I`m doing it like this: ffmpeg -i sample-media/hellboy-2.wmv -y -target ntsc-dvd sample-media-to-mpeg/hellboy-2.vob dvdauthor -o sample-dvd -x dvdauthor-settings.xml mkisofs -dvd-video -o hellboy-2-trailers.iso sample-dvd/ where "dvdauthor-settings.xml" is: link. But when I try to play the iso file in windows it says: Windows Media Player cannot play the DVD because the disc prohibits playback in your region of the world. You must obtain a disc that is intended for your geographic region. When I open the *.IFO file with IfoEdit it says that all world regions are unabled. Can someone tell me why is this happening? ( maybe the whole process of creating the *.iso file is wrong? )

    Read the article

  • Any way to turn off quips in OOWeb?

    - by Misha Koshelev
    http://ooweb.sourceforge.net/tutorial.html Not really a question, but I can't seem to stop writing stuff like this. Maybe someone will find it useful. I know rewriting an HTTP server is not the way to turn off the quips ;) /* Copyright 2010 Misha Koshelev. All Rights Reserved. */ package com.mksoft.common; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.text.SimpleDateFormat; import java.util.Date; import java.util.LinkedHashMap; import java.net.ServerSocket; import java.net.Socket; /** * Simple HTTP Server. * * @author Misha Koshelev */ public class HttpServer extends Thread { /* * Constants */ /** * 404 Not Found Result */ protected final static String result404NotFound="<html><head><title>404 Not Found</title></head><body bgcolor='#ffffff'><h1>404 Not Found</h1></body></html>"; /* * Variables */ /** * Port on which HTTP server handles requests. */ protected int port; public int getPort() { return port; } public void setPort(int _port) { port=_port; } /* * Constructors */ public HttpServer(int _port) { setPort(_port); } /* * Helpers */ /** * Errors */ protected void error(String message) { System.err.println(message); System.err.flush(); } /** * Debugging */ protected boolean debugOutput=true; protected void debug(String message) { if (debugOutput) { error(message); } } /** * Lock object */ private Object lock=new Object(); /** * Should we quit? */ protected boolean doQuit=false; /** * Are we done? */ protected boolean areWeDone=false; /** * Process POST request headers */ protected String processPostRequest(String url,LinkedHashMap<String,String> headers,String inputLine) { debug("HttpServer.processPostRequest: url=\""+url); if (debugOutput) { for (String key: headers.keySet()) { debug("HttpServer.processPostRequest: headers."+key+"=\""+headers.get(key)+"\""); } } debug("HttpServer.processPostRequest: inputLine=\""+inputLine+"\""); try { inputLine=new URLDecoder().decode(inputLine,"UTF-8"); } catch (UnsupportedEncodingException uee) { uee.printStackTrace(); } String[] keyValues=inputLine.split("&"); LinkedHashMap<String,String> post=new LinkedHashMap<String,String>(); for (int i=0;i<keyValues.length;i++) { String keyValue=keyValues[i]; int equals=keyValue.indexOf('='); String key=keyValue.substring(0,equals); String value=keyValue.substring(equals+1); post.put(key,value); } return post(url,headers,post); } /** * Server loop (here for exception handling purposes) */ protected void serverLoop() throws IOException { /* Start server socket */ ServerSocket serverSocket=null; try { serverSocket=new ServerSocket(getPort()); } catch (IOException ioe) { ioe.printStackTrace(); System.exit(1); } Socket clientSocket=null; while (true) { /* Quit if necessary */ if (doQuit) { break; } /* Accept incoming connections */ try { clientSocket=serverSocket.accept(); } catch (IOException ioe) { ioe.printStackTrace(); System.exit(1); } /* Read request */ BufferedReader in=null; String inputLine=null; String firstLine=null; String blankLine=null; LinkedHashMap<String,String> headers=new LinkedHashMap<String,String>(); try { in=new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); while (true) { if (blankLine==null) { inputLine=in.readLine(); } else { /* POST request, read Content-length bytes */ int contentLength=new Integer(headers.get("Content-Length")).intValue(); StringBuilder sb=new StringBuilder(contentLength); for (int i=0;i<contentLength;i++) { sb.append((char)in.read()); } inputLine=sb.toString(); break; } if (firstLine==null) { firstLine=inputLine; } else if (blankLine==null) { if (inputLine.equals("")) { if (firstLine.startsWith("GET ")) { break; } blankLine=inputLine; } else { int colon=inputLine.indexOf(": "); String key=inputLine.substring(0,colon); String value=inputLine.substring(colon+2); headers.put(key,value); } } } } catch (IOException ioe) { ioe.printStackTrace(); } /* Process request */ String result=null; firstLine=firstLine.replaceAll(" HTTP/.*",""); if (firstLine.startsWith("GET ")) { result=get(firstLine.replaceFirst("GET ",""),headers); } else if (firstLine.startsWith("POST ")) { result=processPostRequest(firstLine.replaceFirst("POST ",""),headers,inputLine); } else { error("HttpServer.ServerLoop: Unhandled request \""+firstLine+"\""); } debug("HttpServer.ServerLoop: result=\""+result+"\""); /* Send response */ PrintWriter out=null; try { out=new PrintWriter(clientSocket.getOutputStream(),true); } catch (IOException ioe) { ioe.printStackTrace(); } if (result!=null) { out.println("HTTP/1.1 200 OK"); } else { out.println("HTTP/1.0 404 Not Found"); result=result404NotFound; } Date now=new Date(); out.println("Date: "+new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss z").format(now)); out.println("Content-Type: text/html; charset=UTF-8"); out.println("Content-Length: "+result.length()); out.println(""); out.print(result); /* Clean up */ out.close(); if (in!=null) { in.close(); } clientSocket.close(); } serverSocket.close(); areWeDone=true; synchronized(lock) { lock.notifyAll(); } } /* * Methods */ /** * Run server on port specified in constructor. */ public void run() { try { serverLoop(); } catch (IOException ioe) { ioe.printStackTrace(); System.exit(1); } } /** * Process GET request (should be overwritten). */ public String get(String url,LinkedHashMap<String,String> headers) { debug("HttpServer.get: url=\""+url+"\""); if (debugOutput) { for (String key: headers.keySet()) { debug("HttpServer.get: headers."+key+"=\""+headers.get(key)+"\""); } } if (url.equals("/")) { return "<html><head><title>HttpServer GET Test Page</title></head>\r\n"+ "<body bgcolor='#ffffff'>\r\n"+ "<center><h1>HttpServer GET Test Page</h1></center>\r\n"+ "<hr />\r\n"+ "<center><table>\r\n"+ "<form method='post' action='/'>\r\n"+ "<tr><td align=right>Test 1:</td>\r\n"+ " <td><input type='text' name='text 1' value='test me !!! !@#$'></td></tr>\r\n"+ "<tr><td align=right>Test 2:</td>\r\n"+ " <td><input type='text' name='text 2' value='type smthng'></td></tr>\r\n"+ "<tr><td>&nbsp;</td>\r\n"+ " <td align=right><input type='submit' value='Submit'></td></tr>\r\n"+ "</form>\r\n"+ "</table></center>\r\n"+ "<hr />\r\n"+ "<center><a href='/quit'>Shutdown Server</a></center>\r\n"+ "</html>"; } else if (url.equals("/quit")) { quit(); return ""; } else { return null; } } /** * Process POST request (should be overwritten). */ public String post(String url,LinkedHashMap<String,String> headers,LinkedHashMap<String,String> post) { debug("HttpServer.post: url=\""+url+"\""); if (debugOutput) { for (String key: headers.keySet()) { debug("HttpServer.post: headers."+key+"=\""+headers.get(key)+"\""); } } if (url.equals("/")) { String result="<html><head><title>HttpServer Post Test Page</title></head>\r\n"+ "<body bgcolor='#ffffff'>\r\n"+ "<center><h1>HttpServer Post Test Page</h1></center>\r\n"+ "<hr />\r\n"+ "<center><table>\r\n"+ "<tr><th>Key</th><th>Value</th></tr>\r\n"; for (String key: post.keySet()) { result+="<tr><td align=right>"+key+"</td><td align=left>"+post.get(key)+"</td></tr>\r\n"; } result+="</table></center>\r\n"+ "</html>"; return result; } else { return null; } } /** * Wait for server to quit. */ public void waitForCompletion() { while (areWeDone==false) { synchronized(lock) { try { lock.wait(); } catch (InterruptedException ie) { } } } } /** * Shutdown server. */ public void quit() { doQuit=true; } }

    Read the article

  • UUID in Mountain Lion

    - by Naji
    I am trying to find my external HDD UUID in Mountain Lion but diskutil info /dev/disk1s1 returns: Najis-MacBook-Air:~ ****$ diskutil info disk1s1 Device Identifier: disk1s1 Device Node: /dev/disk1s1 Part of Whole: disk1 Device / Media Name: Untitled 1 Volume Name: My Book Escaped with Unicode: My%FF%FE%20%00Book Mounted: Yes Mount Point: /Volumes/My Book Escaped with Unicode: /Volumes/My%FF%FE%20%00Book File System Personality: NTFS Type (Bundle): ntfs Name (User Visible): Windows NT File System (NTFS) Partition Type: Windows_NTFS OS Can Be Installed: No Media Type: Generic Protocol: USB SMART Status: Not Supported Total Size: 2.0 TB (2000364240896 Bytes) (exactly 3906961408 512-Byte-Blocks) Volume Free Space: 212.5 GB (212506509312 Bytes) (exactly 415051776 512-Byte-Blocks) Device Block Size: 512 Bytes Read-Only Media: No Read-Only Volume: Yes Ejectable: Yes Whole: No Internal: No And there is no UUID. What is wrong exactly? Thank you.

    Read the article

  • Jquery / PHP - pre-loading next page before navigating to it.

    - by Tim
    Hey all Using jQuery, is there a way to prevent going to the next page until the animation has finished AND the next page has completely loaded (including images)? The code below works but it is a bit clunky. You can see what I am trying to achieve here: http://bit.ly/aOeYgE The first three or so pages work. But when you click to go to the homepage a few times (after it's cached) you will see that it jumps, and the animation isn't very smooth. As you can see with the code below, the height is immediately set to 0, then when the page has loaded the height is set to 500px. When users navigate to a new page, the height should go back to 0, the next page content should load, and then upon loading the new window, the first bit of code will run again to set the width back to 500px. $(".content-center").css({"height": "0px"}); $(window).load(function() { if($('.content-center').is(':not(:animated)')) { $('.content-center').animate({height: "500px"}, 450); } }); $("a").click(function(event){ $(".content-center").animate({height: "0px"}, 500); if($('.content-center').is(':not(:animated)')) { navigate($(this).attr('href')); event.preventDefault(); } }); If anyone has any suggestions or alternative ideas to this code then it would be hugely appreciated. Many thanks Tim

    Read the article

  • WPF - Centering a checkbox in a GridViewColumn?

    - by Sonny Boy
    Hey all, I'm currently struggling on getting my checkboxes to property center within my GridViewColumns. I've defined a style for my checkboxes like so: <Style TargetType="{x:Type CheckBox}" x:Key="DataGridCheckBox"> <Setter Property="HorizontalAlignment" Value="Center" /> <Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="IsEnabled" Value="False" /> <Setter Property="Margin" Value="4" /> <Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type GridViewColumn}},Path=ActualWidth}" /> </Style> And my checkboxes are added into the GridViewColumn using a DataTemplate like this: <GridViewColumn Header="Comment"> <GridViewColumn.CellTemplate> <DataTemplate> <CheckBox Style="{StaticResource DataGridCheckBox}" IsChecked="{Binding PropertyItem.Comment, Converter={StaticResource booleanConverter}, ConverterParameter='string'}"/> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> But the problem I have is that the checkboxes remain left-aligned (even when resizing the column). Any ideas? Thanks in advance, Sonny

    Read the article

  • Easier way to create floppy disk images?

    - by Bryan
    I'm using Vyatta routers with KVM and want to attach a floppy drive with a config file for Vyatta when I boot the image. I'll be doing this over and over again, and as such am looking for an automated way of creating the floppy images. Right now, I'm doing the following: Create floppy image with qemu-img create Format floppy image with mkdosfs Mount floppy image with mount -t fat /tmp/floppy.img /media/floppy Populate floppy image with cp -r /tmp/configs/ /media/floppy/ Unmount floppy image with umount /media/floppy Save floppy image with mv /tmp/floppy.img ~/floppies/ Any chance there's an easier way to do this?! Perhaps a shortcut application that I can give a directory to and it will do all this for me w/out having to mount the image?

    Read the article

  • Is there anything that can be done to make X forwarding over LAN less painful?

    - by Earlz
    I have two *nix machines that I like to remotely do graphical things sometimes with. One of those machines is my Arch Linux media server, and another is my OpenBSD router/general server. My current task was installing a Windows XP over virtual box on my media server. I preferred to do the installation from my main workstation so that I could continue to watch TV from my media server on it's "actual" display. I soon noticed that X forwarding is quite painful though, even over low-latency LAN connections. Are there any settings I can tweak to make it a bit less painfully slow, jittery, and laggy? My LAN is rather small, 100Mbit, and ping times to the other box average at about 0.15ms. Also, I know Virtualbox has a VNC mode it can use instead of doing X forwarding, but this particular task was just an example

    Read the article

< Previous Page | 100 101 102 103 104 105 106 107 108 109 110 111  | Next Page >