vendredi 27 juin 2014

Use a js function after another function


Vote count:

0





<div class="panel" id="home">
<video id='video1' width='630' autoplay controls>
<source id="source1" src="1_uno.mp4" type="video/mp4">
</video>
</div>


I' ve this js function that at the and of 'video1' makes the refresh of div home putting 3 buttons



var myVideo = document.getElementById("video1");
myVideo.addEventListener('ended',myHandler,false);
function myHandler(e) {
document.getElementById('home').innerHTML =
'<button type="button" style="height: 180px; width: 200px" onclick="refreshdiv("a")"> a </button><button type="button" style="height: 180px; width: 200px" onclick="refreshdiv("b")"> b </button><button type="button" style="height: 170px; width: 200px" onclick="refreshdiv("c")"> c </button>';
}


Until this part everything works good, now as u can see onclick event i do refreshdiv function:



function refreshdiv(str) {
if(str=='a'){
src='1_uno.mp4';
}
if(str=='b'){
src='2_due.mp4';
}
if(str=='c'){
src='3_tre.mp4';
}
document.getElementById('home').innerHTML = '<video id="video1" width="630" autoplay controls><source id="source1" src="'+ src +'" type="video/mp4"></video>';
}


The problem is when i click on the buttons anything happens and in chrome i got this error: Unexpected token }


All the fuction are inside:



asked 40 secs ago






Android Studio import facebook library odyssey


Vote count:

0




I am trying to use facebook login in my App using Facebook librery on Android Studio.


After following 9 tutorials about how to import that library on Android Studio 0.6.1 , all was going well (on the last tutorial) before click on clean project, after click on it I am getting this error:


C:\Users\Demetria\AndroidStudioProjects\Test\libreries\facebook\src\com\facebook\FacebookAppLinkResolver.java Error:(21, 13) error: package bolts does not exist

Error:(37, 49) error: cannot find symbol class AppLinkResolver

Error:(57, 12) error: cannot find symbol class Task

Error:(63, 42) error: cannot find symbol class Continuation

Error:(105, 83) error: cannot find symbol variable Task

Error:(192, 27) error: package AppLink does not exist


Could anyone help me please?.

Thanks in advance.



asked 45 secs ago






Ways to delimit your text in VBSCRIPT


Vote count:

0




I have a file with the following inputs


"SMEGOLD 1312",20131127,"C","11606233E","SMX","C",20131009,170028,"SMX","70207",0,1,4699,0,469.9,"USD",0,"",0,"",0,"",0,"",0,0,0,8062696,"",0,20131009,170028,"SYSTEM","25228","","166","121328200000223",785,0,"","","","","","","","","","","","",0,0,0,"",20131009,170028,"ADVMEE"


"SMEGOLD 1312",20131127,"C","11606233E","SMX","C",20131009,170030,"SMX","70207",0,1,4699,0,469.9,"USD",0,"",0,"",0,"",0,"",0,0,0,8062697,"",0,20131009,170031,"SYSTEM","25228","","167","121328200000223",786,0,"","","","","","","","","","","","",0,0,0,"",20131009,170028,"ADVMEE"


What i would like to achieve is to only obtain the first quote text of the line. Example "SMEGOLD 1312". Then i would like to append the first 3 characters and the last 4 characters of that extracted text to the back of line.


And move to the next line to carry on with the procedure till the end of the file.


Any advise will be a great help. I tried using the objRegEx.Pattern but to no avail


Thanks



asked 29 secs ago






Load-time weaving and java -jar


Vote count:

0




Is it possible to add the aspectj load-time agent when start a program with -jar ?


With Jetty, if I start



java -javaagent:aspectjweaver-1.8.0.jar -classpath toto.jar -jar start.jar


The aspectj is not apply. But I if call



java -javaagent:aspectjweaver-1.8.0.jar -classpath toto.jar;start.jar org.eclipse.jetty.start.Main


all was fine.



asked 53 secs ago






Is this usage of TBytes as a PAnsiChar "memory manager" correct?


Vote count:

0




The Simple MAPI makes memory management pretty hard unless you write a lot of pointer (PAnsiChar) allocation and deallocation code.


I like to use compiler managed data types as much as possible, so I tried to use a TList<TBytes> to store my PAnsiChar data for me:



type
TMapiEmailSender = class(TEmailSender)
private
FRecipDescs : TList<TMapiRecipDesc>;
FStrings : TList<TBytes>;
procedure AddRecipient(AClass: Cardinal; const ARecipient: string);
procedure AddRecipients(AClass: Cardinal; ARecipients: TStrings);
function GetString(const S: string): PAnsiChar;
public
constructor Create;
destructor Destroy; override;
procedure Run; override;
end;

procedure TMapiEmailSender.AddRecipient(AClass: Cardinal;
const ARecipient: string);
var
D: TMapiRecipDesc;
begin
FillChar(D, SizeOf(D), 0);
D.ulRecipClass := AClass;
D.lpszName := GetString(ARecipient);
FRecipDescs.Add(D);
end;

procedure TMapiEmailSender.AddRecipients(AClass: Cardinal;
ARecipients: TStrings);
var
Recipient: string;
begin
for Recipient in ARecipients do begin
AddRecipient(AClass, Recipient);
end;
end;

constructor TMapiEmailSender.Create;
begin
inherited Create;
FStrings := TList<TBytes>.Create;
FRecipDescs := TList<TMapiRecipDesc>.Create;
end;

destructor TMapiEmailSender.Destroy;
begin
FRecipDescs.Free;
FStrings.Free;
inherited;
end;

function TMapiEmailSender.GetString(const S: string): PAnsiChar;
var
Bytes: TBytes;
begin
Bytes := TEncoding.Default.GetBytes(S);
SetLength(Bytes, Length(Bytes) + 1);
Bytes[High(Bytes)] := 0;
FStrings.Add(Bytes);
Result := @Bytes[0];
end;

procedure TMapiEmailSender.Run;
var
Msg: TMapiMessage;
begin
try
AddRecipients(MAPI_TO, FEmail.ToRecipients);
AddRecipients(MAPI_CC, FEmail.CcRecipients);
AddRecipients(MAPI_BCC, FEmail.BccRecipients);
FillChar(Msg, SizeOf(Msg), 0);
Msg.nRecipCount := FRecipDescs.Count;
Msg.lpRecips := @FRecipDescs.ToArray[0];
// Code that uses Msg to send a MAPI message here
finally
FRecipDescs.Clear;
FStrings.Clear;
end;
end;


The code seems to be correct (this is only a fragment of the whole thing). I tried it and FastMM is not reporting any memory leaks.


I don't like that I have to resize the Result from TEncoding.Default.GetBytes() to include a trailing zero byte.


Otherwise I think the code is fine.


So the question is: Is the code correct and is it simple enough? Am I overcomplicating things?



asked 1 min ago






Log in on virtual machine from core system - Hyper-V


Vote count:

0




Is it possible to login from my core system (windows server 2012, where working hyper-v with VM - windows 7) to virtual machine ? VM has IP address from the same pool as Windows Server.


For example I want to lock my user on Windows Server, and login to Windows 7. I think that good way is create user, which has permissions only for remote desktop on my server, but I don't know if it's possible.



asked 41 secs ago






html css link into another link


Vote count:

-1




Here is my problem :


i try to add a "link" into another one... i explain : i have an image, which is INTO a link, so when i click anywhere on this image i'm redirected to the page i want... what i try to do is, to add a small "edit icon" at the top right corner of this image, so i can edit its properties on another page dedicated to this...


the fact is that i want to have this "edit icon" as a link, when i click on it i want to be redirected on another page, not the page which is the url of the main image container link...


so the code looks like this :



<a href...>
<span ... with style : size and background image so it looks like a clickable picture...>

<a href...>
<span... the second span with another background (edit icon), FLOAT RIGHT (to get it in the corner of the container span) and small sized...>
</span>
</a>

</span>

</a>


if i do things this way, the second block (edit icon) appears OUT OF the container... and if i change my order... it sometimes appears but it's not clickable... what am i doing wrong? is it impossible to make links into links? or is it a special way to do that?


thanks for help



asked 2 mins ago