Monday, August 18, 2008

Facebook programming with ASP3


Programming an application for facebook usualy done with php, java and .net!

what about asp programmers?

As i started to develop and asp application and downloaded a class that implement the api of facebook, i decided to share it here and start a project to improve this class (this is not full class and not all funciton worked).

please help me and all asp programmers to build this class so we all can use it.




thanks

Sunday, March 30, 2008

NearConn published the beta version


Lately, the NearConn team announced that they opened their system for a beta users.
NearConn is a unique cellular social network, it's a social network that enable the user to contact people around in any given time and place.
The main idea of the NearConn creators is to make the bluetooth name that on the cellular phone, a link to details that it's owner want to show the other,
think about it, you can share your profile or you can share your buisness details, advertise a service you offer.
it can be a new way to advertise things in a simple and cheap way...
I beileve that the idea of NearConn is exelent, usefull for milions of users and will be the next thing.
here you can watch a video of how it works : http://www.nearconn.com/demo.asp

you can sign up to nearconn here: http://www.nearconn.com/

Thursday, March 20, 2008

Programming Discussion Forums


I'm happy to announce that i opened the Blog Discussion forum.
i will add there a discussion post for all the materials on my blog.
Please feel free to help me build a rich forum.
if you think that you have an interesting material, source code, tips or tricks please share it with the other programmers.
Add your post at the related category.
thanks alot for your help and support.
the forum address is: http://www.byramix.com/blogforum

Saturday, March 01, 2008

script.aculo.us drag and sort scrolling bug

For those who uses the script.aculo.us drag and drop js libs, this is an explain for fixing a scrolling bug.
if your dragable element has a scrolling bar, when you try to scroll it also start dragging the element.
i fixed this bug, do the following steps and it will work perfectly:
open the file "dragdrop.js" for edit, after the following code:
if((tag_name = src.tagName.toUpperCase()) &&
( tag_name=='INPUT'
tag_name=='SELECT'
tag_name=='OPTION'
tag_name=='BUTTON'
tag_name=='TEXTAREA')) return;

add the following line:
if( src.undragable!=null) return;

this line means that if there's a tag in the element that called "undragable" so it wont move the element.

when you want to set an element with a scrollbar, just add the "undragable" tag to it and it will fix the problem, for example:


< d iv height="50%" width="100%"undragable style="height: 200px; overflow:auto;scrollbar-arrow-color: #808080; scrollbar-track-color: #FFFFFF; scrollbar-face-color: #FFFFFF; scrollbar-highlight-color: #808080; scrollbar-3dlight-color: #FFFFFF; scrollbar-darkshadow-color: #FFFFFF;scrollbar-shadow-color: #808080;"

Sunday, February 10, 2008

Url Encode function. Encode a string according to W3C standards

this is a function that turns all the chars in a string to the W3C Standards. 
/**
* Encode a string according to W3C standards.
*
*/

public static String urlEncoder(String s) {
if (s == null)
return s;
StringBuffer sb = new StringBuffer(s.length() * 3);
try {
char c;
for (int i = 0; i < s.length(); i++) {
c = s.charAt(i);
if (c == '&') {
sb.append("&amp;");
} else if (c == ' ') {
sb.append('+');
} else if (
(c >= ',' && c <= ';')
(c >= 'A' && c <= 'Z')
(c >= 'a' && c <= 'z')
c == '_'
c == '?') {
sb.append(c);
} else {
sb.append('%');
if (c > 15) { // is it a non-control char, ie. >x0F so 2 chars
sb.append(Integer.toHexString((int)c)); // just add % and the string
} else {
sb.append("0" + Integer.toHexString((int)c));
// otherwise need to add a leading 0
}
}
}

} catch (Exception ex) {
return (null);
}
return (sb.toString());
}
 
source of this function : http://forum.java.sun.com/thread.jspa?threadID=594204&messageID=3596899

Monday, January 28, 2008

Replace relative links to absolute base links in HTML - Java

this is a function that can add a base url to all urls in an html page, this code was translated from this vb function displayed here :http://www.motobit.com/tips/detpg_replace-relative-links/

special thanks to the original coder...

the function (java) was tested and run successfully!

public static String ReplaceLinksToBase(String HTML, String baseURL)
// replaces all links in an html to base url
// By Ramik, 28/1/2008
{
HTML = ReplaceTagToBase(HTML, "a", "href", baseURL);
// replace <img src=...> links
HTML = ReplaceTagToBase(HTML, "img", "src", baseURL);
HTML = ReplaceTagToBase(HTML, "link", "href", baseURL);
return HTML;
}


public static String ReplaceTagToBase (String HTML, String TagName, String ValueName, String BaseURL)
// replace a specific tag url to base Url
//By Ramik, 28/01/2008
{
int pos1, pos2;
String p1, p2, html;
html= HTML;
//Find the tag In HTML.
String temp = "<"+TagName ;
pos1 = HTML.indexOf(temp);
while (pos1>0)
{
//The tag was found. Find closing > of the tag.
pos2 = HTML.indexOf(">",pos1+TagName.length());
if (pos2>-1)
{
//separate tag text from HTML
String tag, tag1;
tag = HTML.substring(pos1, pos2);
//rewrite realative URL links In the one tag.
tag1 = ReplaceParamToBase(tag, ValueName, BaseURL);
//The tag was changed - relative links found.
if (!tag1.equals(tag)) //there is some change In the tag.
{
//get parts before And after the tag
p1 = HTML.substring(0,pos1);
p2 = HTML.substring(pos2,HTML.length());
//Compute new POs2 position
pos2 = pos2 + tag1.length() - tag.length() ;
//replace old tag with relative links with the new version
html = p1 + tag1 + p2 ;
}
}
if (pos2>0)
pos1 = HTML.indexOf("<"+TagName,pos2+1);
else
pos1 = 0 ;
}
return html;
}

public static String ReplaceParamToBase( String Tag, String ValueName,String BaseURL)
{
String p1, p2 , c1, URL, tag=Tag;
int pos1, pos2, lenVal ;
lenVal = ValueName.length() ;
//find position of the tag value
pos1 = Tag.indexOf(ValueName+"=");
if (pos1>-1)
{
//get a first char after =
c1 = Tag.substring(pos1+lenVal+1,pos1+lenVal+2);
if (c1.equals("\""))
{
pos1 = pos1+lenVal+1 ;
pos2 = Tag.indexOf("\"",pos1+1);
}
else if (c1.equals("'"))
{
pos1 = pos1+lenVal+1;
pos2 = Tag.indexOf("'",pos1+1);
}
else//the value ends with Space
{
pos1 = pos1+lenVal;
pos2 = Tag.indexOf(" ",pos1);
if (pos2==-1)
pos2 = Tag.length();
}
p1 = Tag.substring(0,pos1+1);
p2 = Tag.substring(pos2,Tag.length());
URL = Tag.substring(pos1+1,pos2);
//is the value relative URL?
if (URL.indexOf("://")==-1 && URL.indexOf("mailto:")==-1)
{
//make the new absolute URL
if (BaseURL.charAt(BaseURL.length()-1)!='/' && BaseURL.charAt(BaseURL.length()-1)!='\\' )
{
BaseURL=BaseURL+'/';
}
URL = BaseURL+URL ;
tag = p1+URL+p2;
}

}
return tag;
}


public static String replaceAllTags (String HTML, String TagName, String ValueName, String BaseURL)
//Replace all tags in html to base url
// by ramik 30/1/2008
{
String html = HTML , allHtml="";
int pos1=0, pos2 = HTML.indexOf(">");
if (pos2>-1)
pos2++;
while (pos2>-1)
{
html = HTML.substring(pos1,pos2);
allHtml = allHtml + ReplaceTagToBase(html,TagName, ValueName, BaseURL);
pos1=pos2;
pos2=HTML.indexOf(">",pos2);
if (pos2>-1)
pos2++;
}
allHtml = allHtml + HTML.substring(pos1);
return allHtml;
}

Discuss this Post

Saturday, September 15, 2007

windows vista: access: local only

Ok, this is my first post of non programming issue but it still usefull for computers users.
Last week i got a new HP Laptop, with windows vista insite, it's cool looking, i was so happy with it untill i had the first problem, i couldn't surf the net.
well, i will not talk alot, because i guess some of you is reading here after a few days of searching.
well, what i had is like that:
i could connect to the network and see other computers but could not surf the net
that what you should do:
go to the network connection icon on the tray - > right click ->network and Sharing Center -> on the left press of the Manage network connection - > right click on the network that you want to log in to -> properties -> now you have some check boxes :
uncheck the Internet Protocol Version 6
stand on the Internet Protocol Version 4 and press properties :
check the Use the following IP Address :
and on the fields fill the following:
IP Address : [put an IP the is fine with your router]
Subnet mask : 255.255.255.0
Default gateway: the ip of your router

then check : use the following DNS server addresses
Prefered DNS server: the ip of your router.

press OK -> OK and restart your computer.

for me it worked..
thanks to the guys here: http://www.daniweb.com/forums/thread73818.html