我正在用PhoneGap和jQuery Mobile编写移动应用程序.为了简化导航,我想使用div data-role ="page"在多个"页面"上传播单个表单.我们的想法是为用户提供类似填充大型表单的向导.完成后,我需要能够在本地保存表单,或者在移动设备在线时提交表单.
如果表单被拆分为多个"虚拟"页面,我不明白如何使用jQuery Mobile提交或保存表单.我在网上搜索但找不到任何有关解决此问题的教程或示例.
任何帮助将不胜感激.
更新:
我最近改变了使用多页表单的方式,这个解决方案对我很有用.你基本上使用一个命名约定,其中字段成为部分的一部分,给它们的id以部分名称和破折号开头,例如:person-name,person-surname.请参阅以下答案.
在iPhone上使用jQuery Mobile和PhoneGap在页面之间导航时,会出现一个恼人的白色闪光,在新页面加载之前显示.像这样的简单链接会导致:
<a href="user.html" rel="external" data-role="button">User details</a>
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?一个合理的解决方法可能是将白色闪光灯改为与我的网页背景颜色相同的颜色,但我不知道这是否可行.
更新:
我在iPhone IOS 5.1和5.2上使用PhoneGap 1.5.0(又名Cordova),jQuery 1.6.4和jQuery Mobile 1.0.1.
这个问题似乎在Safari桌面上持续存在(尽管不那么明显).Firefox上没有问题.
更新2:
闪烁肯定是通过将链接标记为rel ="external"引起的.不幸的是,我链接到jQuery Mobile多重,所以这是必要的.
我不时会看到有一个boot.scala或Boot.scala文件的项目.虽然这似乎不是一个硬的快速Scala规则,但它似乎是包含Boot.scala文件的民间传说.一些项目.这个特定项目使用Akka和Spray,它转换为actor模式和REST服务.
有人请说明在这样的文件中通常可以预期的功能类型,以及这是一种常见的排序模式吗?
作为这个问题的扩展(请先回答第一位:-),我将非常感谢知道如何阅读此代码,该代码位于具有多个Boot.scala文件的项目中.
Web包中的Boot.scala:
trait Web {
this: Api with Core =>
....
}
Run Code Online (Sandbox Code Playgroud)
api包中的Boot.scala:
trait Api {
this: Core =>
....
}
Run Code Online (Sandbox Code Playgroud)
核心包中的Boot.scala:
trait Core {
implicit def actorSystem: ActorSystem
implicit val timeout = Timeout(30000)
val application = actorSystem.actorOf(
props = Props[ApplicationActor],
name = "application"
)
Await.ready(application ? Start(), timeout.duration)
}
Run Code Online (Sandbox Code Playgroud)
可以认为一个包依赖于另一个包,并且Boot.scala文件可能是基于actor的系统中的常见视图,但是如何"读取"关系呢?例如,我如何用英语阅读trait Web {this:Api with Core => ...}?
在特定实例中,应用程序的起点位于主文件中:
object Main extends App {
implicit val system = ActorSystem("RESTService")
class Application(val actorSystem: ActorSystem) extends Core with Api with Web …Run Code Online (Sandbox Code Playgroud) Slick DSL允许两种方式在表中创建可选字段.
对于这个案例类:
case class User(id: Option[Long] = None, fname: String, lname: String)
Run Code Online (Sandbox Code Playgroud)
您可以使用以下方法之一创建表映射:
object Users extends Table[User]("USERS") {
def id = column[Int]("id", O.PrimaryKey, O.AutoInc)
def fname = column[String]("FNAME")
def lname = column[String]("LNAME")
def * = id.? ~ fname ~ lname <> (User, User.unapply _)
}
Run Code Online (Sandbox Code Playgroud)
和
object Users extends Table[User]("USERS") {
def id = column[Option[Long]]("id", O.PrimaryKey, O.AutoInc)
def fname = column[String]("FNAME")
def lname = column[String]("LNAME")
def * = id ~ fname ~ lname <> (User, User.unapply _)
}
} …Run Code Online (Sandbox Code Playgroud) 人们有时会试图通过躲在电脑屏幕后离开你的女朋友.但是,我发现Scala有时候和我的女孩完全一样......
这打印两个列表之间的交集:
val boys = List(Person("John"), Person("Kim"), Person("Joe"), Person("Piet"), Person("Alex"))
val girls = List(Person("Jana"), Person("Alex"), Person("Sally"), Person("Kim"))
println("Unisex names: " + boys.intersect(girls))
Run Code Online (Sandbox Code Playgroud)
这打印绝对没有:
val boys = List(Person("John"), Person("Kim"), Person("Joe"), Person("Piet"), Person("Alex"))
val girls = List(Person("Jana"), Person("Alex"), Person("Sally"), Person("Kim"))
println("Unisex names: " + boys intersect girls)
Run Code Online (Sandbox Code Playgroud)
没有编译器警告,该语句绝对没有打印到控制台.有人可以轻轻解释(我有宿醉),为什么会这样.
我在 Windows 10 上安装了 Flutter 2.2,并将 Flutter 扩展添加到 VSCode。在启动新项目时,运行由 Flutter 扩展创建的样板代码没有问题。
代码中有一条注释鼓励您尝试热重载。请参阅下面的代码,在其中将主色板更改为蓝色以外的颜色。
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
String name = 'Paps';
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, …Run Code Online (Sandbox Code Playgroud) 将Netty ChannelBuffer转换为String就像在ChannelBuffer上调用.toString(UTF_8)一样简单.如何从String创建ChannelBuffer?
在下面的工作表中,我创建了一个自定义字符串插值器.
object WSLookup {
implicit class LookupSC(val sc: StringContext) extends AnyVal {
def lookup(args: Any*): String = {
val strings = sc.parts.iterator
val expressions = args.iterator
var buf = new StringBuffer(strings.next)
while (strings.hasNext) {
buf append doLookup(expressions.next.toString)
buf append strings.next
}
buf.toString()
}
def doLookup(s: String): String = {
// Just change the string to uppercase to test.
s.toUpperCase
}
}
val x = "cool"
val testString = "Not $x"
lookup"How $x"
// lookup testString //<--- See question 1
} …Run Code Online (Sandbox Code Playgroud) 我只是愚弄,奇怪地发现在一个简单的递归函数中解析嵌套括号有点棘手.
例如,如果该计划的目的是查找用户的详细信息,它可能会从{{name surname} age}到{Bob Builder age}再到Bob Builder 20.
这是一个迷你程序,用于对大括号中的总计进行求和,以演示该概念.
// Parses string recursively by eliminating brackets
def parse(s: String): String = {
if (!s.contains("{")) s
else {
parse(resolvePair(s))
}
}
// Sums one pair and returns the string, starting at deepest nested pair
// e.g.
// {2+10} lollies and {3+{4+5}} peanuts
// should return:
// {2+10} lollies and {3+9} peanuts
def resolvePair(s: String): String = {
??? // Replace the deepest nested pair with …Run Code Online (Sandbox Code Playgroud) 我无法让Xcode通过www资源复制到我的基于PhoneGap的iPhone应用程序.我考虑使用Git子模块,但由于应用程序必须在不同的平台(iPhone,Android等)上工作,并且必须以不同的方式标记(图像,css和对某些文件的小变化),因此它无法解决完整的问题.
我结束了一个解决方案,我创建了一个外部核心www文件夹,并为来自不同项目的每个文件创建了符号链接.如果文件需要特别关注平台或品牌要求,那么我可以简单地用实际文件替换该符号链接的实例.
这一切都像魅力一样,但由于某种原因,Xcode for不会将符号链接的资源复制到手机上.有谁知道如何使这项工作?或者是一个可靠的选择 即使这需要我一天的时间来修复.
谢谢.