Is there anybody who can help me making pixels of an png picture transparant, such like: MakePixelTransparant(const png:TPngImage; x,y:integer; perc:integer); and what else do I have to do to makes thinks works (with values do i have to change to make the png object transparant, so i can use it in for example PhotoShop).
Thanks, John Duinmeijer.
Suppose I have a string that contains '¿'. How would I find all those unicode characters? Should I test for their code? How would I do that?
I want to detect it to avoid sax parser exception which I am getting it while parsing the xml
saved as a clob in oracle 10g database.
Exception
javax.servlet.ServletException: org.xml.sax.SAXParseException: Invalid byte 1 of 1-byte UTF-8 sequence.
Hi all:
I've been trying to do as the client requested : redirect to campaign page then to destination page once a customer clicks on the top banner in swf format.
You can check what's been done at :http://ausdcf.org
If you are using Firefox, Chrome or Safari, I suspect you can reach the destination page.
However, if you are using IE or Opera, I doubt it.
I think to cause of such a weird problem is:
The swf ojbects don't have a link to url, SO
I have to hack the theme template file like this :
<div id="header">';
/*
* A quick and dirty way to put some swf into PHP, and rotate among them ...
*/
//available banners
$banners = array(
'http://localhost/smf/flash/banner_fertalign_1.swf',
'http://localhost/smf/flash/banner_fertalign_2.swf',
'http://localhost/smf/flash/banner_fertalign_3.swf'
);
//get random banner
srand((double) microtime() * 1000000);
$rand = rand(0,count($banners)-1);
echo '<div id="top_banner_clickable">';
echo '<div id="top_banner_wrapper">';
echo '<object width="400" height="60">';
echo '<param name="wmode" value="transparent">';
echo '<embed wmode="transparent" src="'.$banners[$rand].'" ';
echo 'width="400" height="60" type="application/x-shockwave-flash"';
echo 'pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" />';
echo '</object>';
echo '</div>';
echo '</div>';
And the related jQuery code is like this:
/* master.js */
$(document).ready(function()
{
$("#top_banner_clickable").click(function()
{
window.location ="http://ausdcf.org/campaign/";
});
});
I absolutely know nothing about Flash or embedded objects. I guess that's the cause of this problem. Plus, I don't know why it works with some browsers but not all...
I even tried to add a z-index to the wrapper div in css like this:
#top_banner_clickable
{
z-index : 100;
}
No this wouldn't do, either...
Is there a way to go around this issue?
Many thanks in advance.
I want to break the following string at the word To and then truncate the email address that follows at 15 characters using JavaScript. This is the sentence:
Please email this card to[email protected]
It should like like this:
Please email this card
to email@emailadd...
I neet access to current object in a static method.
Code:
protected static $name;
public static function name($modulename)
{
self::$name = $modulename;
}
public function __call($name, $arguments)
{
$me = new test(self::$name);
return $me->$name($arguments);
}
I want to be able to call method log in Log class. Like this
echo Mods::name("Log")->log("test");
How do i do that?
Hi, hereafter is my piece of code that I want to simplify in order to avoid passing an extra argument on each call :
module M
def do_something(context)
puts "Called from #{context}"
end
module_function :do_something
end
class Foo
def do_stuff
M.do_something(self)
end
end
Foo.new.do_stuff
Is there a way to do the same think without passing 'self' as an input argument to 'do_something' method like this ?
module M
def do_something
puts "Called from #{method that returns caller object}"
end
module_function :do_something
end
class Foo
def do_stuff
M.do_something
end
end
Foo.new.do_stuff
Thanks for your support!
Is there a way to convert a date to a string in Sqlite? For example I am trying to get the min date in Sqlite:
SELECT MIN(StartDate) AS MinDate FROM TableName
I know in SQL Server I would use the SQL below to accomplish what I am trying to do:
SELECT CONVERT(VARCHAR(10), MIN(StartDate), 101) AS MinDate FROM TableName
Thanks!
Hi,
My rails application requires few values to be specified in the text box.
My web page contains few text boxes .How can i specify the values of these text boxes in the url as query string while using webrick?can any one help, am new to this.
Thanks in advance.
hi guys,
i am wondering is there a convenient function in rails to convert string with negative signs into a number. e.g. -1005.32
when i use to_f method, the number will simply become 1005 with the negative sign and decimal part being ignored.
thanks in advance!
Say you have data in the format:
name=john;age=33;gender=male
How would you call a method that converts data like that into an an object / associative array?
I've been thinking about:
- unserialize_variables
- parse_variables
I have an object of type Hash that I want to loop over via hash.each do |key, value|. I would like to get the number of times I've been through the loop starting at 1.
Is there a method similar to each that provides this (while still providing the hash key/value data), or do I need to create another counter variable to increment within the loop?
how can i access state varibale of class keyboard with object of class kalaplayer
/**
* An abstract class representing a player in Kala. Extend this class
* to make your own players (e.g. human players entering moves at the keyboard
* or computer players with programmed strategies for making moves).
*/
public abstract class KalaPlayer
{
/**
* Method by which a player selects a move.
* @param gs The current game state
* @return A side pit
number in the range 1-6
* @throws NoMoveAvailableException if all side pits for the player are empty
* (i.e. the game is over)
*/
public abstract int chooseMove(KalaGameState gs) throws NoMoveAvailableException;
}
public class KeyBoardPlayer extends KalaPlayer {
/**
* Method by which a player selects a move.
* @param gs The current game state
* @return A side pit number in the range 1-6
* @throws NoMoveAvailableException if all side pits for the player are empty
* (i.e. the game is over)
*/
public KalaGameState state;
public KeyBoardPlayer()
{
System.out.println("Enter the number of stones to play with: ");
try
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int key = Integer.parseInt(br.readLine());
state=new KalaGameState(key);
//key=player1.state.turn;
}
catch(IOException e)
{
System.out.println(e);
}
}
public int chooseMove(KalaGameState gs) throws NoMoveAvailableException{
return 0;
}
}
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class KalaGame {
KalaPlayer player1,player2;
public KalaGame(KeyBoardPlayer Player1,KeyBoardPlayer Player2)
{ //super(0);
player1=new KeyBoardPlayer();
player2 = new KeyBoardPlayer();
//player1=Player1;
//player2=Player2;
//player1.state ****how can i access the stae variable from Keyboard CLass using object from KalaPlayer
key=player1.state.turn;
}
public void play()
{
System.out.println("Enter the number of stones to play with: ");
try
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int key = Integer.parseInt(br.readLine());
System.out.println(key);
KalaGameState state=new KalaGameState(key);
printGame();
}
catch(IOException e)
{
System.out.println(e);
}
}
I have a method that returns a resource fully hydrated when the db is SQLite but when the identical code is used by SqlServer the object is not fully hydrated. I'll explain that with the code after some brief background.
I my domain various otherwise unrelated things like an Employee or a Machine can be used as a Resource that can be allocated to. In the object model an example of this would be:
/// <summary>Wraps a <see cref="StaffMember"/> in a <see cref="ResourceBase"/>. </summary>
public class StaffMemberResource : ResourceBase
{
public virtual StaffMember StaffMember { get; private set; }
public StaffMemberResource(StaffMember staffMember) {
Check.RequireNotNull<StaffMember>(staffMember);
base.BusinessId = staffMember.Number.ToString();
base.Name = staffMember.Name.ToString();
base.OrganizationName = staffMember.Department.Name;
StaffMember = staffMember;
}
[UsedImplicitly]
protected StaffMemberResource() { }
}
And in the db tables, there is a table per class inheritance where the ResourceBase has a discriminator and the id of the actual resource (ie, StaffMember)
StaffMember - 1 ---- M- ResourceBase - 1 ----- M - Allocation
The Code
public override StaffMemberResource BuildResource(IActivityService activityService) {
var sessionFactory = _GetSessionFactory();
var session = sessionFactory.GetCurrentSession();
StaffMemberResource result;
using (var tx = session.BeginTransaction()) {
var propertyName = ExprHelper.GetPropertyName<StaffMember>(x => x.Number);
var staff = session.CreateCriteria<StaffMember>()
.Add(Restrictions.Eq(propertyName, new EmployeeNumber(_testData.Resource_1.BusinessId)))
.UniqueResult<StaffMember>();
if (staff == null) {
... build up a staff member
result = new StaffMemberResource(staff);
}
else {
//////////
var property = ExprHelper.GetPropertyName<StaffMemberResource>(x => x.StaffMember);
result = session.CreateCriteria<StaffMemberResource>()
.Add(Restrictions.Eq(property, staff))
.UniqueResult<StaffMemberResource>();
}
///////////
tx.Commit();
}
return result;
}
It's that second criteria query that works "properly" with SQLite but not with SqlServer. By properly I mean that the employee numer is translated into a ResourceBase.BusinessId, Name is flattened out into a ResourceBase.Name, etc.
Does anyone know why this might be?
Cheers,
Berryl
Is Refactor Pro the only .NET Refactoring tool that supports the Stringto StringBuilder refactor?
I'm looking for one that has a trial version of this feature to see if I like it enough to purchase. The overall goal is to tidy up another developer's VB.NET code.
How to validate a substring is true in PHP for example if user1 is in the string it should be true?
textfile:
user1 : pass1
user2 : pass2
user3 : pass3
if(in_array($_SERVER['user1'] . "\r\n", $textfile)){ //not the way want this to be true
printf("Ok user1 is in this row somewhere");
}
Working with COM interop, I can call a managed function from within unmanaged code.
But, this only gives me the HRESULT for the exception, in case a managed exception is thrown.
Is there anyway to further inspect the exception from the unmanaged code? For example, to look at the message contained in the exception object.
Thanks!
I have no clue how to validate this string. I am simply supplying an IV for an encryption, but can find no "is_hex()" or similar function, I can't wrap my head around it! I read on a comment in the php documentation (user contrib. notes) this:
if($iv == dechex(hexdec($iv))) {
//True
} else {
//False
}
But that doesn't seem to work at all.. It only says false.
If it helps my input of my IV would be this:
92bff433cc639a6d
I'm trying link 40 buttons to one event handler method and then do the
processing work from one method instead of 40. I know how to link it
but once I get there I don't know how to distinguish what button was
pressed. Does anyone know how to reference the button object sender id
or is there another way to solve this problem?
Any help would be greatly appreciated.
Is it possible... when the debugger is stopped at a breakpoint, to modify the value of a std::string variable without resorting to hacks like tweaking the memory image of the current buffer?
e.g. something like "set var mystring="hello world"
?
the Text property of control on winform is always string type, so if i wanna expose property of other type for custom control, i have to do the conversion as following, if i have dozens of properties to expose, it will be such pain for me.
public int ImageGroupLength
{
get
{
return int.Parse(this.imageGroupLength.Text);
}
set
{
this.imageGroupLength.Text = value.ToString();
}
}
so, is there any elegant way to do the conversion?