Posts Tagged ‘tutorial’

FLTK instalation error in VS2010

Sunday, June 13th, 2010

Hello everyone,
i have a problem,
i want to use FLTK in visual studio 2010. I installt it correctly, I copied the .lib files into the lib folder and the FL folder into the include folder in my Visual studio 2010 directory. My problem is when i compile the folowing code to see if everything works i get these errors:

#include <FL/Fl.H>

#include <FL/Fl_Box.H>

#include <FL/FL_Window.h>


int main(){	Fl_Window w(200, 200, "title");	Fl_Box b(0, 0, 200, 200, "Hie");	w.show();	return Fl::run();}

1>------ Build started: Project: testGUI+, Configuration: Debug Win32 ------1>Build started 13.06.2010 11:45:01.1>InitializeBuildStatus:1>  Touching "DebugtestGUI+.unsuccessfulbuild".1>ClCompile:1>  All outputs are up-to-date.1>ManifestResourceCompile:1>  All outputs are up-to-date.1>fltkd.lib(Fl.obj) : error LNK2001: unresolved external symbol "public: static char const * const Fl_Display_Device::device_type" (?device_type@Fl_Display_Device@@2PBDB)1>fltkd.lib(Fl_Double_Window.obj) : error LNK2001: unresolved external symbol "public: static char const * const Fl_Display_Device::device_type" (?device_type@Fl_Display_Device@@2PBDB)1>fltkd.lib(Fl.obj) : error LNK2001: unresolved external symbol "public: static char const * const Fl_GDI_Graphics_Driver::device_type" (?device_type@Fl_GDI_Graphics_Driver@@2PBDB)1>fltkd.lib(Fl.obj) : error LNK2001: unresolved external symbol "public: virtual void __thiscall Fl_Surface_Device::set_current(void)" (?set_current@Fl_Surface_Device@@UAEXXZ)1>fltkd.lib(fl_draw_image.obj) : error LNK2001: unresolved external symbol "public: static char const * const Fl_System_Printer::device_type" (?device_type@Fl_System_Printer@@2PBDB)1>fltkd.lib(Fl_Double_Window.obj) : error LNK2001: unresolved external symbol "public: static char const * const Fl_System_Printer::device_type" (?device_type@Fl_System_Printer@@2PBDB)1>fltkd.lib(fl_rect.obj) : error LNK2001: unresolved external symbol "public: static char const * const Fl_System_Printer::device_type" (?device_type@Fl_System_Printer@@2PBDB)1>fltkd.lib(fl_font.obj) : error LNK2019: unresolved external symbol "public: static char const * const Fl_System_Printer::device_type" (?device_type@Fl_System_Printer@@2PBDB) referenced in function "class Fl_Font_Descriptor * __cdecl find(int,int,int)" (?find@@YAPAVFl_Font_Descriptor@@HHH@Z)1>fltkd.lib(Fl_Bitmap.obj) : error LNK2001: unresolved external symbol "public: static char const * const Fl_System_Printer::device_type" (?device_type@Fl_System_Printer@@2PBDB)1>fltkd.lib(Fl_Pixmap.obj) : error LNK2001: unresolved external symbol "public: static char const * const Fl_System_Printer::device_type" (?device_type@Fl_System_Printer@@2PBDB)1>C:UsersDaniidocumentsvisual studio 2010ProjectstestGUI+DebugtestGUI+.exe : fatal error LNK1120: 4 unresolved externals1>1>Build FAILED.1>1>Time Elapsed 00:00:00.18
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

im sorry if this has been explained before.. i couldnt find anything..

Red&Black

doc,pdf viewer

Sunday, June 13th, 2010

Is there any free/paid software/source code which provides a viewer for doc,pdf,xls,ppt etc files?

Select-all checkboxes in a FORM_TAG

Sunday, June 13th, 2010

In a form_tag, there is a list of 10 to 15 checkboxes:

<%= check_box_tag 'vehicles[]', car.id %>

How can I select-all (put a tick in every single) checkboxes by RJS? Thanks

EDIT: Sorry I didn’t make my question clear. What I meant to ask is how to add a “Select/Un-select All” link in the same page to toggle the checkboxes.

How to approach parallel processing of messages?

Sunday, June 13th, 2010

I am redesigning the messaging system for my app to use intel threading building blocks and am stumped trying to decide between two possible approaches.

Basically, I have a sequence of message objects and for each message type, a sequence of handlers. For each message object, I apply each handler registered for that message objects type.


The sequential version would be something like this (pseudocode):

for each message in message_sequence                     <- SEQUENTIAL
    for each handler in (handler_table for message.type)
        apply handler to message                         <- SEQUENTIAL

The first approach which I am considering processes the message objects in turn (sequentially) and applies the handlers concurrently.

Pros:

  • predictable ordering of messages (ie, we are guaranteed a FIFO processing order)
  • (potentially) lower latency of processing each message

Cons:

  • more processing resources available than handlers for a single message type (bad parallelization)
  • bad use of processor cache since message objects need to be copied for each handler to use
  • large overhead for small handlers

The pseudocode of this approach would be as follows:

for each message in message_sequence                              <- SEQUENTIAL
    parallel_for each handler in (handler_table for message.type)
        apply handler to message                                  <- PARALLEL

The second approach is to process the messages in parallel and apply the handlers to each message sequentially.

Pros:

  • better use of processor cache (keeps the message object local to all handlers which will use it)
  • small handlers don’t impose as much overhead (as long as there are other handlers also to be run)
  • more messages are expected than there are handlers, so the potential for parallelism is greater

Cons:

  • Unpredictable ordering – if message A is sent before message B, they may both be processed at the same time, or B may finish processing before all of A’s handlers are finished (order is non-deterministic)

The pseudocode is as follows:

parallel_for each message in message_sequence                     <- PARALLEL
    for each handler in (handler_table for message.type)
        apply handler to message                                  <- SEQUENTIAL

The second approach has more advantages than the first, but non-deterministic ordering is a big disadvantage..

Which approach would you choose and why? Are there any other approaches I should consider (besides the obvious third approach: parallel messages and parallel handlers, which has the disadvantages of both and no real redeeming factors as far as I can tell)?

Thanks!

Stupid Question Regarding If-Else’s Simultaneous Execution in C++ or C

Sunday, June 13th, 2010

In C or C++

if ( x )
    statement1;
else
    statement 2;

for what value of x both statements will be executed??
I know we can execute if-else together like this:

if(1){
    goto ELSE;
}
else{
    ELSE:
}

Is there any way, like a value?
(Which i think is not possible. Asking because someone is arguing!)

Lowest context switch time

Sunday, June 13th, 2010

Which processor has the best context switch time ?

Chaining your own method in Ruby on Rails

Sunday, June 13th, 2010

In my Rails app, I am used to using syntax like the following in a number of places, including helpers/application_helper.rb:

def my_method(x,y)
  return x+y
end

I am also used to calling the resulting method from basically anywhere in my app using syntax like this:

my_method(2,3)

However, I’d like to be able to use syntax like like this:

class_from_my_rails_app.my_method(3)

How and where do I define my_method so I can use it like this?

I’m happy to consult the documentation, but I just don’t know what the latter style is called. What do you call it?

Many thanks,

Steven.

difference between erase and remove/remove_if algorithms?

Sunday, June 13th, 2010

What is really the difference between the algorithms remove and remove_if and the member function erase?
Does both of them result in a call to the removed objects destructor?

ASP.NET plug-in architecture, settings problem

Sunday, June 13th, 2010

I want to divide business layer (BLL) of an asp.net application into multiple components. Each component is a .NET class library which is compiled as a standalone DLL. These components should have their own configuration files. For example “MyNameSpace.Users.dll” contains classes about users of the website and there’s a password policy to check if password length is at least x characters. When webmaster edits the config file of this DLL and set x to y then component (DLL) should use new value (y) in the future and enforce passwords to be at least y characters. I want each component as a single project and compile them separaely (and not to put all projects in a solution in Visual Studio), and put the DLLs of these libraries into the “Bin” folder of my ASP.NET application.

Is it possible ?
Where should I put these config files ?

how to demonstrate that a protocol is certain with those specifications.

Sunday, June 13th, 2010

Hi every one,

we have 4 persons A, B, C and D witch want to know the averge of their salary SA SB SC SD but no one wants that the others know his salary. For that they use this protocol:

  1. A->B: [N+SA ]KB
  2. B->C:[N+SA+SB]KC
  3. C->D:[N+SA+SB+SC]KD
  4. D->A:[N+SA+SB+SC+SD]KA

where the notation [m]KY represents the message x crypted xith the public key of y

Is this protocol certain. can we trust it.
want you please give me justification.

thanks for help.