load

How do I load an image from a DB inside a JSF page using managed beans?

孤者浪人 提交于 2019-12-30 00:48:08
问题 I have a database with some images. Could anyone explain me how I could load an image in a JSF page? I already have a managed bean that converts an Image object into a streamcontent. This streamcontent is called from the page in a tag <h:graphicImage> , but when I check the source code of the page, there's no src where the image could be loaded. 回答1: The JSF <h:graphicImage> get rendered as a HTML <img> element. Its src attribute should point to an URL, not to the binary contents. So you

Why is Python giving me “an integer is required” when it shouldn't be?

ぐ巨炮叔叔 提交于 2019-12-29 07:42:26
问题 I have a save function within my Python program which looks like this: def Save(n): print("S3") global BF global WF global PBList global PWList print(n) File = open("C:\KingsCapture\Saves\\" + n + "\BF.txt", "w") pickle.dump(BF, File) File = open("C:\KingsCapture\Saves\\" + n + "\WF.txt", "w") pickle.dump(WF, File) File = open("C:\KingsCapture\Saves\\" + n + "\PBList.txt", "w") pickle.dump(PBList, File) File = open("C:\KingsCapture\Saves\\" + n + "\PWList.txt", "w") pickle.dump(PWList, File)

Why is Python giving me “an integer is required” when it shouldn't be?

穿精又带淫゛_ 提交于 2019-12-29 07:42:09
问题 I have a save function within my Python program which looks like this: def Save(n): print("S3") global BF global WF global PBList global PWList print(n) File = open("C:\KingsCapture\Saves\\" + n + "\BF.txt", "w") pickle.dump(BF, File) File = open("C:\KingsCapture\Saves\\" + n + "\WF.txt", "w") pickle.dump(WF, File) File = open("C:\KingsCapture\Saves\\" + n + "\PBList.txt", "w") pickle.dump(PBList, File) File = open("C:\KingsCapture\Saves\\" + n + "\PWList.txt", "w") pickle.dump(PWList, File)

jQuery appending to AJAX loaded SVG problem

给你一囗甜甜゛ 提交于 2019-12-29 05:28:06
问题 I am successfully loading via AJAX some svg from external file: $("#svg").load(svgUrl + " svg", function() { // do stuff }); My HTML looks like that: <div id="svg" ...> <svg ...> ... </svg> </div> I can see the graphics just fine. Now I want to add some additional svg elements to the loaded svg. I changed my script to: $("#svg").load(svgUrl + " svg", function() { $("svg").append("<g id='compass'></g>"); // do stuff }); For some reasons the added element appears as hidden in firebug and no

Get the url of currently executing js file when dynamically loaded

喜欢而已 提交于 2019-12-29 05:23:26
问题 So I'm trying to load a script dynamically and figure out the URL path at which that script was loaded. So some guy gave me a pretty awesome solution to this problem if the scripts are statically loaded ( How to get the file-path of the currently executing javascript code ). But I need a dynamically loaded solution. For example: $(function() { $.getScript("brilliant.js", function(data, textStatus) { // do nothing }); }); where "brilliant.js" has: var scripts = document.getElementsByTagName(

Load and execute javascript code SYNCHRONOUSLY

寵の児 提交于 2019-12-29 03:18:15
问题 Is there a way to load and execute a javascript file in a synchronous way just like a synchronous XMLHttpRequest? I'm currently using a sync XMLHttpRequest and then eval for this, but debugging that code is very difficult... Thanks for your help! Update I tried this now: test.html <html> <head> <script type="text/javascript"> var s = document.createElement("script"); s.setAttribute("src","script.js"); document.head.appendChild(s); console.log("done"); </script> </head> <body> </body> </html>

Load and execute javascript code SYNCHRONOUSLY

房东的猫 提交于 2019-12-29 03:18:09
问题 Is there a way to load and execute a javascript file in a synchronous way just like a synchronous XMLHttpRequest? I'm currently using a sync XMLHttpRequest and then eval for this, but debugging that code is very difficult... Thanks for your help! Update I tried this now: test.html <html> <head> <script type="text/javascript"> var s = document.createElement("script"); s.setAttribute("src","script.js"); document.head.appendChild(s); console.log("done"); </script> </head> <body> </body> </html>

jQuery load multiple html files in one element

末鹿安然 提交于 2019-12-29 00:32:12
问题 How do i load multiple html files and putting them into a specified html element? I tried with no changes: $('#asd').load('file.html,pippo.html'); 回答1: you could get multiple items and add them to the element. jQuery.ajaxSetup({ async: false }); //if order matters $.get("file.htm", '', function (data) { $("#result").append(data); }); $.get("pippo.htm", '', function (data) { $("#result").append(data); }); jQuery.ajaxSetup({ async: true }); //if order matters 回答2: Try this, using deferred

jQuery .load() with fadeIn effect

你说的曾经没有我的故事 提交于 2019-12-28 06:27:35
问题 I'm trying to load #content of a url via AJAX using jQuery within #primary. It loads but doesn't fadeIn. What am I doing wrong? $('.menu a').live('click', function(event) { var link = $(this).attr('href'); $('#content').fadeOut('slow', function(){ $('#primary').load(link+' #content', function(){ $('#content').fadeIn('slow'); }); }); return false; }); Many thanks for your help. 回答1: Actually I was able to do it by applying the effect to the wrapper div instead... $('#primary').fadeOut('slow',

How to do recursive load with Entity framework?

戏子无情 提交于 2019-12-28 05:43:05
问题 I have a tree structure in the DB with TreeNodes table. the table has nodeId, parentId and parameterId. in the EF, The structure is like TreeNode.Children where each child is a TreeNode... I also have a Tree table with contain id,name and rootNodeId. At the end of the day I would like to load the tree into a TreeView but I can't figure how to load it all at once. I tried: var trees = from t in context.TreeSet.Include("Root").Include("Root.Children").Include("Root.Children.Parameter") .Include