~ overflow ~

Notes

How to scroll on a bash screen

by z3n on May.25, 2010, under Notes, Tips & Hints

Problem:

It’s so cool to have many screens at bash, but i never figured out how to scroll up on them, somehow i never looked after as well.

Solution:

CTRL + A -> ESC -> PAGE UP / PAGE DOWN

Source:

SaltyCrane

Leave a Comment :, , , , more...

Note about uploading multibyte filename files (japanese filenames)

by z3n on Apr.20, 2010, under Notes

Uploading multibyte filenames files is a issue, it depends of the origin and destination OS support and not only that but majority of the program you are uploading from. Usually i use smartftp, however, it really sucks on that matter, it simply ruins the encodings.

Use FILEZILLA instead. Don’t even try to move , rename or touch multibyte files with smartftp!

Leave a Comment :, , , , , more...

Javascript Const Note

by z3n on Apr.13, 2010, under Notes

In order to keep my code clean i wrote a javascript with const variable declarations, those were constants anyway and there were no reason to declare them as var, right?

Wrong, big mistake, IE don’t support consts right, turns out it gives javascripts errors (on the wrong position, of course), i will not even go deep into this, cuz it will just turn into more shit, so i’m just replacing const per var;

So, note to self, never use consts on javascript.

Leave a Comment :, , , more...

Fatal error: Cannot use object of type stdClass as array (php json_decode)

by z3n on Feb.17, 2010, under Coding, Notes, Tips & Hints

Problem:

$var=json_decode($_POST['something']);

echo $var['value'];

returns error: Fatal error: Cannot use object of type stdClass as array

Solution:

echo $var->value;

2 Comments :, , , , more...

Zend Optimizer download links

by z3n on Dec.25, 2009, under Linux Happyness, Notes

Problem:

Zend requires registration in order to dowload the free optimizer, it’s annoying and you keep receiving spam.

Solution:

http://downloads.zend.com/optimizer/3.3.3/ZendOptimizer-3.3.3-linux-glibc23-x86_64.tar.gz (linux 64-bit)
http://downloads.zend.com/optimizer/3.3.3/ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz (linux 32-bit)

neat.

Leave a Comment :, , , more...

variable Object MSSQL note

by z3n on Sep.25, 2009, under Notes

Problem:

return $res->Fields['field_name']->Value;

returns `variable Object`

Solution:

return intval($res->Fields['field_name']->Value);

Explanation:

There’s no explanation, this is one of those issues that happens when you deal with microsoft. Sometimes when doing a query it returns the actual value, other times it just return into a different variable type, which needs to be converted. Good thing if you caught it before writing a more complex code and then finally dealing with crypt errors :)

Bonus:

I’ve been getting some more issues even when using this conversion, things like “Object of class variant could not be converted to string php“, this happens on null values, in order to fix i been searching around and found this, which with some changes it will be better like:

  1.   for ($col=array(),$i=0,$j=$ms_res->Fields->Count();$i < $j;$i++) {
  2.    try {
  3.     $value=$ms_res->Fields[$i]->Value;
  4.     if (trim($value) != "") {
  5.      if (gettype($value) !== 'string') {
  6.       if (settype($value,"string")) {
  7.        $col[$ms_res->Fields[$i]->Name]=$value;
  8.       }
  9.      } else {
  10.       $col[$ms_res->Fields[$i]->Name]=$value;
  11.      }
  12.     } else {
  13.      $col[$ms_res->Fields[$i]->Name]='NULL';
  14.     }
  15.    } catch (exception $e) {
  16.     _r("Exception: ".$e);
  17.    }
  18.   }

..and yes you will figure out the missing functions/vars.

Leave a Comment :, , , , , more...

Filename vs Folder Linux ext2 Note

by z3n on Sep.15, 2009, under Notes, Tips & Hints

No, you can’t have a filename and a folder with the same name on the same folder.

For example:

/path/to/happy

/path/to/happy/

Will not work. If happy is a regular file and you try to create a folder called happy (and vice-versa) at ‘/path/to’ you will fail.

Note that this amazingly works on windows.

Leave a Comment :, , more...

Microsoft SQL+IIS Migration

by z3n on Sep.04, 2009, under Notes, Tips & Hints

Problem:

Migrate a SQL 2000 DB to a 2005 Server and IIS 6.0 to IIS 7.0.

Extra Issues:

- SQL2000 is full of procedures, views and identity tables (+200 each)
- Coder who built tables/procedures was lame, so there might be NULL values where it shouldn’t among with other things, like STRINGs being converted to DATE, INT, etc.
- Also includes lame asp coding.
- CRYPT MICROSOFT ERRORS (CRITICAL)

More Problems:

I don’t know why people still using microsoft, everything is against it. Not only the OS, but everything (ASP, SQL, VB, IE, Office, etc) related to microsoft is bad.

When you start to get those `error: XXXXXXXXX` like you know you’re screwed, why:

- Error codes aren’t clear and used by many different instances.. guess what, none of them will fit your issue;
- Microsoft KB isen’t accurate;
- Sometimes, Microsoft KB might present you the right answer, but it will be the last one on a list of 10 possible solutions, since they don’t have much control on the crypt errors themselfs, no wonder;
- Microsoft KB likes to do inaccurate automatic translations of the content (if your not english native), meaning that, if you eventually forgot that, you will be lead to another issue caused by the automatic translation.
- MSSQL don’t have `limit x` on delete/update queries, unless you do a huge workaround that will lead to more issues.
- IIS complies with MSSQL, also showing crypt errors, making the debugging impossible for non-computer beings (eg.: you).
- IIS crypt errors can be more funny when it simple shows `Bad Request`  or `Application Error` and NOTHING ELSE.
- IIS likes to get stuck, if you try to restart/stop/start/recicle a service that takes too much time to happen, IIS manager simply shows a message `Service not responding` and abort the operation, sometimes it abort the operation and a few minutes later it happens, other times it just don’t happen and/or get stuck then you need to reboot;
- Copying database straight from the 2000 server to a local 2005 server gives the following error: `Error, please check your log`; Checking `your log` gives lots, lots of crypt non-sense errors in my native language, guess what? 0 results on google.
- The error above takes 30 minutes to happen, nothing is copied, but there’s a 300mb .mdb file.
- If you do a `SCRIPT DATABASE` you will not get the whole data or/and tables will not have identity columns or/and some data may be corrupted (even deatched);
- If you do a `IMPORT/EXPORT` procedure, you will fall on the VERY SAME problems above, but now you may also get timeout crypt message;
- You can only edit top 300 lines on MSSMS, sorted by MSSMS’ will;
- [db_name].[dbo].[tbl_name] will not appear on the automatic generated scripts, but if you forget to add it your script will miserabily fail with a non-crypt error message (first time) — that only happens if you use MSSMS;
- Can’t stand that green circle looping;
- MSSMS 2005 and 2008 are about the same, meaning you will have the same errors, so don’t even try to update;
- SQL2005 SP3 must be installed before anything, unless you want to fall on unsolved crypt errors, leading to nothingness;
- You can also amazingly fall into crypt errors with ALSO typing errors like `erro XXXXXXXXX`;
- Screaming to the skies and throwing things around will not help;
- Reinstalling SQL Server will not help;
- Reinstalling SQL Server with latest SP will not help;
- Reinstalling OS will not help;
- Reinstalling OS with latest SP will not help;
- Reinstalling <Microsoft Software> with <Any Condition> will not help;
- IIS will not forgive and forget any `;` you put on a asp page, too bad for mainly php coders (eg.: me);
- IIS is for Apache as IE is for Firefox (is this understandable in english? don’t think so);

Another Complaint:

The triumph of a bad software can’t be explained for me, I can’t also understand why they made so much money on something that simply dosen’t work. Maybe users like
things that don’t work? Maybe there’s something magic on crypt errors and blue screens? Maybe Microsoft is paying developers to use their languages and/or software?

Solution:

After several days, tries and lots of time lost I was able to do the migration using MSSQL Enterprise 2005 SP3, the Developer, Express, SQL 2008, SP1 and SP2 gave me crypt errors when copying the database, nothing related to installing the latest SP was on the KB.
Note that i installed ALL versions to try. Thanks microsoft for such great support and programs, looking forward to support the selling of pirated microsoft dvds on streets.

Solution 2:

Move to LAMP, please.

Leave a Comment :, , , , , , more...

MS SQL 2005 Express per Instance Config Note

by z3n on Sep.02, 2009, under Notes

Problem:

How to run more than one ms sql server version in the same machine?

How to change authentication to MIXED MODE without reinstalling the whole thing?

Solution:

Install with different instances. To connect you will use .\INSTANCENAME or SERVERNAME\INSTANCENAME

To change the authentication method, you need to edit the registry, no wonder it’s another obscure cryptic thing:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer]
“LoginMode”=dword:00000002

dword 1 means windows authentication, while 2 is the mixed mode, just change it and restart the server.

This key is for MS SQL 2005 EXPRESS.

Leave a Comment :, , , , more...

Apache Setup Note

by z3n on Sep.01, 2009, under Notes, Tips & Hints

Problem:

403 / forbidden on any file, even if the permissions and user / group are right.

Solution:

First check httpd.conf to see if the User and Group statements are compatible with the user you’re trying to access.

“No, you can’t add root there, you idiot.”

After that make sure that the folder /home/<username> is actually owned by the same user and group (or same/lower rights) of the user you’re running apache with.

To make sure you should restart apache completly.

“httpd -k stop;httpd -k start”


Leave a Comment :, , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!