xtina: (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:
xtina: (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.
xtina: (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
xtina: (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.
xtina: (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
xtina: (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?
xtina: (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
xtina: (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.
xtina: (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
xtina: (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
xtina: (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.
xtina: (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?‽
xtina: (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.
xtina: (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?
xtina: (Default)
Herp, party of derp. )

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

It'd help if I didn't close the connection between one query and the next, huh.
xtina: (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.
xtina: (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.
xtina: (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?
xtina: (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?

June 2017

S M T W T F S
    123
45678 910
11121314151617
18192021222324
252627282930 

Most Popular Tags

Style Credit

Page generated 2017-06-22 12:12
Powered by Dreamwidth Studios