miércoles, 21 de octubre de 2009

Media Center for Windows 7 gets NETFLIX OFFICIALY !

at last !

What I had been wating for an official netflix for WMC !

Early on today I was going to watch some netflix, however yesterday I was looking at some stuff on internet tv ( part of WMC ), so I wanted to show it to my wife.

When I opened it, it started downloading again, I said weird an update I just installed it 2 days ago, so I let it go.

and then SURPRISE, InternetTV has a complete new look and the SO much expected WMC netflix plugin !! WOOT !!!!!!!!!




Windows 7 WMC

It seems to have everything, and it acually looks like the old netflixplugin
however it is fully embedded and starts the movies in full screen !


WMC NATIVE NETFLIX WINDOWS 7


So after months and months of waitng here it is !

BTW, I am using the RTM ( build 7600) no idea if this is in the beta, I guess it is :)

have fun !


martes, 20 de octubre de 2009

PHP some more !

today I had a small yet interesting chore to do on PHP...

again with charsets, anyhow I needed to find a specific UTF-8 char on any given string.

I don't play that much with UTF characters however ( this might be public knowledge , well it is , but I did not know it )

ok it seems every UTF 8 character is 3 characters in one... so when you want to analize it you have to analize the 3 characters separately to get a final response.

so a UTF character enters to the PHP script like this: %E2%95%90
and it becomes inside the PHP E2 95 90 so the string contains E2 95 90 :)

so then I wanted to filter out characters like this so I made a small conversion of the first character to decimal

E2=226

so I did this check against he variable:

$val = $_GET['text'];
if( strpos ( $val , chr(226) ) !== false )
{// stuff}


So after looking at many UTF functions out there, this was the best option based on performance and whatnot...

I don't think it would be valid for all types of UTF encoding and there are UTF functions in PHP but sometimes they are just too big do to something small

I know I could have used the E2 directly but I am the kind of nerd that likes to use the dec notation :)

anyhow that is usefull.

=)

viernes, 27 de marzo de 2009

Green Segunda vida

Green Segunda vida


My last blog post about second life, was taken quite good by many users, so I decided to place more things that have been on my mind or that I use on second life to make that life a bit easier, and maybe share it with the community to also make things easier for them

Anyhow a few weeks ago or so someone did a post about a green trend on SL scripting, however I think that the idea was novel, but there are many other things that can make SL greener for everyone.

Graphics… do you really need them ?

This will be somewhat controversial, but most of this article is based on this, I am maybe trying to raise a new awareness about how to use the graphics on SL.

First of all many, many people using SL has very “powerful” high end graphics cards ( by today standards ) , but, how much do you really need to see?

If you can set your graphics card to max, and have everything on ultra, and well the bells and whistles, you have to know that to get all this information is divided on 2 parts:


-Server side
-Client side

Server Side.


Ok, to explain this a bit more, let’s talk about each part, and how SL actually makes you “see” things. LL™ had a great idea on how to make a virtual world that is not stored over several gigabytes on your PC, they accomplished this by sending small chunks of “raw” data, basically it sends “parameters” to your PC, so it knows that a cube exists and it has a shape, and a position, so on your PC the viewer grabs that information and makes the cube.

So instead of sending tons of data with a few simple lines it can tell you where the object is how it’s is shape etc.

After that LL sends the textures, and what texture goes where, and voila, you have your world made.

Of course when something moves like vehicle, it sends the data again, but not the full data, just the new positions, or when you move a cube etc.

To send this data uses your bandwidth as well as LL servers bandwidth, keep that in mind. (bandwidth is your internet connection)

I know I talked somewhat of the PC side or client side here also but basically the concept of sending small chunks of data from one side to the other is what the server does.




Client side

Ok the client side as mentioned before, grabs all that information and builds the “world” that you will see, this part is where your video card and your CPU take over, the faster your video card and CPU the faster the world will show, and move. ( of course your bandwidth )

Green…

Ok now I can go and explain some of the “green” part of working with this, when you go to your Graphic preferences, you will see that SL selected the “best” settings for you, but you can tweak this, based on what you really need.

For instance, if you set your draw distance to 512 meters, or even more on the advance settings on the debug part, think about this, every object, avatar, texture that is around you at 512 meters, will be sent to your PC, with textures and well EVERYTHING, if they move that gets updated etc.

Now I have to ask, if you go to a club, or if you are working on a project or something do you REALLY need to see everything around 512meters from you?

Unless you are making a movie or taking pictures or spying on the sim next door, you will not need to have this at such high settings.

Just make a little test, set your draw distance at 64 meters, then sit down somewhere and wait, then press control-shift-1 ( to get the statistics panel ) and look at your bandwidth, it will not be much, unless you just arrived to that place but if it goes up, it will not stay up for long.

Then set your draw distance to 512meters, and see how your bandwidth behaves, it will go up and up, and stay there for quite sometime, just think about this if you are on the middle of Sims, using each the 15.000 objects that they are allowed to use, before that bandwidth goes down you will have to download information for 30.000 objects, textures for those 30.000 objects, and if objects are moving then you also will have to update those objects.

Now, just think how much energy your internet modem will consume getting all that information, also a lot of that information will be either stored on your hard drive or ram, using more energy, then your CPU has to process that, and at the end, your graphics card will have to deal with the textures and what not, all of that uses a lot of energy ( just put your hand on your PC to see how hot it is, or if you can touch the heat sink for your graphics card, or your CPU, they will be hot, that heath, is just wasted energy, that you will have to end up paying.

And not only that if you are on a limited internet connection, you will reach your limit VERY fast, just by doing teleports to other places, not to mention the amount of energy the routers, modems, and PC’s that deliver that data to your PC will use, I mean, is it really necessary to go around having 512 or more meters, ALL the time. I have to say, no, not really.

Your pc has a power source, it can state 400,500 watts, but that’s the maximum power it can give, when you overload a program like second life, your PC will draw more and more and more power, and over time, this will add to some money, as well as some more burning of fossil fuels, etc, so basically you can help the world and save money just by using what you just really need.

Greener !

As I said before the GPU ( Graphics processing unit or video card ) performs a lot of operations on SL, but you can control those options as well, once again on the graphics tab, you can see several options (when you click on custom ) you’ll see “Shaders” most of the options there put strain on the GPU, as I said before you don’t really need all that for good SL experience, basically with basic shaders, and atmospheric shaders you will have a good SL experience ( because it will render glow) and bump map and shiny, but you can turn those off, but notice that if you build something when you texture specially if you want to add glow, it’s important to have them on, or you will make things so “Glowy” that people will just see everything as if they just arrived to heaven, so it’s good to keep this off, unless you are building, well texturing.

Water reflections, once again good for pictures, useless for a day to day SL experience, then we move to particles, it’s not a real good idea to turn them completely off because you’ll loose some of the SL experience, but a good practice is to keep them on low, that way you don’t put as much strain on your video card but you’ll also be able to see things that require particles.

There are other options there, most can be lowered for a day to day use, the only one that will act to help you is avatar impostors, since it will not render full avatars unless needed.

Mesh detail, again good for pictures, but not for a day to day thing.


Multimedia..

Ok as you know on SL you can see media , and audio, and it’s good to have them enabled, but try not to keep on the audio and video tab, the automatically play media on, because for instance if you teleport to a place where a video is playing even if you are not even close to the TV it will start to play, so once again more bandwidth and costs, so keep it on, but play it on demand it only takes for you to click on the play button, or a script to start your play but when you want it !


Your Fried PC.

Now this is all good, and will make your “consumption” of resources from RL and SL less, but that’s not the only benefit you will get out of this, as I said before using everything on ULTRA, will cause heat, a lot of heat, and you maybe know this, but heat is the natural enemy of PCs , if your computer runs very hot during hour’s days or months, IT WILL FAIL, when you see your motherboard it has small tracks ( the things that resemble roads on the green plaque ), and it also has small components that where soldered there, with heat, but a PC that stands heat and heat and more heat, over time some of the tracks and the soldering will become loose, and something “strange” will happen, your pc will start to fail, it will fail randomly, maybe a frozen program, a reboot, a Blue Screen etc, and this is a thing that personally I have seen happen a LOT of times, random failing PCs because the components got overheated and failed.

Also if you have several hard drives, lets say you have one to save your pictures, or music, and you will not use it while on Second Life, make it go to sleep, ( you can google and check how to make your hard drives sleep ), it will basically make your unused hard drives go to and idle state where they use a lot less energy, and will generate less heat, and at the end it will prolong their life.

Also, you can make other parts of your pc ( or all your PC ) go to sleep, instead of using a screen saver, make the monitor turn off, once again google up how to make your PC and it’s parts enter sleep mode.

So by keeping usage low, you will save money, energy, resources, and make your PC live longer and work better, great deal if you ask me.

The BUZZZZZZZZ sound….

Maybe your PC from time to time buzzes, or sounds like an airplane, maybe it happens when you open SL or a program that uses a lot of resources, this basically has 2 causes, one, is that your components notice that they are getting hot, so they tell the PC: “hey I need to cool down, please make the fans spin faster so they can take more heat out!” , so when that happens you’ll start listening to the annoying buzz sound.

But that’s not the only cause of the buzz sound, or “airplane pc”, a big problem that people are not aware is that dust gets collected on your PC, that dust ends up on the heatsinks and then they can’t work properly, even with the fan going at a full speed, the air will not flow as intended, and will cause the airflow to get resistance, so, the GPU, CPU, motherboard will get hotter, and well once again the problem, more electricity, less PC life.

However there are things you can do to solve this, if you can get a can of compressed air you can blow it on your heatsink, and remove the dust, I warrantee you that the sound will either go away or become very very faint.

Personally from time to time I go to the gas station at the corner where I live, and I ask them if I can use the compressed air they have there, and I blow all the PC, when it comes back I get 0 sound, more stable temperature, and the good feeling of knowing my PC is working better !

Oh my Laggness !

As you might have assumed by now, all that I’ve written here can also affect you, generating lag, once again by pressing control-shift-1, you can get the status window there you can see a parameter ( FPS , Frames per second ) as I said at the beginning SL is server and client side, but sometimes you get lag and a lot of it by having your graphics settings to the max.

Basically you’ll use a lot of ram, a lot of GPU, a lot of everything, so your PC will not be able to process everything the way it’s supposed to do it, and that will show on your FPS ( of course if the sim is laggy it will also affect you ) but anyhow, if you are getting very low FPS ( 3-8 ) making the changes stated above most likely will allow you to get more FPS, and end up making your SL experience smoother, so you might also consider that sometimes lag is not only the sim fault but maybe all the resources you are using, will generate more lag.


Thinking about the Future !

Maybe you have seen or have bought those new energy saving light bulbs, they are amazing! ( however they have been with us for so long Tesla invented them on the late 1800’s or early 1900’s ) anyhow those are made to save you money on electricity.

Well based on that concept now you will see flat screen monitors, ( LCD ones ), and well the “old” tube monitors, the ( CRT ones ), maybe you still use a CRT, anyhow where I am going with this is that if you have an old monitor or an old PC and you change it most likely you’ll end up saving a lot of money, and for instance if you right now have a CRT monitor, a LCD one will pay for itself, just by the insane difference on power consumption that one has compared to the other, the LCD one uses fractions of the energy that the CRT one uses.

Now when you decide to change the PC, or if you want to change the motherboard and processor, try to get a 45nm processor, ( 45 nanometers , that’s how they build them ) anyhow, a 45 nm processor will use A LOT LESS POWER than a 65 nm processor, so really on the long run you’ll have a better, greener PC, that is energy aware, and that will have a long life.



I really hope this makes your Second Life easier, better, and more aware of the environment, I know some people will say that all of this is not worth it, but let’s just talk about the money, if by making this changes you end up saving 0.5$ per hour that you use Second life, and you use it 4 hours a day, every day, for 1 year, it could save you 730$ a year ! ( 0.5x4x365 = 730 ) , and just imagine the amount of energy saved !

Thank you for reading.

RS.

viernes, 20 de marzo de 2009

Future Changes on SL -Expensive Ram ! -

Hi I decided to take a break from my schedule to write about something that seems to be on the Idea Panel, at Linden Labs(tm), and most likely will be implemented in soon to come versions of the Second Life Server.

A few days ago at 4AM SLT, babbage Linden called up on an office hour meeting ( march 18 to be exact ), to inform us about new things that are cooking on SL.

Basically 3 things where discussed, some of you might know about them some of you might now, however I will talk about this issues here:

-The New Scheduler


[2009/03/18 4:03] Babbage Linden: so, the biggest thing that happened this week is that the new mono scheduler past internal QA.


ok for the non tech people out there the scheduler is the "soul" of SL scripts, it seems that based on the work of some hard working beta testers ( like moon metty ) they found out a serious flaw on the scheduler, that from time to time allowed mono scripts to go over it's 64K ram allocation limit, therefore using more ram, as well as bigger time slices, so that is indeed a thing that could potentially create a lot of issues, from the server side where the scripts are run.

in Babbage Linden's words:


[2009/03/18 4:04] Roberto Salubrius: now new limitations that we should be aware of ?
[2009/03/18 4:04] Babbage Linden: previously it was possible to exploit the scheduler to get long time slices
[2009/03/18 4:05] Babbage Linden: that should now be fixed
[2009/03/18 4:05] Babbage Linden: also, it was possible to temporarily use more than 64K with mono scripts within a time slice


Babbage Linden: scripts that are most often affected are those which use list operations like this
[2009/03/18 4:07] Babbage Linden: l = llListSortList(l);


on a personal note:
This, has been "exploited" by some scripters, deliberately, and maybe others are using more than 64K without being aware that they are using it, or more time, since we really don't have the appropriate tools to measure this, and we thought it was controlled correctly on the Server Side, well thankfully this new scheduler will be for some time on the Beta Grid, so we can go out and test some scripts, that we could think might be using more than they where supposed to, and try to fix them, however, it's known that some content will break, but well, there's not much we can do about that right now, the new Scheduler is expected to come with the 1.26 Server.


-limit script memory based on parcel ownership

It seems that in the near future, we are going to have to worry not only about the prims we have on a parcel, but also the ram that we are using on each parcel:

[2009/03/18 4:24] Babbage Linden: there is a separate project we're working on which we limit script memory based on parcel ownership
[2009/03/18 4:25] Babbage Linden: which will work like prim limits
Babbage Linden: when scripts are running in world, they will request memory from the parcel's script memory pool



So then as the conversation unfolds it seems that we are going to have to sell items, like this " Techno Kitty Development - Future Object - Prims: 3 Ram: 16K -

As Babbage said after this, when you do not have enough ram to run a script, it will just not rez, just like it happens now when you don't have enough prims on a parcel, maybe we'll get a "Parcel Ram Full Unable to rez item"

on a personal note, as a system administrator of years, I understand why this is going to be implemented, you need boundaries and limits, however as a user, I see this as something potentially problematic, now it will not only be prims, but also ram.

And as a "SL scripter" this really worries me, since as we all know a program might grow over time, for instance a visitor counter, right now we have a predefined allocation of ram ( or we thought we did, look the scheduler part ), and we knew that we could use up to 64K of ram, I have no idea how much ram we will get for each SQM, however it would be interesting to see, how things will unfold, when you sell a small script telling people it uses 64K of ram, and well to start it might just use 1K, or 2K, I really have a lot of questions about this, but well, I guess time will tell.


[2009/03/18 4:29] Babbage Linden: you will need to sell it as a 6 prim, 16KB object
[2009/03/18 4:29] Babbage Linden: people are widely aware of prim limits
[2009/03/18 4:30] Babbage Linden: "memory limits are like prim limits: you get them with your land"


@_@

Also it seems that in the not so far future we will be able to allocate more ram per script, so we won't need to "cut scripts" and use linked messages as we do now, that might be nice, however I think that if a script requires a lot of ram, well, it won't be a big seller, as I said before I have more questions about this, and the implications of this, than answers:

[2009/03/18 4:46] Babbage Linden: you might have a 1 prim object that needs 1MB
[2009/03/18 4:46] Babbage Linden: or a 100 prim object that needs 16KB


[2009/03/18 4:50] Babbage Linden: there will be edge cases were people are running 2000 scripts on a 512m parcel of land
[2009/03/18 4:51] Babbage Linden: those will stop working



-avatars allowance for attachments


[2009/03/18 4:24] Babbage Linden: and give avatars and allowance for attachments
[2009/03/18 4:25] Babbage Linden: which will work like prim limits
[2009/03/18 4:25] Roberto Salubrius: so limit ram and or script time per avatar
[2009/03/18 4:26] Babbage Linden: when scripts are attachments, they will request memory from the avatar's script pool



This is basically the same thing as limit script memory based on parcel ownership, but it will be per avatar, basically you'll have an amount of ram for each Avatar, for scripted attachments, if you have enough ram you'll be able to attach the items, if not, well it won't attach.

[2009/03/18 4:45] Babbage Linden: parcels and avatars will have a memory pool
[2009/03/18 4:45] Babbage Linden: in order to rez a script you need to have enough memory available in the pool to fulfil the requirement
[2009/03/18 4:46] Babbage Linden: just like a prim limit



[2009/03/18 4:53] Babbage Linden: but again, we will pick numbers for avatar pools that will mean that most people can continue to use the scripted attachments they currently use
[2009/03/18 4:53] Babbage Linden: only extreme edge cases should be affected



On a personal note, I really hope they give each avatar a very LARGE pool of ram, because it will be so bad to get costumers screaming at you, telling you that product X or Y is nor working, and then you are gonna have to tell them something like, look if you go bald, take off your shoes, and all your jewelery, you'll be able to use your new item... that really concerns me.


Well all of that being said, the "why" this is being implemented is basically to really limit things, and avoid lag, and griefing:

Babbage Linden: and actually, running tons of scripts on a tiny parcel is griefing all the other parcel owners anyway
[2009/03/18 4:52] Roberto Salubrius: yes of course
[2009/03/18 4:52] Babbage Linden: i agree that this will require lots of communication to get right

[2009/03/18 4:53] Babbage Linden: but again, we will pick numbers for avatar pools that will mean that most people can continue to use the scripted attachments they currently use
[2009/03/18 4:53] Babbage Linden: only extreme edge cases should be affected



I have no idea what a extreme case is right now, but I guess I'll know soon enough, well it seems that right now the lindens are conducting a grid wide assessment, on how much ram each person is using, and how much ram each parcel is using to have real numbers to work with, I hope this numbers are REAL high, so we don't see content broken, or we don't see as much content broken as we could see when this is fully implemented.

However I have to say that RIGHT now, when they are getting the metrics of all this, Bots do affect us more than imagined, since most of them are just "dummies" with no attachments, they basically could end up lowering the pool for the rest of us real users, I hope the lindens take this into consideration before they get the metrics up and running, and I really call massive bot owners, to keep them out of the grid while the metrics are set, so LL(tm) get a better understanding of what is required with real significant numbers.

As I Said before this really raises a lot of questions, from my side, and makes me wonder, if on the long run this will be for the better or for the worst, I guess we will see, this is is a change that will touch the core of SL as we know it right now ( no I am not screaming wolf, or writing about another end of SL ).

Now I do have my own personal theories about why this might be being implemented, but I will keep this to myself, and let you all come to your conclusions, basically I wrote a few comments, and decide to share this information with the community !

Thank you for reading !

RS.

domingo, 1 de febrero de 2009

The hell of nsbp or char 160 or %A0

I was coding a website and I came with an issue, it seems that if you use select option then add the text, well that normally works UNLESS you end up with double spaces, so if you have something like "HELLO HOW ARE YOU" and you place it in an option you will end with "HELLO HOW ARE YOU", if you are working with thins, products maybe that have several spaces and you can't change the product name, what do you do ?

well you can add &NBSP so it would end up begin something like "HELLO    &NBSPHOW ARE YOU" that will result in the correct text inside the option !.... now here comes the pain in the ARSE !

if you grab that data and try to include it on a database it will not enter as you would expect "HELLO HOW ARE YOU" but it will enter as:

"HELLO%A0%A0%A0HOW ARE YOU" ( %A0 is character 160 )


** note even here the damn Blog ate the SPACES .... I will re-write
but basically most of the text =

S/HELLO(SPACE)(SPACE)(SPACE)HOW ARE YOU/

so when you try to do more "transactions" on the name, you will get an error, because you would normally write something like:

$sql="update value="newvalue" where salute="HELLO HOW ARE YOU" ( just a code stub )

but inside $SQL you already have saved the text with char(160)... so this:

"HELLO%A0%A0%A0%A0%A0HOW ARE YOU"

is not the same as: (%20 is the normal space)

"HELLO%20%20%20%20%HOW ARE YOU"

so ... well this kept me up all the night it has to be corrected like this:

( in PHP )

str_replace("%A0"," ",DATA WITH NBSP);

that will replace the unholy NSBPs to real spaces...

then you can add it to the DB and work as you please.

this really gave me a headache today... geez.

domingo, 18 de enero de 2009

I'm gonna start posting bits of PHP or other coding langs here so I can remember them when I need them.

First:

how to get the filename of a PHP script ( without the server or anything )

echo end(explode('/',$_SERVER['PHP_SELF']));

now a way to get just where the script is being executed the main path of the server
would be:

$scriptname=end(explode('/',$_SERVER['PHP_SELF']));
$htmlpath ='http://'.preg_replace('/'.$scriptname.'/',"",$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']);
echo $htmlpath;