Search Results

Search found 72370 results on 2895 pages for 'file moving'.

Page 68/2895 | < Previous Page | 64 65 66 67 68 69 70 71 72 73 74 75  | Next Page >

  • Write to a binary file?

    - by rick irby
    Here is data structure w/ variables: struct Part_record { char id_no[3]; int qoh; string desc; double price: }; --- (Using "cin" to input data) --- Part_record null_part = {" ", 0," ",0.0}; --- --- file.seekg( -(long)sizeof(Part_record), ios::cur); file.write( ( char *)&part, sizeof(Part_record) ); The three variables, qoh, Id_no & price, write out correctly, but the "desc" variable is not right. Do I need to initialize Part_record some other way? It should be 20 characters in length. If you have enough info here, pls share your advice,thanks.

    Read the article

  • Nginx redirect all request that does not match a file to a php file

    - by cyrbil
    I'm trying to get all request to: http://mydomain.com/downloads/* redirect to http://mydomain.com/downloads/index.php except if the requested file exist in /downloads/ ex: http://mydomain.com/downloads = /downloads/index.php http://mydomain.com/downloads/unknowfile = /downloads/index.php http://mydomain.com/downloads/existingfile = /downloads/existingfile My current problem is I have either the redirection to php working but static files not served or the opposite. Here is my current vhost conf: (which redirect fine but static files are send to php and fail) server { listen 80; ## listen for ipv4; this line is default and implied server_name domain.com; root /data/www; index index.php index.html; location / { try_files $uri $uri/ /index.html; } error_page 404 /404.html; # redirect server error pages to the static page /50x.html error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/www; } location ^~ /downloads { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_index index.php; include fastcgi_params; try_files $uri @downloads; } location @downloads { rewrite ^ /downloads/index.php; } # pass the PHP scripts to FastCGI server # location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } } Precision: static files are symlinks created by /downloads/index.php Thank you for your help.

    Read the article

  • Using Python read specific (column, row) values from a txt file

    - by user2955708
    I would like to read values from a text file until that is a float value. Lets say I have the following file: 14:53:55 Load 300 Speed 200 Distance,m Fz Fx Speed 0.0000 249 4 6.22 0.0002 247 33 16.29 0.0004 246 49 21.02 0.2492 240 115 26.97 0.2494 241 112 21.78 0.2496 240 109 13.09 0.2498 169 79 0.27 Distance,m Fz Fx Speed 0.0000 249 4 7.22 0.0002 247 33 1.29 0.0004 246 49 271.02 0.2492 240 115 26.97 0.2494 241 112 215.78 0.2496 240 109 13.09 0.2498 169 79 0.27 And I need only the values under the first Distance column. So something like skip the first few rows, then read values from the first column while it is float. Thanks your help in advance

    Read the article

  • Add up values from a text file

    - by Stanley
    Hi Guys I have a text file that contains Amounts at Substring (34, 47) of each line. I need to sum Up all the Values to the End of the File. I have this code that I had started to build but I do not know how to proceed from here: public class Addup { /** * @param args the command line arguments */ public static void main(String[] args) throws FileNotFoundException, IOException { // TODO code application logic here FileInputStream fs = new FileInputStream("C:/Analysis/RL004.TXT"); BufferedReader br = new BufferedReader(new InputStreamReader(fs)); String line; while((line = br.readLine()) != null){ String num = line.substring(34, 47); double i = Double.parseDouble(num); System.out.println(i); } } } The output is like this: 1.44576457E4 2.33434354E6 4.56875685E3 The Amount is in two decimal Places and I need the result also in the Two decimal Places. What Is the Best way to achieve this?

    Read the article

  • I need to rename a file in VBA, but getting "File Not Found" when it's clearly there!

    - by Karl
    Help! I'm getting a File Not Found error when trying to rename a file w/a variable. The variable is string. I can look at the variable and it's the exact filename that is there, but when I run the code, it says not found! Dim filePath, fileName, absPath, newPath As String filePath = "P:\Automated\" fileName = MySite.GetResult absPath = filePath & fileName newPath = "P:\Automated\NEW.csv" 'The following is a rename from CuteFTP Pro COM Object: '(Getting the same result from this and the below "Name". 'MySite.LocalRename "P:\Automated\" & fileName, "P:\Automated\NEW.csv" Name absPath As newPath

    Read the article

  • Generate a collection of changed lines between two revisions of a file using Java

    - by mchr
    I am writing an eclipse plugin which needs to be able to determine which lines of a file have changed compared to a different version of the same file. Is there an existing class or library which I can use for this task? The closest I have found is org.eclipse.compare.internal.merge.DocumentMerger. This can be used to find the information I need but is in an internal package so is not suitable for me to use. I could copy/paste the source of this class and adapt it to my requirements. However, I am hoping there is an existing library to handle textual comparisons.

    Read the article

  • C++: How do I correctly register and unregister file type associations for our application (programa

    - by Mordachai
    Time was when you set file associations in: HEY_CLASSES_ROOT\<.ext However, that seems to be possible, but an incomplete solution anymore. There are additional associations throughout the registry. For example: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\KindMap HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\Extensions And all of the above, but by HKEY_USERS\ And Microsoft added their Set Default Associations control panel applet, which controls... what? I'm looking for a white paper, or discussions on: "How is a modern, Windows XP-Windows 7 compatible application written in C/C++ supposed to register and manipulate its file associations without interfering with Explorer, User-Settings, or the Default Associations cpl"

    Read the article

  • save input from text file to array

    - by Jessy
    How to save txt file content to different arrays? my txt file content is like this; 12 14 16 18 13 17 14 18 10 23 pic1 pic2 pic3 pic4 pic5 pic6 pic7 pic8 pic9 pic10 left right top left right right top top left right 100 200 300 400 500 600 700 800 900 1000 how can I save each line into different array? e.g. line 1 will be saved in an array1 line 2 will be saved in an array2 line 3 will be saved in an array3 line 4 will be saved in an array4 Thanks you

    Read the article

  • Attach file to mail using php

    - by ktsixit
    Hi all, I've created a form which contains an upload field file and some other text fields. I'm using php to send the form's data via email and attach the file. This is the code I'm using but it's not working properly. The file is normally attached to the message but the rest of the data is not sent. $body="bla bla bla"; $attachment = $_FILES['cv']['tmp_name']; $attachment_name = $_FILES['cv']['name']; if (is_uploaded_file($attachment)) { $fp = fopen($attachment, "rb"); $data = fread($fp, filesize($attachment)); $data = chunk_split(base64_encode($data)); fclose($fp); } $headers = "From: $email<$email>\n"; $headers .= "Reply-To: <$email>\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/related; type=\"multipart/alternative\"; boundary=\"----=MIME_BOUNDRY_main_message\"\n"; $headers .= "X-Sender: $first_name $family_name<$email>\n"; $headers .= "X-Mailer: PHP4\n"; $headers .= "X-Priority: 3\n"; $headers .= "Return-Path: <$email>\n"; $headers .= "This is a multi-part message in MIME format.\n"; $headers .= "------=MIME_BOUNDRY_main_message \n"; $headers .= "Content-Type: multipart/alternative; boundary=\"----=MIME_BOUNDRY_message_parts\"\n"; $message = "------=MIME_BOUNDRY_message_parts\n"; $message .= "Content-Type: text/html; charset=\"utf-8\"\n"; $message .= "Content-Transfer-Encoding: quoted-printable\n"; $message .= "\n"; $message .= "$body\n"; $message .= "\n"; $message .= "------=MIME_BOUNDRY_message_parts--\n"; $message .= "\n"; $message .= "------=MIME_BOUNDRY_main_message\n"; $message .= "Content-Type: application/octet-stream;\n\tname=\"" . $attachment_name . "\"\n"; $message .= "Content-Transfer-Encoding: base64\n"; $message .= "Content-Disposition: attachment;\n\tfilename=\"" . $attachment_name . "\"\n\n"; $message .= $data; //The base64 encoded message $message .= "\n"; $message .= "------=MIME_BOUNDRY_main_message--\n"; $subject = 'bla bla bla'; $to="[email protected]"; mail($to,$subject,$message,$headers); Why isn't the $body data not sent? Can you help me fix it?

    Read the article

  • Moving from 1 Linux Partition to Many over USB Mount

    - by Mistiry
    We have devices which use Compact Flash for storage. They work OK, but we recently got industrial-grade CF cards to start using. One of the major problems we get is corruption on the flash card. As it is now, these flash cards run Debian with everything in a single partition. We want to have multiple partitions on the new industrial CF cards to help avoid some of the corruption problems. I booted up the device, and attached a USB CF reader. I then used fdisk to partition the CF card in the USB reader. How can I move the data to these partitions so that it works? I have a partition for each of these directories: /lib /var /root /boot /tmp /home /etc / swap space I imagine I can't just use rsync - do I need to attach a second CF reader with a copy of the CF card, so that it's not active and in-use - and then copy from the first reader to the second? How will the system know where to find its files? I know I'd have to change fstab, but that resides in /etc, which will be on a separate partition...how will it find the fstab file if it can't find /etc? And what about grub? I'm at a loss, perhaps its just because I'm under the weather, or I'm just missing a piece of logic here... Any help is greatly appreciated, this is somewhat urgent as our existing stock is nearing its end and we don't want to purchase anything but these industrial cards, but need to get it working with partitions.

    Read the article

  • python open does not create file if it doesnt exist

    - by Toddeman
    I am using Python. What is the best way to open a file in rw if it exists, or if it does not, then create it and open it in rw? From what i read, file = open('myfile.dat', 'rw') should do this, no? it is not working for me (python 2.6.2) and im wondering if it is a version problem, or not supposed to work like that or what. The bottom line is, i just need a solution for the problem. I am curious about the other stuff, but all i need is a nice way to do the opening part. thanks in advance

    Read the article

  • replacing values in formated file with python

    - by froggy
    I have a string see attached file like that and i would like to modify it using a function Giving section name parameter name and value to set Also in case i want to modify several parameters for a same section how can i have position in file to avoid scanning x time for a same section and other to pass my question and other to pass my question and other to pass my question and other to pass my question and other to pass my question and other to pass my question and other to pass my question and other to pass my question and other to pass my question and other to pass my question and other to pass my question an and other to pass my question d other to pass my question and other to pass my question and other to pass my question and other to pass my questionand other to pass my question and other to pass my question

    Read the article

  • headers already sent displays after moving files from one server to another

    - by PERR0_HUNTER
    hey there! I have a project running on dreamhost hosting and it's working fine, but since DH has been getting really slow I'm moving the project to my new dedicated server. The thing is that after I move all of my file over to the new dedicated (ubuntu 8.4) I get see warnings all over the place telling me that the headers had been already sent. The first thing I tried was moving the files via FTP: download to my machine, upload to server - Didn't worked Second try was tar.gz the folder on the first server and untar it on the new one, didn't worked either I tried chaing enconding to ANSI and they start working, however most of my files contain accents so ANSI is not an option for all my files i need UTF8 Any ideas on how to fix this? I'm sure it must be some sort of config

    Read the article

  • Position DIV relative to containing DIV Without Moving Other Stuff

    - by yar
    [I'm not sure if this question has been asked, though I've looked around a bit.] I have a DIV inside a DIV. I would like the inner DIV to have a certain position inside the outer div. I'm having some success with this position: absolute; top: 0px;right:0px; but all other divs are getting moved around. I just want it to float on top of the other stuff (float didn't work, of course). Thanks! Edit: The outer div is relative, and I'd like the inner to move with it when the browser is resized. Edit: Sorry, I've figured out the question (but not the answer): if I use right:0px, the inner div stops moving relative to the outer div and starts moving relative to the browser window. Why would that be?

    Read the article

  • How to give 'Everybody' full rights to a file (programmatically)

    - by egrunin
    I'm modifying an old C++ program to run on Vista. It does not require Admin privileges. I've changed the code to put logfiles in \ProgramData\MyApp\. These logfiles are written with the stdio functions (fopen, fprintf, fclose). Here's the problem: UserA runs the program first, it creates \ProgramData\MyApp\MyLogFile.txt UserB runs the program next, it tries to append to MyLogFile.txt and gets access denied. I tried creating a null SECURITY_DESCRIPTOR and passing that to CreateFile(). That does create a file with "no permissions assigned", but it seems as if the first user to write to the file takes ownership and afterwards all the other non-admin users are out of luck. It's important that all users share the same logfiles, but it's also important that I change as little code as possible.

    Read the article

  • Reading data file into an array C#

    - by Whitey
    I have an array like this: int[,] iMap = new int[iMapHeight, iMapWidth] { { 0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, { 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 1, 1, 1, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, }; And I want the same thing coming from a data file. The file should be structured like this preferably: 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 0000000000000000000000000 Which will ultimately make an array like above with all values set to 0. What would be the best way to do this? Would I read one line from the file and then split each characters separately and transfer it to the new array? Or perhaps read a line, and then read each character and put that in the array? Thanks for any help.

    Read the article

  • Calling class in Java after editing file used in as source for table

    - by user2892290
    I'm currently working on a project, I'll try to subrscibe first. I save data into text file, that I use as a source for browser of that data. The browser is based on table that contains the data. I have to rewrite the source file everytime I delete or edit data. That's where the problem comes in. After deleting or editing data I call a method to create the table again, but the table never creates. Is it possibly made by editing the file and calling the method right after that? If I restart my app the table is successfully created with right data. Take in note that I don't get any error message. This is the method I use for loading data from source file: try (BufferedReader input1 = new BufferedReader(new FileReader("./src/data.src"))) { int lines = 0; while (input1.read() != -1) { if (!(input1.readLine()).equals("")) { lines++; } } input1.close(); if (lines == 0) { JOptionPane.showMessageDialog(null, "No data to load, create a note first!"); new Writer().build(frame); } else { try (BufferedReader input = new BufferedReader(new FileReader("./src/data.src"))) { Game[] g = new Game[lines]; String currentLine; String[] help; int counter = 0; while (lines > 0) { currentLine = input.readLine(); help = currentLine.split("#"); g[counter] = new Game(help[0],help[1], help[2], help[3], help[4], help[5], help[6], help[7], help[8], help[9]); counter++; lines--; } input.close(); final JButton bButton = new backButton().create(frame, mPanel); build(g, frame, bButton); mPanel.add(panel); mPanel.add(panel2); mPanel.add(searchPanel); mPanel.add(bButton); bButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); panel.removeAll(); frame.setCursor(Cursor.getDefaultCursor()); } }); mPanel.setPreferredSize(new Dimension(1000, 750)); panel.setBorder(new EmptyBorder(10, 10, 10, 10)); frame.setLayout(new FlowLayout()); frame.add(mPanel); frame.pack(); JMenuBar menuBar = new Menu().create(frame, mPanel); frame.setJMenuBar(menuBar); frame.setVisible(true); Rectangle rec = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); int width = (int) rec.getWidth(); int height = (int) rec.getHeight(); frame.setBounds(1, 3, width, height); frame.addComponentListener(new ComponentAdapter() { @Override public void componentMoved(ComponentEvent e) { frame.setLocation(1, 3); } }); And this is the method I use for creating the table: String[][] tableData = new String[g.length][9]; for (int i = 0; i < tableData.length; i++) { tableData[i][0] = g[i].getChampion(); tableData[i][1] = g[i].getRole(); tableData[i][2] = g[i].getEnemy(); tableData[i][3] = g[i].getDifficulty(); tableData[i][4] = g[i].getResult(); tableData[i][5] = g[i].getScore(); tableData[i][6] = g[i].getGameType(); tableData[i][7] = g[i].getPoints(); tableData[i][8] = g[i].getLeague(); } final JLabel searchLabel = new JLabel("Search for champion played."); final JButton searchButton = new JButton("Search"); final JTextField searchText = new JTextField(20); frame.setTitle("LoL Notepad - reading your notes"); JTable table = new JTable(tableData, columnNames); final JScrollPane scrollPane = new JScrollPane(table); scrollPane.setPreferredSize(new Dimension(980, 500)); panel2.setPreferredSize(new Dimension(1000, 550)); panel2.setVisible(false); panel2.setBorder(new EmptyBorder(10, 10, 10, 10)); panel3.setVisible(false); panel.setLayout(new FlowLayout()); panel.add(scrollPane); searchPanel.add(searchLabel); searchPanel.add(searchText); searchPanel.add(searchButton); searchButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); search(g, searchText.getText(), frame, bButton); frame.setCursor(Cursor.getDefaultCursor()); } catch (IOException ex) { Logger.getLogger(Reader.class.getName()).log(Level.SEVERE, null, ex); } } }); table.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (e.getClickCount() == 1) { JTable target = (JTable) e.getSource(); panel.setVisible(false); searchPanel.setVisible(false); bButton.setVisible(false); int row = target.getSelectedRow(); specific(row, g, frame, bButton); } } });

    Read the article

  • .resx file data inaccessible in Visual C#

    - by dsp_099
    What I'm trying to do: include some files along with the executable to extract them later. I have two projects, both with a Resource1.resx file (and some resources included from disk). In one project, I can use File.WriteAllBytes(path, Resource1.Image); to dump the resource to disk. In another, Resource1 is does not exist. I've done this before but all I can find is information about localizations (?) when I search MSDN for how to work with Resources.

    Read the article

< Previous Page | 64 65 66 67 68 69 70 71 72 73 74 75  | Next Page >