我正在进行角度应用.我们的应用程序基于https://github.com/Swiip/generator-gulp-angular,一切正常.这个角度种子项目基本上扫描目录中的所有JS文件,并在您投入生产时将它们连接成一个JS文件.
我们正在为计费系统构建管理员后端.客户现在还希望为所有客户提供"公共后端".客户端基本上登录并发送消息的地方.UI对于公共后端是相同的,我们可以在任何地方重复使用相同的指令.唯一的问题是公共后端很小,管理员后端很庞大.我不认为为随机客户端提供完整的管理员应用程序是一种很好的做法.
如何从同一代码库构建两个应用程序?
默认的react-router用作如下:
import * as React from 'react';
import { Router, Route, hashHistory } from 'react-router';
const routing = (
<Router history={hashHistory}>
<Route path="/login" component={Login}/>
</Router>
};
Run Code Online (Sandbox Code Playgroud)
当我包含"react-router-relay"库时,它会为路由器添加功能.即它为路由器组件添加了2个属性(渲染和环境):
import * as React from 'react';
import * as Relay from 'react-relay';
import * as useRelay from 'react-router-relay';
import { Router, Route, hashHistory, applyRouterMiddleware } from 'react-router';
const routing = (
<Router history={hashHistory} render={applyRouterMiddleware(useRelay)} environment={Relay.Store}>
<Route path="/login" component={Login}/>
</Router>
};
Run Code Online (Sandbox Code Playgroud)
我将如何增加反应路由器的类型?
我尝试过一系列方法,最新的方法是:
import { Router } from 'react-router';
declare module 'react-router' {
namespace …Run Code Online (Sandbox Code Playgroud) 我正在使用AJAX根据需要从服务器加载数据.我目前正在努力将服务器软件更新到最新版本.我注意到的一件事情发生了变化,现在每个请求都需要我传递一个令牌.这意味着我必须为每个请求添加一个新参数.我希望通过一般方法实现这一点,而不必修改每一个AJAX调用.
有什么指针吗?
使用CSS可以得到以下结果: 
所以li.item占用div.wrapper宽度的50%,而不是ul.list(这是极长的).我添加了一个基本设置的片段.关于此事的任何想法都表示赞赏(请记住我正在寻找CSS选项).一个jsfiddle游乐场链接:http://jsfiddle.net/6o8t9t8L/
.wrapper {
width: 400px;
overflow-y: hidden;
overflow-x: scroll;
border: 1px solid black;
}
.list {
list-style-type: none;
border: 1px solid red;
width: 2000px;
}
.item {
display: inline-block;
height: 200px;
width: 50%;
border: 1px solid green;
}Run Code Online (Sandbox Code Playgroud)
<div class="wrapper">
<ul class="list">
<li class="item"></li>
<li class="item"></li>
<li class="item"></li>
<li class="item"></li>
</ul>
</div>Run Code Online (Sandbox Code Playgroud)
假设我有以下标记:
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>Some title</h1>
<p>First paragraph</p>
<p>Second paragraph</p>
</body>
<html>
Run Code Online (Sandbox Code Playgroud)
我需要标记文本的某些部分,即"第一段secon"它看起来像这样:
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>Some title</h1>
<p>F
<mark>
irst paragraph</p><p>Secon
</mark>
d paragraph</p>
</body>
<html>
Run Code Online (Sandbox Code Playgroud)
但问题是html标记会被破坏.标记越复杂,这种方法就会遇到越多的问题.
题:
寻找关于如何获取第一个HTML示例并应用函数来返回html结构的想法,其中"irst paragraph second"以某种方式被特别标记.
我现在拥有的是:
我正在使用以下方法来调用jar文件中的类:
invokeClass("path.to.classfile", new String[] {});
public static void invokeClass(String name, String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, MalformedURLException {
File f = new File(System.getProperty("user.home") + File.separator + ".myapplication"+File.separator+"myjar.jar");
URLClassLoader u = new URLClassLoader(new URL[]{f.toURI().toURL()});
Class c = u.loadClass(name);
Method m = c.getMethod("main", new Class[] { args.getClass() });
m.setAccessible(true);
int mods = m.getModifiers();
if (m.getReturnType() != void.class || !Modifier.isStatic(mods) || !Modifier.isPublic(mods)) {
throw new NoSuchMethodException("main");
}
try {
m.invoke(null, new Object[] { args });
} catch (IllegalAccessException e) {
}
}
Run Code Online (Sandbox Code Playgroud)
是否可以在单独的进程上调用它?那么正在运行的应用程序和新调用的应用程序没有任何共同之处? …
var camera = {
settings : {
quality : 50,
targetWidth : 1024,
targetHeight : 1024,
correctOrientation : true
}
};
var error = function(message) {
alert("Error happened while trying to get a picture", message);
};
document.addEventListener("deviceready", function() {
camera.toFile = function() {
this.settings.destinationType = navigator.camera.DestinationType.FILE_URI;
return this;
},
camera.toBase64 = function() {
this.settings.destinationType = navigator.camera.DestinationType.DATA_URL;
return this;
},
camera.fromCamera = function() {
this.settings.sourceType = navigator.camera.PictureSourceType.CAMERA;
return this;
};
camera.fromLibrary = function() {
this.settings.sourceType = navigator.camera.PictureSourceType.PHOTOLIBRARY;
return this;
};
camera.fromPhotoAlbum …Run Code Online (Sandbox Code Playgroud) 是的,通过使用异常获取类名是一个合理的解决方案,但我正在寻找更优雅的东西.
String className = new Exception().getStackTrace()[1].getClassName();
Run Code Online (Sandbox Code Playgroud)
这将主要用于日志记录目的,并确保我的缓存关键字是特定于组件/调用者类的.
我目前的查询:
SELECT DACTIONMILLIS, DACTIONDATE INTO WF_DACTIONMILLIS, WF_DACTIONDATE
FROM WORKFLOWHISTORY
WHERE ddocname=? and LOWER(DACTION)=?
and lower(DWFSTEPNAME)=?
and lower(DUSER)=?
and rownum = 1
ORDER BY DACTIONDATE desc;
Run Code Online (Sandbox Code Playgroud)
但是因为在我获得无效结果之前在订单之前应用了rownum.我在stackoverflow上找到了以下主题:如何在订购后限制Oracle查询返回的行数?但这讨论了一个选择,而不是一个选择
https://www.googleapis.com/freebase/v1/search?query=madonna#
JSON结果打破了PHP的json_decode.确切地说,以下字符串正在打破解码:"Sticky\x26amp; Sweet Tour".
浏览器似乎能够理解它:http://jsfiddle.net/nggX2/和http://jsfiddle.net/QUVFt/
http://jsonlint.com/声称它是无效的JSON.
在PHP方面,我尝试过:http://codepad.viper-7.com/suUbQD和http://codepad.viper-7.com/QjqCH7
对于发生了什么的任何想法?
java ×2
javascript ×2
android ×1
angularjs ×1
browser ×1
camera ×1
cordova ×1
css ×1
cyanogenmod ×1
google-api ×1
highlight ×1
highlighting ×1
invoke ×1
jquery ×1
json ×1
oracle ×1
php ×1
process ×1
reactjs ×1
relayjs ×1
sql ×1
typescript ×1