Archive for the Category »coding «

Every liked the swatch @beat time for an internation new time ?

What looks like that:

The current Internet Beat time is @772.

can be realised by a javascript like that:

<html>

<SCRIPT>
<!--
function getBeat()
{
	var now = new Date();
	var off = (now.getTimezoneOffset() + 60)*60;
	var theSeconds = (now.getHours() * 3600) + (now.getMinutes() * 60) + now.getSeconds() + off;
	var beat = Math.floor(theSeconds/86.4);
	if (beat > 1000) beat -= 1000;
	if (beat < 0) beat += 1000;
	return beat;
}

// I added a little function that keeps updating the beat time

function follow()
{
	if (!document.getElementById || window.opera) return;
	document.getElementById('writeroot').innerHTML = '@' + getBeat();
	setTimeout('follow()',20000);
}
// -->
</SCRIPT>

<body>
<P>The current Internet Beat time is <SPAN ID="writeroot"><SCRIPT>document.write('@'+getBeat())</SCRIPT></SPAN>.</P>

</body>
</html>

To create FTP user through SSH you would need to follow below mentioned steps:

1. Login as root through SSH.

2. Next add the user account you want using the ‘useradd’ command

useradd <username>

3. Now create a special group for that user.

groupadd <groupname>

4. Now to add the user to the group

gpasswd -a <username> <groupname>

These commands are non-standard but available on most popular distributions.
If not, then you can try editing /etc/group using your favorite text editor.

5. Change the group ownership of the special directory to that group.

chgrp -R groupname /path/to/your/web/directory

6. Enable write permissions

chmod -R g+rw /path/to/your/web/directory

Category: apache  Leave a Comment

CGRect nextMonthButtonFrame = CGRectMake(10,10,50,50);

UIButton *nextMonthButton = [[UIButton alloc] initWithFrame:nextMonthButtonFrame];

[nextMonthButton setImage:[UIImage imageNamed:@"kal_right_arrow.png"] forState:UIControlStateNormal];

nextMonthButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;

nextMonthButton.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;

[nextMonthButton addTarget:self action:@selector(prevMonth) forControlEvents:UIControlEventTouchUpInside];

[calendarview addSubview:nextMonthButton];

[nextMonthButton release];

Category: xcode  Leave a Comment

Hi,

thanks to Mike from http://www.71squared.com

I go finaly OpenAL playing a Sound on my iPhone :)

I am not a big writer as usual so just see the Code

You may find a full functional XCode Demo (its on 3.2.2)
on my HP: http://2t4u.com/playopenal.zip

I added also a small function: checkSoundWithKeyPlaying(soundID)

Just look at the Source and when you start your Project
look into your CONSOLE !! to see if the Sound is still playing or not!

Enjoy and Thanks to Mike for the Base.

Greets
Chris

Category: xcode  Leave a Comment

Simple RSS Reader

function getrssdata($rssx,$item_strip)

{

$rsslength = strlen ($rssx);

$title_start=strpos($item_strip,”<”.$rssx.”>”);

$title_end=strpos($item_strip,”</”.$rssx.”>”);

$title_length=$title_end+$rsslength+3-$title_start;

$title=substr($item_strip, $title_start+$rsslength+2, $title_length-(($rsslength*2)+5));

return trim($title);

}

function readrss($rssfile)

{

global $fldID, $fldCountry, $fldCountryIndex;

$array=file_get_contents($rssfile);

$i=0; $counti=0;

while ($i!=1) {

$item_start=strpos($array,”<rec>”);

if ($item_start===false) {

$i=1;

}

else

{

$item_end=strpos($array,”</rec>”);

$item_length=$item_end+6-$item_start;

$item_strip=substr($array,$item_start,$item_length);

$fldID[$counti]           = getrssdata(“fldID”,$item_strip);

$fldCountry[$counti]      = getrssdata(“fldCountry”,$item_strip);

$fldCountryIndex[$counti] = getrssdata(“fldCountryIndex”,$item_strip);

$array=substr($array,$item_end+6); $counti++;

}

}

}

//———————————————————————————

readrss (“http://xxx.xx/myxml.xml”);

$arr_size = count ($fldID);

echo “Centers found: “.$arr_size.”<br><br>”;

function getrssdata($rssx,$item_strip)
{
$rsslength = strlen ($rssx);
$title_start=strpos($item_strip,”<”.$rssx.”>”);
$title_end=strpos($item_strip,”</”.$rssx.”>”);
$title_length=$title_end+$rsslength+3-$title_start;
$title=substr($item_strip, $title_start+$rsslength+2, $title_length-(($rsslength*2)+5));
return trim($title);
}
function readrss($rssfile)
{
global $fldID, $fldCountry, $fldCountryIndex, $fldCity, $fldCityAlias, $fldHost, $fldStreet, $fldcode,
$fldCityLocation, $fldTelefon, $fldTelefon2, $fldTelefon3, $fldFax, $fldHandy, $fldHandy2,
$fldDWBEmail, $fldForwardEmail, $fldURL, $fldFounded, $fldLongitude, $fldLatitude, $fldTyp;
$array=file_get_contents($rssfile);
$i=0; $counti=0;
while ($i!=1) {
$item_start=strpos($array,”<rec>”);
if ($item_start===false) {
$i=1;
}
else
{
$item_end=strpos($array,”</rec>”);
$item_length=$item_end+6-$item_start;
$item_strip=substr($array,$item_start,$item_length);
$fldID[$counti]           = getrssdata(“fldID”,$item_strip);
$fldCountry[$counti]      = getrssdata(“fldCountry”,$item_strip);
$fldCountryIndex[$counti] = getrssdata(“fldCountryIndex”,$item_strip);
$fldCity[$counti] = getrssdata(“fldCity”,$item_strip);
$fldCityAlias[$counti] = getrssdata(“fldCityAlias”,$item_strip);
$fldHost[$counti] = getrssdata(“fldHost”,$item_strip);
$fldStreet[$counti] = getrssdata(“fldStreet”,$item_strip);
$fldcode[$counti] = getrssdata(“fldcode”,$item_strip);
$fldCityLocation[$counti] = getrssdata(“fldCityLocation”,$item_strip);
$fldTelefon[$counti] = getrssdata(“fldTelefon”,$item_strip);
$fldTelefon2[$counti] = getrssdata(“fldTelefon2″,$item_strip);
$fldTelefon3[$counti] = getrssdata(“fldTelefon3″,$item_strip);
$fldFax[$counti] = getrssdata(“fldFax”,$item_strip);
$fldHandy[$counti] = getrssdata(“fldHandy”,$item_strip);
$fldHandy2[$counti] = getrssdata(“fldHandy2″,$item_strip);
$fldDWBEmail[$counti] = getrssdata(“fldDWBEmail”,$item_strip);
$fldForwardEmail[$counti] = getrssdata(“fldForwardEmail”,$item_strip);
$fldURL[$counti] = getrssdata(“fldURL”,$item_strip);
$fldFounded[$counti] = getrssdata(“fldFounded”,$item_strip);
$fldLongitude[$counti] = getrssdata(“fldLongitude”,$item_strip);
$fldLatitude[$counti] = getrssdata(“fldLatitude”,$item_strip);
$fldTyp[$counti] = getrssdata(“fldTyp”,$item_strip);
$array=substr($array,$item_end+6); $counti++;
}
}
}
//———————————————————————————
//readrss (“http://www.kagyu.net/xml2.asp”);
//$arr_size = count ($fldID);
//echo “Worldwide Centers found: “.$arr_size.”<br><br>”;
Category: php  Leave a Comment

Hi, you may like to copy whole folders from one server to another.

as long your both server support ssh you should try

scp -r username1@xxx.xxx.xxx.xxx:/home/folderorg username2@yyy.yyy.yyy.yyy:/home/folderdest

its very fast, because you dont have to copy the files to your local pc first.

Just replace username1 with the username from your first server
and xxx.xxx with the IP from your original server

and username2 with the username from your first server
and yyy.yyy with the IP from your destination server

you may also login to your original server and just do
scp -r  /home/folderorg  username2@yyy.yyy.yyy.yyy:/home/destfolder

have fun

Category: coding  Leave a Comment

My job was to bring a swf streaming to my android mobile (g1)

As we know there is no Flash Player on the Android (G1) i had to convert it to a mp4.
Unfortunatly when I placed the mp4 on my sd-card i was able to play it on my device, but when i placed it on my server and loaded that file from there to my Android it told my “Format is not supported”.

Long Story, shorter Result:

1.

I use now the Software SWF to Video Converter from iWiSoft (get it here) to convert my swf to a mp4 file.
- I choose the swf, choose automatic converting and 480×320 (IPhone Size).

This  Mp4 plays on Android Sd-Card. To make it playable also from my Server:

2.
I upload this Mp4 just simple to YouTube and there is a new Feature you can download,  every Hour
two of your Videos as Mp4, I  just download this Video as MP4 from Youtube again.
NOW! It works also perfect when I place it on my Server and stream it to my Android.

I talked with the People from IwiSoft and gave them some hints, hopefully their new Software Update in October will be able to convert a SWF directly into a progressiv streaming Android Mp4.

But for now this what a wrote above is a fine working Solution to convert SWF to MP4 for Android.

Have Fun

Chris

Category: android  Leave a Comment

vkeyboardHi, thanks to Keith Wood , creator from this cool virtuale keyboard
http://keith-wood.name/keypad.html

I had some problems with it and needed a working back button and also that i just simple can keep my forms in Frame1 as they are and a virtual keyboard in the second frame.
Wohhh and he really did it great.

Download the Demo

iwebkitsHi, while is was searching for a simple solution to create a homepage that looks like the GUi of Iphone I found IWebKit. It works great, just the sliding did not worked. Here Marcus from devilx.net helped me out and did a frame work that adds the Sliding into the iWebkit.

So here you find the original Framework with the examples:
http://iwebkit.net/

Than just download the hacked Framework with sliding and replace the css and js

http://www.devilx.net/2009/09/08/hacked-iwebkit-a-bit/

Enjoy

Greets

Chris

Hi, I guess some of you like to get a simple demo how to listen to gestures on Android.
I could write now a lot of code, but more simple, just DOWNLOAD the archive I made for you with a simple Demo Gesture APP. Its written under sdk 1.5 but also works in sdk 1.1

But anyhow… this could be very useful to know.
@Override
public boolean dispatchTouchEvent(MotionEvent me) {

gestureScanner.onTouchEvent(me);
return super.dispatchTouchEvent(me);
}

when you do that, the demo listener works also on buttons ! I was looking quit long for that to know.. but its all included in the demo.
greets
chris

Category: android  Leave a Comment