w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Using Javascript to pull data from an RSS Atom feed
Two things to check for starters: 1) Your NewsFeed.aspx needs to be hosted at exactly the same protocol, sub-domain, domain, and port as the page calling it. Otherwise browser security kicks in and prevents you from using an XHR. If you're trying to read a 3rd party RSS feed you may need to use a proxy. 2) The content-type header of the response needs to be text/xml. There are ways to get around this, but it's better if the content-type is accurate.

Categories : Javascript

Shell command works in shell but not in shell script
You are using single quotes in this command: filelist=$(grep '$incstring' -rl --include=*.{h,cpp} pathToFiles) Single quotes inhibit variable expansion. That is, you're looking for the literal string $incstring rather than the contents of that variable. This command, as shown here, would not have worked on the command line either. From the bash(1) man page: Enclosing characters in single quotes preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash. Replace the single quotes with double quotes: filelist=$(grep "$incstring" -rl --include=*.{h,cpp} pathToFiles)

Categories : Shell

Clojure - is this an appropriate use of an atom?
Your approach using an atom is fine and looks good and clojurish. If you are looking for other approaches as well; since you can split your problem into some code that will produce and answer (your visitor) and some other code that will need the answer when it is available, Clojure's promise and deliver functions may be well suited. If you create the promises in the let block, then have the visitor deliver the results to the promise.

Categories : Clojure

How to call a shell script from JavaScript?
No. It would be such a gigantic security hole that any browser developer who allowed this would be [family-friendly censorship banner]. The right answer to this is Why do you want to do that?

Categories : Javascript

Atom:link in RSS using Rome
The blog post Adding Atom links to an RSS feed generated by ROME answers exactly that question: there is no build-in immediate support for Atom elements inside an RSS feed ... I’ve implemented an AtomContent class that holds a list of com.sun.syndication.feed.atom.Link but is easy extensible. The code is published as https://github.com/michael-simons/java-syndication .

Categories : Java

Ruby RSS/Atom documentation
RSS and Atom it only xml-document with known shema, which included some xml-tag: author, category. Therefore you can use any ruby library for generate xml. For example or nokogiri. Builder github For example: require 'builder' class Rss def initialize(hash) builder = Builder::XmlMarkup.new builder.instruct! :xml, :version => "1.0" builder.rss :version => "2.0" do builder.channel do |b| hash.each do |key, value| b.tag!(key) { value } end end end builder end end #hash of nodes with values rss_hash = {:title => "Some Title", :link => "http://example.com", :description => "foo bar"} Rss.new(rss_hash) #=> "<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title></t

Categories : Ruby

Converting value of a term to an atom
I think you are doing more complicated than necessary: animals_that_are(mammal, [lion, elephant, dog]). animals_that_are(reptile, [lizard, turtle]). does_animal_belong_to_group(Animal, Group) :- animals_that_are(Group, Animals), member(Animal, Animals). ?- does_animal_belong_to_group(lion, mammal). true ; false. Also, I would change the style of those facts, tentatively, the predicate naming should reflect the positions of arguments: animals_group([lion, elephant, dog], mammal).

Categories : Prolog

RSS == Atom? Issues when getting/parsing
Kind of obvious solution, the data variable was already an xml object, so I could traverse it with jquery: $(data).find('entry').find('author').text();

Categories : Jquery

ATOM XML is not accepted by IBM Connections Server
There are two things you want to double check 1) I wonder if you need an id element in the atom entry, in the example of Connections forums API document, no id is provided 2) I notice you use the topic uuid in ref="urn:lsid:ibm.com:forum:ee5878b5-65d4-4d44-8192-367e49c30e91" , in fact, you should use the correct forum uuid instead of the topic id.

Categories : Misc

Trying to Save Gmail Atom Feed to XML - C#
I have tried the code and it works fine (but I have no proxy in my network). I have changed the GmailHandler.cs, the constructor now accepts a internet proxy. using System; using System.Data; using System.Xml; using System.Net; using System.IO; /* * this code made by Ahmed Essawy * AhmedEssawy@gmail.com * http://fci-h.blogspot.com */ /// <summary> /// Summary description for Class1 /// </summary> public class GmailHandler { private string username; private string password; private string gmailAtomUrl; private string proxy; public string GmailAtomUrl { get { return gmailAtomUrl; } set { gmailAtomUrl = value; } } public string Password { get { return password; } set { password = value; } } public

Categories : C#

How To deserialize an Atom feed using DataContracts
I don't have enough reputation to comment, or I otherwise I would have asked for clarification in the comments... As per your example XML that you have to deserialize, the double quotes (") are escaped in the version, encoding and id attributes. As shown, this is not valid XML. Is the XML an output of your own program? If so, find where it is escaping the characters and prevent it from doing so when writing the output. If that is the file you have to work with, then I suggest removing all backslashes escaping a double quote: // We have to escape the backslash and the quote both, with a backslash xmlString.Replace("\#","#"); Perhaps that solves your problem? Lastly, you only mention that your code is 'failing', and fail to provide any kind of exception or error message... Please prov

Categories : C#

JavaScript execution failed connected to mongoHQ shell
This is a shell bug and it's not a new one. Basically the mongo shell doesn't accept the same format of connection string that regular mongodb drivers do. I can reproduce this error in the current and previous versions and this syntax isn't expected to work (though it probably shouldn't crash either, but there is already a bug for the shell to accept standard connection string: jira.mongodb.org/browse/SERVER-3254 Meanwhile you can connect by using the mongo shell options such as mongo -u <user> -p <passwd> hostIP:port/db or mongo --host host --port port [ other options ] db

Categories : Mongodb

How to execute a shell command on the server side within javascript?
I don't believe this is possible with client-side JavaScript. Althought it's not really your question, you could do it if you were using NodeJS server-side (http://nodejs.org/api/all.html#all_child_process_exec_command_options_callback).

Categories : Javascript

Adding categories to an Atom feed from Rails
This is what I ended up using. This actually gets 2 different models into the feed. views/entries/feed.atom.builder atom_feed language: 'en-US', schema_date: 2013 do |feed| feed.title @title feed.updated @updated @entries.each do |e| next if e.updated_at.blank? feed.entry e do |entry| entry.title e.name entry.summary e.summary.blank? ? truncate("#{strip_tags(e.content)}", length: 140, separator: ' ') : strip_tags(e.summary), type: 'html' entry.content e.content, type: 'html' entry.author do |author| author.name e.user.name end e.categories.map {|c| c.name}.each do |t| entry.category term: t, label: t, scheme: root_url end entry.category term: 'blog', label: 'blog', scheme: root_url end # end feed.entry

Categories : Ruby On Rails

How to find element in atom xml file jquery?
You have to escape the colon (:) with a double backslash () : $(xml).find("d\:Message") For more information, see jQuery XML parsing with namespaces

Categories : Jquery

Atom Feed shows header but no posts
If you are trying to get the article content, use $item->get_content(); instead of $item->get_description(); The feed you listed also does not have any articles. If you paste it directly in your browser you will see the feed page with no content.

Categories : PHP

Best way to remove item in a list for an atom in Clojure
Sure, you can use swap!, see A. Webb's answer. You might want to consider whether it's the best choice to store you clients in a list; a set or a map would be a more natural choice (for use with disj / dissoc). (Unless there is always a very small number of clients, in which case it may make sense to use the least complicated data structure available.) Also, the dosync does nothing here. dosync is for use with Refs (and alter, commute, ref-set, ensure). I'll also point out that if you run a loop like this: (doseq [c @clients] ...) then it'll always loop across the value of clients at the time the doseq form was entered, regardless of any swap!s to the clients Atom which might have occurred in the meantime. Not that it's likely to be a problem, just something to keep in mind. Anot

Categories : Multithreading

Search.twitter.com Atom Feed doesn't work (?)
This API has now been retired: Requests to search.twitter.com/search.* will receive HTTP 410 Gone. Use GET search/tweets instead. note also that: JSON is API v1.1's only output format. XML, RSS, and ATOM response formats will be retired along with API v1.

Categories : Twitter

ld: Assertion failed: (src.atom != NULL), function addRelocFixup
I was having this issue with the Bump library on my simulator. This thread provides a simulator friendly version of the lib: https://github.com/bumptech/bump-api-ios/issues/15

Categories : IOS

url in atom feed-builder behaves different to erb-template with nested resource
I'm not sure why, but after restarting the server and a cold reload, it works this way: feed.entry(feeditem, :url => url_for(:action =>'show', :controller =>'games',:category_id => feeditem.categorygames.first.category, :id => feeditem, :only_path => false)) do |entry|

Categories : Ruby On Rails

Angular.js: How can I return a content without view? Returning atom feed to users
Use the following process: Append an <object> or <iframe> to the DOM with the XML within the tag OR: Return Atom from the service Store in a documentFragment Use transformToFragment or DOMParser to create a view Use XMLSerializer to convert the view to a string Insert an XML stylesheet into the string: <?xml-stylesheet href="feed.css"?> Use the string as the value of the srcdoc attribute: <iframe srcdoc="{{atomfeed}}" height="95%" width="100%"> For example: $scope.atomstyle='<?xml-stylesheet href="feed.css"?>' $scope.atomboilerplate='<feed xmlns="http://www.w3.org/2005/Atom">' $scope.atomhead='<title></title><link></link>' $scope.atomcontent='<entry><title></title><link></link></entry&

Categories : Angularjs

How to fix incorrect mime-type (atom-feed) showed in chrome-devtools?
The problem seems to be Chrome not regognizing the application/*+xml content type. It looks that you need to use plain old application/xml to get XSLT processing and correct Content-Type display to work in dev tools.

Categories : PHP

Wordpress: Timezone issue of published field (Atom Publishing Protocol Plugin)
Replace get_publish_time() function in wp-content/plugins/atom-publishing-protocol/class-wp-atom-server.php with following code: /** * Retrieve published time to display in XML. * * @since 2.3.0 * * @param string $published Time string. * @return string */ function get_publish_time($published) { $pubtime = DateTime::createFromFormat(DateTime::RFC3339, $published); if (!$pubtime) { return array(current_time('mysql'),current_time('mysql',1)); } else { $localtime = $pubtime->format("Y-m-d H:i:s"); $pubtime->setTimezone( new DateTimeZone('UTC') ); $gmttime = $pubtime->format("Y-m-d H:i:s"); return array($localtime, $gmttime); } } Notice Requires PHP >= 5.2 If wp-app.php still exists, the plugin is not used. Reason

Categories : Wordpress

Running two node servers from a single shell command using a shell script
Your command does not work because you are trying to have two processes running in the same shell. Instead, you should 'spawn' the node processes into different processes. Try this command: node project/rest.js & node static-server.js &

Categories : Node Js

Read / write a file in a shell namespace extension using shell APIs
Try IShellFolder.BindToObject: IStream *stream; if (FAILED(shellfolder->BindToObject (pidl, NULL, IID_IStream, &stream))) return E_FAIL; But I'm not sure if this works with writing files as well.

Categories : Windows

Running a login shell using sudo inside a shell script on Mac OSX
Your shell is interpreting the $HOME variable in the heredoc, before the input reaches the su shell. You need to escape the $: bash-3.2$ sudo su -l root <<EOF > echo $HOME > echo $HOME > EOF /Users/kevin /var/root The real question is why does it work on your Linux box.

Categories : Osx

Variables scope in inline django shell, vs python shell
It seems to be a known issue and fixed in Django 1.6. For the time being, there is a suggested workaround in the ticket. "Grab the following lines (from here https://github.com/django/django/blob/master/django/core/management/commands/shell.py) and replace the current implementation (...) with this": def ipython(self): try: from IPython.frontend.terminal.ipapp import TerminalIPythonApp app = TerminalIPythonApp.instance() app.initialize(argv=[]) app.start() except ImportError: # IPython < 0.11 # Explicitly pass an empty list as arguments, because otherwise # IPython would use sys.argv from this script. try: from IPython.Shell import IPShell shell = IPShell(argv=[]) shell.mainloop

Categories : Python

How can I default to a login shell for Jenkins shell execution
You could work around by creating a wrapper around bash: #!/bin/sh # for ex.: /usr/local/bin/login-bash exec /bin/bash -l "$@" If you want to use the default ruby just use the rvm-shell, which comes with rvm. Login as the jenkins user and type: $ which rvm-shell /home/jenkins/.rvm/bin/rvm-shell to get the path of the rvm-shell. Use this path for the "Shell executable" option.

Categories : Bash

Use shell script wrapper to enter commands into a new shell
If the sequence of commands is fixed (does not change from run to run), you might be able to use: #!/bin/sh Dbm2 <<EOF table THE_TABLE ...other commands... EOF ls # Just to demonstrate that the shell continues The <<EOF notation is a here-doc. The lines up to the line containing EOF are the input to the command Dbm2. If the content of the commands needs to vary, you may be able to pipe the input to Dbm2. In your script, if you manually enter commands to Dbm2 and then quit, your original shell script should continue. The table THE_TABLE line would be treated as another shell command and would, most likely, fail.

Categories : Shell

Start Emacs in shell when started form shell
So there's the alias solution, but a pb I encounter is that I sometimes make emacs sleep with Ctrl-z and then I forget I have an emacs session launched so I use my alias once again and I end up with two emacs in the terminal, which annoys me. So I use a function which checks if an emacs is already running: cemacs () { if (ps|grep emacs); then echo "Hey, emacs is already running"; fg %emacs else emacs -nw $@ fi } Shortcut I defined a handy shortcut to revive a sleeping emacs: bind -x '"C-xC-e":fg %emacs' Emacs-server So that's what I used for quite long, and it isn't perfect. I can not launch a normal emacs and then my function, unless if I use emacs server: http://wikemacs.org/index.php/Emacs_server Just create an alias to emacsclient -t. and shell-mode But

Categories : Shell

How to pass several shell variables to awk in shell script?
ls -l | nawk -v r="3,5" 'BEGIN{split(r,a,",")}{for(i in a)printf $a[i]" ";print " "}' Now you can simply change your r variable in shell script and pass it on. or you can configure it in your shell script and use r=$your_list_var What ever fields numbers are present in $your_list_var will be printed by awk command. The example above print 3rd and 5th fields of ls -l output.

Categories : Linux

What does "mkdir /mnt 0700 shell shell" do in init.rc..?
The commands in the init.rc file are special language used by the android init process. The syntax is loosely described in a readme file in the AOSP source code: https://android.googlesource.com/platform/system/core/+/master/init/readme.txt by in particular the command you are asking about will create a directory called "/mnt" with the unix permissions "0700" owned by the user "shell" and the group "shell". I hope that helps.

Categories : Android

How can I execute a shell-script in a Bash sub-shell?
You can do the same but without eval. with-env-overrides() { ( source $HOME/.env-overrides "$@" ) } Example: $ cat ~/.env-overrides export A=1000 $ export | grep ^A= $ with-env-overrides export | ^grep A= declare -x A="1000" As you can see, in the second case, you've got an environment with the A variable.

Categories : Linux

Shell within php or send variable from php to shell
The best option (by far!) would be to modify the external script to accept command line parameters. So instead of shell_exec('sh.sh'); where all variables are embedded, make it into shell_exec("./sh.sh $opt1 $opt2"); where you can pass your variables easily. An example for a bash script to use these arguments would be : #!/bin/bash echo "My $1 will kick your $2 anytime" which will replace $1 with the first argument, and $2 with the second.

Categories : PHP

Import data to R from Atom-compliant data feed
Feeds just give you the information in XML format, which can be parsed using the XML package. library(XML) url <- 'http://housesofstones.com/blog/feed/atom/' # Download and parse the data xml_data <- xmlParse(url) # Convert the xml structure to a list so you can work with it in R xml_list <- xmlToList(xml_data) str(head(xml_list)) List of 6 $ title :List of 2 ..$ text : chr "Houses of Stones" ..$ .attrs: Named chr "text" .. ..- attr(*, "names")= chr "type" $ subtitle:List of 2 ..$ text : chr ""Science is facts; just as houses are made of stones, so is science made of facts; but a pile of stones is not a house and a c"| __truncated__ ..$ .attrs: Named chr "text" .. ..- attr(*, "names")= chr "type" $ updated : chr "2013-05-16T12:16:49Z" $ link : Named chr [1:3] "alternat

Categories : R

Can any one explain the usage of Shell::Source perl module or Shell::GetEnv module
Reading and changing environment variables is built-in to Perl, you do not need the modules you mentioned. $ENV{UVM_HOME} = '/u/tools/digital/uvm/uvm-1.1a'; $ENV{VIPP_HOME} = '/u/tools/digital/vipcat_11.30-s012-22-05-2012'; $ENV{VIP_AXI_PATH} = "$ENV{VIPP_HOME}/vips/amba_axi/vr_axi/sv/";

Categories : Linux

Translating shell script into Windows command shell script (batch)
for /L makes a count-controlled loop in batch. mkdir remains mkdir. @echo off for /L %%y in (1,1,9) do mkdir week_0%%y mkdir week_10

Categories : Shell

Wscript.shell.run and Wscript.shell.exec do not display the same outputs
Ok, I found the solution on a 8 years old post. (http://computer-programming-forum.com/61-wsh/813f07658378176c.htm) In order to get the complete output from ftp command using Exec method, the -v option has to be added to ftp command. Works like a charm. var shell = new ActiveXObject("WScript.Shell"); exec = shell.exec(cmd /c ftp -i -v -A -s:file.ftp host); var output = exec.StdOut.ReadAll();

Categories : Javascript

what's the difference between "hadoop fs" shell commands and "hdfs dfs" shell commands?
fs refers to any file system, it could be local or HDFS but dfs refers to only HDFS file system. So if you need to perform access/transfer data between different filesystem, fs is the way to go.

Categories : Hadoop

Android Emulation Issue; Application working on ARM system image but not Intel Atom system image
Well this somehow resolved itself (no idea how). If you run into this issue just be patient and keep developing in your ARM image for a while, then check the Intel image once every few minutes for me it just started working again after about 45 minutes.

Categories : Android



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