小编kol*_*nar的帖子

我们如何在浏览器中缓存内联SVG?

SVG已经存在多年,因为它具有可扩展性,并且长期以来很熟悉内联SVG的好处是可以用CSS和JS操作它,当我们想在html文档上重复相同的SVG时,我们可以使用<use>用于引用原始元素的标记.此外,内联SVG还可以减少HTTP请求的数量.

但是,许多文章建议(不解释细节)虽然我们使用内联SVG来保存HTTP请求,但它不再可以被浏览器缓存为单独的主题,这意味着它不能跨页面重用.

由于我碰巧在项目中广泛使用内联SVG,我想知道内联SVG(着名的html5元素,这是一个w3c推荐)如何在浏览器中缓存,同时使用带<img>标记的SVG 或background-image可缓存.

如果DOM是可缓存的,那为什么不能使用SVG DOM呢?(建立在DOM Level 2上并与之兼容.参考:https://www.w3.org/TR/SVG/svgdom.html)

到目前为止,我提出的可缓存性的解决方案是使用数据URI方案 (也参考:在数据uris中优化svgs)但是这样做,它失去了处理CSS和JS的样式和操作的能力.

Web上的一些示例建议使用JS来加载可缓存资源,或者替换占位符元素(如<object>tag),以及使用localStorage,CacheStorageService Worker.但我仍然需要一些指导方针来开始实现理想的解决方案.

有人能给我一些光吗?

-

-

-

参考:在localStorage中缓存SVG Sprite

参考:内联SVG和缓存

参考:网上的SVG

参考:内联SVG重量减少网站?

html javascript css html5 svg

7
推荐指数
1
解决办法
8085
查看次数

Android SQLite事务回滚工具?

我必须独立插入三个表..但如果第一个表成功插入,则只需要第二个表来插入数据.如果在插入第二个表时发生任何错误,则需要回滚第一个表的最后一个表,同样也是第三个表:

我当前喜欢这个:

   DBAdapter dbAdapter = DBAdapter.getDBAdapterInstance(RetailerOrderActivity.this);
dbAdapter.openDataBase();
   for (Map.Entry<String, MyProduct> entry : myProductMap.entrySet()) {
                    String key = entry.getKey();
                    MyProduct myProduct = entry.getValue();

                    ContentValues initialValue = new ContentValues();
                    initialValue.put("BusinessUnit",strBusinessUnit);
                    initialValue.put("ExecutiveCode",strExecutive);

                    if(salesType.equalsIgnoreCase("I")){
                        initialValue.put("InvoiceNo",transactionControl.getNextInvoiceNo());
                        initialValue.put("SalesCategory",transactionControl.getInvoicePrefix());

                    }else if(salesType.equalsIgnoreCase("O")){
                        initialValue.put("InvoiceNo",transactionControl.getNextOrderNo());
                        initialValue.put("SalesCategory",transactionControl.getOrderPrefix());
                    }
                    initialValue.put("ProductCode",key);
                    initialValue.put("LineNumber",i);
                    initialValue.put("Qty",myProduct.getQty());
                    initialValue.put("UnitPrice",myProduct.getPrice());
                    initialValue.put("DiscountValue",myProduct.getDisValue());
                    initialValue.put("DiscountQty",myProduct.getDisQty());


                    long nl = dbAdapter.insertRecordsInDB("WMInvoiceLine", null, initialValue); 

                   //update WMStockRecord table
                    if(nl != -1 ){

                        if((salesType.equalsIgnoreCase("I") && orderStockValidation.equals("1")) || (salesType.equalsIgnoreCase("O") && orderStockValidation.equals("1"))){
                            ContentValues stockValue = new ContentValues();
                            if(myProduct.getAvailableQuantity() < myProduct.getQty()){
                                stockValue.put("Stock",0.00);
                            }else{
                                double tmp = myProduct.getAvailableQuantity() - myProduct.getQty();
                                stockValue.put("Stock",tmp); …
Run Code Online (Sandbox Code Playgroud)

sqlite android

6
推荐指数
1
解决办法
6007
查看次数

如何通过SQL Server的xp_cmdshell根据Windows命令shell中的创建日期加载文件

在SQL Server中,我使用下面的查询将特定目录(例如z :)中的所有".jpg"文件名加载到表中.

我想知道是否有办法在Windows命令提示符下根据创建日期而不是修改日期加载文件.以下查询仅在执行时与修改日期一起使用xp_cmdshell.

-- Create the table to store file list
CREATE TABLE myFilesTable (myFileID INT IDENTITY, myFileName NVARCHAR(256))

-- Insert file list from directory to SQL Server
DECLARE @Command varchar(1024) = 'z: & forfiles /m *.jpg /s /d 07/16/2015 /c "cmd /c echo @fdate @ftime @path"'

INSERT INTO myFilesTable
   EXEC MASTER.dbo.xp_cmdshell @Command

-- Check the list
SELECT * FROM myFilesTable
GO
Run Code Online (Sandbox Code Playgroud)

07/16/2015在变量中@Command修改日期.显然,该命令forfiles没有通过Created …

t-sql windows sql-server powershell command-prompt

6
推荐指数
1
解决办法
3524
查看次数