w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
CakePHP 2.x custom "Authentication adapter "LdapAuthorize" was not found
I think your App::uses() is wrong so it can't find the class. Your current code: App::uses('LdapAuthroize', 'Controller/Component/Auth/LdapAuthorize'); Is trying to find Controller/Component/Auth/LdapAuthorize/LdapAuthroize.php The first parameter is the class name (you have a typo with that), the second is just the path to the directory containing the class, you don't need to add the class name again. Try this: App::uses('LdapAuthorize', 'Controller/Component/Auth');

Categories : Cakephp

Sending JSON data as context quotes becoming "?
I think you can use autoescape tag in your template to not escape the quotes # sessionscheduler.html {% autoescape off %} {{ your_string }} {% endautoescape %}

Categories : Javascript

Jsoup emits " entity in text nodes
public boolean prettyPrint() Get if pretty printing is enabled. Default is true. If disabled, the HTML output methods will not re-format the output, and the output will generally look like the input. To tell JSoup not to re-format your document, you'd simply include doc.outputSettings().prettyPrint(false); JSoup API - Class Document.OutputSettings

Categories : Java

How to get rid off indentation and how can i tell Simple xml framework, not to convert " to " while serializing object
Isn't xml meant to do so? I don't know any option to disable this. But as a workaround you may implement a Transform, which (un-)escapes your quoutes. Edit: Possible the org.simpleframework.xml.stream.Formatter class can help you. This will escape those sequences. But not sure if you can customize it per code or you have to work on source-level. Disable indention: Serializer ser = new Persister(new Format(0)); Will set indention count to 0. Please see Format.

Categories : Java

How to write a VBA macro using the web page's source code
If you're looking to display the HTML on your spreadsheet, you can try something like the following. Dim IE as Object Dim Doc as Object Sub DisplayMyInfo() InitializeIE("http://www.ILoveMyPrinter.com") ActiveWorksheet.Range("A1") = ReturnOuterHTML("SupplyPLR0") ActiveWorksheet.Range("A2") = ReturnOuterHTML("SupplyPLR1") ActiveWorksheet.Range("A3") = ReturnOuterHTML("MachineStatus") ActiveWorksheet.Range("A4") = ReturnOuterHTML("BlackCartridge1-EstimatedPagesRemaining") Set Doc = Nothing Set IE = Nothing End Sub Sub InitializeIE(URL as String) Set IE = CreateObject("InternetExplorer.Application") IE.Navigate URL Do While IE.ReadyState <> 4 DoEvents Loop Set Doc = IE.Document End Sub Function ReturnOuterHTML(NodeID as String) Dim strHTML as String strHTML = Doc.GetElementByID(Nod

Categories : Excel

Dragging the button navigates to the next page how I can write the code?
To navigate function dragUser(el){ window.loaction ='write the url here'; } This is stop navigation add href="javascript:void(0)" <a href="javascript:void(0)" draggable="true" class="user" id="leonardo" ondragstart="dragUser(this, event)" aria-selected="undefined"> IPD</a>

Categories : Javascript

How to make "document.write" in an if statement work on the same html page rather than a new blank page?
This has nothing to do with being in an if statement, it has to do with using document.write when the document is in a closed state. Using it then will open a new document to write to. There is no way around that. Use DOM manipulation instead of document.write.

Categories : Javascript

how to run method in master page before execute child page code in IsPostBack?
You need to have a look at the ASP.NET Webforms page lifecycle in order to understand what happens when. Here is some docs regarding that: http://msdn.microsoft.com/en-us/library/ms178472(v=vs.100).aspx#lifecycle_events The problem you have at the moment is that the Button click event happens after the Page_Load event, so when you click the button you probably experience that Label1.Text is one click "behind". Look at the docs and place the Label1.Text assignment in PreRender for example. Like @ArabicProgrammer is answering, it is better yet to actually make use of the Culture support that is available in the .NET Framework. If you use that method instead, you can display the language using something like this. <%= System.Threading.Thread.CurrentThread.CurrentCulture.DisplayName %

Categories : C#

Unicode signs shown on development page, but not on actual page with same code
Try putting this in your <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> Also, try changing the de-DE in the <html> tag to <html lang="de" prefix="og: http://ogp.me/ns#"> let me know if that works

Categories : CSS

how to write code for dialog box when we click on exit and code for dialog xml in android?
I hope this helps. public void onClick(View v) { new AlertDialog.Builder(YOUR_ACTIVITY) .setMessage("Are you sure?") .setCancelable(true) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { finish(); } }).setNegativeButton("No", null).show(); }

Categories : Android

Adding JavaScript Code to A Single Page in Joomla (Google Remarketing Code)
You could use a module which allows to run custom code in it. There are several solutions to this in the JED: http://extensions.joomla.org/extensions/core-enhancements/coding-a-scripts-integration/custom-code-in-modules

Categories : Javascript

AJAX code for calling code-behind method from aspx page doesn't work
try this: in your anchor do this: <a href="javascript:void(0)" id="kontakt">Go to Kontakt</a> and modify your ajax script to this: $('a').click(function (e) { var data = { 'id': $(this).attr("id") }; var dataVal = JSON.stringify(data); $.ajax({ type: "POST", url: "Default.aspx/loadNewPage", contentType: "application/json; charset=utf-8", data: dataVal, dataType: "json", success: function (id) { } }); });

Categories : Javascript

node.js page in different tabs shows the same page source code
Yes, it's because your browser caches page sources and when you are trying to view it, shows the latest loaded page. If you add some logging, you'll understand what i mean. http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); res.write('<p>' + Math.random() + '</p>'); res.end(); console.log('Message has been sent'); }).listen(3000); When you open your page in new tab, you can see in console that browser loads new version of it. But when you trying to view the source browser doesn't load anything. If you want to avoid this behaviour, try to reload the source, after you open it.

Categories : Node Js

generate code using form button and then display generated code on page
You can use tag to show HTML entities You need to encode all Your HTML entities like < => < like way. Also you can show a text area in which all those HTML code need to echo, it will not execute your code simply it will print it.

Categories : PHP

How to get source code after simulate web page button click in code
A hacky approach would be to: Attach an event handler to the 'onclick' event of the button. Then, once the event is triggered, use the Microsoft Internet Controls (SHDocVw) type library in order to get the last URL opened in IE. Lastly, navigate to the URL and once the document is loaded, get the source of the document from the webBrowser1.DocumentText property. In your project, add a reference to the Microsoft Internet Controls type library (you'll find it in the COM tab). Add at the top of your file: using SHDocVw; The code: webBrowser1.Navigate(url); while (webBrowser1.ReadyState != WebBrowserReadyState.Complete) { Application.DoEvents(); } // assign the button to a variable var button = webBrowser1.Document.GetElementById("downloadButton"); // attach an event handler for

Categories : C#

Write code into VBA IDE from .NET
I assume you've figured this out already, but just in case: The VBE object tree is exposed through automation - just get the application object for whatever Office file you're dealing with via a CreateObject call, then do the same thing you did in VBA (with appropriate changes from VB6 to .net, obviously). exl = CreateObject("Excel.Sheet") exl.Application.Workbooks.Open("whatever.xlsx") 'exl.Application.VBE.ActiveVBProject etc etc

Categories : Vb.Net

C# Code only getting pagesource for visible page, not for scrolled down page
using HtmlAgilityPack; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication5 { class Program { static void Main(string[] args) { WebClient wc = new WebClient(); var sourceCode = wc.DownloadString("http://dota-trade.com/equipment?order=name"); HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(sourceCode); var node = doc.DocumentNode; var nodes = node.SelectNodes("//a"); List<string> links = new List<string>(); foreach (var item in nodes) { var link = item.Attributes["href"].Value; links.Add(link.Contains("h

Categories : C#

insert html code to a page via php script in other page
As Filippo Toso said, you may include the HTML file in your code.php. Perhaps, if you don't want to have two files, you may make only one file and set the form to act like that: <form id="createNewGallery" name="newgallery" method="GET" action="./"><p><strong>please choose the number of pictures you want to upload: </strong> <select name="numOfPictures" id="numOfPictures"> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> </select></p> <input name="submitNumOfPictures" type="submit" /> <

Categories : PHP

how to write this code in right way in javascript
Without changing your html, you could do this: $("#wedding, #homecoming, #ourstory, #weddingcrew").click(function() { // remove menuclick class from all elements that currently have it $(".menuclick").removeClass("menuclick"); // now add menuclick just to elements associated with the clicked item $("." + this.id).find("div").andSelf().addClass("menuclick"); }); This depends on the fact that your element ids are exactly the same as the corresponding classes on the elements they're associated with. If you could add a common class, say class="menu" to the #wedding, #homecoming, etc. items then you could simplify the initial selector to $(".menu"). P.S. If you're using jQuery v1.8 or later use .addBack() instead of .andSelf().

Categories : Javascript

Is there a shorter way for me to write this code?
In your case you can select all even childs + the 7th child tr td:first-child, tr td:nth-child(even), tr td:nth-child(7) {} Edit: ah I missed the 2nd child, maybe you can overwrite it again... whatever shorter in pure css is not possible I think

Categories : HTML

How to write an api for my python code
Your question may be too open for stackoverflow. So you want to provide a web API. Simpleapi goal matches your question: the short description reads simpleapi is an easy to use, consistent, transparent and portable way of providing an API. It supports several transport formats (e. g. json, jsonp, xml, yaml) and provides server (django, flask) and client libraries (PHP, Python) to interact seamlessly. You can also use nearly every Ajax framework (e. g. jQuery, ExtJS, etc.) to access the API. What you're interested in is the server side (provides the API, while the client side uses it). I think you should learn about Rest APIs. A simple search gave me those and those guidelines.

Categories : Python

how to write php code to a file with php
You're missing your closing PHP tag ?>. Consider for a moment that what you are doing might not be the best approach anyway. The only use case I can think of for writing out PHP files with PHP would be for some compiled template code or weird caching.

Categories : PHP

stemming. i need to write a code for this
I see two options. Either this is a homework question, in which case - please try to solve your own homework. The other case - you need this in real life. If so, please look at NLTK for Python natural language processing needs. In particular see http://nltk.org/api/nltk.stem.html

Categories : Python

How can i write better my jquery code?
Do this: h = parseInt(h); queryString = "#service"+h; $(queryString).show(); It is easier to construct a string given whatever h is rather than have to handle each one individually. The concatenation in the second line is handled automatically because of automatic type detection. That will get rid of almost all your if's and else's.

Categories : Jquery

I want to write the following code in GAWK?
gawk 'NR <= 10 { x=1; len = length($0); for (i = 1; i < len; i++) if (substr($0, i, 1) ~ /[FLDT]/) x *= 2; print x }' Untested, therefore probably not quite correct. The substr line is the most likely problem line; it extracts one character at a time from $0 (hardly the epitome of efficiency) and then compares it with the regex. You could consider n = gsub(/[FLDT]/, 'X') which gives a count of the substitutions it makes (and hence of the number of [FLDT] characters in the line) and then multiply x appropriately. The NR <= 10 condition deals with the first ten lines only.

Categories : Python

How to NOT write file_put_contents on EVERY page load
I'm really confused about why you would do this at all. First, Joomla has a way to save parameters for a template and to use them, which you are doing. It also has a standard way to include a css file in your template. You can do this easily with a plugin if you don't want to addStyle() directly to the the template file. Also for google font api just look at how protostar does it. I really think you need to look at how templates work in Joomla --- it's not modifying the core to modify your template index unless you are using one of the included templates --- in which case copy it, which you can do with one click in 2.5 and 3. If you really absolutely have to do this, make a plugin. There are a lot of examples in the JED of plugins to include a file in a template. http://extensions.joom

Categories : PHP

write music notations on web page
Look at this Javascript api for creating sheet music using html5 canvas. http://www.vexflow.com/docs/tutorial.html Example: <canvas width=700 height=100"></canvas> UPDATED (18 March 2014) And then: var canvas = $("div.three div.a canvas")[0]; var renderer = new Vex.Flow.Renderer(canvas, Vex.Flow.Renderer.Backends.CANVAS); var ctx = renderer.getContext(); var stave = new Vex.Flow.Stave(10, 0, 500); // Add a treble clef stave.addClef("treble"); stave.setContext(ctx).draw(); var notes = [ // Dotted eighth E## new Vex.Flow.StaveNote({ keys: ["e##/5"], duration: "8d" }). addAccidental(0, new Vex.Flow.Accidental("##")).addDotToAll(), // Sixteenth Eb new Vex.Flow.StaveNote({ keys: ["eb/5"], duration: "16" }). addAccidental(0, n

Categories : Javascript

Write simple rails code better
What about: tags = params[:station][:tag_ids].split(',') params[:station][:tag_ids] = tags.each_with_object([]) do |tag, array| array << tag.start_with?('xxx_') ? Tag.create(name: tag[4..-1]).id : tag end

Categories : Ruby On Rails

how can i write code to lerp between three colors?
the Gradient is what you need > http://docs.unity3d.com/Documentation/ScriptReference/Gradient.html the page already provides a good explanation. you can even lerp more than 3 colors :)

Categories : Unity3d

How to write to Excel using MVC and EF Code First - Best Practices
You need to create your Excel to a byte[] or a Stream using a library like EPPlus. Then you can serve this using the FileActionResult: public ActionResult CreateExcel() { var data=_repository.GetExcelData(); byte[] excel=CreateExcelAsByteArray(data); return File(excel, "application/vnd.ms-excel", "excel.xlsx"); } With this method you can serve a dinamically created Excel file. Update: To create the excel file you can use EPPlus: public byte[] CreateExcelAsByteArray(IEnumerable<int> elems) { using(var ms=new MemoryStream()) using(var package=new ExcelPackage()) { var ws = package.Workbook.Worksheets.Add("worksheet"); int i=1; foreach(var elem in elems) { ws.Cells("A"+i).Value=elem; i++; }

Categories : Asp Net Mvc

When should I write code in the controller vs. model?
Code to access the database should be in service layer instead of keeping in Controller or Model. Accessing Database Entities from Controller Here is my answer for the above question, you can also read others answers why you should keep in separate layer. namespace MyProject.Web.Controllers { public class MyController : Controller { private readonly IKittenService _kittenService ; public MyController(IKittenService kittenService) { _kittenService = kittenService; } public ActionResult Kittens() { // var result = _kittenService.GetLatestKittens(10); // Return something. } } } namespace MyProject.Domain.Kittens { public class Kitten { public string Name {get; set; } public string Url {ge

Categories : C#

where can I write the java code in fragments?
You can write within onCreateView() public class fragmentname extends Fragment{ Activity referenceActivity; View parentHolder; Button backBtn; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { referenceActivity = getActivity(); parentHolder = inflater.inflate(R.layout.yourlayout, container, false); backBtn = (Button) parentHolder.findViewById(R.id.back_btn); backBtn.setOnClickListener(new OnClickListener() { public void onClick(View v) { } }); return parentHolder; } }

Categories : Android

How do I write Query code while I use Jquery in PHP
you are getting the first error since the javascript code should be inside the <script> tag and not outside it.. try this.. <script type="text/javascript"> //notice the </script> tag is shifted to the end of javascript code function get() { $.post ('data.php', { word: form.name.value }, function (output) { $('#defination') .html(output).show() ; }); } </script> and other few errors in data.php $name = mysql_real_escape_string($_POST['word']); if ($name==NULL) //<----here $word = $name echo "Please enter a Word </td></tr>"; //close the tr and td else { and you can end and start the php tag again <?php $username = "root"; $passwor

Categories : PHP

Is there a way I can write this Haskell code in Scala?
How about this: val double = (_: Int) * 2 Note Here double is a Function rather than a method. In your first example, you have defined a method named double with return type of Function. In your second example, your just have defined a method. Function is different from method in Scala. In case the compiler can get the type information, we can write the Function even simple: scala> def apply(n: Int, f: Int => Int) = f(n) apply: (n: Int, f: Int => Int)Int scala> apply(10, 2*) res1: Int = 20 scala> apply(10, 100+) res2: Int = 110

Categories : Scala

What should I do when I am forced to write unreachable code?
The compiler cannot tell that your foreach loop will always return a value. A theoretical compiler could do so since in principal the information is available, but the C# compiler cannot.

Categories : C#

How to write a javascript tracking code?
I would suggest to use jQuery ajax features. Comes with good documentation and examples. You can send stuff synchronously or asynchronously, via GET, POST etc. See the linked documentation.

Categories : Javascript

Write ruby code in string
you are most probably in an erb template so you have to do the following <a href="#" data-dropdown="drop<%= f.id %>" class="tiny button dropdown expand"> <%= f.beschreibung %> </a>

Categories : Ruby On Rails

Write filesystem-dependent code in c++
I'm not aware of any information that the preprocessor would give you on this. Something to keep in mind is that you might be in a situation where the OS supports multiple types of filesystems. It's not inconceivable that an application might be accessing multiple filesystems at the same time on the same box.

Categories : C++

How to write html code inside
Try it like, <?php $name='your name'; echo '<table> <tr><th>Name</th></tr> <tr><td>'.$name.'</td></tr> </table>'; ?> Updated <?php echo '<table> <tr><th>Rst</th><th>Marks</th></tr> <tr><td>'.$rst4.'</td><td>'.$marks4.'</td></tr> </table>'; ?>

Categories : PHP

how to write the code for download button in ASP.net
try th above byte[] data = File.ReadAllBytes(WDriveFilePath) FileStream file = File.Create(HttpContext.Current.Server.MapPath(MyLocalFile)); file.Write(data, 0, data.Length); file.Close();

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.