我有一个读取文件并返回字符串的方法,但我想返回一个读者.我想将字符串转换为读者,或者我想读取文件并返回阅读器.我怎样才能做到这一点?
我创建了一个播放应用程序.当我运行应用程序时,我在dev和prod中都会收到此错误
07:59:58,445 INFO ~ Precompiling ...
08:00:08,884 ERROR ~ Unable to set localhost. This prevents creation of a GUID. Cause was: sys3: sys3: Name or service not known
java.net.UnknownHostException: sys3: sys3: Name or service not known
at java.net.InetAddress.getLocalHost(InetAddress.java:1438)
at net.sf.ehcache.Cache.<clinit>(Cache.java:155)
at net.sf.ehcache.config.ConfigurationHelper.createCache(ConfigurationHelper.java:298)
at net.sf.ehcache.config.ConfigurationHelper.createDefaultCache(ConfigurationHelper.java:214)
at net.sf.ehcache.CacheManager.configure(CacheManager.java:552)
at net.sf.ehcache.CacheManager.init(CacheManager.java:323)
at net.sf.ehcache.CacheManager.<init>(CacheManager.java:279)
at net.sf.ehcache.CacheManager.create(CacheManager.java:641)
at play.cache.EhCacheImpl.<init>(EhCacheImpl.java:31)
at play.cache.EhCacheImpl.newInstance(EhCacheImpl.java:41)
at play.cache.Cache.init(Cache.java:241)
at play.Play.start(Play.java:511)
at play.Play.init(Play.java:300)
at play.server.Server.main(Server.java:158)
Caused by: java.net.UnknownHostException: sys3: Name or service not known
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:866)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1258) …Run Code Online (Sandbox Code Playgroud) 我正在检查互联网是否可用
URL url = new URL("http://www.google.co.in/");
final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
// set connect timeout.
conn.setConnectTimeout(1000000);
// set read timeout.
conn.setReadTimeout(1000000);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type","text/xml");
conn.setDoOutput(true);
conn.connect();
Integer code = conn.getResponseCode();
final String contentType = conn.getContentType();
Run Code Online (Sandbox Code Playgroud)
在运行此代码时,我得到了例外
URLjava.io.IOException: Server returned HTTP response code: 411
可能是什么错误.
我正在使用Play框架.我有一个JSONObject,其结构如下(在打印的控制台中)
{
"rows_map":{
"220":["mahesh",
"outfit:bmtech,app:salesreport,uuname,ffname,llname",
"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.5",
null
],
"221":["mahesh",
"outfit:bmtech,app:salesreport,uuname,ffname,llname",
"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.5",
null
],
"222":["mahesh",
"outfit:bmtech,app:salesreport,uuname,ffname,llname",
"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.5",
null
],
"223":["mahesh",
"outfit:bmtech,app:salesreport,uuname,ffname,llname",
"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.5",
null
]
},
"columns_map":["Sender",
"Message Received",
"Device",
"Time"
]
}
Run Code Online (Sandbox Code Playgroud)
我想将此JSONObject写入文件.这是代码
String path = "/var/www/html/Prj/public/CacheLayer/Incoming_Cache/CacheFileMgr.cache";
ObjectOutputStream outputStream = null;
try{
outputStream = new ObjectOutputStream(new FileOutputStream(path));
System.out.println("Start Writings");
outputStream.writeObject(object);
outputStream.flush();
outputStream.close();
}catch (Exception e){
System.err.println("Error: " …Run Code Online (Sandbox Code Playgroud) 我是Play的新手,也是休眠和JPA的新手.我正在使用MySql DB和JPA
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import javax.persistence.Query;
import play.db.jpa.JPA;
import play.mvc.Controller;
import play.db.jpa.*;
Run Code Online (Sandbox Code Playgroud)
我有这个查询
List languages = FormLanguages.findAll();
render(languages);
Run Code Online (Sandbox Code Playgroud)
哪个运行正常,但我想基于id选择,像这样
"select*from FormLanguages,其中id> 10"
当我这样使用
Query query = JPA.em().createQuery("select * from FormLanguages");
List<FormLanguages> articles = query.getResultList();
render(articles);
Run Code Online (Sandbox Code Playgroud)
这给了我IllegalArgumentException错误
当这样使用时
List queryList = FormLanguages.em().createQuery("select * from FormLanguages").getResultList();
render(queryList);
Run Code Online (Sandbox Code Playgroud)
给出同样的错误请帮我看看如何编写Query
还建议我一些网站
我有JQuery Datatable,我想删除行,当点击删除链接时.它适用于前10行,即第一页.当我从分页移动到另一个.它不起作用.这是我的代码:
$("#example tbody td.delete").click(function(event) {
var row = $(this).closest("tr").get(0);
oTable.fnDeleteRow( row );
});
Run Code Online (Sandbox Code Playgroud)
行的所有最后一行都有"删除"类.
我该怎么做才能为所有页面或所有记录工作?
我正在使用jQuery Mobile.其实我想在弹出窗口中打开一个externl链接.我试过这个.
<a href="#" id="dialoglink" data-rel="dialog">Open Dialog</a>
<script>
$(document).delegate('#dialoglink', 'click', function() {
$(this).simpledialog({
'mode' : 'blank',
'prompt': false,
'forceInput': false,
'useModal':true,
'fullHTML' :
'http://www.google.com/'
})
});
</script>
Run Code Online (Sandbox Code Playgroud)
它打开一个弹出窗口,内容是http://www.google.com/.但我其实想加载网址.即谷歌索引页面.
我的示例json文件内容
{
"FlightLog":{
"FlightLog.crewMembers":[
],
"destinationStationCode":"JPN",
"FlightLog.destinationStationCode":"IND",
"FlightLog.originStationCode":"IND",
"FlightLog._lockVersion":"0",
"FlightLog.flightNum":"123"
}
}
Run Code Online (Sandbox Code Playgroud)
我想获得FlightLog.FlightLog.originStationCode的价值.
例如:当我声明如下字段名称时,我得到的值是"JPN"
<field name="FlightLog.destinationStationCode" class="java.lang.String">
<fieldDescription><![CDATA[FlightLog.destinationStationCode]]></fieldDescription>
</field>
Run Code Online (Sandbox Code Playgroud)
如果我声明如下字段,
<field name="destinationStationCode" class="java.lang.String">
<fieldDescription><![CDATA[FlightLog.FlightLog.destinationStationCode]]></fieldDescription>
</field>
Run Code Online (Sandbox Code Playgroud)
我没有得到上述代码的任何价值.
我试过用
<field name="destinationStationCode" class="java.lang.String">
<fieldDescription><![CDATA[FlightLog[FlightLog.destinationStationCode]]]></fieldDescription>
</field>
<field name="destinationStationCode2" class="java.lang.String">
<fieldDescription><![CDATA[FlightLog.FlightLog\\.destinationStationCode]]></fieldDescription>
</field>
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
UPDATE
Run Code Online (Sandbox Code Playgroud)
我的jrxml是,
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Test" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="062e3e2d-b648-49c7-b4a5-1d3c4fbdfc6b">
<queryString language="json">
<![CDATA[]]>
</queryString>
<field name="FlightLog" class="java.lang.Object">
<fieldDescription><![CDATA[FlightLog]]></fieldDescription>
</field>
<detail>
<band height="20" splitType="Stretch">
<textField isStretchWithOverflow="true">
<reportElement x="0" y="0" width="555" height="20" uuid="dc09b2c4-31b1-4458-8097-2e912e80b3a2"/>
<textFieldExpression><![CDATA[$F{FlightLog}.get("FlightLog.destinationStationCode")]]></textFieldExpression>
</textField> …Run Code Online (Sandbox Code Playgroud) 我正在使用magento 1.5.0.1.在我的主页中,我想显示类别,我创建了3个类别,并在管理员中给出了是活动选项.我想在我的主页上显示带有链接的这些类别.在主页我有这些代码
<reference name="content">
<block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml" after="product_list"><action method="addPriceBlockType"><type>bundle</type><block>bundle/catalog_product_price</block><template>bundle/catalog/product/price.phtml</template></action></block>
</reference>
Run Code Online (Sandbox Code Playgroud)
如何更改此选项以查看类别.我是magento的新手.请帮帮我......
在添加类别时,我已将Include in Navigation Menu设置为yes.
我正在使用Magento ver.1.5.0.1.在主页我用左栏2列.我想一个接一个地展示最新,最高评价和最好的产品.请帮我怎么做.我是magento的新手,请帮助我......
java ×3
file-io ×2
jquery ×2
json ×2
magento ×2
categories ×1
datasource ×1
file ×1
hibernate ×1
javascript ×1
jpa ×1
popup ×1