w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
404 issue with static assets, CDN and multi server environment
Hmm so your CDN is using your site as the origin I take it? You might want to review this issue. What this does is writes the hash as a folder in the generated path, you can then use IIS rewrite rules to remove that folder from the URL on the way in. This was done to give an option that provides the reliable cache-busting of the "hash in filename" option without the explosion of files. You could use this to ensure that something gets served - but in this scenario it would leave you with an old version of the file in your CDN's cache (so you'd need to invalidate everything after you finish deployment). This will be available in the next release (0.9.3)

Categories : Dotnet

how to read files in multi process, multi threaded environment
If you want to create exclusive access to a file, you cannot use file locking, as on most OSes file locking is advisory, not mandatory. I'd suggest creating a common lock directory for all your processes; in this lock directory, you would create a directory per file you want to lock, right before you open a file. The big advantage is that directory creation, unlike file creation, is atomic; as such, you can use Files.createDirectory() (or File's .mkdir() if you still use Java6 but then don't forget to check the return code) to grab a lock on the files you read. If this fails, you know someone else is using the file. Of course, when you're done with a file, don't forget to remove the lock directory matching this file... (in a finally block) (note: with Java 7 you can use Files.newBuffer

Categories : Java

Multi Client Server, Multi interface, Multi IP version Socket
You're not missing anything. It is accepting connections to ::1 you said? Then it will accept ipv6 connections. And since IPv6 is backwards compatible, if you've created the correct ipv6 socket, it should be able to send and receive ipv4 packets as well.

Categories : C

Using MySQL on development environment and SQL server on the live environment
While on the development environment, I have installed the commercial system with the default MYSQL that comes with the product. Due to licenses & resource restrictions. Can't you use SQL Express? But yes, you can use Entity Framework with MySQL, and it should be possible to accomplish by just changing the connection string. Beware that the MySQL-EF connector seems not to support all possiblities of Linq to Entities.

Categories : Asp Net Mvc

multi-user git development environment
First, you should look into gitolite: it allows to manage users and access to repositories. With gitolite you can restrict what repositories and branches user has access to. For dev branch you may want to set up a git post-receive hook script: so your git repo will SSH to dev server and pull code from the repository.

Categories : GIT

Heap in multi-threaded environment
Talking about pthreads, From the man page, A single process can contain multiple threads, all of which are executing the same program. These threads share the same global memory (data and heap segments), but each thread has its own stack (automatic variables). The heap is the same for all threads but the access would depend on the scope of variable used to access the allocated memory. void* thFn(void*) { char* c = new char[5]; //etc delete[] c; } In this case, memory will be allocated on the heap. But c is local to each pthread. Other pthreads can possibly read from that location (retrieving correct values, until memory is released by the thread that allocated it ) if they are allowed to (If they obtain the address somehow).

Categories : Multithreading

the variable with the same name in multi threads environment
No, that shouldn't be a problem, simply because each instance of your thread has it's own instance of the variable. Examine the addresses of the variables to be sure, if they differ (which they will if I understand you correctly), you're fine. Inconsistencies between threads will only occur, if two threads concurrently access the same variable. Not just 'the same name', but really the same variable. Now, if the variable was global and both threads were to access it, you'd need some sort of mutual exclusion to prevent data corruption, but auto-variables are safe.

Categories : C++

Declaring Manifest for Multi-Platform Environment
You can use processorArchitecture="*" to indicate support for all architectures. If your application is a 32 bit application then you can use processorArchitecture="x86" With such a manifest your process will be just fine on a 64 bit system since it will be running as a 32 bit process under the WOW64 emulator. For a 64 bit application running on x64 you use processorArchitecture="amd64" And finally, for 64 bit Itanium the value is processorArchitecture="ia64" For the type attribute, the value is always type="win32". The documentation (which is admittedly a little sparse) is here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa374191.aspx For what it is worth, it doesn't seem to me as though you need to change anything. If you have a 32 bit executable built with

Categories : C#

How to update/delete row in multi user environment
If im correct in assuming you are using C# then you should look into some ORM frameworks as they can handle collisions like this for you or at least alert you when they have happened so you can handle them in your code. So you could for instance inform the user someone else has made a change and refresh their display or merge the changes and save the merged data. Have a look at entity framework. There are literally loads of tutorials and examples available for you. This should get you started. http://www.asp.net/entity-framework http://msdn.microsoft.com/en-us/library/bb386876.aspx This specifically references data concurrency (its MVC but the principles are the same) http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/handling-concurrency-with-the-entity-framework-in-a

Categories : C#

nodejs&couchbase work with multi-core cpu and multi-server
The creation of multiserver couchbase cluster is easy as a pie - just install couchbase on new server and add it to cluster with one button. Nodejs scaling is more difficult. If you have realtime game (i.e. you use websockets to handle players communication) you should look to nosql databases that have "pub-sub" out of the box (i.e. redis). There are some utils that implement "pub-sub" for memcached, but they are very ugly and their performance isn't good. But if your game isn't realtime (i.e. your game is like FarmVille) you can use couchbase as a "shared" layer between nodejs threads and servers.

Categories : Node Js

java callback functions in a multi threaded environment
You could use an ExecutorService to do tasks on the background and then use the methods of the Future you get back to wait for the result. For example: class Main { private static final ExecutorService es = Executors.newCachedThreadPool(); public static void main(final String... args) throws Throwable { List<Future<Integer>> results = new ArrayList<>(); for (int i = 0; i < 10; i++) { results.add(asyncSum(i, i*i)); } // here, in the main thread, you can do whatever you want // while the calculations are performed in background threads // ... // after the main thread finishes what it was doing, it // can process the futures for (final Future<Integer> result : results) { System.out.println(result.get()); }

Categories : Java

Do std containers always throw exceptions in a multi-threaded environment?
AFAIK the standard says nothing about the multithreaded behavior of std::vector et al. Realistically, though, everyone is going to implement things in the most straight forward, performant manner and that means no thread safety whatsoever. MSDN documents the behavior of their implementation of the STL. I would expect no differences between mainstream implementations. FYI the long and the short of the MSDN docs is that if you have readers in other threads and the container is being modified behavior will be undefined.

Categories : C++

Static method behavior in multi-threaded environment in java
Will it go to sleep state? No, running a thread does not affect other threads as long as they don't intentionally synchronize with each other. If you have more than one processor core, all recent machines do, those threads are likely to execute at the exact same time. That gets to be bit less likely when you start 5 threads since your machine might not have enough cores. The operating system is forced to choose between them, giving them each some time to run. The job of the thread scheduler. A thread will then not be in a "sleep" state, it is simply paused and waiting for the thread scheduler to give it a chance to run. It will resume where it was interrupted by the scheduler. Is there any possibility to interchange the inFileStr sent by multiple threads? There is no such

Categories : Java

Performance issue: use Singleton object in multi thread environment
It depends on how you implement Singleton. If you use Synchronized keyword then they will wait else not. Use Singleton with eager initialization. Something like this: public final class Universe { public static Universe getInstance() { return fINSTANCE; } // PRIVATE // /** * Single instance created upon class loading. */ private static final Universe fINSTANCE = new Universe(); /** * Private constructor prevents construction outside this class. */ private Universe() { //..elided } } Above will perform very well in multithreaded environment. or else you can go for enum implementation of Singleton. Check this link for various singleton implementation: http://javarevisited.blogspot.in/2012/07/why-enum-singleton-are-better-in-java.html

Categories : Java

Test a method behavior in multi threading environment using JUnit?
Consider your unit test code as a thread too. When I tried to test something in multi-threaded environment, generally speaking I did the following: I started the work threads (the thread(s) containing the tested method and the other threads) in the unit test thread manually and let the unit test thread sleep for a given time, or wait for the other threads and then I checked my results. The thing is, the unit test thread may not give up execution to the others and that is why you have to force it someway. You cannot "directly" control how the processor time is assigned to threads, so that is why you have to start them and let them "work out" the problem.

Categories : Java

Read/Remove items from dictionary in multi threaded environment
i would advise you to use a System.Collections.Concurrent.ConcurrentDisctionary in that case. It also implements the IDictionary interface and can be used in a thread safe manner for performing additions and deletions. See http://msdn.microsoft.com/en-us/library/dd287191.aspx A variant for ToDictionary for concurrent dictionaries as requested, that does not need intermediate conversion to a KeyValuePair can be found here: Extension method Gets "No overload for method" Error.

Categories : C#

Multi-threaded environment, other threads never get access to critical section
Is there any possibility that a process is failing in the "// manipulate global data" section? If so, then LeaveCriticalSection(&obj) would never be called. Have you tried putting debug logs right before LeaveCriticalSection(&obj)?

Categories : C++

Maximizing a window in a multi-screen environment without hiding/blocking the task bar
Or you could set this.MaximumSize to new Size (screen.primaryscreen.bounds.width + screen.secondaryscreen.bounds.width, screen.primaryscreen.bounds.height). P.S. I wrote this from my phone so I cannot check syntax etc... and also why did you post this as a 'question'?

Categories : C#

How to seamlessly maintain code of django celery in a multi node environment
For this type of situation I have in the past made a egg of all of my celery task code that I can simply rsync or copy in some fashion to my worker nodes. This way you can edit your celery code in a single project that can be used in your django and on your work nodes. So in summary create a web-app-celery-tasks project and make it into an installable egg and have a web-app package that depends on the celery tasks egg.

Categories : Python

Can .Find method return wrong results in multi-user environment
Well the docs state that Find... Uses the primary key value to attempt to find an entity tracked by the context. If the entity is not in the context then a query will be executed and evaluated against the data in the data source, So it searches the cache first. If what's in your cache is old (or doesn't exist in the database - and maybe never will) then that's what you get. It ONLY does a query if it can't find the entity in the cache. I wouldn't say it returns the "wrong" thing because of what it's defined to do. If you need to find data that might be changed by another user or that's guaranteed to exist in the database you'll want to stick with a query.

Categories : C#

MongoDB schema design to support editing subdocuments within an array in multi-user environment?
Having different writers is a key downside of embedding documents in my opinion. You might want to take a look at this discussion that presents different solutions. I'd try to avoid different writers to one document and use a separate Comments collection instead, where each comment is owned by its author. You can fetch all comments on a post by an indexed field postId reasonably fast. Then the comments simply have a regular _id field. It makes sense to use an ObjectId because that automatically stores the time the comment was created, and it's a monotonic index by default. create a "lastModified" timestamp on the parent document, and only save the edit if nothing has changed on the document. This is called 'optimistic locking' and it's generally not good if there is a high probabilit

Categories : Mongodb

how to use shared preference on multi textview,multi checkbox,multi button and multi edit box in android?
Use these method to save and get values from any where in your app change parameter according to your requirment this method to save value in shared prefrences public static void setPref(Context c, String pref, String val) { Editor e = PreferenceManager.getDefaultSharedPreferences(c).edit(); e.putString(pref, val); e.commit(); } this method to get value from shared prefrences public static String getPref(Context c, String pref, String val) { return PreferenceManager.getDefaultSharedPreferences(c).getString(pref, val); }

Categories : Android

.Net Multi threaded application slow on a powerful server vis a vis regular server
Your question is a little vague especially since we have no code to work with or any idea of the framework. But I can think of some general things that might be causing your problem. First off just because you add more cores doesn't mean you will get better processing, in fact depending on how the code is written, you could get the exact opposite which is what you are seeing. My primary suspicion would be that you have some common object(s) that all your task are using which your tasks end up fighting over resulting in bottlenecks. So my first question would be do you have any shared resources among tasks? Basically are the tasks that you are spawning individual units of work (i.e. have no dependencies shared between tasks)? Another warning sign that you have a bottleneck is your CPU usag

Categories : C#

How to know if a JFrame is on screen in a multi screen environment
This is a little redumentry, but, if all you want to know is if the frame would be visible on the screen, you could calculate the "virtual" bounds of desktop and test to see if the frame is contained within in. public class ScreenCheck { public static void main(String[] args) { JFrame frame = new JFrame(); frame.setBounds(-200, -200, 200, 200); Rectangle virtualBounds = getVirtualBounds(); System.out.println(virtualBounds.contains(frame.getBounds())); } public static Rectangle getVirtualBounds() { Rectangle bounds = new Rectangle(0, 0, 0, 0); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice lstGDs[] = ge.getScreenDevices(); for (GraphicsDevice gd : lstGDs) {

Categories : Java

How to register an HttpModule outside of the web server environment
You shouldn't be doing this :) Your better option is to create a wrapper around the module. And inject your wrapper in the controller. That way you can mock the wrapper in your test. public interface IAuthModule { void WriteSessionTokenToCookie(Token sessionToken); } public class MyAuthModuleWrapper : IAuthModule { public void WriteSessionTokenToCookie(Token sessionToken) { FederatedAuthentication.SessionAuthenticationModule.WriteSessionTokenToCookie(sessionToken); } } Then, if you are not using IoC container to wire up your app, you can use the poor's man version for your controller (I strongly recommend using IoC): public class MyController : Controller { private readonly IAuthModule _authModule; public MyController() : this(new MyAuthModuleWrapper()){}

Categories : C#

Set Environment Variables in Rails' Webrick Server
In your development.rb file: ENV['AUTH_TYPE'] = "Entrust-GetAccess" ENV['HTTP_SCTCGID'] = "johndoe" If you need this on other environments, put it on the respective staging.rb or production.rb, or just on application.rb to set them on all environments.

Categories : Ruby On Rails

ASP.net State Server losing session in load balanced environment
I've been told it's not possible to persist session data in a multi-server environment unless you use a SQL Server instance to store it...I'm assuming you're familiar with it but here's a link for others who may not be: http://support.microsoft.com/kb/317604

Categories : Asp Net

Connecting to SQL Server from Visual Studio 2010 for windows phone environment
You can't directly interact with a SQL Server from a Windows Phone app. The best way would be to create a service layer around your database which exposes all the operations you need.This service will be called from the mobile app. The most popular technologies for doing so on the Microsoft stack are WCF and ASP.NET Web API. Which one you choose is up to you and depends on several factors. ref : http://social.msdn.microsoft.com/Forums/wpapps/en-US/a653ad41-59f7-41b7-82e8-3b2c76d7dec6/sql-server-connection-for-windows-phone-8

Categories : C#

XmlSeeAlso issue deployment of apache cxf to weblogic server in java 1.5 environment
According to XmlSeeAlso Javadoc the annotation exists since JAXB 2.1 - you're using JABX 2.0.1, upgrade to 2.1 or higher and it should work.

Categories : Java

A field was longer or shorter than the server allows - Rails production environment error
The only errors that are showing on your account is the following. errorcode 10501 shortmessage "Invalid Configuration" longmessage "This transaction cannot be processed due to an invalid merchant configuration." This can be caused when you try to perform a DoDirectPayment API request and do not have Pro enabled on your account. It's possible that your software is translating that error into the field error that you are seeing. Please reach out to customer support if you wish to enable Pro on your account to be able to perform DoDirectPayment API calls.

Categories : Paypal

Standard Interface to Interact with Various Content Repositories From J2EE Client Server Environment Using JCR
Well with JCR 2.0 the RepositoryFactory should be able to provide you with the repository you want. After that it is just how to pass the configuration in your code to create and access the repository. You can look into Silverpeas code or Crash's code to see that.

Categories : Java

Configure spring security ldap-server attribute to use different url based on deployed environment
I've done that with Spring profiles: In your spring.*.xml config file use this at the end of your file: <beans profile="production"> ... </beans> <beans profile="local"> ... </beans> As VM Arguments the used profile must be provided: -Dspring.profiles.active=production Regards

Categories : Spring

using socket io on multi server
As long as each instance is pointing to the same Redis store, all of your rooms will be available. If you want to run multiple instances of a node app on a single server you could use node cluster.

Categories : Node Js

SQL Server Rows to Multi-Columns
Are you trying to dynamically create columns in your result set? If you had a third record of 'AA' with a total of 300 and the date of 03/01/2013 would you that mean you would want something like this displayed? Code | Total | Date | Total | Date | Total | Date AA | 200 | 2013-02-01 | 100 | 2012-12-01| 300 | 03-01-13 BB | 50 | 2012-01-01 | null | null | null | null

Categories : SQL

Multi Threaded TCP server in Python
You should pass the client sock to the thread like you do with the ip address and the port: class ClientThread(threading.Thread): def __init__(self, ip, port, socket): threading.Thread.__init__(self) self.ip = ip self.port = port self.socket = socket print "[+] New thread started for "+ip+":"+str(port) def run(self): # use self.socket to send/receive ... (clientsock, (ip, port)) = tcpsock.accept() newthread = ClientThread(ip, port, clientsock) ...

Categories : Python

Copying a WF4 instance store database from production environment to development environment?
Jesús López gave me the answer at this MSDN thread, where I asked exactly the same question as in this StackOverflow’s thread. First, he asked: “Is the [IIS] path to the workflow service (the xalmx file) the same in production than in development? If the path is different because the virtual directory is different then is also different the WorkflowHostType column and that might cause problems.” After letting him know that IIS site names were actually different in production and in development environment, even though the rest of the paths to workflow services were the same, he replied: “Both [IIS sites] must have the same name. I've just tested it. I changed the site name in IIS and suddenly WorkflowHostType changed. So idle persisted workflows won't load any more.” Then he

Categories : Dotnet

to multi-thread or not on a scalable client-server application
Thread-per-connection is not a scalable solution. To scale well, you should use asynchronous socket methods exclusively. The question is whether to multiplex them all on a single thread or to use the thread pool. The thread pool would scale better than multiplexing, but it introduces multithreading complexities. A lot of devs attempt to learn socket programming and multithreading at the same time, which is just too much.

Categories : C#

Get the client bound IP address with an Axis2 Server with multi NIC
Perhaps you can try something like this request.getHeader("url"); String ipAddress = request.getHeader("X-FORWARDED-FOR"); if (ipAddress == null) { ipAddress = request.getRemoteAddr(); }

Categories : Java

Is puma the ONLY multi-threaded rails 4 http server?
No. In alphabetical order: Net::HTTP::Server, despite the lack of advertising, supports multithreading Phusion Passenger has supported multithreading since v4 beta Rainbows! supports multiple concurrency models, including multithreading Reel is a Celluloid-backed "evented" server, which "also works great for multithreaded applications and provides traditional multithreaded blocking I/O support too" Thin has a threaded mode, which can be enabled by passing --threaded or by setting threaded: true in the appropriate configuration file (e.g. bundle exec thin start --threaded) WEBrick is on its own multithreaded, so it's not fair to eliminate it as an option; if you're using the Rails-embedded version, you'll need to monkey-patch Rails::Server to enable multi-threading Zbatery is based on Ra

Categories : Ruby On Rails

Multi Language insertion in SQL Server using a stored procedure
Here is the correct update statement: update tblTest set Description_Ta = @Description_Ta where Row_Id = @Row_Id; You don't need single quotes around a variable. But, I think the posting is confused. To call the procedure use: exec [dbo].[spr_Sam] 2, N'பெண்டிரேம்'; To modify it: ALTER PROCEDURE [dbo].[spr_Sam] @Row_Id int = NULL, @Description_Ta nvarchar(MAX) = null AS BEGIN update tblTest set Description_Ta = @Description_Ta where Row_Id = @Row_Id; END; You shouldn't have arguments when you define the stored procedure.

Categories : C#



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