w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
While Sending Html Mails from my web application Recieved Mails contains Symbols like &ldquo,&rdquo, ‘
Check with another constructor for htmlView: ContentType mimeType = new System.Net.Mime.ContentType("text/html"); var htmlView = AlternateView.CreateAlternateViewFromString(bodyMessage, mimeType);

Categories : Asp Net Mvc

CPU usage not maximized and high synchronization in server app relying on async/await
It sounds like your server is almost completely asynchronous (async MSMQ, async DB, async HttpClient). So in that case I don't find your results surprising. First, there is very little CPU work to do. I'd fully expect each of the thread pool threads to sit around most of the time waiting for work to do. Remember that no CPU is used during a naturally-asynchronous operation. The Task returned by an asynchronous MSMQ/DB/HttpClient operation does not execute on a thread pool thread; it just represents the completion of an I/O operation. The only thread pool work you're seeing are the brief amounts of synchronous work inside the asynchronous methods, which usually just arrange the buffers for I/O. As far as throughput goes, you do have some room to scale (assuming that your test was floodin

Categories : C#

Ubuntu 12.04.2 server auto enter root shell in recovery mode
After further study, I thought I had figured it out. Two changes are needed: (1) update the grub.cfg to customize recovery mode - open /boot/grub/grub.cfg - revise the menuentry "linux ...... ro recovery nomodest ...... " to "linux ...... ro single ...... " (2) There is known issue of GRUB in the 12.04 64bits, where the change of timeout is not converged into final grub.cfg (/etc/grub). You have to revise "set timout=-1" to "set timeout=0" in the auto generated grub.cfg or do below, §/etc/grub.d/00_header –In the make_timeout() function: replace the if/else/if block with "set timeout=${2}“ before executing update-grub. Actually, you should do step (2) first and then step (1)

Categories : Linux

What platform (server installed on ubuntu vs ubuntu server) to prefer for website development?
There seems to be a lot of confusion in your post. Based on your lack of experience with GNU/Linux, I would suggest you use desktop Ubuntu. The difference between Ubuntu server and Ubuntu desktop is that the server edition is targetted to experienced users, so you get a very minimal distribution. No GUI, nothing preinstalled except the bare minimum. As for your comment about Apache/Glassfish, the two aren't comparable. Apache is the name of the open source community which looks after a lot of products. Very often people call Apache's httpd just "apache", which is a web server. Glassfish is a Java EE application server (Oracle's reference implementation) so probably a good place to start with Java EE.

Categories : Apache

High CPU Usage by Tomcat
There is not sufficient information / evidence to explain what is going on. This could be a direct result of having an excessive number of request threads, or it could underlying problem in your webapp that is exacerbated by the number of threads. The only (possible) clue I can pull out of this is that (maybe) the high TakeQueue value means something is doing a lot of internal request forwarding. I suggest: Reduce the number of threads by a factor of 10 or more to see if that makes any difference. It is a bad thing to have a huge number of threads active at the same time. As in ... bad for system performance. Use visualvm to try tp work out what the worker threads are doing. See if you can spot errors or unusual behaviour in the tomcat logs, and the request logs. (Turn the logging

Categories : Java

High CPU usage with SDL + OpenGL
Loops use as much computing power as they can. The main problem may be located in: int delay = 1000 / 60 - (SDL_GetTicks() - now); your delay duration may be less than zero so that your operation may be just an infinite loop without waiting. You need to control the value of variable delay. Moreover, in the this link: it is proposed that SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL,1); can be used to enable vsync so that it will not use all the CPU

Categories : C++

CPU usage goes high when read
If you're seeing memory pressure during reads, you're probably reading too many rows at once. Tracing the request can give more visibility into what's going on: http://www.datastax.com/dev/blog/tracing-in-cassandra-1-2

Categories : Cassandra

mongodb high cpu usage
Here's a summary of a few things to look into: 1. Observed a large number of connections and cursors (13k): - fix: make sure your connection pool is appropriate. For reporting, and your current request rate, you only need a few connections at most. Also, I'm guessing you have a m1small instance, which means you only have 1 core. 2. Review queries and indexes: - run your queries with explain(), to observe how the queries are executed. The right model normally results in queries only pulling very few documents and utilization of an index. 3. Memory (compact and readahead setting): - make the best use of memory. 1.6GB is low. Check how much free memory you have, and compare it to what is reported as resident. A couple of common causes of low resident memory is due to fragmentation. I

Categories : Ruby On Rails

Wordpress High CPU Usage
First of all you should have to install " WP Overview (lite) Footer Memory Usage " plugin on your server and you can check it... And also install " W3 Total Cache " and cache your files and images from the server. You can increase a speed of your side with this plugin.

Categories : PHP

High CPU usage when reading from console
I assume you have some kind of code that checks the status of readLine(), otherwise Java will continue to block. String line = null; while ((line = br.readLine()) != null) { // handle contents of line here } You may be better off using the Scanner class to read user input. Scanner sc = new Scanner(System.in); int num = sc.nextInt(); ....

Categories : Java

Can High CPU usage be avoided in FileServer?
For TCP sockets function receive_data may not work correctly. The fact that it allocates a new local buffer suggests that this buffer gets destroyed when the function returns. This implies that receive_data cannot handle incomplete messages. A correct approach is to allocate a buffer for each socket once. Read from the socket into that buffer and then process and discard complete messages in the front of the buffer. Once all complete messages have been consumed, move the tail of the buffer that contains an incomplete message to the front and next time the socket is ready for reading append new bytes to the end of the incomplete message until it gets complete.

Categories : C++

Memcached slow gets, high CPU usage
Well, I've found the problem! To get an idea of the requests per second I used the memcache.php file that's available out there. It told me that there were 350 requests per second. The thing is that there has been quite an increase of use in the past few days, and the requests/second is really just an average over the entire uptime. Calculated by (hits+missed)/uptime. Now after restarting memcached this average returns more correct values and there are actually 4000 requests per second. tl;dr: Wrong stats in first post. Correct stats are: 4000 requests/second. I suppose my hardware simply can't cope with that.

Categories : PHP

Image viewer and high ram usage
Here is my take: <Window x:Class="LargeJpeg.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Image x:Name="Image" Stretch="None"/> </Window> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); var bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.CacheOption = BitmapCacheOption.None; bitmap.UriSource = new Uri(@"C:5x5.jpg", UriKind.Absolute); bitmap.DecodePixelWidth = (int)Image.ActualWidth; bitmap.EndInit(); bitmap.Freeze(); Image.Source = bitmap; } } Average memory usage: 130 mb on a

Categories : C#

Laravel Artisan Queues - high cpu usage
I had the same issue. But I found another solution. I used the artisan worker as is, but I modified the 'watch' time. By default(from laravel) this time is hardcoded to zero, I've changed this value to 600 (seconds). See the file: 'vendor/laravel/framework/src/Illuminate/Queue/BeanstalkdQueue.php' and in function 'public function pop($queue = null)' So now the work is also listening to the queue for 10 minutes. When it does not have a job, it exits, and supervisor is restarting it. When it receives a job, it executes it after that it exists, and supervisor is restarting it. ==> No polling anymore! notes: it does not work for iron.io queue's or others. it might not work when you want that 1 worker accept jobs from more than 1 queue.

Categories : Laravel

Named pipes in service causes high CPU usage
Unless the service sleeps/awais at some point, it's a perfectly normal behavior. By default, a while true{} loop will use 100% of the processing power of where it's executing. 25% sounds a lot like 1/4 of the 4 threads available on your computer. You actually want to use 100% of the CPU whenever you code, else why are you paying for faster computers ?...

Categories : C#

.NET - high memory usage by clr.dll and native heaps
Use !dumpheap -stat at each stage. You may be able to find which type is getting increased drastically at each stage. On those objects use !gcroot <"addr"> to find which object is holding it from getting garbage collected.

Categories : Dotnet

Android game, battery usage is very high
Charging from a USB port in your PC is going to be very slow (the USB is also transferring data, not just power). I would think it is okay for a game to use more charge than it is receiving when connected to a PC USB port.

Categories : Android

CPU usage is high when using opengl control class?
This needs more investigation but you may have problems with your main-loop. This probably is not a problem with OpenGL, but with usage of WinApi. When you add textures, models, shaders... your cpu usage should be similar. You use SetTimer(1, 1, 0); it means 1 millisecond of delay as I understand? Can you change it to 33 milliseconds (33 FPS)? That way you will not kill your message pump in mfc app. Note that this timer is very imprecise. link to [Basic MFC + OpenGL Message loop], (http://archive.gamedev.net/archive/reference/articles/article2204.html), using OnIdle() Here is a great tutorial about MFC + opengl + threading - @songho http://gamedev.stackexchange.com/questions/8623/a-good-way-to-build-a-game-loop-in-opengl - discussoion regarding mail loop in GLUT

Categories : Visual Studio 2010

Linux free shows high memory usage but top does not
Don't look at the "Mem" line, look at the one below it. The Linux kernel consumes as much memory as it can to provide the I/O cache (and other non-critical buffers, but the cache is going to be most of this usage). This memory is relinquished to processes when they request it. The "-/+ buffers/cache" line is showing you the adjusted values after the I/O cache is accounted for, that is, the amount of memory used by processes and the amount available to processes (in this case, 578MB used and 7411MB free). The difference of used memory between the "Mem" and "-/+ buffers/cache" line shows you how much is in use by the kernel for the purposes of caching: 7734MB - 578MB = 7156MB in the I/O cache. If processes need this memory, the kernel will simply shrink the size of the I/O cache.

Categories : Linux

MSMQ System.Messaging high resource usage
Why not host your queue reader process in a windows service. This will continually poll the queue each 10 seconds. Then use the windows scheduler to start/stop the service at relevant times to create your service window. This means you won't need to do anything complicated in your scheduled task, and you won't be loading and unloading all the time.

Categories : C#

Python OpenCV extremely high CPU usage after 10 second runtime
You should run a profile of your code with CProfile and see what's chewing up your resources. The official docs on profiling are here: http://docs.python.org/2/library/profile.html

Categories : Python

What is proper way to write a chrome extension with high I/O usage
Unfortunately, you cannot raise the quota. However, you can save your settings in some global variable or chrome.storage.local and periodically write them to chrome.storage.sync.

Categories : Javascript

Clock_gettime showing high usage during profiling of code
It's all relative to whatever else your program is doing, and keep in mind that if you're doing any I/O, the actual CPU time your program uses may be small, and gprof doesn't see anything else. So if some calls to timing routines get stuck in there, and they are called often enough, sure they can show a high percent. Why doesn't gprof show where they're being called from? For routines compiled with -pg, it tries to figure out who the caller is when any routine is entered. It tries, but that doesn't mean it succeeds. Anyway, that's gprof.

Categories : Misc

Why doesn't this item get removed from the cache when memory usage is high?
I would expect the CacheItemRemoveCallback to be fired Why do you expect that? I'd expect you to get an OutOfMemoryException fairly quickly on a 32-bit machine (*) - after a minute or so, by which time you'll have approx 1.2GB in your list. (*) unless the OS is started with the /3GB switch, in which case it will behave similarly to a 32-bit process on a 64-bit machine. On a 64-bit machine, your request will time when the a default of 90 seconds, by which time it will have added 90*200 = 1800 items = approx 1.8GB to your static list. A 64-bit process will handle this, and probably a 32-bit process would be able to do so on a 64-bit machine if it is LARGEADDRESSAWARE, which is definitely the case for IIS; not sure about Cassini. Also, ISS would probably recycle your application do

Categories : Asp Net

Excessively high memory usage in .NET MVC/Entity Framework application
We are automatically assuming that the problem is the EF. Can be, can be not. There are a lots of points that we should take care, not only data access infrastructure. With data access issued, as you are using only EF, you can gain fast improvement using simple .AsNoTracking() method. Adopt a ServiceLocator to help you manage your contexts pool. You can also user Dapper, instead of EF, in ReadOnly situations. And for last, but not least, use pure ADO.NET, for the more complex queries and a fastest execution. Refactor your ActionFilters to avoid using some "BaseController" that all controllers inherits is a good practice either. Check if your IDisposable classes are truly being supressed by CG, adopting the .Dispose(bool) pattern. Be sure that you are not persisting cache variables fo

Categories : Asp Net Mvc

Linux skip /root/.gvfs when executing df command with non-root user
I got the solution for my own question :) In df command you can pass the file system types which you would like to exclude, in this case it is 'fuse.gvfs-fuse-daemon'. So when I execute the below the command I no more get this message "df: `/root/.gvfs': Permission denied" df -x fuse.gvfs-fuse-daemon For more details one can look into df --help option.

Categories : Linux

Is sudo-ing tomcat's startup with a non-root user the same as running it as root?
Do be aware that the recommended solution to run tomcat on port 80 is to use mod-jk with the Apache web server, not to have tomcat listen on port 80 directly.

Categories : Unix

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. ping ipaddress-basemachine 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

Categories : Linux

Phonegap app uses high RAM because filereader() and change loaded pics to white instead because of memory usage
1000 images of those dimensions is a significant amount of data so will take a significant amount of RAM. Do you really need all 1000 to be in memory at the same time? Without knowing the user interface layout and use case requirements for your app I'm just speculating, but could you not, for example, load each image on demand asynchronously as it needs to be displayed? Or if the delay in reading the image from the file system creates an unacceptable delay in displaying it, you could pre-load just some of the images, for example if they are in a sequence, then just have a couple in memory either side of the currently displayed image.

Categories : Cordova

Remote login as root in ubuntu
Ubuntu documentation says: By default, the Root account password is locked in Ubuntu. It also says: Please keep in mind, a substantial number of Ubuntu users are new to Linux. There is a learning curve associated with any OS and many new users try to take shortcuts by enabling the root account, logging in as root, and changing ownership of system files. It talks at length about why it's been done this way. Enabling the root account: sudo -i To enable the Root account (i.e. set a password) use: sudo passwd root Use at your own risk! Logging in to X as root may cause very serious trouble. If you believe you need a root account to perform a certain action, please consult the official support channels first, to make sure there is not a better alternative.

Categories : Linux

Find usage result in Intellij in Ubuntu
You may be using a different keymap, please double check that Show Usages action is what you are invoking, and not Find Usages:

Categories : Ubuntu

How to get the memory usage of a process in linux without root permission
I'm not sure exactly what you are really looking for-- do you want to know the amount of memory that a process is currently using? If so, then look at /proc/<pid>/status and examine the VmRSS line. That's the number you want (in this case, RSS means "Resident Set Size" if you're curious). That line should be parse-able in a high-level language like PHP. However, for a lower-level language like C, it should be easier to parse /proc/<pid>/stat which has the same values but each is separated by a space and there are no labels. If you don't have permission to read the file, that means that the server process is running under a different user than you are logged in as. You will need to work with the hosting provider to get that resolved, or figure out how to get the server process

Categories : C++

Which of Yesod's Warp and snap-server should I choose for a high-performance application server?
I would highly recommend making the choice between Warp/Yesod and Snap based on which system provides you with the best set of tools for creating your application. Both Warp and Snap are using the same underlying GHC I/O manager, and both are highly optimized. I would be surprised if a well written application for each system, doing anything non-trivial, showed a significance performance gap. Your last paragraph is a bit vague, but I think the basic answer for either Warp or Snap is to just write your code, and the I/O manager will scale as well as possible. If you really find concurrent connections to be the bottleneck, you could consider trying out the prefork technique, using GHC 7.8 (not yet released, but has a much improved I/O manager), or using multiple servers.

Categories : Haskell

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 each 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

Categories : Sql Server

.NET application memory usage - high unused .NET and unmanaged memory and fragmentation
As Alex already pointed out a very nice explanation of the problem class large object heap fragmentation is found here: https://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-object-heap/ The problem is well known in the .NET FX Dev Team and continuously been worked at. There is a good chance that the symptoms fade off using more recent FX releases. Starting with .NET 4.5.1 there will be a GC method call to even compact the LOH: http://blogs.msdn.com/b/mariohewardt/archive/2013/06/26/no-more-memory-fragmentation-on-the-large-object-heap.aspx However, finding the root cause of the LOHF would be way more efficient than just wiping it of the heap wasting tons of ms's Let me know, if you need further details how to isolate such effects. Seb

Categories : Dotnet

what 's difference between android system user and linux root user
As far as Linux is concerned, the system user is just a regular user (UID 1000). Android services however give it special permissions and you can get access to pretty much anything. Most services have code like this somewhere: private static final void enforceSystemOrRoot(String message) { final int uid = Binder.getCallingUid(); if (uid != Process.SYSTEM_UID && uid != 0) { throw new SecurityException(message); } } What that does is deny access to anyone who is not root or system. The shell user (UID 2000) (what you get when doing adb shell) is another user with a lot of power (member of many groups). Cf. system: $ su 1000 $ id uid=1000(system) gid=1000(system) groups=1003(graphics),1004(input),1007(log),1009(mount), 1011(adb),1015(sdcard_rw),1028(sdc

Categories : Android

Count all items on which a user is the high bidder
Do a subs query to get the latest bid for all items and then join that to item_sales_bids to only process the latest items. Something like this:- SELECT COUNT(DISTINCT(item_sales_bids.user_id)) AS total, SUM((sale.list_date + (sale.duration * 86400)) - UNIX_TIMESTAMP()) AS endTime FROM item_sales_bids INNER JOIN item_sales sale ON item_sales_bids.sale_item = sale.id INNER JOIN ( SELECT sale_item, MAX(id) AS LatestBid FROM item_sales_bids GROUP BY sale_item ) Sub1 ON item_sales_bids.sale_item = Sub1.sale_item AND item_sales_bids.id = Sub1.LatestBid WHERE user_id = 1 GROUP BY item_sales_bids.sale_item HAVING endTime > 0

Categories : Mysql

wicked_pdf does not run on Ubuntu server : wkhtmltopdf: cannot connect to X server
Verify you have xvfb installed, or install it using apt-get install xvfb. Create a file called wkhtmltopdf.sh and add the following: xvfb-run -a -s "-screen 0 640x480x16" wkhtmltopdf $* Change the dimensions (640x480x16) to match whatever virtual screen parameters you want it to emulate. Move the shell script to /usr/bin, and set permissions: sudo chmod a+x /usr/bin/wkhtmltopdf.sh Optionally, you can add a symbolic link in your project directory: ln -s /usr/bin/wkhtmltopdf.sh wkhtmltopdf See this and this for reference.

Categories : Ruby On Rails

High performance socket server (like MMO)
There: C# SocketAsyncEventArgs High Performance Socket Code; based on things I have learnt from this (and some other resources) I have written a high performance TCP server which is handling more than 7000 clients. Edit: Other good .NET code bases I studied to some extend are fracture (F#), SocketAwaitable and SuperSocket. I especially like fracture because of it's simple (not naive) and smart buffer pool handling but (as the version I've worked with) it does not provide a separate pool for acceptors; which I've done myself easily based on the already provided pool.

Categories : C#

High-load java server
I do not think that Idea 3 would be over engineering, and I'd hit that road. Building @MessageDriven Bean "adapter" that handles incoming socket connections in the onMessage method is easy to develop and from there you're in the well scaling EE world. You your case, you might even want to rely on UDP. See following example: http://www.apprigger.com/2011/06/javaee-udp-resource-adapter-example/ But from my point of view there are other important reasons to go this way. Some pointers: 1.) As you've already mentioned. Building an own Socket Server handling threads and requests is a lot of work, and at the end you might build your own little "application server". 2.) Don't be afraid of using an application server. Of course people tend to call such a platform "overhead". Though when I did

Categories : Java



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