程序设计

专业和发烧友程序员的问答

6
绘制等距游戏世界
在2D游戏中绘制等距图块的正确方法是什么? 我已经阅读了一些参考资料(例如this),这些参考资料建议以某种方式渲染图块,这些图块将使地图的2D数组表示形式中的每一列都呈锯齿形。我想应该以菱形的方式绘制它们,在屏幕上绘制的内容与2D阵列的外观更紧密相关,只是稍微旋转一下即可。 两种方法都有优点还是缺点?
178 2d  isometric 

7
CodeIgniter:创建新的助手?
我需要以不同的方式循环许多数组并将其显示在页面中。数组由模块类生成。我知道最好不要在“视图”上包含函数,并且我想知道在哪里插入函数文件。 我知道我可以“扩展”助手,但是我不想扩展助手。我想用我的循环函数创建一个助手。让我们称之为loops_helper.php

19
如何创建今天午夜和明天午夜的Java Date对象?
在我的代码中,我需要找到我今天发生的所有事情。因此,我需要将今天00:00 am(今早凌晨)至12:00 pm(今晚午夜)之间的日期进行比较。 我知道 ... Date today = new Date(); ...让我马上。还有... Date beginning = new Date(0); ...让我在1970年1月1日成为零时间。但是,有什么简单的方法可以让今天零时间和明天零时间呢? 更新; 我这样做了,但是肯定有更简单的方法吗? Calendar calStart = new GregorianCalendar(); calStart.setTime(new Date()); calStart.set(Calendar.HOUR_OF_DAY, 0); calStart.set(Calendar.MINUTE, 0); calStart.set(Calendar.SECOND, 0); calStart.set(Calendar.MILLISECOND, 0); Date midnightYesterday = calStart.getTime(); Calendar calEnd = new GregorianCalendar(); calEnd.setTime(new Date()); calEnd.set(Calendar.DAY_OF_YEAR, calEnd.get(Calendar.DAY_OF_YEAR)+1); calEnd.set(Calendar.HOUR_OF_DAY, 0); calEnd.set(Calendar.MINUTE, …
178 java  date 


15
未被充分利用的数据可视化
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案会得到事实,参考或专业知识的支持,但是这个问题可能会引起辩论,争论,民意调查或扩展讨论。如果您认为此问题可以解决并且可以重新提出,请访问帮助中心寻求指导。 8年前关闭。 直方图和散点图是可视化数据以及变量之间关系的好方法,但是最近我一直在想我缺少什么可视化技术。您认为最未被充分利用的情节类型是什么? 答案应该是: 在实践中不是很常用。 无需大量背景讨论就可以理解。 适用于许多常见情况。 包括可复制的代码以创建示例(最好在R中)。链接的图像会很好。

8
``json''本机gem需要安装的构建工具
我已经ruby 1.9.2p180 (2011-02-18) [i386-mingw32]在Windows 7机器上安装了。现在,我尝试使用命令“ gem install json”安装JSON gem,并收到以下错误。 ERROR: Error installing JSON: The 'json' native gem requires installed build tools. Please update your PATH to include build tools or download the DevKit from '[http://rubyinstaller.org/downloads][1]' and follow the instructions at '[http://github.com/oneclick/rubyinstaller/wiki/Development-Kit][2]' 然后我去下载了DevKit-4.5.0-20100819-1536-sfx.exe。将其提取到C:\ DevKit。然后从命令提示符处执行以下命令。 ruby dk.rb init 执行以上命令后,我验证了config.yaml的生成,并且它具有我的ruby文件夹的路径自动添加。这是config.yaml文件“-C:/ Ruby192”底部的行 ruby dk.rb …
178 ruby  json  windows-7  rubygems 

20
选择单元格后,UITableViewCell子视图消失
我正在实现一个颜色选择器表视图,用户可以在其中选择10种颜色(取决于产品)。用户还可以选择其他选项(如硬盘容量,...)。 所有颜色选项都在其自己的tableview部分中。 我想在textLabel的左侧显示一个小方块,以显示实际的颜色。 现在,我添加一个简单的方形UIView,为其提供正确的背景颜色,如下所示: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:RMProductAttributesCellID]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:RMProductAttributesCellID] autorelease]; cell.indentationWidth = 44 - 8; UIView *colorThumb = [[[UIView alloc] initWithFrame:CGRectMake(8, 8, 28, 28)] autorelease]; colorThumb.tag = RMProductAttributesCellColorThumbTag; colorThumb.hidden = YES; [cell.contentView …
178 iphone  ios  uitableview 

11
使主滚动条始终可见
当用户访问网页时(当页面内容不足以触发滚动条激活时),使浏览器的垂直滚动条保持可见状态需要什么CSS?
178 html  css  xhtml 

6
styles.xml中的自定义属性
我已经创建了一个自定义窗口小部件,并在layout.xml中声明了它。我还在attr.xml中添加了一些自定义属性。但是,当尝试在styles.xml中以样式声明这些属性时,这给了我No resource found that matches the given name: attr 'custom:attribute'. 我已经将xmlns:custom="http://schemas.android.com/apk/res/com.my.package"styles.xml中的所有标记(包括<?xml>,<resources>和)放入了所有标记中<style>,但是仍然出现相同的错误,即找不到我的自定义XML名称空间。 但是,我可以使用命名空间在layout.xml中为视图手动分配属性,因此命名空间没有任何问题。我的问题在于使styles.xml了解我的attr.xml。


30
项目构建中的CocoaPods错误
我无法建立使用CocoaPods的项目。我收到以下错误: diff: /../Podfile.lock: No such file or directory diff: Manifest.lock: No such file or directory error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.` $ pod install似乎工作正常,Pods并向我的工作区添加了一个项目。我已经尝试过了,$ pod update但这无济于事。 似乎PODS_ROOT没有设置。 Podfile: platform :ios, '6.0' workspace 'Example.xcworkspace' xcodeproj 'example/Example.xcodeproj' pod 'TestFlightSDK', '~> …

9
上一个功能完成后调用一个功能
我有以下JavaScript代码: $('a.button').click(function(){ if (condition == 'true'){ function1(someVariable); function2(someOtherVariable); } else { doThis(someVariable); } }); 我如何确保function2仅在function1完成后调用?
178 javascript  jquery 

8
当id包含点时,如何通过jquery的ID选择html节点?
如果我的html看起来像这样: <td class="controlCell"> <input class="inputText" id="SearchBag.CompanyName" name="SearchBag.CompanyName" type="text" value="" /> </td> 如何使用JQuery选择#SearchBag.CompanyName?我无法使其正常工作,我担心这是打破一切的圆点。令人烦恼的是,重命名我的所有ID会花费很多工作,更不用说可读性的损失了。 注意: 请不要开始谈论如何不为布局创建表格。我非常了解CSS的价值和缺点,并尝试尽可能多地使用它。
178 jquery 

8
在IIS Express的web.config中添加MIME映射
我需要为.woff文件扩展名添加新的MIME映射到IIS Express。 如果将以下代码段添加到IIS Express的“ applicationhost.config”中,则可以正常工作: <staticContent lockAttributes="isDocFooterFileName"> <mimeMap fileExtension=".woff" mimeType="font/x-woff" /> ... 但是我实际上确实想将其添加到我的“ web.config”中,以便并非每个开发人员都需要在本地更改其“ applicationhost.config”。 因此,我再次从“ applicationhost.config”文件中将其删除,并将以下代码段添加到项目的“ web.config”中: <system.webServer> ... <staticContent> <mimeMap fileExtension=".woff" mimeType="font/x-woff" /> </staticContent> </system.webServer> 不幸的是,它似乎无法以这种方式工作,因为当我尝试访问.woff文件时,最终会收到HTTP 404.3错误。 我究竟做错了什么?

13
获取对象的属性名称
我想知道JavaScript中是否有任何方法可以像这样遍历一个对象。 for(var i in myObject) { // ... } 但是这样获取每个属性的名称。 for(var i in myObject) { separateObj[myObject[i].name] = myObject[i]; } 我似乎在Google上找不到类似的东西。他们说与他们一起传递变量名,但这不是我要实现的目标的选择。 谢谢你尽你所能的帮助。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.