w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
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 exist.

Categories : Neo4j

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.

Categories : Jquery

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

Categories : Mysql

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.]

Categories : Algorithm

Div at least as high as other div
Try this: $('#rightdiv').css('min-height', $('#leftdiv').height()); Fiddles: http://jsfiddle.net/25dSw/ http://jsfiddle.net/25dSw/1/

Categories : Javascript

Buy Low Sell High
If I've understood correctly, this is hard to do efficiently because the choice depends upon the past. It's not elegant but this code gives the output you require, library("xts") close <- c(0, -0.5, -0.75, -1, -0.75, -1.5, -2, -2.5, -3, -3.5, -3, -2.5, -2, -1, 0, 1, 1.5, 2, 2.5, 3, 2.5, 2, 0) data <- xts(close, Sys.Date()-23:1) colnames(data) <- "close" sig.buy <- c(F,F,F) sig.short <- c(F,F,F) for(i in 1:length(data)) { if(data$close[i] <= -1) sig.buy[1] <- T if(data$close[i] <= -2) sig.buy[2] <- T if(data$close[i] <= -3) sig.buy[3] <- T if(sig.buy[1] && data$close[i] >= 0) sig.buy[1] <- F if(sig.buy[2] && data$close[i] >= 0) sig.buy[2] <- F if(sig.buy[3] && data$close[i] >= 0) sig.buy[3] &

Categories : R

high precision division in C
You're not doing the calculation you think you're doing. The ^ operator in C does not perform exponentiation, it performs bitwise exclusive OR. You are actually dividing ts_delta by 2 xor 32 == 34. I'm not sure how you got 15.000000 from that, it should have come out 15.058823529411764. The calculation you wanted to do is expressed in C like this: double scale_factor = ((double)ts_delta) / (((uint64_t)1) << 32); EDIT: From the other answer: if your compiler supports C99's hexadecimal floating-point literals, you can also write double scale_factor = ts_delta * 0x1p-32; Written this way, no casts are necessary, because one side of the multiplication is already a double, so the integer on the other side will be converted to match. Unfortunately, several compilers have uint64_

Categories : C

high resolution timer in C++
1.e-6 is a number in a scientific notation that is equal to 10 ^ -6, or 0.000001, and is of type double. You can read it as «ten to the minus six». Since gettimeofday() is returning time as two separate integer numbers - seconds and microseconds, microsecond portion is converted to a double value representing seconds through dividing integer microseconds value by a million. Then, whole seconds (tv_sec) are added to the result. For example, let's say gettimeofday() returns 6 seconds and 5 microseconds, this code would do 5 * 0.000001 + 6 and yield 6.000005 seconds. On a side note, gettimeofday() is not really considered a high-resolution clock (and certainly has nothing to do with timers), and it is also deprecated. You should consider using clock_gettime() instead. It supports variou

Categories : C++

High Availability for WSO2 ELB
Yes you can run the ELB in a cluster. Please follow this link to get detailed steps, http://docs.wso2.org/display/ELB210/Using+Load+Balancer+in+a+Cluster

Categories : Wso2

profiling tools for mvc app with very high cpu
I know it seems like a daunting task getting started, but start slow and try to develop a hypothesis for why your application is experiencing such degraded performance. A good place to start is with basic perfmon counters and debugdiag, as per this article: Troubleshooting High CPU in an IIS 7.x Application Pool There are tons of SO posts on this topic, so definitely do your research. A good profiler can definitely help here, for ASP.NET MVC apps I'd recommend Red Gate ANTS, because it can show you where and how long calls to DBs and other downstream systems are taking.

Categories : Asp Net Mvc

Python: High Low game v2
You could either (if possible) move the declaration outside as taronish4 said or could alter your code so that it looks like this: choice = raw_input("Press enter to start ") i=-1 first=1 while choice != 'quit': card = [2,3,4,5,6,7,8,9,10] card1, card2 = random.sample(card, 2) if first == 1: print 'Dealer First card: '+str(card1) first = 0 showCard = [card1, card2] if choice == 'high': rest of the code as before. EDIT: Solution to additional Problem You have to copy this: card1, card2 = random.sample(card, 2) and put it before the loop like this: card = [2,3,4,5,6,7,8,9,10] card1, card2 = random.sample(card, 2) choice = ' ' i=0 while choice != 'quit': and then move the call of random.sample inside the loop so that is executed at the end, r

Categories : Python

high chart sample
The bullet concept will work for this, though it will take some work to get styling like that. There are plenty of useful options for styling such a chart though without relying on the physical gauge metaphor. A quick variation on the bullet chart approach that puts them into a single chart and removes the banding: http://jsfiddle.net/jlbriggs/kwtZr/41/ It relies on a custom extension to produce the 'line' marker type: Highcharts.Renderer.prototype.symbols.line = ... {{ edit in response to comments below: updated example with some additional formatting options and clean up: http://jsfiddle.net/jlbriggs/kwtZr/55/ be wary of using multiple colors unless the colors truly mean something. Using additional color to highlight items that require attention is a good use of color. Using

Categories : Highcharts

SSE, interleave low and high words
No, because there are no SSE shuffles that have two sources and a distinct destination. However, you can do it if r is the same as a, with shufpd. If you need to preserve the value of a: movapd r, a shufpd r, b, 1 On recent µarches, the movapd is free and handled in rename[*], so this effectively is a “single instruction", from the point of view of the execution core. If AVX is available, you can use vshufpd. [*] It’s possible to saturate this capability of rename, in which case the extra reg-reg moves will behave like normal port 0|1|5 operations—fortunately, real world code almost always has some bubbles on one of those ports, so the move tends to still be “free”.

Categories : Performance

Using memcached on a high end web application
first of all, memcached does not persist your data to the disk, so relying on it to keep your data is not a good practice memcached helps to scale your php application by minimizing the load from your db by serving results from queries or even better minimizing the load off the web server by storing the entire html if you can (there are actually many good use cases for memcached) consider the follwing flow: 1. client browsing to your page 2. php application requests the data from memcached by a key (the key can be the sql query, the url ... it depends) 3. if memcached has the data use it 4. if not the php application should query the data from mysql 5. after the data is retrieved save it in memcached so next request it will be available in 2 to handle updates, make sure to define ttl to

Categories : PHP

Getting average low and high bids in SQL
As You are saying you need to find out the Min of Avg and Max of Avg, Now what you are doing is group on one column this means Avg(Bid) will return only one value. And the thing that you are doing will make sense only if it is done with two column, For example you wanna know the min of Averages per day. You need to identify one more column on which base you want to find out max and min of Avg. See in my example i am using Date as second column. the query will go like. Select Max(MAx_Bid),Min(Min_Bid),Min(Avg_Bid),Max(Avg_Bid) FROM (SELECT AVG(bid) Avg_Bid,MIN(bid) Mix_Bid,MAX(bid) max_bid FROM bidding WHERE bid_id=:bid_id GROUP BY bid_id,Days_Date(Dummy column))A

Categories : SQL

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

Retina/High-res Images
why is it not a good idea to include just the bigger image, and size that to half the size so you only have one image which which, on non-retina images, will just become smaller (with the same amount of detail in the image) It's not a good idea because for the cases where people don't have high-res/retina mobile devices, you've just wasted ~40% of the images bandwidth. Depending on the volume of traffic, the cost of that additional bandwidth will add up very quickly.

Categories : CSS

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

High reliability of a web service
The only real solution to ensure completion of a request that I can think of is to add a wrapper to the third-party web service so that it DOES have a retry mechanism. Any other solution including HA will have a point of failure. Consider that if the Amazon SQS service fails, you will still have a third party web service that will request information from the down service and fail.

Categories : Web Services

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

how to get price in high to low order
You are ordering a "text" field, the result goes alphabetically. You need to cast as Int your price field: select * from product_tb where sub_id='"+bl.sub_id+"' order by CAST(price AS INT) desc

Categories : Asp Net

Get alert when value in input box is too high
You have lot of errors in code try this $(document).ready(function () { $('#inputValue').keyup(function () { if ($(this).val() > 1 ) alert('Value must be a decimal between 0 en 1'); }); });

Categories : Jquery

What is the proper use of high-res sprites on iOS with CSS?
You're absolutely on the right track here. Essentially the process here with providing 'retina' graphics in a sprite via CSS is: Set up your normal sprite, with the relevant positioning/etc within your CSS to feed to non-retina devices, Set the background-size of this image, Use a media query to feed the @2x variant of the image to those devices that support it. There are a few key things to bear in mind: setting background-size requires several declarations with different vendor prefixes to get the best browser coverage - see my code below to see what I mean background-size is the size of the non-retina variant of the background image, not the size of the element it sits within. So, if the normal-size sprite image is 200px by 400px (and the high-resolution version is 400px by 800p

Categories : IOS

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

WM_POINTER and High DPI settings
If you have processes that are running at different DPI awareness levels (private, inter-process communications are not virtualized) you can run "SetParent" across processes so that the DPI awareness level will be inherited from the new parent. http://msdn.microsoft.com/en-us/library/windows/desktop/dn469266(v=vs.85).aspx#input_issues

Categories : C++

c# high resolution images in PDF
First let me clear a couple of misunderstandings: a PDF document doesn't have a resolution. The comment by spender was wrong. There is no such thing as DPI in PDF. The resolution only comes into play when a PDF is rendered (to the screen, to paper,...) and that's why there may be a DPI in a PDF viewer (but that's something completely different). when you scale an Image object in iTextSharp, you don't lose any information: the number of pixels remains the same. Whereas PDF doesn't have a resolution, the images inside a PDF do. When you the image scale down (that is: you put the same number of pixels on a smaller canvas), the resolution increases; when you scale up, the resolution decreases. Now for your question: you're not obliged to create A4 pages: Image img = iTextSharp.text.Im

Categories : C#

Convert png to high quality ico
In the referenced question the accepted solution uses imagemagick, which is a great image manipulation tool that gives you have the ability to control size, colour depth etc. when converting from png to ico. I would really suggest trying that solution. Using the imagemagick utility would look something like convert -resize x16 -gravity center -crop 16x16+0+0 input.png -flatten -colors 256 output/favicon.ico (you could then control -resize and -colors to achieve what you are looking for.) The same options should be available programmatically in C# through http://imagemagick.codeplex.com

Categories : C#

High Latency with NodeJS
I know this may sound strange but have you consider it is not an issue with node but with the OS setting. Have you checked your file handles and the number of connections the OS is showing to the socket? Have you also made sure the socket timeout in the OS is low enough? I have run into similar sounding performance issues with other code and it turned out to be the OS and not the code. Also check the package and see what it has for open allowed connections on the socket. I ave not looked at the node code but ran into a similar issue with the http client library in java. The application just backed up and it was just a configuration issue with number of connections.

Categories : Javascript

View box in High chart
There is no such thing as viewBox with Highcharts. Refer: API Documentation To create border around chart you can use: chart: { height:"300", width:"600", type: 'column', borderWidth:1, // around chart plotBorderWidth:1, // around plot }

Categories : CSS

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

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

quickfix/n error : MsgSeqNum too high
Your sequence numbers are out of sync. The output you pasted says that pretty clearly. I suggest you do some reading about FIX protocol. The unfocused nature of your question indicates that you don't know much about it. QuickFIX/n will be much easier to use and ask questions about if you spend some time learning about how the protocol actually works. It's a pretty simple protocol.

Categories : C#

Configuring TCP for a very high volume network
If the sensor is sending a RST, then the connection got closed at the sensor. You should investigate why that happened? One reason might be that the connection got timed out -- perhaps TCP@sensors were trying to send something and could not get through. Can you run some trace tool (like tcpdump/windump) at sensors?

Categories : Networking

TFS (high level) install process
well, I followed http://tfsguide.codeplex.com/wikipage?title=How%20To%20-%20Migrate%20Source%20Code%20to%20Team%20Foundation%20Server%20from%20Visual%20Source%20Safe And nearly got it installed. I'll post a new question with the new issue.

Categories : Tfs

Apache Cassandra High Availability
Cassandra supports fault-tolerance / HA by design. To understand this, read hinted hand-off and message routing in Cassandra. For split-brain handling, you may think of using Cages java lib for distributed synchronization functionality/locks etc. From Cassandra - A Decentralized Structured Storage System: Cassandra uses replication to achieve high availability and durability. Each data item is replicated at N hosts, where N is the replication factor configured per-instance". Each key, k, is assigned to a coordinator node . The coordinator is in charge of the replication of the data items that fall within its range. In addition to locally storing each key within its range, the coordinator replicates these keys at the N-1 nodes in the ring. Cassandra provides the client with various o

Categories : PHP

How to distinguish android devices in Low/Mid/High?
Take a look at this image : There is also xxhdpi which is around 480 ppi. From : http://developer.android.com/guide/practices/screens_support.html You can also see how many devices use these configuration here : http://developer.android.com/about/dashboards/index.html#Screens

Categories : Android

Do most phones use high density displays?
It depends on the service you provide in your website, which in turn determines which type of users visit your pages. A simple solutions is to check similar websites (specially the famous ones) and see whether they provide different resolutions to different users.

Categories : Misc

Very high GC thread count in a ServerGC app
With Server GC, there will be one thread per logical core (that is affinity set to that core). So in your case there should be at least 32 threads. If you have background GC turned on, then there could be more worker threads processing the graph for each heap (reference). Also keep in mind that these GC threads will run at THREAD_PRIORITY_HIGHEST which can easily starve any threads that aren't already paused by the GC (reference). Now, as far as your other threads, 500+ in a process is going to create a lot of contention regardless of garbage collector. So figuring out what those threads are will be important to your investigations. Things to look at See if Background GC is turned on, and if so, try running without it (this mode is supported in 4.5's Server GC). Try reducing the max

Categories : Dotnet

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