小编Owe*_*wen的帖子

从ActiveRecord重构到DataMapper

您是否已从ActiveRecord重构为DataMapper模式?什么条件促使开关?我主要对基于Web的应用程序感兴趣,但想知道在任何环境中这种移动所带来的挑战.

refactoring activerecord design-patterns datamapper

4
推荐指数
1
解决办法
2253
查看次数

Google网页排名 - 新域名/链接结构迁移

我的任务是将纯HTML网站重新组织到CMS中.如果一切顺利,新网站最终将成为主要网址,旧网域将逐步淘汰.旧域名具有足够的页面排名,公司希望减少页面排名的任何损失.在查看可用选项时,我发现了一些东西:

  • 当你准备好进行切换()时,最好使用301重定向.
  • 当前站点没有站点地图,因此添加一个站点地图并提交它可能有助于他们未来的页面排名.
  • 我需要向他们建议他们联系目前链接到他们的人来更新他们的链接.
  • 重新获得旧页面排名的过程需要一段时间,因此在我们看到新网站是否足够灵活以保证完全切换时,计划重建链接.

我的问题是:由于转移到CMS驱动的网站,各个页面的链接将更改以适应新的结构.这会是一个试图维持(或改善)当前页面排名的问题吗?有哪些方法可以缓解更改单个页面URL的问题?除了将单个页面映射到具有301重定向的新位置之外,还有一种更好的方法吗?(该网站有几百页,呃...)

ex.
http://domain.com/Messy_HTML_page_with_little_categorization.html ->
http://newdomain.com/nice/structured/pages.php
Run Code Online (Sandbox Code Playgroud)

我意识到这不是一个严格的编程问题,但是我觉得这些信息对于除了开发网站之外还负责处理这类事情的开发人员有用.

编辑:斜体添加

migration seo pagerank

4
推荐指数
1
解决办法
925
查看次数

PHP + WSDL + SOAP - 如何在屏幕上显示Web服务结果

我刚刚开始使用PHP,并且想要了解如何将Web服务结果显示在数组中.

例如,我想将货币代码从以下WSDL打印到数组中

$wsdl="http://www.webservicex.com/CurrencyConvertor.asmx?WSDL
Run Code Online (Sandbox Code Playgroud)

这就是我到目前为止所做的一切,但没有真正发生过:

$proxyhost="proxy.cpit.ac.nz";  
$proxyport = 8080;  

$wsdl="http://www.webservicex.com/CurrencyConvertor.asmx?WSDL";

$client = new SoapClient($wsdl,
  array('proxy_host' => "$proxyhost",'proxy_port' => 8080, 'trace' => 1));

$country=array();
$result = $client->ConversionRate($country);
print_r($result);
Run Code Online (Sandbox Code Playgroud)

php soap web-services

3
推荐指数
1
解决办法
9763
查看次数

如何提取.hpi文件的.jpg/.png组件?

我偶然发现了相当古老的照片对象磁盘,遗憾地发现公司(hemera)不再提供支持了.这给我留下了一大堆.hpi文件.幸运的是,我发现这个信息对提取的文件JPG和PNG组件.

不幸的是,我无法让它发挥作用.谁能弄清楚这段代码有什么问题?如果Perl不是您的话,我会对PHP或Python解决方案感到满意.:)

open(I, "$name") || die;
binmode(I);
$_ = <I>;
close(I);

my ($j, $p) = m|^.{32}(.*)(\211PNG.*)$|s;
open(J, ">$name.jpg") &&
    do { binmode(J); print J $j; close J; };
open(P, ">$name.png") &&
    do { binmode(P); print P $p; close P; };
Run Code Online (Sandbox Code Playgroud)

如果它有帮助的话,我从CD中取出的当前测试文件的hexdump就在这里:

0000000 89 48 50 49 0d 0a 1a 0a 64 00 00 00 20 00 00 00
0000010 45 89 00 00 65 89 00 00 0a 21 00 00 00 d0 d0 00
Run Code Online (Sandbox Code Playgroud)

binaryfiles

3
推荐指数
1
解决办法
2182
查看次数

如何使用Mysql数据填充下拉列表的选定值?

我需要sql数据库填充表单输入的值.我的代码适用于所有文本和textarea输入,但我无法弄清楚如何将数据库值分配给下拉列表,例如.'房产类型'如下.它围绕着"选择选项"来表示数据库中保存的值.

这是我的代码:

$result = $db->sql_query("SELECT * FROM ".$prefix."_users WHERE userid='$userid'");    
$row = $db->sql_fetchrow($result);

echo "<center><font class=\"title\">"._CHANGE_MY_INFORMATION."</font></center><br>\n";
echo "<center>".All." ".fields." ".must." ".be." ".filled."  
<form name=\"EditMyInfoForm\" method=\"POST\" action=\"users.php\" enctype=\"multipart/form-data\">           
  <table align=\"center\" border=\"0\" width=\"720\" id=\"table1\" cellpadding=\"2\" bordercolor=\"#C0C0C0\">        
    <tr>                
      <td align=\"right\">".Telephone." :</td>                
      <td>
        <input type=\"text\" name=\"telephone\" size=\"27\" value=\"$row[telephone]\"> Inc. dialing codes
      </td>        
    </tr>        
    <tr>                
      <td align=\"right\">".Type." ".of." ".property." ".required." :</td>                                          
      <td>Select from list:
        <select name=\"req_type\" value=\"$row[req_type]\">                   
          <option>House</option>                  
          <option>Bungalow</option>                  
          <option>Flat/Apartment</option>                  
          <option>Studio</option>                  
          <option>Villa</option>                  
          <option>Any</option>                  
         </select>  
       </td>          
      </tr>
....
Run Code Online (Sandbox Code Playgroud)

php mysql

2
推荐指数
1
解决办法
4370
查看次数

致命错误函数名称必须是字符串

我试图从用户那里得到评论,但浏览器显示致命错误:函数名称必须是字符串.我的代码;

// <form name="form1" method="post" action="posting.php">
// <input name="comment" type="text" id="comment" style="width:254px; height:44px;">
// </form>

<?php

  $comment = $_POST('comment');//this was the line where problem occured

  if(!empty($comment))
  {
    mysql_query("INSERT INTO comment (comment) VALUES('".$comment."')");
  }

  echo "$comment";

?>
Run Code Online (Sandbox Code Playgroud)

php mysql

2
推荐指数
1
解决办法
9992
查看次数

PHP中数组的短代码

我有这样的数组

$array = array('Autobus', 'Ecole', 'Hopital' ...);
Run Code Online (Sandbox Code Playgroud)

这就是我回显该阵列中的图像的方式

foreach ($array as $prox){
    if ($prox == 'Autobus'){
        echo '<img src="./imgs/icones/autobus.png" width="35" height="35" alt="'.$prox.'" title="'.$prox.'"/>';
    }
    if ($prox == 'Ecole'){
        echo '<img src="./imgs/icones/ecole.png" width="35" height="35" alt="'.$prox.'" title="'.$prox.'"/>';
    }
    if ($prox == 'Hopital'){
        echo '<img src="./imgs/icones/hopital.png" width="35" height="35" alt="'.$prox.'" title="'.$prox.'"/>';
    }
...
Run Code Online (Sandbox Code Playgroud)

有没有比该代码更短的方法来做同样的事情?

谢谢

php arrays

2
推荐指数
1
解决办法
365
查看次数

如何知道应用程序尝试访问哪些文件?

我如何知道应用程序尝试访问哪些文件和注册表项?

file-io

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

在jQuery中将变量传递给.load(html)

假设我有这样的jquery代码:

html += '<div class="index">' + item.index + '</div>';

// many more similar html += statements

// load items
$('div').append(html);
Run Code Online (Sandbox Code Playgroud)

这个html太难以管理了,所以我想把它移到外部文件中.在加载变量时将变量传递给HTML的最佳方法是什么?我只需要加载它然后将jquery命令放在第一个JS文件中吗?这就是它的样子,但我宁愿使用更像模板的方法.

jquery

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

如何从文本文件中读取并存储在单独的C#表单中

我正在难以找到一段代码,它将成功读取文件并将信息存储在一个单独的数组中.

有人建议

var lines = File.ReadAllLines("peter_testresults.txt"); 
Run Code Online (Sandbox Code Playgroud)

在过去的问题,但"var"无法识别.

码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.IO;

    namespace WindowsFormsApplication4
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }

            //return a pass/fail
            //return number of correct answers
            //return number of incorrect answers
            //return index figures of incorrect values

    correctAnswers ={B,D,A,A,C,A,B,A,C,D,B,C,D,A,D,C,C,B,D,A} 


    private string determinePassOrFail (); //return a pass/fail


        string[] lines= File.ReadAllLines("peter_testresults.txt");

        var c = correctAnswers.Where((x, i) => …
Run Code Online (Sandbox Code Playgroud)

c# forms arrays

-2
推荐指数
1
解决办法
351
查看次数