Posts

Showing posts from February, 2011

iphone - How can I fade a View with a CAEAGLLayer -

i'm looking way change alpha value of view caeagllayer. setting self.alpha doesn't work, think there must concept here don't understand. app i'm building has opengl layer on live footage iphone/ipod camera, , i'd fade in , out. i've tried setting caeagllayer's opaque , opacity value, won't work. thoughts may have. i trying similar, i.e. have background of caeagllayer transparent, can draw on photo. have managed fade whole thing in , out setting alpha value on layer in layout editor of nib, might work you, not quite effect want. want transparent background , there discussion of how achieve here: http://www.iphonedevsdk.com/forum/iphone-sdk-development/20081-merging-content-uiimageview-eaglview.html although haven't managed describe working yet ... :-(

php - Cache_Manager in View_Helper -

i have configured cachemanager resource in application.ini ... can resource actions. trying same resource view_helper , it's not working! i'm getting zend_cache_manager object ... but $cachemanager->getcache('theresourcename'); is returning null...? any ideas? best wishes, alex try: $front = zend_controller_front::getinstance(); $bootstrap = $front->getparam('bootstrap'); $resource = $bootstrap->getresource('cachemanager'); $cache = $resource->getcache('theresourcename');

How to open serial port in linux without changing any pin? -

posix requires changing rts pin on port opening. want way avoid it. having same problem, i'd give try patching ftdi_sio kernel driver. need uncomment small piece of code in ftdi_dtr_rts() this: static void ftdi_dtr_rts(struct usb_serial_port *port, int on) { ... /* drop rts , dtr */ if (on) set_mctrl(port, tiocm_dtr /*| tiocm_rts*/); // <<-- here else clear_mctrl(port, tiocm_dtr /*| tiocm_rts*/); // <<-- , here } and rts handshake line not longer changed upon open() call. note, uart might not longer working rts/cts hardware handshake, long modified kernel driver loaded. can still control state of rts handshake line manually calling e.g.: int opins = tiocm_rts; ioctl(tty_fd, tiocmbic, &opins); i'd tested ctrl+a+g command of picocom 2.3a, running kubuntu 16.04 64 bit , ftdi ft2232h based usb uart adapter. you might find more details on topic here .

django - Cross-subdomain Admin login with login sharing -

i have sites 2 subdomains www.example.com test.example.com both talk same db. both separate code bases. i want admin login persist between 2 sites. (if logged in www, automatically logged in test , vice versa) i have these settings in settings.py csrf_cookie_domain = session_cookie_domain = ".example.com" secret_key ="theeisnospoonblahblah" the admins seems talking, in weird way. if go www.example.com , logged admin, if go test.example.com, instead of being logged in test.example.com admin, i automatically logged out of www.example.com . am missing settings in settings.py

mongodb - What's the most efficient document-oriented database engine to store thousands of medium sized documents? -

mongodb or redis ? i've heard should keep collections small in mongodb enable better indexing (and indexes fitting on ram), , i've heard redis "blazing fast" mongodb better if have bigger collections. what's efficient 1 if have multiple thousand collections of few thousand of hashes ? i'm asking because in project it's have available data benchmark , design bad benchmark scripts because don't understand theoretical concepts of 2 database engines, specially redis. thanks answers this. it depends on specific use case. if want able query documents on other id shouldn't choose redis. redis have implement own indexing scheme, , that's unnecessary. there's few cases redis better option think use case (not there's wrong redis, use both redis , mongo, different things). sounds me have objects can represented hashes. both mongo , redis can store hashes, mongo can more. mongo can search document on of fields, can add index

javascript - empty check for this script? -

between head <head><script type="text/javascript">$(document).ready(function() { $.twitter.start({ searchtype:"searchword", searchobject:"google", lang:"en", live:"live-180", placeholder:"tweetcontainer", loadmsg: "loading messages...", imgname: "loader.gif", total: 6, readmore: "read on twitter", nameuser:"image", openexternallinks:"newwindow", }); });</script></head> between body <body> <div id="tweetcontainer"></div> </body> i want empty check tweet container if no tweets hide div tweetcontainer you can this if($("#tweetcontainer").eq(0).html() == '') { //this implies there no tweets. whatever need $("#twe

symfony1 - Is there any way to set post parameters? -

is there way set post parameters? when submit form set variable (that give value dynamically) post parameter. is possible? sf 1.4 yes , no. depends you're trying achieve. post parameters in php stored in $_post super global, global array far php code concerned. following: $_post['my_key'] = $value; this method can used manipulate posted values. i'd there serious issue design if need add post variables.

PHP cURL: Get target of redirect, without following it -

the curl_getinfo function returns lot of metadata result of http request. however, reason doesn't include bit of information want @ moment, target url if request returns http redirection code. i'm not using curlopt_followlocation because want handle specific redirect codes special cases. if curl can follow redirects, why can't tell me redirect when isn't following them? of course, set curlopt_header flag , pick out location header. there more efficient way? this can done in 4 easy steps: step 1. initialise curl curl_init($ch); //initialise curl handle //cookiesession optional, use if want keep cookies in memory curl_setopt($this->ch, curlopt_cookiesession, true); step 2. headers $url curl_setopt($ch, curlopt_url, $url); //specify url curl_setopt($ch, curlopt_header, true); //include headers in http data curl_setopt($ch, curlopt_followlocation, false); //don't follow redirects $http_data = curl_exec($ch); //hit $url $curl_info = curl_g

java - Getting the array Class<?> of a given class -

given class<?> describes class a , somehow possible class<?> matches class a[] ? class<?> clazz = a.class; class<?> arrayclazz = clazz.toarray(); // ?? assert arrayclazz.equals(a[].class); java.lang.reflect.array.newinstance(clazz, 0).getclass()

java - How to detect - mouse right or left key is primary? -

how detect - mouse right or left key primary using java? i suspect there's no way without getting os specifics, since it's os abstraction. see also: how detect mouse configuration?

html - add text from textfield into selectbox at javascript? -

can point @ tutorial adding text (by user) textfield select list (after clicking button) javascript? thanks here simple jsfiddle shows how can dynamically add option select tag using javascript input textfield: html: <select id='myselect'></select> <input type='text' value='' name='mytext' id='mytext' /> <button value='submit' id='mybtn' name='submit'>submit</button> javascript: var myselect = document.getelementbyid('myselect'); function createoption(){ var currenttext = document.getelementbyid('mytext').value; var objoption = document.createelement("option"); objoption.text = currenttext ; objoption.value = currenttext ; //myselect.add(objoption); myselect.options.add(objoption); } document.getelementbyid('mybtn').onclick = createoption; basically have text field, button , select box in html. submit button

asp.net mvc - Custom Model Binder -

i'd create custom model binder. let's there're 20 properties. need manualy bind 5 of them. i'd bind other 15 properties automatic default binder does. is somehow possible ? sure, least thing can inherit defaultmodelbinder , override bindmodel(...) method , use base.bindmodel(...) whatever want. after provide own binding logic else.

r - multiply each cell of a data.frame with it's weight -

what want embarrassing simple - nevertheless fail. i have data.frame "characters" , "numerics". 1 of columns of data.frame represents weights. i want multiply every cell of data frame corresponding weight (if it's numeric). how do (best without using nested loop). thank in advance! example: c1 c2 w l1 abc 2 1 l2 dxf 3 0.5 l3 ghi 4 1.5 should become c1 c2 w l1 abc 2 1 l2 dxf 1.5 0.5 l3 ghi 6 1.5 for reproducible example, dd data frame mixture of variable types, w being weights. dd <- data.frame(g=gl(2,2), x=rnorm(4), y=1l:4l, z=letters[1:4], w=0.3:3.3) num.vars <- names(dd)[sapply(dd, is.numeric)] #select numeric variables num.vars <- setdiff(num.vars, "w") # remove weight variable dd[num.vars] <- dd[num.vars] * dd$w # multiply

c++ cli - Syntax error : identifier 'String' -

we received piece of code assignment, , after spending lot of time fixing problems within, ended syntax error : identifier 'string' . everywhere on web, people using std::string , not code referring since function called c# project using string object. here declaration : int findwindow(string ^captiontext,intptr ^%phwnd, int %left,int %top,int %right,int %bottom); and have no idea how fix one. there other errors such as error c2062: type 'int' unexpected ... error c2065: 'intptr' : undeclared identifier error c2065: 'string' : undeclared identifier ... etc. any appreciated. should mention errors have nothing assignment? use system::string , system::intptr or write using namespace system;

NHibernate subclass with join table with bag of subclass problem -

hi guys have model of type public abstract class baseentity { public guid id {get; set;} } class entitya : baseentity { ..other properties.. ilist<entityb> bentities {get; set;} } class entityb : baseentity { ..other properties.. entitya owner {get, set;} } mapped follow: <class name="baseentity" abstract="true" table="tbl_baseentity" dynamic-insert="true" dynamic-update="true" lazy="true" > <id name="id" column="id_entity" type="guid" unsaved-value="00000000-0000-0000-0000-000000000000"> <generator class="guid.comb" /> </id> <discriminator column="etitytype" type="string" force="true" /> </class> <subclass name="entitya" extends="baseentity" discriminator-value="a&quo

data visualization - How to display a stacked barchart in Gnuplot? -

Image
i have data file looks bit this: a 0.2 0.5 b 0.65 0.8 c 0.4 0.2 i.e., contains 3 columns first column contains labels , other 2 columns float values. columns separated spaces. i'd plot in way labels appear tics on x-axis while columns plotted 2 differently colored barcharts on top of each other. how can achieve using gnuplot? assuming data stored in file 1.dat , stacked barcharts might generated follows: set style data histograms set style histogram rowstacked set boxwidth 1 relative set style fill solid 1.0 border -1 set yrange [0:1.5] set datafile separator " " plot '1.dat' using 2 t "var 1", '' using 3:xticlabels(1) t "var 2" as can see, barcharts no different histograms (at least, within gnuplot). more information can found on gnuplot demo page .

configuration - What prevents a browser from loading 2 long running PHP scripts concurrently from the same domain? -

there appears limit on number of concurrent scripts php session. session , not ip / client because can start browser , load second script. there parameter limiting 1 concurrent script? you have wait 1 complete before other 1 starts loading. the default session handler uses files, , lock session file duration of request. if have long-running script, should force relinquish session lock doing session_write_close() before entering "long running" part of script. you can re-open session session_start() again later on, if need modify session data after long-running portion completes.

php - Mysql REGEX Matching query -

what correct query match string variable mysql field? example: $var_surname = $_post['surname']; $var_surname = strtolower($var_surname); select surname tblname lower(surname) regex $var_surname .......... .......... if($check > 0) { surname exists } else { successful } any appreciated. i don't understand, why using regex (should regexp way) ? do "select surname tblname lower(surname) = '$var_surname'"

zend framework - Does PHP's built-in filter_input work correctly? -

i tried php's built-in function: filter_input() var_dump(filter_var('john.doe.@gmail.com', filter_validate_email)); output: string(19) "john.doe.@gmail.com" then tried latest release of zend framework (1.11.3): $validator = new zend_validate_emailaddress(); if ($validator->isvalid('john.doe.@gmail.com')) { echo 'ok'; } else { foreach ($validator->getmessages() $message) { echo "$message\n"; } } output: 'john.doe.' can not matched against dot-atom format 'john.doe.' can not matched against quoted-string format 'john.doe.' no valid local part email address 'john.doe.@gmail.com' either built-in function should return false or zend method 'ok'. my hubmle question is: which 1 right? http://framework.zend.com/manual/en/zend.validate.set.html doesn't indicate wether they're being rfc-strict or not, lets @ source. in s

android - Visible and invisible with a checkbox -

i have screen 5 lines.each line has 3 edittexts.after 5th line there checkbox , below line 3 edittexts.i like,the 6th line invisible when firstly open app,and when users checks checkbox,the line appear.is possible?thanks final checkbox checkbox = (checkbox) findviewbyid(r.id.box); checkbox.setonclicklistener(new onclicklistener() { public void onclick(view v) { // perform action on clicks, depending on whether it's checked if (((checkbox) v).ischecked()) { ????????????? } else { ??????????? } } }); in layout xml file add android:visibility="gone" to view have hidden @ startup. then in code: myhiddenview.setvisibility(view.visible); to make visible.

mysql - Updating intersection tables, alternative to delete->insert -

i hope 1 more sql wise can me. suppose following table , relationships they're compacted. orders(pk_refno,customer, status) order_accessories(pk_refno,pk_acc) accessories(pk_acc,name,desc) as can see typical 1:*----*:*----*:1 scenario the issue or concern when updating, accessories each order has can modified, meaning user can add/remove accessories. the way i've thought using mysql delete accessories , insert updated ones. i dislike way. think there's sql way it. maybe can suggest , advanced query (which i'll study of course) the other way thought to: retrieve originals. compare them , remove/add differences. i'm not fan of either because done in app, not in database. let's table starts this. order_accessories pk_refno pk_acc 1 73 1 74 1 75 1 86 1 92 let's 75 supposed 76. assuming sane user interface, user can change 75 76. sane user interface send statement dbms. update order_ac

JQuery clear all rows after the first row? -

given follow: <table id="mytable"> <tr> </tr> <tr> </tr> ... </table> i can clear table doing: $("mytable").html(""); but, i'd instead clear rows first one. ideas? $('#mytable tr:gt(0)').remove()

java - Programmatically deploying portlets in locations through liferay? -

i'd have consistent layout every time deploy war, , currently, need manually move , add portlets layout need. there way can anagrammatically or through configuration setup liferay? currently, database isn't versioned, i'm not sure there's way that. yes, can use layout , perhaps specified layout template . these layouts can part of layout set create entire portal. to programmatically, can follow tutorial here . class layoutlocalserviceutil going key process.

classpath - Bundling wsdl in jar with CXF wsdl2java -

i'm working on implementation use wsdl have gotten vendor. our project running on spring , cxf, , i'd create jar allow me access vendor's wsdl services, i'm running classpath issues. using cxf's wsdl2java able generate code acts this: wsdl_location = new url("file:someservice.wsdl"); the service requires wsdl in classpath, bundle in jar distributable stand-alone jar. using wsdl2java tool, able specify string in url instantiation whatever like. however, have not found combination of custom string , wsdl file location inside jar works. the way have gotten work want put wsdl file in same folder someservice.class , use following line: wsdl_location = trackservice.class.getresource("trackservice_v4.wsdl"); however, has downside of me having manually edit java code , compile myself. undesirable because make process part of our maven build , have wsdl2java generation , compilation automatically. i ok wsdl being anywhere in jar, don'

asp.net - Should I encrypt a GUID passed by URL-parameters? -

we creating silverlight application , need have few parameters pass in url calling site. example: http://oursite.com/index.aspx?test=d53ae99b-06a0-4ba7-81ed-4556adc532b2 we want give calling website 'test' string links guid of our table tells silverlight application it's task when arrive. use guid authentication on our application among other things. the guid such: d53ae99b-06a0-4ba7-81ed-4556adc532b2 8354b838-99b3-4b4c-bb07-7cf68620072e encrypted, values longer: l5gyhpwsbuw8kdd+tpwjosoofdf0lzmgzd4uuflx+v/d3ebygz6zpcrjvcrmg2tg wvmn7b0fpa18/q7+u4njb5aoknx6ga9xoasvcet6myjm5tv6do86oexacxdixaes my question is, security in mind, should give them guid encrypted or is, unencrypted? does matter? what everyone's experience type of parameter passing? in matters of encryption, key define security context. might able if had access original guids? if couldn't hazardous, there's no point encrypting, , it's best not encrypt. if there

javascript - Best way to save drag and drop layout -

i've seen question few times have individual objects , cookies. building application toolbox drag , drop functionality (very you'd see in visual studio - i.e. dragging objects onto form, giving them name, etc...) therefore droppable area have many objects including nested droppables. any opinions on best way save sql server database, , re-load such complex layout? objects need load , display saved. done ajax beyond i'm not sure best way proceed. examples might point me in right direction great. much obliged. you can serialize data via xml or json , save serialized string database. keep database , web service infrastructure simple having save each control separately require more parsing on js side, since app sounds js-heavy, assuming shouldn't problem you. var state = { textbox1:{ x:100, y:200, width:20, height:10, defaultvalue:'hello world!' }, button1:{ x:150, y:200,

How to query a MYSQL database for all values within an array -

i have mysql database with users , activity table. user table containing user info , activity table containing messages users activity on site (similar facebooks news feed). within users table have stored array of friends commas separated string. (friend_list) i trying select using mysql joins messages friends in friends list , current user , order them activity timestamp. i thinking this... $query=mysql_query("select * users,activity users.user=activity.user or //### activity.user equal 1 of users.friend_list array values ### order activity.timestamp")or die(mysql_error()); its tough 1 describe. hope it. i dont know syntax compare activity.user against array of values (users.friend_list) its simple when know how. ideas on fantastic. fix database schema. mysql has no notion of "array of values". should use tables, columns , rows describe data , relationships between entities. you create friends table can store ids of 2 people being frie

overlay - ClearCanvas DICOM - How to create a Tag with a 'VR' of 'OW' -

ok, doing adding new overlay existing dicom file & saving it(the dicom file has 2 overlays). saves without errors & both dicom viewers sante & clearcanvas-workstation open file, sante displays both overlays. when @ tags within dicom file, overlaydata(6000) 'vr' 'ow' & overlaydata(6002) 'vr' 'ob'. problem how create new tag 'vr' of 'ow' because correct 1 use overlaydata. here code i'm using add new overlay dicomfile.dataset:: note, after create overlay write visible pixel data it. void addoverlay() { int newoverlayindex = 0; for(int = 0; != 16; ++i) { if(!dicomfile.dataset.contains(getoverlaytag(i, 0x3000))) { newoverlayindex = i; break; } } //columns uint columnstag = getoverlaytag(newoverlayindex, 0x0011); dicomfile.dataset[columnstag].setu

input - How do I read until the end of file? -

in c, can read input , stop program when reaches end of file ( eof ). so. #include <stdio.h> int main(void) { int a; while (scanf("%d", &a) != eof) printf("%d\n", a); return 0; } how can in lua? the lua documentation features ton of details on file-reading , other io. reading entire file: t = io.read("*all") apparently reads entire file. documentation has examples on reading line-by-line etc. hope helps. example on reading lines of file , numbering each of them (line-by-line): local count = 1 while true local line = io.read() if line == nil break end io.write(string.format("%6d ", count), line, "\n") count = count + 1 end

c# - iTextSharp Paragraph Containing a Table not Written to a Column -

in following code, creating pdfptable, adding paragraph. try add paragraph column. doesn't work. never gets added. if add table directly column, added fine. what doing wrong? (fwiw, simplified version of larger project has elements created in manner.) here code: private void form3_load(object sender, eventargs e) { string pdffile = string.format("{0}{1}.pdf", path.gettemppath(), guid.newguid()); document pdfdoc = new document(); pdfwriter writer = pdfwriter.getinstance(pdfdoc, new filestream(pdffile, filemode.create)); pdfdoc.open(); pdfcontentbyte pcb = writer.directcontent; columntext columns = new columntext(pcb); pdfptable table = createtable(); paragraph para = new paragraph(); para.add(table); columns.addelement(para); columns.setsimplecolumn(0, 0, 72*8, 72*11); columns.go(); pdfdoc.close(); process.start(pdffile); } pri

Python 3.1 and win32api dll not found error -

hello got clean python 3.1.3 install , went latest version of pywin32 module here http://sourceforge.net/projects/pywin32/files/pywin32/ when try to import win32api it gives me error traceback (most recent call last): file "", line 1, in import win32api importerror: dll load failed: no se puede encontrar el módulo especificado. in english last line "the specified module can't found". ideas how pywin32 run on 3.1.3? dll need? edit: fixed see comments below which of files did download , install? need install 1 of installers, , not source file (unless can build it). this can find dll it's trying find: http://www.dependencywalker.com/

java - Service insert more than expected on database -

i'm getting contacts calllog , inserting on database using service contentobserver. so, contentobserver keep watching if new changes happens calllog, , if yes, inside method onchange() calls method data in calllog , insert on database. but, problem that, if make new call, there 1 new data, so, must inserted in database, 1 new row, inserts 3 rows. don't know why. tested on android 2.3 emulator , on emulator ok, on real 2.3 device happens. , in 2.1 emulator happens too. so here code. service posted. thanks! here service myapplicationservice.java public class myapplicationservice extends service { private handler handler = new handler(); private sqlitedatabase db; private openhelper helper; class myapplicationcontentobserver extends contentobserver { public myapplicationcontentobserver(handler h) { super(h); helper = new openhelper(getapplicationcontext()); db = helper.getwritabledatabase(); }

c# - How would I run an async Task<T> method synchronously? -

i'm learning async/await, , ran situation need call async method synchronously. how can that? async method: public async task<customers> getcustomers() { return await service.getcustomersasync(); } normal usage: public async void getcustomers() { customerlist = await getcustomers(); } i've tried using following: task<customer> task = getcustomers(); task.wait() task<customer> task = getcustomers(); task.runsynchronously(); task<customer> task = getcustomers(); while(task.status != taskstatus.rantocompletion) i tried suggestion here , doesn't work when dispatcher in suspended state. public static void waitwithpumping(this task task) { if (task == null) throw new argumentnullexception(“task”); var nestedframe = new dispatcherframe(); task.continuewith(_ => nestedframe.continue = false); dispatcher.pushframe(nestedframe); task.wait(); } here exception , stack trace calling runsy

assembly - memory location calculation -

the question follow : microcomputer has memory locations 00000h fffffh. each memory location stores 1 byte. in decimal, how many bytes can microcomputer store in memory? how many kilobytes this? answer: requires 2 2kbytes of ram , 512 bytes of prom. i try calculate myself before reviewing answer,and find out not same,till still don't understand why answer,anyone may give me help??thanks well, 00000h fffffh, represents 100,000h memory locations, hence 100,000h bytes. 10h^5 (hex) 16^5 (decimal). 16^5 = (2^4)^5 = 2^20 = (1024)^2 = 1 m = 1024 k. conclusion: processor can address 1 megabyte of memory. obviously, less 1 megabyte installed on microcomputer, , not of installed memory ram. can't deduce amount of addressable memory.

crystal reports - SQL code for identifying if there is a new value -

i have crystal report need set produce new page when id number changes. sql code identify when value changes column. column named id , arbitrary set of numbers 0000000 format etc, how can code know when number changes? you don't need sql this. in report, open group expert . group report unique id. see 2 new sections in report design, group footer , group header. open section expert . click on group header access options therein. turn on new page before option.

ruby on rails 3 - Using link_to with routes -

my route: scope "/ajax" resources :companies resources :comments end end so, link_to company.title, company generates such url: /ajax/companies/1 how generate clear url without first /ajax/ part? result want generate companies/(:id) , companies/create , companies/edit/(:id) the obvious answer remove scope '/ajax' do line, have feeling not looking for. maybe put resources line in there again outside of scope block. is ajax module? if so, replace scope :module => 'ajax' do .

ruby on rails - What all exceptions map to 404.html and what exceptions map to 500.html -

i using rails3 , looking list of exceptions show 404.html , list of exceptions map 500.html in production mode. right need add like rescue_from activerecord::recordnotfound, :with => :render_404 in application_controller , don't it. think rails should handle automatically. i'm doing in application controller: rescue_from exception, :with => :handle_error def handle_error(exception) if exceptions_to_treat_as_404.include?(exception.class) render_404 else raise exception if rails.env == 'development' body = exception_error_message(exception) #to logger logger.fatal( body ) #to email = '<errors@peakdemocracy.com>' recipients = "<robert@peakdemocracy.com>" subject = "[error] (#{exception.class}) #{exception.message.inspect}" genericemail.create(:subject => subject, :from => from, :recipients => recipients, :body => body) #to pagerequest table

oop - What fundamental objects are missing in Object Oriented PHP? -

i've been coding php while, , i've been relatively irritated @ inconsistencies in procedural functions (especially strings , arrays). with support objects, i've been wishing php had native implementation of arrays , strings objects write code like: $arr = new array('foo', 'bar'); $item = $arr->pop(); making array-like object isn't overly difficult, however, there's significant performance hit. end being wrapper array constructs anyway. are there other core objects php should have object oriented php? edit add: this not how can use arrays objects; in fact, not want discussion of arrays in answer, that's not question about. used arrays example, , seems no 1 read question. interested in other classes/objects should exist natively in core php. edit: possible in php 6 aoutoboxing automatic conversion compiler makes between primitive (basic) types , corresponding object wrapper classes (eg, array , arrayobject, double

opengl - Incorrect order of matrix values in glm? -

first of all, i'm not expert opengl. started using glm library mathematics operations on opengl 3 , glsl. need orthographic projection draw 2d graphics, writed simple code: glm::mat4 projection(1.0); projection = glm::ortho( 0.0f, 640.0f, 480.0f, 0.0f, 0.0f, 500.0f); printing on screen values glm::ortho has created get: 0.00313 0.00000 0.00000 0.00000 0.00000 -0.00417 0.00000 0.00000 0.00000 0.00000 -0.00200 0.00000 -1.00000 1.00000 -1.00000 1.00000 as know not correct order values in opengl, because multiplying matrix position vector ignore translation values. i tested matrix shader , primitives , blank screen. if modify hand matrix follows works ok: 0.00313 0.00000 0.00000 -1.00000 0.00000 -0.00417 0.00000 1.00000 0.00000 0.00000 -0.00200 -1.00000 0.00000 0.00000 0.00000 1.00000 moreover, looking @ function "ortho" in "glm/gtc/matrix_transform.inl" file: template <typename valtype> inli

c++ - Integer division algorithm -

i thinking algorithm in division of large numbers: dividing remainder bigint c bigint d, know representation of c in base b, , d of form b^k-1. it's easiest show on example. let's try dividing c=21979182173 d=999. we write number sets of 3 digits: 21 979 182 173 we take sums (modulo 999) of consecutive sets, starting left: 21 001 183 356 we add 1 sets preceding ones "went on 999": 22 001 183 356 indeed, 21979182173/999=22001183 , remainder 356. i've calculated complexity and, if i'm not mistaken, algorithm should work in o(n), n being number of digits of c in base b representation. i've done crude , unoptimized version of algorithm (only b=10) in c++, tested against gmp's general integer division algorithm , seem fare better gmp. couldn't find implemented anywhere looked, had resort testing against general division. i found several articles discuss seem quite similar matters, none of them concentrate on actual implementations, in ba

Throw away local commits in git -

due bad cherry-picking, local git repository 5 commits ahead of origin, , not in state. want rid of these commits , start on again. obviously, deleting working directory , re-cloning it, downloading github again seems overkill, , not use of time. maybe git revert need, don't want end 10 commits ahead of origin (or 6), if code right state. want pretend last half-hour never happened. is there simple command this? seems obvious use case, i'm not finding examples of it. if excess commits visible you, can git reset --hard origin/<branch_name> move origin is. doing git revert makes new commits remove old commits in way keeps everyone's history sane.

c# - WPF: ControlTemplate vs Style that Changes Template -

inside app.xaml may have: <style targettype="{x:type button}" x:key="roundbutton"> <setter property="template"> <setter.value> <controltemplate target="{x:type button}"> bla bla bla... </controltemplate> </setter.value> </setter> </style> vs. going <controltemplate target="{x:type button}" x:key="roundbutton"> bla bla bla... </controltemplate> i'm confused, should use / what's difference? using style change other values of button @ same time. using controltemplate can change template. appropriate?

Trying to install DBD::mysql using macports mysql and perl fails make test [Snow Leopard] -

i have installed mysql5 , perl5 through macports in order try , subvert earlier issue of running perl script architecture discrepancies (introduced of osx10.6). downloaded dbd::mysql package , seek manually install it. perl makefile works well, make. make test, however, yields following: perl_dl_nonlazy=1 /opt/local/bin/perl5 "-mextutils::command::mm" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/00base....................ok 1/6 # failed test 'use dbd::mysql;' # @ t/00base.t line 21. # tried use 'dbd::mysql'. # error: can't load '/users/ianseyer/downloads/dbd-mysql- 4.011/blib/arch/auto/dbd/mysql/mysql.bundle' module dbd::mysql: dlopen(/users/ianseyer/downloads/dbd-mysql-4.011/blib/arch/auto/dbd/mysql/mysql.bundle, 2): symbol not found: _is_prefix # referenced from: /users/ianseyer/downloads/dbd-mysql- 4.011/blib/arc

c# - Is my approach to Winforms coding old-school -

the project i'm working on quite large , have framework developed building simple ui screens easily. 2 fundamental types have search (search parameters + grid of results) , detail (a set of editors populated model object). the application c# .net winforms. in detail have following process. load - populate edit controls based on appropriate model object. invoked prior detail being shown user clicks ok validate - validates detail ensure consistent accept - copy updated control values model this works nicely simple stuff in more complex cases i've noticed perhaps above approach not smoothest. the more complex cases mentioned above when detail represents model object , there grid embedded in detail holds 'child' objects can added , removed. typically want launch child detail , pass in parent model object, not populated/up date @ point because happens when ok clicked. find myself working round in annoying fashion leads me following question. at h

iphone - How to create a static delegate from main-viewcontroller? -

hope can me on learning new stuff delegates in ios-programming. i have "mainviewcontroller" first vc when app starts. i´ve kind of modelselection different uiimageviews , after choosing 1 of them, i´m pushing new vc. want handle modelchoice delegate, other viewcontrollers can listen , act based on users choice. but mean have alloc new instance of "mainviewcontroller" in every vc? whats solution on that? how create (i think called) static delegate? would great learn that.. sharing.. you can make mainviewcontroller singleton class: static mainviewcontroller* ctrl = nil; +(mainviewcontroller*) sharedinstance { @synchronized( ctrl ) { if( !ctrl ) { ctrl = [[mainviewcontroller alloc] init]; } } return ctrl; } then can access class this: [mainviewcontroller sharedinstance]. you can add method mainviewcontroller like: -(void) addlistener:(nsobject<listenerprotocol>*) listener; and when you're creati

c# - Fast and Responsive GridView for data acquisition? -

my use case log millions of messages customizable grid gui (e.g. similar features of devexpress , telerik's win form datagrids). since should used logs specific hardware i'm forced use storage file or flat database (excluded sql&co) the gridview shall customizable , fast on inserting new rows , when grouping/filtering/formatting. these operations need done while grid collects data on pace of ~1000 events/second. does used 1 of these grids specific purpose? recommend? thanks ps: after rough test, telerik's grid looks have better performance. you can work datagridview , using virtualmode . but there subtle things have check performance out of it. these questions best performance answered in datagridview faq . read out of it.

android - multiplayer game using surfaceview for drawing and bluetooth for multiplayer (performance) -

i'am building game android. game works using same architecture google's lunar lander. studied bluetooth api , bluetooth chat app. make game can played 2 devices ageanst each other using bluetooth. i'am making pong style game. have ball , 2 paddles. 1 each player. i'am using thread updating game , redering surfaceview. i'am using thread sending position of paddle other device. game runs @ 50 fps. means 50 writes on bluetooth. method works, there huge delays... how should improve bluetooth performance? type of input , outputstream shoud use? kind regards you shouldn't rely on connection good, expect variable delays. you need kind of time synchronization , , timestamp events when other side late, can calculate ball should @ moment, , game stays in sync. as understand it, minimum should send/timestamp pallet position while hits ball and/or outgoing vector of ball, on other device can calculate on own happen until hits ball en same. pallet upd

sockets - .PY into .EXE Python 2.6 -

i'm trying convert .py script .exe file, in process have tried py2exe following command line.. python c:\users\noob\desktop\setup.py py2exe -p ftplib -> -p ftplib module import. when use code, i'm left .exe , bunch of files, if take .exe out come error. required have "_socket.pyd" , "python26.dll" or crash (the program). how compile (not having use py2exe or having use it) without these files? lot! you should not taking exe out of folder , executing. execute dist directory got created, has python26.dll executable needs. if want ship it, zip dist directory , ship it. otherwise have create installer using specific installer software nsis. hope took @ python2.6 specific section , has details on how write data_files include msvcr90.dll also, finding -p ftplib cmd option pretty new. things within setup.py. can point out kind of option specification mentioned.

actionscript 3 - Switching of depths causes duplication of MC -

this repost of previous question more info time. the files: 2shared.com/file/hrkheiqh/script_test.html , 2shared.com/video/uznmqzxt/a_anconeus.html this issue reproducible on machine new .fla project in actionscript 3.0 in flash professional cs5. it's edit of original question more information. i'm working on project load external swf's , search through instance names matching keywords, namely 'drag' , 'drop' identify movieclip matches, attach event listeners these mc's contain d&d event listeners , code. the specific problem switching of depths movieclips nested in dynamically loaded external swf files. where having trouble specific commands: swapchildrenat, setchildindex, swapchildren, removechild/addchild. i've tried 4 same problem of duplication. let me explain. when draggable mc clicked, moved top index of dynamically loaded swf it's visible above else in swf. problem trying of these commands duplicate mc. happens this

WPF Custom Control - Binding a template item to a Path -

in wpf custom control template, there way can following in xaml?: var selitemtext = this.gettemplatechild("part_selecteditemtext") textblock; var binding = new binding("selecteditem." + displaymemberpath); binding.relativesource = new relativesource(relativesourcemode.templatedparent); selitemtext .setbinding(textblock.textproperty, binding); note interesting part of statement binding constructor - building path based on both text specify ("selecteditem."), , path provided user. the consumer use control similar to: <c:mycontrol displaymemberpath="description" /> short answer: no, it's not possible entirely in xaml within controltemplate your possibilities are: use have (possibly using attached properties / behavior make more mvvm-like) use multibinding 1 binding "selecteditem" other "displaymemberpath" , multivalueconverter using reflection reflect down displaymemberpath (may bit ugly) cre

In Ruby on Rails, what does authenticate_with_http_basic do? -

restful authentication uses authenticate_with_http_basic , search on net can find many pages no description. on official http://api.rubyonrails.org/ , can found, except again there no description, no comment, no spec. what do? seems able use login_name , password http request , can compared login_name , encrypted_password in users table... case, why aren't there 1-line description? this method allows implement basic http authentication (the kind little dialog box pops asking username , password). it's great way limit access development site or admin area. example: class admincontroller < applicationcontroller before_filter :authenticate def authenticate authenticate_or_request_with_http_basic('administration') |username, password| username == 'admin' && password == 'password' end end end this function either make request basic http authentication username , password, or after has been entered, che

compiler construction - Program Dependence Graphs (PDG) -

i new llvm , need analyse program(control flow , data flow analysis).i couldn't found pdg or task graph in llvm. can me? a developer have implemented generating pdg using llvm project: https://github.com/dengminghua/llvm-program-dependency-graph-generator

connection - php pgadmin remote db connect failure -

i want connect remote database php postgres not connect , says warning: pg_connect() [function.pg-connect]: unable connect postgresql server: not connect server: no route host (0x00002751/10065) server running on host "xxxxxxxxx" , accepting tcp/ip connections on port 5432? in c:\xampp\htdocs\test.php on line 4 wrong conn_string <html> <body> <?php $db = pg_connect('host=xxx.xxx.xxx.xxx port=5432 dbname=postgres user=postgres password=') or die('wrong conn_string'); if (!$db) { echo 'error'; }else{ echo 'success'; } ?> </body> the same database can access pgadmin client running on same machine apache running, not understand pgadmin can access db apache webserver's php not access ? idea ? "no route host" tells there kind of networking problem - fact different client able access same

html - design issues in IE 7 -

Image
hi ,this html <div style="width:220px;float:left;" id="radio_text"> <ul style="width:20px;float:left;display:block;"> <li style="list-style:none;line-height:13px;height:13px;float:left;"><input type="radio" name="radio_flag" checked="true" /></li> <li style="list-style:none;line-height:13px;height:13px;float:left;"><input type="radio" name="radio_flag" /></li> <li style="list-style:none;line-height:13px;height:13px;float:left;"><input type="radio" name="radio_flag" /></li> </ul> <ul style="width:200px;float:left;"> <li style="list-style:none;line-height:13px;height:13px;width: 200px;float:left;">show all</li> <li style="list-style:none;line-height:13px;height:13px;width: 200px;float:l

apache - Problem authentication django -

i have problem of authentication django. the first time after restarting server works fine, after time of work (several hours) authentication not work: when log admin area gives "it seems browser not configured accept cookies. please enable cookies, reload page , try again. " cookies enabled, of course. after server restart worked again (some time). tried , apache + mod_wsgi , nginx + fastcgi: problem everywhere. locally on development server (runserver) works fine. may problem? here discussion how cookie problem in admin solved, in mod_python though give idea.

c - Is there any libc project that does not requires linux kernel -

i using custom user space environment has barely no os support: 1 char device, mass storage interface , single network socket. to provide c programming platform, need libc. there libc project configurable enough can map low-level io small api have access ? afaik glibc , uclibc expecting linux syscalls, can't use them (without trying emulate linux syscalls, prefer avoid). there several different libc's choose from, need work integrate system. uclibc has list of other c libraries. interesting ones on list dietlibc newlib freedos has libc eglibc might simpler port "standard" glibc.