|what's the fast and new way(based on high performance) of reading event logs from remote machine using c#|
I don't know if this is faster, but worth a shot
My suggestion is to skip the eventlogreader class and go straight to WMI (
where you may be able to query just what you want.
Also, you can get the remote machine to backup the event log then try
copying the backup...
you may want to look at
How to construct WMI query
on how to do WMI From C#
|what does a C process status mean in HTOP|
Here are the different values that the s, stat and state output specifiers
(header "STAT" or "S") will display to describe the state of a process:
D uninterruptible sleep (usually IO)
R running or runnable (on run queue)
S interruptible sleep (waiting for an event to complete)
T stopped, either by a job control signal or because it is being traced.
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z defunct ("zombie") process, terminated but not reaped by its parent.
Source: man ps
|How do I interpret the memory usage information from htop|
htop author here.
Does server #1 have more memory available than server #2?
From the htop faq:
The memory meter in htop says a low number, such as 9%, when top shows
something like 90%! (Or: the MEM% number is low, but the bar looks almost
full. What's going on?)
The number showed by the memory meter is the total memory used by
processes. The additional available memory is used by the Linux kernel for
buffering and disk cache, so in total almost the entire memory is in use by
the kernel. I believe the number displayed by htop is a more meaningful
metric of resources used: the number corresponds to the green bars; the
blue and brown bars correspond to buffers and cache, respectively (as
explained in the Help screen accessible through the F1 key). Numeric data
|Azure Could Computing high availoability vs NEO4J high availability?|
The short answer is probably yes.
Windows Azure provide you infrastructure that allow you to build high
availability system, it won't make any system high available by magic.
As NEO4J is state-full, each node (with only one node Azure don't give you
any SLA, you instance will be down) will need to share some state and the
way to do it will be dependent on how NEO4J is working. So you will need
to rely on NEO4J mechanism to do it.
I don't know how NEO4J is working but you won't be able to skip designing
an high available architecture around NEO4J using Windows Azure infra.
Cloud may be a magic buzz word that can make things append on management
level, but when we are on hard real world level Harry magic wand doesn't
|quicksand sorting price values low to high / high to low|
val() gives you a string, so > and < comparisons are lexographical
(not numeric). Try wrapping the values in parseInt() or parseFloat().
Make sure to add appropriate error handling as well.
|List View Not Showing Images on Right Most Corner only in High Resolution Devices|
apply android:layout_width="match_parent"and change
android:layout_weight=""(shown below) to both ImageView and inner
LinearLayout in rowdata.xml
here is code
<?xml version="1.0" encoding="utf-8"?>
|Varnish High DB Connections In High Traffic|
Mostly spiking backend connections has little to do with your varnish
configuration but alot to do with the cachability of your site.
Are there cookies that prevents you from caching efficiently? You can chose
to strip them or remove all but chosen ones, there are examples for both on
the varnish site.
Do a varnishstat and check your hit rates during peaks. Is it a good cache
hitratio? Is it the same as during low load? If it's the same or higher in
low load it's easy to work on improving it at any time.
Do a varnishtop -i txurl to see what requests are the most frequently sent
to backend servers. Maybe it's some URLs that are just not cached due to
faulty headers? Maybe some pages can be cached longer? Maybe some parts of
the pages can be cached with ESI?
Make sure your varnish is not
|va_alist ( using variable list in 64 bit machine )|
How varargs works on x86-64 is actually fairly complicated.
If we take this as an example:
printf("%d %f %p %d %f", 17, f, "hello", 42, 0.8);
The code it generates is:
.string "%d %f %p %d %f"
.type main, @function
subq $8, %rsp
movl $42, %ecx
movl $.LC1, %edx
movsd .LC0(%rip), %xmm1
movl $17, %esi
movsd .LC2(%rip), %xmm0
movl $.LC3, %edi
movl $2, %eax
xorl %eax, %eax
|How to get list of all git remotes present on my machine?|
"git remote" modifies the local config of a repo, ie the config file under
the .git directory of a repo.
That means there is no "central place" where to query all your repo: you
need to search for all .git directory on your local machine or your heroku
instance, and do a git remote -v in each one to see the remotes defined.
|When to use low < high or low + 1 < high for loop invariant|
If your invariant is that the target must lie in low <= i <= high,
then you use while (low < high); if your invariant is that the target
must lie in low <= i < high then you use while (low + 1 < high).
[Thanks to David Eisenstat for confirming this.]
|Determine list of non-OS packages installed on a RedHat Linux machine|
yum provides some useful information about when & from where a package
was installed. If you have the system installation date then can you pull
out packages that were installed after that, as well as packages that were
installed from different sources & locations.
Coming at it from the other direction you can query rpm to find out which
packages provides each of the binaries in /sbin /lib etc ... - any package
that doesn't provide a "system" binary or library is part of your initial
set for consideration.
|How to copy only file permissions and user:group from one machine and apply them on another machine in linux?|
How about this?
while read file
permission=$(stat -c %a $file) # retrieve permission
owner=$(stat -c %U $file) # retrieve owner
group=$(stat -c %G $file) # retrieve group
# just for debugging
echo "$file@local: p = $permission, o = $owner, g = $group"
# copy the permission
ssh $user@$host "chmod $permission $file" < /dev/null
# copy both owner and group
ssh $user@$host "chown $owner:$group $file" < /dev/null
done < list.txt
I am assuming that the list of the files is saved in "list.txt".
Moreover you should set the variables "user" and "host" accordingly to your
I would suggest to configure ssh to have "automatic login". Otherwise you
the password twice per loop. Here
|ModelState.isValid = false on production machine, true on development machine|
As I mentioned in the edit, I found the cause of and solution to my
problem. It was caused by an error being thrown by the automatic binding of
parameters, and the reason it was having issues with dates on my production
machine was due to the locale settings (dd/mm/yy vs mm/dd/yy) on that
machine. To fix, I set the computers region settings (in the control
panel), and also added a line into my Web.config.
|Is it possible to remotely debug a 64 bit machine from 32 bit Host Machine(which has visual studio)|
According to MSDN, the answer in the other article is incorrect, and you
can debug x64 from an x86 host:
If you are debugging remotely, Visual Studio can run under WOW64 or on
a 32-bit computer. You can debug both IA64 and x64 applications, in
addition to 32-bit applications that are running under x64 WOW mode or
on 32-bit operating systems.
|Use NLP / Machine Learning to teach a machine how to detect if a string is mathematical?|
Parsing is a better tool than machine learning for this problem. What you
have described is a relatively simple grammar for arithmetic, with some
aliases for numbers, and a touch of syntax for those aliases. A tokenizer
and some basic syntactic analysis, which you could code directly, will
produce better more reliable results with significantly less computational
effort than machine learning and optimization will.
One reason why parsing is sufficient is that you don't need to worry about
misspellings as often as you do, say, with people's names. If you want to
get fancy about that, then use your Jaro-Winkler-based things for lexical
analysis and then use syntatic analysis on what you think are your tokens.
That is still much cheaper and less complex than machine learning.
I don't know mu
|PyDev: Running Code in local machine to remote machine|
One solution would be:
Install python on the remote machine
Package your code into a python package using distutils (see
http://wiki.python.org/moin/Distutils/Tutorial). Basically the process ends
when you run the command python setup sdist in the root dir of your
project, and get a tar.gz file in the dist/ subfolder.
Copy your package to the remote server using scp, for example, if it is an
scp -i myPemFile.pem local-python-package.tar.gz
Run sudo pip install local-python-package.tar.gz on the remote server
Now you can either SSH to the remote machine and run your code or use some
remote enabler such as fabric to start commands on the remote server (works
for any shell command, specifically python scripts)
Alternatively, you c
|MySQL statement failing on local machine but not deployment machine?|
The failure is referring to the d.id in the nested subquery:
FROM DOLineEJB dol2
You can fix the query:
SELECT d.id, ..., dol.weight, d.status
FROM DeliveryOrderEJB d join
on d.id=lnk.DeliveryOrderEJB_id left join
FROM DOLineEJB dol2
ORDER BY d.id
I believe the problem is because you have different versions of MySQL on
the machines. MySQL changed the semantics of the , around version 5.0.
|SQL server 2012 : SQL query to get list of database for which a server is secondary in high availability configuration|
So, I don't have an exact query for you but it shouldn't be too hard to do,
there are 2 DMVs to look at for this:
sys.dm_hadr_availability_group_states - This will tell you about the
availability groups and which servers are primary/secondary replicas for
sys.dm_hadr_database_replica_states - This will tell you about the
databases within each availibility group and what state they are in
Join the two of these together on the group_id column and you will be able
to see what databases are in which availability group and which servers are
acting as primary/secondary replicas.
Links to the docs here:
AlwaysOn Availability Groups Dynamic Management Views and Functions
|How to calculate the offset of machine instructions using machine code itself?|
In general, a machine instruction set uses three types of storage
Absolute addresses which refer to the exact storage location of interest.
Base-relative addresses which, when added to the contents of a "base
register", refer to the storage location of interest.
Instruction-relative addresses which, when added to the address of the
instruction containing them, refer to the storage location of interest.
Usually the 3rd type does not need to be "relocated", since the location
being referred to will generally be in the same code segment as the
referring instruction, so they move together.
The second type may or may not require change upon binding/loading,
depending on details of the compiled code binding scheme.
The first type will almost always require changing, but it's u
|Connecting Clients machine to MySQL Server machine|
You can use other tool with good looking GUI. For example: HeidiSQL.
Then, you need to enable remote access. If you use windows, there is nice
wizard for you to enable remote access with a few clicks. The wizard is
located it at MySQL Server 5.5inMySQLInstanceConfig.exe. Then
Reconfigure Instance -> Next -> Standard Configuration -> Next
-> Next. You will see this screen.
Tick on "Enable root access from remote machines". Or you can manually
configure it to allow remote access from my.ini file. See this link for how
to do it.
If having done above still does not allow you to connect to your MySQL.
Please make sure that Firewall does not block MySQL port.
|Powershell tasks from local machine to remote machine|
Reading from docs on MSDN:
To run a single command on a remote computer, use the ComputerName
parameter. To run a series of related commands that share data, use the
New-PSSession cmdlet to create a PSSession (a persistent connection) on the
remote computer, and then use the Session parameter of Invoke-Command to
run the command in the PSSession. To run a command in a disconnected
session, use the InDisconnectedSession parameter. To run a command in a
background job, use the AsJob parameter.
So basically you should do something like:
$session = New-PSSession
Invoke-Command -Session $session -FilePath <PathToScript>
|host webapp in my machine trough virtual machine|
Yes to both questions, if your browser machine can hit the port the server
machine is serving the app on. On WAN, you would need to make sure your
router didn't block requests to the server's port, and the same for any
modem/firewall that connects you to the internet at large. Also, if your
public ip is not static, it may change.
|Installation of MSI File on remote machine from local machine|
You're running a remote MSI on the local host. To install the remote
executable on a remote host, you could use WMI:
host = "<IP ADDR>"
setup = "msiexec /a ""C:MySetup<FILENAME>"" /quiet ..."
Set wmi = GetObject("winmgmts://" & host & "/root/cimv2")
rc = wmi.Get("Win32_Process").Create(setup, , , pid)
If rc = 0 Then
WScript.Echo "Setup started with PID " & pid & "."
WScript.Echo "Starting setup failed. (" & rc & ")"
The above will start the process asynchronously (i.e. Create returns
immediately). If you need to wait for the remote process to complete,
you'll have to monitor it like this:
Set p = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE ProcessID="
Loop Until p.Count = 0
There may be s
|If an application is built on a 32-bit machine, when run on a 64-bit machine, how does it look for DLLs?|
First of all, you can cross-compile in either direction so being built on a
32-bit machine doesn't necessarily mean anything. It is really an issue of
running 32-bit code on a 64-bit machine. In this case, there is a 32-bit
emulation layer on 64-bit installations called Wow64. Part of this is file
system redirection, which redirects file system requests from 32-bit
programs. In this case, trying to access "C:Program Files" from 32-bit
code will transparently redirect to "C:Program Files (x86)".
|How to SSH from Perl script from windows machine to EC2 machine|
Use Net::SSH::Perl to avoid tricky (on Windows!) dependencies to
ssh-binaries. This module is written completely in Perl, so it should work
on any platform. Net::SSH::Perl
|porting opencv project from 32 bit machine to 64 bit machine|
As I tried, It will be enough to copy your files to new system and do not
forget to add your x:WindowsSysWOW64 some needed dll files
for example you might needed opencv_core245.dll file and you might get it
from OpenCV directory
Or just another way if you were builded with MS VS to download and install
your new system redistributable package from following link
I have just found one more solution which is copying all needed dll files
to same directory with .exe
Hope it helps
|Auto Generate Machine Key VS. Custom Machine Key|
If you have a WebFarm you have to use custom machine key, other way it
The only secure problem is that there are people, who knows these machine
key. If they "sell it" outside your company somebody can for example
decrypt your cookies.
|Purpose of "Target machine" field in Visual studio -> Linker-> Advanced Options->Target Machine|
This option relates to the linker option /MACHINE and is a hint for the
linker for what target architecture to link the object code if he (the
linker) cannot determine this from the object file. As MSDN states you
usually have not to specify this. So no you don't need to explicitly
specify this flag when porting your code.
|How to install all the packages that are on machine A onto machine B?|
This should be a start
sudo dpkg --set-selections < (ssh othermachine dpkg --get-selections)
|migration c++ code 32 bit machine to 64 bit machine|
reverse() reverses the byte-order, depending on platform. Shown here seems
to be only the non-SPARC version of reverse() See endianness.
Reason for reversing the byte-order (i.e. calling reverse()) before writing
to file is to make the file format platform (i.e. endianness) independent.
|I need to get a list of branches of a git repo without having cloned the repo on my local machine|
You can use
git ls-remote --heads <URL OF REMOTE REPO>
to get a list of branches in the remote repository.
The entries will have the format <SHA> <REF NAME>, where the
<REF NAME> is prefixed with refs/heads/. You can ignore this prefix
(it's the full name of the branch refs, but that's not important for you in
If you need to do this often and only want to see the actual branch names
(not the full ref names), you could also write a script to filter and
transform the output.
|How to solve could not create the virtual machine error of Java Virtual Machine Launcher?|
Edit your Catlina.bat so that your -Xmx settings are less than your
See Tomcat 7: How to set initial heap size correctly?
|Upload file from my virtual machine to another virtual machine using hadoop hdfs|
You might find webHDFS REST API useful. I have tried it to write content
from my local FS to the HDFS and it works fine. But being REST based it
should work fine from local FS of a remote machine as well, provided both
machines are connected.
|C# :Does Client machine need SQL Server installed on it while connecting to other machine having SQL Server installed on it (the Server machine)|
The pieces needed to connect to SQL server are built into the .net
framework. As long as you used those when coding the client piece you can
connect to a SQL Database without MSSQL installed on the client.
PS: I am asking beforehand to avoid the last minute hassle on the day of
You should always test locally first. You can probally get your hands on a
random test machine to verify that everything is good to go.
|Copying a file from a windows machine to another windows machine through java|
You cannot copy to a folder that it is not shared.
The operating system of the computer where you want to copy files will
never allow you to write wherever you want for obvious security reasons.
|TimeZoneInfo which was defined by local machine not found by local machine?|
You're calling ToString() on TimeZoneInfo - that doesn't give the ID, it
gives the display name. Often they're the same in English cultures, but
they don't have to be, and usually won't be in non-English cultures.
Basically you should persist TimeZoneInfo.Local.Id instead of
(Note that using the Windows system time zone identifiers pins you down to
Windows pretty heavily. You might want to consider using TZDB time zone
information instead, e.g. via my Noda Time project. That's a separate
|Same android cmake git project compiles well on one Ubuntu machine but does not compile on another Ubuntu machine even the entire project is the same|
whoa! Solved! It was really a weird behaviour from cmake: I had three files
conf.c that must be merged into a static library. When cmake run the AR
program to create the library, it executed a command that was like:
ar cr dir1/source1.c dir1/source2.c ... dft/conf.c rdft/conf.c
ar r reodft/conf.c dir2/source3.c
so, maybe due to the huge number of object files that were to be linked,
cmake splitted ar commands in two command, BUT second command overwrited
one of the two file conf.c that were added with the first command, so
symbols defined with the first ar command were lost! This is clearly a bug
in ar because even if the source file is the same, maybe the content may
vary, thus symbols are not to be deleted. Thanks to all! Your suggestions
brought me to the right solution!
|Java Virtual Machine newbie Confusion: When is the virtual machine invoked while compiling java|
Yes, the .class file is JVM bytecode. The JVM (invoked by java foo for
foo.class) interprets (some JVMs JIT the bytecode into native machine code
at runtime) the bytecode.
|Cannot access ubuntu server from other machines other than the machine which is hosting the virtual machine which is my ubuntu server|
First of all make sure in the setting of the virtual machine that it is in
Bridged Adaptor type connectivity.
Give a static ip to the virtual machine using
sudo ifconfig eth0 10.0.0.100 netmask 255.255.255.0
the above is an example. You got what I mean.
3.Third, Try pinging the virtual machine with the base machine running the
vbox to make sure they are connected.
4 . Now if everything is working fine from there then connect with this
virtual machine with other base machine using Remote Desktop Viewer or any
other similar application.
Specify, the ip-address of the vbox and username, password. It will be able
to connect with it now.
5 . If it still is not able to then try to check the firewall rules on both
the virtual box machine and the base machine
|Could the first part of a url resolve to machine X but if you add a path it would resolve to machine Y?|
No, it is not possible.
http://somehostname/application means, "connect, using the http protocol,
to the server called somehostname, and as for /application". The closes
thing to this would be that the server can use a redirect (saying, "no, you
want to go to that machine instead"), or the server could proxy the request
- without telling the web browser, go out and get the page from elsewhere,
and then present it to the browser as if the page was it's own.