w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
C++ Linux: Get the refresh rate of a monitor
Use XRandr API (man 3 Xrandr). See here for an example: http://www.blitzbasic.com/Community/posts.php?topic=86911 You can also look at the code for xrandr(1). Edit1: For posterity sake: Sample code slightly adjusted so its more of a demo: #include <cstdio> #include <cstdlib> #include <cstring> #include <string> #include <iostream> #include <unistd.h> #include <X11/Xlib.h> #include <X11/extensions/Xrandr.h> int main() { int num_sizes; Rotation current_rotation; Display *dpy = XOpenDisplay(NULL); Window root = RootWindow(dpy, 0); XRRScreenSize *xrrs = XRRSizes(dpy, 0, &num_sizes); // // GET CURRENT RESOLUTION AND FREQUENCY // XRRScreenConfiguration *conf = XRRGetScreenInfo(dpy, root);

Categories : C++

How to monitor linux spinlock waiting time?
Let me first explain how the spinlock code works. We have variables uint16_t inc = 0x0100, lock->slock; // I'll just call this "slock" In the assembler code, inc is referred to as %0 and slock as %1. Moreover, %b0 denotes the lower 8 bit, i.e. inc % 0x100, and %h0 is inc / 0x100. Now: lock xaddw %w0, %1 ;; "inc := slock" and "slock := inc + slock" ;; simultaneously (atomic exchange and increment) 1: cmpb %h0, %b0 ;; "if (inc / 256 == inc % 256)" je 2f ;; " goto 2;" rep ; nop ;; "yield();" movb %1, %b0 ;; "inc = slock;" jmp 1b ;; "goto 1;" 2: Comparing the upper and lower byte of inc succeeds if inc is zero. Since inc has the value of the original lock, this happens if the lock i

Categories : C

How to monitor a process in Linux CPU, Memory and time
I typically throw together a simple script for this type of work. Take a look at the kernel documentation for the proc filesystem (Google 'linux proc.txt'). The first line of /proc/stat (Section 1.8 in proc.txt) will give you cumulative cpu usage stats (i.e. user, nice, system, idle, ...). For each process, the file /proc/$PID/stat (Table 1-4 in proc.txt) will provide you with both process-specific cpu usage stats and memory usage stats (see rss). If you google a bit you'll find plenty of detailed info on these files, and pointers to libraries / apps / code snippets that can help you obtain / derive the values you need. With that in mind, I'll focus on the high-level strategy. For CPU stats, use your favorite scripting language to create an executable that takes a set of process ids f

Categories : Linux

Continuously monitor a directory in linux and notify when a new file is available
inotify is the perfect solution to your problem. It is available as a system command that can be used in a shell, or as a system call that can be used in a C/C++ program. For details see the accepted answer to this question: Inotify - how to use it? - linux Update: you need inotify-tools for use on command line. The answer to the question above only describes C/C++ system calls. Here is the link to inotify-tools. It is also available as a packaged distribution so search your favorite install repository (yum/apt-get/rpm etc.): https://github.com/rvoicilas/inotify-tools/wiki

Categories : Linux

running eclipse on linux, "eclipse is not executable."
There is ADT Bundle for Linux, are you sure that you've downloaded the correct one? This is for linux 32bit

Categories : Android

File-copy using Java NIO is slow on Linux
Java will be accessing the SMB share via a regular file system mount. It is possible that Nemo is accessing the SMB share via a different mechanism that is faster / better tuned. Either way, if file transfer speed is critical, you will most likely get best results using an external application. (Exactly which one will be OS specific ... and beyond the scope of StackOverflow.) I had a brief look at how Files.copy is implemented. It appears that the actual file copying is implemented by a native code method (sun.nio.fs.UnixFileCopy.transfer(...)). Based on that, I don't think that a utility that copied a large file (via a regular file system mount) should go significantly faster than Files.copy(...). It would need to access it a different way to achieve a significant speedup.

Categories : Java

OpenCL/GL Interop slow on nvidia/win but fast on linux?
I'm gonna make the assumption that since you are using OpenGL, you display something on the screen after the OCL computation. So based on that assumption, my first thought would be to check in the NVIDIA control panel if the VSync is enable and if yes to disable it and retest. As far as I recall, the default options regarding vsync are different for AMD and NVIDIA; which would explain the difference between the two GPUs. Just in case, here is a post that explain how vsync can slow down the rendering.

Categories : Performance

Sluggish animations with CSS3 and jQuery for iOs
You should have a look at GSAP jquery plugin: GSAP Up to 20x faster than jQuery’s native animate() method. See the interactive speed comparison for yourself. Works exactly the same as the regular jQuery.animate() method. Same syntax. No need to change your code. Just load the plugin (and TweenMax or TweenLite & CSSPlugin) and you’re done.

Categories : Jquery

Sencha Touch Scrolling Sluggish on IE10/WP8
How are you serving those large images? Have you tried using sencha.io to serve them? You can also use the yahoo tool smush.it to crush images further without loss of quality. Another question: are you using CSS shadows and effects? These can have a noticeable performance hit sometimes... Also the custom font, how are you implementing that? Google fonts work well, or are you implementing it another way? :-)

Categories : Windows Phone 8

Cause of sluggish performance in JavaScript collapsing-menu script?
The issue isn't with your javascript but your css. You set your active max-height to 100em. However, you don't need this entire height. The browser is transitioning the entire max-height from 100 back to 0. The first 89ems of the transition doesn't appear do anything, because the content is only roughly 11em tall. In your other example, you set max-height to 15em

Categories : Javascript

WPF: Synchronous scrolling becoming sluggish for two DataGrids with one of them having image column with binding
Look for binding errors in the VS Output window. Also you can use this attached property directly on your binding to image source: diagnostics:PresentationTraceSources.TraceLevel=High Namespace diagnostics is here: xmlns:diagnostics="clr-namespace:System.Diagnostics;assembly=WindowsBase" After that, you can find even more info about your binding again, in your Output window. Unfortunately the binding errors are capable of HUGE performance hit. So try to completely eliminate them always when you are working on any WPF application. Btw you dont have to make your binding TwoWay, because Image control just cant change the property value back. Its OneWay control that just accepts the given value. EDIT: There are some WPF DataGrid control performance tips you can make use of link

Categories : Wpf

Using Performance Monitor to monitor pooled connections
You can run this from a SQL query windows to get a count and the details of current connections and session running on your SQL server. select * FROM sys.dm_exec_sessions AS es INNER JOIN sys.dm_exec_connections AS ec ON es.session_id = ec.session_id I've had trouble with pooled connections. They're hard to control. Explicitly closing them never seemed to work since they're under the control of .NET. The biggest reason we've run out of connections is uncommitted transactions. If a transaction is left uncommitted or rolled back for some reason, the connection, instead of being re-used, get's stuck in limbo, forcing .NET to open yet another connection to continue processing.

Categories : Sql Server

Will loading my app from Eclipse to my Android phone instead of AVD will speed things up? Because AVD is slow as hell
Very simply said, it absolutely will. Enable USB debugging on your device. Install phone drivers and connect your phone to your PC. When running your application choose your phone from the list and run. Read more about all steps on Using Hardware Devices, Android developer site

Categories : Android

compiling linux C++ in eclipse
You don't mention which type of mutex you are trying to use: If it's the pthread mutex, then: #include <pthread.h> If it's the C++11 mutex, then: #include <mutex> (you'll also need to compile with -std=c++11).

Categories : Linux

Linux CLOCK_PROCESS_CPUTIME_ID not being recognized in Eclipse CDT
Ok to solve this I had to go into my project settings, "Indexer" and there is a list of header files you index "up front". I added "time.h" to this list and then rebuilt the project. Absolutely no idea why this is required?!

Categories : C++

Monitor.Enter vs Monitor.Wait
According to MSDN: Monitor.Wait Method(Object) SynchronizationLockException: The calling thread does not own the lock for the specified object. In other words: You can only call Monitor.Wait(Object), when you already own the lock, whereas you call Monitor.Enter(Object) in order to acquire the lock. As for why Monitor.Wait is needed: If your thread realizes, that it is lacking information to continue execution (e.g. it's waiting for a signal), you might want to let other threads enter the critical section, because not all threads have the same prerequisites. For the waiting thread to continue execution, you will need to call Monitor.Pulse(Object) or Monitor.PulseAll(Object) before releasing the lock (otherwise, you're going to get the same kind of exception as with Monitor.Wait(Ob

Categories : C#

Not able to debug java code in eclipse in linux
I installed the linux on of my machines and its working fine there. Seems to be there is some issue if i connect remotely. My problem is resolved. But if anyone can add anything to this, it will be great. cheers, Saurav

Categories : Linux

C++ Eclipse: Debugging with optirun/primusrun on Linux
You can start Eclipse under primusrun. gdb and the debbugged process will "inherit" this, thus running themselves on the discrete card. Unfortunately, this means that Eclipse itself is also holding the card active, thereby increasing the power consumption.

Categories : Eclipse

Windows Builder plugin of Eclipse not working in Linux
The plugins might be conflicting.And why not directly use an Eclipse for RCP and RAP Developers version.The WindowBuilder plugin is included and you don't need to download it. Eclipse for RCP and RAP Developers : A complete set of tools for developers who want to create Eclipse plug-ins and Rich Clients (RCP), or develop with the Remote Application Platform (RAP), plus Mylyn, XML editors, Code Recommenders, Git, CVS, and Maven integration.

Categories : Eclipse

Eclipse - Common Preference settings file(.epf) for Linux and Windows
No, because JAVA_HOME could point to, well, anything--1.3, 1.7, who knows? You want complete and conscious control over what's in a project's Java Build Path and complete isolation from the OS if you want your projects to be portable. It's ok to have the preferences refer to things unique to the machine, you can change those on other machines, it's the settings in the projects that you don't want tied a specific machine. Start by setting their Java Build Path to use an Execution Environment to find its JRE.

Categories : Eclipse

Error in loading JNI library after sudo authentication in eclipse in linux
Don't use sudo for this task! Instead, give the appropriate permissions to the device so that the user can access it. This is possible by either using chmod/chown to change the device file's permissions, or use adduser <username> <group> to add the current user to that devices group.

Categories : Linux

How can i include the android code developed on linux platform into the eclipse
Just copy the whole project folder to windows, and import the project into Eclipse. Then create a emulator which is as same as the one on Linux platform. After that, You can run or debug your app on the emulator without any problem.

Categories : Android

Error "Task can be only monitored with a single monitor" when setting my monitor to a task in dll
OnMessage function creates implicit monitor which receives the task message and calls your anonymous function. Same goes for OnTerminated. If you wish to use MonitorWith, you should implement message processing and termination handling as a monitor events, not with OnMessage/OnTerminated functions.

Categories : Delphi

Importing Git Repositories into Linux Eclipse (3.8) and Running/Compiling Them as Java Projects
go through this way: eclipse>right click on project>build path>configure. here you will see a tab called library, library>"add library">"jre system library" you will see as option which jre you want to add. you select execution environment as what ever jre u have installed. thats it.

Categories : Java

Setup Blackberry Development Environment on Java + Linux + eclipse juno
Hmm..your logs say artifacts not found and so I guess you're using the eclipse blackberry plugin update site to download the jde which unfortunately is no more supported by blackberry. You'll need to download the blackberry eclipse jde bundle that is pre installed with blackberry jde. Check this out. Moreover I haven't seen any support for linux yet.

Categories : Java

Created a java test script in eclipse, how do i run it in a headless linux CentOS VM?
People usually use either PhantomJS or "Headless Chrome" to run in a headless environment. Also, some people run regular browsers from a XVFB framebuffer. Here is a blog article that I found that explains how to install XVFB. xvfb-run --server-args='-screen 0, 1024x768x16' google-chrome -start-maximized http://example.com > /dev/null & Using XVFB and VNC, you could probably login remotely and watch your tests run on the headless box but I haven't tried this. You would have to experiment with it.

Categories : Java

How to remove auto-discovered paths after compiling on Linux from Eclipse CDT project?
I found this where a user solved a similar problem by doing the following: Close your project and remove file $WORKSPACE/.metadata/.plugins/org.eclipse.cdt.make.core/$YOUR-PROJECT.sc I haven't tested this though so I'm not sure if it will work.

Categories : C++

Text doesn't start centered when calling jquery's show('slow') and hide('slow')
You want the fadeIn and fadeOut functions, not the show and hide. This should do it for you. Just replace the relevant code. =] $("#btnShow").click(function() { $("#loading").fadeIn('slow'); }); $("#btnHide").click(function () { $("#loading").fadeOut('slow'); }); http://jsfiddle.net/cpWaa/

Categories : Jquery

Slow Hibernate/C3P0 handling of non-slow Postgres SELECT
I can't be certain this is the cause of your issue, but I think there's a pretty good shot! You have set maxStatements to a value that is way, way too low for the load you are carrying. Try setting maxStatements to zero (turn Statement caching off), or else try setting maxStatementsPerConnection to 20, which I think is what you may have intended. As is, you've set a global max of 20 PreparedStatements to be shared by up to 20 Connections. That's not likely to yield good performance.

Categories : Java

column pk dual varchars or int?
If you add a surrogate autoincrement integer column, you still need a unique index on the JobID, SubJobID columns. This is the natural primary key. It may not add much value except using more disk and memory to store the extra column. Saying that, if the composite (JobID, SubJobID) index is used in child tables as a foreign key, it can make more sense to use one. 10000 rows here could have 10 million child rows: then the varchar overhead matters. However, there is no truth in anything you read that says Thou shalt always have an identity/autoincrement primary key It is an implementation decision for performance depending on the design.

Categories : SQL

Dual authentication mode
It is possible technically. The classic Mode doesn't requires much effort and can be implemented more or less easily. However when in integrated mode , some careful work is required to achieve the same. Check one post here which may be of help to you for getting started.

Categories : Asp Net

Dual divs on the same place
When I click on About me the "slide down div" will slide down and show the about me section. And when I click on contact the contact section will be showed...) How can I make this, and I'm a beginner when it comes to coding and hopefully this can be solved with a simple line of code... Actually, this can be done with a simple line of code! Change your "About me" link to this: <a href="#AboutMe">About Me</a> And, create a div like this: <div id="AboutMe">This is about me!</div> When you click the link, your browser will scroll to the AboutMe div. JsFiddle: http://jsfiddle.net/NmrbP/11/

Categories : Javascript

three.js dual viewports only one displays
Needed the following statement (in the javascript init function) to prevent renderer clearing its buffer after rendering the first viewport:- renderer.autoClear = false

Categories : Javascript

Function dual to std::move?
If you can manipulate T you could template the constructor. #include <iostream> using namespace std; class B { int x; public: B (int i) : x(i) { } B (B && b) : x(b.x) { cout << "B moved (" << x << ")" << endl; } B (B const & b) : x(b.x) { cout << "B copied (" << x << ")" << endl; } }; class A { B b; public: template<typename TB> A (TB && init_b) : b(std::forward<TB &&>(init_b)) { } }; B foo (void) { B x(3); return x; } int main (void) { A a1(foo()); B b1(4); A a2(b1); return 0; } Prints B moved (3) B copied (4) As far as I understand reference collapsing you should come out with a constructor A(B&) forwarding to the copy constructor of B and a A(B&&a

Categories : C++

Best Practice for Dual Layouts in Rails 3
It seems to me an admin might be doing different things with a user than an end user would be doing so different controllers may not be completely unDRY. However, if they are completely the same and you just want to have a different layout, then you can just set your layout based on the current user. Something like this would work: layout :determine_layout def determine_layout return 'admin' if current_user && current_user.admin? 'application' end

Categories : Ruby On Rails

Dual use of composite foreign keys
Here's what you started with. CREATE TABLE medication ( "id" INTEGER NOT NULL, -- You don't need this. "therapy_id" INTEGER NOT NULL, "day" INTEGER NOT NULL, "revision" INTEGER NOT NULL, "substance" VARCHAR(100), "dosage" VARCHAR(50), PRIMARY KEY (id), -- Drop this. FOREIGN KEY(therapy_id, day, revision) REFERENCES day (therapy_id, day, revision), -- Ok, but should be PK. FOREIGN KEY(therapy_id) REFERENCES therapy (id) -- You don't need this. ); The column "id" serves no useful purpose, and has instead convinced you that you don't need a unique constraint on the real key: {therapy_id, day, revision}. Replace the useless primary key constraint on "id" with a primary key constraint on {therapy_id, day, revision

Categories : SQL

Get selected values in a dual listbox PHP
This is the weird code: function listbox_selectall(listID,isSelect) { var listbox=document.getElementById(listID); for(var count=0;count<listbox.options.length;count++) { istbox.options[count].selected=isSelect;//<-- ? } } Maybe, you wanted to say: listbox.options[count].selected=isSelect; You said, that only 1 value from "destination" is submitted to PHP. To allow multiple values to be submitted, add [] to the names of the <select>-s: <SELECT id="s" size="10" name="source[]" multiple> <SELECT id="d" size="10" name="destination[]" multiple> Also, there is no need to use name attribute for options. You don't use it anywhere.

Categories : PHP

Formatting column name in dual table
Try this SELECT 'HELLO WORLD' as HELLOWORLD FROM dual; or SELECT 'HELLO WORLD' as "HELLO WORLD" FROM dual; See SQL Fiddle

Categories : SQL

Has anyone had success with ADT on a (dual-booted) Chromebook?
Are you sure you installed the driver correctly? If so, try switching Nexus 7's usb mode from storage mode to pics transfer??/view?? mode(forgot the exact name here). Hopefully it does help.

Categories : Android

Dual play frameworks on the same system
There is answer for similar problem dedicated for mac/unix. In Win you can create symlinks pointing to the proper version of Play directly in the instance folder

Categories : Java



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