I'm working with node and would like to include a module stored on a remote server in my app.
I.E. I'd like to do something along these lines (which does not work as is):
var remoteMod = require('http:// ... url to my remote module ... ');
As a workaround I'd be happy with just grabbing the contents of the remote file and parsing out what I need if that's easier - though I haven't had much luck with that either. I have a feeling I'm missing something basic here (as I'm a relative beginner with node), but couldn't turn up anything after scouring the docs.
EDIT:
I own both local and remote servers so I'm not concerned with security issues here.
If I'm just going to grab the file contents I'd like to do so this synchronously. Using require('http').get can get me the file, but working from within the callback is not optimal for what I'm trying to do. I'd really be looking for something akin to php's fopen function - if that's even doable with node.
Running code loaded from another server is very dangerous. What if someone can modify this code? This person would be able to run every code he wants on your server.
You can grab remote file just via http
http://nodejs.org/docs/v0.4.6/api/http.html#http.get
require('http').get({host: 'www.example.com', path: '/mystaticfile.txt'}, function(res) {
//do something
});
Related
I have a working hapi service, complete with hapi-swaggered and hapi-swaggered-ui. This is useful for many cases, but I want to add a build step to my CI which will be able to get the JSON generated by hapi-swaggered (which, if changed, would get compiled that into an .Net assembly that gets stored in a local proget).
I know that if I really wanted to, on my build server, I could start an instance of my server, curl to localhost:3000/swagger, kill the server, and proceed, but that seems a little risky (i.e., what if I have two builds running at the same time?).
Has anyone developed a way to directly call the hapi-swaggered API to get the raw JSON?
Well, that didn't take too much longer, but I think I found one solution. In this case, internals is my server. It does not auto-start if its loaded (required'ed) from another file, and the compose method is exposed to use hapi's Glue.compose to assemble the service. It seems that I can then use the inject method to simulate a call.
'use strict';
var internals = require('./');
internals.compose(function(err, server) {
server.inject({ method: 'GET', url: '/swagger' }, function (response) {
console.log(JSON.stringify(response.result));
process.exit();
});
});
If there's anything that I'm missing about this technique, I'd like to hear about it.
I have developing Forge Minecraft mods for some time now. I was wondering if it were possible to actually put them on a server. I can't seem to find a direct answer. I know that this may not be the place to put this but I am just dying to know. Please let me know if I can do it, and if so, how.
You can't turn a MC mod into a server plugin because Bukkit and Forge are different things (take it from a plugin dev); however, you can make a mod work on Forge servers.
When making a Forge server, all of your server's players will have to have the client mod, in addition to the Forge client, installed for it to work, so be prepared.
The first step is to actually install the server. Next, go to your Forge server folder, and upload the mod(s) into the folder. Then restart your server and boom, its there. Server mods can be found here.
So if you didn't want to read this, the gist of it is, no, you cannot, but your mods can be used on a Forge server, but not as plugins for a Bukkit or Spigot server, and that your players will need a clientside modpack. Hope this helped!
If you want to make your mod server side only, without having your "clients" having to download it, add acceptableRemoteVersions = "*" to your #Mod line.
This way players don't have to have the mod to be able to connect to the server. This way you can have plugins/mods like dynmap or whotookmycookies without the players having to have the mod as well.
If you want to put them on a server, yes you can. But keep in mind if you solely developped for single player worlds you'll run into "Side" issues.
Code will break beacuse some code is specifically Client side only, and some code is Server side only.
You will have to adapt some synching code with packets to make sure all your graphical things will happen and user input will be returned to you.
Single player worlds are way less picky in that aspect. So make sure you run all your code on the "proper" side, and remember if(!world.isRemote)(test to see if you are running serverside) is your friend.
#Mod(modid = MyMod.MODID, name = MyMod.NAME, version = MyMod.VERSION), acceptableRemoteVersions = "*"
public class MyMod {
....
}
is it possible in dotCMS to parse a vtl file from a remote source?
// this doesn't seem to work
#dotParse("https://some.random.source.com/vtl/index.vtl")
Not normally and it would be very easy to write a plugin to do it. Without writing any java code, it should be possible to do something like this:
#set($code = $import.read("https://some.random.source.com/vtl/index.vtl"))
$render.eval($context, $code)
The downside is that it will probably be much slower than just rendering a vtl in dotcms.
I had to move a website on a bluehost server, that is in the Joomla Platform 1.7. I did alot of reasearch on Joomla.org and google and still haven't resloved the issue.
I recieve the following error: Infinite loop detected in JError. I went threw the configuration file and made sure that database and user match up with my new database parameters match up and I am still recieving this issue. Thank you. Urgent response will be very helpful. Currently working on this and this is not a good start. :(
I have ran into the same issue moving my Joomla site from one server to another. What I learned is the following;
Make sure you look at the parameters in configuration.php. Double check if the following variables in your configuration.php file is correct. (Double Check) You did mention that you already have done so. In that case I am 98% sure that you have an issue dealing with file Attributes with configuration.php. Change the Attributes of configuration.php from 444 to 666.
To get detailed information about the error, open the error.php file located in /libraries/joomla/error/ on your server.
In the following code:
public static function throwError(&$exception)
{
static $thrown = false;
// If thrown is hit again, we've come back to JError in the middle of
throwing
another JError, so die!
if ($thrown) {
// echo debug_print_backtrace();
jexit(JText::_('JLIB_ERROR_INFINITE_LOOP'));
}
change the line // echo debug_print_backtrace();
to the following:
**print"<pre>";
echo debug_print_backtrace();
print"</pre>";**
Remember- When you change the parameters in configuration.php to you new database make sure you that configuration.php file attribute is set to 666, Otherwise when you go to save the file it will not change. Try this first.. Good luck.
I would want to program something where you upload a file on the one side and the other person can download it the moment I start uploading. I knew such a service but can't remember the name. If you know the service I'd like to know the name if its not there anymore I'd like to program it as an opensource project.
And it is supposed to be a website
What you're describing sounds a lot like Bit Torrent.
You might be able to achieve this by uploading via a custom ISAPI filter (if you use IIS) -- all CGI implementations won't start to run your script until the request has completed, which makes sense, as you won't have been told all the values just yet, I'd suspect ISAPI may fall foul of this as well.
So, your next best bet is to write a custom HTTP server, that can handle the serving of files yet to finish uploading.
pipebytes.com I found it :)