always

Verilog generate/genvar in an always block

匿名 (未验证) 提交于 2019-12-03 02:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to get a module to pass the syntax check in ISE 12.4, and it gives me an error I don't understand. First a code snippet: parameter ROWBITS = 4; reg [ROWBITS-1:0] temp; genvar c; generate always @(posedge sysclk) begin for (c = 0; c When I try a syntax check, I get the following error message: ERROR:HDLCompiler:731 - "test.v" Line 46: Procedural assignment to a non-register is not permitted. I really don't understand why it's complaining. "c" isn't a wire, it's a genvar. This should be the equivalent of the completely legal syntax:

How can I make sure a float will always be rounded up with PHP?

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to make sure a float in PHP is rounded up if any decimal is present, without worrying about mathematical rounding rules. This function would work as follows: 1.1 to 2 1.2 to 2 1.9 to 2 2.3 to 3 2.8 to 3 I know the round() function exists but I don't see any function for rounding up if any decimal is found. Is there any easy way to do this? 回答1: Use the ceil function: $number = ceil(1.1); //2 回答2: I know this is an old topic, however it appears in Google. I will extend Blake Plumb's answer regarding precision. ceil(1024.321 * 100) /

Always getting 401 Unauthorized with new install of Rails + Devise

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a new install of Rails and am trying to set up authentication with Devise. As far as I can tell I have a very basic set up that should work, but whenever I try to log in with the default Devise sign in form I get an Unauthorized error. I am sure my credentials are correct as I created a User to test with in the console like so: User . new ({: email => 'mark@markdavies.com.au' , : priv_level => 'admin' , : password => 'mypassword' , : password_confirmation => 'mypassword' }). save My User model: class User < ActiveRecord ::

Does unaligned memory access always cause bus errors?

匿名 (未验证) 提交于 2019-12-03 02:12:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: According to the Wikipedia page Segmentation fault , a bus error can be caused by unaligned memory access. The article gives an example about how to trigger a bus error. In the example, we have to enable alignment checking to see the bus error. What if we disable such alignment checking? The program seems to work properly. I have a program access unaligned memory frequently, and it is used by quite a few people, but no one reports bus errors or other weird results to me. If we disable alignment checking, what is the side effect of

BuildConfig.DEBUG always false when building library projects with gradle

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: BuildConfig.DEBUG is not working (= logically set to false) when I run my app in debug mode. I use gradle to build.I have a library project where I do this check. BuildConfig.java looks like this in the build debug folder: /** Automatically generated file. DO NOT MODIFY */ package common.myProject; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); } and in the release folder: public static final boolean DEBUG = false; both in the library project and in the application project. I tried to get

Does COUNT(*) always return a result?

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: If I run a query such as: SELECT COUNT (*) as num FROM table WHERE x = 'y' Will it always return a result, even when the query doesn't match any record? Or do I need to validate and make sure a row is returned as the result? 回答1: Yes, because it's an aggregate and returns zero. Unless you add GROUP BY in which case no result because there is no group... MAX/SUM etc would return NULL unless you add GROUP BY then no rows. Only COUNT returns a number for no results Edit, a bit late: SUM would return NULL like MAX Edit, May 2013: this

Mongoose always returning an empty array NodeJS

匿名 (未验证) 提交于 2019-12-03 02:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have tried using find and findOne and both are not returning a document. find is returning an empty array while findOne is returning null . err in both cases in null as well. Here is my connection: function connectToDB(){ mongoose.connect("mongodb://localhost/test"); //i have also tried 127.0.0.1 db = mongoose.connection; db.on("error", console.error.bind(console, "connection error:")); db.once("open", function callback(){ console.log("CONNECTED"); }); }; Here is me schema: var fileSchema = mongoose.Schema({ hash: String, type: String,

X11/Xlib: Window always on top

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: A window should stay on top of all other windows. Is this somehow possible with plain x11/xlib? Googling for "Always on top" and "x11" / "xlib" didn't return anything useful. I'd avoid toolkits like GTK+, if somehow possible. I'm using Ubuntu with gnome desktop. In the window menu, there's an option "Always On Top". Is this provided by the X server or the window manager? If the second is the case, is there a general function that can be called for nearly any wm? Or how to do this in an "X11-generic" way? Edit: I implemented fizzer's answer,

UNIX timestamp always in GMT?

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: UNIX timestamp always in GMT? I tried to run php function time() and when I tried to convert the unix timestamp from the time() function, the output is not similar to the computer time. Thank You 回答1: yep, UNIX timestamp represents how much seconds past from unix-time epoch in GMT+0 回答2: UNIX timestamp (A.K.A. Unix's epoch) means elapsed seconds since January 1st 1970 00:00:00 UTC (Universal Time). So , if you need the time in a specific TimeZone, you should convert it. Even though is technically possible, I would recommend alternative ways

Why properties are always said to be made nonatomic in Objective C? [duplicate]

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: What's the difference between the atomic and nonatomic attributes? 26 answers It is said that nonatomic option will make your setter method run faster. I googled it but am not able to understand. Could someone tell me why? 回答1: Declaring a property atomic makes compiler generate additional code that prevents concurrent access to the property. This additional code locks a semaphore, then gets or sets the property, and then unlock the semaphore. Compared to setting or getting a primitive value or a