Posts

c# - Application hangs when calling external constructor -- troubleshooting steps? -

this may long shot i'm out of ideas. i've got vs c# solution 3 projects in it. there's class library project , 2 application projects depend on class library. class library in turn depends on few other dlls including avalonedit dll sharpdevelop project. one of applications building , running fine, including use of own control wraps avalonedit control. other application failing run , seems failing @ point when avalonedit control initialised via xaml in wrapping control. the problem don't see errors in debug output @ all, see dll loaded message , nothing. if step constructor of control step never completes. debugger says app running, apparently spinning somewhere in avalonedit dll when underlying edit control constructed xaml side. i have assume there's issue difference in environment between 2 projects i'm kind of stumped how proceed in tracking problem down. going have somehow arrange matters can put break in avalonedit source? edit: if pause/break...

c - signed two's complement arithmetic -

i thinking on data types ranges, question arises. know signed char's range -128 127. got how 127 comes, i.e. 0111111 = +127 but not how -128 comes? if on sign bit 11111111, how equal -128 ? most of time, computers use what's called 2's complement represent signed integers. the way 2's complement works possible values in huge loop, 0, max_value, min_value, zero, , on. so minimum value maximum value +1 - 01111111 = 127 , , 10000000 = -128 . this has nice property of behaving same unsigned arithmetic - if want -2 + 1 , have 11111110 + 00000001 = 11111111 = -1 , using same hardware unsigned addition. the reason there's value on low end choose have numbers high-bit set negative, means 0 takes value away positive side.

flash - Actionscript block until request completes -

i want make synchronous request server. want entire program stop processing until request complete , server has responded; proper way of doing this? you don't want entire program stop processing until server responds, because runs risk swf trigger "script has executed 15 seconds" modal dialog warning appear in front of user, @ point might consider action lost cause. considered "crash" , "not idea." what you're trying accomplish believe halting execution (including rendering) achieve? if really want make application non-responsive user activity during request, might able away setting mousechildren = mouseenabled = false on application's root movieclip. if need stop timeline animations, you'll have come way globally find / stop them yourself. obviously, enter_frame events you're listening for, or timers you're running should stop when make request. you might able away setting swf's framerate 0fps in code (...

math - Finding the angle between two lines -

possible duplicate: calculating angle between 2 lines without having calculate slope? (java) i need find angle between 3 points. have point , point c being 2 points of ray , have point b being central point points , c extend from. if create line between points b , a, , create line between points b , c, can find angle between 2 lines. take line direction vector a(a,a',a") , line b direction vector b(b,b',b"). a.b = ||a||.||b||.cos(t) a.b cos(t) = -------------- ||a||.||b|| take a(1,2,3) ; b(4,5,6) ; c(3,2,0) calculate angle between lines ab , ac. line ab has direction numbers (3,3,3) , line ac has direction numbers (2,0,-3). hence 6 + 0 - 9 cos(t) = ----------------- sqrt(27) .sqrt(13) update: use arccos(cos(t)) obtain angle. convert radians degrees multiply 180/π convert degrees radians multiply π/180

android - NDK call in a GLSurfaceView class -

i trying render opengl es surface ndk, got halted in work. have setup similar 3d example in ndk. have class inheriting glsurface view , 1 inheriting glsurfaceview.renderer. in .c file, have simple method nothing. void function nothing in it. can call function in class inherit activity oncreate method. private static native void nativesetup(); @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); mglview = new graphglsurfaceview(this); setcontentview(mglview); nativesetup(); } the program works fine. however, if put call (and declaration) in 1 of glsurfaceview classes, program fails (nativesetup call in question). have verified working fine without native call (a colored surface drawn). have ideas why cannot call native code glsurface classes? my c file: #include <string.h> #include <jni.h> void java_com_test_intro_nativesetup( jnienv* env ){} my jav...

iphone - Is there any way to resize the UIPickerView so that I can see completely it in center of my application? -

hello trying resize uipickerview below dimension given, not working @ want visible. here datepicker uipickerview declared , synthesized too, should do? datepicker = [[uipickerview alloc] initwithframe:cgrectmake(100, 200, 100, 150)]; datepicker.delegate = self; datepicker.showsselectionindicator = yes; [self.view addsubview:datepicker]; if not getting mean, can ask me again,,, cgaffinetransform s0 = cgaffinetransformmakescale(scalefactor, scalefactor); cgaffinetransform t1 = cgaffinetransformmaketranslation(x,y); mypickerview.transform = cgaffinetransformconcat(s0, t1); you can use 0.5 scalefactor resize pickerview 50%, , change x , y appropriate values make pickerview appear in desired position. note: import quartzcore framework.

python - Django: How to set DateField to only accept Today & Future dates -

i have been looking ways set django form accept dates today or days in future. have jquery datepicker on frontend, here form field modelform. thanks help, appreciated. date = forms.datefield( label=_("what day?"), widget=forms.textinput(), required=true) you add clean() method in form ensure date not in past. import datetime class myform(forms.form): date = forms.datefield(...) def clean_date(self): date = self.cleaned_data['date'] if date < datetime.date.today(): raise forms.validationerror("the date cannot in past!") return date see http://docs.djangoproject.com/en/dev/ref/forms/validation/#cleaning-a-specific-field-attribute