w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
managing content thorugh an API and directly from a file system
If your requirements are to manage the resources from both file system and REST api then the first thing that comes to mind is that those two systems should communicate in some way. To let your REST api know that the file system changed, first I would examine what possiblities the versioning system has to post events when certain things happen (i.e. files committed). For example it seems that Subversion supports hooks that could run a java utility that would contact your REST api. For the other side of communication (the REST api notifies the file system) you would probably need to use the API of the versioning system so when a user makes an action in your application to perform the corresponding action to the file system. Here you may have more options since all versioning systems have

Categories : Java

Generate a word document in the server's file system in PHP
PHPWord can do this: http://phpword.codeplex.com/releases/view/49543 I have tried Examples/BasicTable.php, it creates the file on the server and doesn't download it. Here's the code used: <?php require_once '../PHPWord.php'; // New Word Document $PHPWord = new PHPWord(); // New portrait section $section = $PHPWord->createSection(); // Add table $table = $section->addTable(); for($r = 1; $r <= 10; $r++) { // Loop through rows // Add row $table->addRow(); for($c = 1; $c <= 5; $c++) { // Loop through cells // Add Cell $table->addCell(1750)->addText("Row $r, Cell $c"); } } // Save File $objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007'); $objWriter->save('BasicTable.docx'); ?>

Categories : PHP

How can i solve PostgreSQL JDBC org.postgresql.util.PSQLException Error:
You are missing a space between del.libelledelegationar and FROM. This is causing the query to be parsed as: SELECT ...., del.libelledelegationarFROM dossier d .... In other words it sees a column del.libelledelegationarFROM with alias dossier and when the parser then sees d it trips, because it either expects a , or FROM, so it returns an error that there is a syntax error near d.

Categories : Java

How to retrieve Postgresql Sequence-cache value from Postgresql Catalog tables?
You can query a sequence with its name as if it was a table. For example: CREATE SEQUENCE s CACHE 10; SELECT cache_value FROM s; Result: cache_value ------------- 10 (1 row) Or x SELECT * FROM s; Result: -[ RECORD 1 ]-+-------------------- sequence_name | s last_value | 1 start_value | 1 increment_by | 1 max_value | 9223372036854775807 min_value | 1 cache_value | 10 log_cnt | 0 is_cycled | f is_called | f

Categories : Postgresql

Heroku PostgreSQL Crane DB vs Linode 1GB with PostgreSQL installed
Lower Heroku plans are on a shared server partitioned into containers with LXC. The details are on Heroku's site. Your plan appears to be one of them. This can actually be a win as discussed in this question if you happen to be on an instance where other users aren't putting much load on the server. It makes your performance less predictable though. The only good way to characterize performance is to benchmark with a simulation of your production workload. Whether the RAM actually matters or not depends on your data. If your frequently accessed data and indexes fit in RAM on one machine, but not on another, then the RAM difference will make a huge difference. If the data fits in RAM on both hosts there's little benefit to adding RAM. If the hot data won't fit in RAM on either machine th

Categories : Postgresql

System.Delegate System.Reflection.MethodInfo.CreateDelegate(System.Type)
That method not exists in .net 4.5 - before then, Delegate.CreateDelegate should be used instead. It sounds to me like maybe NInject is incorrectly using that method in a 4.0 nuget package, in which case you should report that as a bug in NInject. The first thing to do is to check you are using the correct version of the dll, i.e. specifically a 4.0 build. After that, one of: roll back to an earlier NInject version upgrade your .net framework version download the code, fix it, and submit a patch

Categories : C#

Convert PDF document to Word document by programmatically without any third party tool (SSRS 2005)
There are many fundamental differences between PDF and Word making the approach you want highly undesirable as a general workflow. I'll give just one example: PDF typically does not store information about document structure - sentences, paragraphs, columns, tables... All it stores is the actual text at certain locations at a page. Word of course does have those concepts. Is it possible to do what you want? Yes, to some extent. In the general case with guesswork and approximation. If you know which information you want to convert it might be possible to search for it in the PDF file generated by SSRS and then generate a Word file out of it. However, if SSRS allows export to text, XML, RTF or any other structure based file format (however slightly structure based), you'd have a much easier

Categories : C#

Create a custom office document property that is linked to content inside the document
See comment above, but I think there may be a more reliable/controllable way of doing what you want. When the user creates one of your "bookmarks", your code can add a tag to the shape in question. In VBA, this is as simple as: oSh.Tags.Add "TagName", "Value of my tag" ' assuming oSh contains a reference to the shape you want to mark You'd use the same tag name each time but change the tag value for each shape. To jump to the tagged content, something like this (insert obligatory aircode warning here): Sub JumpToTaggedContent(sTagValue as String) Dim oSl as Slide Dim oSh as Shape For Each oSl in ActivePresentation.Slides For Each oSh in oSl.Shapes If oSh.Tags("TagName") = sTagValue Then ' you've found it ActiveWindow.View.GoToSlide(oSh.Parent.SlideIndex)

Categories : C#

Phantom
All these divs are attributable to layout panels; they are "rulers" to detect changes in "relative units" (em and ex to detect font change –there's one such div per layout widget–; and cm to detect zooming –there's only one such div for the whole application–), because you can mix units when you position your "layers" in a LayoutPanel. I think the fixedRuler (for cms) should be positioned not only at top:-20cm but also left:-20cm (or possibly right:-20cm in RTL). Would you mind filing a bug at https://code.google.com/p/google-web-toolkit/issues/entry ? (and possibly even providing the patch: http://www.gwtproject.org/makinggwtbetter.html)

Categories : Gwt

Sorry, we are unable to generate a view of the document at this time showing by google document viewer
It is getting downloaded. use this link https://docs.google.com/viewer and add the full address of the file. Then add the iframe link into your webpage. I too had the same problem but it is working fine for me now. See mine: http://microlabz.in/MyResume.php

Categories : PHP

XPath evaluation in dom4j Document created from org.w3c.dom.Document doesn't work as expected
Change your xml loading as follows: DocumentBuilderFactory docBuilderFactor = DocumentBuilderFactory.newInstance(); docBuilderFactor.setNamespaceAware(true); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();

Categories : Java

load external xml in xslt 1.0 with document() function but pass url of document as variable
I think your problem is the base of a relative URI. When the argument to document() is evaluated as a string, the base URI is the stylesheet. When the argument to document() is evaluated as a node, the base URI is the base URI of the node. You've declared the variable in a way that it is getting used as a string by the document() function: as a result tree fragment. If you declare the variable using select="some_node" instead of a child xsl:value-of then that changes the data type of the argument to the document() function, which changes the base URI of the evaluation, which may change the result. Otherwise, your first line is correct: document($variable)

Categories : Xml

Unable to auto assign Document properties from Document Set shared columns
It sounds like you need a simple event reciever, which fire on itemadded. It would then go back up the tree to find the document set. Capture which properties are marked as shared. Adjust the item that is being added to force the values. Probably 8 lines of code

Categories : Sharepoint

IE10 issue executing function after document open but before document write?
You mention you're writing to an IFRAME. You can call this from IFRAME parent <iframe id="ifr"></iframe> <script type="text/javascript"> document.getElementById("ifr").contentWindow.document.open(); alert("Opened document"); document.getElementById("ifr").contentWindow.document.write("Hello World"); alert("Wrote to document"); document.getElementById("ifr").contentWindow.document.close(); alert("Closed document"); </script> Seems to work in IE as well.

Categories : Javascript

unoconv: UnoException during import phase: The document '(path to document)' could not be opened
Read the Troubleshooting section of the README at: https://github.com/dagwieers/unoconv#troubleshooting-instructions There are various possible causes for this, the most important being that it is a bug in LibreOffice. You can help by reporting it at: https://bugs.freedesktop.org/enter_bug.cgi?product=LibreOffice&bug_status=UNCONFIRMED

Categories : Linux

XML Document validation fails on modified Document but passes when reparsed
I had the same problem with a namespace aware XML Document. I was using setAttribute(name, value) to add non-namespaced attributes, which resulted in the same Attribute "x" is not allowed in element "y" exception. Re-parse the document and the problem went away. The fix was to use the namespace aware method setAttributeNS(namespaceURI, qualifiedName, value), passing null as the namespaceURI.

Categories : Java

Attaching more than one metadata tag on a document that is uploaded to a SharePoint document library
Based on your code, it looks like you are setting the "Document Type" to each item in CblDocumentMetadata, and the last one will be the last one that gets set. It is really unclear to me what are you actually trying to do here. Perhaps you can edit your question to clarify?

Categories : C#

How to prevent a document-based cocoa application to open ANY document?
You're probably looking for functionality that is defined in the NSApplicationDelegate-protocol. Specifically the following two methods give you some control over what happens on app start: - (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag - (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender See the documentation for more.

Categories : Osx

Javascript, Firefox replacing entire document without document.write
I would recommend you to make use of the .html() function of jQuery. (or innerHTML if you prefer to make use of pure Javascript) If the document DOM has already been loaded you shouldn't be using document.write.

Categories : Javascript

asp.net json web service sending array error Cannot convert object of type 'System.String' to type 'System.Collections.Generic.List`1[System.String]'
You need to make your data parameter of the $.ajax call like this: JSON.stringify({'a': variables}) The JSON variable is not available in < IE8 so you'll want to include a JSON implementation like the one mentioned in the answer here Also, you had an extra } in the success function. So, in the future, if you want to add extra parameters to your data object passed to the web service, you'd construct it like so: var someArr = ['el1', 'el2']; JSON.stringify({ 'param1': 1, 'param2': 'two' 'param3': someArr // etc }); JavaScript: var variables = Array(); var i = 0; $('#Div_AdSubmition').find('.selectBox').each(function () { variables[i] = $(this).find('.selected').find(".text").html(); i++; }); $.ajax({ type: 'post', data: JSON.stringify({'a': variables}),

Categories : C#

'The document has no page' error thrown when closing a document
use this code and set your pdf location. and image path. its working. string contents = "hi"; string fileName = "aaa.pdf"; Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment; filename=" + fileName); Response.Cache.SetCacheability(HttpCacheability.NoCache); StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); hw.AddStyleAttribute("font-size", "11px"); string path = Server.MapPath("~/Images/a.png"); contents = contents.Replace("~/Images/a.png", path); sw.Close(); hw.Close(); StringReader sr = new StringReader(contents); System.IO.FileStream fs = new System.IO.FileStream(Server.MapPath("~/") + DateTime.Now.Ticks,

Categories : C#

Javascript - document.write() is working but document.innerHTML isn't
Am I doing something incorrectly? Yes, your timer logic is flawed. Currently you're doing function fn() { if (/* no time left*/) { clearTimeout(timer); // show end message } // show countdown var timer = setTimeout(fn, 1000); } You're trying to clear the timer before you've started it. And actually you don't have to do that at all, since at that time no timer is running. What you have to do instead is ensure that the timer is not restarted. So change the logic to function fn() { if (/* no time left*/) { // show end message } else { // show countdown setTimeout(fn, 1000); } } Of course that doesn't really explain why your innerHTML assignment is not working (unless the flawed timer-cancelling led to some exceptio

Categories : Javascript

when a search hits a document, how can ES only return parts of that document?
With nested documents you can only get back the whole structure (parent + all children) and you can only update the whole structure. If you switch to parent/child you can index parent and every child independently paying the price of more memory usage and a little worse performance. On the other hand this way you can search on the parents and get back the children, or search on the children and get back the parents. Also, children are separate documents and you can index query them independently, regardless of the fact that they have a parent.

Categories : Search

update nth document in a nested array document in mongodb
Q1: If you update with permalink 'jaiho' instead of 'haha', it most certainly updates the email; > db.posts.update({"permalink" : "jaiho"},{$set:{"comments.0.email":1}}) > db.posts.find() ..., "email" : 1 },... Q2: Same goes for this include; > db.posts.update({"permalink" : "jaiho"},{$inc:{"comments.0.num_likes":1}}) > db.posts.find() ..., "num_likes" : 1 },...

Categories : Arrays

Invalid cast from 'System.Int32' to 'System.Nullable`1[[System.Int32, mscorlib]]
For above I could simply write int? nVal = val Actually, you can't do that either. There is no implicitly conversation from object to Nullable<int>. But there is an implicit conversation int to Nullable<int> so you can write this; int? unVal = (int)val; You can use Nullable.GetUnderlyingType method. Returns the underlying type argument of the specified nullable type. A generic type definition is a type declaration, such as Nullable, that contains a type parameter list, and the type parameter list declares one or more type parameters. A closed generic type is a type declaration where a particular type is specified for a type parameter. Type t = typeof(int?); //will get this dynamically Type u = Nullable.GetUnderlyingType(t); object val = 5; //will get th

Categories : C#

How I can get parent document object From SVG document JavaScript?
There's a HTMLDocument interface and an SVGDocument interface, both derive from a base Document interface which provides some common methods. Cookies are part of the HTMLDocument interface and so only HTML documents get cookies. If you're talking about a situation where the <svg> is embedded in an html document via an <object>, <embed> or <iframe> tag then parent.document or top.document will get you the parent html document from a script in the SVG object provided that the SVG and HTML documents are on the same domain. This works for me on Firefox at least... <html> <body> <object id="object" data="embedded.svg" type="image/svg+xml" width="450" height="300"> </object> </body> </html> together with em

Categories : Javascript

Meteor: display document's key and value without knowing the document itself?
Using Underscore.js you could loop through the unknown document and add the values/keys to an array. Using this array in the template will let you output all the keys/values. Like this (untested but should work): // Template js Template.whatever.elementToReturn = function() { var elementToReturn = []; var someDoc = CollectionWithUnknowFields.findOne({}); var index = 0; _(someDoc).each( function( value, key, someDoc ) { elementToReturn[index] = {}; elementToReturn[index]['value'] = value; elementToReturn[index]['key'] = key; index++; }); return elementToReturn; }; // Template HTML <template name="whatever"> {{#each elementToReturn}} <p>Key is: {{key}}</p> <p>Value is: {{value}}</p>

Categories : Meteor

Document cannot be converted into iTextSharp.text.Document
Looks like your Document is coming from some other namespace, try specifying the namespace explicitly: dim doc as iTextSharp.text.Document = new iTextSharp.text.Document() 'may need parameters to constructor

Categories : Asp Net

How to change the nodeType of XML document from DOCUMENT to ELEMENT
I figured out one way to handle this. After I have completed my document #1, then I can select a single node (the root) into a new DOM object. It works for my purpose. oDOM2 = Createobject(MSXML2.DOMDocument) <bunch of code and other things go here...> oDOM1 = Createobject(MSXML2.DOMDocument) oDOM1.Load("<SomeXML><MoreXML></MoreXML></SomeXML>") oDOMTemp = oDOM1.selectSingleNode("//SomeXML") oDOM2.appendChild(oDOMTemp) Is there a better way?

Categories : Misc

Calling a (document).resize and (document).ready
How about: (function($) { $(document).ready(function() { var cols = $(".cols"); cols.resize(function(){ cols.equalHeights(); }); cols.trigger('resize'); }); })(jQuery);

Categories : Jquery

With elasticsearch, it's possible to search document related to another document?
I believe that you're looking for "more like this" querying - here's the ES API documentation: http://www.elasticsearch.org/guide/reference/api/more-like-this/. I'd think that tire exposes this API endpoint or allows you to do so manually - in fact, it looks like tire-contrib give you what you're looking for: https://github.com/karmi/tire-contrib/.

Categories : Search

MongoDB: If document exists VS If document does not exist
The question is how you determine that "the document" exists? Usually, you'd do this using a unique id. Now MongoDB's ObjectId comes to the rescue because it contains a timestamp already. This can also be used in queries. Instead of using an integer field User_ID, you might want to consider calling the field _id and use the ObjectId data type so you get that functionality for free. > db.test.insert({"foo" : "test"}); { "_id" : ObjectId("51cb763e58bb4077aea65b3d"), "foo" : "test" } > var foo = db.test.findOne(); > foo._id.getTimestamp(); ISODate("2013-06-26T23:16:14Z")

Categories : Mongodb

Embed source document in output document
Yes, there's a very easy way to do that. Just use <xsl:copy-of select="/" />. E.g.: <xsl:template match="/"> <html> <head></head> <body> <script type='text/javascript'> document.sourceXml = '<xsl:copy-of select="/" />'; </script> </body> </html> </xsl:template> Now if your source XML could have single quotes in it, your javascript isn't going to be happy. I'm not sure I understand your purpose well enough to know whether this is important to you. In that case, you might do better just emitting the XML into the HTML; but you didn't want to do that and I'm not sure what your reasons were.

Categories : Xml

Javascript document.defaultView or document.styleSheets?
document.styleSheets is the list of the actual stylesheet or sheets loaded into the page. Fun fact: you can dynamically create new "stylesheets" and add them to this list, without actually loading separate files. If you are looking up the current style of an element, the question you need to ask is, "do I care more what the stylesheet SAYS the style should be, or do I care more what the actual current (computed) style is?" The circumstances will determine which is more appropriate. If you care about the original declared styles, you'll want to consult the stylesheets themselves. However, this is quite a bit more complex than it may seem, because you're going to have to parse the files and find all the cascading styles that would apply to the element in question. If you care about what t

Categories : Javascript

What is the difference between transient document and document in OpenCMIS?
Do not use TransientDocument. It has been deprecated, see the JavaDoc. Jeff

Categories : Apache

Managing a Big Matrix in R
If it's a dense matrix there's not much you can do about it. The storage requirements for this matrix are roughly 6 * 6 * 10^4 * 10^4 * 8 bytes = 288 * 10^8 bytes = 28.8 Gigabytes. 8 bytes is the size for a double. You can use single values, this halves the size. For sparse matrices, the Matrix package by Douglas Bates and Martin Maechler is your friend.

Categories : R

managing state with FRP
I'm not familiar with Flapjax, but looking at the docs, you can use collectE to create a stream accumulating the state. Then, create a second stream of animationFrame events using receiverE and sendEvent. Finally, emulate bacon.js's sampledBy (https://github.com/baconjs/bacon.js/wiki/Diagrams#sampledby) to create a third stream of [animationFrame, state] tuples.

Categories : Javascript

Managing the same project with TFS & Git
Git-tf is the way to go (as commented by @DaveShaw). This should work : First, clone your TFS repo with git-tf. You may want to use --shallow if your tfs history is long and you only want a quick clone, but you won't have the entire history, just the last commit (like it was the first one). git tf clone --shallow http://myserver:8080/tfs/mycollection $/TeamProjectA/Main Add your GitHub repo as a remote git remote add github https://github.com/<user>/<repo>.git The simplest thing then is to delete the current github history with the new tfs history git push github master --force Then, whenever you want to update your github repo, follow this steps (--deep will make every following tfs commit a git commit, the opposite of --shallow) git tf pull --deep git push github

Categories : C#

Managing databases with PHP OOP
A better way could be by using a mapper. You have your Person Object, and you have a PersonMapper object, which is only responsible of mapping what's in the database to the person, and vice versa. So... class Person { //All attributes here //Setter and getter methods as necessary } class PersonMapper { public function fetch(Person $person) { //Contact the database and fetch all the data into $person; } //Mapping from the database } So that you use it like so: $person = new Person; $mapper = new PersonMapper; $mapper->fetch($person); //$person should now hold all of the data in its properties. This gives you the advantage of not being tied to a single data source, it can be a database, a file, a remote API call, or whatever.

Categories : PHP

Managing a 2D CUDA Array
Your cudaMemset2D is accesing to a bigger memory space that you previously allocated with cudaMallocPitch Also your cudaMemcpy2D is copying a little portion of that memory. You should use the function in the following way: cudaMallocPitch(&d_array, &pitch, block_size * sizeof(int), num_blocks); cudaMemset2D(d_array, pitch, 0, block_size * sizeof(int), num_blocks) // * sizeof(int)); <- This size is bigger than the previously declared kernel<<<grid_size, block_size>>>(d_array, pitch); cudaMemcpy2D(h_array, pitch, d_array, pitch, block_size * sizeof(int) /* you forgot this here */, num_blocks, cudaMemcpyDeviceToHost);

Categories : C++



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