Daily Archives

Articles indexed Sunday October 28 2012

Page 10/13 | < Previous Page | 6 7 8 9 10 11 12 13  | Next Page >

  • stdio data from write not making it into a file

    - by user1551209
    I'm having a problem with using stdio commands for manipulating data in a file. I short, when I write data into a file, write returns an int indicating that it was successful, but when I read it back out I only get the old data. Here's a stripped down version of the code: fd = open(filename,O_RDWR|O_APPEND); struct dE *cDE = malloc(sizeof(struct dE)); //Read present data printf("\nreading values at %d\n",off); printf("SeekStatus <%d>\n",lseek(fd,off,SEEK_SET)); printf("ReadStatus <%d>\n",read(fd,cDE,deSize)); printf("current Key/Data <%d/%s>\n",cDE->key,cDE->data); printf("\nwriting new values\n"); //Change the values locally cDE->key = //something new cDE->data = //something new //Write them back printf("SeekStatus <%d>\n",lseek(fd,off,SEEK_SET)); printf("WriteStatus <%d>\n",write(fd,cDE,deSize)); //Re-read to make sure that it got written back printf("\nre-reading values at %d\n",off); printf("SeekStatus <%d>\n",lseek(fd,off,SEEK_SET)); printf("ReadStatus <%d>\n",read(fd,cDE,deSize)); printf("current Key/Data <%d/%s>\n",cDE->key,cDE->data); Furthermore, here's the dE struct in case you're wondering: struct dE { int key; char data[DataSize]; }; This prints: reading values at 1072 SeekStatus <1072> ReadStatus <32> current Key/Data <27/old> writing new values SeekStatus <1072> WriteStatus <32> re-reading values at 1072 SeekStatus <1072> ReadStatus <32> current Key/Data <27/old>

    Read the article

  • Asp.net mvc, entity framework, Poco - Architecture

    - by user1576228
    I have a "small" enterprise application, aspnet mvc 3 + entity framework with POCO entity and repository pattern. I structured the solution in 4 projects: POCO entities Domain model Services web application When the application performs a query on the database, use one of the services provided, the service uses the repository and the small classes, as a result I have some dynamic proxy objects that I would like to convert in my domain entities, before using them in mvc views, but I do not know how. Dovrebber be set as the translator? This approach is reasonable?

    Read the article

  • Saving results to a file in C++

    - by user1680877
    I have a problem with this code. What I am looking for in the code is to get the result of "first" and "second" randomly and put the result in a file. It works great if I run it without using the file and I get all the correct results, but when I try to save the result in the file, I get only the first node which contains (first, secnd). Here is the code: #include<iostream> #include <fstream> #include<cmath> using namespace std; void main() { int first[100],secnd[100]; for (int i=0; i<100 ;i++) { first[i]=rand()%500; //random number from to 499 secnd[i]=rand()%500; //random number from to 499 ofstream myfile; myfile.open ("example.txt"); myfile << "Writing this to a file.\n"; myfile <<first[i]<<" "<<secnd[i]; myfile.close(); } }

    Read the article

  • Repaint() not calling paint() in Java

    - by Joshua Auriemma
    Let me start off by saying I know I've violated some basic Java principles in this messy code, but I'm desperately trying to finish a program by Tuesday for a social science experiment, and I don't know Java, so I'm basically just fumbling through it for now. With that disclaimer out of the way, I have a separate program working where a circle is moving around the screen and the user must click on it. It works fine when its in its own separate class file, but when I add the code to my main program, it's no longer working. I don't even really understand why repaint() calls my paint() function — as far as I'm concerned, it's magic, but I've noticed that repaint() calls paint() in my test program, but not in the more complicated actual program, and I assume that's why the circle is no longer painting on my program. Entire code is below: import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; import javax.swing.*; import java.awt.event.*; import java.awt.geom.Ellipse2D; import java.io.FileReader; import java.io.IOException; import java.util.Calendar; public class Reflexology1 extends JFrame{ private static final long serialVersionUID = -1295261024563143679L; private Ellipse2D ball = new Ellipse2D.Double(0, 0, 25, 25); private Timer moveBallTimer; int _ballXpos, _ballYpos; JButton button1, button2; JButton movingButton; JTextArea textArea1; int buttonAClicked, buttonDClicked; private long _openTime = 0; private long _closeTime = 0; JPanel thePanel = new JPanel(); JPanel thePlacebo = new JPanel(); final JFrame frame = new JFrame("Reflexology"); final JFrame frame2 = new JFrame("The Test"); JLabel label1 = new JLabel("Press X and then click the moving dot as fast as you can."); public static void main(String[] args){ new Reflexology1(); } public Reflexology1(){ frame.setSize(600, 475); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Reflexology 1.0"); frame.setResizable(false); frame2.setSize(600, 475); frame2.setLocationRelativeTo(null); frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame2.setTitle("Reflexology 1.0"); frame2.setResizable(false); button1 = new JButton("Accept"); button2 = new JButton("Decline"); //movingButton = new JButton("Click Me"); ListenForAcceptButton lForAButton = new ListenForAcceptButton(); ListenForDeclineButton lForDButton = new ListenForDeclineButton(); button1.addActionListener(lForAButton); button2.addActionListener(lForDButton); //movingButton.addActionListener(lForMButton); JTextArea textArea1 = new JTextArea(24, 50); textArea1.setText("Tracking Events\n"); textArea1.setLineWrap(true); textArea1.setWrapStyleWord(true); textArea1.setSize(15, 50); textArea1.setEditable(false); FileReader reader = null; try { reader = new FileReader("EULA.txt"); textArea1.read(reader, "EULA.txt"); } catch (IOException exception) { System.err.println("Problem loading file"); exception.printStackTrace(); } finally { if (reader != null) { try { reader.close(); } catch (IOException exception) { System.err.println("Error closing reader"); exception.printStackTrace(); } } } JScrollPane scrollBar1 = new JScrollPane(textArea1, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); AdjustmentListener listener = new MyAdjustmentListener(); thePanel.add(scrollBar1); thePanel.add(button1); thePanel.add(button2); frame.add(thePanel); ListenForMouse lForMouse = new ListenForMouse(); thePlacebo.addMouseListener(lForMouse); thePlacebo.add(label1); frame2.add(thePlacebo); ListenForWindow lForWindow = new ListenForWindow(); frame.addWindowListener(lForWindow); frame2.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e){ if(e.getKeyChar() == 'X' || e.getKeyChar() == 'x') {moveBallTimer.start();} } }); frame.setVisible(true); moveBallTimer = new Timer(1000, new ActionListener() { public void actionPerformed(ActionEvent e) { moveBall(); System.out.println("Timer started!"); repaint(); } }); addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if(frame2.isVisible()){ moveBallTimer.start(); } } }); } private class ListenForAcceptButton implements ActionListener{ public void actionPerformed(ActionEvent e){ if (e.getSource() == button1){ Calendar ClCDateTime = Calendar.getInstance(); System.out.println(ClCDateTime.getTimeInMillis() - _openTime); _closeTime = ClCDateTime.getTimeInMillis() - _openTime; //frame.getContentPane().remove(thePanel); //thePlacebo.addKeyListener(lForKeys); //frame.getContentPane().add(thePlacebo); //frame.repaint(); //moveBallTimer.start(); frame.setVisible(false); frame2.setVisible(true); frame2.revalidate(); frame2.repaint(); } } } private class ListenForDeclineButton implements ActionListener{ public void actionPerformed(ActionEvent e){ if (e.getSource() == button2){ JOptionPane.showMessageDialog(Reflexology1.this, "You've declined the license agreement. DO NOT RESTART the program. Please go inform a researcher that you have declined the agreement.", "WARNING", JOptionPane.INFORMATION_MESSAGE); System.exit(0); } } } private class ListenForWindow implements WindowListener{ public void windowActivated(WindowEvent e) { //textArea1.append("Window is active"); } // if this.dispose() is called, this is called: public void windowClosed(WindowEvent arg0) { } // When a window is closed from a menu, this is called: public void windowClosing(WindowEvent arg0) { } // Called when the window is no longer the active window: public void windowDeactivated(WindowEvent arg0) { //textArea1.append("Window is NOT active"); } // Window gone from minimized to normal state public void windowDeiconified(WindowEvent arg0) { //textArea1.append("Window is in normal state"); } // Window has been minimized public void windowIconified(WindowEvent arg0) { //textArea1.append("Window is minimized"); } // Called when the Window is originally created public void windowOpened(WindowEvent arg0) { //textArea1.append("Let there be Window!"); Calendar OlCDateTime = Calendar.getInstance(); _openTime = OlCDateTime.getTimeInMillis(); //System.out.println(_openTime); } } private class MyAdjustmentListener implements AdjustmentListener { public void adjustmentValueChanged(AdjustmentEvent arg0) { AdjustmentEvent scrollBar1; //System.out.println(scrollBar1.getValue())); } } public void paint(Graphics g) { //super.paint(g); frame2.paint(g); Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.RED); g2d.fill(ball); System.out.println("Calling fill()"); } protected void moveBall() { //System.out.println("I'm in the moveBall() function!"); int width = getWidth(); int height = getHeight(); int min, max, randomX, randomY; min =200; max = -200; randomX = min + (int)(Math.random() * ((max - min)+1)); randomY = min + (int)(Math.random() * ((max - min)+1)); //System.out.println(randomX + ", " + randomY); Rectangle ballBounds = ball.getBounds(); //System.out.println(ballBounds.x + ", " + ballBounds.y); if (ballBounds.x + randomX < 0) { randomX = 200; } else if (ballBounds.x + ballBounds.width + randomX > width) { randomX = -200; } if (ballBounds.y + randomY < 0) { randomY = 200; } else if (ballBounds.y + ballBounds.height + randomY > height) { randomY = -200; } ballBounds.x += randomX; ballBounds.y += randomY; _ballXpos = ballBounds.x; _ballYpos = ballBounds.y; ball.setFrame(ballBounds); } public void start() { moveBallTimer.start(); } public void stop() { moveBallTimer.stop(); } private class ListenForMouse implements MouseListener{ // Called when the mouse is clicked public void mouseClicked(MouseEvent e) { //System.out.println("Mouse Panel pos: " + e.getX() + " " + e.getY() + "\n"); if (e.getX() >=_ballXpos && e.getX() <= _ballXpos + 25 && e.getY() <=_ballYpos && e.getY() >= _ballYpos - 25 ) { System.out.println("TRUE"); } System.out.println("{e.getX(): " + e.getX() + " / " + "_ballXpos: " + _ballXpos + " | " + "{e.getY(): " + e.getY() + " / " + "_ballYpos: " + _ballYpos); } public void mouseEntered(MouseEvent arg0) { // TODO Auto-generated method stub } public void mouseExited(MouseEvent arg0) { // TODO Auto-generated method stub } public void mousePressed(MouseEvent arg0) { // TODO Auto-generated method stub } public void mouseReleased(MouseEvent arg0) { // TODO Auto-generated method stub } } // System.out.println("e.getX(): " + e.getX() + " / " + "_ballXpos: " + _ballXpos); // Mouse over public void mouseEntered(MouseEvent arg0) { // TODO Auto-generated method stub } // Mouse left the mouseover area: public void mouseExited(MouseEvent arg0) { // TODO Auto-generated method stub } public void mousePressed(MouseEvent arg0) { // TODO Auto-generated method stub } public void mouseReleased(MouseEvent arg0) { // TODO Auto-generated method stub } } Could anyone tell me what I need to do to get repaint() to call the paint() method in the above program? I'm assuming the multiple frames is causing the problem, but that's just a guess. Thanks.

    Read the article

  • Advice regarding Java frameworks [closed]

    - by Mixiul
    I am in the process of creating a website/phone application using JQuery Mobile and PhoneGap. I am hoping to add openID support so users can login in with pre-existing accounts. It will be necessary for me to have a database with a few tables to enable me to implement all the core functionality I desire. I haven't really had much experience with frameworks before, the closest thing I have done to this is create a basic website using php that connected to a MySql database stored on the machine that hosted the apache webserver. The interaction with the database won't be complex. I am required to use a java framework for the backend of my application. My question is which java framework is most suitable (flexible and straight forward to learn)? Any advice you guys can provide is greatly appreciated. Thanks

    Read the article

  • Is it possible to port a Windows RT app to a Windows Phone app?

    - by balint
    Just recently released an application to the Windows Store, and I'm wondering if it is possible to "downgrade" it to Windows Phone 7.1 - until Windows Phone 8 will arrive. The real problem is with the async stuff, I've found the "Async Targeting Pack", but it requires Visual Studio 2012; however VS2012 doesn't work with the Phone SDK 7.0, 7.1. I'm not in the mood to install old and ugly Visual Studio 2010 on my brand new Windows 8 machine :) Does anyone know a workaround?

    Read the article

  • Can't call function from within onOptionsItemSelected

    - by Kristy Welsh
    public boolean onOptionsItemSelected(MenuItem item) { //check selected menu item switch (item.getItemId()) { case R.id.exit: this.finish(); return true; case R.id.basic: Difficulty = DIFFICULTY_BASIC; Toast.makeText(YogaPosesActivity.this, "Difficulty is Basic", Toast.LENGTH_SHORT).show(); SetImageView(myDbHelper); return true; case R.id.advanced: Toast.makeText(YogaPosesActivity.this, "Difficulty is Advanced", Toast.LENGTH_SHORT).show(); Difficulty = DIFFICULTY_ADVANCED; SetImageView(myDbHelper); return true; case R.id.allPoses: Toast.makeText(YogaPosesActivity.this, "All Poses Will Be Displayed", Toast.LENGTH_SHORT).show(); Difficulty = DIFFICULTY_ADVANCED_AND_BASIC; SetImageView(myDbHelper); return true; default: return super.onOptionsItemSelected(item); } } I get an error when I call the SetImageView function, which was defined out of the OnCreate Activity. Can you not call a function unless it was defined inside the OnCreate? I get a nullPointer Exception when calling the function.

    Read the article

  • error: polymorphic expression with default arguments

    - by 0__
    This following bugs me: trait Foo[ A ] class Bar[ A ]( set: Set[ Foo[ A ]] = Set.empty ) This yields <console>:8: error: polymorphic expression cannot be instantiated to expected type; found : [A]scala.collection.immutable.Set[A] required: Set[Foo[?]] class Bar[ A ]( set: Set[ Foo[ A ]] = Set.empty ) ^ It is quite annoying that I have to repeat the type parameter in Set.empty. Why does the type inference fail with this default argument? The following works: class Bar[ A ]( set: Set[ Foo[ A ]] = { Set.empty: Set[ Foo[ A ]]}) Please note that this has nothing to do with Set in particular: case class Hallo[ A ]() class Bar[ A ]( hallo: Hallo[ A ] = Hallo.apply ) // nope Strangely not only this works: class Bar[ A ]( hallo: Hallo[ A ] = Hallo.apply[ A ]) ...but also this: class Bar[ A ]( hallo: Hallo[ A ] = Hallo() ) // ???

    Read the article

  • How to return arrays with the biggest elements in C#?

    - by theateist
    I have multiple int arrays: 1) [1 , 202,4 ,55] 2) [40, 7] 3) [2 , 48 ,5] 4) [40, 8 ,90] I need to get the array that has the biggest numbers in all positions. In my case that would be array #4. Explanation: arrays #2, #4 have the biggest number in 1st position, so after the first iteration these 2 arrays will be returned ([40, 7] and [40, 8 ,90]) now after comparing 2nd position of the returned array from previous iteration we will get array #4 because 8 7 and so on... Can you suggest an efficient algorithm for this? Doing with Linq will be preferable. UPDATE There is no limitation for the length, but as soon as some number in any position is greater, so this array is the biggest.

    Read the article

  • Problem reading in file written with xdr using c

    - by Inga
    I am using Ubuntu 10.4 and have two (long) C programs, one that writes a file using XDR, and one that uses this file as input. However, the second program does not manage to read in the written file. Everything looks perfectly fine, it just does not work. More spesifically it fails at the last line added here with the error message xdr_string(), which indicates that it can not read in the first line of the input file. I do no see any obvious errors. The input file is written out, have a content and I can see the right strings using stings -a -n 2 "inputfile". Anyone have any idea what is going wrong? Relevant parts of program 1 (writer): /** * create compressed XDR output stream */ output_file=open_write_pipe(output_filename); xdrstdio_create(&xdrs, output_file, XDR_ENCODE); /** * print material name */ if( xdr_string(&xdrs, &name, _POSIX_NAME_MAX) == FALSE ) xdr_err("xdr_string()"); Relevant parts of program 2 (reader): /** * open data file */ input_file=open_data_file(input_filename, "r"); if( input_file == NULL ){ ERROR(input_filename); exit(EXIT_FAILURE); } /** * create input XDR stream */ xdrstdio_create(&xdrs, input_file, XDR_DECODE); /** * read material name */ if(xdr_string(&xdrs, &name, _POSIX_NAME_MAX) == FALSE) XDR_ERR("xdr_string()");

    Read the article

  • Windows 8 Launch&ndash;Why OEM and Retailers Should STFU

    - by D'Arcy Lussier
    Microsoft has gotten a lot of flack for the Surface from OEM/hardware partners who create Windows-based devices and I’m sure, to an extent, retailers who normally stock and sell Windows-based devices. I mean we all know how this is supposed to work – Microsoft makes the OS, partners make the hardware, retailers sell the hardware. Now Microsoft is breaking the rules by not only offering their own hardware but selling them via online and through their Microsoft branded stores! The thought has been that Microsoft is trying to set a standard for the other hardware companies to reach for. Maybe. I hope, at some level, Microsoft may be covertly responding to frustrations associated with trusting the OEMs and Retailers to deliver on their part of the supply chain. I know as a consumer, I’m very frustrated with the Windows 8 launch. Aside from the Surface sales, there’s nothing happening at the retail level. Let me back up and explain. Over the weekend I visited a number of stores in hopes of trying out various Windows 8 devices. Out of three retailers (Staples, Best Buy, and Future Shop), not *one* met my expectations. Let me be honest with you Staples, I never really have high expectations from your computer department. If I need paper or pens, whatever, but computers – you’re not the top of my list for price or selection. Still, considering you flaunted Win 8 devices in your flyer I expected *something* – some sign of effort that you took the Windows 8 launch seriously. As I entered the 1910 Pembina Highway location in Winnipeg, there was nothing – no signage, no banners – nothing that would suggest Windows 8 had even launched. I made my way to the laptops. I had to play with each machine to determine which ones were running Windows 8. There wasn’t anything on the placards that made it obvious which were Windows 8 machines and which ones were Windows 7. Likewise, there was no easy way to identify the touch screen laptop (the HP model) from the others without physically touching the screen to verify. Horrible experience. In the same mall as the Staples I mentioned above, there’s a Future Shop. Surely they would be more on the ball. I walked in to the 1910 Pembina Highway location and immediately realized I would not get a better experience. Except for the sign by the front door mentioning Windows 8, there was *nothing* in the computer department pointing you to the Windows 8 devices. Like in Staples, the Win 8 laptops were mixed in with the Win 7 ones and there was nothing notable calling out which ones were running Win 8. I happened to hit up the St. James Street location today, thinking since its a busier store they must have more options. To their credit, they did have two staff members decked out in Windows 8 shirts and who were helping a customer understand Windows 8. But otherwise, there was nothing highlighting the Windows 8 devices and they were again mixed in with the rest of the Win 7 machines. Finally, we have the St. James Street Best Buy location here in Winnipeg. I’m sure Best Buy will have their act together. Nope, not even close. Same story as the others: minimal signage (there was a sign as you walked in with a link to this schedule of demo days), Windows 8 hardware mixed with the rest of the PC offerings, and no visible call-outs identifying which were Win 8 based. This meant that, like Future Shop and Staples, if you wanted to know which machine had Windows 8 you had to go and scrutinize each machine. Also, there was nothing identifying which ones were touch based and which were not. Just Another Day… To these retailers, it seemed that the Windows 8 launch was just another day, with another product to add to the showroom floor. Meanwhile, Apple has their dedicated areas *in all three stores*. It was dead simple to find where the Apple products were compared to the Windows 8 products. No wonder Microsoft is starting to push their own retail stores. No wonder Microsoft is trying to funnel orders through them instead of relying on these bloated retail big box stores who obviously can’t manage a product launch. It’s Not Just The Retailers… Remember when the Acer CEO, Founder, and President of Computer Global Operations all weighed in on how Microsoft releasing the Surface would have a “huge negative impact for the ecosystem and other brands may take a negative reaction”? Also remember the CEO stating “[making hardware] is not something you are good at so please think twice”? Well the launch day has come and gone, and so far Microsoft is the only one that delivered on having hardware available on the October 26th date. Oh sure, there are laptops running Windows 8 – but all in one desktop PCs? I’ve only seen one or two! And tablets are *non existent*, with some showing an early to late November availability on Best Buy’s website! So while the retailers could be doing more to make it easier to find Windows 8 devices, the manufacturers could help by *getting devices into stores*! That’s supposedly something that these companies are good at, according to the Acer CEO. So Here’s What the Retailers and Manufacturers Need To Do… Get Product Out The pivotal timeframe will be now to the end of November. We need to start seeing all these fantastic pieces of hardware ship – including the Samsung ATIV Smart PC Pro, the Acer Iconia, the Asus TAICHI 21, and the sexy Samsung Series 7 27” desktop. It’s not enough to see product announcements, we need to see actual devices. Make It Easy For Customers To Find Win8 Devices You want to make it easy to sell these things? Make it easy for people to find them! Have staff on hand that really know how these devices run and what can be done with them. Don’t just have a single demo day, have people who can demo it every day! Make It Easy to See the Features There’s touch screen desktops, touch screen laptops, tablets, non-touch laptops, etc. People need to easily find the features for each machine. If I’m looking for a touch-laptop, I shouldn’t need to sift through all the non-touch laptops to find them – at the least, I need to quickly be able to see which ones are touch. I feel silly even typing this because this should be retail 101 and I have no retail background (but I do have an extensive background as a customer). In Summary… Microsoft launching the Surface and selling them through their own channels isn’t slapping its OEM and retail partners in the face; its slapping them to wake the hell up and stop coasting through Windows launch events like they don’t matter. Unless I see some improvements from vendors and retailers in November, I may just hold onto my money for a Surface Pro even if I have to wait until early 2013. Your move OEM/Retailers. *Update – While my experience has been in Winnipeg, similar experiences have been voiced from colleagues in Calgary and Edmonton.

    Read the article

  • Create XFS volume on /dev/sg* device

    - by cpt.Buggy
    Now I have couple of Supermicro 24x2Tb SATA servers and I have now idea how to get access to disks. I need to create XFS volume on each of them but really don't know how to do it, because fdisk doesn't see them. # sg_scan -i /dev/sg0: scsi0 channel=0 id=0 lun=0 [em] ATA ST3250318AS CC38 [rmb=0 cmdq=0 pqual=0 pdev=0x0] /dev/sg1: scsi1 channel=0 id=0 lun=0 [em] ATA ST3250318AS CC38 [rmb=0 cmdq=0 pqual=0 pdev=0x0] /dev/sg2: scsi6 channel=1 id=8 lun=0 [em] Hitachi HDS722020ALA330 JKAO [rmb=0 cmdq=1 pqual=1 pdev=0x0] ... ... ... /dev/sg25: scsi6 channel=1 id=31 lun=0 [em] Hitachi HDS722020ALA330 JKAO [rmb=0 cmdq=1 pqual=1 pdev=0x0] /dev/sg26: scsi6 channel=3 id=0 lun=0 [em] LSILOGIC SASX36 A.1 7017 [rmb=0 cmdq=1 pqual=0 pdev=0xd] # sg_map /dev/sg0 /dev/sda /dev/sg1 /dev/sdb /dev/sg2 .. ... ... /dev/sg25 /dev/sg26 I can't use fdisk and mkfs, what should I do?

    Read the article

  • Blocking ICMP outgoing requests only in eth1

    - by Raj
    I am creating a NAT with iptables: Computer A: eth0 (dhcp) + eth1 (static ip 192.168.0.1 - gateway) Computer B: eth1 (static ip 192.168.0.2, using Computer A as gateway) I know how to block ICMP outgoing requests (-A OUTPUT -p icmp --icmp-type echo-request -j DROP), but that would block ICMP requests from Computer A, but not from Computer B (in fact, only for Computer A - Computer B can keep doing those). I tried with the same command, but adding -o eth1, but that does not block at all. Any idea?

    Read the article

  • Securing php on a shared apache

    - by Jack
    I'm going to install apache+php in a server where two users, A and B, will deploy their website. I'm trying to achieve isolation of users' space for security reasons: that is no scripts from site A should be able to read files in site B. To achieve this I installed suphp. Website files of user A are owned by A:A with perm=700 and user of B are owned by B:B with perm=700. Suphp works great, but apache complains about permissions to read .htaccess. How can I let apache to read .htaccess in every dir of A and B while keeping isolation between site A and site B? I played with ownership (group = www-data) and permissions (750) but I found no way to keep isolation granted. Any idea? Maybe by running apache as root, but in this case are there any drawbacks?

    Read the article

  • Node.js apps and wordpress on the same vps

    - by Msencenb
    So currently my linode (ubuntu 11.10) serves up three node.js apps for me using connect's vhost middleware listening on port 80. Here is an example of how vhost sets up a domain: var portfolio = require('./bootstrap-portfolio/lib/app.js'); var server = express(); server.use(express.vhost('sencedev.com',portfolio)); server.use(express.vhost('www.sencedev.com',portfolio)); server.listen(80); However I would now like to add a wordpress installation to my vps as well. In the past for me this has meant a traditional apache installation; however I'm a bit unsure of how node.js + a different webserver (apache or nginx) should interact. Any thoughts on how I should approach hosting wordpress + node.js on the same box?

    Read the article

  • Is it possible to add wildcard serveralias to virtualhost without modifying httpd.conf manually?

    - by Favourite Chigozie Onwuemene
    Is it possible to add wildcard serveralias (example: *.somesite.com) in an apache server without modifying httpd.conf manually? I use a DNS different from my hosting server and i have added asterisk A record to my DNS to point all request like (test.somesite.com,test2.somesite.com) to my hosting servers IP, but i don't see anyway of adding asterisk serveraliases to apache httpd.conf file in my cpanel. Pls is there a solution?

    Read the article

  • Blocking apache access via user agent string

    - by Tchalvak
    I've got a scripter who is using a proxy to attack a website I'm serving. I've noticed that they tend to access the site via software with a certain common user agent string (i.e. http://www.itsecteam.com/en/projects/project1_page2.htm "Havij advanced sql injection software" with a user_agent string of Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727) Havij). I'm aware that any cracking software worth it's salt will probably be able to modify it's user agent string, but I'm fine with the scripter having to deal with that feature at some point. So, is there any software out there for automatically blocking access & permanently blacklisting by matching user agent strings?

    Read the article

  • How do I force .htaccess authorization to occur over ssl?

    - by kenja
    I'm trying to force a particular directory to require only allowed IPs and a valid username/password through basic authorization. To ensure that the username/password are sent in encrypted form, I want the directory to also force SSL use. Here is what I have in my .htaccess file: # Force HTTPS-Connection RewriteEngine On RewriteCond %{SERVER_PORT} !^443$ RewriteRule (.*) https://www.mywebsite.com%{REQUEST_URI} [R,L] ## password begin ## AuthName "Restricted Access" AuthUserFile /var/www/admin/.htpasswd AuthType Basic Require valid-user Order deny,allow Deny from all Allow from 79.1.231.151 62.123.134.83 Satisfy All Unfortunately, when I access that directory using http protocol, it is asking for the password before it redirects the page to the secure version. This means the password is sent unencrypted. What am I doing wrong? Is there a way to do this?

    Read the article

  • Stopping immediate right button up in Mint 13 (Cinnamon) actioning first menu choice

    - by jontyc
    In Windows, a single right click (i.e., with release) displays a context menu on the screen, allowing you to select the appropriate choice with a further click from either button. In Mint 13, Cinnamon, it's hold down the right button, drag, then release on the appropriate menu choice. Both methods are fine, but constantly using both OSs regularly, I'm doing the Windows procedure in Mint by mistake all the time. This makes the single right click and release bring up the context menu and immediately action the first menu choice. Is there any mechanism to ignore right-button-up if a substantial dragging action or time period hasn't occurred, and have Mint looking for a further click to select?

    Read the article

  • Can I change the image associated with my computer when it's sharing as a media server?

    - by animuson
    I currently have my computer setup to share its videos, music, and pictures as a media server so I can easily access all of my stuff from my PS3 and play it on my TV (since I can't connect my computer directly to my TV). However, my dad also has his laptop setup as a media server, for whatever reason, and both of them use the same "Windows Media Player" icon in the list. It's not a huge issue, but I was wondering if it was possible to somehow change what icon gets sent out by your computer to other devices when it's acting as a media server, and how?

    Read the article

  • Spikes of 99% disk activity in Windows 8 Task Manager

    - by Jonathan Chan
    For some reason Windows 8's Task Manager reports spikes of 99% disk activity for hours at a time. Looking at the entries in that column, however, data doesn't seem to be getting written any more quickly than when the disk activity is around 25-50% (which it seem to idle at most of the time). Furthermore, when these 99% disk activity spikes are happening, the average response time reported in the Performance tab becomes 4000-6000ms. Is there a good way to find out what is causing the disk activity? I've tried using Process Explorer, but I said above, the rate at which data is reportedly being written doesn't seem to correspond (Dropbox and Google Chrome are constantly the top two, but the spikes are not dependent on their being open). Thanks in advance for any help. It gets very annoying when the computer stutters to a halt.

    Read the article

  • Debug JS from browser without a server/localhost

    - by sazpaz
    So something I do very frequently is writing random scripts in JS without really being part of an app. To run them I just paste them in the console of either Chrome of FF which works as a nice REPL, or if I really need more fancy debugging I just add it to my test app on localhost and browse it from the browser. Is there a way to get all the good debugging of a browser (breakpoints, locals, etc), without it being served from a server?, e.g by just copy-pasting my code into console or something?

    Read the article

  • graphics performance better on battery?

    - by Scott Beeson
    Anyone have any idea why my laptop would perform (considerably) better while on battery than while plugged in? It's a Dell Latitude E6420 with Windows 8 Pro. I tried mirroring all the settings in the selected power plan from "On battery" to "Plugged In" and that didn't help. I then just restored the defaults for all power plans (balanced and high performance). I'm still seeing the same results. The best example where it is most noticeable (don't laugh) is Sim City Social in Chrome. I'm probably seeing a performance increase of 5x on battery versus plugged in. This is easily reproducible too. I'm very confused. Could it be caused by dust? The laptop isn't that old and there is no visible dust. I'm not going to take it apart to check the insides as it's a corporate laptop. Could it be overheating? Battery Sim City Social: 68 degrees max Civ V: 77 degrees max Charger Sim City Social: 68 Civ V: did not test See answer below... I'm retarded

    Read the article

  • Windows 8 installer: Something Happened

    - by mcandre
    My school provides Windows 8 through MSDN. When I run the Windows 8 installer, it says: What can I do? Specs: systeminfo | findstr /B /C:"OS Name" /C:"OS Version" OS Name: Microsoft Windows 7 Professional OS Version: 6.1.7601 Service Pack 1 Build 7601 systeminfo | findstr /B /C:"System Manufacturer" /C:"System Model" System Manufacturer: Apple Inc. System Model: MacBookPro5,5 Also posted in Microsoft Community.

    Read the article

  • Data transfer speed to USB storage connected to wifi router very slow

    - by RonakG
    Here is my setup. A Linksys Cisco E3200 wifi router. A MacbookPro running OS X Lion 10.7.4. A Seagate GoFlex 1TB hard drive connected to wifi router via the USB port. When I try to transfer data from my MBP to the HDD, the data transfer rate is very low. I'm getting around 3MB/s write speed. This is very slow compared to the speed I get when HDD is directly connected to the MBP. The HDD is NTFS formatted. And the router provides access to HDD using Samba share. So I connect to the HDD using smb://. What is the limiting factor here affecting the data transfer rate?

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13  | Next Page >