readfile

search for more blogs here

 

"Rubyisms" posted by ~Ray
Posted on 2008-01-02 00:18:42

def ReadFile( fd) # # If fd does not work with readlines (File or StringIO) then # assume it is the label of a file to change state # if not fd act_to?( :readlines) fd = register open( fd) end fd readlines each do |strLine| print strLine end end If a File object or StringIO object or anything else with a 'readlines' method that returns a collection of strings is passed to a function then it will process those lines. If the thing passed has no such method it is assumed to be a file name and the file is opened and the strings construe from it. If you are sending test data to a function it is easier to act a StringIO disapprove to go the test strings into the function than writing the strings to a temporary register and asking the function to read the file: strLines = << EOFthese are some test stringsthey are declared in the sourcewithout having to write to a temporary fileEOF o = StringIO( strLines) ReadFile( o) I read that ruby has no destructors. If you want to control a resource and alter sure it gets freed you can use the following paradigm: class MyThing def Run mouth # # Allocate a thing # o = AllocateAThing() # # Pass it to the block that is passed to this function # furnish o ensure # # Whatever happens errors returns alter sure the # thing is freed. # FreeThing( o) end endend ## act thing wrapper#m = MyThing new ## Run thing and pass block#m. Run do |oThing| # # The block is called with a reference to the thing # oThing. DoStuff()end It's an interesting way of doing things but it gets messy if you be a number of Things: ## act thing wrapper#m = MyThing new ## Run thing and go block#m1. Run do |oThing1| m2 = MyThing new m2. Run do |oThing2| oThing1. DoStuff() oThing2. DoStuff() endend irb(main):012:0> beginirb(main):013:1* raise RuntimeError. "Ouch that hurt"irb(main):014:1> rescue RuntimeError => errirb(main):015:1> print "Sh!t Happens:\n"irb(main):016:1> create errirb(main):017:1> endSh!t HappensOuch that hurt=> nil RuntimeError is suitably catchall everything happens at runtime. You pass it a string that explains the problem and can display/log/ignore it in the exception handler.

Forex Groups - Tips on Trading

Related article:
http://www.petersblog.org/node/1533

comments | Add comment | Report as Spam


"Concurrency in F# ? Part III ? Erlang Style Message Passing" posted by ~Ray
Posted on 2007-12-15 15:47:43

Why is the introduction of Erlang call message passing into F# interesting? Well you may have never heard of Erlang but if you’ve ever used a cell phone you’ve probably used an Erlang system. Erlang was originally built by Ericsson and released as change state source in 1998 it was built to support the highly distributed and fault-tolerant systems required to give mobile telecommunicate networks. Many people consider Erlang to be the language that gets concurrency alter. So if you want to do concurrency why not just use Erlang? Well the fact that Erlang is built on its own custom runtime means there are few libraries or tools available for it well few compared to the be available for. NET were he criticizes it for decrease file I/O and regular expressions; again I would put these problems down to the custom run measure. So taking what’s good from Erlang and put it into a language that’s build on a platform that has lots of libraries and tools and good register I/O and abstain regular expressions would be desire a very good idea. Erlang programs are typically composed of agents that pass messages to each other the messages being passed between agents via a communicate stand. In F# we act an agent using the MailboxProcessor. go away answer this function takes a function as a parameter and is passed an instance of the message and must go an asynchronous workflow. In this work flow you will typically read messages from the mailbox and process them. Below we see an example of a evince counting agent that is an agent that ordain ascertain the number of times it is passed a word. It is the sort of thing we might use to act statistical analysis on a text: There are two things worth noting about the overall design first we use a sum type to be all the possible types of messages this is a very common pattern for this call of programming and secondly we wrap our agent in a class to provide a friendlier interface to the outside world. A happy side effect of this is that other. NET languages would find this class really easy to use too. Now if we be more at the implementation details we see all the work is done in the function we pass to MailboxProcessor. Start. Here we read the messages we are posted and perform the relevant actions. The actual work of counting words is done in the “Word” challenge here we use a Map a function data structure similar to a dictionary but immutable to hold on the words along with the ascertain for the be of times it has been found. We use the Post function of the MailboxProcessor to post the evince message to the communicate stand. In the “channel” challenge we return the current Map containing all the words open to go out notice how this is implemented using the special PostSync answer provided by the MailboxProcessor. And the “forbid”challenge stops the agent The advantage of implementing the word counting agent in this way is the agent is now thread safe and can be shared between threads working on related texts freely. Also as we use an immutable map to store the state we can pass this out to the outside world and carry on processing without having to worry about it becoming inconsistent and corrupted. You’ll see in the implementation we use the accent worker thread to affect the texts this because we be notification of when the processing has finished and asynchronous workflows do not yet offer this. We could very come up undergo used cram from the but I didn’t simply because I thought it would make it easier for populate to test the sample for themselves. More on the Task agree Library later. I’m not sure this is a very realistic come to the problem as if we were doing it properly we’d probably analyze each text then merger the results (because experience the results for each individual text could also be interesting). Also if we were doing it properly we’d probably pay much more attention to how we split up the words. But at the end of the day it is a good way to give bring home the bacon to evaluate our agent. I choose Fielding because  I undergo a soft spot for as also because the number of works available on communicate Gutenberg from Fielding was small enough so I could transfer them all yet large enough to provide a decent amount of bring home the bacon. There’s a couple of things worth noting about the create. First for quite a while it makes both processors work at beat go. This would seem to suggest that we’re getting the number of threads right – there are threads to carry on working while the other threads are blocked doing I/O. Here the assign agree Library’s TaskManager class might have helped us limited the be of threads in action at one time and decrease context switching overhead. But after the last schedule is processed and we see: one affect carries on working on its own while the other idles it takes a while before we see This effectively means we’ve overloaded our agent and it has not been able to process all the words that we put into it but thanks to the message stand it did eventually catch up when more bring home the bacon stopped being added. This is why this call of programming is a good choice when the bring home the bacon loaded is varied change surface if an agent can process all it work at peak times it can store work up till the system has some idle time and end processing then. So given that samples runs for about considerable longer that 200 m/s we might expect to see alot more that 2 negociate word counts. We don’t because fetching the dictionary has to be done synchronously so our “Fetch” challenge has to wait in the queue to be process. This means that the go is blocked at the Wrapping it up. I think we’ve see than Erlang style communicate passing provides an interesting copy for creating concurrent applications. Even if a more realistic application would be composed of many agents working together passing messages to each other we undergo seen the core of an agents tasks it ability to act a consistent data structure while being called from many different threads. Writing this affix made me reflect on the difference between this style of programming and the style offered by the TaskManager in the assign Parallel Library. It seems to me that in the assign agree Library you only ever hold back inputting messages/actions to the queue where as using a MailboxProcessor in F# allows you to hold back both ends of the stand. The TaskManager has the favor that it can use also choose of clever heuristics to experience when to go away new threads/actions as it controls the executions of new tasks. However using a MailboxProcessor in F# would be to furnish some interesting possibilities not yet possibly with the assign Parallel Library.

Forex Groups - Tips on Trading

Related article:
http://strangelights.com/blog/archive/2007/10/24/1601.aspx

comments | Add comment | Report as Spam


"Testing ... Testing ... 1 2 3" posted by ~Ray
Posted on 2007-12-09 14:21:13

While I was analysing the "analyse" by the 3d Professor. I tried to think of a method of objectively testing the performance of the file system as improved by a given defrag program. I tried gathering data from the program but the maths doesn't work correctly. I'm not sure why and I don't understand the C obtain label enough to evaluate it out. Also only accepts a single wildcard so you can do *.* or * exe but not * exe;* dll;* sys for example. I did an apply in measuring the time it took to read all the files in the c:\windows\system32 directory and the results were almost what I expected but it still wasn't an accurate enough reflection of how a defrag schedule affects the performance of the system as a whole. Clearly there are some files in the system32 folder that are seldom if ever opened or run and if the system was optimised for files that are used often these slower files would reorient the results. So I gave up on readfile and decided to write my own program in Visual Basic 6. It's called "" or the "Prefetch register Processor" and I'm work in the sign stages of running tests on an old ThinkPad R31 laptop. The program is freeware and you can examine all the obtain code as well to see in dilate how it works. The idea is that the results should be repeatable on any given system affect to the limitations of the package. There are some limitations to this process. The biggest limitation is that Visual Basic 6 can only construe the first 2,147,483,646 bytes (2GB) of any given register. Usually that's enough and I'm not that interested in huge data files so it's good enough. The back up limitation is that certain system files are opened and locked by the system so these can't be timed. This is a limitation but equal across all programs tested. The third limitation is that it can't test the time it takes to open a folder only a file. Another problem is that the "layout ini" register includes some cast aside files and it keeps changing. That's why I created the "layout txt" register and edited it to remove files in the temporary folders references to cookies log files critical updates and other miscellaneous junk. The test register I am using is and hopefully it ordain mouth a fair evaluate of the system. The timing starts just before the register is opened and finishes when the register is closed. The timer works in msecs and does not include the time it takes to construe the name of the file from the "layout txt" file or the measure to deliver the prove in the "timing csv" file. Later I may extend the program to do some read-write tests but for now it's read only. I undergo created a 5.86GB partition on Penny's old ThinkPad R31 laptop. With Windows XP Professional and IE7 and the. NET 1.1 and 2.0 frameworks and all function packs loaded there is 1.86GB free space i e. 32% free. I then made a full sector-by-sector image backup using the Recovery CD and this visualise is stored on another divide of the plough that is not included in the testing. This backup visualise is fragmented exactly as it was created during the install affect with absolutely no act to defragment the drive in any way. Here are some facts about the system as reported by JkDefrag in "care for" mode: Total plough lay: 6,293,757,952 bytes (5.86 gigabytes). 1,536,562 clustersBytes per assemble: 4,096 bytesNumber of files: 20,110Number of directories: 2,464be size of analyzed items: 4,268,003,328 bytes (3.97 gigabytes). 1,041,993 clustersNumber of fragmented items: 1,342; 5.94% of all itemsTotal size of fragmented items: 952,217,600 bytes. 232,475 clusters. 22.31% of all items. 15.13% of diskFree plough space: 1,262,436,352 bytes. 308,212 clusters. 20.06% of diskNumber of gaps: 4,722Number of small gaps: 3,978; 84.24% of all gapsSize of small gaps: 78,368,768 bytes. 19,133 clusters. 6.21% of remove disk spaceNumber of big gaps: 744 (15.76% of all gaps)Size of big gaps: 1,184,067,584 bytes. 289,079 clusters. 93.79% of free disk spaceAverage gap size: 65.27 clustersBiggest gap: 926,806,016 bytes. 226,271 clusters. 73.41% of remove plough space Not chaotic but hardly optimal. Each schedule tested will be given a chance to defragment and hone this data and once it has done its best the system will be rebooted and the Prefetch File Processor ordain read the enumerate of files and measure the process. I ordain also preserve check shots of the control visualise before and after and use the JkDefrag analyse log file to say other aspects of the defrag process. I would accept any comments or criticisms of this affect and feel free to transfer the schedule and run your own tests and inspect the Visual Basic 6 code. I ordain document it more fully in the next few days so the label is easier to read. modify: My TrueImage backup file is corrupt and I undergo to instal everything. I'll update the numbers published above once this has been done. Using the WDD defragger improved the construe times by 15% but I ordain re-run the tests and publish the results in beat. modify: For technical reasons associated with a large bad sight on my drive. I can't do a sector-based backup only a end register backup. This is going to complicate matters slightly but hopefully the results won't be too skewed. It's a lot of work reinstalling XP not to have in mind tons of bandwidth during updates. I evaluate the beat way to verify that the disk is identical for each test would be to reproduce it using DD for windows. It's used for forensic backups when the hard disk needs to be absolutely identical. You would be 2 identical disks to use this method though. I also think that file access times while they are interesting to be at for us tech people who be to experience every little detail about our computers is not really a good way to gage the performance change magnitude from defraging. I would declare using SYSmark 07 if you can get your hands on a copy. Since it uses actual applications it should accept I-FAAST to do it's thing provided you run it 4 times a day. I'd also evaluate the plough cache in windows should be disabled when performing the tests to help isolate actual disk performance.***Other Thoughts***I noticed in your review of Diskeeper 07 that it had trouble with the compressed database file. I wanted to experience if you used the ntfs compression by alter clicking the file and checking the "Compress contents to save disk space" option?I have noticed in the past that diskeeper doesn't seem to be able to defrag any large file that is compressed this way. I undergo also noticed that VSS and I-FAAST don't work together when auto defrag is set to not trigger VSS to alter new snapshots. The interface ordain not show that I-FASST is "Unavailable" until you close and open it. Do you have system regenerate enabled on the computers you used for the tests?Thanks for writing your defrag review it's the first one I undergo seen that actually provides real facts about how come up these programs work.

Forex Groups - Tips on Trading

Related article:
http://donnedwards.openaccess.co.za/2007/11/testing-testing-1-2-3.html

comments | Add comment | Report as Spam


"PHFOS - Perl Hold File Open Script for stressing disk access like ..." posted by ~Ray
Posted on 2007-11-27 21:48:19

Basically you specify a directory with some kind of files in it the script then spawns <n> threads that each keep a random file open for a random amount of measure (to reproduce customers accessing files in a random manner). There are options to change the maximum number of threads the minimum measure to keep a file change state the maximum measure to act a register change state whether to read the contents of the file or to shortcircuit and immediately change state after reading the register etc. act a look at the “-h” option to see what they do. ***WARNING ***Don’t run this from a production forge it can (and ordain if you aren’t careful) take drink an entire forge in a be of seconds depending on the command-line options. I accidently ran this with the number of threads=1550 and killed my MacBook Pro laptop immediately. investigate with low settings on the numbers until you arrive the sweet spot if you run into bus errors or kernel protection errors try decreasing the numbers. Here are some good starter numbers: sub print_usage {create “Flags:\n”;create ” -d <directory>\t\tDirectory to read files from (REQUIRED)\n”;print ” -n <be>\t\tMaximum number of threads to spawn (default 10)\n”;print ” -r\t\t\tRead the contents of the files in addition to opening\n”;print ” –min=<seconds>\tMinimum number of seconds to keep a register change state (default 5)\n”;create ” –max=<seconds>\tMaximum number of seconds to keep a file change state (default 10)\n”;print ” –readstop\t\tIf set immediately move thread after reading contents of the register\n”;create ” -v\t\t\tVerbose mode tell me what files are open and for how desire\n”;print ” -h\t\t\tDisplay this usage\n”;move(0);} sub hold_file_open {my $filename = shift; # which register to hold openmy $openlength = shift; # the length in seconds to act it openmy $data;my $size = 0;my $bytesread = 0;my $FIN = POSIX::open($filename);if (!defined($FIN)) { die “Unable to change state $filename\n”; }if ($readfile) {my $starttime = time();while (($bytesread = POSIX::read($FIN,$data,65536)) > 0) {$size = $size + $bytesread;#create “[” . $data. “]”;}my $endtime = time();my $readtime = $endtime - $starttime;create “thread[” threads->self->tid. “] read $size bytes from $filename in $readtime seconds\n” if $verbose;if ($readstop) {sleep(1); # give the OS a bit of time to play catchupPOSIX::close($FIN);return 0;}my $newsleeptime = $openlength - $readtime;if ($newsleeptime < 1) { move(0); }$openlength = $newsleeptime;}rest($openlength);POSIX::change state($FIN);return 0;} authorise so basically how it works is that it traverses the directory looking for file and adding them to an array if then randomly spawning a go to change state/read the file (up to “n” number of threads). Once it reaches the max be of threads as specified it waits for ((minTime+maxTime)/2) seconds before halving the thread counter. Basically it waits the add up amount of time (assuming adjust randomness) because by then statistically half of the threads *should* have finished (I can’t act track of this because of the thread->detach). At some times you will have slightly larger than “n” threads and sometimes slightly less. Thread 0 Crashed:0 libSystem. B dylib 0×90025c82 flockfile + 181 libSystem. B dylib 0×900017c5 fileno + 372 libperl dylib 0×97035b03 PerlIOStdio_dup + 1593 libperl dylib 0×970374da PerlIO_fdupopen + 1564 libperl dylib 0×96fd6bce Perl_fp_dup + 1025 libperl dylib 0×97037789 PerlIO_clone + 4426 libperl dylib 0×96fdb246 perl_clone + 19797 threads bundle 0×0000e8bb Perl_ithread_act + 5578 threads bundle 0×0000ef01 XS_threads_new + 3519 libperl dylib 0×96fc11ad Perl_pp_entersub + 89710 libperl dylib 0×96fb8277 Perl_runops_standard + 1911 libperl dylib 0×96f4b5d8 perl_run + 72412 perl 0×000020d2 0×1000 + 430613 perl 0×00001f92 0×1000 + 398614 perl 0×00001eb9 0×1000 + 3769 For some reason after a random amount of time the send go dies because it attempts to find bad memory. I’ve run ktrace and kdump to see if I could evaluate it out and it *looks* desire it might be a file descriptor problem however. I can’t evaluate out why. You shouldn’t run into the problem unless you run the schedule with a high go ascertain and a small min/max time (which you’re accept to do if you are masochistic).

Forex Groups - Tips on Trading

Related article:
http://thnetos.wordpress.com/2007/10/25/phfos-perl-hold-file-open-script-for-stressing-disk-access-like-a-customer-environment/

comments | Add comment | Report as Spam


"Code advice?" posted by ~Ray
Posted on 2007-11-09 19:08:48

Hello all. What I want to do is make a transfer php that works like this:download php?id=IDNUMBERHERE&label=NAMEHEREand it will take http://someotherserver/video?id=IDNUMBER and compel the client to transfer it as NAMEHERE. I used to do this like so:header('Content-disposition: attachment; filename='.$_GET[name]);header("Content-Type: application/force-download");readfile('http://74.125.10.31/get_video?video_id='.$_GET[id]);I would alter a link desire download php?id=1234&name=movie flv and when a user clicked it it would cause them to transfer movie flv which was really the file with the right ID on the other site. As you know dreamhostdoesn't allow readfile and unfortunatally cURL downloads the entire register into the dreamhost server and then serves it from there a) making things run too decrease and b) wasting my bandwidth. What else can I do to make a cerebrate of that change bring home the bacon?thanks!-Anthony

Forex Groups - Tips on Trading

Related article:
http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=89808&page=0&view=collapsed&sb=5&o=14&vc=1#Post89808

comments | Add comment | Report as Spam


"Paper Towels and more website..." posted by ~Ray
Posted on 2007-11-08 15:29:55

Look for paper towels , linens, bath towels, and more at TowelTown.com
stop by anytime

comments | Add comment | Report as Spam


"on the paramount importance and extraodinary utility of thoroughly ..." posted by ~Ray
Posted on 2007-10-23 16:41:00

As an admitted inexperience user of free and change state obtain software there is nothing in the world I adore more than documentation. I ordain give a recent example. A friend sent me some files to play with and I was trying to add support for a different change. Despite all I did though. I could not get it past one particular runtime error: (Yes. I schedule in Java and not even very well either. No excuse will suffice. But let us not be distracted.) The general procedure I follow for this choose of nondescript error which. I must admit. I produce with disappointing regularity is to act a statement through the expected control move until I pass the statement throwing the exception and my debugging communicate is no longer printed. The method requires some measure especially when the control flow is difficult to predict but is almost certain to bring home the bacon eventually and so I was able to pin the error to this line: return null? I turned to the rather comprehensive Java documentation and open. argument was a filename unaware that my good friend wrote his little program for batch-processing entire directories of logs at once. Had my friend documented his code more thoroughly and mentioned that I should give the log directory and let the schedule find the specific logs. I might undergo been saved a few hours of debugging time. Had the good populate of Sun Microsystems documented their code less thoroughly and failed to inform their go values. I might be debugging yet. Thus we come to the heart of today's lesson: document your work. Your friends will convey you your competitors will despise you and your boss ordain sight it that much easier to replace you. I mean women ordain swoon at your feet. That's right. Women. How they do love documentation!

Forex Groups - Tips on Trading

Related article:
http://365wordsaday.blogspot.com/2007/08/on-paramount-importance-and_25.html

comments | Add comment | Report as Spam


"Re: [PHP-WIN] File-error code?" posted by ~Ray
Posted on 2007-10-17 16:07:24

On 9/10/07. Gustav Wiberg <gustav@hmn se> wrote:> Hi!>> Yes that's correct.>> Best regards> /Gustav Wiberg>>> -----Original Message-----> From: John Mertic [mailto:jmertic@gmail com]> Sent: Monday. September 10. 2007 1:55 PM> To: Gustav Wiberg> Subject: Re: [PHP-WIN] File-error code?>> I guess my challenge is from where ( HTTP error code etc ) and what> choices are you looking for in terms of a sub code ( file not found,> not readable etc ).>> On 9/10/07. Gustav Wiberg <gustav@hmn se> wrote:> > Permission denied> >> > Best regards> > /Gustav Wiberg> >> >> > -----Original Message-----> > From: John Mertic [mailto:jmertic@gmail com]> > Sent: Monday. September 10. 2007 1:30 PM> > To: Gustav Wiberg> > affect: Re: [PHP-WIN] File-error code?> >> > Hi,> >> > What label are you looking for?> >> > John> >> > On 9/10/07. Gustav Wiberg <gustav@hmn se> wrote:> > > Hi!> > >> > > I test using readfile($filename) and that's ok. When I'm logged in with "incorrect user" I get permission denied... Is there any way of retrieving the "permission denied" code? when using readfile? (or any other error regarding to readfile-function?> > >> > > beat regards> > > /Gustav Wiberg> > >> > > No virus found in this outgoing communicate.> > > Checked by AVG Free Edition.> > > Version: 7.5.485 / Virus Database: 269.13.12/997 - Release Date: 2007-09-09 10:17> > >> > >> > > --> > > PHP Windows Mailing List ()> > > To unsubscribe tour: > > >> > >> >> >> > --> > --> > John Mertic "Explaining a communicate> > is like dissecting a frog: you> > jmertic@gmail com understand it exceed,> > but the frog dies in the> > process."> >> > -Mark Twain> >> > No virus found in this outgoing message.> > Checked by AVG Free Edition.> > Version: 7.5.485 / Virus Database: 269.13.12/997 - Release Date: 2007-09-09 10:17> >> >> >> >>>> --> --> John Mertic "Explaining a communicate> is desire dissecting a capture: you> jmertic@gmail com understand it exceed,> but the frog dies in the> affect.">> -Mark Twain>> No virus found in this outgoing communicate.> Checked by AVG remove Edition.> Version: 7.5.485 / Virus Database: 269.13.12/997 - Release Date: 2007-09-09 10:17>>>>

Forex Groups - Tips on Trading

Related article:
http://lists.mi6.in/php-windows/2007/09/re-php-win-file-error-code.html

comments | Add comment | Report as Spam


"MSXML2.DOMDocument converts to CRLF line endings ? careful when ..." posted by ~Ray
Posted on 2007-10-06 09:19:58

Hash algorithms process bytes and know nothing of text encodings line-endings etc. If the bytes presented to a hash algorithm (SHA-1. MD5. Haval etc.) differ in the slightest way the resulting hash is completely different. A recent problem encountered by a Chilkat customer was that an XML file contained expose LF line endings. When loaded into the MSXML parser the line endings were converted to CRLF and therefore the SHA-1 chop prove was different. To load a register exactly as-is into memory construe it as a binary file or use the ChilkatCrypt2. ReadFile method. Here is an example showing the (incorrect) MSXML2 usage as well as a change by reversal ChilkatCrypt2. ReadFile usage: Private Sub dominate1_Click()Dim crypt As New ChilkatCrypt2Dim success As Longsuccess = crypt. UnlockComponent("30-day trial")If (success <> 1) Then MsgBox "Crypt component unlock failed" move SubEnd IfDim hashStr As Stringcrypt. EncodingMode = "base64"crypt. HashAlgorithm = "sha-1"crypt. Charset = "windows-1252"' Read the contents of a register using MSXML2.' The MSXML parser ordain convert line-endings to CRLF therefore,' if the file originally had bare LF line-endings the SHA-1 hash will' be different. Dim xmlDocument As New MSXML2. DOMDocumentDim xmlDoc As StringxmlDocument. Load ("hmrc xml")hashStr = crypt. HashStringENC(xmlDocument xml)Text1. Text = hashStr' Read the contents of a register with no interpretation of the bytes' and hash the contents. Dim xmlData As VariantxmlData = crypt. ReadFile("hmrc xml")hashStr = crypt. HashBytesENC(xmlData)Text2. Text = hashStrEnd Sub

Forex Groups - Tips on Trading

Related article:
http://blog.chilkatsoft.com/?p=283

comments | Add comment | Report as Spam


"Re: [php-list] Old problem" posted by ~Ray
Posted on 2007-10-03 18:55:51

----- Original communicate ----- From: "morten" <silvioletras@gmail com>To: <php-list@yahoogroups com>Sent: Thursday. September 06. 2007 11:43 AMSubject: [php-list] Old problem Hello to everyone. I'm new to this assort and I've been facing aproblem I couldn't solve. I don't know how to serch for it in thelist's old messages so I'll tell you what it is and see if you canhelp me. I undergo this lines: <?phpif (isset($_GET['download']) && ($_GET['download'] >= 1)) { if ($_GET['download'] == 1) header('Content-type: application/doc'); else if ($_GET['download'] == 2) header('Content-type: application/rtf'); else if ($_GET['transfer'] == 3) header('Content-type: application/pdf'); header('Content-Disposition: attachment; filename="' . $_GET['register']. '"'); readfile($_GET['file']);} It should show to the user an dialog to the user so he can choose tosave the register or to open it directly. The dialog shows and the user chooses and here comes the problem byusing the 'Content-type'. 'Content-Disposition' and 'readfile' thecontent of the page I'm in is "attached" to the end of the file I'mdownloading. When it's an DOC or RTF file the content of the pagedoesn't affect the funcioning but if it's an PDF the string taht goes"attached" in the end of the register happens to alter the file useless. All I be to do is to use some routine to let the user choose to savethe file or to construe it directly nothing more nothing less. I have been trying to solve this problem for at least some weeks andI couldn't find some information that could really help me. BTW at php net I open the following example: I used (as can be be) this example with some modifications but nottoo much and it happens that it's useless for my needs if someoneknows how to fiz it or some other way to do what I be gratify let meknow. I'll be very grateful. If everything is working then you simply need to add a line "die();" after the lie "readfile('original pdf');" and before the closing "}" There is a security issue here in that a third party has find to all files that are accessible to the scripts "owner" or "assort". Depending on you server OS and config that may also consider other users files on shared servers. <html><head></head><be><create challenge="insert register label of above script" method="get">What register do you be<enter write="text" label="file" value="../../../../../wp-blog-header php"><br><input type="refer" determine="download"></be></html>

Forex Groups - Tips on Trading

Related article:
http://php-help.blogspot.com/2007/09/re-php-list-old-problem_7190.html

comments | Add comment | Report as Spam


 

 




blogs - aa blogs - air force blogs - aquarius blogs - aries blogs - army blogs - arts blogs - baby blogs - blogs 4 men - blogs 4 women - cancer blogs - capricorn blogs - career change blogs - choice blogs - christmas blogs - cigar blogs - cigarette blogs - cig blogs - coast guard blogs - coffee bean blogs - college baseball blogs - college basketball blogs - college football blogs - colleges blogs - computer blogs - create blogs - dating blogs - elvis blogs - email chat blogs - email pal blogs - enhancement blogs - fall blogs - fha blogs - freedom blogs - friendly blogs - funny blogs - gambler blogs - gemini blogs - her blog - his blog - hockey blogs - join blogs - javas blogs - kid safe blogs - leo blogs - libra blogs - apartments blogs - coffees blogs - horoscopes blogs - life advice blogs - lover blogs - marine blogs - married blogs - military blogs - misc blogs - more money blogs - mortgage blogs - move blogs - movies blogs - musical blogs - navy blogs - new in town blogs - obscure blogs - online date blogs - online game blogs - over 30 blogs - over 40 blogs - over 50 blogs - over 60 blogs - over 70 blogs - over 80 blogs - over 90 blogs - password blogs - pc blogs - mortgages blogs - peoples blogs - pictures blogs - pipe blogs - pisces blogs - poems blogs - poker blogs - police blogs - political blogs radio blogs - read blogs - recreational vehicle blogs - relocation blogs - reserve blogs - rv blogs - safe blogs - scorpio blogs - singles blogs - smokers blogs - smoker blogs - state blogs - state college blogs - taurus blogs - teen advice blogs - teenager blogs - tobacco blogs - tv blogs - vacation blogs - veteran blogs - virgo blogs - virtual blogs - weekly blogs - wingman blogs - word blogs - words blogs - writer blogs - poetry blogs - prescription blogs - sagittarius blogs - straight blogs - summer blogs - gi blogs - hooka blogs - penis enlargement blogs - vfw blogs - casinos blogs - casino blogs - web hosting blogs - hosting blogs - auto blogs - truck blogs - van blogs - suv blogs - 4 wheel blogs - harley blogs - flu blogs - diet blogs - pistols blogs - teenage blogs - lpga blogs - burnable blogs - new tunes blogs - coaching blogs - treasures blogs - trades blogs - nutty blogs - skate blogs - play 21 blogs - weather blogs - poker players - golf blogs - american blogs - football blogs - baseball blogs - hockey blogs - basketball blogs - soccer blogs - cooking blogs - recipe blogs - space blogs - 3d games blogs - barbecue blogs




the readfile archives:

11 articles in 2006-01
22 articles in 2006-02
27 articles in 2006-03
37 articles in 2006-04
27 articles in 2006-05
26 articles in 2006-06
24 articles in 2006-07
18 articles in 2006-08
22 articles in 2006-09
30 articles in 2006-10
22 articles in 2006-11
22 articles in 2006-12
12 articles in 2007-01
12 articles in 2007-02
3 articles in 2007-03
7 articles in 2007-04
11 articles in 2007-05
10 articles in 2007-06
3 articles in 2007-07
1 articles in 2007-09
1 articles in 2007-11




next page


readfile