Java resize image from an URL?
I want to resize the an image from an URL to 50x50 px.
This is how i load the image:
jLabel1.setIcon(new javax.swing.ImageIcon(new
URL("http://url.com/picture.jpg")));
How can i make picture.jpg 50x50px ?
Any ideas?
Saturday, 31 August 2013
IDE says MasterPage not found, but builds/runs fine
IDE says MasterPage not found, but builds/runs fine
I am stumped as to why my pages are saying the MasterPage cannot be found,
even though the MasterPages are where they are specified. For example:
In default.aspx
<%@ Page Title="Welcome" Language="C#" MasterPageFile="~/Master.Master"
AutoEventWireup="true" CodeBehind="default.aspx.cs"
Inherits="My_site.default" %>
In the above line, "~/Master.Master" is underlined in green. Hovering with
my mouse shows a balloon that reads File '~/Master.Master' was not found.
Master.Master definitely exists in the root folder of my site. The site
builds fine and all of my pages DO find ~/Master.Master when ran on either
my local PC or when uploaded to my hosting account.
The biggest annoyance is that I can't view my pages in the VS IDE because
it says The Master Page file '~/Master.Master' cannot be loaded. Correct
the problem in Code view. I see nothing to fix...
I have completely deleted the /obj/Debug and /obj/Development folders,
clicked to Clean the entire solution, and done a complete build. Every
page that uses a Master Page on my site is telling me this.
After running into some problems with long filename errors (unrelated
issue) I moved my solution/project to a folder off of my C:. I named the
solution folder C:\My_Site and inside of it there is a project folder
called My_Site. The full path to my project files is C:\My_site\My_Site.
If I change MasterPageFile="~/Master.Master" to
MasterPageFile="~/My_Site/My_Site/Master.Master" then the IDE stops
reporting an error and will allow me to view pages in design mode without
a problem - although the site will not build this way. The compiler
reports problems that the Master Pages cannot be found.
I read a post here on SO - Error: "The file
'/MasterPages/MainMaster.master' does not exist." (Yes, this file does
exist!) but my files are not located in a virtual folder. I use IIS
Express and so am pretty limited with configuring it. I am uneasy about
right-clicking my project and converting it to anything. I'm not sure what
the effect of that would be.
Anyone have an idea what's possibly happening and how I might resolve this?
I am stumped as to why my pages are saying the MasterPage cannot be found,
even though the MasterPages are where they are specified. For example:
In default.aspx
<%@ Page Title="Welcome" Language="C#" MasterPageFile="~/Master.Master"
AutoEventWireup="true" CodeBehind="default.aspx.cs"
Inherits="My_site.default" %>
In the above line, "~/Master.Master" is underlined in green. Hovering with
my mouse shows a balloon that reads File '~/Master.Master' was not found.
Master.Master definitely exists in the root folder of my site. The site
builds fine and all of my pages DO find ~/Master.Master when ran on either
my local PC or when uploaded to my hosting account.
The biggest annoyance is that I can't view my pages in the VS IDE because
it says The Master Page file '~/Master.Master' cannot be loaded. Correct
the problem in Code view. I see nothing to fix...
I have completely deleted the /obj/Debug and /obj/Development folders,
clicked to Clean the entire solution, and done a complete build. Every
page that uses a Master Page on my site is telling me this.
After running into some problems with long filename errors (unrelated
issue) I moved my solution/project to a folder off of my C:. I named the
solution folder C:\My_Site and inside of it there is a project folder
called My_Site. The full path to my project files is C:\My_site\My_Site.
If I change MasterPageFile="~/Master.Master" to
MasterPageFile="~/My_Site/My_Site/Master.Master" then the IDE stops
reporting an error and will allow me to view pages in design mode without
a problem - although the site will not build this way. The compiler
reports problems that the Master Pages cannot be found.
I read a post here on SO - Error: "The file
'/MasterPages/MainMaster.master' does not exist." (Yes, this file does
exist!) but my files are not located in a virtual folder. I use IIS
Express and so am pretty limited with configuring it. I am uneasy about
right-clicking my project and converting it to anything. I'm not sure what
the effect of that would be.
Anyone have an idea what's possibly happening and how I might resolve this?
#EANF#
#EANF#
What is wrong with this query? PHP gives me error,
Parse error: syntax error, unexpected T_STRING
INSERT INTO `realtorl_leads`.`data` (`LeadFirstName`, `LeadLastName`,
`LeadEmail`, `LeadEmail2`, `LeadPhone`, `LeadCity`, `LeadAddress`,
`LeadPostcode`, `LeadUserId`, `LeadLeadStatusId`, `LeadMonth`,
`LeadAreas`, `LeadMinPrice`, `LeadMaxPrice`, `LeadMinBedrooms`,
`LeadMaxBedrooms`, `LeadMinBathrooms`, `LeadMaxBathrooms`, `LeadMinYear`,
`LeadNextFollowup_mm`, `LeadNextFollowup_dd`, `LeadNextFollowup`) VALUES
('Fahad', 'Uddin', 'fahad.fuss@gmail,com', 'fahad@ff.com', '3242342',
'karachi', '3234asdasd.karachi', '74600', '222', '32432', '23', '232',
'232', '23', '232', '323', '323', '232', '23232', '3232', '232', '23232');
Thanks in advance.
What is wrong with this query? PHP gives me error,
Parse error: syntax error, unexpected T_STRING
INSERT INTO `realtorl_leads`.`data` (`LeadFirstName`, `LeadLastName`,
`LeadEmail`, `LeadEmail2`, `LeadPhone`, `LeadCity`, `LeadAddress`,
`LeadPostcode`, `LeadUserId`, `LeadLeadStatusId`, `LeadMonth`,
`LeadAreas`, `LeadMinPrice`, `LeadMaxPrice`, `LeadMinBedrooms`,
`LeadMaxBedrooms`, `LeadMinBathrooms`, `LeadMaxBathrooms`, `LeadMinYear`,
`LeadNextFollowup_mm`, `LeadNextFollowup_dd`, `LeadNextFollowup`) VALUES
('Fahad', 'Uddin', 'fahad.fuss@gmail,com', 'fahad@ff.com', '3242342',
'karachi', '3234asdasd.karachi', '74600', '222', '32432', '23', '232',
'232', '23', '232', '323', '323', '232', '23232', '3232', '232', '23232');
Thanks in advance.
Friday, 30 August 2013
Python : using mod_wsgi ( environ ) : " LoL, the people on unix.stackexchange don't know i'ma troll - check out this answer i got ' [on...
Python : using mod_wsgi ( environ ) : " LoL, the people on
unix.stackexchange don't know i'ma troll - check out this answer i got '
[on...
After the environ stuff in mod_wsgi
we are ready to start our search engine
and rule the world.
here's the link to unix.stackexchange question asked
http://unix.stackexchange.com/questions/88952/the-command-ls-ltu-fails-to-list-folders-files-based-on-last-accessed-time
unix.stackexchange don't know i'ma troll - check out this answer i got '
[on...
After the environ stuff in mod_wsgi
we are ready to start our search engine
and rule the world.
here's the link to unix.stackexchange question asked
http://unix.stackexchange.com/questions/88952/the-command-ls-ltu-fails-to-list-folders-files-based-on-last-accessed-time
Thursday, 29 August 2013
How to call code behind method from a javascript function?
How to call code behind method from a javascript function?
I am having an javascript function for a HTML img click event in aspx
page. And a server Method in its code behind page.Now I want to call the
server method from the javascript function without any parameter only when
the HTML img is clicked by the user.
C# Code Behind Method:
[WebMethod]
public void PopUpClick(object sender, EventArgs e)
{
//Something;
}
JavaScriptMethod:
$(document).ready(function () {
$('.clickme').click(function () {
PageMethods.PopUpClick();
});
});
Also I added into the master page: <asp:ScriptManager ID="ScriptManager1"
runat="server" EnablePartialRendering="true" EnablePageMethods="true" />
It is not working.When I debugging this Javascript function on the Chrome
I saw an error:Uncaught Reference Error:PageMethods is not defined.
Can anyone help me on this ?. Thanks in advance.
I am having an javascript function for a HTML img click event in aspx
page. And a server Method in its code behind page.Now I want to call the
server method from the javascript function without any parameter only when
the HTML img is clicked by the user.
C# Code Behind Method:
[WebMethod]
public void PopUpClick(object sender, EventArgs e)
{
//Something;
}
JavaScriptMethod:
$(document).ready(function () {
$('.clickme').click(function () {
PageMethods.PopUpClick();
});
});
Also I added into the master page: <asp:ScriptManager ID="ScriptManager1"
runat="server" EnablePartialRendering="true" EnablePageMethods="true" />
It is not working.When I debugging this Javascript function on the Chrome
I saw an error:Uncaught Reference Error:PageMethods is not defined.
Can anyone help me on this ?. Thanks in advance.
Wednesday, 28 August 2013
How can I enable http auth in lighttpd for multiple users?
How can I enable http auth in lighttpd for multiple users?
At the time, authentication is done using the Domain Admins group, based
on the ldap. However, I need to create 2 more users who are not
administrators to just viewing my reports sarg:
auth.backend = "ldap"
auth.backend.ldap.hostname = "localhost"
auth.backend.ldap.base-dn = "ou=Admins,ou=users,dc=innovata,dc=intraer"
auth.backend.ldap.filter = "(uid=$)"
auth.require = ( "/sarg" =>
( "method" => "basic",
"realm" => "SARG",
"require" => "valid-user"
)
)
At the time, authentication is done using the Domain Admins group, based
on the ldap. However, I need to create 2 more users who are not
administrators to just viewing my reports sarg:
auth.backend = "ldap"
auth.backend.ldap.hostname = "localhost"
auth.backend.ldap.base-dn = "ou=Admins,ou=users,dc=innovata,dc=intraer"
auth.backend.ldap.filter = "(uid=$)"
auth.require = ( "/sarg" =>
( "method" => "basic",
"realm" => "SARG",
"require" => "valid-user"
)
)
try to sort arrays using compareTo() but getting error
try to sort arrays using compareTo() but getting error
public class Dog {
int size;
String name;
//Deploying a constructor
Dog(String name, int size){
this.name=name;
this.size=size;
}
//Deploying toString() for printing
public String toString(){
return name+"/"+size;
}
//Deploying compareTo() method and overriding it for int value
public int compareTo(Object s){
return (this.size-((Dog)s).size);
}
}
import java.util.Arrays;
public class CompareTo {
public static void main(String[] args){
Dog[] obj=new Dog[5];
obj[0]=new Dog("Alpha",332);
obj[1]=new Dog("Romeo",32);
obj[2]=new Dog("Charlie",332);
obj[3]=new Dog("Tyson",632);
obj[4]=new Dog("Roger",532);
//Without Sorting taking the output
for(Object x:obj){
System.out.println(x);
}
//With Sorting taking the output
try{Arrays.sort(obj);
for(Object x: obj){
System.out.println(x);
}
}catch(Exception e){
System.out.println("Something is wrong in this line"+e);
}
}
}
Output-Alpha/332
Romeo/32
Charlie/332
Osama/632
Laden/532
Something is wrong in this linejava.lang.ClassCastException: Dog cannot be
cast to java.lang.Comparable
Hi, I was trying to short the Dog object on the basis of size of the dogs.
I downcast object x of supermostclass to Dog class but don't know why at
runtime java is executing the try and catch block saying that Dog can't be
cast to java.lang.Comparable
public class Dog {
int size;
String name;
//Deploying a constructor
Dog(String name, int size){
this.name=name;
this.size=size;
}
//Deploying toString() for printing
public String toString(){
return name+"/"+size;
}
//Deploying compareTo() method and overriding it for int value
public int compareTo(Object s){
return (this.size-((Dog)s).size);
}
}
import java.util.Arrays;
public class CompareTo {
public static void main(String[] args){
Dog[] obj=new Dog[5];
obj[0]=new Dog("Alpha",332);
obj[1]=new Dog("Romeo",32);
obj[2]=new Dog("Charlie",332);
obj[3]=new Dog("Tyson",632);
obj[4]=new Dog("Roger",532);
//Without Sorting taking the output
for(Object x:obj){
System.out.println(x);
}
//With Sorting taking the output
try{Arrays.sort(obj);
for(Object x: obj){
System.out.println(x);
}
}catch(Exception e){
System.out.println("Something is wrong in this line"+e);
}
}
}
Output-Alpha/332
Romeo/32
Charlie/332
Osama/632
Laden/532
Something is wrong in this linejava.lang.ClassCastException: Dog cannot be
cast to java.lang.Comparable
Hi, I was trying to short the Dog object on the basis of size of the dogs.
I downcast object x of supermostclass to Dog class but don't know why at
runtime java is executing the try and catch block saying that Dog can't be
cast to java.lang.Comparable
Subscribe to:
Posts (Atom)