上传到服务器时,DB :: raw是否会产生影响?(Does DB::raw affect when uploaded on server?)

目前使用此代码来获取mysql上的数据及其在本地主机上的工作,但是当我将其上传到我们的AWS服务器时,它会停止排序?

$raw = "( 3959 * acos( cos( radians('$lat') ) * cos( radians( '$lat' ) ) * cos( radians( longitude ) - radians('$lon') ) + sin( radians('$lat') ) * sin( radians( latitude ) ) ) ) AS distance";
$stores = DB::table('stores')
    ->select('storename', 'id', 'photo', 'address', DB::raw($raw))
    ->orderBy('distance')
    ->where('domain', $domain->appEnv)
    ->take(25)
    ->get();

当我上传AWS时,是否有某些内容会受到影响?

请注意,我们的数据库位于不同的RDS服务器上


Currently using this code to fetch data on mysql and its working on my localhost but when I uploaded it on our AWS server it stop sorting?

$raw = "( 3959 * acos( cos( radians('$lat') ) * cos( radians( '$lat' ) ) * cos( radians( longitude ) - radians('$lon') ) + sin( radians('$lat') ) * sin( radians( latitude ) ) ) ) AS distance";
$stores = DB::table('stores')
    ->select('storename', 'id', 'photo', 'address', DB::raw($raw))
    ->orderBy('distance')
    ->where('domain', $domain->appEnv)
    ->take(25)
    ->get();

Is there something that is being affected when I uploaded on AWS?

Note that our DB is on a different server for RDS


原文:https://stackoverflow.com/questions/31720363
2023-08-07 19:08

满意答案

std::random_shuffle (myarray, myarray + size);


std::random_shuffle(myarray, myarray + size);

相关问答

更多

随机化方法的问题(Issue with randomize method)

使用Random.nextInt() ,无法保证生成的数字是唯一的。 您应首先生成1到20之间的数字,然后将数字洗牌。 现在问题改为“如何随机改变数字?” 也许你可以参考JDK Collections.shuffle() 。 改组数字的算法很简单: 选择数组中的第一个元素并将其与随机位置的数字交换。 重复步骤1直到最后一个元素。 When you use Random.nextInt(), there's no guarantee that the numbers generated are un...

在Java中随机化一个int数组的最快方法(Quickest way to randomize an array of ints in Java)

你也可以使用Collections.shuffle(List)来洗牌一个数组: Integer[] data = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; Collections.shuffle(Arrays.asList(data)); System.out.println(Arrays.toString(data)); 将打印例如[6,2,4,5,10,3,1,8,9,7]。 Arrays.asList不会创建一个新列表,而是一个用于该数组的List接口包装器,以便...

使用.NET随机化数组的最佳方式(Best way to randomize an array with .NET)

如果你在.NET 3.5,你可以使用下面的IEnumerable酷(VB.NET,而不是C#,但想法应该清楚...): Random rnd=new Random(); string[] MyRandomArray = MyArray.OrderBy(x => rnd.Next()).ToArray(); 编辑:OK,这里是相应的VB.NET代码: Dim rnd As New System.Random Dim MyRandomArray = MyArray.OrderBy(Funct...

如何随机化(shuffle)一个JavaScript数组?(How to randomize (shuffle) a JavaScript array?)

事实上无偏差的洗牌算法是Fisher-Yates(又名Knuth)Shuffle。 请参阅https://github.com/coolaj86/knuth-shuffle 你可以看到一个很好的可视化在这里 (和原来的帖子链接到这 ) function shuffle(array) { var currentIndex = array.length, temporaryValue, randomIndex; // While there remain elements to shu...

shuffle()array ..正确的方法来随机化数组结果?(shuffle() array.. correct way to randomize array results?)

你也可以简单地使用array_rand选择一个随机密钥,而不是改变整个事情。 它不会比那更随机* 。 基于仅20次运行的测试数据,你不能说一些不随机的东西。 如果再运行几千次,它应该会均匀。 换一种说法: Dilbert http://img51.imageshack.us/img51/2848/dilberttourofaccounting.png *就PRNG至少而言。 You could also simply pick a random key using array_rand, inst...

如何随机化一个NSMutableArray?(How to randomize an NSMutableArray? [duplicate])

以下是一些示例代码:遍历数组,并随机将对象的位置与另一个对象切换。 for (int x = 0; x < [array count]; x++) { int randInt = (arc4random() % ([array count] - x)) + x; [array exchangeObjectAtIndex:x withObjectAtIndex:randInt]; } Here's some sample code: Iterates through the arr...

随机化图库阵列(Randomize gallery array)

你的数组不是一个数组。 做这个: var pics = Array.from(document.getElementsByTagName("img")); Your Array isnt an Array. Do this: var pics = Array.from(document.getElementsByTagName("img"));

简单的方法来随机化数组的条目使用STL?(easy way to randomize the entries of an array using stl?)

std::random_shuffle (myarray, myarray + size); std::random_shuffle(myarray, myarray + size);

随机化功能(Randomize function)

randomize()和random()不是标准C库函数。 您可以使用srand和rand来代替。 srand((unsigned)time(NULL)); for (i =0; i < DIM ; i ++) myVect[i] = rand()%100; 对于time()函数,你需要包含<time.h>头文件。 randomize() and random() are not Standard C library functions. Y...

随机化数字1到100的数组(Randomize Array of numbers 1 through 100)

首先,您应该照顾其他答案中提到的for循环条件。 然后,为了改组您的输入数组,您可以使用以下代码: import java.util.Random; public class Program { public static void main(String[] args) { int[] nums = new int[100]; for(int i = 0; i < nums.length; ++i) { ...

相关文章

更多

rsync 文件校验及同步原理及rsync server配置

参考:http://rsync.samba.org/how-rsync-works.html 我们关注 ...

OpenCms 集成外部Solr Server

OpenCms默认是以内嵌的Solr作为全文搜索服务的,不过我们也可以配置一个独立的Solr搜索服务器 ...

《DB2设计与性能优化-原理、方法与实践》扫描版[PDF]

中文名: DB2设计与性能优化-原理、方法与实践 作者: 王飞鹏 陈辉 张广舟 ...

weblogic启动server错误

我的weblogic启动时时报server错误,如下: &lt;2011-11-23 下午03时56分 ...

微信公共平台接口 使用$GLOBALS["HTTP_RAW_POST_DATA"]收不到信息解决方法

微信公众平台官方提供下载的示例代码中,使用$postStr = $GLOBALS[&quot;HTTP ...

java socket server

用java编写的一个socket服务端,通过一个tcp测试工具测试这个服务端,发现发送数据给服务端,服 ...

Hadoop的thrift server配置

说明:Hadoop版本:hadoop-1.2.1.tar.gz。linux系统12.04,不过这里跟系 ...

jsp程序在服务器上运行,如何将本地文件上传到ftp上

jsp程序在服务器上运行,如何将本地文件上传到ftp上 jsp页面传过去String fileStr ...

HTML5服务器事件发送(Server-Sent Events)【HTML5教程 - 第十三篇】

erver-Sent Events - 单向的信息处理.一个SSE(server send event ...

《Windows Server 2008服务器架设与管理教程(项目式)》扫描版[PDF]

中文名: Windows Server 2008服务器架设与管理教程(项目式) 作者: 丛书编委 ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本