Can't run my own OpenGL 3 programs on Ubuntu |
My main() starts with glewInit and glutInit
Nope. You don't get a current GL context until glutCreateWindow() returns.
You can call glewInit() and glewIsSupported() after that.
Something like this:
#include <GL/glew.h>
#include <GL/glut.h>
...
int main( int argc, char** argv )
{
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE );
glutInitWindowSize( 300, 300 );
glutCreateWindow( "OpenGL" );
glewInit();
...
return 0;
}
|
Can love2d programs be run as normal Lua programs? |
You really need to run it with love.exe
It is possible to build love as a shared library so you could, in
principle, write an openlib wrapper over it. However, to get it to work in
a reasonable fashion as a lua module would need a fair amount of work.
I wouldn't want to put you off doing this if that's of interest to you but
it's not really intended to work that way.
|
How to develop GTK+ programs on windows? |
They mean you can develop under Windows and you do not have to compile the
libraries for yourself.
Binaries for GTK+ and its dependencies can be found here.
Cross OS means that the same API is available across all supported
platforms.
Direct calls to the win32 API can be made normally in a GTK+ application.
|
How to activate programs on windows from Linux machine |
According to the documentation of winexe:
--interactive=0|1
Desktop interaction: 0 - disallow, 1 - allow.
If you allow use also --system switch (Win > requirement).
Vista do not support this option.
So --interactive=1 --system should do the trick.
|
python bottle can run two programs on the same address and port on WINDOWS |
Sorry to bother all.
I've found the resolution, just so simple.
Simply change the BaseHTTPServer.HTTPServer's attribute allow_reuse_address
to 0.
The codes should be:
from bottle import route, run, template
import BaseHTTPServer
@route('/hello/:name')
def index(name='World'):
return template('<b>Hello {{name}} </b>', name=name)
setattr(BaseHTTPServer.HTTPServer,'allow_reuse_address',0)
run(host='localhost', port=9999)
|
Programs started by windows script close immediately |
Try to call those by cmd.exe instead:
cd UsersMeProjects
start python Chord.py -i ini
for /l %%a in (8001,1,8101) do (
ping /n 5 127.0>nul
start cmd.exe /c python Chord.py -p %%a %%a
)
echo. & pause
|
VT-X on windows 7 cannot be recognized by Guest OS(Ubuntu 12.04) with virtualbox |
Thanks for answering, I finally installed Ubuntu 12.04 with windows7 on the
same hard disk. As for my issue, virtualbox don't support full
virtuallization, so I could not see any VMX feature in my Guest OS, but
vmware do, which suits me well.
|
Other programs in pipe |
If you're on Linux you can use the /proc filesystem to check how commands
communicate over pipes. However, this is not really portable.
|
Programs always output 0 |
Regarding second problem:
str[a]*str[a-1]*str[a-2]*str[a-3]*str[a-4] = p;
this assignment seems reversed. In addition str is a string made of
characters '0' '1' '2' which are not directly numbers, or at least
'0' != 0
since '0' is the character digit 0 which is encoded as 0x48
|
Qt5 programs won't compile |
I found the answer using qmake --help. This actually says:
Note: The created .pro file probably will
need to be edited. For example add the QT variable to
specify what modules are required.
Adding these lines to the .pro file solved the problem:
QT += core gui
QT += widgets
|
Dependencies of programs using gtk/gtk.h |
You generally build such GTK programs using pkg-config. And I am getting
(on Debian/Sid/AMD64) the compile flags
% pkg-config --cflags gtk+-x11-3.0
-pthread -I/usr/include/gtk-3.0 -I/usr/include/atk-1.0
-I/usr/include/at-spi2-atk/2.0 -I/usr/include/pango-1.0
-I/usr/include/gio-unix-2.0/ -I/usr/include/cairo
-I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include
-I/usr/include/harfbuzz -I/usr/include/freetype2
-I/usr/include/pixman-1 -I/usr/include/libpng12
-I/usr/include/libdrm
and the link flags
% pkg-config --libs gtk+-x11-3.0
-lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0
-lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo
-lgobject-2.0 -lglib-2.0
Notice that these shared libraries link some
|
Eclipse will not run C programs |
right click your project in eclipse "project explore" -> Run as -> Run
configuration
=>select your project name then check "Main" tab, in C/C++ application
file. is it point to your binary file?
E.g:
Debug/TestProj.exe
|
PHP executing two C programs with proc_open |
If process can run separately one after another
You can try put "in-steps",
/** step 1*/
$process1 = proc_open($command_exe1, $descriptorspec1, $pipes1, $cwd)
...
while(!feof($pipes1[1])) {
$StdOut1 = stream_get_contents($pipes1[1]);
}
echo $StdOut1;
/** step 2*/
$process2 = proc_open($command_exe2 $descriptorspec2, $pipes2, $cwd)
while(!feof($pipes2[1])) {
...
|
How to run Frege programs on Android? |
I'm not familiar with frege, and I haven't tried to use scala or other JVM
languages on Android.
That being said, if I were to try something like that, these are the steps
I would likely take to try and figure out how to get it to work.
Build a simple command line based HelloWorld type application in frege,
that can be run with, e.g. java -jar HelloWorld.jar HelloWorld
Run dx on HelloWorld.jar, and then try to get the example working on an
android device from adb shell, using dalvikvm. i.e. dalvikvm -cp blah.dex
HelloWorld
Figure out how to reference/use classes from the android.jar provided by
the Android sdk in frege
Build a simple proof of concept Activity class in frege, and manually build
a classes.dex file from it
Build a similar proof of concept application in java and use the
|
Administrator permission for certain programs |
The culprit is User Account Control (UAC). UAC doesn't allow white listing
a particular application. You have to disable it to get rid of these
messages.
To know more about UAC or to diable it see
http://www.petri.co.il/disable-uac-in-windows-7.htm
|
threads calling other programs |
You should look int Boost Threads. There are examples on the web on how to
create a program and use Boost Threads to call either a class method or a
non-class static method.
About using C++ library in C code, this stackoverflow post may be helpful.
I guess using extern scope operator is the magic here. C++ cross-compiler
is designed using C, so backward conversion is not impossible.
If you hit success in using C++ into C
Wikipedia listed these for Multithreading libraries for C++. I guess it is
worth visiting those and see what is good. Boost is still the best IMPO.
P.S. You should checkout intel's Threading Building Block TBB too. They
are quite good and simple. Open source projects such as OpenCV uses tbb for
their multithreaded class ops. the link is here
|
How to add my program to add/remove programs? VB.NET |
I found an indirect way to do it - via cmd. That's not the best way, but it
may work.
You can write the following text in the resources as name.cmd:
'sets the name of your app to display
reg add "HKLMSoftwareMicrosoftWindowsCurrentVersionUninstallYourapp" /v
"DisplayName" /d "Yourapp" /f
'sets your app version to display
REG ADD "HKLMSoftwareMicrosoftWindowsCurrentVersionUninstallYourapp" /V
"DisplayVersion" /D "1.0.0.0"
'sets your app icon to display location
REG ADD "HKLMSoftwareMicrosoftWindowsCurrentVersionUninstallYourapp" /V
"DisplayIcon" /D "%PROGRAMFILES%Yourappyourapp.ico"
'sets your name to display as publisher
REG ADD "HKLMSoftwareMicrosoftWindowsCurrentVersionUninstallYourapp" /V
"Publisher" /D "Yourname"
'sets the uninstall path
REG ADD "HKLMSoftwareMicrosoftWindowsCurrentV
|
Pseudorandomity in concurrent programs |
My question is this: Is it possible to preserve pseudorandomity without
having inter-thread communication and if so, how?
Yes it is. Make each thread use a separate random number generator (with a
different but deterministic seed).
|
How do i share a variable's value between C programs |
What your code does is wrong; you're trying to share a variable between two
processes but what you've done is sharing between two source files so
declaring a variable as an extern certainly doesn't help you; because
that's what you do if in one process you want to expose a variable in one
source file to other source files.
A natural way to share a variable between two(or more) processes(programs)
is something in UNIX systems called shared-memory.
Please check this link for an introduction.
http://www.cs.cf.ac.uk/Dave/C/node27.html
Edit:
Of course, inter-process communication(how two processes talk with each
other) isn't limited to shared memory, you can also share a variable by
sockets or through pipes
|
Execute Commands / Run Programs |
Do not use such components. This is dangerous no matter what creator says.
I'm Joomla extension developer and believe me it can ruin your application
and make more problems and benefits. Depends on what you want to archive
and how big will be your project you have few possibilities:
1. Create component that will execute commands
Something similar to what U did but based on custom created component. Its
fastest and cheapest way. Problem starts when your Java application will
use more resources then website (interface). So its more like good solution
for start.
2. Create component that will contact application written in Java via API
This is good solution if your Java application use a lot of resources. You
can run it on several servers, manage servers load so clients gets results
faster
|
Can you explain to me the difference between two programs? |
The first program prints the value of the uninitialized pointer p
interpreted as an unsigned integer. Since the pointer is not initialized
the value printed is whatever value happens to be in that location.
The second program prints the address of the pointer p interpreted as an
unsigned integer. While not technically legal, it will work on most
systems where the sizeof(char *) == sizeof(unsigned int). Since the
variable "p" is an automatic variable you will get a value in the address
range that your runtime assigns to the C stack.
Edit: to clarify from the comments. Printf formats the data passed to it
in parameters according to the control string. %u means to print an
unsigned integer. So when you pass in p, C passes in the value of the
pointer variable to printf. The # of
|
Advice with for loop programs |
You're generating the random number outside of your loop. Therefore it will
exist as the same number every time. The solution is to move the definition
inside of the loop.
public static void main(String[] args) {
for(int counter = 0; counter < 30; counter++){
int random = (int) (Math.random() *50) +25;
System.out.println(random);
}
}
In this way, every time through the loop (30 iterations), your code will
(1) generate some random number and (2) print that number.
|
Share class between programs |
The easiest solution is to put the server and client in the same Eclipse
project:
Both Server and Client can have a main() and be in the same project.
Create two separate run configurations in eclipse (one for Server, one for
Client) -- note that run configurations are created automatically if they
don't exist when you press the "play" button in eclipse (just make sure the
file that has the main() method is open in the editor when you press play),
so you probably won't need to do this manually.
Then, in eclipse, when you export the program, export it as a Runnable JAR
(if "Runnable JAR" isn't available in the export quick menu just select
"Other..." and search for it). You can select the run configuration. So
export one for client (maybe name it client.jar) and one for the server
(maybe
|
Same Sparql with different result using different programs |
I've tried this query with the data that you provided (I had to add the
prefixes):
prefix wo: <http://purl.org/ontology/wo/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
select ?individual ?type ?label where {
?individual rdf:type ?type .
?individual rdfs:label ?label
filter (?type in (wo:Kingdom))
}
I ran the query using Jena's command line arq with the following results:
$ arq --query query.sparql --data ontology.owl
-------------------------------------------------------------------
| individual | type | label |
===================================================================
| <file:/nature/life/Animal#kingdom> | wo:Kingdom | "Animals" |
|
|
How to run java programs in grails? |
You have to import class Hello:
import Hello
class HelloController {
def index() {
Hello.main(null)
}
}
See Java docs about packages and import statement:
http://docs.oracle.com/javase/tutorial/java/package/usepkgs.html
|
Two different C programs are accessing a file |
You should be concerned. I assume you are sure that no other program (than
the two executables mentioned in your question) are accessing that file.
You should indeed lock to serialize that access. Use flock(2), or lockf(3)
which uses fcntl(2)
BTW, is the file read and written sequentially? Did you consider using some
higher-level thing, e.g. GDBM or some database like mariadb or postgresql
or mongodb, etc...
|
Is there a way to use GLSL programs as filters? |
The typical process for this type of thing is to use a full-screen shader
in post processing using the depth buffer from your fully rendered scene,
or using a z-pass, which renders only to the depth buffer. You can chain
them together and create any number of effects. It typically involves some
render-to-texture work, and is not a real trivial task (too much to post
code here), but it's not THAT difficult either.
If you want to take a look at a decent post-processing system, take a look
at the PostFx system in Torque3D:
https://github.com/GarageGames/Torque3D
And here is an example of creating fog with GLSL in post:
http://isnippets.blogspot.com/2010/10/real-time-fog-using-post-processing-in.html
|
Optimizing console programs |
Well... There's always multithreading:
Stack Overflow, for example.
But it's always a complicated process, especially for C++. I'm afraid
you'll have to google some tutorials for your particular case.
Here are some: tutorialspoint, codebase, plenty more around. There are a
lot of methods, achieved by many distinct libraries, and none of them could
be considered simple.
|
Combining large C and C++ programs |
I'll tell you the correct answer and you're probably not going to like it.
Without knowing all the specifics of your code, it sounds like you need to
do some heavy refactoring.
In an ideal world, when you write your application, it should be written in
such a way that the implementation is done as a formal API and the main()
translates/parses the command-line arguments into appropriate calls into
the API. If done correctly, the file that has the main() routine is only
needed to build the executable for its task.
Better still, the implementation would be built as a library and a set of
headers for using that library.
Then your task would not be blenderizing two executables, but instead
building a new application that calls two different libraries.
The reason that you're not going to li
|
When do C programs not have main function |
Just as every C application and C++ application must have a main function
as its starting point, every Win32-based application must have a WinMain
function.
Take a look: http://msdn.microsoft.com/en-us/library/vstudio/bb384843.aspx
|
Can native C programs be used in LibGDX? |
To be clear, I believe you have an app written in Java that uses Libgdx
currently, and you would like to extend that app by including a C library
and making calls out to the C library from the Java application.
Libgdx does not provide any special support for third-party libraries,
native or Java. You will have to use the backend platform's APIs to call
out to native code (JNI, NDK, etc).
You should be able to add your library to the Android and Desktop backend
projects, and access it via a Platform Interface. It is probably not
possible to use the GWT-backend (unless you have a C to Javascript
compiler). For iOS you would need to build your library for iOS, and then
figure out how to link it into the Xamarin (or robovm) build process for
your app. While I'm going to assume this is po
|
How to change volumes of individual programs? |
Please see this example in Codeproject. it's a sample documentation of
Windows Audio Mixer API Wrapper Library
Hope will help it.
|
Bootstrapper and Setup in Add/Remove Programs |
The documentation says this, have you set these Attributes (DisableModify
& DisableRemove) in your bundle?
If the "DisableModify" attribute is also "yes" or "button" then the
bundle will not be displayed in Progams and Features and another
mechanism (such as registering as a related bundle addon) must be used
to ensure the bundle can be removed.
DisableRemove YesNoType Determines whether the bundle can be removed
via the Programs and Features (also known as Add/Remove Programs). If the
value is "yes" then the "Uninstall" button will not be displayed. The
default is "no" which ensures there is an "Uninstall" button to remove the
bundle. If the "DisableModify" attribute is also "yes" or "button" then the
bundle will not be displayed in Progams and Features and another me
|
Avoid website garb programs |
You have to tell whether the visitor is human or bot in the first place.
This no easy task, see e. g. : Tell bots apart from human visitors for
stats?
Then, if you detected what bot it is, you can decide wether you want to
give it your website content or not. Legitimate bots (like Googlebot) will
conveniently provide their own userAgent id; malicious bots / web crawlers
may disguise themselves as common browser programs.
There is no 100% solution, anyway.
If you content is really sensitive, you may want to add captcha, or user
authentication.
|
mapreduce programs using eclipse in CDH4 |
Pankaj, you can always visit the official page. Apart from this you might
find these links helpful :
http://blog.cloudera.com/blog/2013/08/how-to-use-eclipse-with-mapreduce-in-clouderas-quickstart-vm/
http://cloudfront.blogspot.in/2012/07/how-to-run-mapreduce-programs-using.html#.UgH8OWT08Vk
It is not mandatory to have Eclipse on the main server(main server=master
machine???). Any of the last 3 versions of eclipse work perfectly fine.
Don't know about earlier versions. You can either run your job through
Eclipse directly or you can write your job in Eclipse and export it as a
jar. You can then copy this jar to your JT machine and execute it there
through the shell using hadoop/jar command. If you are running your job
directly through the eclipse you need to tell it the location of your
|
Linux: What programs are accessing the Internet? |
Using
netstat -an
you will see which ports that are in a connection at the moment.
If you want to see which process that is connected to a certain, port 80 in
this case, you can use
lsof -i tcp:80
Well, you need to be root, of course.
|
How to write parallel programs in Perl? |
That design makes no sense whatsoever, and the claim that it's better not
to use threads or child processes makes even less sense.
You have three sources of requests:
Request Source A: Make web request to a server every 5 seconds.
Request Source B: Make database request to a server every 60 seconds.
Request Source C: Accept requests from a socket.
Create a thread for each Request Source. Their job is solely to monitor
each Request Source in order to ensure that the Sources are checked when
they should be checked. As such, none of these threads should do any real
work. If a task must be performed, they delegate the work to a worker
thread. They don't POST anything. They don't write to the database.
The actual tasks (including sending POSTs and writing to the database) are
performed by
|
How to list all the programs that are available to a given account on a cluster? |
echo $PATH | tr ":" "
" | while read line; do echo $line; ls $line; done
Be prepared for tons of output. You might be better off doing echo $PATH
first and looking for interesting-looking directories, or just seeing if
tab-completion works (just type 'c', tab, see if it shows 'cat', 'cd',
etc).
Really tho, ask the prof for whatever docs you're supposed to have, the
tools you're looking for aren't likely to be obvious just from the name of
the command.
|
Do agda programs necessarily terminate? |
The syntax highlighting you are seeing is a compile error. The termination
checker's effect is to highlight non-terminating functions in a kind of
pink-orange color ("salmon"). You may notice that a module containing such
an error cannot be imported from other modules. It can also not be
compiled down to Haskell.
So yes, Agda programs always terminate and this is not a bug.
|
Interchanging two programs inputs and outputs |
You can do this with a named pipe:
mkfifo xy_pipe
./program_x < xy_pipe | ./program_y > xy_pipe
A regular pipe is used to connect x's stdout to y's stdin.
To connect y's stdout to x's stdin we create a second, named pipe using
mkfifo. A named pipe is an explicit way to connect two processes the way |
normally does. Whenever a process writes to a named pipe it blocks until
another process reads from the pipe. Although xy_pipe appears to be a file,
no data is actually written to disk.
Example:
$ cat program_x
#!/bin/bash
echo foo
read line && echo "program_x: read '$line'" >&2
$ cat program_y
#!/bin/bash
read line && echo "program_y: read '$line'" >&2
echo bar
$ mkfifo xy_pipe
$ ./program_x < xy_pipe | ./program_y > xy_pipe
program_y: read 'f
|