Microarchitectural zeroing of a register via the register renamer: performance versus a mov? |
Executive summary: You can run up to four xor ax, ax instructions per
cycle as compared to the slower mov immediate, reg instructions.
Details and references:
Wikipedia has a nice overview of register renaming in general:
http://en.wikipedia.org/wiki/Register_renaming
Torbj¨orn Granlund's timings for
instruction latencies and throughput for
AMD and Intel x86 processors are at: http://gmplib.org/~tege/x86-timing.pdf
Agner Fog nicely covers the specifics in his Micro-architecture study:
8.8 Register allocation and renaming
Register renaming is controlled by the register alias table (RAT) and
the reorder buffer (ROB) ... The µops from the decoders and the stack
engine go to the RAT via a queue and then to the ROB-read and the
reservation station. The RAT can handle 4
|
GCM (Google cloud messaging) - can I register multiple devices with same register id? |
No. Moreover, you should not need to. You can use user notifications to be
able to send a single message from the server to all instances of your app
across all the user's devices.
|
Why does this mathematical operation work? (Getting 8-bit register from 32-bit register) |
"mod 256" is the remainder after division by 256.
In binary, this turns out to be the lowest 8 bits (because 256 is 2 to the
8th).
This is just like "mod 2" gives you the least significant bit (0 or 1).
On (in decimal, base 10), "mod 100" gives you the last two decimals ( 2013
mod 100 => 13).
|
Vim register completion |
Hooking into the built-in commands (like " and Ctrl+r) is difficult,
because Vim then is in a special sub-mode where it waits for the register
name. I use the following "" mapping (which normally is a no-op) to refresh
my memory:
" ["x][N]"" List contents of the passed register / [N] named
" registers / all registers (that typically contain
" pasteable text).
nnoremap <silent> <expr> "" ':<C-u>registers ' .
(v:register ==# '"' ? (v:count ? strpart('abcdefghijklmnopqrstuvwxyz', 0,
v:count1) : '"0123456789abcdefghijklmnopqrstuvwxyz*+.') : v:register) .
"<CR>"
|
Register users in php? |
I believe you need to quote your values like so:
$Query = "INSERT INTO `sito` (`user`, `password`) VALUES('$Escape',
'$Password')";
Also you might want to check out mysqli or PDO instead of using mysql_*
functions.
|
@Register or ? |
From an efficiency standpoint, it would seem that using the controls
element in web.config would be better, because it is cached once when the
application starts; whereas the page directive Register will be processed
every page request.
|
What does “Register for COM Interop” actually do? Q2 |
Visual Studio enumerate the
HKEY_LOCAL_MACHINESOFTWAREWow6432NodeClassesTypeLib registry key to fill
the COM tab. Drop Wow6432Node if you use the 32-bit version of Windows.
So what's missing is that you forgot to ask Regasm.exe to register the type
library. You need to also use the /tlb option.
|
Can't register assembly in .Net GAC |
Found the answer. It appears that library was build in .net 2, and it can
not appear here c:WindowsMicrosoft.NetassemblyGAC_MSIL because it is GAC
for assemblies build in .net 4 and higher. So I just take library build in
.net 4 and register it using gacutil from
c:Program Files (x86)Microsoft SDKsWindowsv8.0AinNETFX 4.0 Toolsx64
|
How to pass value from rax to xmm register |
(Presumed) Problem:
movq $1, -72(%rbp) moves the integer value 1 into memory, which, when
represented as a floating point number is something extremely small. When
you multiply 'x' by this number the result is so small that it's rounded to
0.
Potential Solutions:
Move a floating point immediate value of 1.0f into memory, instead of 1. I
can't say exactly how to do this because I don't know what assembler you're
using.
Like Brett Hale said, convert the integer into a floating point number.
There's probably a million ways to do this, so just Google something like
"SSE Integer to Float", and you'll a bunch of results.
|
to use GCM, each device will need to register? |
By using gcm sender id,you will use in android ie client side and server
browser api in server side say php side. So when a device opens,it will
create gcm register id at server side and intermediate is gcm account and
it will monitor the device.so you can send notification from server to
client. For same device,only unique gcm registration id will be generated.
See this tutorial
http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/
|
Not able to register a user. How do I do that? |
I use the code below. The code assumes that the XMPP server is running
locally (localhost). The createAccount method is creating internally a
Registration packet and sends it through the connection.
public static void main(String[] args)
{
XMPPConnection.DEBUG_ENABLED = true;
XMPPConnection connection=null;
try
{
ConnectionConfiguration config = new
ConnectionConfiguration("localhost", 5222);
connection = new XMPPConnection(config);
connection.connect();
AccountManager accountManager = connection.getAccountManager();
if(accountManager.supportsAccountCreation())
{
accountManager.createAccount("user1", "user1pw");
}
else
{
...
}
}
catch (Exception e)
{
|
gdb - get variable name of register |
There might be one register, multiple registers, or even no registers
associated with any given C variable at any given point in time. You'll
have to inspect the disassembly to see what's going on.
Why not just print my_reg to see the value?
l *$pc will list the source code around the current instruction being
executed.
|
Django register |
You need to use authenticate() first, before calling login().
from django.contrib.auth import authenticate, login
if(form.is_valid()):
form.save()
new_user = authenticate(username=form.cleaned_data.get('username'),
password= form.cleaned_data.get('password'))
login(request,new_user)
return redirect('/dashboard/')
From Django docs:
When you’re manually logging a user in, you must call authenticate()
before you call login(). authenticate() sets an attribute on the User
noting which authentication backend successfully authenticated that user
(see the backends documentation for details), and this information is
needed later during the login process. An error will be raised if you try
to login a user object retrieved from the database direct
|
Increment eax register by 4 bytes |
The thing you want is pretty simple, but you need to add few additional
information to your code, because you're writing x86 assembly and not any
high-level language like Java or C#.
First solution is to keep counting in ecx and compare it with array length.
...
arrlen: .long (arrlen - myvar)/4
...
xor %ecx, %ecx
loop:
movl $0, %edi
movl $myvar(, %ecx, 4), %eax
pushl %ecx
...
//fill other registers
...
int $0x80
popl %ecx
incl %ecx
cmpl %ecx, arrlen
jne loop
Another way is just to check value loaded. After calling system call, you
can't be sure that it won't affect register values (some system calls
return information in same registers as used for parameters). You can
simply save it on stack, or faster, do comparasion direcly in memory.
pus
|
how to register YUI drag event |
I don't think you can listen to the drag event using jsPlumb.
YUI has a Drag class which is the one that fires the drag event. Usually
you'd create an instance of this class and that would be enough to make
your node draggable.
var dd = new Y.DD.Drag({
node: '#foo'
});
dd.on('drag:drag', function () {
// do something
});
But jsPlumb creates a hidden Drag instance and keeps it to itself. There
doesn't seem to be a way to retrieve that Drag instance. My recommendation
would be to open an issue in jsPlumb's GitHub asking for a way to do this.
|
Why is CPSR not a banked register? |
Manual mode changes are not an efficiency goal on the ARM. Typically,
manual mode changes are only done to setup stacks, etc at boot or
initialization time.
The cpsr is the active copy. Why do we have a banked lr register but not
the current pc? The spsr is a banked cpsr for a different mode; just like
the banked lr is the pc for a different mode. The banking is so that the
exception state can be transparent. The spsr is banked as an interrupt or
data abort may occur in any mode; we need to save it so that we stack
execution correctly. The normal unbanked user mode never stacks with
another mode. mode changes are done automatically in exception conditions.
The mode registers are setup to make exception handling very efficient and
flexible. Manual mode changes are not highly conve
|
How to access values in an xmm register |
This is how clang on my OS X machine does it -- annotated for clarity:
# this is the constant '(double)2.5'
LCPI0_0:
.quad 4612811918334230528 ## double 2.500000e+00
## (0x4004000000000000)
leaq L_.str(%rip), %rdi # arg1 = format string address
movsd LCPI0_0(%rip), %xmm0 # float arg2 = 2.5
movb $1, %al # number of floating-point arguments
callq _printf
.section __TEXT,__cstring,cstring_literals
L_.str:
.asciz "%f
" # here's the format string
|
What happens when we try to set the register of the currently executing code? |
According to the Intel manual, you get an "undefined opcode" exception:
mov — Move
{ Protected Mode, Real-Address Mode, Virtual-8086 Mode, 64-Bit Mode}
Excpetions
#UD If attempt is made to load the CS register.
|
Register callback from Java to C++ via JNI or JNA |
This is what it looks like in JNA:
public interface MyLibrary extends Library { /* StdCallLibrary if using
__stdcall__ */
interface MyCallback extends Callback { /* StdCallCallback if using
__stdcall__ */
void invoke(/* fill your parameters here*/);
}
DWORD RegisterCallback(HANDLE handle, int type, MyCallback callback);
}
...
MyLibrary lib = (MyLibrary)Native.loadLibrary("mylib", MyLibrary.class/*,
options*/);
MyCallback callback = new MyCallback() {
public void invoke() {
System.out.println("Success!");
}
};
HANDLE h = ...;
int type = ...;
lib.RegisterCallback(h, type, callback);
...
Suffice to say the JNI version is quite a bit longer, plus you have a
native compile step to account for.
|
fast compact register using sse |
Simple and very fast, but requires 4KB of table space:
_mm_shuffle_epi8(a, mask_lookup[bitvector]);
where you simply store all 256 possible shuffle masks in a table indexed by
the bitvector.
|
Register annotation router |
Information found in the phalcon forum:
http://forum.phalconphp.com/discussion/344/multi-module-wildcard-annotation-router
One has to register the namespace with the PhalconLoader instead of the
throught the modules loader.
$loader = new Loader();
$loader->registerNamespaces(
array(
'AppsBackendControllers' => __dir__ .
'/../apps/backend/controllers/'
)
);
$loader->register();
|
Read Register via Modbus |
By reading the documentation from LibModBus, I think you're missing a call
to modbus_connect.
Try connecting before reading registers:
ctx = modbus_new_rtu("/dev/ttyS0", 115200, 'N',8,1);
if (ctx == NULL) {
fprintf(stderr, "Creation failed: %s
", modbus_strerror(errno));
return -1;
}
if (modbus_connect(ctx) == -1) {
fprintf(stderr, "Connection failed: %s
", modbus_strerror(errno));
modbus_free(ctx);
return -1;
}
Also, remember to modbus_close and modbus_free your context before exiting
due to further error conditions. For example:
rc = modbus_read_registers(ctx, 0, 10, tab_reg);
if (rc == -1) {
fprintf(stderr, "%s
", modbus_strerror(errno));
modbus_close(ctx);
modbus_free(ctx);
return -1;
}
|
Register VML behavior dynamically in IE7 |
You can create style sheet for VML using the below code
document.namespaces.add("v","urn:schemas-microsoft-com:vml");
var style = document.createStyleSheet();
style.addRule('v\:*', "behavior: url(#default#VML);");
This code will work in IE 7 & above, but I have not tested in IE 6
|
How to register a widgetized sidebar |
Try this
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => __( 'Right Hand Sidebar' ),
'id' => 'left-sidebar-login',
'description' => __( 'ThemeMyLogin Widget Area' ),
'before_title' => '<h1>',
'after_title' => '</h1>'
));
|
Explicitly re-register device to GCM |
Part 1:
In order to check if the registration id is refreshed to a new one or it
is still the same, I plan to re-register.
Now, if you see the second point under the heading Enable GCM on
Architectural Overview page, it says:
Note that Google may periodically refresh the registration ID, so you
should design your Android application with the understanding that the
com.google.android.c2dm.intent.REGISTRATION intent may be called multiple
times. Your Android application needs to be able to respond accordingly.
So, Google automatically sends you this broadcast, when it renews the ID.
You might not necessarily send check the emptyness of the ID. When Google
changes the ID, then also it won't be empty, right? So if you want to
handle the renewal/refreshing of the ID then you may do the
|
ExpressJs Cannot Get /register Error |
You route for /register should look like this:
app.get("/register", function (req, res) {
res.sendfile(__dirname + "/register.html");
});
Currently you have put both the login and the register view on "/", but
only the first will work.
|
Yii register form does not work |
You must NOT comment out the rules() function.
In it, you MUST set the attributes to safe, to allow Yii to copy the fields
from the form to model:
public function rules() {
return array(
array('username, password, user_sex, user_qq,
user_hobby, user_xueli, user_introduce,
user_email, user_tel', 'safe'),
);
}
See also:
http://www.yiiframework.com/wiki/161/understanding-safe-validation-rules/
|
NoReverseMatch at /accounts/register/ |
The information you need is in the traceback you have provided,
In template /Users/Studio/Desktop/pod/t1/tut/tut/templates/base.html,
error at line 16
Reverse for 'index' with arguments '()' and keyword arguments '{}' not
found.
In your base.html template, on line 16, you are using the url tag to link
to the view named 'index'.
16 <a href="{% url 'index' %}">{% trans "Home" %}</a> |
However, there is no url pattern named index in your url patterns.
Therefore the reverse fails, and raises a NoReverseMatch exception.
You can fix this by creating an index view in your tut.views module, and
adding it to your url patterns.
url(r'^$', 'tut.views.index', name='index'),
Alternatively, you can remove the {% url 'index' %} from your template
until you add an index vi
|
vim system register * and + not working |
If you have copy something to clipboard and paste that in vim, you can use
"+p.
+ is a quoteplus, which means CLIPBOARD documented X selection. :help
quoteplus for more information.
If you want to copy something in vim to clipboard and paste the content in
the other place by Ctrl+v, you can do "+yy, this will copy the current line
to clipboard.
more information about vim register:
:help registers
:help quotestar
|
Redirect after Register Using UserID |
var userID = System.Web.Security.Membership.GetUser().ProviderUserKey;
Using the WebSecurity and System.Web.Security items will only work on
subsequent request because you have not sent the auth cookie back to the
client yet (this is where it pulls its data from). Given that, you should
not even have to send the user Id of the user in the redirect URL...they
are logged in and you can just get it at the controller/action that you are
going to. By grabbing the userId from the auth ticket, you now do not have
to check if the user Id passed in the URL is actually the user that is
currently logged in.
Example:
Login Method
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Register(RegisterModel model)
{
if (!ModelState.IsValid)
|
How can i register a Receiver in a service? |
Try
registerReceiver(yourReceiver, new
IntentFilter("android.intent.action.BATTERY_CHANGED"));
You might will need to add the
<uses-permission android:name="android.permission.BROADCAST_STICKY"/>
in your Manifest file
|
GoogleCloudMessaging Hello World register |
First of all, you must use an AsyncTask, since the register method is
blocking, and can't be called by the main thread.
You cab save the registration id in shared preferences and access it from
anywhere. See the deno code at the GCM programmers guide.
As for using the send method, you should only use it for device to cloud
messages, which are messages from your app to your server. For such
messages to reach your server your server must establish a XMPP connection
with the GCM server.
For the simpler cloud to device messaging, you can send messages from your
server to your app via the HTTP API .
|
php login register error |
In your database, you are storing the password field with md5 encryption.
So, while checking username and password in your login and checkuser
function, you nee to check password as md5($password).
Also, I wonder why you have kept the form name and submit button name same.
|
Remote register of ocx using powershell |
I think you are overenginnering, try:
$LocalOCXPath = "C:WindowsSysWOW64dxapi.ocx"
Invoke-Command -ComputerName $ComputerName -ScriptBlock { &
'regsvr32.exe' $LocalOCXPath }
|
Register Variable in Ansible |
I test the code use ansible 1.2 on my mbp, it works fine:
---
- hosts: local
tasks:
- name: Checking if Sources are Available
action: shell echo a$(cat /etc/apt/sources.list | grep $(echo
'http://url/${ansible_distribution}/stable' | tr "[:upper:]" "[:lower:]"
))
register: sources
ignore_errors: True
- debug: msg="sources value is ${sources.stdout} "
- name: Adding source.
action: shell echo "deb http://url/${ansible_distribution}/stable
${ansible_lsb.codename} main" | tr "[:upper:]" "[:lower:]" >>
/etc/apt/sources.list
when: "ansible_os_family == 'RedHat' and sources.stdout == 'a'"
result:
ansible-playbook test.yml
PLAY [local]
******************************************************************
GATHERING FACTS ***************
|
Parsing Sax XML but only the last register is kept in memory |
the issue is related to the todo tag. Every time you get that tag inside
your startElement you override the current value of data: remove it from
the startElement and instantiate it at declaration time
public static XMLGettersSetters data = new XMLGettersSetters();
|
G++ Asm inline: register clobbering |
This question is kind of tricky. As far as I know, the way you compile will
have impact on the result. I am not sure if this is what you need but if
you don't use inline assembly, you can control it.
You write your code in a separate .s file, and compile with optimization
like -O3, gcc will not push and protect nonvolatile registers. I don't use
inline assembly myself so I am not clear with that part. You can test it
yourself :D
BTW: I think if you write .asm file and use nasm to compile it and link the
object with gcc, same thing would happen. With optimization, I don't think
gcc will do the push/pop automatically. Let me know if there are something
wrong in my reply. Thanks.
Good luck
xiangpisaiMM
|
Register GCM from a library project |
Here's what you have to do :
Write a class (in your library project) that overrides GCMBroadcastReceiver
:
package com.test.pushlibrary;
import android.content.Context;
import com.google.android.gcm.GCMBroadcastReceiver;
public class PushLibraryBroadcastReceiver extends GCMBroadcastReceiver
{
/**
* Gets the class name of the intent service that will handle GCM
messages.
*/
@Override
protected String getGCMIntentServiceClassName(Context context) {
return "com.test.pushlibrary.GCMIntentService";
}
}
Change your manifest to refer to the new receiver :
<receiver
android:name="com.test.pushlibrary.PushLibraryBroadcastReceiver"
...
The reason that your original code didn't work is that the default
implementation of getGCMIntentS
|
Compare number with register |
The compare instruction produces enough information to determine all the
ordering information—less than, equal to, or greater than. The branch
instruction chooses which conditions to branch on. Change BLO to BHI.
Note: You did not specify the architecture or assembly language, so I am
partially guessing about BHI. You should check the documentation. Various
architectures and assembly languages have variants for slightly different
kinds of branches. For example, BHI may be for branching if the comparison
shows one unsigned value is higher than another unsigned value, while BGT
may be for branch if the comparison shows one signed value is greater than
than another signed value.
|
How to register listeners in android |
You have not understand the android concept at all.
There is always only one Activity at once visible.
Therefore your code will not work. You can not instantiate a Activity by
calling new Activity_X();
The Android OS is responsible to start / instantiate an Activity, and an
Activity has its lifecycle (onCreate(), onResume(), onPause() onDestroy())
but you can not instantiate Activities directly like you would do, and as
mentioned before, there is normally only one active Activity on screen (The
only way you can have two activities active at the same time is, if you
have a activity with transparent background on top of a normal activity).
Read that:
Android getting started
|