w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
cross memory attach. How do I get the remote address from a child process to a parent process
The system calls process_vm_readv and process_vm_writev are meant for fast data transfer between processes. They are supposed to be used in addition to some traditional way of interprocess communication. For example, you may use a regular pipe or fifo to transfer the required addresses between your processes. Then you may use those addresses to establish faster process_vm_ communication. The simpliest way to transfer something between forked processes should be the pipe() function (man 2 pipe has a good example of its usage). There are many other ways to do so of course, like using sockets or messages. You can even write an address to a file and let the other process read it.

Categories : C

multiprocess in python: cross process to process watch-kill-restart
I've enabled Debug functions, and tried to kill and restart child processes from the parent. I've turned A and B in classes and added a shutdown method that kill the failing process, after this, if I try A.start() or A.run() this error appear 'cannot start a process twice'.What this means? the process is dead, there aren't others running. If I call multiprocessing.active_childre() the process aren't restarted but got this output: <Process(SyncManager-2, started)>, <Process(SyncManager-1, started)>, <Process(SyncManager-3, started)>] [INFO/MainProcess] process shutting down [DEBUG/MainProcess] running all "atexit" finalizers with priority >= 0 [SUBDEBUG/MainProcess] calling <Finalize object, callback=_decref, args=(Token(typeid='Value', address='/tmp/pymp-2ObnP1

Categories : Python

GSM communication, cross threading
Reason for Cross thread exception: You are trying to update GUI element on a thread other then the one on which it was created. it is not allowed. Solution: To avoid cross thread exception. You should update your code like this this.Invoke((MethodInvoker) delegate { // update your textbox here });

Categories : C#

Creating an API in yii for cross domain communication
As i see this string contents error url:'http:'http//uxaserver.local/alpha2_uxarmy/app/users/crossDomain' , Should be url:'http//uxaserver.local/alpha2_uxarmy/app/users/crossDomain' ,

Categories : Javascript

Designing a cross platform communication interface
This can really depend on your infrastructure and services you are using. If you are in the Amazon Web Services world you could use a Simple Queue Service (SQS) to receive messages. The remote systems could then poll the queue and run the jobs based on the messages pulled off the SQS queue.

Categories : C#

Qt blocking threads and cross-thread communication
Use event loops in the secondary threads. QThread::exec() starts the thread's event loop which will run until QThread::quit() is called. That should solve your "how to wait until something happens" problem. The default implementation of QThread::run() just calls exec(), so I'd go with that. You could set everything up in your main() method, e.g. for the sender thread: //Create UI MainWindow mainWindow; mainWindow.show(); //set up sender thread and the QObject doing the actual work (Sender) QThread senderThread; Sender sender; //the object doing the actual sending sender.moveToThread(&sender); //move sender to its thread senderThread.start(); //starts the thread which will then enter the event loop //connect UI to sender thread QObject::connect(&mainWindow, SIGNAL(sendMessage(QS

Categories : Multithreading

Using Anonymous method not preferred by .NET itself?
There are no overloads of Console.WriteLine which accept a Func<string> - and indeed even your current WriteLog method won't do anything useful (as you'd need to invoke the delegate). Where methods accepting specific delegates do exist - most prominently in LINQ, but elsewhere too - you can indeed use lambda expressions or anonymous methods to invoke them. You can call Console.WriteLine using a lambda expression, but you need to cast it to a specific delegate type - as there are only conversions from lambda expressions to specific delegate or expression types, not just Delegate or object. So this will work: Console.WriteLine((Func<string>)(() => "someLogData")); Again though, it wouldn't be useful to do so anyway - you don't want to log the delegate, you want to log the

Categories : C#

FIFO Communication between two different process c++
In readMsg, your last mempcpy writes to msg, not to the InfotT you just allocated. Also, but I suppose you know this: this is only guaranteed to work if both processes were compiled with the same compiler, using the same options. (In practice, it's likely to work if the underlying system defines its API in terms of C, which is the case for Windows and Unix.) EDIT: Further: you have the same problem when writing. You write sizeof(InfoT) (288) bytes, but you write the pointer (and then a lot of garbage), not the data it's pointing to. And you increment the pointer into the MsgT object. This is likely not to work, if there is any padding. What you really have to do is: int write_buffer( MsgT const* data ) { char buffer[512] = {}; // Or better yet, std::vector<char>

Categories : C++

Inter-Process communication options
Am I right that if I choose WCF Named Pipes I'll have to use IIS And by the way, what options do I have in general? No, not really. Although this is an option but you have other options as well. Like, Self-Hosting Your Service Hosting in Windows Services Hosting Using Internet Information Services (IIS) which you can read in detail here. Named pipes existed even before WCF and WCF is certainly not the only way to use them

Categories : C#

Inter-process communication for python
Python has good support for ZeroMQ, which is much easier and more robust than using raw sockets. The ZeroMQ site treats Python as one of its primary languages and offers copious Python examples in its documentation. Indeed, the example in "Learn the Basics" is written in Python.

Categories : Python

inter process communication in python
Assuming the mother process spawns the child process(es), the child process can exit with a success/failure code. The code determines if cleanup is required. Then the mother process spawns a new child process. See subprocess for info.

Categories : Python

Preferred method of checking object's class in R
I would say inherits(df,"data.frame") or is(df,"data.frame") among other things, #2 in your list can fail because (as you suggest in #3) class(df) can have length > 1. (is.data.frame is nice, but not all classes have is. methods: see methods("is"))

Categories : R

Inter process communication with NetNamedPipeBinding protocol WCF
You can look here, it explains both named pipes and http bindings, but you can just ignore the http part and get the named pipe : http://tech.pro/tutorial/855/wcf-tutorial-basic-interprocess-communication As a side note, switching from any kind of binding to any other is just a matter of changing the url of the endpoint, and changing the class for the endpoint., so any tutorial for wcf would do :)

Categories : Wcf

Zeromq in-process communication - how to send a reference-message?
A message queuing system is designed for inter-process communication. For communication within an application there are several options. For a class Producer-Consumer problem, take a look at the BlockingCollection class. Here's an overview.

Categories : C#

Preferred method for controlled logging of Python debug messages?
I think the existing logging module does what you want. The trick is to separate the place where you call setLevel() (a configuration operation) from the places where you call getChild() (ongoing logging operations). import logging logger = logging.getLogger('mod1') def fctn1(): logger.getChild('fctn1').debug('I am chatty') # do stuff (notice, no setLevel) def fctn2(): logger.getChild('fctn2').debug('I am even more chatty') # do stuff (notice, no setLevel) Notice there was no setLevel() there, which makes sense. Why call setLevel() every time and since when does a method know what logging level the user wants. You set your logging levels in a configuration step at the beginning of the program. You can do it with the dictionary based configuration, a python module th

Categories : Python

Is there a preferred method of transferring native JavaScript methods to other objects?
You don't need to do anything: String.prototype.toUpperCase.call(anyObject) If you want to shorten that, you'll need to bind call to toUpperCase: var toUpperCase = Function.call.bind(String.prototype.toUpperCase);

Categories : Javascript

Preferred method of adding records to custom tables in Umbraco?
There are two answers to this question: Use a framework/solution like EF; Use Contour If you haven't looked at it, Contour is an Umbraco plugin that does exactly what you need. See here for more information about Contour. However, for more control I use PetaPoco or more recently NPoco (via NuGet) and also Autofac to inject the Database (analogous to DataContext) into the constructor of my Controllers. This is super easy and if you aren't already using an IoC container like Autofac in your builds I would highly recommend looking into it. Especially if you stick with EF, as you could ensure that a single DataContext object was created and disposed for each request, making sure that you didn't have multiple contexts floating about.

Categories : Asp Net Mvc

Inter-process-communication between a Java application and a local server
ZeroMQ is great for internal communications, or any other similar communication solutions. For specifically your case, I can see that ZeroMQ would be a best fit. Reasons: You offline server have to be agnostic to web solution. Communication can be reliable and bi-directional, possibly another patterns like (pub>sub, req<>res, etc). Restarting any of sides would not require to restart the sockets (connection) on other side, as messages are queued. Possibility to scale not just on same hardware, but as well to local area network or even through internet. Big community of support. It might look a bit hard to get into, but in reality it is dead simple, just go to examples and once concept understood - it is very easy and neat to work with. ZeroMQ has lots drivers for most popular languag

Categories : Java

communication between run() method and other class method (java threads)
If you are creating different threads for each services, then you cannot control the execution is the threads (e.g. by setting its priority, etc). Priority is just an indicator for OS, but can not be guarantee that threads with higher priority runs first. Only way you can do this by inter-thread communication using wait, notify, join, etc. But I think in case you case the solution could be, create separate thread for one combination of Service A, B, C & D.

Categories : Java

cross-process locking in linux
You can use file locking facilities that Linux provides. You haven't specified the language, however you might find this capability pretty much everywhere in some form or another. Here is a simple idea how to do that in a C program. When the program starts you can take an exclusive non-blocking lock on the whole file using fcntl system call. When another instance of the applications is attempted to be started, it will get an error trying to lock the file, which will mean the application is already running. Here is a small example how to take the full file lock using fcntl (this function provides facilities for putting byte range locks, but when length is 0, the full file is locked). struct flock lock_struct; memset(&lock_struct, 0, sizeof(lock_struct)); lock_struct.l_type

Categories : Linux

Cross-process locking with Android NDK?
Assuming the processes have the same user ID, you can use flock(2) to lock a file (could be anything accessible to both processes), or the POSIX semaphore operations (sem_open(3)) to use a semaphore. If the user IDs are different, the mechanisms will still work, but you have to set the file permissions to be more "open" -- which introduces the risk of some malicious app performing a denial-of-service attack by grabbing the lock.

Categories : Android

Cross process file locking in .Net
I'd version the PDFs. Assume you have a file, FOO.PDF, that you want to stream. Its actual name would be FOO.1.PDF. When a user requests FOO.PDF, the Web server gets a list of all the files in the directory that match "FOO.*.PDF", and selects the one with the highest number. When uploading a file, you upload to a temp file and then do a directory for "FOO.*.PDF", get the highest version number, increment it by 1, and then rename the temp file. So the next time a client wants FOO.PDF, he'll find FOO.2.PDF. This completely eliminates any sharing or locking problems. You will, however, have to clean the directory from time to time to remove stale versions.

Categories : C#

Cross-platform way to Check if a (non-child) Process is Running
The easiest way is to test which operation system your ruby is running, and then through the command line use a simple test on linux or windows to check if your program is running. The easiest way often is not the best way. Yet, be prepared to face some strange code, for example, how to simple kill a process on windows. It is your call. I would love someone say I'm wrong and that there is a great way to manage processes in ruby being cross-platform. Please do.

Categories : Ruby

PC communication using name pipes method through LAN cable
You're using named pipes over the network which means named pipes over samba or however Windows do domain networking. It only works when the computers are in the same domain or workgroup. Why not use sockets instead? It's the standard way to do networking and works wherever you have IP addresses.

Categories : Misc

Service and activity communication, method update in all activities
May be you can use a custom broadcast receiver. From the service you can broadcast the message and can write a receiver in your activity. In onReceive() in your activity, you can call to your update() method. Hope you understand what I mean

Categories : Android

Database design for communication records and communication preferences
Address needs to be in a separate table, because as you said, there are many columns to an address. You can put a flag in the Address table to differentiate between a work address and a home address, if necessary. Address ------- Address ID Street City ... The Address ID is an auto incrementing integer or long. It's the primary (clustering) key. The remainder of the communication records can go in a Contact table. The table would look like this: Contact ------- Contact ID Contact Type (Land line phone, email, cell phone, etc.) Contact Information The Contact ID is an auto incrementing integer or long. It's the primary (clustering) key. The Contact Information is a varchar that holds the email address or the telephone number. The Preference table would look like this: Preferen

Categories : Database

Cross-threading the hide method
You haven't given any information code-wise but this is a common pattern for manipulating the UI thread from a non-UI thread. if (mainForm.InvokeRequired) { mainForm.Invoke(new Action(() => { mainForm.Hide(); })); } else mainForm.Hide();

Categories : C#

c++ cross-platform method for file-io is needed
int open(const char *pathname, int flags, mode_t mode) is not C++. It is pure C. You should use std::fstream ( http://www.cplusplus.com/reference/fstream/fstream/ ) #include <fstream> int main () { std::fstream fs; fs.open ("test.txt", std::fstream::in | std::fstream::out | std::fstream::app); fs << " more lorem ipsum"; fs.close(); return 0; }

Categories : C++

C# cross thread operation exception when I call my method from Form1
You need to invoke the method call on the form's thread. You can make the method do it itself so you don't have to worry about it in the calling code: public void SetleMotor1() { if (Form1.InvokeRequired) { Form1.Invoke(new Action(SetleMotor1)); return; } button1.Enabled = true; button2.Enabled = false; if (Form1.Motor1.Calibstate == 3) label4.Text = "Befejezve"; else label5.Text = "Megállt"; if (Form1.Motor1.Calibrated) { label21.Text = "Igen"; label6.Text = Convert.ToString(Form1.Motor1.MMImp); } else { label21.Text = "Nem"; label6.Text = "-"; } }

Categories : C#

Cross domain jQuery $.ajax request fails for PUT (Method PUT is not allowed by Access-Control-Allow-Methods.)
Apparently the browser first sends an OPTIONS request to find out if PUT (or DELETE) requests are allowed. Since I had not allowed the OPTIONS method in Access-Control-Allow-Methods it failed and so did the PUT request after in Firefox. Adding OPTIONS to Access-Control-Allow-Methods solved the problem: header('Access-Control-Allow-Methods: GET, POST, PUT, OPTIONS');

Categories : Jquery

Responsive Cross Browser and Flexible way of "cross-background" images
It doesn't matter if the fonts in the text boxes are in EM. If the font size change, the text boxes size will change, but that it doesn't mean that the space between them also has to change (it could has a fixed height -the background height-). Here's a really basic example (try changing the body font-size): <html> <head> <style> body { font-size: 12px;} .text { border: 1px solid #999; padding: 15px; font-size:1em; } .line { background: url(http://www.agavegroup.com/images/articles/photoshopCurvedLine/curveFinal.gif) no-repeat center center; height: 50px; } </style> </head> <body> <div class="text"> Lorem ipsum dolor sit amet, consectetur adipisicing elit. </div> <div class="line"><

Categories : CSS

parallel method process
An idea of how to do it: public void addNewOrder(Order order) { Thread sendMessageThread = new Thread(new Runnable() { public void run() { mailer.sendMessage(order.getCustomer()); } }); Thread insertOrderThread = new Thread(new Runnable() { public void run() { orderDAO.insert(order); } }); // Start both threads; sendMessageThread.start(); insertOrderThread.start(); // wait for them to finish sendMessageThread.join(); insertOrderThread.join(); }

Categories : Java

How to multithread a process method
How about treating the entire thing as a Parallel Linq query? private IEnumerable<BulkProcessorResult> GetProccessResults(List<Foo> Foos) { var listOfFooLists = CreateListOfFooLists(Foos); return listOfFooLists.AsParallel() .SelectMany(FooList => FooList) .Select(Foo => new BulProcessorResult { ClaimStatusId = (int)_processor.Process(Foo), Property1 = Foo.Property1 }).ToList(); }

Categories : C#

Cross Platform, Cross .NET versions Hash-function
If performance is not an issue, try one of the cryptographic hash functions that come with the .NET Framework library: MD5, SHA256, RIPEMD160. If performance is an issue, you could perhaps go for something like MurMurHash3. All of these are dependent only on the input. (If you want to hash for security purposes, it's worth noting that you should only use cryptographic hash functions and that MD5 and older versions of SHA have known vulnerabilities and should be avoided.)

Categories : C#

Javascript Method Dispatch Process
"Method dispatch" is actually just property lookup, because "methods" in JavaScript are just functions used via object properties. (More about that on my blog: Mythical methods) When you write: obj.prop the JavaScript engine looks at the obj object to see if it has a property with the name "prop". If it does, the value of that property is used. If it doesn't, the engine looks the the prototype object for obj to see if it has a property with that name. If so, it uses the value of it. If not, it looks at that object's prototype. Rinse, repeat, until it runs out of prototype objects. There is no "method signature" matching of any kind as in some languages that allow method overloading. JavaScript doesn't have method overloading. There can only be one propety attached to an object with a

Categories : Javascript

The rails process of the new and edit method
If you use <%= form_for @user do |f| %>, Rails determine which URL and HTTP method to use (in order to lead to create or update action) by calling persisted? method on @user object. If it returns false, create form will be generated. If it's true, the form will lead to update action.

Categories : Ruby On Rails

Call a method of a running process
You are geting the address of the method in the remote process and trying to call whatever happens to be in the same address in your process. You're actually lucky you got an AccessViolation. First you have to decide if the method should run in the calling process or the remote one. If it's supposed to run in the calling process then it's easier to just reference the DLL/EXE where the method resides and call it. But if you want it to run in the remote process you can use some form of remoting such as WCF.

Categories : C#

Object method as multiprocessing.Process target
In this situation you are using processes not threads, so you need inter process communication. you can achieve that with Queues. See http://docs.python.org/dev/library/multiprocessing.html, look for 17.2.1.3. Exchanging objects between processes.

Categories : Python

SwingWorker method process() shows error
You're importing java.awt.List; instead of java.util.List... If you are using you both, then I'm worried, but, you use the fully qualified class name to differentiate between the two... protected void process(java.util.List<Integer> chunks)

Categories : Java

Call method from out-of-process COM component using PHP on Azure
After giving up on solving this last year. I made another concerted effort to resolve it this week and succeeded! I basically needed to (a) enable the php_com_dotnet.dll to allow use of COM and VARIANT classes, and (b) grant default Local Activation permission to IIS_IUSRS to allow access to the COM component. I've listed the detailed steps I took below... Add a folder called php in the web role's bin folder As of PHP 5.3.15 / 5.4.5, in order to use the COM and VARIANT classes, the php_com_dotnet.dll needs to be enabled inside of php.ini. Previous versions of PHP enabled these extensions by default (source: http://www.php.net/manual/en/com.installation.php). In the php folder, create a php.ini file containing only the following lines... [COM_DOT_NET] extension=php_com_dotnet.dll Crea

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.