nonethefewer: (Default)
In PHP, I have the script down enough to where it can check particular files in all particular subdirectories.  I can even open the files, and walk through each of the lines in the file.  Furtherly, I can even get two of the three lines that I need.

I need this third line, and it's bugging me, because the third line is two lines after a particular line.  Basically, I'm getting the company name from a .tex file, which is always two lines after the "\today" line.  It's not consistently at the same line in the file; later versions of these .tex files have changed headers.  But it's always, to my knowledge, two lines after "\today".

How the &%(* do I get that?

--

[eta] Ut, never mind, found it.

Originally posted on Dreamwidth.  Number of comments so far:
nonethefewer: (Default)
Newer Mediawiki versions have the page Special:LinkSearch.  This searches for all links that start with whatever you type in.  Except, you still can't list them all at once.

To change this, edit $mw/includes/specials/SpecialLinkSearch.php, around line 102:

if (preg_match('/^(:?[0-9]{1,3}\.)+\*\s*$|^(:?[0-9]{1,3}\.){3}[0-9]{1,3}:[0-9]*\*\s*$/', $query) || $query == "*") {

The or bit is what matters there.

Originally posted on Dreamwidth.  Number of comments so far: comment count unavailable
nonethefewer: (Default)
Stupid question time.

PHP/MySQL.  I have this line:

mysql_query("INSERT IGNORE INTO table SELECT * FROM othertbl") or die(mysql_error());

When I run this elsewhere (phpMyAdmin, command line, mysql prompt), I get an indication of how many rows were changed.

How can I capture that in PHP, for writing to elsewhere?

Originally posted on Dreamwidth.  Number of comments so far: comment count unavailable
nonethefewer: (Default)
Stupid question time.

PHP/MySQL.  I have this line:

mysql_query("INSERT IGNORE INTO table SELECT * FROM othertbl") or die(mysql_error());

When I run this elsewhere (phpMyAdmin, command line, mysql prompt), I get an indication of how many rows were changed.

How can I capture that in PHP, for writing to elsewhere?
nonethefewer: (Default)
A fuller thing from yesterday's post re PHP/MySQL.

The steps, laid out. )

So, it's probably that the data's being exported from type bit to type boolean for some daft reason, and MySQL is all like, "I'm taking in tinyint, what's this boolean bullshit?", and setting it to 0, because that's the default value.

It's still bloody annoying that command line works but PHP doesn't, on the same file.

Oh well.  I put cast(the_column as int) as the_column in the query for the package; that should help.

--

[eta] Except that didn't change a goddamn thing.  Motherfuck.  FINE.  LINE BY LINE IT IS, ASSHOLES.

Originally posted on Dreamwidth.  Number of comments so far: comment count unavailable
nonethefewer: (Default)
A fuller thing from yesterday's post re PHP/MySQL.

The steps, laid out. )

So, it's probably that the data's being exported from type bit to type boolean for some daft reason, and MySQL is all like, "I'm taking in tinyint, what's this boolean bullshit?", and setting it to 0, because that's the default value.

It's still bloody annoying that command line works but PHP doesn't, on the same file.

Oh well.  I put cast(the_column as int) as the_column in the query for the package; that should help.

--

[eta] Except that didn't change a goddamn thing.  Motherfuck.  FINE.  LINE BY LINE IT IS, ASSHOLES.
nonethefewer: (Default)
PHP/MySQL question.

There is a tab-separated file that contains, among other things, true/false values.

I run this from the command line:

mysqlimport -v --fields-terminated-by='\t' --fields-optionally-enclosed-by="'" --lines-terminated-by='\n' --user=user --password=password dbname filename.csv

The true/false values are updated fine.

I do the exact same damn thing from PHP, and all true/false columns are set to false.

What gives?

[eta] Same if I run this in PHP:

mysql_query("LOAD DATA INFILE '$file' INTO TABLE table_name FIELDS TERMINATED BY '\t' ENCLOSED BY \"'\" LINES TERMINATED BY '\n'");

WRYYYYYYYy

Originally posted on Dreamwidth.  Number of comments so far: comment count unavailable
nonethefewer: (Default)
PHP/MySQL question.

There is a tab-separated file that contains, among other things, true/false values.

I run this from the command line:

mysqlimport -v --fields-terminated-by='\t' --fields-optionally-enclosed-by="'" --lines-terminated-by='\n' --user=user --password=password dbname filename.csv

The true/false values are updated fine.

I do the exact same damn thing from PHP, and all true/false columns are set to false.

What gives?

[eta] Same if I run this in PHP:

mysql_query("LOAD DATA INFILE '$file' INTO TABLE table_name FIELDS TERMINATED BY '\t' ENCLOSED BY \"'\" LINES TERMINATED BY '\n'");

WRYYYYYYYy
nonethefewer: (Default)
Am I in fact completely missing something, or does PHP's opendir() function not have any native way of sorting files?

If the latter, why?‽

Originally posted on Dreamwidth.
nonethefewer: (Default)
Am I in fact completely missing something, or does PHP's opendir() function not have any native way of sorting files?

If the latter, why?‽

And again.

Apr. 5th, 2010 01:55 pm
nonethefewer: (Default)
There's this script.

Part of it:

$command = "cp " . $topLevelDir . $invoiceDir . $invoicePrefix . "*tiffg3 " . $collDir;
exec($command, $errmsg);


So the command, written out, would be:

cp /var/www/html/sitefolder/invoices/site_invoices2009-09-11/15551112345_12345-12*tiffg3 /var/www/html/sitefolder/invoices/collections2010-04-05/

When I run that at the command line:

cp: cannot create regular file `/var/www/html/sitefolder/invoices/collections2010-04-05/15551112345_12345-12.001.tiffg3': Permission denied

* The collections* folder is owned by apache, and has 775 permissions.
* The site_invoices* folder is owned by apache, and has 775 permissions.
* The *.tiffg3 file is owned by apache, and has 644 permissions.

The oddest thing is, the very next command does the same damn thing, only with the *.pdf file, and that works perfectly.

(And it's not always for all files...?  This script is so weird.)


How would I go about ensuring that the webpage has permissions to copy files?

Originally posted on Dreamwidth.

And again.

Apr. 5th, 2010 01:55 pm
nonethefewer: (Default)
There's this script.

Part of it:

$command = "cp " . $topLevelDir . $invoiceDir . $invoicePrefix . "*tiffg3 " . $collDir;
exec($command, $errmsg);


So the command, written out, would be:

cp /var/www/html/sitefolder/invoices/site_invoices2009-09-11/15551112345_12345-12*tiffg3 /var/www/html/sitefolder/invoices/collections2010-04-05/

When I run that at the command line:

cp: cannot create regular file `/var/www/html/sitefolder/invoices/collections2010-04-05/15551112345_12345-12.001.tiffg3': Permission denied

* The collections* folder is owned by apache, and has 775 permissions.
* The site_invoices* folder is owned by apache, and has 775 permissions.
* The *.tiffg3 file is owned by apache, and has 644 permissions.

The oddest thing is, the very next command does the same damn thing, only with the *.pdf file, and that works perfectly.

(And it's not always for all files...?  This script is so weird.)


How would I go about ensuring that the webpage has permissions to copy files?
nonethefewer: (Default)
Herp, party of derp. )

It'd help if I didn't close the connection between one query and the next, huh.
nonethefewer: (Default)
Herp, party of derp. )

It'd help if I didn't close the connection between one query and the next, huh.
nonethefewer: (Default)
I have an ignorant question.

The end result here is an automatically generated image that contains text*.  I can do this easily in PHP.  However, the web server does not have PHP installed, and the IT person is underinterested in installing it.  Fair enough.

My workstation has PHP installed and happy.  My computer is Windows 7; the server is Windows 2003 Server.

Is it possible for WebComp to have a webpage that points to \\WorkStation\image.png?

I spectacularly doubt it, but I figured I'd ask.

Alternately, how can I make a text-based image in ASP or JS or something?

* It's a list of links, that the boss wants in image form.  Don't ask.
nonethefewer: (Default)
Arr.  I wish I knew more about PHP.

I have a PHP page that makes things for me, based on certain values I've set.  At the end of the page, I want to include an image, generated by PHP.

I have the image generation page down pat.  I can have it included into the bottom of the page.  All of that is fine.

However, I want to pass variables to the image file.  (makeimg.php - I am very original.)  Specifically, I want to send a filename, the foreground colour, and the background colour.  These are set on the create.php page, so.

How do I do that?
nonethefewer: (Default)
Is there a page, compares basic PHP / VB / Javascript functions?

Looking for indexOf or inStr or strpos or whateverthefuck == frustrating.
nonethefewer: (Default)
I have a select box.

<SELECT NAME="items" MULTIPLE>
  <OPTION VALUE=1>Candy</OPTION>
  <OPTION VALUE=2>Gravy</OPTION>
  <OPTION VALUE=3>Fruit</OPTION>


Method is GET.  Selecting two of them results in this URL:

[blahblahblah]\search.php?items=1&items=3

How do I use PHP to grab each of those 'items' values and put 'em in an array?
nonethefewer: (Default)
* As always, I learn best through having projects.  I'm doing a bunch of tinkering to get this one website to do my bidding, so I'm learning a ton of PHP in the meantime.  This article on basic PHP security things seems not ungood, but it's from 2003, so I want to find something better.  (I need to, for example, block against SQL-based suck in the URL query string, this I know.)

If you have good links on basic-cat PHP (with MySQL) security things, this is the place for 'em.  Even if it's dirt-simple - I'm not an idiot, but I am a scatterbrain, and reminders are good.  Not to mention the part where I'm newish to PHP anyhow.

[eta] Fuck, I'm going to have to learn regex again.  *annoyed*

* My arms got betterish over the weekend, but they're starting to twinge, which means there's something about my work setup that's sub-par.  Alas.  It's probably the arms on this goddamn chair.  I'm trying to space typing out anyhow, just to be thorough, and I'm still not signed onto AIM.

* Part of yesterday was going to a friend's house for grilling.  Her roommate has the gardening bug, so she was raking and setting up a compost pile and digging a fire pit and so and so and so forth.  I wish I didn't kill plants through inattention, I would love to get a bit into container gardening - find some easy-to-grow vegetable that I like, and make that go.  Not necessarily for cooking, mostly just for the occasional munching-on.

I dunno, maybe if I set up reminders for watering...  *sad face*  This is why my loving kitties totally works - there's no set schedule of kitty-care.

* Blogspot has, by far, the shittiest commenting system known to thinking creatures.  Fucking hell.  And you'd think that with that in mind, third-party commenting systems (Disqus, IntenseDebate, Haloscan) would have, I dunno, options for importing Blogger comments.  And yet.  Fuckers.
nonethefewer: (Default)
* As always, I learn best through having projects.  I'm doing a bunch of tinkering to get this one website to do my bidding, so I'm learning a ton of PHP in the meantime.  This article on basic PHP security things seems not ungood, but it's from 2003, so I want to find something better.  (I need to, for example, block against SQL-based suck in the URL query string, this I know.)

If you have good links on basic-cat PHP (with MySQL) security things, this is the place for 'em.  Even if it's dirt-simple - I'm not an idiot, but I am a scatterbrain, and reminders are good.  Not to mention the part where I'm newish to PHP anyhow.

[eta] Fuck, I'm going to have to learn regex again.  *annoyed*

* My arms got betterish over the weekend, but they're starting to twinge, which means there's something about my work setup that's sub-par.  Alas.  It's probably the arms on this goddamn chair.  I'm trying to space typing out anyhow, just to be thorough, and I'm still not signed onto AIM.

* Part of yesterday was going to a friend's house for grilling.  Her roommate has the gardening bug, so she was raking and setting up a compost pile and digging a fire pit and so and so and so forth.  I wish I didn't kill plants through inattention, I would love to get a bit into container gardening - find some easy-to-grow vegetable that I like, and make that go.  Not necessarily for cooking, mostly just for the occasional munching-on.

I dunno, maybe if I set up reminders for watering...  *sad face*  This is why my loving kitties totally works - there's no set schedule of kitty-care.

* Blogspot has, by far, the shittiest commenting system known to thinking creatures.  Fucking hell.  And you'd think that with that in mind, third-party commenting systems (Disqus, IntenseDebate, Haloscan) would have, I dunno, options for importing Blogger comments.  And yet.  Fuckers.
Page generated Aug. 7th, 2025 02:41 am
Powered by Dreamwidth Studios