Posts

c# - 2D distance constraint -

i've been trying 2d distance joint working in unity. want free rotation both body joint , connected body, need mass , other constraints adhered to, such fixing rigidbody's position. i've tryed days now, no luck configuring joint type. tryed verlet constraint using: float xdistance = hinge.transform.position.x - target.transform.position.x; float ydistance = hinge.transform.position.y - target.transform.position.y; float newdistance = mathf.sqrt( xdistance * xdistance + ydistance * ydistance ); float con = ( newdistance - maxdistance) / newdistance; vector3 movetarget = new vector3( xdistance * 0.5f * con , ydistance * 0.5f * con, 0.0f ); hinge.rigidbody.moveposition( hinge.transform.position - movetarget ); target.rigidbody.moveposition( target.transform.position + movetarget ); but doesn't take account mass/force or fixtures. can see here want movement on x/y , rotation on z. help? i know isn't answer, add comment button not there. i'm unit...

c - Difference between Vector and Linked list ADT -

can explain me difference between vector , linked list adt in c programming language context. thanks. well, in c, there no "vector" , "list" data types available directly in c++ std library. in terms of "abstract data type", vector considered represent contiguous storage, , linked list considered represented individual cells linked together. vectors provide fast constant time random-access read , write operations, inserting , deleting vector elements take linear time. lists have linear lookup performance find element read , write, given element location, have constant time insertion , deletion. can add items start , end of list in constant time (if adt implementation caches location of last element in list).

c# - cannot loop oo components in a usercontrol -

i bit confused. implemented own usercontrol , want control discover components (like binding source) hosted in same control @ design time. code this: private void findcomponentbyname(string aname) { foreach(component component in this.container.components) { if (component.tostring()==aname) { dosomething(); break; } } } this code not working either @ design time or run time container null. if run code in form not in usercontrol private component findcomponentbyname(string aname) { component result = null; foreach (component component in this.components.components) { if (component.tostring() == aname) { result = component; break; } } return result; } it works, components not null , man...

layout - use vertical percentage for css - height: x%; -

i trying make fluid layout app , having trouble using css height percentages. using horizontal size of window specify height % when want getting percentage vertical size of window. possible or out of luck? width: x%; height: y%; x , y being percentage want element be. both being determined horizontal size of window, , want each use it's respective axis. if use javascript update absolute height of parent node, height % begins mean something. playing around, p or div first generation child of body ignores css height%; wrap in absolute height. if don't know height before hand, use onload js function set it.

How to get Windows native look for the .NET TreeView? -

Image
when using treeview component in .net, of left tree. how can of right tree (windows native look) .net treeview? what want "triangle" node handles , blue "bubble" selection square. you need p/invoke call setwindowtheme passing window handle of tree , use "explorer" theme. paste following code new class in project, compile, , use custom control instead of built-in treeview control. c#: public class nativetreeview : system.windows.forms.treeview { [dllimport("uxtheme.dll", charset = charset.unicode)] private extern static int setwindowtheme(intptr hwnd, string pszsubappname, string pszsubidlist); protected override void createhandle() { base.createhandle(); setwindowtheme(this.handle, "explorer", null); } } vb.net: public class nativetreeview : inherits treeview private declare unicode function setwindowtheme lib "uxtheme...

linux - Apache2::Request (libapreq2-2.13) on centos 5.5 -

i'm having torrid time installing apache2::request on centos 5.5. apache standard 1 came centos. i'm installing libapreq2-2.13 , lot of dependencies didn't exist. far had do: yum install httpd-devel # apxs i did: perl makefile.pl --with-apache2-apxs=/usr/sbin/apxs make the make step told me needed: extutils-xsbuilder , parse-recdescent, duly installed. running make again gave compiler error: /home/xx/installers/libapreq2-2.13/glue/perl/xsbuilder/apreq_xs_postperl.h:22:34: error: modperl_perl_unembed.h: no such file or directory /home/xx/installers/libapreq2-2.13/glue/perl/xsbuilder/apreq_xs_postperl.h:25:33: error: modperl_common_util.h: no such file or directory in file included apache2.xs:45: /home/xx/installers/libapreq2-2.13/glue/perl/xsbuilder/apr/request/apache2/apr__request__apache2.h:1:22: error: mod_perl.h: no such file or directory can tell me package i'm missing? there not method of installing common package "just works" (tm...

mysql - Is it good to use a default of NULL? -

i have columns may contain data if user wants provide it. example | email | first name | last name | email - required column set not null - default: none first name - not required column set null - default: null last name - not required column set null - default: null in phpmyadmin when creating/editing column; has option saying default: drop down showing none | defined | null | current timestamp because first name | last name optional , not required should choose default null or maybe none? which best , why please? i know there many discussions on not find answered question; more in regards allowing null or not null, question default value. you should set them default:null if user doesn't provide info fields, should null obviously.