Archive for the ‘coding’ Category

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

Posted by admin on February 17, 2010

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>”;

Posted by admin on January 16, 2010

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

Posted by admin on January 3, 2010

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

Posted by admin on September 17, 2009

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

Posted by admin on September 9, 2009

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

Posted by admin on September 9, 2009

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

Posted by admin on May 7, 2009

Hi,

today I got my commercial API from Orb (thanks to Orb).

Now I am able to share with you my little App I wrote for Android.

—- Info

With this Application ( i called it Androrb) you may request your media list that is stored on your pc from the orb server and open a video, audio, webradio or photo on your Android G1 Mobile.

Its still Alpha and there are several things to improve. Please keep in mind this is just a hobby from me and the only reason I give it into the public is to share my joy that I do not need to login by browser into orb, just to listen my music.

— Where to get the Pre-Version?

Here you find the Alpha Version to install on your G1.
http://www.guruk.com/android/androrb03a.apk

You can install this APK with a Tool you find in the Android Market called “Apps Installer”

When you open it first Time you have to enter your ORB UserID and Passwort.

I am only able to test this Version with WIFI on a G1 RC33 . So I am glad you send me your response and experience in your Environment.

—— Develop with me

Should you like helping in development, you may have a look on: https://developer.orb.com/wiki/Main_Page

There you find how to access the API and what commands are possible for he XML Response.
For example:
1. https://api.orb.com/orb/xml/session.login?apiKey=evcphjpgribp&l=myorbid&password=myorbpw
creates a session Key

2. https://api.orb.com/orb/xml/media.search?q=mediaType%3Dvideo&groupBy=author
now we request all Videos.

You may construct and explain XML Feeds you need and I can implement them by time.

—- Finaly :)

All the best and Enjoy.

Yours
Chris

—some pics:

http://www.guruk.com/android/1-registerdata.jpg
http://www.guruk.com/android/2-about.jpg
http://www.guruk.com/android/3-login.jpg
http://www.guruk.com/android/4-showfolders.jpg
http://www.guruk.com/android/5-listcontent.jpg
http://www.guruk.com/android/6-loadmedia.jpg

Posted by admin on March 31, 2009

delay in ms

02-10-09

Somtimes you may like to pause your javascript for a while (milliseconds). Here is a simple script i found from sean.co.uk that do exactly this:

<script language=”javascript”>

// www.sean.co.uk

function pausecomp(millis) 
{
var date = new Date();
var curDate = null;

do { curDate = new Date(); } 
while(curDate-date < millis);

</script>

Posted by admin on February 10, 2009

When you need to jump to a specific URL direct after you choosed a Statement from a Selectbox:

 

<select onchange=”window.open(this.options[this.selectedIndex].value,’_self’)”>

    <option value=”">Choose a Language…</option>

    <option value=”database.php?lang=en”>English</option>

    <option value=”database.php?lang=de”>Deutsch</option>

    <option value=”database.php?lang=id”>Italian</option>

    <option value=”database.php?lang=ru”>Russian</option>

</select>

Posted by admin on December 19, 2008